feat: 订单详情展示退款流水号并支持人工核实退款
- 支付卡片显示退款单号、退款流水号、失败原因与退款状态 - 人工核实退款弹窗改为双按钮:确认已退款(可填流水号)/ 确认未退款 - refundManual 接口支持传入退款流水号
This commit is contained in:
+2
-1
@@ -50,9 +50,10 @@ export const escortApi = {
|
||||
{ method: 'POST' }
|
||||
),
|
||||
|
||||
refundManual: (id: string) =>
|
||||
refundManual: (id: string, refundNo?: string) =>
|
||||
request<{ record: EscortRecord }>(`/health/escort-record/${id}/refund/manual`, {
|
||||
method: 'POST',
|
||||
body: { refundNo: refundNo || '' },
|
||||
}),
|
||||
|
||||
refundRetry: (id: string) =>
|
||||
|
||||
@@ -89,6 +89,8 @@ export type EscortRecord = {
|
||||
payChannel?: string
|
||||
paymentRecordId?: string | null
|
||||
status?: string
|
||||
refundNo?: string
|
||||
refundedAt?: string | null
|
||||
}
|
||||
paymentWindowEnd?: string | null
|
||||
notes?: {
|
||||
@@ -214,6 +216,18 @@ export type PaymentStatusResult = {
|
||||
prepayExpiresAt: string | null
|
||||
timeExpireAt: string | null
|
||||
}
|
||||
refund?: null | {
|
||||
outRefundNo: string
|
||||
refundId: string
|
||||
status: string
|
||||
refundAmount: number
|
||||
successTime: string | null
|
||||
lastError?: null | {
|
||||
code: string
|
||||
message: string
|
||||
at: string | null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type QrLoginResult = {
|
||||
|
||||
+53
-13
@@ -65,9 +65,9 @@
|
||||
v-if="record.payment?.status === 'refunding'"
|
||||
variant="danger"
|
||||
:disabled="actionLoading"
|
||||
@click="manualRefundVisible = true"
|
||||
@click="openManualRefund"
|
||||
>
|
||||
人工核销退款
|
||||
人工核实退款
|
||||
</BButton>
|
||||
<BButton variant="outline-danger" :disabled="actionLoading" @click="deleteVisible = true">删除订单</BButton>
|
||||
</div>
|
||||
@@ -227,6 +227,14 @@
|
||||
<hr class="border-dashed my-3" />
|
||||
<p class="text-muted mb-1 fs-12">支付流水ID</p>
|
||||
<p class="mb-0 text-break fs-12">{{ record.payment?.paymentRecordId || '-' }}</p>
|
||||
<template v-if="outRefundNoDisplay || refundNoDisplay">
|
||||
<p v-if="outRefundNoDisplay" class="text-muted mb-0 fs-12 mt-1">退款单号:{{ outRefundNoDisplay }}</p>
|
||||
<p v-if="refundNoDisplay" class="text-muted mb-0 fs-12 mt-1">退款流水号:{{ refundNoDisplay }}</p>
|
||||
</template>
|
||||
<p v-if="refundErrorText && record.payment?.status !== 'refunded'" class="text-danger mb-0 fs-12 mt-1 text-break">
|
||||
退款失败原因:{{ refundErrorText }}
|
||||
</p>
|
||||
<p v-if="refundStatusLabel" class="text-danger mb-0 fs-12 mt-1">退款状态:{{ refundStatusLabel }}</p>
|
||||
<p v-if="record.paymentWindowEnd" class="text-muted mb-0 fs-12 mt-2">
|
||||
支付截止:{{ formatDateTime(record.paymentWindowEnd) }}
|
||||
</p>
|
||||
@@ -342,16 +350,18 @@
|
||||
</BFormGroup>
|
||||
</BModal>
|
||||
|
||||
<ConfirmModal
|
||||
v-model="manualRefundVisible"
|
||||
title="人工核销退款"
|
||||
ok-title="确认已退款"
|
||||
ok-variant="danger"
|
||||
@confirm="submitManualRefund"
|
||||
>
|
||||
<p class="mb-1">请确认已通过线下渠道完成退款,再执行核销。</p>
|
||||
<p class="text-muted mb-0 fs-12">核销后订单支付状态将变为「已退款」,且不可撤销。</p>
|
||||
</ConfirmModal>
|
||||
<BModal v-model="manualRefundVisible" title="人工核实退款" centered>
|
||||
<p class="mb-1">请先核实该订单的退款结果(线上退款查微信支付商户平台,线下退款与收款方确认),再选择对应操作。</p>
|
||||
<p class="text-muted mb-0 fs-12">确认已退款:订单支付状态置为「已退款」,不可撤销。</p>
|
||||
<p class="text-muted mb-0 fs-12">确认未退款:订单保持「退款中」,可稍后尝试再次退款。</p>
|
||||
<BFormGroup label="退款流水号" label-for="manualRefundNo" class="mb-0 mt-3">
|
||||
<BFormInput id="manualRefundNo" v-model="manualRefundNo" placeholder="选填,如微信退款单号" />
|
||||
</BFormGroup>
|
||||
<template #footer>
|
||||
<BButton variant="light" :disabled="actionLoading" @click="confirmNotRefunded">确认未退款</BButton>
|
||||
<BButton variant="danger" :disabled="actionLoading" @click="submitManualRefund">确认已退款</BButton>
|
||||
</template>
|
||||
</BModal>
|
||||
|
||||
<ConfirmModal
|
||||
v-model="retryRefundVisible"
|
||||
@@ -424,6 +434,7 @@ const paymentVisible = ref(false)
|
||||
const paymentForm = reactive({ method: 'offline_cash', amount: 0 })
|
||||
|
||||
const manualRefundVisible = ref(false)
|
||||
const manualRefundNo = ref('')
|
||||
const retryRefundVisible = ref(false)
|
||||
const deleteVisible = ref(false)
|
||||
|
||||
@@ -432,6 +443,25 @@ const sexRequirementLabel = computed(() => {
|
||||
return map[record.value?.escort?.sexRequirement || 'none'] || '不限'
|
||||
})
|
||||
|
||||
const refundNoDisplay = computed(
|
||||
() => record.value?.payment?.refundNo || payInfo.value?.refund?.refundId || ''
|
||||
)
|
||||
|
||||
const outRefundNoDisplay = computed(() => payInfo.value?.refund?.outRefundNo || '')
|
||||
|
||||
const refundErrorText = computed(() => {
|
||||
const err = payInfo.value?.refund?.lastError
|
||||
if (!err?.message) return ''
|
||||
return err.code ? `${err.message}(${err.code})` : err.message
|
||||
})
|
||||
|
||||
const refundStatusLabel = computed(() => {
|
||||
const status = payInfo.value?.refund?.status
|
||||
if (status === 'abnormal') return '异常,需人工处理'
|
||||
if (status === 'closed') return '已关闭'
|
||||
return ''
|
||||
})
|
||||
|
||||
const canRecordOffline = computed(() => {
|
||||
if (!record.value) return false
|
||||
return record.value.payment?.status === 'unpaid'
|
||||
@@ -563,11 +593,21 @@ const submitRetryRefund = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const openManualRefund = () => {
|
||||
manualRefundNo.value = payInfo.value?.refund?.refundId || ''
|
||||
manualRefundVisible.value = true
|
||||
}
|
||||
|
||||
const confirmNotRefunded = () => {
|
||||
manualRefundVisible.value = false
|
||||
notify.info('已确认未退款,订单保持退款中,可稍后尝试再次退款')
|
||||
}
|
||||
|
||||
const submitManualRefund = async () => {
|
||||
if (!record.value) return
|
||||
actionLoading.value = true
|
||||
try {
|
||||
await escortApi.refundManual(record.value._id)
|
||||
await escortApi.refundManual(record.value._id, manualRefundNo.value.trim())
|
||||
notify.success('退款已核销')
|
||||
manualRefundVisible.value = false
|
||||
await load()
|
||||
|
||||
Reference in New Issue
Block a user