Blame view

src/pages/Invoice/constant.tsx 6.58 KB
zhongnanhuang authored
1
2
3
import { enumToProTableEnumValue } from '@/utils';
import { PAYEE_OPTIONS } from '../Order/constant';
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export type InvoiceItem = {
  id: number; //id
  invoiceStatus: string; //发票类型:专票/普票
  invoiceNumber: string; //发票号码
  status: string; //状态
  purchaser: string; //购买方
  payee: string; //收款单位
  contacts: string; //联系人
  sale: string; //销售
  money: number; //金额
  invoicingTime: string; //开票日期
  collectionTime: string; //收款时间
  notes: string; //备注
};
zhongnanhuang authored
19
20
21
22
export const INVOICE_STATUS = {
  UNVERIFIED: '未核销',
  VERIFIED: '已核销',
  ABNORMAL: '异常',
zhongnanhuang authored
23
  PARTIAL_VERIFICATION: '部分核销',
zhongnanhuang authored
24
25
};
26
27
28
29
30
export const BANKSTATEMENT_STATUS = {
  VERIFIED: '已核销',
  ABNORMAL: '异常',
};
31
32
export const INVOICE_COLUMNS = [
  {
zhongnanhuang authored
33
34
35
36
37
    dataIndex: 'invoiceId',
    title: 'id',
    valueType: 'text',
    hideInTable: true,
    hideInSearch: true,
38
    readonly: true,
zhongnanhuang authored
39
40
41
    width: 100,
  },
  {
42
43
44
    dataIndex: 'invoiceNumber',
    title: '发票号码',
    valueType: 'text',
zhongnanhuang authored
45
    width: 100,
46
47
48
49
50
  },
  {
    dataIndex: 'invoiceStatus',
    title: '发票类型',
    valueType: 'select',
zhongnanhuang authored
51
    width: 100,
zhongnanhuang authored
52
53
54
55
    valueEnum: enumToProTableEnumValue({
      SPECIALLY_INVOICED: '专票',
      COMMON_INVOICED: '普票',
    }),
56
57
58
  },
  {
    title: '状态',
59
    dataIndex: 'statusText',
60
    valueType: 'text',
61
    width: 180,
62
    readonly: true,
63
64
65
66
    hideInSearch: true,
  },
  {
    title: '状态',
67
    dataIndex: 'writeOffIdIsNull',
68
69
    valueType: 'select',
    width: 100,
70
71
72
73
74
75
76
77
78
79
    valueEnum: {
      true: {
        text: '未核销',
        status: false,
      },
      false: {
        text: '已核销',
        status: true,
      },
    },
80
    hideInTable: true,
81
82
  },
  {
83
84
    title: '订单状态',
    dataIndex: 'orderTypeText',
85
    readonly: true,
86
    valueType: 'text',
87
    hideInSearch: true,
88
89
90
91
92
    width: 180,
  },
  {
    title: '绑定流水号',
    dataIndex: 'serialNumbersTextByOrder',
93
    readonly: true,
94
95
96
97
98
    hideInSearch: true,
    valueType: 'text',
    width: 180,
  },
  {
99
100
101
102
103
104
105
    title: '金额',
    dataIndex: 'money',
    hideInTable: true,
    valueType: 'money',
    width: 180,
  },
  {
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
    title: '是否预付款',
    dataIndex: 'orderIsPrePay',
    valueType: 'select',
    valueEnum: {
      true: {
        text: '是',
        status: true,
      },
      false: {
        text: '否',
        status: false,
      },
    },
    hideInTable: true,
    width: 180,
  },
  {
    title: '绑定流水号',
    dataIndex: 'serialNumberLike',
    hideInTable: true,
    valueType: 'text',
    width: 180,
  },
  {
130
131
132
    title: '购买方',
    dataIndex: 'purchaser',
    valueType: 'text',
zhongnanhuang authored
133
    width: 180,
134
135
136
137
138
  },
  {
    title: '收款单位',
    dataIndex: 'payee',
    valueType: 'text',
zhongnanhuang authored
139
    width: 180,
zhongnanhuang authored
140
    valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
141
142
143
144
145
  },
  {
    title: '联系人',
    dataIndex: 'contacts',
    valueType: 'text',
zhongnanhuang authored
146
    width: 100,
147
148
  },
  {
149
150
151
152
153
154
    title: '来源',
    dataIndex: 'createByName',
    valueType: 'text',
    width: 100,
  },
  {
155
156
157
    title: '销售',
    dataIndex: 'sale',
    valueType: 'text',
zhongnanhuang authored
158
    width: 100,
159
160
161
162
163
  },
  {
    title: '金额',
    dataIndex: 'money',
    valueType: 'money',
164
165
166
167
168
169
170
171
    hideInSearch: true,
    width: 100,
  },
  {
    title: '开具类型',
    dataIndex: 'invoicingTypeText',
    valueType: 'invoicingTypeText',
    hideInSearch: true,
172
    readonly: true,
zhongnanhuang authored
173
    width: 100,
174
175
176
177
  },
  {
    title: '开票日期',
    dataIndex: 'invoicingTime',
178
179
180
181
182
183
    valueType: 'date',
    width: 150,
    hideInSearch: true,
  },
  {
    title: '开票日期',
184
    valueType: 'dateRange',
zhongnanhuang authored
185
    width: 150,
186
    hideInTable: true,
zhongnanhuang authored
187
188
189
190
191
192
193
194
195
196
    search: {
      transform: (value) => {
        if (value) {
          return {
            invoicingBeginTime: value[0],
            invoicingEndTime: value[1],
          };
        }
      },
    },
197
198
199
200
  },
  {
    title: '收款时间',
    dataIndex: 'collectionTime',
201
    valueType: 'date',
202
203
204
205
206
207
208
    hideInSearch: true,
    width: 200,
  },
  {
    title: '收款时间',
    valueType: 'dateRange',
    hideInTable: true,
zhongnanhuang authored
209
    width: 200,
zhongnanhuang authored
210
211
212
213
214
215
216
217
218
219
    search: {
      transform: (value) => {
        if (value) {
          return {
            collectionBeginTime: value[0],
            collectionEndTime: value[1],
          };
        }
      },
    },
220
221
222
223
224
  },
  {
    title: '备注',
    dataIndex: 'notes',
    valueType: 'text',
225
    hideInSearch: true,
zhongnanhuang authored
226
    width: 250,
227
228
  },
];
229
230
231
232
233
234
235
236
const convertToObjectWithTextAndStatus = (obj) => {
  const newObj = {};
  for (const [key, value] of Object.entries(obj)) {
    newObj[key] = { text: value, status: key };
  }
  return newObj;
};
zhongnanhuang authored
237
238
239
export const BANK_STATEMENT_COLUMNS = [
  {
    dataIndex: 'id',
zhongnanhuang authored
240
    title: '编号',
zhongnanhuang authored
241
    valueType: 'text',
zhongnanhuang authored
242
243
244
245
    width: 160,
    copyable: true,
    // hideInTable: true,
    // hideInSearch: true,
zhongnanhuang authored
246
    editable: false,
zhongnanhuang authored
247
248
  },
  {
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
    dataIndex: 'statusText',
    title: '状态',
    hideInSearch: true,
    valueType: 'text',
    width: 100,
  },
  {
    dataIndex: 'writeOffIdIsNull',
    title: '状态',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      true: {
        text: '未核销',
        status: false,
      },
      false: {
        text: '已核销',
        status: true,
      },
    },
    width: 100,
  },
  {
zhongnanhuang authored
273
274
275
276
277
278
    dataIndex: 'serialNumber',
    title: '流水号',
    valueType: 'text',
    width: 100,
  },
  {
279
    dataIndex: 'collectionDatetime',
曾国涛 authored
280
281
    title: '收款时间',
    valueType: 'date',
zhongnanhuang authored
282
    width: 100,
zhongnanhuang authored
283
    hideInSearch: true,
zhongnanhuang authored
284
285
  },
  {
286
    dataIndex: 'collectionDatetimeSearch',
曾国涛 authored
287
    title: '收款时间',
zhongnanhuang authored
288
    valueType: 'dateRange',
zhongnanhuang authored
289
    width: 100,
曾国涛 authored
290
    hideInTable: true,
zhongnanhuang authored
291
292
293
294
    search: {
      transform: (value) => {
        if (value) {
          return {
295
296
            collectionDatetimeBegin: value[0],
            collectionDatetimeEnd: value[1],
zhongnanhuang authored
297
298
299
300
          };
        }
      },
    },
zhongnanhuang authored
301
302
  },
  {
曾国涛 authored
303
304
    dataIndex: 'payeeText',
    title: '收款方',
zhongnanhuang authored
305
306
    valueType: 'text',
    width: 100,
307
308
309
310
311
312
    hideInSearch: true,
  },
  {
    title: '收款方',
    width: 80,
    dataIndex: 'payee',
313
    hideInTable: true,
314
    valueEnum: convertToObjectWithTextAndStatus(PAYEE_OPTIONS),
zhongnanhuang authored
315
316
  },
  {
曾国涛 authored
317
318
    dataIndex: 'payer',
    title: '付款方',
zhongnanhuang authored
319
320
321
322
    valueType: 'text',
    width: 100,
  },
  {
曾国涛 authored
323
324
    dataIndex: 'amount',
    title: '金额',
zhongnanhuang authored
325
326
    valueType: 'text',
    width: 100,
327
    hideInSearch: true,
zhongnanhuang authored
328
329
  },
  {
330
331
332
333
334
335
336
    dataIndex: 'amount',
    title: '金额',
    valueType: 'money',
    width: 100,
    hideInTable: true,
  },
  {
曾国涛 authored
337
338
    dataIndex: 'remark',
    title: '备注',
zhongnanhuang authored
339
340
    valueType: 'text',
    width: 100,
341
    hideInSearch: true,
zhongnanhuang authored
342
343
344
345
346
347
  },
  {
    dataIndex: 'remarkNote',
    title: '附言',
    valueType: 'text',
    width: 100,
348
    hideInSearch: true,
zhongnanhuang authored
349
350
  },
];