Commit e3b45c92c91f1d603e7dbc0b3bd4646b472b9dd5

Authored by zhongnanhuang
1 parent 9f02014d

feat: update 售后审核

src/pages/Order/components/CheckModal.tsx
@@ -7,12 +7,20 @@ import { @@ -7,12 +7,20 @@ import {
7 postServiceOrderQueryAfterSalesInfoSnapshot, 7 postServiceOrderQueryAfterSalesInfoSnapshot,
8 } from '@/services'; 8 } from '@/services';
9 import { ModalForm, ProFormTextArea } from '@ant-design/pro-components'; 9 import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
10 -import { Button, Descriptions, Form, Modal, UploadFile, message } from 'antd'; 10 +import { Button, Col, Form, Modal, Row, UploadFile, message } from 'antd';
11 import Upload, { RcFile, UploadProps } from 'antd/es/upload'; 11 import Upload, { RcFile, UploadProps } from 'antd/es/upload';
12 import { useEffect, useRef, useState } from 'react'; 12 import { useEffect, useRef, useState } from 'react';
13 -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';
14 // import { cloneDeep } from 'lodash'; 18 // import { cloneDeep } from 'lodash';
15 -import { transImageFile } from '@/utils'; 19 +import {
  20 + enumValueToLabel,
  21 + getAliYunOSSFileNameFromUrl,
  22 + transImageFile,
  23 +} from '@/utils';
16 import { PlusOutlined } from '@ant-design/icons'; 24 import { PlusOutlined } from '@ant-design/icons';
17 import { cloneDeep } from 'lodash'; 25 import { cloneDeep } from 'lodash';
18 export default ({ 26 export default ({
@@ -36,10 +44,11 @@ export default ({ @@ -36,10 +44,11 @@ export default ({
36 const [fileList, setFileList] = useState<UploadFile[]>([]); 44 const [fileList, setFileList] = useState<UploadFile[]>([]);
37 const handleCancel = () => setPreviewOpen(false); 45 const handleCancel = () => setPreviewOpen(false);
38 const [messageApi, contextHolder] = message.useMessage(); 46 const [messageApi, contextHolder] = message.useMessage();
39 - const [afterSalesItems, setAfterSalesItems] = useState<any[]>([]);  
40 const [form] = Form.useForm<{ name: string; company: string }>(); 47 const [form] = Form.useForm<{ name: string; company: string }>();
41 let subOrderIds: any[] = subOrders.map((subOrder) => subOrder.id); 48 let subOrderIds: any[] = subOrders.map((subOrder) => subOrder.id);
42 49
  50 + const [afterSalesInfo, setAfterSalesInfo] = useState<any>();
  51 +
43 /** 52 /**
44 * 审核类型 53 * 审核类型
45 */ 54 */
@@ -54,8 +63,46 @@ export default ({ @@ -54,8 +63,46 @@ export default ({
54 let res = await postServiceOrderQueryAfterSalesInfoSnapshot({ 63 let res = await postServiceOrderQueryAfterSalesInfoSnapshot({
55 data: { subOrderIds: subOrderIds }, 64 data: { subOrderIds: subOrderIds },
56 }); 65 });
57 - setAfterSalesItems([]);  
58 - console.log(res); 66 +
  67 + //附件
  68 + let annex = res?.data[0].afterSalesAnnexList;
  69 +
  70 + let annexLinks = annex?.map((f) => {
  71 + return (
  72 + <Button type="link" key="key" href={f}>
  73 + {getAliYunOSSFileNameFromUrl(f)}
  74 + </Button>
  75 + );
  76 + });
  77 +
  78 + setAfterSalesInfo(
  79 + <div className="my-5">
  80 + <Row gutter={[16, 24]}>
  81 + <Col span={6}>
  82 + <span className="text-[#333333]">售后方案</span>
  83 + </Col>
  84 + <Col span={18}>
  85 + {enumValueToLabel(
  86 + res?.data[0].afterSalesPlan,
  87 + AFTE_SALES_PLAN_OPTIONS,
  88 + )}
  89 + </Col>
  90 + <Col span={6}>
  91 + <span className="className='text-[#333333]'">修改后总金额</span>
  92 + </Col>
  93 + <Col span={18}>{res?.data[0].totalPayment}</Col>
  94 +
  95 + <Col span={6}>
  96 + <span className="className='text-[#333333]'">售后原因</span>
  97 + </Col>
  98 + <Col span={18}>{res?.data[0].afterSalesNotes}</Col>
  99 + <Col span={6}>
  100 + <span className="className='text-[#333333]'">附件</span>
  101 + </Col>
  102 + <Col span={18}>{annexLinks}</Col>
  103 + </Row>
  104 + </div>,
  105 + );
59 }; 106 };
60 107
61 const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => { 108 const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => {
@@ -361,19 +408,7 @@ export default ({ @@ -361,19 +408,7 @@ export default ({
361 }} 408 }}
362 onOpenChange={setCheckVisible} 409 onOpenChange={setCheckVisible}
363 > 410 >
364 - {checkType(CHECK_TYPE.AFTER_SALES) ? (  
365 - <Descriptions  
366 - className="mb-5"  
367 - labelStyle={{ textAlign: 'center' }}  
368 - column={1}  
369 - bordered  
370 - title={<span className="text-sm font-medium">售后信息</span>}  
371 - size="small"  
372 - items={afterSalesItems}  
373 - />  
374 - ) : (  
375 - ''  
376 - )} 411 + {checkType(CHECK_TYPE.AFTER_SALES) ? afterSalesInfo : ''}
377 412
378 <div>请特别注意订单总金额与订单金额。</div> 413 <div>请特别注意订单总金额与订单金额。</div>
379 <ProFormTextArea 414 <ProFormTextArea
src/pages/Order/components/ProcureCheckModal.tsx
@@ -99,10 +99,10 @@ export default ({ setCheckVisible, data, subOrders, onClose }) =&gt; { @@ -99,10 +99,10 @@ export default ({ setCheckVisible, data, subOrders, onClose }) =&gt; {
99 message.error('选择转回仓库请点击转回仓库按钮!'); 99 message.error('选择转回仓库请点击转回仓库按钮!');
100 return; 100 return;
101 } 101 }
102 - let procureIsPrintAndSend = false;  
103 - if (values.name === '采购自行发货') {  
104 - procureIsPrintAndSend = true;  
105 - } 102 + let procureIsPrintAndSend = true;
  103 + // if (values.name === '采购自行发货') {
  104 + // procureIsPrintAndSend = true;
  105 + // }
106 return doCheck({ 106 return doCheck({
107 ids: subOrderIds, 107 ids: subOrderIds,
108 supplier: values.name, 108 supplier: values.name,