Commit 6376c35ac968f1b16c83a4556f12376d87cbddcc
Merge branch 'master' of http://39.108.227.113:8001/zhusen/canrd-erp-front
Showing
3 changed files
with
668 additions
and
2 deletions
src/pages/Instalment/components/title/titletest.tsx
0 → 100644
1 | +// import type { ProColumns } from '@ant-design/pro-components'; | |
2 | +// import { | |
3 | +// EditableProTable, | |
4 | +// ProCard, | |
5 | +// ProFormField, | |
6 | +// ProFormRadio, | |
7 | +// useRefFunction, | |
8 | +// } from '@ant-design/pro-components'; | |
9 | +// import { | |
10 | +// deleteOrderErpOrderStagesDelect, | |
11 | +// getOrderErpOrderStagesListAll, | |
12 | +// postOrderErpOrderStagesSearch, | |
13 | +// } from '@/services'; | |
14 | +// import { orderExport } from '@/services/order'; | |
15 | +// import { VerticalAlignTopOutlined } from '@ant-design/icons'; | |
16 | +// import { ProTable } from '@ant-design/pro-components'; | |
17 | +// import { Button, message } from 'antd'; | |
18 | +// import { useRef } from 'react'; | |
19 | +// import Comfire from '../comfire/comfire'; | |
20 | +// import AddModel from '../detail/detail'; | |
21 | +// import EditorModel from '../edit/edit'; | |
22 | +// import ReadModel from '../read/read'; | |
23 | +// import UploadModel from '../upload/uploadModel'; | |
24 | +// import './title.less'; | |
25 | +// import React, { useState } from 'react'; | |
26 | + | |
27 | +// export const waitTimePromise = async (time: number = 100) => { | |
28 | +// return new Promise((resolve) => { | |
29 | +// setTimeout(() => { | |
30 | +// resolve(true); | |
31 | +// }, time); | |
32 | +// }); | |
33 | +// }; | |
34 | + | |
35 | +// export const waitTime = async (time: number = 100) => { | |
36 | +// await waitTimePromise(time); | |
37 | +// }; | |
38 | + | |
39 | +// type OrderStagesItem = { | |
40 | +// //文件编号 | |
41 | +// id?: number; | |
42 | +// //合同编号 | |
43 | +// contract?: string; | |
44 | +// //供应商名称 | |
45 | +// vendor?: string; | |
46 | +// //签合同日期 | |
47 | +// dateRange?: Date; | |
48 | +// //终端名称 | |
49 | +// terminal?: string; | |
50 | +// //设备编号 | |
51 | +// dId?: number; | |
52 | +// //设备名称 | |
53 | +// deviceName?: string; | |
54 | +// //设备型号 | |
55 | +// deviceModel?: string; | |
56 | +// //数量 | |
57 | +// count?: number; | |
58 | +// //单价 | |
59 | +// unitPrice?: number; | |
60 | +// //总价 | |
61 | +// price?: number; | |
62 | +// //合同总金额 | |
63 | +// totalPrice?: number; | |
64 | +// //付款方式 | |
65 | +// payWay?: string; | |
66 | +// //附件 | |
67 | +// annex?: string; | |
68 | +// //备注 | |
69 | +// remark?: string; | |
70 | +// //可选操作 | |
71 | +// opt?: string[]; | |
72 | +// //子类 | |
73 | +// children?:OrderStagesItem[] | |
74 | +// }; | |
75 | + | |
76 | +// type OrderStagesWithListItem = { | |
77 | +// //文件编号 | |
78 | +// id: number; | |
79 | +// //合同编号 | |
80 | +// contract: string; | |
81 | +// //供应商名称 | |
82 | +// vendor: string; | |
83 | +// //签合同日期 | |
84 | +// dateRange: Date; | |
85 | +// //终端名称 | |
86 | +// terminal: string; | |
87 | +// orderStagesDeviceVoList: orderStagesDevice[]; | |
88 | +// //合同总金额 | |
89 | +// totalPrice: number; | |
90 | +// //付款方式 | |
91 | +// payWay: string; | |
92 | +// //附件 | |
93 | +// annex: string; | |
94 | +// //备注 | |
95 | +// remark: string; | |
96 | +// //可选操作 | |
97 | +// paths:string[]; | |
98 | +// }; | |
99 | + | |
100 | +// type orderStagesDevice = { | |
101 | +// //设备id | |
102 | +// dId: number; | |
103 | +// //设备名称 | |
104 | +// deviceName: string; | |
105 | +// //设备型号 | |
106 | +// deviceModel: string; | |
107 | +// //数量 | |
108 | +// count: number; | |
109 | +// //单价 | |
110 | +// unitPrice: number; | |
111 | +// //总价 | |
112 | +// price: number; | |
113 | +// }; | |
114 | + | |
115 | +// const filterOrderStages = ( | |
116 | +// data: readonly OrderStagesWithListItem[], | |
117 | +// id: number | undefined, | |
118 | +// ): OrderStagesWithListItem[] => { | |
119 | +// return data.reduce<OrderStagesWithListItem[]>((accumulator, item) => { | |
120 | +// // If the current item's id does not match the given id | |
121 | +// if (item.id !== id) { | |
122 | +// // If the item has a device list, we can also filter it if needed | |
123 | +// const filteredDevices = item.orderStagesDeviceVoList.filter(device => device.dId !== id); | |
124 | + | |
125 | +// // Create a new item without the filtered devices | |
126 | +// const newItem: OrderStagesWithListItem = { | |
127 | +// ...item, | |
128 | +// orderStagesDeviceVoList: filteredDevices, | |
129 | +// }; | |
130 | + | |
131 | +// // Add the new item to the accumulator | |
132 | +// accumulator.push(newItem); | |
133 | +// } | |
134 | +// return accumulator; | |
135 | +// }, []); | |
136 | +// }; | |
137 | + | |
138 | +// export default () => { | |
139 | +// const [editableKeys, setEditableRowKeys] = useState<React.Key[]>([]); | |
140 | +// const [dataSource, setDataSource] = useState<readonly OrderStagesWithListItem[]>( | |
141 | +// [] | |
142 | +// ); | |
143 | + | |
144 | +// interface ActionType { | |
145 | +// reload: (resetPageIndex?: boolean) => void; | |
146 | +// reloadAndRest: () => void; | |
147 | +// reset: () => void; | |
148 | +// clearSelected?: () => void; | |
149 | +// startEditable: (rowKey: Key) => boolean; | |
150 | +// cancelEditable: (rowKey: Key) => boolean; | |
151 | +// } | |
152 | + | |
153 | +// const ref = useRef<ActionType>({ | |
154 | +// reload: () => { | |
155 | +// // implementation for reload | |
156 | +// }, | |
157 | +// reloadAndRest: () => { | |
158 | +// // implementation for reloadAndRest | |
159 | +// }, | |
160 | +// reset: () => { | |
161 | +// // implementation for reset | |
162 | +// }, | |
163 | +// startEditable: () => { | |
164 | +// // implementation for startEditable | |
165 | +// }, | |
166 | +// cancelEditable: () => { | |
167 | +// // implementation for cancelEditable | |
168 | +// }, | |
169 | +// }); | |
170 | + | |
171 | +// function reload() { | |
172 | +// ref.current.reload(); | |
173 | +// } | |
174 | + | |
175 | +// async function toDelete(value) { | |
176 | +// const res = await deleteOrderErpOrderStagesDelect({ | |
177 | +// data: { | |
178 | +// ids: null, | |
179 | +// deviceIds: value, | |
180 | +// }, | |
181 | +// }); | |
182 | +// if (res) { | |
183 | +// message.success('删除成功'); | |
184 | +// ref.current.reload(); | |
185 | +// } else { | |
186 | +// message.error('删除失败'); | |
187 | +// } | |
188 | +// } | |
189 | + | |
190 | +// const exportLoadingDestory = () => { | |
191 | +// message.success('导出成功'); | |
192 | +// }; | |
193 | + | |
194 | +// async function toExport() { | |
195 | +// // await getOrderErpOrderStagesExport() | |
196 | +// orderExport( | |
197 | +// '/api/order/erp/orderStages/export', | |
198 | +// '分期订单.xlsx', | |
199 | +// 'get', | |
200 | +// {}, | |
201 | +// exportLoadingDestory, | |
202 | +// ); | |
203 | +// } | |
204 | + | |
205 | +// const columns: ProColumns<OrderStagesItem>[] = [ | |
206 | +// { | |
207 | +// title: '文件编号', | |
208 | +// dataIndex: 'id', | |
209 | +// width: 100, | |
210 | +// disable: true, | |
211 | +// onFilter: true, | |
212 | +// ellipsis: true, | |
213 | +// // render: (_, record) => { | |
214 | +// // if (record.id) { | |
215 | +// // const text = record?.id.toString(); | |
216 | +// // const paddedText = '0'.repeat(4 - text.length) + text; | |
217 | +// // return paddedText; | |
218 | +// // } | |
219 | +// // }, | |
220 | +// }, | |
221 | +// { | |
222 | +// title: '签合同日期', | |
223 | +// dataIndex: 'dateRange', | |
224 | +// valueType: 'date', | |
225 | +// width: 100, | |
226 | +// disable: true, | |
227 | +// onFilter: true, | |
228 | +// ellipsis: true, | |
229 | +// }, | |
230 | +// { | |
231 | +// title: '合同编号', | |
232 | +// dataIndex: 'contract', | |
233 | +// width: 200, | |
234 | +// disable: true, | |
235 | +// onFilter: true, | |
236 | +// ellipsis: true, | |
237 | +// }, | |
238 | +// { | |
239 | +// title: '供应商名称', | |
240 | +// dataIndex: 'vendor', | |
241 | +// width: 200, | |
242 | +// disable: true, | |
243 | +// onFilter: true, | |
244 | +// ellipsis: true, | |
245 | +// }, | |
246 | +// { | |
247 | +// title: '终端名称', | |
248 | +// dataIndex: 'terminal', | |
249 | +// width: 200, | |
250 | +// disable: true, | |
251 | +// onFilter: true, | |
252 | +// ellipsis: true, | |
253 | +// }, | |
254 | +// { | |
255 | +// title: '设备名称', | |
256 | +// dataIndex: 'deviceName', | |
257 | +// width: 200, | |
258 | +// disable: true, | |
259 | +// onFilter: true, | |
260 | +// ellipsis: true, | |
261 | +// }, | |
262 | +// { | |
263 | +// title: '设备型号', | |
264 | +// dataIndex: 'deviceModel', | |
265 | +// hideInSearch: true, | |
266 | +// width: 200, | |
267 | +// disable: true, | |
268 | +// onFilter: true, | |
269 | +// ellipsis: true, | |
270 | +// }, | |
271 | +// { | |
272 | +// title: '数量', | |
273 | +// dataIndex: 'count', | |
274 | +// hideInSearch: true, | |
275 | +// width: 100, | |
276 | +// disable: true, | |
277 | +// onFilter: true, | |
278 | +// ellipsis: true, | |
279 | +// }, | |
280 | +// { | |
281 | +// title: '单价', | |
282 | +// dataIndex: 'unitPrice', | |
283 | +// hideInSearch: true, | |
284 | +// width: 100, | |
285 | +// disable: true, | |
286 | +// onFilter: true, | |
287 | +// ellipsis: true, | |
288 | +// }, | |
289 | +// { | |
290 | +// title: '总价', | |
291 | +// dataIndex: 'price', | |
292 | +// hideInSearch: true, | |
293 | +// width: 100, | |
294 | +// disable: true, | |
295 | +// onFilter: true, | |
296 | +// ellipsis: true, | |
297 | +// }, | |
298 | +// { | |
299 | +// title: '合同总金额', | |
300 | +// dataIndex: 'totalPrice', | |
301 | +// hideInSearch: true, | |
302 | +// width: 100, | |
303 | +// disable: true, | |
304 | +// onFilter: true, | |
305 | +// ellipsis: true, | |
306 | +// }, | |
307 | +// { | |
308 | +// title: '付款方式', | |
309 | +// dataIndex: 'payWay', | |
310 | +// hideInSearch: true, | |
311 | +// width: 100, | |
312 | +// disable: true, | |
313 | +// onFilter: true, | |
314 | +// ellipsis: true, | |
315 | +// }, | |
316 | +// { | |
317 | +// title: '附件', | |
318 | +// dataIndex: 'annex', | |
319 | +// hideInSearch: true, | |
320 | +// width: 100, | |
321 | +// disable: true, | |
322 | +// onFilter: true, | |
323 | +// ellipsis: true, | |
324 | +// render: (_, record) => { | |
325 | +// if (record.id && record.annex !== null) { | |
326 | +// return <a href={record.annex}>附件文件</a>; | |
327 | +// } | |
328 | +// }, | |
329 | +// }, | |
330 | +// { | |
331 | +// disable: true, | |
332 | +// title: '备注', | |
333 | +// dataIndex: 'remark', | |
334 | +// filters: true, | |
335 | +// hideInSearch: true, | |
336 | +// onFilter: false, | |
337 | +// ellipsis: true, | |
338 | +// width: 100, | |
339 | +// }, | |
340 | +// { | |
341 | +// disable: true, | |
342 | +// title: '备注', | |
343 | +// dataIndex: 'remark', | |
344 | +// filters: true, | |
345 | +// hideInSearch: false, | |
346 | +// onFilter: false, | |
347 | +// ellipsis: true, | |
348 | +// width: 100, | |
349 | +// hideInTable: true | |
350 | +// }, | |
351 | +// { | |
352 | +// title: '操作', | |
353 | +// valueType: 'option', | |
354 | +// key: 'option', | |
355 | +// fixed: 'right', | |
356 | +// width: 160, | |
357 | +// disable: true, | |
358 | +// onFilter: true, | |
359 | +// ellipsis: true, | |
360 | +// render: (_text, record) => { | |
361 | +// if (record?.id) { | |
362 | +// return ( | |
363 | +// <> | |
364 | +// <a key="check" target="_blank" onClick={() => { | |
365 | +// console.log(record); | |
366 | +// }}> | |
367 | +// 审核 | |
368 | +// </a> | |
369 | +// | |
370 | +// <ReadModel currentContract={record.contract}></ReadModel> | |
371 | +// | |
372 | +// <EditorModel | |
373 | +// currentContract={record.contract} | |
374 | +// toReload={reload} | |
375 | +// ></EditorModel> | |
376 | +// | |
377 | +// <Comfire currtDid={record.dId} sureDelete={toDelete}></Comfire> | |
378 | +// </> | |
379 | +// ); | |
380 | +// } | |
381 | +// return null; | |
382 | +// }, | |
383 | +// }, | |
384 | +// ]; | |
385 | + | |
386 | +// return ( | |
387 | +// <> | |
388 | +// <EditableProTable<OrderStagesItem> | |
389 | +// request={async (params) => { | |
390 | +// if ( | |
391 | +// params.id !== null || | |
392 | +// params.contract !== null || | |
393 | +// params.vendor !== null || | |
394 | +// params.terminal !== null || | |
395 | +// params.deviceName !== null || | |
396 | +// params.dateRange !== null | |
397 | +// ) { | |
398 | +// let PostOrderErpOrderStagesSearchOption = { | |
399 | +// id: params.id, | |
400 | +// contract: params.contract, | |
401 | +// vendor: params.vendor, | |
402 | +// terminal: params.terminal, | |
403 | +// deviceName: params.deviceName, | |
404 | +// dateRange: params.dateRange, | |
405 | +// }; | |
406 | +// let res = await postOrderErpOrderStagesSearch({ | |
407 | +// data: { ...PostOrderErpOrderStagesSearchOption }, | |
408 | +// }); | |
409 | +// await waitTime(2000); | |
410 | +// if (res) { | |
411 | +// // setTableItem(res.data) | |
412 | +// const orderStagesWithList: OrderStagesWithListItem[] = res?.data; | |
413 | +// let orderStagesList: OrderStagesItem[] = []; | |
414 | +// for (let ind = 0; ind < orderStagesWithList.length; ind++) { | |
415 | +// for ( | |
416 | +// let index = 0; | |
417 | +// index < orderStagesWithList[ind].orderStagesDeviceVoList.length; | |
418 | +// index++ | |
419 | +// ) { | |
420 | +// let item: OrderStagesItem = { | |
421 | +// id: undefined, | |
422 | +// contract: undefined, | |
423 | +// vendor: undefined, | |
424 | +// dateRange: undefined, | |
425 | +// terminal: undefined, | |
426 | +// dId: undefined, | |
427 | +// deviceName: undefined, | |
428 | +// deviceModel: undefined, | |
429 | +// count: undefined, | |
430 | +// unitPrice: undefined, | |
431 | +// price: undefined, | |
432 | +// totalPrice: undefined, | |
433 | +// payWay: undefined, | |
434 | +// annex: undefined, | |
435 | +// remark: undefined, | |
436 | +// opt:undefined, | |
437 | +// children:undefined | |
438 | +// }; | |
439 | +// if (index === 0) { | |
440 | +// item.id = orderStagesWithList[ind].id; | |
441 | +// item.contract = orderStagesWithList[ind].contract; | |
442 | +// item.vendor = orderStagesWithList[ind].vendor; | |
443 | +// item.dateRange = orderStagesWithList[ind].dateRange; | |
444 | +// item.terminal = orderStagesWithList[ind].terminal; | |
445 | +// item.dId = | |
446 | +// orderStagesWithList[ind].orderStagesDeviceVoList[index].dId; | |
447 | +// item.deviceName = | |
448 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
449 | +// index | |
450 | +// ].deviceName; | |
451 | +// item.deviceModel = | |
452 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
453 | +// index | |
454 | +// ].deviceModel; | |
455 | +// item.count = | |
456 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
457 | +// index | |
458 | +// ].count; | |
459 | +// item.unitPrice = | |
460 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
461 | +// index | |
462 | +// ].unitPrice; | |
463 | +// item.price = | |
464 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
465 | +// index | |
466 | +// ].price; | |
467 | +// item.totalPrice = orderStagesWithList[ind].totalPrice; | |
468 | +// item.payWay = orderStagesWithList[ind].payWay; | |
469 | +// item.annex = orderStagesWithList[ind].annex; | |
470 | +// item.remark = orderStagesWithList[ind].remark; | |
471 | +// item.opt=orderStagesWithList[ind].paths | |
472 | +// orderStagesList.push(item); | |
473 | +// } else { | |
474 | +// item.id = orderStagesWithList[ind].id; | |
475 | +// item.contract = orderStagesWithList[ind].contract; | |
476 | +// item.vendor = orderStagesWithList[ind].vendor; | |
477 | +// item.dateRange = orderStagesWithList[ind].dateRange; | |
478 | +// item.terminal = orderStagesWithList[ind].terminal; | |
479 | +// item.dId = | |
480 | +// orderStagesWithList[ind].orderStagesDeviceVoList[index].dId; | |
481 | +// item.deviceName = | |
482 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
483 | +// index | |
484 | +// ].deviceName; | |
485 | +// item.deviceModel = | |
486 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
487 | +// index | |
488 | +// ].deviceModel; | |
489 | +// item.count = | |
490 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
491 | +// index | |
492 | +// ].count; | |
493 | +// item.unitPrice = | |
494 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
495 | +// index | |
496 | +// ].unitPrice; | |
497 | +// item.price = | |
498 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
499 | +// index | |
500 | +// ].price; | |
501 | +// item.totalPrice = orderStagesWithList[ind].totalPrice; | |
502 | +// item.payWay = orderStagesWithList[ind].payWay; | |
503 | +// item.annex = orderStagesWithList[ind].annex; | |
504 | +// item.remark = orderStagesWithList[ind].remark; | |
505 | +// item.opt=orderStagesWithList[ind].paths | |
506 | +// if (orderStagesList[ind]) { | |
507 | +// orderStagesList[ind].children.push(item); | |
508 | +// } | |
509 | +// } | |
510 | +// } | |
511 | +// } | |
512 | +// return { | |
513 | +// data: orderStagesList || [], | |
514 | +// }; | |
515 | +// } | |
516 | +// } else { | |
517 | +// let res = await getOrderErpOrderStagesListAll(); | |
518 | +// await waitTime(2000); | |
519 | +// if (res) { | |
520 | +// const orderStagesWithList: OrderStagesWithListItem[] = res?.data; | |
521 | +// let orderStagesList: OrderStagesItem[] = []; | |
522 | +// for (let ind = 0; ind < orderStagesWithList.length; ind++) { | |
523 | +// for ( | |
524 | +// let index = 0; | |
525 | +// index < orderStagesWithList[ind].orderStagesDeviceVoList.length; | |
526 | +// index++ | |
527 | +// ) { | |
528 | +// let item: OrderStagesItem = { | |
529 | +// id: undefined, | |
530 | +// contract: undefined, | |
531 | +// vendor: undefined, | |
532 | +// dateRange: undefined, | |
533 | +// terminal: undefined, | |
534 | +// dId: undefined, | |
535 | +// deviceName: undefined, | |
536 | +// deviceModel: undefined, | |
537 | +// count: undefined, | |
538 | +// unitPrice: undefined, | |
539 | +// price: undefined, | |
540 | +// totalPrice: undefined, | |
541 | +// payWay: undefined, | |
542 | +// annex: undefined, | |
543 | +// remark: undefined, | |
544 | +// opt:undefined, | |
545 | +// children:[] | |
546 | +// }; | |
547 | +// if (index === 0) { | |
548 | +// item.id = orderStagesWithList[ind].id; | |
549 | +// item.contract = orderStagesWithList[ind].contract; | |
550 | +// item.vendor = orderStagesWithList[ind].vendor; | |
551 | +// item.dateRange = orderStagesWithList[ind].dateRange; | |
552 | +// item.terminal = orderStagesWithList[ind].terminal; | |
553 | +// item.dId = | |
554 | +// orderStagesWithList[ind].orderStagesDeviceVoList[index].dId; | |
555 | +// item.deviceName = | |
556 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
557 | +// index | |
558 | +// ].deviceName; | |
559 | +// item.deviceModel = | |
560 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
561 | +// index | |
562 | +// ].deviceModel; | |
563 | +// item.count = | |
564 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
565 | +// index | |
566 | +// ].count; | |
567 | +// item.unitPrice = | |
568 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
569 | +// index | |
570 | +// ].unitPrice; | |
571 | +// item.price = | |
572 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
573 | +// index | |
574 | +// ].price; | |
575 | +// item.totalPrice = orderStagesWithList[ind].totalPrice; | |
576 | +// item.payWay = orderStagesWithList[ind].payWay; | |
577 | +// item.annex = orderStagesWithList[ind].annex; | |
578 | +// item.remark = orderStagesWithList[ind].remark; | |
579 | +// item.opt=orderStagesWithList[ind].paths | |
580 | +// orderStagesList.push(item); | |
581 | +// } else { | |
582 | +// item.id = orderStagesWithList[ind].id; | |
583 | +// item.contract = orderStagesWithList[ind].contract; | |
584 | +// item.vendor = orderStagesWithList[ind].vendor; | |
585 | +// item.dateRange = orderStagesWithList[ind].dateRange; | |
586 | +// item.terminal = orderStagesWithList[ind].terminal; | |
587 | +// item.dId = | |
588 | +// orderStagesWithList[ind].orderStagesDeviceVoList[index].dId; | |
589 | +// item.deviceName = | |
590 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
591 | +// index | |
592 | +// ].deviceName; | |
593 | +// item.deviceModel = | |
594 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
595 | +// index | |
596 | +// ].deviceModel; | |
597 | +// item.count = | |
598 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
599 | +// index | |
600 | +// ].count; | |
601 | +// item.unitPrice = | |
602 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
603 | +// index | |
604 | +// ].unitPrice; | |
605 | +// item.price = | |
606 | +// orderStagesWithList[ind].orderStagesDeviceVoList[ | |
607 | +// index | |
608 | +// ].price; | |
609 | +// item.totalPrice = orderStagesWithList[ind].totalPrice; | |
610 | +// item.payWay = orderStagesWithList[ind].payWay; | |
611 | +// item.annex = orderStagesWithList[ind].annex; | |
612 | +// item.remark = orderStagesWithList[ind].remark; | |
613 | +// item.opt=orderStagesWithList[ind].paths | |
614 | +// if (orderStagesList&&ind) { | |
615 | +// orderStagesList[ind].children.push(item); | |
616 | +// } | |
617 | +// } | |
618 | +// } | |
619 | +// } | |
620 | +// return { | |
621 | +// data: orderStagesList || [], | |
622 | +// }; | |
623 | +// } | |
624 | +// } | |
625 | +// }} | |
626 | +// /> | |
627 | +// </> | |
628 | +// ); | |
629 | +// }; | ... | ... |
src/pages/Order/components/DeliverInfoDrawer.tsx
1 | +import { postDistrictSelOrderProvince } from '@/services'; | |
1 | 2 | import { enumValueToLabel } from '@/utils'; |
2 | 3 | import { getReceivingCompanyOptions } from '@/utils/order'; |
3 | 4 | import { Col, Drawer, Row } from 'antd'; |
5 | +import { useEffect, useState } from 'react'; | |
4 | 6 | import { PAYEE_OPTIONS } from '../constant'; |
5 | 7 | |
6 | 8 | export default ({ data, onClose }) => { |
9 | + const [province, setProvince] = useState(''); | |
10 | + const [city, setCity] = useState(''); | |
11 | + const [district, setDistrict] = useState(''); | |
12 | + | |
13 | + useEffect(() => { | |
14 | + const fetchData = async () => { | |
15 | + if (data.id !== undefined) { | |
16 | + const resp = await postDistrictSelOrderProvince({ | |
17 | + data: data.id, | |
18 | + }); | |
19 | + if (resp && resp.data) { | |
20 | + if (resp.data.province) { | |
21 | + setProvince(resp.data.province); | |
22 | + } | |
23 | + if (resp.data.city) { | |
24 | + setCity(resp.data.city); | |
25 | + } | |
26 | + if (resp.data.district) { | |
27 | + setDistrict(resp.data.district); | |
28 | + } | |
29 | + } | |
30 | + } | |
31 | + }; | |
32 | + | |
33 | + fetchData(); | |
34 | + }, [data.id]); | |
7 | 35 | return ( |
8 | 36 | <> |
9 | 37 | <Drawer |
... | ... | @@ -22,12 +50,16 @@ export default ({ data, onClose }) => { |
22 | 50 | <span className="className='text-[#333333]'">联系方式</span> |
23 | 51 | </Col> |
24 | 52 | <Col span={18}>{data.customerContactNumber}</Col> |
25 | - | |
53 | + <Col span={6}> | |
54 | + <span className="className='text-[#333333]'">省市区</span> | |
55 | + </Col> | |
56 | + <Col span={18}> | |
57 | + {province} {city} {district} | |
58 | + </Col> | |
26 | 59 | <Col span={6}> |
27 | 60 | <span className="className='text-[#333333]'">收货地址</span> |
28 | 61 | </Col> |
29 | 62 | <Col span={18}>{data.customerShippingAddress}</Col> |
30 | - | |
31 | 63 | <Col span={6}> |
32 | 64 | <span className="className='text-[#333333]'">课题组老师</span> |
33 | 65 | </Col> | ... | ... |
src/pages/Order/components/OrderDrawer.tsx
... | ... | @@ -742,6 +742,11 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
742 | 742 | let preOrderData = localStorage.getItem('preOrderData'); |
743 | 743 | if (preOrderData) { |
744 | 744 | let formData = JSON.parse(preOrderData); |
745 | + formData.customerName = { | |
746 | + label: formData.customerNameString, | |
747 | + value: formData.customerName, | |
748 | + }; | |
749 | + console.log(formData); | |
745 | 750 | form.setFieldsValue(formData); |
746 | 751 | setPaymentMethod(formData.paymentMethod); |
747 | 752 | } | ... | ... |