优化申诉仲裁流程和证据展示
This commit is contained in:
@@ -4,7 +4,7 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import { showToast, showDialog } from 'vant'
|
||||
|
||||
import { fetchOrderChat } from '@/features/chats/api/chats'
|
||||
import { createDispute } from '@/features/disputes/api/disputes'
|
||||
import { cancelOrderDispute, createDispute } from '@/features/disputes/api/disputes'
|
||||
import { uploadFile } from '@/shared/api/files'
|
||||
import { readError } from '@/shared/utils/error'
|
||||
import {
|
||||
@@ -57,6 +57,7 @@ const countering = ref(false)
|
||||
const acceptingCheckout = ref(false)
|
||||
const rejectingCheckout = ref(false)
|
||||
const disputing = ref(false)
|
||||
const cancellingDispute = ref(false)
|
||||
const uploadingEvidence = ref(false)
|
||||
const openingChat = ref(false)
|
||||
const order = ref<Order | null>(null)
|
||||
@@ -127,6 +128,14 @@ const canOpenDispute = computed(() => {
|
||||
'abnormal',
|
||||
].includes(order.value.status)
|
||||
})
|
||||
const canCancelDispute = computed(() => {
|
||||
return (
|
||||
!!order.value &&
|
||||
(isOwner.value || isRenter.value) &&
|
||||
['disputing', 'checkout_disputing'].includes(order.value.status) &&
|
||||
order.value.active_dispute?.initiator_id === session.userId
|
||||
)
|
||||
})
|
||||
const isCheckoutDisputeStage = computed(() => {
|
||||
return (
|
||||
!!order.value &&
|
||||
@@ -384,6 +393,26 @@ async function handleCreateDispute() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCancelDispute() {
|
||||
if (!order.value) return
|
||||
showDialog({
|
||||
title: order.value.status === 'checkout_disputing' ? '取消结账争议' : '取消申诉',
|
||||
message: '取消后订单将恢复到发起申诉前的流程,确定继续吗?',
|
||||
showCancelButton: true,
|
||||
}).then(async () => {
|
||||
cancellingDispute.value = true
|
||||
try {
|
||||
await cancelOrderDispute(order.value!.id)
|
||||
showToast({ message: '申诉已取消,订单已恢复', icon: 'passed' })
|
||||
await loadOrder()
|
||||
} catch (error) {
|
||||
showToast({ message: readError(error, '取消申诉失败'), icon: 'cross' })
|
||||
} finally {
|
||||
cancellingDispute.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function handleEvidenceUpload(event: Event) {
|
||||
const input = event.target as HTMLInputElement
|
||||
const file = input.files?.[0]
|
||||
@@ -731,6 +760,20 @@ async function copyListingCode() {
|
||||
</van-button>
|
||||
</section>
|
||||
|
||||
<section v-if="canCancelDispute" class="card-section action-card">
|
||||
<van-button
|
||||
type="warning"
|
||||
block
|
||||
plain
|
||||
round
|
||||
:loading="cancellingDispute"
|
||||
loading-text="取消中..."
|
||||
@click="handleCancelDispute"
|
||||
>
|
||||
{{ order.status === 'checkout_disputing' ? '取消结账争议' : '取消申诉' }}
|
||||
</van-button>
|
||||
</section>
|
||||
|
||||
<!-- Snapshot Account Details Accordion -->
|
||||
<section class="card-section">
|
||||
<van-collapse v-model="activeNames">
|
||||
|
||||
Reference in New Issue
Block a user