fix(order): show authoritative progress and billing in customer detail
This commit is contained in:
@@ -18,3 +18,12 @@ export function orderProgressLabel(progress?: MerchantOrderProgress) {
|
||||
const label = ORDER_QUEUES.find(q => q.key === progress.stage)?.label ?? '—'
|
||||
return `${progress.partial ? '部分' : ''}${label}`
|
||||
}
|
||||
|
||||
export function requireOrderProgress(orderId: string, progress: MerchantOrderProgress) {
|
||||
if (!progress || String(progress.orderId) !== orderId
|
||||
|| !['none', 'loaded', 'declared', 'cleared', 'scheduled', 'delivering', 'delivered'].includes(progress.stage)
|
||||
|| typeof progress.partial !== 'boolean') {
|
||||
throw new Error('订单履约进度不完整,请重新加载')
|
||||
}
|
||||
return progress
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user