优化号主交接超时卡死问题

- 号主交接超时(owner_timeout)后允许补提交交接说明,避免临时延误导致订单卡死
- 后台新增"重置交接"动作,可将超时订单恢复为待号主交接并刷新计时
- 交接超时改以进入待交接时刻为基准计算,新增 handoff_started_at 字段

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
yml2213
2026-06-17 04:16:31 +08:00
co-authored by Claude Opus 4.8
parent ae11dd7b8d
commit 8192344027
13 changed files with 140 additions and 23 deletions
@@ -9,6 +9,7 @@ import {
adminMarkOrderAbnormal,
adminRefundOrder,
adminRefundStatus,
adminResetHandoff,
fetchAdminHandoffRecords,
fetchAdminOrder,
type HandoffRecord,
@@ -28,7 +29,7 @@ const submitting = ref(false)
const order = ref<Order | null>(null)
const handoffRecords = ref<HandoffRecord[]>([])
const paymentRecords = ref<AdminPayment[]>([])
const actionType = ref<'close' | 'abnormal' | ''>('')
const actionType = ref<'close' | 'abnormal' | 'reset' | ''>('')
const reason = ref('')
const refundStatus = ref<RefundStatus | null>(null)
const listingCode = computed(() =>
@@ -37,10 +38,20 @@ const listingCode = computed(() =>
const refunding = ref(false)
const snapshotText = computed(() => JSON.stringify(order.value?.account_snapshot || {}, null, 2))
const actionTitle = computed(() => (actionType.value === 'close' ? '客服关闭订单' : '标记订单异常'))
const actionTitle = computed(() => {
if (actionType.value === 'close') return '客服关闭订单'
if (actionType.value === 'reset') return '重置交接(给号主再次机会)'
return '标记订单异常'
})
const canOperate = computed(
() => !!order.value && !['completed', 'cancelled', 'closed'].includes(order.value.status)
)
const canResetHandoff = computed(
() =>
!!order.value &&
order.value.status === 'pending_handoff' &&
order.value.handoff_status === 'owner_timeout'
)
onMounted(loadOrder)
@@ -64,7 +75,7 @@ async function loadRefundStatus() {
}
}
function openAction(type: 'close' | 'abnormal') {
function openAction(type: 'close' | 'abnormal' | 'reset') {
actionType.value = type
reason.value = ''
}
@@ -76,6 +87,9 @@ async function submitAction() {
if (actionType.value === 'close') {
await adminCloseOrder(order.value.id, reason.value)
ElMessage.success('订单已关闭')
} else if (actionType.value === 'reset') {
await adminResetHandoff(order.value.id, reason.value)
ElMessage.success('交接已重置,等待号主重新提交')
} else {
await adminMarkOrderAbnormal(order.value.id, reason.value)
ElMessage.success('订单已标记异常')
@@ -197,6 +211,9 @@ function formatHandoffRecordType(type: string) {
<RouterLink :to="adminPath('orders')">
<el-button>返回列表</el-button>
</RouterLink>
<el-button v-if="canResetHandoff" type="success" @click="openAction('reset')"
>重置交接</el-button
>
<el-button type="warning" :disabled="!canOperate" @click="openAction('abnormal')"
>标记异常</el-button
>