优化下单流程
This commit is contained in:
@@ -14,19 +14,28 @@ const OrderDetail = () => {
|
||||
const router = Taro.getCurrentInstance().router;
|
||||
const orderId = router?.params?.orderId;
|
||||
|
||||
const getOrderStatusText = (orderStatus?: number, payStatus?: number) => {
|
||||
if (payStatus === 0) return '待付款';
|
||||
switch (orderStatus) {
|
||||
case 0: return '未使用';
|
||||
case 1: return '已完成';
|
||||
case 2: return '已取消';
|
||||
case 3: return '取消中';
|
||||
case 4: return '退款申请中';
|
||||
case 5: return '退款被拒绝';
|
||||
case 6: return '退款成功';
|
||||
case 7: return '客户端申请退款';
|
||||
default: return '未知状态';
|
||||
}
|
||||
const getOrderStatusText = (order: ShopOrder) => {
|
||||
// 优先检查订单状态
|
||||
if (order.orderStatus === 2) return '已取消';
|
||||
if (order.orderStatus === 3) return '取消中';
|
||||
if (order.orderStatus === 4) return '退款申请中';
|
||||
if (order.orderStatus === 5) return '退款被拒绝';
|
||||
if (order.orderStatus === 6) return '退款成功';
|
||||
if (order.orderStatus === 7) return '客户端申请退款';
|
||||
|
||||
// 检查支付状态 (payStatus为boolean类型)
|
||||
if (!order.payStatus || order.payStatus === false) return '待付款';
|
||||
|
||||
// 已付款后检查发货状态
|
||||
if (order.deliveryStatus === 10) return '待发货';
|
||||
if (order.deliveryStatus === 20) return '待收货';
|
||||
if (order.deliveryStatus === 30) return '已收货';
|
||||
|
||||
// 最后检查订单完成状态
|
||||
if (order.orderStatus === 1) return '已完成';
|
||||
if (order.orderStatus === 0) return '未使用';
|
||||
|
||||
return '未知状态';
|
||||
};
|
||||
|
||||
const getPayTypeText = (payType?: number) => {
|
||||
@@ -68,7 +77,7 @@ const OrderDetail = () => {
|
||||
<CellGroup title="订单信息">
|
||||
<Cell title="订单编号" description={order.orderNo} />
|
||||
<Cell title="下单时间" description={dayjs(order.createTime).format('YYYY-MM-DD HH:mm:ss')} />
|
||||
<Cell title="订单状态" description={getOrderStatusText(order.orderStatus, order.payStatus)} />
|
||||
<Cell title="订单状态" description={getOrderStatusText(order)} />
|
||||
</CellGroup>
|
||||
|
||||
<CellGroup title="商品信息">
|
||||
|
||||
Reference in New Issue
Block a user