Blame view

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