columns.tsx
6.76 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
import { QuestionCircleOutlined } from '@ant-design/icons';
import { UTag, UTooltip } from '@uj/ui';
import type { DataTableColumnsType } from '@/components';
import type { ChannelNode, WithdrawRow } from '@/api';
import {
CHANNEL_PROVIDER,
LIMIT_STORE_FLAG,
PAY_MODE,
TRANSFER_STATUS,
WITHDRAWAL_SOURCE,
WITHDRAWAL_TYPE,
findChannelNode,
optionLabel,
statusMeta,
} from '@/features/shared/dictionaries';
import { centsToYuan, dateTimeOr, numberOr, textOr } from '@/features/shared/format';
export interface TransferColumnHandlers {
/** 身份证列:老系统只在有正面照时可点,点开看正反面。 */
onIdCard: (row: WithdrawRow) => void;
/** 免责协议列:有地址才显示「协议」,点开是 iframe 弹窗。 */
onAgreement: (url: string) => void;
}
/**
* 列顺序、标题与宽度逐字对齐老系统 list.vue 的 tableColumns(31 列)。
* 两处老系统现算的文案仍在前端算:付款渠道要拿渠道树按 code 递归找名字,
* 提现类型/方式/来源/服务商按字典下标取,后端加了新枚举时原样回显而不是显示空白。
*/
export function buildTransferColumns(
channelNodes: ChannelNode[],
handlers: TransferColumnHandlers,
): DataTableColumnsType<WithdrawRow> {
const link = (enabled: boolean) => (enabled ? 'uj-link' : undefined);
return [
{
title: '提现单号',
dataIndex: 'outSettleOrderId',
line: 1,
width: 200,
render: (value) => textOr(value),
},
{
title: '积分时段归属',
dataIndex: 'pointsPeriodTypeDesc',
line: 1,
width: 200,
render: (value) => textOr(value),
},
{
title: '提现类型',
dataIndex: 'transferType',
width: 120,
render: (value) => optionLabel(WITHDRAWAL_TYPE, value) || '—',
},
{
title: '限制门店',
dataIndex: 'limitStoreFlag',
width: 100,
render: (value) => optionLabel(LIMIT_STORE_FLAG, value) || '—',
},
{
title: '手动标签',
dataIndex: 'manualTagPath',
line: 1,
width: 180,
render: (value) => textOr(value),
},
{
title: '主营品牌',
dataIndex: 'mainBrandName',
line: 1,
width: 180,
render: (value) => textOr(value),
},
{ title: '省份', dataIndex: 'provinceName', width: 120, render: (value) => textOr(value) },
{
title: '提现方式',
dataIndex: 'mode',
width: 100,
render: (value) => optionLabel(PAY_MODE, value) || '—',
},
{ title: '客户名称', dataIndex: 'customerName', width: 150, render: (value) => textOr(value) },
{
title: '客户手机号',
dataIndex: 'customerPhone',
width: 140,
render: (value) => <span className="uj-code">{textOr(value)}</span>,
},
{
title: '所属门店',
dataIndex: 'merchantName',
line: 1,
width: 220,
// 老列表把门店编号拼在名字后面,筛选项里也是同一个拼法。
render: (_value, row) =>
textOr(row.merchantName ? `${row.merchantName}(${row.merchantId ?? ''})` : ''),
},
{
// 老系统在这一列的表头挂了个问号提示,内容照搬。
title: (
<UTooltip title="申请积分提现时,获取所属门店关联的最新平台方">
<span className="uj-points-header-hint">
平台方
<QuestionCircleOutlined />
</span>
</UTooltip>
),
dataIndex: 'realityMerchantName',
line: 1,
width: 190,
render: (value) => textOr(value),
},
{
title: '提现积分',
dataIndex: 'integralAmount',
width: 100,
render: (value) => numberOr(value),
},
{
title: '提现金额',
dataIndex: 'payAmount',
width: 110,
render: (value) => <span className="uj-code">{centsToYuan(value)}</span>,
},
{ title: '收款人姓名', dataIndex: 'name', width: 110, render: (value) => textOr(value) },
{
title: '收款人身份证',
dataIndex: 'idCardNo',
width: 200,
render: (value, row) => (
<span
className={link(!!row.idCardFront)}
onClick={() => row.idCardFront && handlers.onIdCard(row)}
>
{textOr(value)}
</span>
),
},
{
title: '收款银行卡号',
dataIndex: 'recvBankCardNo',
width: 230,
render: (value) => <span className="uj-code">{textOr(value)}</span>,
},
{
title: '收款银行',
dataIndex: 'recvBank',
line: 1,
width: 150,
render: (value) => textOr(value),
},
{ title: '收款手机号', dataIndex: 'mobile', width: 130, render: (value) => textOr(value) },
{
title: '微信openid',
dataIndex: 'customerOpenId',
width: 130,
render: (value) => textOr(value),
},
{
title: '状态',
dataIndex: 'status',
width: 120,
render: (value) => {
const meta = statusMeta(TRANSFER_STATUS, value);
if (!meta) return numberOr(value);
return (
<UTag color={meta.color} style={{ borderRadius: 6 }}>
{meta.label}
</UTag>
);
},
},
{
title: '申请时间',
dataIndex: 'createdDate',
width: 170,
render: (value) => dateTimeOr(value),
},
{
title: '来源',
dataIndex: 'withdrawalSource',
width: 140,
render: (value) => optionLabel(WITHDRAWAL_SOURCE, value) || '—',
},
{
title: '付款渠道',
dataIndex: 'channel',
width: 160,
render: (_value, row) => textOr(findChannelNode(channelNodes, row.channel)?.name),
},
{
title: '付款主体',
dataIndex: 'paymentEntityName',
line: 1,
width: 200,
render: (value) => textOr(value),
},
{
title: '代征主体',
dataIndex: 'levyName',
line: 1,
width: 200,
render: (value) => textOr(value),
},
{ title: '付款时间', dataIndex: 'payDate', width: 170, render: (value) => dateTimeOr(value) },
{
title: '服务商',
dataIndex: 'channelProvider',
width: 120,
render: (value) => optionLabel(CHANNEL_PROVIDER, value) || '—',
},
{
title: '到账时间',
dataIndex: 'receiptDate',
width: 170,
render: (value) => dateTimeOr(value),
},
{
title: '结算金额/元',
dataIndex: 'settleAmount',
width: 130,
render: (value) => <span className="uj-code">{centsToYuan(value)}</span>,
},
{
title: '免责协议',
dataIndex: 'disclaimerAgreementUrl',
width: 110,
render: (value) =>
value ? (
<span className={link(true)} onClick={() => handlers.onAgreement(String(value))}>
协议
</span>
) : (
'—'
),
},
];
}