撞车订单新增「接待中」状态,支持后台接待标记
已支付订单可标记为接待中,避免重复跟进;完成/取消覆盖接待中状态,前后台同步展示与筛选。
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
completeAdminMohongOrder,
|
||||
fetchAdminMohongOrders,
|
||||
mohongOrderStatusLabel,
|
||||
receiveAdminMohongOrder,
|
||||
type MohongOrder,
|
||||
} from '@/features/mohong/api/mohong'
|
||||
import { formatCent } from '@/shared/utils/money'
|
||||
@@ -43,6 +44,19 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleReceive(row: MohongOrder) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认接待订单 ${row.order_no}?标记后状态变为「接待中」。`, '提示', {
|
||||
type: 'info',
|
||||
})
|
||||
await receiveAdminMohongOrder(row.id)
|
||||
ElMessage.success('已标记为接待中')
|
||||
await load()
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') ElMessage.error(readError(error, '操作失败'))
|
||||
}
|
||||
}
|
||||
|
||||
async function handleComplete(row: MohongOrder) {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认将订单 ${row.order_no} 标记为已完成?`, '提示', {
|
||||
@@ -71,6 +85,20 @@ async function handleCancel(row: MohongOrder) {
|
||||
}
|
||||
}
|
||||
|
||||
function canReceive(row: MohongOrder) {
|
||||
return row.status === 'paid'
|
||||
}
|
||||
|
||||
function canComplete(row: MohongOrder) {
|
||||
return row.status === 'paid' || row.status === 'receiving'
|
||||
}
|
||||
|
||||
function canCancel(row: MohongOrder) {
|
||||
return (
|
||||
row.status === 'pending_payment' || row.status === 'paid' || row.status === 'receiving'
|
||||
)
|
||||
}
|
||||
|
||||
async function copyText(text: string) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
@@ -86,7 +114,7 @@ async function copyText(text: string) {
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<h2>撞车订单</h2>
|
||||
<p>查看订单、完成履约、复制用户订单信息</p>
|
||||
<p>查看订单、接待买家、完成履约、复制用户订单信息</p>
|
||||
</div>
|
||||
<el-button :icon="Refresh" @click="load">刷新</el-button>
|
||||
</div>
|
||||
@@ -96,6 +124,7 @@ async function copyText(text: string) {
|
||||
<el-select v-model="status" clearable placeholder="状态" style="width: 140px">
|
||||
<el-option label="待支付" value="pending_payment" />
|
||||
<el-option label="已支付" value="paid" />
|
||||
<el-option label="接待中" value="receiving" />
|
||||
<el-option label="已完成" value="completed" />
|
||||
<el-option label="已取消" value="cancelled" />
|
||||
</el-select>
|
||||
@@ -121,23 +150,16 @@ async function copyText(text: string) {
|
||||
<el-table-column label="下单时间" min-width="160">
|
||||
<template #default="{ row }">{{ formatDateTime(row.created_at) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="220" fixed="right">
|
||||
<el-table-column label="操作" width="260" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="detail = row">详情</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'paid'"
|
||||
link
|
||||
type="success"
|
||||
@click="handleComplete(row)"
|
||||
>
|
||||
<el-button v-if="canReceive(row)" link type="warning" @click="handleReceive(row)">
|
||||
接待
|
||||
</el-button>
|
||||
<el-button v-if="canComplete(row)" link type="success" @click="handleComplete(row)">
|
||||
完成
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'pending_payment' || row.status === 'paid'"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleCancel(row)"
|
||||
>
|
||||
<el-button v-if="canCancel(row)" link type="danger" @click="handleCancel(row)">
|
||||
取消
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
@@ -263,6 +263,14 @@ export async function fetchAdminMohongOrder(id: number | string) {
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function receiveAdminMohongOrder(id: number, remark?: string) {
|
||||
const { data } = await apiClient.post<ApiResponse<MohongOrder>>(
|
||||
`/admin/crash/orders/${id}/receive`,
|
||||
{ remark: remark || '' }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function completeAdminMohongOrder(id: number, remark?: string) {
|
||||
const { data } = await apiClient.post<ApiResponse<MohongOrder>>(
|
||||
`/admin/crash/orders/${id}/complete`,
|
||||
@@ -293,6 +301,7 @@ export function mohongOrderStatusLabel(status: string) {
|
||||
const map: Record<string, string> = {
|
||||
pending_payment: '待支付',
|
||||
paid: '已支付',
|
||||
receiving: '接待中',
|
||||
completed: '已完成',
|
||||
cancelled: '已取消',
|
||||
refunded: '已退款',
|
||||
|
||||
@@ -157,6 +157,11 @@ async function loadOrders() {
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
.status-tag.receiving {
|
||||
background: #fff7ed;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.status-tag.completed {
|
||||
background: #eff6ff;
|
||||
color: #2563eb;
|
||||
|
||||
@@ -67,6 +67,7 @@ const statusTabs = [
|
||||
{ key: 'pending_handoff', label: '待交接' },
|
||||
{ key: 'renting', label: '使用中' },
|
||||
{ key: 'paid', label: '已支付' },
|
||||
{ key: 'receiving', label: '接待中' },
|
||||
{ key: 'pending_checkout_confirm', label: '待结账' },
|
||||
{ key: 'completed', label: '已完成' },
|
||||
{ key: 'cancelled', label: '已取消' },
|
||||
@@ -638,6 +639,10 @@ async function copyListingCode(order: Order) {
|
||||
color: #1477ff;
|
||||
background: rgba(20, 119, 255, 0.08);
|
||||
}
|
||||
.badge-receiving {
|
||||
color: #d97706;
|
||||
background: rgba(217, 119, 6, 0.1);
|
||||
}
|
||||
.badge-completed {
|
||||
color: #10b981;
|
||||
background: rgba(16, 185, 129, 0.08);
|
||||
|
||||
@@ -51,6 +51,7 @@ const statusTabs = [
|
||||
{ key: 'pending_handoff', label: '待交接' },
|
||||
{ key: 'renting', label: '使用中' },
|
||||
{ key: 'paid', label: '已支付' },
|
||||
{ key: 'receiving', label: '接待中' },
|
||||
{ key: 'pending_checkout_confirm', label: '待结账' },
|
||||
{ key: 'completed', label: '已完成' },
|
||||
{ key: 'cancelled', label: '已取消' },
|
||||
@@ -844,6 +845,11 @@ function bizTypeLabel(bizType: BizType) {
|
||||
color: #059669;
|
||||
}
|
||||
|
||||
.crash-status.receiving {
|
||||
background: #fff7ed;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.crash-status.completed {
|
||||
background: #eff6ff;
|
||||
color: #2563eb;
|
||||
|
||||
Reference in New Issue
Block a user