fix[订单服务]:退款逻辑优化,素材逻辑优化,后台页面管理优化
This commit is contained in:
@@ -4,7 +4,11 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: file-center
|
name: file-center
|
||||||
cloud:
|
# cloud:
|
||||||
nacos:
|
# nacos:
|
||||||
discovery:
|
# discovery:
|
||||||
ip: 119.45.169.13
|
# ip: 119.45.169.13
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 10MB
|
||||||
|
max-request-size: 10MB
|
||||||
|
|||||||
+8
-6
@@ -47,7 +47,7 @@ public class OrderRefundController {
|
|||||||
@Parameter(name = "page",description = "分页起始位置",required = true,in= ParameterIn.QUERY),
|
@Parameter(name = "page",description = "分页起始位置",required = true,in= ParameterIn.QUERY),
|
||||||
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
|
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
|
||||||
})
|
})
|
||||||
@GetMapping("/list")
|
@GetMapping()
|
||||||
public PageResult list(@RequestParam Map<String, Object> params) {
|
public PageResult list(@RequestParam Map<String, Object> params) {
|
||||||
return refundService.findList(params);
|
return refundService.findList(params);
|
||||||
}
|
}
|
||||||
@@ -65,6 +65,8 @@ public class OrderRefundController {
|
|||||||
refund.setRefundNo("RF" + order.getOrderNo());
|
refund.setRefundNo("RF" + order.getOrderNo());
|
||||||
refund.setOrderNo(order.getOrderNo());
|
refund.setOrderNo(order.getOrderNo());
|
||||||
refund.setUserId(order.getUserId());
|
refund.setUserId(order.getUserId());
|
||||||
|
refund.setOrderAmount(order.getOrderAmount());
|
||||||
|
refund.setRefundAmount(order.getOrderAmount());
|
||||||
refund.setStatus(OrderStatus.REFUNDING.getId());
|
refund.setStatus(OrderStatus.REFUNDING.getId());
|
||||||
refund.setState(RefundState.APPROVING.getId());
|
refund.setState(RefundState.APPROVING.getId());
|
||||||
boolean res = refundService.createRefund(refund);
|
boolean res = refundService.createRefund(refund);
|
||||||
@@ -76,14 +78,16 @@ public class OrderRefundController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "微信支付退款")
|
@Operation(summary = "微信支付退款")
|
||||||
@PostMapping()
|
@PatchMapping()
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result<com.central.order.model.Refund> refundOrder(@RequestBody String orderNo) {
|
public Result<com.central.order.model.Refund> refundOrder(@RequestBody String orderNo) {
|
||||||
try {
|
try {
|
||||||
// 检查订单是否存在
|
// 检查订单是否存在
|
||||||
Order order = orderService.getOrderByNumber(orderNo);
|
Order order = orderService.getOrderByNumber(orderNo);
|
||||||
Assert.notNull(order, "ORDER DATA不存在");
|
Assert.notNull(order, "ORDER DATA不存在");
|
||||||
|
if (!order.getOrderStatus().equals(OrderStatus.REFUNDING.getId())){
|
||||||
|
return Result.failed("请重试");
|
||||||
|
}
|
||||||
// 创建微信退款请求
|
// 创建微信退款请求
|
||||||
CreateRequest request = new CreateRequest();
|
CreateRequest request = new CreateRequest();
|
||||||
request.setOutTradeNo(order.getOrderNo());
|
request.setOutTradeNo(order.getOrderNo());
|
||||||
@@ -103,9 +107,7 @@ public class OrderRefundController {
|
|||||||
// 发起退款请求
|
// 发起退款请求
|
||||||
Refund response = service.create(request);
|
Refund response = service.create(request);
|
||||||
Assert.notNull(response, "退款失败");
|
Assert.notNull(response, "退款失败");
|
||||||
|
return Result.succeed("已提交,请关注账户资金变化");
|
||||||
|
|
||||||
throw new RuntimeException("创建退款订单失败");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 记录异常信息
|
// 记录异常信息
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.central.order.enums;
|
||||||
|
|
||||||
|
import com.central.common.enums.ZltEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据状态枚举类型
|
||||||
|
*
|
||||||
|
* @author lsl create by 2025/1/10
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum CommonStatus implements ZltEnum {
|
||||||
|
ENABLE(0,"启用"),
|
||||||
|
UNABLE(1, "未启用");
|
||||||
|
|
||||||
|
CommonStatus(Integer id, String content) {
|
||||||
|
this.id = id;
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,7 +27,8 @@ public class Refund extends SuperEntity {
|
|||||||
private String refundNo;
|
private String refundNo;
|
||||||
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
private String orderAmount;
|
||||||
|
private String refundAmount;
|
||||||
private String refundReason;
|
private String refundReason;
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: order-center
|
name: order-center
|
||||||
cloud:
|
# cloud:
|
||||||
nacos:
|
# nacos:
|
||||||
discovery:
|
# discovery:
|
||||||
ip: 81.70.164.178
|
# ip: 81.70.164.178
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: user-center
|
name: user-center
|
||||||
cloud:
|
# cloud:
|
||||||
nacos:
|
# nacos:
|
||||||
discovery:
|
# discovery:
|
||||||
ip: 124.222.128.40
|
# ip: 124.222.128.40
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
########################## 统一变量配置 ##########################
|
########################## 统一变量配置 ##########################
|
||||||
##### 数据库配置
|
##### 数据库配置
|
||||||
zlt.datasource.ip=127.0.0.1
|
#zlt.datasource.ip=127.0.0.1
|
||||||
|
#zlt.datasource.username=root
|
||||||
|
#zlt.datasource.password=root
|
||||||
|
zlt.datasource.ip=sh-cdb-i6yxaaec.sql.tencentcdb.com:58797
|
||||||
zlt.datasource.username=root
|
zlt.datasource.username=root
|
||||||
zlt.datasource.password=root
|
zlt.datasource.password=ZXC_zxc!@#123+
|
||||||
|
|
||||||
##### redis配置
|
##### redis配置
|
||||||
spring.data.redis.host=192.168.2.20
|
spring.data.redis.host=192.168.2.20
|
||||||
@@ -76,6 +79,6 @@ zlt.wxpay.notifyUrl=https://img.goflytec.com/api-order/wechat/pay/notify
|
|||||||
# 微信退款异步通知地址(需外网可访问且与微信支付平台配置一致)
|
# 微信退款异步通知地址(需外网可访问且与微信支付平台配置一致)
|
||||||
zlt.wxrefund.notifyUrl= https://img.goflytec.com/api-order/wechat/refund/notify
|
zlt.wxrefund.notifyUrl= https://img.goflytec.com/api-order/wechat/refund/notify
|
||||||
# 商户API私钥路径
|
# 商户API私钥路径
|
||||||
zlt.wxpay.privateKeyPath=/data/zlt/cert/apiclient_key.pem
|
zlt.wxpay.privateKeyPath=D:\\wx\\WXCertUtil\\cert\\1703796518_20250114_cert\\apiclient_key.pem
|
||||||
# 商户APIV3密钥
|
# 商户APIV3密钥
|
||||||
zlt.wxpay.apiV3Key=aIt5Vw3cYXSCSd4L5h14kIyDsoXBow7r
|
zlt.wxpay.apiV3Key=aIt5Vw3cYXSCSd4L5h14kIyDsoXBow7r
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
########################## bootstrap级别通用配置 ##########################
|
########################## bootstrap级别通用配置 ##########################
|
||||||
# 默认开发环境
|
# 默认开发环境
|
||||||
spring.profiles.active=prod
|
spring.profiles.active=dev
|
||||||
|
|
||||||
##### nacos(注册中心和配置中心)地址
|
##### nacos(注册中心和配置中心)地址
|
||||||
spring.cloud.nacos.server-addr=47.94.136.130:8848
|
#spring.cloud.nacos.server-addr=47.94.136.130:8848
|
||||||
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||||
spring.cloud.nacos.username=nacos
|
spring.cloud.nacos.username=nacos
|
||||||
spring.cloud.nacos.password=nacos
|
spring.cloud.nacos.password=nacos
|
||||||
spring.cloud.nacos.config.file-extension=yml
|
spring.cloud.nacos.config.file-extension=yml
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: uaa-server
|
name: uaa-server
|
||||||
cloud:
|
# cloud:
|
||||||
nacos:
|
# nacos:
|
||||||
discovery:
|
# discovery:
|
||||||
ip: 124.222.128.40
|
# ip: 124.222.128.40
|
||||||
|
|
||||||
encrypt:
|
encrypt:
|
||||||
key-store:
|
key-store:
|
||||||
|
|||||||
@@ -9,38 +9,38 @@
|
|||||||
export default {
|
export default {
|
||||||
dev: {
|
dev: {
|
||||||
'/api-uaa/': {
|
'/api-uaa/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-user/': {
|
'/api-user/': {
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-log/': {
|
'/api-log/': {
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-search/': {
|
'/api-search/': {
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-generator/': {
|
'/api-generator/': {
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-file/': {
|
'/api-file/': {
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-order/': {
|
'/api-order/': {
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -73,6 +73,10 @@
|
|||||||
{
|
{
|
||||||
path: '/orders/homeCarousel.html',
|
path: '/orders/homeCarousel.html',
|
||||||
component: './orders/HomeCarousel',
|
component: './orders/HomeCarousel',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/orders/refund.html',
|
||||||
|
component: './orders/Refund',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
ProTable,
|
ProTable,
|
||||||
QueryFilter,
|
QueryFilter,
|
||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { Typography, Popconfirm, Space, message, Image, Button } from 'antd';
|
import { Typography, Popconfirm, Space, message, Image, Button, Tag } from 'antd';
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
import UpdateForm from './components/UpdateForm';
|
import UpdateForm from './components/UpdateForm';
|
||||||
|
|
||||||
@@ -73,6 +73,20 @@ const handleDelete = async (qrcode: ORDERS.Qrcode) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 状态颜色映射
|
||||||
|
const statusColorMap = {
|
||||||
|
0: { color: 'green', text: '启用' },
|
||||||
|
1: { color: 'red', text: '未启用' },
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// 渲染状态标签
|
||||||
|
const renderStatus = (status: {} | null | undefined) => {
|
||||||
|
const statusInfo = statusColorMap[status] || { color: 'gray', text: '未知状态' };
|
||||||
|
return <Tag color={statusInfo.color}>{statusInfo.text}</Tag>;
|
||||||
|
};
|
||||||
|
|
||||||
const TableList: React.FC = () => {
|
const TableList: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||||
@@ -112,6 +126,7 @@ const TableList: React.FC = () => {
|
|||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
|
render: (status) => renderStatus(status),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import {
|
||||||
|
ModalForm,
|
||||||
|
ProForm,
|
||||||
|
ProFormText,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { Form } from 'antd';
|
||||||
|
|
||||||
|
export type FormValueType = Partial<ORDERS.Tourism>;
|
||||||
|
|
||||||
|
export type UpdateFormProps = {
|
||||||
|
onVisibleChange: (flag: boolean) => void;
|
||||||
|
onSubmit: (values: FormValueType) => Promise<void>;
|
||||||
|
updateModalVisible: boolean;
|
||||||
|
values?: ORDERS.Tourism;
|
||||||
|
};
|
||||||
|
|
||||||
|
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
return (
|
||||||
|
<ModalForm
|
||||||
|
title="修改景区"
|
||||||
|
form={form}
|
||||||
|
visible={props.updateModalVisible}
|
||||||
|
onFinish={props.onSubmit}
|
||||||
|
onVisibleChange={props.onVisibleChange}
|
||||||
|
>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '名称不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismName"
|
||||||
|
label="名称"
|
||||||
|
placeholder="输入名称"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '地址不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismAddress"
|
||||||
|
label="地址"
|
||||||
|
placeholder="输入地址"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '手机号不为空',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="md"
|
||||||
|
name="tourismPhone"
|
||||||
|
label="手机号"
|
||||||
|
placeholder="输入手机号"
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
</ModalForm>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default UpdateForm;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { order } from '@/services/orders/api';
|
import { refund } from '@/services/orders/api';
|
||||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||||
import {
|
import {
|
||||||
PageContainer,
|
PageContainer,
|
||||||
@@ -32,10 +32,18 @@ const { Link } = Typography;
|
|||||||
|
|
||||||
// 状态颜色映射
|
// 状态颜色映射
|
||||||
const statusColorMap = {
|
const statusColorMap = {
|
||||||
0: { color: 'yellow', text: '待处理' },
|
7: { color: 'yellow', text: '退款申请中' },
|
||||||
1: { color: 'orange', text: '待处理' },
|
8: { color: 'green', text: '已退款' },
|
||||||
3: { color: 'green', text: '已完成' },
|
9: { color: 'red', text: '退款失败' },
|
||||||
2: { color: 'red', text: '已取消' },
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// 状态颜色映射
|
||||||
|
const stateColorMap = {
|
||||||
|
0: { color: 'yellow', text: '待审核' },
|
||||||
|
1: { color: 'green', text: '已通过' },
|
||||||
|
2: { color: 'red', text: '已拒绝' },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 渲染状态标签
|
// 渲染状态标签
|
||||||
@@ -44,10 +52,16 @@ const renderStatus = (status: {} | null | undefined) => {
|
|||||||
return <Tag color={statusInfo.color}>{statusInfo.text}</Tag>;
|
return <Tag color={statusInfo.color}>{statusInfo.text}</Tag>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 渲染状态标签
|
||||||
|
const renderState = (state: {} | null | undefined) => {
|
||||||
|
const stateInfo = stateColorMap[state] || { color: 'gray', text: '未知状态' };
|
||||||
|
return <Tag color={stateInfo.color}>{stateInfo.text}</Tag>;
|
||||||
|
};
|
||||||
|
|
||||||
const TableList: React.FC = () => {
|
const TableList: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||||
const columns: ProColumns<ORDERS.Order>[] = [
|
const columns: ProColumns<ORDERS.Refund>[] = [
|
||||||
{
|
{
|
||||||
dataIndex: 'index',
|
dataIndex: 'index',
|
||||||
valueType: 'indexBorder',
|
valueType: 'indexBorder',
|
||||||
@@ -61,10 +75,23 @@ const TableList: React.FC = () => {
|
|||||||
dataIndex: 'refundNo',
|
dataIndex: 'refundNo',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '订单金额',
|
||||||
|
dataIndex: 'orderAmount',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '退款金额',
|
||||||
|
dataIndex: 'refundAmount',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '订单状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
render: (status) => renderStatus(status),
|
render: (status) => renderStatus(status),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '退款状态',
|
||||||
|
dataIndex: 'state',
|
||||||
|
render: (state) => renderState(state),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
@@ -84,7 +111,7 @@ const TableList: React.FC = () => {
|
|||||||
// }
|
// }
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Link>删除</Link>
|
<Link>审核</Link>
|
||||||
</Popconfirm>,
|
</Popconfirm>,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -100,10 +127,10 @@ const TableList: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<ProFormText name="name" label="搜索" placeholder="输入关键字" />
|
<ProFormText name="name" label="搜索" placeholder="输入关键字" />
|
||||||
</QueryFilter>
|
</QueryFilter>
|
||||||
<ProTable<ORDERS.Order>
|
<ProTable<ORDERS.Refund>
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
headerTitle="任务列表"
|
headerTitle="任务列表"
|
||||||
request={order}
|
request={refund}
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
search={false}
|
search={false}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
ProTable,
|
ProTable,
|
||||||
QueryFilter,
|
QueryFilter,
|
||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { Typography, Popconfirm, Space, message, Image, Button } from 'antd';
|
import { Typography, Popconfirm, Space, message, Image, Button, Tag } from 'antd';
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { useRef, useState } from 'react';
|
||||||
import UpdateForm from './components/UpdateForm';
|
import UpdateForm from './components/UpdateForm';
|
||||||
import Upload, { RcFile } from 'antd/lib/upload';
|
import Upload, { RcFile } from 'antd/lib/upload';
|
||||||
@@ -92,6 +92,36 @@ const handleImport = async (file: RcFile) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 状态颜色映射
|
||||||
|
const statusColorMap = {
|
||||||
|
0: { color: 'green', text: '启用' },
|
||||||
|
1: { color: 'red', text: '未启用' },
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// 渲染状态标签
|
||||||
|
const renderStatus = (status: {} | null | undefined) => {
|
||||||
|
const statusInfo = statusColorMap[status] || { color: 'gray', text: '未知状态' };
|
||||||
|
return <Tag color={statusInfo.color}>{statusInfo.text}</Tag>;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 状态颜色映射
|
||||||
|
const typeColorMap = {
|
||||||
|
0: { color: 'yellow', text: '待审核' },
|
||||||
|
1: { color: 'green', text: '活动' },
|
||||||
|
2: { color: 'green', text: '拍照角度' },
|
||||||
|
3: { color: 'green', text: '引导' },
|
||||||
|
4: { color: 'green', text: '大图' },
|
||||||
|
};
|
||||||
|
|
||||||
|
// 渲染状态标签
|
||||||
|
const renderType = (type: {} | null | undefined) => {
|
||||||
|
const typeInfo = typeColorMap[type] || { color: 'gray', text: '未知状态' };
|
||||||
|
return <Tag color={typeInfo.color}>{typeInfo.text}</Tag>;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const TableList: React.FC = () => {
|
const TableList: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [params, setParams] = useState<Record<string, string | number>>({ });
|
const [params, setParams] = useState<Record<string, string | number>>({ });
|
||||||
@@ -127,6 +157,12 @@ const TableList: React.FC = () => {
|
|||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
|
render: (status) => renderStatus(status),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "类型",
|
||||||
|
dataIndex: 'type',
|
||||||
|
render: (type) => renderType(type)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ declare namespace ORDERS {
|
|||||||
id: number;
|
id: number;
|
||||||
orderNo: string;
|
orderNo: string;
|
||||||
refundNo: string;
|
refundNo: string;
|
||||||
|
orderAmount: string;
|
||||||
|
refundAmount: string;
|
||||||
status: number;
|
status: number;
|
||||||
state: number;
|
state: number;
|
||||||
approveReason: string;
|
approveReason: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user