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

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