!49 feat: 退款订单与订单列表整合5

Merge pull request !49 from 鸭先知/feature_dzc
This commit is contained in:
2025-10-29 10:08:15 +00:00
committed by Gitee
4 changed files with 39 additions and 24 deletions
@@ -192,7 +192,7 @@ public class RefundController {
}
if (refundRequest.getState().equals(RefundState.APPROVED.getId())){
dealCustomRefundAmountRequest(order,refundRequest.getRefundAmount());
refundorder.setRefundReason(refundRequest.getApproveReason());
refundorder.setApproveReason(refundRequest.getApproveReason());
if(refundRequest.getRefundAmount()!=null){
refundorder.setRefundAmount(refundRequest.getRefundAmount());
}
@@ -202,6 +202,8 @@ public class RefundController {
if (refundRequest.getState().equals(RefundState.REFUSED.getId())){
order.setOrderStatus(OrderStatus.REFUND_FAILED.getId());
refundorder.setStatus(OrderStatus.REFUND_FAILED.getId());
refundorder.setApproveReason(refundRequest.getApproveReason());
refundorder.setState(refundRequest.getState());
orderService.updateOrder(order);
refundService.updateById(refundorder);
return Result.succeed("处理成功");
@@ -91,8 +91,10 @@ public class RefundServiceImpl extends SuperServiceImpl<RefundMapper, Refund> im
result.put("orderAmount", refund.getOrderAmount());
result.put("refundAmount", refund.getRefundAmount());
result.put("status", refund.getStatus());
result.put("state", refund.getState());
result.put("reason", refund.getRefundReason());
result.put("refundReason", refund.getRefundReason());
result.put("approveReason", refund.getApproveReason());
result.put("createTime", refund.getCreateTime());
result.put("applyTime", refund.getCreateTime());
+2 -2
View File
@@ -5,13 +5,13 @@
"scripts": {
"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=dev GATEWAY_ORIGIN=http://127.0.0.1:9900 umi dev",
"start:dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=dev GATEWAY_ORIGIN=http://127.0.0.1:9900 umi dev",
"start:test": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=test GATEWAY_ORIGIN=http://local.goflytec.com:9900 umi dev",
"start:test": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=test GATEWAY_ORIGIN=https://socket.goflytec.com umi dev",
"start:pre": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=pre GATEWAY_ORIGIN=http://119.45.169.13:9900 umi dev",
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider umi build",
"build:test": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=test API_PREFIX=http://119.45.169.13:9900 umi build",
"build:pre": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=pre API_PREFIX=http://119.45.169.13:9900 umi build",
"build:prod": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=prod umi build",
"build:test:mgnt": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=test APP_BASE=/mgnt API_PREFIX=https://local.goflytec.com:9999 umi build",
"build:test:mgnt": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=test APP_BASE=/mgnt API_PREFIX=https://socket.goflytec.com umi build",
"build:pre:mgnt": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=pre APP_BASE=/mgnt API_PREFIX=https://local.goflytec.com umi build",
"build:prod:mgnt": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=prod APP_BASE=/mgnt umi build",
"lint": "eslint --ext .ts,.tsx src",
@@ -1,7 +1,8 @@
// UTF-8: 退款审核弹框组件
import React, { useState, useEffect } from 'react';
import { Modal, Form, Select, Input, message, Empty, Image, Space, Row, Col, Divider, InputNumber, Button } from 'antd';
import { Modal, Form, Select, Input, message, Empty, Image, Space, Row, Col, Divider, InputNumber, Button, Tag } from 'antd';
import { ordersApi } from '@/services/orders';
import { ORDER_STATUS_OPTIONS, findLabel, findColor } from './constants';
interface RefundReviewModalProps {
visible: boolean;
@@ -12,12 +13,12 @@ interface RefundReviewModalProps {
}
const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
visible,
orderNo,
onCancel,
onSuccess,
isReviewMode = true,
}) => {
visible,
orderNo,
onCancel,
onSuccess,
isReviewMode = true,
}) => {
const [form] = Form.useForm();
const [loading, setLoading] = useState(false);
const [refundData, setRefundData] = useState<any>(null);
@@ -28,7 +29,7 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
// 审核结果选项
const reviewResults = [
{ label: '审核通过', value: 1 },
{ label: '审核拒绝', value: 0 },
{ label: '审核拒绝', value: 2 },
];
// 格式化金额(分转元)
@@ -56,14 +57,14 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
}
};
// 根据status获取退款状态的文案和颜色
const getRefundStatusInfo = (status: number) => {
// 根据state获取退款状态的文案和颜色
const getRefundStateInfo = (state: number) => {
const statusMap: Record<number, { text: string; bgColor: string; textColor: string }> = {
7: { text: '退款中', bgColor: '#fff7e6', textColor: '#d46b08' }, // orange
8: { text: '退款成功', bgColor: '#f6ffed', textColor: '#52c41a' }, // lime
9: { text: '退款失败', bgColor: '#fff1f0', textColor: '#f5222d' }, // red
0: { text: '审核中', bgColor: '#fff7e6', textColor: '#d46b08' }, // orange
1: { text: '审核通过', bgColor: '#f6ffed', textColor: '#52c41a' }, // lime
2: { text: '审核失败', bgColor: '#fff1f0', textColor: '#f5222d' }, // red
};
return statusMap[status] || { text: '未知状态', bgColor: '#f5f5f5', textColor: '#666' };
return statusMap[state] || { text: '未知状态', bgColor: '#f5f5f5', textColor: '#666' };
};
// 获取退款订单详情
@@ -119,7 +120,7 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
refundNo: refundData?.refundNo,
refundAmount: String(actualRefundAmount), // 后端期望字符串格式
status: 7, // 退款中状态码
state: values.reviewResult, // 审核状态:1=通过(APPROVED),0=拒绝(REFUSED)
state: values.reviewResult, // 审核状态:1=通过(APPROVED),2=拒绝(REFUSED)
approveReason: values.reviewComment, // 审核意见
});
@@ -253,7 +254,7 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
<span style={{ fontWeight: 'bold' }}>退款状态</span>
<div style={{ marginTop: 4 }}>
{(() => {
const statusInfo = getRefundStatusInfo(refundData?.status);
const statusInfo = getRefundStateInfo(refundData?.state);
return (
<span style={{
padding: '2px 8px',
@@ -272,9 +273,9 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
<div>
<span style={{ fontWeight: 'bold' }}>订单状态</span>
<div style={{ marginTop: 4 }}>
<span style={{ padding: '2px 8px', backgroundColor: '#f6f8fb', color: '#000', borderRadius: 2 }}>
{refundData?.orderStatus || '-'}
</span>
<Tag color={findColor(ORDER_STATUS_OPTIONS, refundData?.status)}>
{findLabel(ORDER_STATUS_OPTIONS, refundData?.status)}
</Tag>
</div>
</div>
</Col>
@@ -284,12 +285,22 @@ const RefundReviewModal: React.FC<RefundReviewModalProps> = ({
{/* 退款原因 */}
<div style={{ marginBottom: 16 }}>
<span style={{ fontWeight: 'bold' }}>退款原因</span>
<span style={{ fontWeight: 'bold' }}>用户退款原因</span>
<div style={{ marginTop: 4, padding: '8px', backgroundColor: '#fafafa', borderRadius: 2, minHeight: 40 }}>
{refundData?.reason || refundData?.refundReason || '-'}
{refundData?.refundReason || '-'}
</div>
</div>
{/* 审核原因 */}
{refundData?.approveReason && (
<div style={{ marginBottom: 16 }}>
<span style={{ fontWeight: 'bold' }}>审核原因</span>
<div style={{ marginTop: 4, padding: '8px', backgroundColor: '#fafafa', borderRadius: 2, minHeight: 40 }}>
{refundData?.approveReason}
</div>
</div>
)}
{/* 退款凭证(图片) */}
{refundData?.images && refundData?.images.length > 0 && (
<>