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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
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
240
241
242
243
244
245
246
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { AftersalesReturnApi } from '#/api/aftersales/return';
|
| import { DICT_TYPE } from '@vben/constants';
| import { getDictOptions } from '@vben/hooks';
|
| export { AftersaleReturnStatusEnum } from '@vben/constants';
|
| /** 退货类型选项 */
| export const RETURN_TYPE_OPTIONS = [
| { label: '退款退货', value: 1 },
| { label: '换货', value: 2 },
| { label: '仅退款', value: 3 },
| ];
|
| /** 表单类型 */
| export type ReturnFormType = 'create' | 'detail';
|
| /** 退货申请表单 schema */
| export function useReturnFormSchema(
| formType: ReturnFormType,
| ): VbenFormSchema[] {
| return [
| {
| fieldName: 'id',
| component: 'Input',
| dependencies: {
| triggerFields: [''],
| show: () => false,
| },
| },
| {
| fieldName: 'ticketId',
| label: '售后工单',
| component: 'Input',
| componentProps: {
| disabled: true,
| placeholder: '售后工单',
| },
| },
| {
| fieldName: 'customerName',
| label: '客户',
| component: 'Input',
| componentProps: {
| disabled: true,
| placeholder: '客户',
| },
| },
| {
| fieldName: 'saleOrderId',
| label: '销售订单ID',
| component: 'Input',
| dependencies: {
| triggerFields: [''],
| show: () => false,
| },
| },
| ...(formType === 'detail'
| ? [
| {
| fieldName: 'no',
| label: '退货单号',
| component: 'Input',
| componentProps: {
| disabled: true,
| placeholder: '退货单号',
| },
| },
| {
| fieldName: 'status',
| label: '单据状态',
| component: 'Select',
| componentProps: {
| disabled: true,
| options: getDictOptions(
| DICT_TYPE.AFTERSALE_RETURN_STATUS,
| 'number',
| ),
| placeholder: '单据状态',
| },
| },
| {
| fieldName: 'totalReturnPrice',
| label: '应退金额',
| component: 'Input',
| componentProps: {
| disabled: true,
| placeholder: '应退金额',
| },
| },
| {
| fieldName: 'actualRefundPrice',
| label: '实退金额',
| component: 'Input',
| componentProps: {
| disabled: true,
| placeholder: '实退金额',
| },
| },
| {
| fieldName: 'mesReturnCode',
| label: 'MES退货单号',
| component: 'Input',
| componentProps: {
| disabled: true,
| placeholder: 'MES退货单号',
| },
| },
| {
| fieldName: 'qualityResult',
| label: '质检结果',
| component: 'Input',
| componentProps: {
| disabled: true,
| placeholder: '质检结果',
| },
| },
| {
| fieldName: 'qualityReportUrl',
| label: '质检报告',
| component: 'Input',
| componentProps: {
| disabled: true,
| placeholder: '质检报告',
| },
| },
| ]
| : []),
| {
| fieldName: 'returnType',
| label: '退货类型',
| component: 'Select',
| componentProps: {
| options: RETURN_TYPE_OPTIONS,
| placeholder: '请选择退货类型',
| },
| rules: 'selectRequired',
| },
| {
| fieldName: 'returnReason',
| label: '退货原因',
| component: 'Textarea',
| formItemClass: 'col-span-3',
| componentProps: {
| placeholder: '请输入退货原因',
| rows: 3,
| },
| rules: 'required',
| },
| {
| fieldName: 'defectCategory',
| label: '缺陷类别',
| component: 'Input',
| componentProps: {
| placeholder: '请输入缺陷类别',
| },
| },
| {
| fieldName: 'remark',
| label: '备注',
| component: 'Textarea',
| formItemClass: 'col-span-3',
| componentProps: {
| placeholder: '请输入备注',
| rows: 3,
| },
| },
| ];
| }
|
| /** 列表搜索表单 schema */
| export function useReturnGridFormSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'no',
| label: '退货单号',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入退货单号',
| },
| },
| {
| fieldName: 'ticketId',
| label: '售后工单',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入售后工单号',
| },
| },
| {
| fieldName: 'customerId',
| label: '客户',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入客户',
| },
| },
| {
| fieldName: 'status',
| label: '单据状态',
| component: 'Select',
| componentProps: {
| allowClear: true,
| options: getDictOptions(DICT_TYPE.AFTERSALE_RETURN_STATUS, 'number'),
| placeholder: '请选择单据状态',
| },
| },
| ];
| }
|
| /** 列表字段 */
| export function useReturnGridColumns(): VxeTableGridOptions<AftersalesReturnApi.Return>['columns'] {
| return [
| {
| field: 'no',
| title: '退货单号',
| minWidth: 160,
| slots: { default: 'no' },
| },
| {
| field: 'ticketId',
| title: '售后工单',
| minWidth: 120,
| slots: { default: 'ticketId' },
| },
| {
| field: 'customerName',
| title: '客户名称',
| minWidth: 150,
| },
| {
| field: 'returnType',
| title: '退货类型',
| minWidth: 110,
| slots: { default: 'returnType' },
| },
| {
| field: 'totalReturnPrice',
| title: '应退金额',
| minWidth: 110,
| },
| {
| field: 'actualRefundPrice',
| title: '实退金额',
| minWidth: 110,
| },
| {
| field: 'status',
| title: '单据状态',
| minWidth: 110,
| slots: { default: 'status' },
| },
| {
| field: 'mesReturnCode',
| title: 'MES退货单号',
| minWidth: 140,
| },
| {
| field: 'qualityResult',
| title: '质检结果',
| minWidth: 110,
| slots: { default: 'qualityResult' },
| },
| {
| field: 'createTime',
| title: '创建时间',
| width: 180,
| formatter: 'formatDate',
| },
| {
| title: '操作',
| width: 180,
| fixed: 'right',
| slots: { default: 'actions' },
| },
| ];
| }
|
| /** 退货明细子表字段 */
| export function useReturnItemGridColumns(): VxeTableGridOptions<AftersalesReturnApi.ReturnItem>['columns'] {
| return [
| {
| field: 'itemCode',
| title: '物料编码',
| minWidth: 120,
| },
| {
| field: 'itemName',
| title: '物料名称',
| minWidth: 140,
| },
| {
| field: 'batchCode',
| title: '批次号',
| minWidth: 120,
| },
| {
| field: 'returnQuantity',
| title: '退货数量',
| width: 100,
| },
| {
| field: 'unitPrice',
| title: '单价',
| width: 100,
| },
| {
| field: 'returnPrice',
| title: '退货金额',
| width: 110,
| },
| ];
| }
|
|