fix(order): 修正未付款已发货订单状态显示错误

- 订单列表卡片 OrderCard 中将已发货/已收货状态判断提前,覆盖未付款状态显示
- 订单详情页 detail.tsx 调整 getOrderDisplayStatus 和 getOrderPhase 函数,优先显示物流状态
- 确保未付款但已发货订单状态正确显示为“待收货”
- 改动不影响正常付款和发货流程,仅修正异常状态显示问题
This commit is contained in:
2026-07-17 15:28:57 +08:00
parent 65bcd07ca7
commit 37cea1b6d0
3 changed files with 20 additions and 7 deletions

View File

@@ -71,7 +71,12 @@ const getOrderDisplayStatus = (order: ShopOrder): { title: string; bgColor: stri
return { bgColor: '#ee0a24', title: '退款被拒绝', subtitle: '退款申请已被拒绝' }
}
// 正常订单流程
// 物流状态优先于付款状态(已发货/已收货的订单,即使未付款也显示物流状态)
if (deliveryStatus === 20 || deliveryStatus === 30) {
return { bgColor: '#4b9cf5', title: '待收货', subtitle: '商品运输中,请注意查收' }
}
// 未发货时按付款状态显示
if (!payStatus && !isCod && !isOffline) {
return { bgColor: '#ff7d00', title: '待付款', subtitle: '请尽快完成支付' }
}
@@ -84,9 +89,6 @@ const getOrderDisplayStatus = (order: ShopOrder): { title: string; bgColor: stri
if (deliveryStatus === 10) {
return { bgColor: '#4b9cf5', title: '待发货', subtitle: '商家正在准备商品' }
}
if (deliveryStatus === 20 || deliveryStatus === 30) {
return { bgColor: '#4b9cf5', title: '待收货', subtitle: '商品运输中,请注意查收' }
}
if (orderStatus === OrderStatus.Completed) {
return { bgColor: '#0e932e', title: '已完成', subtitle: '交易已完成,感谢购买' }
}
@@ -111,12 +113,14 @@ const getOrderPhase = (order: ShopOrder): OrderPhase => {
return orderStatus === OrderStatus.Cancelled || orderStatus === OrderStatus.RefundSuccess ? 'cancelled' : 'refund'
}
// 物流状态优先于付款状态(已发货/已收货的订单,即使未付款也进入 shipped 阶段)
if (deliveryStatus === 20 || deliveryStatus === 30) return 'shipped'
// 线下付款且未确认收款:等待商家确认,不显示"立即支付"按钮
if (isOffline && !payStatus) return 'offline_pending'
// 货到付款订单payStatus=true 但还未实际付款,直接进入 unshipped 阶段(不需要"立即支付"按钮)
if (!payStatus && !isCod) return 'unpaid'
if (deliveryStatus === 10) return 'unshipped'
if (deliveryStatus === 20 || deliveryStatus === 30) return 'shipped'
if (orderStatus === OrderStatus.Completed) return 'completed'
return 'unshipped'