feat: refund policy 从订单接口获取、梳理订单操作按钮

This commit is contained in:
2025-12-10 20:08:13 +08:00
parent 7b620210a2
commit 46a59ba282
3 changed files with 47 additions and 41 deletions

View File

@@ -6,18 +6,28 @@ export function getOrderStatus(orderData) {
if (!order_no) {
return 'none'
}
const { start_time } = game_info
const { start_time } = game_info || {}
if (!start_time) { console.log('活动开始时间未找到, start_time: ', start_time); }
const unPay = order_status === OrderStatus.PENDING && ([CancelType.NONE].includes(cancel_type));
const refund = [RefundStatus.SUCCESS].includes(refund_status);
const refunding = [RefundStatus.PENDING].includes(refund_status);
const expired =
order_status === OrderStatus.FINISHED;
const frozen = dayjs().add(2, 'h').isAfter(dayjs(start_time))
const frozen = dayjs().isAfter(dayjs(start_time))
const canceled = [CancelType.TIMEOUT, CancelType.USER].includes(cancel_type);
return unPay ? 'unpay' : refund ? 'refund' : canceled ? 'canceled' : expired ? 'expired' : refunding ? 'refunding' : frozen ? 'start' : 'progress'
// return unPay ? 'unpay' : refund ? 'refund' : canceled ? 'canceled' : expired ? 'expired' : refunding ? 'refunding' : is_substitute_order ? 'progress' : frozen ? 'start' : 'progress'
if (unPay) return 'unpay';
if (refund) return 'refund';
if (canceled) return 'canceled';
if (expired) return 'expired';
if (refunding) return 'refunding';
if (frozen) return 'start';
// if (is_substitute_order) return 'progress';
return 'progress';
}
// scene: list、detail