订单操作增加二次确认
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { readError } from '@/shared/utils/error'
|
import { readError } from '@/shared/utils/error'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
@@ -75,6 +75,9 @@ const actionTitle = computed(() => {
|
|||||||
if (actionType.value === 'reset') return `${resetActionLabel.value}(恢复到对应待办)`
|
if (actionType.value === 'reset') return `${resetActionLabel.value}(恢复到对应待办)`
|
||||||
return '标记订单异常'
|
return '标记订单异常'
|
||||||
})
|
})
|
||||||
|
const closeActionTip = '关闭订单并归档商品/账号;已支付订单会按租金+实付押金全量原路退款。'
|
||||||
|
const refundActionTip = '仅发起后台人工全量原路退款,不关闭订单或调整商品/账号状态。'
|
||||||
|
const refundButtonDisabled = computed(() => refundStatus.value?.refund_status === 'refunded')
|
||||||
|
|
||||||
onMounted(loadOrder)
|
onMounted(loadOrder)
|
||||||
|
|
||||||
@@ -103,6 +106,24 @@ function openAction(type: 'close' | 'abnormal' | 'reset') {
|
|||||||
reason.value = ''
|
reason.value = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function confirmCloseAction() {
|
||||||
|
if (!order.value || !canOperate.value) return
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
'客服关闭会终止订单,归档关联商品和账号;若订单已支付,将按租金加实付押金发起全量原路退款。确认继续?',
|
||||||
|
'确认客服关闭',
|
||||||
|
{
|
||||||
|
confirmButtonText: '继续关闭',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
openAction('close')
|
||||||
|
}
|
||||||
|
|
||||||
async function submitAction() {
|
async function submitAction() {
|
||||||
if (!order.value || !actionType.value) return
|
if (!order.value || !actionType.value) return
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
@@ -162,6 +183,26 @@ async function handleRefund() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function confirmRefund() {
|
||||||
|
if (!order.value || refundButtonDisabled.value) return
|
||||||
|
const hasRefundInProgress = ['pending', 'refunding'].includes(
|
||||||
|
refundStatus.value?.refund_status || ''
|
||||||
|
)
|
||||||
|
const message = hasRefundInProgress
|
||||||
|
? '当前订单已有退款处理中,继续人工退款可能导致重复全量退款。确认仍要发起?'
|
||||||
|
: '人工退款只会发起全量原路退款,不会关闭订单或调整商品状态。请确认该订单确实需要补发全额退款。'
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(message, '确认人工退款', {
|
||||||
|
confirmButtonText: '确认退款',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await handleRefund()
|
||||||
|
}
|
||||||
|
|
||||||
function refundStatusLabel(status: string) {
|
function refundStatusLabel(status: string) {
|
||||||
const map: Record<string, string> = {
|
const map: Record<string, string> = {
|
||||||
pending: '待退款',
|
pending: '待退款',
|
||||||
@@ -246,17 +287,25 @@ function formatHandoffRecordType(type: string) {
|
|||||||
<el-button type="warning" :disabled="!canOperate" @click="openAction('abnormal')"
|
<el-button type="warning" :disabled="!canOperate" @click="openAction('abnormal')"
|
||||||
>标记异常</el-button
|
>标记异常</el-button
|
||||||
>
|
>
|
||||||
<el-button type="danger" :disabled="!canOperate" @click="openAction('close')"
|
<el-tooltip :content="closeActionTip" placement="top">
|
||||||
|
<span>
|
||||||
|
<el-button type="danger" :disabled="!canOperate" @click="confirmCloseAction"
|
||||||
>客服关闭</el-button
|
>客服关闭</el-button
|
||||||
>
|
>
|
||||||
|
</span>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip :content="refundActionTip" placement="top">
|
||||||
|
<span>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:loading="refunding"
|
:loading="refunding"
|
||||||
:disabled="refundStatus?.refund_status === 'refunded'"
|
:disabled="refundButtonDisabled"
|
||||||
@click="handleRefund"
|
@click="confirmRefund"
|
||||||
>
|
>
|
||||||
{{ refundStatus?.refund_status === 'refunded' ? '已退款' : '人工退款' }}
|
{{ refundButtonDisabled ? '已退款' : '人工退款' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user