1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
| import { Button } from 'antd';
| import { useRef, useState } from 'react';
| import { PageContainer, ProTable } from '@ant-design/pro-components';
| import RefundDetailModal from './components/RefundDetailModal';
| import { getRefundRecordsList } from './service';
| import { buildProTableDataSource } from '@/utils/antdUtils';
| import { Access, useAccess } from 'umi';
|
| const RefundRecords = () => {
| const access = useAccess();
| const actionRef = useRef();
| const [detailVisible, setDetailVisible] = useState(false);
| const [currentId, setCurrentId] = useState(null);
|
| // 状态映射
| const auditStatusMap = {
| 1: { text: '待审核', status: 'Warning' },
| 2: { text: '审核通过', status: 'Success' },
| 3: { text: '审核驳回', status: 'Error' },
| };
|
| const paymentTypeMap = {
| 1: '订金+尾款',
| 2: '全款',
| };
|
| const columns = [
| {
| title: '序号',
| dataIndex: 'index',
| hideInSearch: true,
| width: 60,
| render: (text, record, index) => index + 1,
| },
| {
| title: '订单编号',
| dataIndex: 'code',
| width: 180,
| copyable: true,
| ellipsis: true,
| order: 4,
| search: {
| transform: (value) => ({
| code: value,
| }),
| },
| },
| {
| title: '下单时间',
| dataIndex: 'createTime',
| valueType: 'dateRange',
| width: 240,
| order: 2,
| search: {
| transform: (value) => ({
| time: value ? value.join(' - ') : undefined,
| }),
| },
| },
| {
| title: '用户手机号',
| dataIndex: 'phone',
| width: 120,
| order: 3,
| search: {
| transform: (value) => ({
| phone: value,
| }),
| },
| },
| {
| title: '下单用户',
| dataIndex: 'userName',
| hideInSearch: true,
| width: 120,
| ellipsis: true,
| },
| {
| title: '订单价格',
| dataIndex: 'orderPrice',
| hideInSearch: true,
| width: 100,
| render: (text) => `¥${text}`,
| search: false,
| },
| {
| title: '商品名称',
| dataIndex: 'bigGiftPackageName',
| width: 200,
| hideInSearch: true,
| ellipsis: true,
| search: {
| transform: (value) => ({
| name: value,
| }),
| },
| },
| {
| title: '支付方式',
| dataIndex: 'paymentType',
| hideInSearch: true,
| valueType: 'select',
| valueEnum: paymentTypeMap,
| width: 120,
| },
| {
| title: '审核状态',
| dataIndex: 'auditStatus',
| valueType: 'select',
| valueEnum: auditStatusMap,
| order: 1,
| width: 120,
| search: {
| transform: (value) => ({
| auditStatus: value,
| }),
| },
| },
| {
| title: '操作',
| dataIndex: 'action',
| valueType: 'option',
| width: 100,
| fixed: 'right',
| render: (_, record) => (
| <Access accessible={access.refundRecords_detail || false}>
| <Button
| type="link"
| size="small"
| onClick={() => {
| setCurrentId(record.id);
| setDetailVisible(true);
| }}
| >
| 详情
| </Button>
| </Access>
| ),
| },
| ];
|
| return (
| <PageContainer>
| <ProTable
| actionRef={actionRef}
| rowKey="id"
| search={{
| labelWidth: 'auto',
| defaultCollapsed: false,
| }}
| request={(params) => buildProTableDataSource(getRefundRecordsList, params)}
| columns={columns}
| scroll={{ x: 1400 }}
| pagination={{
| showSizeChanger: true,
| showQuickJumper: true,
| defaultPageSize: 10,
| }}
| />
|
| {/* 详情弹窗 */}
| <RefundDetailModal
| visible={detailVisible}
| onCancel={() => {
| setDetailVisible(false);
| setCurrentId(null);
| }}
| id={currentId}
| />
| </PageContainer>
| );
| };
|
| export default RefundRecords;
|
|