feat: 去掉商品取货码,管理员可直接发货完成
已付款订单不再生成或核验取货码,管理员确认后即可完成订单。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -45,21 +45,9 @@
|
||||
<view class="divider" />
|
||||
<text class="muted">{{ order.contactName }} · {{ order.contactPhone }}</text>
|
||||
<text class="order-no" @tap="copy(order.orderNo)">订单号 {{ order.orderNo }} ⧉</text>
|
||||
<template v-if="order.status === 'PAID'">
|
||||
<view v-if="!admin" class="notice">
|
||||
到馆出示提货码
|
||||
<text class="code" @tap="copy(order.pickupCode)">{{ order.pickupCode }}</text>
|
||||
请在领取商品时向工作人员出示。
|
||||
</view>
|
||||
<view v-else class="field">
|
||||
<input
|
||||
v-model="codes[order.id]"
|
||||
class="input"
|
||||
maxlength="12"
|
||||
placeholder="输入顾客的 12 位提货码"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
<text v-if="order.status === 'PAID' && !admin" class="notice">
|
||||
已付款,到馆即可领取。工作人员确认交付后,订单即完成。
|
||||
</text>
|
||||
<text v-if="order.status === 'PENDING'" class="muted">
|
||||
付款截止 {{ date(order.expiresAt) }},超时后自动取消。
|
||||
</text>
|
||||
@@ -77,7 +65,7 @@
|
||||
:disabled="!!busy"
|
||||
@tap="complete(order)"
|
||||
>
|
||||
确认已交付商品
|
||||
确认发货并完成
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -105,8 +93,7 @@ const items = ref<ShopOrder[]>([]),
|
||||
total = ref(0),
|
||||
loading = ref(false),
|
||||
error = ref(''),
|
||||
busy = ref(''),
|
||||
codes = ref<Record<string, string>>({})
|
||||
busy = ref('')
|
||||
const tabs = [
|
||||
{ value: '', label: '全部' },
|
||||
...Object.entries(shopStatus).map(([value, label]) => ({ value, label })),
|
||||
@@ -199,22 +186,17 @@ async function cancel(order: ShopOrder) {
|
||||
}
|
||||
}
|
||||
async function complete(order: ShopOrder) {
|
||||
const code = (codes.value[order.id] || '').trim().toUpperCase()
|
||||
if (!/^[A-F0-9]{12}$/.test(code)) {
|
||||
shopError(new Error('请输入完整提货码'))
|
||||
return
|
||||
}
|
||||
const answer = await uni.showModal({
|
||||
title: '确认商品已交付',
|
||||
content: `${order.title} × ${order.quantity},取货人 ${order.contactName}。核销后订单将完成。`,
|
||||
title: '确认发货并完成',
|
||||
content: `${order.title} × ${order.quantity},取货人 ${order.contactName}。确认后订单将完成。`,
|
||||
})
|
||||
if (!answer.confirm || busy.value) return
|
||||
busy.value = order.id
|
||||
try {
|
||||
await post(`/admin/shop/orders/${order.id}/complete`, { pickupCode: code })
|
||||
await post(`/admin/shop/orders/${order.id}/complete`)
|
||||
await load(true)
|
||||
emit('changed')
|
||||
uni.showToast({ title: '提货完成' })
|
||||
uni.showToast({ title: '订单已完成' })
|
||||
} catch (e) {
|
||||
shopError(e)
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user