Blame view

src/pages/Invoice/constant.tsx 6.73 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',
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',
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',
140
    width: 180,
141
142
143
144
145
  },
  {
    title: '收款单位',
    dataIndex: 'payee',
    valueType: 'text',
146
    width: 180,
zhongnanhuang authored
147
    valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
148
149
150
151
152
  },
  {
    title: '联系人',
    dataIndex: 'contacts',
    valueType: 'text',
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',
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,
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',
192
    dataIndex: 'invoicingTime',
193
    width: 150,
194
    hideInTable: true,
zhongnanhuang authored
195
196
197
198
199
200
201
202
203
204
    search: {
      transform: (value) => {
        if (value) {
          return {
            invoicingBeginTime: value[0],
            invoicingEndTime: value[1],
          };
        }
      },
    },
205
206
207
208
  },
  {
    title: '收款时间',
    dataIndex: 'collectionTime',
209
    valueType: 'date',
210
211
212
213
214
215
216
    hideInSearch: true,
    width: 200,
  },
  {
    title: '收款时间',
    valueType: 'dateRange',
    hideInTable: true,
217
    width: 200,
zhongnanhuang authored
218
219
220
221
222
223
224
225
226
227
    search: {
      transform: (value) => {
        if (value) {
          return {
            collectionBeginTime: value[0],
            collectionEndTime: value[1],
          };
        }
      },
    },
228
229
230
231
232
  },
  {
    title: '备注',
    dataIndex: 'notes',
    valueType: 'text',
233
    hideInSearch: true,
234
    width: 250,
235
236
  },
];
237
238
239
240
241
242
243
244
const convertToObjectWithTextAndStatus = (obj) => {
  const newObj = {};
  for (const [key, value] of Object.entries(obj)) {
    newObj[key] = { text: value, status: key };
  }
  return newObj;
};
zhongnanhuang authored
245
246
247
export const BANK_STATEMENT_COLUMNS = [
  {
    dataIndex: 'id',
zhongnanhuang authored
248
    title: '编号',
zhongnanhuang authored
249
    valueType: 'text',
zhongnanhuang authored
250
251
252
253
    width: 160,
    copyable: true,
    // hideInTable: true,
    // hideInSearch: true,
zhongnanhuang authored
254
    editable: false,
zhongnanhuang authored
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
280
    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
281
282
283
284
285
286
    dataIndex: 'serialNumber',
    title: '流水号',
    valueType: 'text',
    width: 100,
  },
  {
287
    dataIndex: 'collectionDatetime',
曾国涛 authored
288
289
    title: '收款时间',
    valueType: 'date',
zhongnanhuang authored
290
    width: 100,
zhongnanhuang authored
291
    hideInSearch: true,
zhongnanhuang authored
292
293
  },
  {
294
    dataIndex: 'collectionDatetimeSearch',
曾国涛 authored
295
    title: '收款时间',
zhongnanhuang authored
296
    valueType: 'dateRange',
zhongnanhuang authored
297
    width: 100,
曾国涛 authored
298
    hideInTable: true,
zhongnanhuang authored
299
300
301
302
    search: {
      transform: (value) => {
        if (value) {
          return {
303
304
            collectionDatetimeBegin: value[0],
            collectionDatetimeEnd: value[1],
zhongnanhuang authored
305
306
307
308
          };
        }
      },
    },
zhongnanhuang authored
309
310
  },
  {
曾国涛 authored
311
312
    dataIndex: 'payeeText',
    title: '收款方',
zhongnanhuang authored
313
314
    valueType: 'text',
    width: 100,
315
316
317
318
319
320
    hideInSearch: true,
  },
  {
    title: '收款方',
    width: 80,
    dataIndex: 'payee',
321
    hideInTable: true,
322
    valueEnum: convertToObjectWithTextAndStatus(PAYEE_OPTIONS),
zhongnanhuang authored
323
324
  },
  {
曾国涛 authored
325
326
    dataIndex: 'payer',
    title: '付款方',
zhongnanhuang authored
327
328
329
330
    valueType: 'text',
    width: 100,
  },
  {
曾国涛 authored
331
332
    dataIndex: 'amount',
    title: '金额',
zhongnanhuang authored
333
334
    valueType: 'text',
    width: 100,
335
    hideInSearch: true,
zhongnanhuang authored
336
337
  },
  {
338
339
340
341
342
343
344
    dataIndex: 'amount',
    title: '金额',
    valueType: 'money',
    width: 100,
    hideInTable: true,
  },
  {
曾国涛 authored
345
346
    dataIndex: 'remark',
    title: '备注',
zhongnanhuang authored
347
348
    valueType: 'text',
    width: 100,
349
    hideInSearch: true,
zhongnanhuang authored
350
351
352
353
354
355
  },
  {
    dataIndex: 'remarkNote',
    title: '附言',
    valueType: 'text',
    width: 100,
356
    hideInSearch: true,
zhongnanhuang authored
357
358
  },
];