修复仲裁退款并新增免押额度
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
|
||||
import { arbitrateDispute, fetchAdminDisputes, type Dispute } from '@/features/disputes'
|
||||
import { fetchAdminFileBlob } from '@/shared/api/files'
|
||||
@@ -20,6 +20,13 @@ const amount = ref<number | undefined>()
|
||||
const currentPage = ref(1)
|
||||
const currentPageSize = ref(20)
|
||||
const total = ref(0)
|
||||
const isPartialRefund = computed(() => result.value === 'partial_refund')
|
||||
const canSubmitArbitration = computed(() => {
|
||||
if (submitting.value || !activeDispute.value) return false
|
||||
if (!result.value || !remark.value.trim()) return false
|
||||
if (isPartialRefund.value && (!amount.value || amount.value <= 0)) return false
|
||||
return true
|
||||
})
|
||||
|
||||
onMounted(loadDisputes)
|
||||
|
||||
@@ -79,11 +86,20 @@ async function openEvidence(url: string) {
|
||||
|
||||
async function handleArbitrate() {
|
||||
if (!activeDispute.value) return
|
||||
if (submitting.value) return
|
||||
if (!remark.value.trim()) {
|
||||
ElMessage.warning('请填写客服裁决说明')
|
||||
return
|
||||
}
|
||||
if (isPartialRefund.value && (!amount.value || amount.value <= 0)) {
|
||||
ElMessage.warning('请填写部分退款金额')
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await arbitrateDispute(activeDispute.value.id, {
|
||||
result: result.value,
|
||||
remark: remark.value,
|
||||
remark: remark.value.trim(),
|
||||
amount: amount.value,
|
||||
})
|
||||
ElMessage.success('仲裁结果已保存,双方已收到通知')
|
||||
@@ -205,8 +221,12 @@ function readError(error: unknown, fallback: string) {
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="activeDispute = null">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleArbitrate"
|
||||
<el-button :disabled="submitting" @click="activeDispute = null">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="submitting"
|
||||
:disabled="!canSubmitArbitration"
|
||||
@click="handleArbitrate"
|
||||
>保存裁决</el-button
|
||||
>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user