Commit 95b334069bd729c23c6e4e49c0041adbff309c35
1 parent
6383ef37
feat: update 售后审核
Showing
2 changed files
with
75 additions
and
62 deletions
src/pages/Order/components/CheckModal.tsx
... | ... | @@ -4,14 +4,23 @@ import { |
4 | 4 | postServiceOrderCheckOrder, |
5 | 5 | postServiceOrderFileProcess, |
6 | 6 | postServiceOrderFinanceCheckOrder, |
7 | + postServiceOrderQueryAfterSalesInfoSnapshot, | |
7 | 8 | } from '@/services'; |
8 | 9 | import { ModalForm, ProFormTextArea } from '@ant-design/pro-components'; |
9 | -import { Button, Form, Modal, UploadFile, message } from 'antd'; | |
10 | +import { Button, Col, Form, Modal, Row, UploadFile, message } from 'antd'; | |
10 | 11 | import Upload, { RcFile, UploadProps } from 'antd/es/upload'; |
11 | 12 | import { useEffect, useRef, useState } from 'react'; |
12 | -import { CHECK_TYPE, COMFIR_RECEIPT_IMAGES_NUMBER } from '../constant'; | |
13 | +import { | |
14 | + AFTE_SALES_PLAN_OPTIONS, | |
15 | + CHECK_TYPE, | |
16 | + COMFIR_RECEIPT_IMAGES_NUMBER, | |
17 | +} from '../constant'; | |
13 | 18 | // import { cloneDeep } from 'lodash'; |
14 | -import { transImageFile } from '@/utils'; | |
19 | +import { | |
20 | + enumValueToLabel, | |
21 | + getAliYunOSSFileNameFromUrl, | |
22 | + transImageFile, | |
23 | +} from '@/utils'; | |
15 | 24 | import { PlusOutlined } from '@ant-design/icons'; |
16 | 25 | import { cloneDeep } from 'lodash'; |
17 | 26 | export default ({ |
... | ... | @@ -40,7 +49,7 @@ export default ({ |
40 | 49 | let subOrderIds: any[] = subOrders.map((subOrder) => subOrder.id); |
41 | 50 | const [mainOrderId] = useState(data.id); |
42 | 51 | |
43 | - // const [afterSalesInfo, setAfterSalesInfo] = useState<any>(); | |
52 | + const [afterSalesInfo, setAfterSalesInfo] = useState<any>(); | |
44 | 53 | |
45 | 54 | /** |
46 | 55 | * 审核类型 |
... | ... | @@ -52,51 +61,48 @@ export default ({ |
52 | 61 | return false; |
53 | 62 | } |
54 | 63 | |
55 | - // const getOrderAfterSalesInfo = async () => { | |
56 | - // let res = await postServiceOrderQueryAfterSalesInfoSnapshot({ | |
57 | - // data: { subOrderIds: subOrderIds }, | |
58 | - // }); | |
64 | + const getOrderAfterSalesInfo = async () => { | |
65 | + let res = await postServiceOrderQueryAfterSalesInfoSnapshot({ | |
66 | + data: { subOrderIds: subOrderIds }, | |
67 | + }); | |
59 | 68 | |
60 | - // //附件 | |
61 | - // let annex = res?.data[0]?.afterSalesAnnexList; | |
69 | + //附件 | |
70 | + let annex = res?.data[0]?.afterSalesAnnexList; | |
62 | 71 | |
63 | - // let annexLinks = annex?.map((f) => { | |
64 | - // return ( | |
65 | - // <Button type="link" key="key" href={f}> | |
66 | - // {getAliYunOSSFileNameFromUrl(f)} | |
67 | - // </Button> | |
68 | - // ); | |
69 | - // }); | |
72 | + let annexLinks = annex?.map((f) => { | |
73 | + return ( | |
74 | + <Button type="link" key="key" href={f}> | |
75 | + {getAliYunOSSFileNameFromUrl(f)} | |
76 | + </Button> | |
77 | + ); | |
78 | + }); | |
70 | 79 | |
71 | - // setAfterSalesInfo( | |
72 | - // <div className="my-5"> | |
73 | - // <Row gutter={[16, 24]}> | |
74 | - // <Col span={6}> | |
75 | - // <span className="text-[#333333]">售后方案</span> | |
76 | - // </Col> | |
77 | - // <Col span={18}> | |
78 | - // {enumValueToLabel( | |
79 | - // res?.data[0]?.afterSalesPlan, | |
80 | - // AFTE_SALES_PLAN_OPTIONS, | |
81 | - // )} | |
82 | - // </Col> | |
83 | - // <Col span={6}> | |
84 | - // <span className="className='text-[#333333]'">修改后总金额</span> | |
85 | - // </Col> | |
86 | - // <Col span={18}>{res?.data[0]?.totalPayment}</Col> | |
80 | + setAfterSalesInfo( | |
81 | + <div className="my-5"> | |
82 | + <Row gutter={[16, 24]}> | |
83 | + <Col span={6}> | |
84 | + <span className="text-[#333333]">售后方案</span> | |
85 | + </Col> | |
86 | + <Col span={18}> | |
87 | + {enumValueToLabel( | |
88 | + res?.data[0]?.afterSalesPlan, | |
89 | + AFTE_SALES_PLAN_OPTIONS, | |
90 | + )} | |
91 | + </Col> | |
92 | + <Col span={6}> | |
93 | + <span className="className='text-[#333333]'">售后原因</span> | |
94 | + </Col> | |
95 | + <Col span={18}>{res?.data[0]?.afterSalesNotes}</Col> | |
96 | + <Col span={6}> | |
97 | + <span className="className='text-[#333333]'">附件</span> | |
98 | + </Col> | |
99 | + <Col span={18}>{annexLinks}</Col> | |
100 | + </Row> | |
101 | + </div>, | |
102 | + ); | |
103 | + }; | |
87 | 104 | |
88 | - // <Col span={6}> | |
89 | - // <span className="className='text-[#333333]'">售后原因</span> | |
90 | - // </Col> | |
91 | - // <Col span={18}>{res?.data[0]?.afterSalesNotes}</Col> | |
92 | - // <Col span={6}> | |
93 | - // <span className="className='text-[#333333]'">附件</span> | |
94 | - // </Col> | |
95 | - // <Col span={18}>{annexLinks}</Col> | |
96 | - // </Row> | |
97 | - // </div>, | |
98 | - // ); | |
99 | - // }; | |
105 | + getOrderAfterSalesInfo(); | |
100 | 106 | |
101 | 107 | const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => { |
102 | 108 | //fileListObj得在change里变化,change的参数是已经处理过的file数组 |
... | ... | @@ -341,7 +347,7 @@ export default ({ |
341 | 347 | doAfterSalesCheck({ |
342 | 348 | isAfterSalesSuccess: false, |
343 | 349 | subOrderIds: subOrderIds, |
344 | - mainId: data.id, | |
350 | + mainId: mainOrderId, | |
345 | 351 | afterSalesRejectionNotes: form.getFieldValue('name'), |
346 | 352 | }); |
347 | 353 | return; |
... | ... | @@ -384,7 +390,7 @@ export default ({ |
384 | 390 | submitTimeout={2000} |
385 | 391 | onFinish={async (values) => { |
386 | 392 | if (checkType(CHECK_TYPE.NORMAL)) { |
387 | - //审核通过 | |
393 | + //审核通过mainOrderId | |
388 | 394 | return doCheck({ |
389 | 395 | flag: true, |
390 | 396 | ids: subOrderIds, |
... | ... | @@ -398,7 +404,7 @@ export default ({ |
398 | 404 | return doAfterSalesCheck({ |
399 | 405 | isAfterSalesSuccess: true, |
400 | 406 | subOrderIds: subOrderIds, |
401 | - mainId: data.id, | |
407 | + mainId: mainOrderId, | |
402 | 408 | afterSalesRejectionNotes: values.name, |
403 | 409 | }); |
404 | 410 | } |
... | ... | @@ -410,16 +416,19 @@ export default ({ |
410 | 416 | onOpenChange={setCheckVisible} |
411 | 417 | > |
412 | 418 | {checkType(CHECK_TYPE.AFTER_SALES) ? ( |
413 | - <Button | |
414 | - className="px-0" | |
415 | - type="link" | |
416 | - onClick={() => { | |
417 | - console.log(data); | |
418 | - openOrderDrawer('after-sales-check', mainOrderId); | |
419 | - }} | |
420 | - > | |
421 | - 查看旧订单 | |
422 | - </Button> | |
419 | + <> | |
420 | + {afterSalesInfo} | |
421 | + <Button | |
422 | + className="px-0" | |
423 | + type="link" | |
424 | + onClick={() => { | |
425 | + console.log(data); | |
426 | + openOrderDrawer('after-sales-check', mainOrderId); | |
427 | + }} | |
428 | + > | |
429 | + 查看旧订单 | |
430 | + </Button> | |
431 | + </> | |
423 | 432 | ) : ( |
424 | 433 | '' |
425 | 434 | )} | ... | ... |
src/pages/Order/components/OrderDrawer.tsx
... | ... | @@ -181,10 +181,6 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
181 | 181 | buildOrderData(); |
182 | 182 | } |
183 | 183 | |
184 | - if (optType('after-sales-check')) { | |
185 | - getOldOrderData(data.id); | |
186 | - } | |
187 | - | |
188 | 184 | /** |
189 | 185 | * |
190 | 186 | * @returns 获取开票选项 |
... | ... | @@ -286,6 +282,14 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
286 | 282 | form.setFieldValue('totalPayment', totalPayment); |
287 | 283 | } |
288 | 284 | |
285 | + useEffect(() => { | |
286 | + if (optType('after-sales-check')) { | |
287 | + getOldOrderData(data.id); | |
288 | + } else { | |
289 | + buildOrderData(); | |
290 | + } | |
291 | + }, []); | |
292 | + | |
289 | 293 | return ( |
290 | 294 | <DrawerForm<{ |
291 | 295 | deleteSubOrderLists: any; | ... | ... |