feat: 优化退款审核页面

This commit is contained in:
2025-10-30 16:42:06 +08:00
parent 2cb8fcf1e4
commit a56e9c0ef7
4 changed files with 26 additions and 3 deletions
@@ -65,7 +65,7 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
0: { text: '审核中', bgColor: '#fff7e6', textColor: '#d46b08' }, // orange
1: { text: '全额退款通过', bgColor: '#f6ffed', textColor: '#52c41a' }, // lime
2: { text: '全额退款拒绝', bgColor: '#fff1f0', textColor: '#f5222d' }, // red
3: { text: '部分退款通过', bgColor: '#EE82EE', textColor: '#EE82EE' }, // Violet
3: { text: '部分退款通过', bgColor: '#EE82EE', textColor: '#000000' }, // Violet
};
return statusMap[state] || { text: '未知状态', bgColor: '#f5f5f5', textColor: '#666' };
};
@@ -119,6 +119,20 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
? Math.round(customRefundAmount * 100) // 元转分
: refundData?.refundAmount;
// 如果是部分退款,需要验证金额不能大于等于订单金额
if (values.reviewResult === 3) {
const orderAmount = parseFloat(formatAmount(refundData?.orderAmount));
const refundAmount = customRefundAmount !== null
? customRefundAmount
: parseFloat(formatAmount(refundData?.refundAmount));
if (refundAmount >= orderAmount) {
message.error(`部分退款金额必须小于订单金额 ¥${orderAmount.toFixed(2)}`);
setLoading(false);
return;
}
}
// 调用自定义金额的退款审核接口
const res = await ordersApi.approveRefundWithCustomAmount({
orderNo: refundData?.orderNo,
@@ -229,6 +243,12 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
message.error('请输入大于0的退款金额');
return;
}
// 如果是部分退款,检查金额不能大于等于订单金额
const orderAmount = parseFloat(formatAmount(refundData?.orderAmount));
if (selectedReviewResult === 3 && customRefundAmount >= orderAmount) {
message.error(`部分退款金额必须小于订单金额 ¥${orderAmount.toFixed(2)}`);
return;
}
// 校验通过,关闭编辑模式
setEditingAmount(false);
}}
@@ -17,6 +17,7 @@ const ORDER_STATUS = {
REFUNDING: 7, // 退款中
REFUND_SUCCESS: 8, // 退款成功
REFUND_FAILED: 9, // 退款失败
REFUND_PART: 10, // 退款失败
};
// 资源列表操作组件
@@ -30,7 +31,7 @@ const ResourcesActionCell: React.FC<{ record: OrderItem; onReload?: () => void;
// 判断是否显示退款审核按钮(订单状态为退款中)
const isRefunding = record.orderStatus === ORDER_STATUS.REFUNDING;
// 判断是否显示退款查看按钮(订单状态为退款成功或退款失败)
const isRefundResolved = record.orderStatus === ORDER_STATUS.REFUND_SUCCESS || record.orderStatus === ORDER_STATUS.REFUND_FAILED;
const isRefundResolved = record.orderStatus === ORDER_STATUS.REFUND_SUCCESS || record.orderStatus === ORDER_STATUS.REFUND_FAILED || record.orderStatus === ORDER_STATUS.REFUND_PART;
return (
<>