Blame view

src/pages/Invoice/constant.tsx 5.89 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
38
39
40
    dataIndex: 'invoiceId',
    title: 'id',
    valueType: 'text',
    hideInTable: true,
    hideInSearch: true,
    width: 100,
  },
  {
41
42
43
    dataIndex: 'invoiceNumber',
    title: '发票号码',
    valueType: 'text',
zhongnanhuang authored
44
    width: 100,
45
46
47
48
49
  },
  {
    dataIndex: 'invoiceStatus',
    title: '发票类型',
    valueType: 'select',
zhongnanhuang authored
50
    width: 100,
zhongnanhuang authored
51
52
53
54
    valueEnum: enumToProTableEnumValue({
      SPECIALLY_INVOICED: '专票',
      COMMON_INVOICED: '普票',
    }),
55
56
57
  },
  {
    title: '状态',
58
    dataIndex: 'statusText',
59
    valueType: 'text',
60
    width: 180,
61
62
63
64
    hideInSearch: true,
  },
  {
    title: '状态',
65
    dataIndex: 'writeOffIdIsNull',
66
67
    valueType: 'select',
    width: 100,
68
69
70
71
72
73
74
75
76
77
    valueEnum: {
      true: {
        text: '未核销',
        status: false,
      },
      false: {
        text: '已核销',
        status: true,
      },
    },
78
    hideInTable: true,
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
    title: '订单状态',
    dataIndex: 'orderTypeText',
    valueType: 'text',
    width: 180,
  },
  {
    title: '绑定流水号',
    dataIndex: 'serialNumbersTextByOrder',
    hideInSearch: true,
    valueType: 'text',
    width: 180,
  },
  {
    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,
  },
  {
118
119
120
    title: '购买方',
    dataIndex: 'purchaser',
    valueType: 'text',
zhongnanhuang authored
121
    width: 180,
122
123
124
125
126
  },
  {
    title: '收款单位',
    dataIndex: 'payee',
    valueType: 'text',
zhongnanhuang authored
127
    width: 180,
zhongnanhuang authored
128
    valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS),
129
130
131
132
133
  },
  {
    title: '联系人',
    dataIndex: 'contacts',
    valueType: 'text',
zhongnanhuang authored
134
    width: 100,
135
136
137
138
139
  },
  {
    title: '销售',
    dataIndex: 'sale',
    valueType: 'text',
zhongnanhuang authored
140
    width: 100,
141
142
143
144
145
  },
  {
    title: '金额',
    dataIndex: 'money',
    valueType: 'money',
146
147
148
149
150
151
152
153
    hideInSearch: true,
    width: 100,
  },
  {
    title: '开具类型',
    dataIndex: 'invoicingTypeText',
    valueType: 'invoicingTypeText',
    hideInSearch: true,
zhongnanhuang authored
154
    width: 100,
155
156
157
158
  },
  {
    title: '开票日期',
    dataIndex: 'invoicingTime',
zhongnanhuang authored
159
    valueType: 'dateRange',
zhongnanhuang authored
160
    width: 150,
zhongnanhuang authored
161
162
163
164
165
166
167
168
169
170
    search: {
      transform: (value) => {
        if (value) {
          return {
            invoicingBeginTime: value[0],
            invoicingEndTime: value[1],
          };
        }
      },
    },
171
172
173
174
  },
  {
    title: '收款时间',
    dataIndex: 'collectionTime',
zhongnanhuang authored
175
    valueType: 'dateRange',
zhongnanhuang authored
176
    width: 200,
zhongnanhuang authored
177
178
179
180
181
182
183
184
185
186
    search: {
      transform: (value) => {
        if (value) {
          return {
            collectionBeginTime: value[0],
            collectionEndTime: value[1],
          };
        }
      },
    },
187
188
189
190
191
  },
  {
    title: '备注',
    dataIndex: 'notes',
    valueType: 'text',
192
    hideInSearch: true,
zhongnanhuang authored
193
    width: 250,
194
195
  },
];
196
197
198
199
200
201
202
203
const convertToObjectWithTextAndStatus = (obj) => {
  const newObj = {};
  for (const [key, value] of Object.entries(obj)) {
    newObj[key] = { text: value, status: key };
  }
  return newObj;
};
zhongnanhuang authored
204
205
206
export const BANK_STATEMENT_COLUMNS = [
  {
    dataIndex: 'id',
zhongnanhuang authored
207
    title: '编号',
zhongnanhuang authored
208
    valueType: 'text',
zhongnanhuang authored
209
210
211
212
    width: 160,
    copyable: true,
    // hideInTable: true,
    // hideInSearch: true,
zhongnanhuang authored
213
    editable: false,
zhongnanhuang authored
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
    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
240
241
242
243
244
245
    dataIndex: 'serialNumber',
    title: '流水号',
    valueType: 'text',
    width: 100,
  },
  {
246
    dataIndex: 'collectionDatetime',
曾国涛 authored
247
248
    title: '收款时间',
    valueType: 'date',
zhongnanhuang authored
249
    width: 100,
zhongnanhuang authored
250
    hideInSearch: true,
zhongnanhuang authored
251
252
  },
  {
253
    dataIndex: 'collectionDatetimeSearch',
曾国涛 authored
254
    title: '收款时间',
zhongnanhuang authored
255
    valueType: 'dateRange',
zhongnanhuang authored
256
    width: 100,
曾国涛 authored
257
    hideInTable: true,
zhongnanhuang authored
258
259
260
261
    search: {
      transform: (value) => {
        if (value) {
          return {
262
263
            collectionDatetimeBegin: value[0],
            collectionDatetimeEnd: value[1],
zhongnanhuang authored
264
265
266
267
          };
        }
      },
    },
zhongnanhuang authored
268
269
  },
  {
曾国涛 authored
270
271
    dataIndex: 'payeeText',
    title: '收款方',
zhongnanhuang authored
272
273
    valueType: 'text',
    width: 100,
274
275
276
277
278
279
    hideInSearch: true,
  },
  {
    title: '收款方',
    width: 80,
    dataIndex: 'payee',
280
    hideInTable: true,
281
    valueEnum: convertToObjectWithTextAndStatus(PAYEE_OPTIONS),
zhongnanhuang authored
282
283
  },
  {
曾国涛 authored
284
285
    dataIndex: 'payer',
    title: '付款方',
zhongnanhuang authored
286
287
288
289
    valueType: 'text',
    width: 100,
  },
  {
曾国涛 authored
290
291
    dataIndex: 'amount',
    title: '金额',
zhongnanhuang authored
292
293
    valueType: 'text',
    width: 100,
294
    hideInSearch: true,
zhongnanhuang authored
295
296
  },
  {
曾国涛 authored
297
298
    dataIndex: 'remark',
    title: '备注',
zhongnanhuang authored
299
300
    valueType: 'text',
    width: 100,
301
    hideInSearch: true,
zhongnanhuang authored
302
303
304
305
306
307
  },
  {
    dataIndex: 'remarkNote',
    title: '附言',
    valueType: 'text',
    width: 100,
308
    hideInSearch: true,
zhongnanhuang authored
309
310
  },
];