feat(store): 新增订单送达操作功能
- 新增操作类型 'deliver',用于上传送达凭证照片并标记为已收货 - 在操作列表中增加“送达”按钮,仅在订单已发货状态显示 - 送达操作不改变付款状态和订单完成状态 - 送达操作要求上传凭证照片,否则提示用户上传 - 确认完成操作仅在订单已付款时可用 - 调整凭证上传提示文案,针对送达操作显示专属提示 - 更新订单状态逻辑,送达时设置配送状态为“已收货”,完成时标记订单为已完成
This commit is contained in:
@@ -28,10 +28,11 @@ const TABS: { key: TabKey; label: string; params: Partial<ShopOrderParam>[] }[]
|
|||||||
]
|
]
|
||||||
|
|
||||||
// ─── 操作类型 ─────────────────────────────────────────────────────
|
// ─── 操作类型 ─────────────────────────────────────────────────────
|
||||||
type OpType = 'confirmPay' | 'complete' | 'editPrice' | 'ship'
|
type OpType = 'confirmPay' | 'deliver' | 'complete' | 'editPrice' | 'ship'
|
||||||
|
|
||||||
const OP_LABEL: Record<OpType, string> = {
|
const OP_LABEL: Record<OpType, string> = {
|
||||||
confirmPay: '收款',
|
confirmPay: '收款',
|
||||||
|
deliver: '送达',
|
||||||
complete: '已完成',
|
complete: '已完成',
|
||||||
editPrice: '金额',
|
editPrice: '金额',
|
||||||
ship: '发货',
|
ship: '发货',
|
||||||
@@ -39,7 +40,8 @@ const OP_LABEL: Record<OpType, string> = {
|
|||||||
|
|
||||||
const OP_DESC: Record<OpType, string> = {
|
const OP_DESC: Record<OpType, string> = {
|
||||||
confirmPay: '确认已收到线下付款',
|
confirmPay: '确认已收到线下付款',
|
||||||
complete: '同时变更支付状态为已付款、收货状态为已收货、订单状态为已完成',
|
deliver: '上传送达凭证照片,标记为已收货(不改变付款和订单完成状态)',
|
||||||
|
complete: '确认订单已完成,收款后点击此按钮标记订单完成',
|
||||||
editPrice: '修改订单实付金额',
|
editPrice: '修改订单实付金额',
|
||||||
ship: '选择发货人员并生成发货单,订单将进入已发货状态',
|
ship: '选择发货人员并生成发货单,订单将进入已发货状态',
|
||||||
}
|
}
|
||||||
@@ -149,9 +151,13 @@ function getOrderActions(order: ShopOrder): { label: string; type: OpType }[] {
|
|||||||
actions.push({label: '发货', type: 'ship'})
|
actions.push({label: '发货', type: 'ship'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 确认完成:已发货即可确认完成(无论是否付款,线下付款先发货后结款场景也需要上传送达照片)
|
// 送达:已发货即可上传送达照片(无论是否付款,线下付款先发货后结款场景也需要)
|
||||||
const shipped = order.deliveryStatus != null && order.deliveryStatus >= 20
|
const shipped = order.deliveryStatus != null && order.deliveryStatus >= 20
|
||||||
if (shipped) {
|
if (shipped) {
|
||||||
|
actions.push({label: '送达', type: 'deliver'})
|
||||||
|
}
|
||||||
|
// 确认完成:仅已付款才可标记订单为已完成
|
||||||
|
if (order.payStatus) {
|
||||||
actions.push({label: '确认完成', type: 'complete'})
|
actions.push({label: '确认完成', type: 'complete'})
|
||||||
}
|
}
|
||||||
return actions
|
return actions
|
||||||
@@ -418,9 +424,9 @@ export default function StoreOrdersPage() {
|
|||||||
const submitOperation = async () => {
|
const submitOperation = async () => {
|
||||||
if (!currentOrder) return
|
if (!currentOrder) return
|
||||||
|
|
||||||
// 确认完成必须上传凭证照片
|
// 确认送达必须上传凭证照片
|
||||||
if (opType === 'complete' && proofImages.length === 0) {
|
if (opType === 'deliver' && proofImages.length === 0) {
|
||||||
Taro.showToast({title: '请上传配送凭证照片', icon: 'none'})
|
Taro.showToast({title: '请上传送达凭证照片', icon: 'none'})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,14 +448,14 @@ export default function StoreOrdersPage() {
|
|||||||
} else {
|
} else {
|
||||||
const updateData: any = {orderId: currentOrder.orderId}
|
const updateData: any = {orderId: currentOrder.orderId}
|
||||||
|
|
||||||
if (opType === 'complete') {
|
if (opType === 'deliver') {
|
||||||
// 确认完成:用户已收到货
|
// 送达:上传送达照片,标记为已收货(不改变付款状态和订单完成状态)
|
||||||
updateData.payStatus = true
|
updateData.deliveryStatus = 30 // 已收货
|
||||||
updateData.payTime = formatDateTime(new Date())
|
updateData.deliveryTime = formatDateTime(new Date())
|
||||||
updateData.deliveryStatus = 20 // 发货状态 → 已收货
|
updateData.sendEndImg = JSON.stringify(proofImages)
|
||||||
updateData.deliveryTime = formatDateTime(new Date()) // 收货时间
|
} else if (opType === 'complete') {
|
||||||
|
// 确认完成:标记订单为已完成
|
||||||
updateData.orderStatus = 1 // 订单状态 → 已完成
|
updateData.orderStatus = 1 // 订单状态 → 已完成
|
||||||
updateData.sendEndImg = JSON.stringify(proofImages) // 配送员送达拍照(JSON数组)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await updateShopOrder(updateData)
|
await updateShopOrder(updateData)
|
||||||
@@ -835,8 +841,8 @@ export default function StoreOrdersPage() {
|
|||||||
<Text className='text-sm text-gray-600 mb-3 block'>
|
<Text className='text-sm text-gray-600 mb-3 block'>
|
||||||
{opType === 'confirmPay'
|
{opType === 'confirmPay'
|
||||||
? '上传支付凭证(必填,如微信转账截图)'
|
? '上传支付凭证(必填,如微信转账截图)'
|
||||||
: opType === 'complete'
|
: opType === 'deliver'
|
||||||
? '上传凭证照片(必填,配送货物到达后拍照上传,最多3张)'
|
? '上传送达凭证(必填,配送货物到达后拍照上传,最多3张)'
|
||||||
: '上传凭证照片(选填,最多3张)'}
|
: '上传凭证照片(选填,最多3张)'}
|
||||||
</Text>
|
</Text>
|
||||||
<View className='flex flex-wrap gap-3 mb-4'>
|
<View className='flex flex-wrap gap-3 mb-4'>
|
||||||
|
|||||||
Reference in New Issue
Block a user