feat: 优化退款审核页面
This commit is contained in:
@@ -25,11 +25,12 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
|
|||||||
const [fetching, setFetching] = useState(false);
|
const [fetching, setFetching] = useState(false);
|
||||||
const [editingAmount, setEditingAmount] = useState(false);
|
const [editingAmount, setEditingAmount] = useState(false);
|
||||||
const [customRefundAmount, setCustomRefundAmount] = useState<number | null>(null);
|
const [customRefundAmount, setCustomRefundAmount] = useState<number | null>(null);
|
||||||
|
const [selectedReviewResult, setSelectedReviewResult] = useState<number | null>(null);
|
||||||
|
|
||||||
// 审核结果选项
|
// 审核结果选项
|
||||||
const reviewResults = [
|
const reviewResults = [
|
||||||
{ label: '部分退款', value: 3 },
|
|
||||||
{ label: '全额退款', value: 1 },
|
{ label: '全额退款', value: 1 },
|
||||||
|
{ label: '部分退款', value: 3 },
|
||||||
{ label: '拒绝退款', value: 2 },
|
{ label: '拒绝退款', value: 2 },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -62,9 +63,9 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
|
|||||||
const getRefundStateInfo = (state: number) => {
|
const getRefundStateInfo = (state: number) => {
|
||||||
const statusMap: Record<number, { text: string; bgColor: string; textColor: string }> = {
|
const statusMap: Record<number, { text: string; bgColor: string; textColor: string }> = {
|
||||||
0: { text: '审核中', bgColor: '#fff7e6', textColor: '#d46b08' }, // orange
|
0: { text: '审核中', bgColor: '#fff7e6', textColor: '#d46b08' }, // orange
|
||||||
1: { text: '审核通过', bgColor: '#f6ffed', textColor: '#52c41a' }, // lime
|
1: { text: '全额退款通过', bgColor: '#f6ffed', textColor: '#52c41a' }, // lime
|
||||||
2: { text: '审核失败', bgColor: '#fff1f0', textColor: '#f5222d' }, // red
|
2: { text: '全额退款拒绝', bgColor: '#fff1f0', textColor: '#f5222d' }, // red
|
||||||
3: { text: '部分退款', bgColor: '#EE82EE', textColor: '#EE82EE' }, // Violet
|
3: { text: '部分退款通过', bgColor: '#EE82EE', textColor: '#EE82EE' }, // Violet
|
||||||
};
|
};
|
||||||
return statusMap[state] || { text: '未知状态', bgColor: '#f5f5f5', textColor: '#666' };
|
return statusMap[state] || { text: '未知状态', bgColor: '#f5f5f5', textColor: '#666' };
|
||||||
};
|
};
|
||||||
@@ -73,9 +74,11 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible && orderNo) {
|
if (visible && orderNo) {
|
||||||
fetchRefundDetail();
|
fetchRefundDetail();
|
||||||
// 打开弹窗时清空编辑状态
|
// 打开弹窗时清空编辑状态,并设置默认为全额退款
|
||||||
setEditingAmount(false);
|
setEditingAmount(false);
|
||||||
setCustomRefundAmount(null);
|
setCustomRefundAmount(null);
|
||||||
|
setSelectedReviewResult(1); // 1 = 全额退款
|
||||||
|
form.setFieldsValue({ reviewResult: 1 });
|
||||||
}
|
}
|
||||||
}, [visible, orderNo]);
|
}, [visible, orderNo]);
|
||||||
|
|
||||||
@@ -157,6 +160,26 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
) : refundData ? (
|
) : refundData ? (
|
||||||
<>
|
<>
|
||||||
|
{/* 审核表单 - 退款类型放在第一行(仅审核模式显示) */}
|
||||||
|
{isReviewMode && (
|
||||||
|
<>
|
||||||
|
<Form form={form} layout="vertical">
|
||||||
|
<Form.Item
|
||||||
|
name="reviewResult"
|
||||||
|
label="审核结果"
|
||||||
|
rules={[{ required: true, message: '请选择退款类型' }]}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
placeholder="请选择"
|
||||||
|
options={reviewResults}
|
||||||
|
onChange={(value) => setSelectedReviewResult(value)}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
<Divider />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* 基本信息行 */}
|
{/* 基本信息行 */}
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
@@ -227,7 +250,7 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
|
|||||||
) : (
|
) : (
|
||||||
<div style={{ marginTop: 4, display: 'flex', gap: 8, alignItems: 'center' }}>
|
<div style={{ marginTop: 4, display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||||
<span>¥ {customRefundAmount !== null ? customRefundAmount.toFixed(2) : formatAmount(refundData?.refundAmount)}</span>
|
<span>¥ {customRefundAmount !== null ? customRefundAmount.toFixed(2) : formatAmount(refundData?.refundAmount)}</span>
|
||||||
{isReviewMode && (
|
{isReviewMode && selectedReviewResult === 3 && (
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -341,14 +364,6 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
|
|||||||
{/* 审核表单(仅审核模式显示) */}
|
{/* 审核表单(仅审核模式显示) */}
|
||||||
{isReviewMode && (
|
{isReviewMode && (
|
||||||
<Form form={form} layout="vertical">
|
<Form form={form} layout="vertical">
|
||||||
<Form.Item
|
|
||||||
name="reviewResult"
|
|
||||||
label="退款类型"
|
|
||||||
rules={[{ required: true, message: '请选择退款类型' }]}
|
|
||||||
>
|
|
||||||
<Select placeholder="请选择" options={reviewResults} />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="reviewComment"
|
name="reviewComment"
|
||||||
label="审核意见"
|
label="审核意见"
|
||||||
|
|||||||
Reference in New Issue
Block a user