fields.ts
4.24 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
import type { FieldSchema } from '@/components';
import { compactParams, expandDateRanges } from '@/features/shared/format';
import {
LIMIT_STORE_FLAG,
PAY_MODE,
POINTS_PERIOD,
TRANSFER_STATUS,
WITHDRAWAL_SOURCE,
WITHDRAWAL_TYPE,
statusOptions,
withAll,
} from '@/features/shared/dictionaries';
import type { DictOption } from '@/api';
/**
* 提现列表的筛选区。
*
* 字段名逐字对齐老系统 showFormData(提交给接口的就是这些 key),顺序也保持原样;
* 三个时间区间在表单里各是一个区间,提交前才展开成接口的起止字段。
*/
/** 老系统这三个区间都用 00:00:01 起、23:59:59 止,见 getParams()。 */
const DATE_RANGES = [
{ from: 'applyDateStr', start: 'applyDateStart', end: 'applyDateEnd' },
{ from: 'payTimeStr', start: 'payDateStart', end: 'payDateEnd' },
{ from: 'receiptDateStr', start: 'receiptDateStart', end: 'receiptDateEnd' },
];
/** 手动标签:老系统用级联选到任意一级,接口只认那个节点的 id。 */
export function toTransferParams(values: Record<string, unknown>): Record<string, unknown> {
return compactParams(expandDateRanges({ ...values }, DATE_RANGES));
}
export interface TransferFieldDeps {
/** 渠道树顶层节点:付款渠道筛选就是这一层(老系统把级联注释掉了,只剩平铺下拉)。 */
channels: DictOption[];
/** 付款主体不是独立接口,而是所选渠道下的子节点去重。 */
entities: DictOption[];
merchants: DictOption[];
brands: DictOption[];
provinces: DictOption[];
/** 标签树摊平成「一级 / 二级」这种路径文案,选中任意层级都能筛。 */
tags: DictOption[];
}
export function buildTransferFields(
deps: TransferFieldDeps,
): FieldSchema<Record<string, unknown>>[] {
return [
{
name: 'outSettleOrderId',
label: '提现单号',
type: 'input',
placeholder: '请输入提现单号',
inputProps: { maxLength: 25 },
essential: true,
},
{
name: 'customerName',
label: '客户名称',
type: 'input',
placeholder: '请输入客户名称',
inputProps: { maxLength: 20 },
essential: true,
},
{
name: 'customerPhone',
label: '手机号',
type: 'input',
placeholder: '请输入手机号',
inputProps: { maxLength: 11 },
},
{
name: 'name',
label: '收款人姓名',
type: 'input',
placeholder: '请输入收款人姓名',
inputProps: { maxLength: 20 },
},
{
name: 'status',
label: '状态',
type: 'select',
options: withAll(statusOptions(TRANSFER_STATUS)),
essential: true,
},
{ name: 'applyDateStr', label: '申请时间', type: 'dateRange', essential: true },
{ name: 'payTimeStr', label: '付款时间', type: 'dateRange' },
{ name: 'channel', label: '付款渠道', type: 'select', options: withAll(deps.channels) },
{
name: 'paymentEntityCode',
label: '付款主体',
type: 'select',
options: withAll(deps.entities),
},
{ name: 'merchantIds', label: '所属门店', type: 'selectMultiple', options: deps.merchants },
{ name: 'receiptDateStr', label: '到账时间', type: 'dateRange' },
{ name: 'transferType', label: '提现类型', type: 'select', options: withAll(WITHDRAWAL_TYPE) },
{ name: 'mode', label: '提现方式', type: 'select', options: withAll(PAY_MODE) },
{
name: 'withdrawalSource',
label: '来源',
type: 'select',
options: withAll(WITHDRAWAL_SOURCE),
},
{ name: 'realityMerchantName', label: '平台方', type: 'input', placeholder: '请输入平台方' },
{
name: 'limitStoreFlagQuery',
label: '限制门店',
type: 'select',
options: withAll(LIMIT_STORE_FLAG),
},
{ name: 'mainBrandIds', label: '主营品牌', type: 'selectMultiple', options: deps.brands },
{ name: 'provinceCodes', label: '省份', type: 'selectMultiple', options: deps.provinces },
{
name: 'transferOutTagIdQuery',
label: '手动标签项',
type: 'select',
options: withAll(deps.tags),
},
{
name: 'pointsPeriodType',
label: '积分时段归属',
type: 'select',
options: withAll(POINTS_PERIOD),
},
];
}