Commit 2ae24a7d3c217a6022762fc079e5e98c81d0d61f

Authored by boyang
1 parent 37038e0f

修改首页路由

Showing 44 changed files with 468 additions and 14037 deletions
.umirc.ts
... ... @@ -29,7 +29,7 @@ export default defineConfig({
29 29 routes: [
30 30 {
31 31 path: '/',
32   - redirect: '/order',
  32 + redirect: '/order/order',
33 33 },
34 34 {
35 35 name: '登录',
... ...
src/pages/Order/Order/components/OrderDrawer copy.tsx
... ... @@ -36,7 +36,7 @@ import {
36 36 PAYMENT_CHANNEL_OPTIONS,
37 37 PAYMENT_METHOD_OPTIONS,
38 38 PRODUCT_BELONG_DEPARTMENT_OPTIONS,
39   -} from '../constant';
  39 +} from '../../constant';
40 40 import KingdeeCustomerModal from './KingdeeCustomerModal';
41 41  
42 42 export default ({ onClose, data, subOrders, orderOptType }) => {
... ... @@ -554,7 +554,7 @@ export default ({ onClose, data, subOrders, orderOptType }) => {
554 554 onChange={(_, option) => {
555 555 autoFillSalesInfo(option);
556 556 }}
557   - // disabled={mainInfoDisbled}
  557 + // disabled={mainInfoDisbled}
558 558 />
559 559  
560 560 <ProFormText
... ... @@ -642,7 +642,7 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
642 642 },
643 643 }}
644 644 debounceTime={1000}
645   - request={async (value, {}) => {
  645 + request={async (value, { }) => {
646 646 const keywords = value.keyWords;
647 647 const res = await postKingdeeRepCustomer({
648 648 data: { search: keywords },
... ... @@ -740,7 +740,7 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
740 740 </Button>
741 741 ),
742 742 }}
743   - // disabled={mainInfoDisbled}
  743 + // disabled={mainInfoDisbled}
744 744 />
745 745 </div>
746 746  
... ... @@ -752,7 +752,7 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
752 752 label="支付渠道"
753 753 options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)}
754 754 rules={[{ required: true, message: '支付渠道必填' }]}
755   - // disabled={mainInfoDisbled}
  755 + // disabled={mainInfoDisbled}
756 756 />
757 757 <ProFormSelect
758 758 placeholder="请输入支付方式"
... ... @@ -762,7 +762,7 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
762 762 label="支付方式"
763 763 options={enumToSelect(PAYMENT_METHOD_OPTIONS)}
764 764 rules={[{ required: true, message: '支付方式必填' }]}
765   - // disabled={mainInfoDisbled}
  765 + // disabled={mainInfoDisbled}
766 766 />
767 767 <ProFormSelect
768 768 placeholder="选择是否需要开票"
... ... @@ -1094,7 +1094,7 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
1094 1094 options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)}
1095 1095 initialValue={'EXPERIMENTAL_CONSUMABLES'}
1096 1096 rules={[{ required: true, message: '所属事业部必填' }]}
1097   - // disabled={mainInfoDisbled}
  1097 + // disabled={mainInfoDisbled}
1098 1098 />,
1099 1099 <ProFormTextArea
1100 1100 key={'notes' + listMeta.index}
... ...
src/pages/Order/Order/index.css 0 → 100644
  1 +.order-page-container .ant-table .ant-table-middle {
  2 + margin-inline: 0 !important;
  3 +}
  4 +.order-page-container td {
  5 + font-family: 'San Francisco', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif;
  6 + font-size: 13px;
  7 +}
  8 +#total-payment .ant-input-number-group-addon {
  9 + padding: 0 !important;
  10 +}
  11 +.order-page-container table:hover,
  12 +.order-page-container tr:hover,
  13 +.order-page-container thead:hover {
  14 + background: none !important;
  15 +}
  16 +#main-table .ant-table-tbody > tr.ant-table-row:hover > td {
  17 + background: none !important;
  18 +}
  19 +.order-page-container .ant-pro-card {
  20 + background-color: transparent;
  21 +}
  22 +#main-table .ant-table-tbody .ant-table-cell {
  23 + padding: 10px 0 0;
  24 +}
  25 +.order-page-container .ant-pagination {
  26 + background-color: #fff !important;
  27 + padding: 10px;
  28 + border-radius: 8px;
  29 +}
  30 +.order-page-container .ant-pro-table .ant-form {
  31 + background-color: #fff;
  32 + border-radius: 8px;
  33 +}
  34 +#main-table .ant-table-tbody {
  35 + background-color: #f5f5f5;
  36 +}
  37 +.order-page-container .ant-pro-card-body {
  38 + padding: 0 !important;
  39 +}
  40 +.order-page-container .ant-table-thead .ant-table-cell {
  41 + background-color: #fff !important;
  42 + border-radius: 8px !important;
  43 +}
  44 +#sub-table tbody td {
  45 + padding: 10px 0 !important;
  46 +}
  47 +#sub-table tbody tr:first-child td:first-child {
  48 + border-top-left-radius: 8px;
  49 +}
  50 +#sub-table tbody tr:first-child td:nth-child(2) {
  51 + border-top-right-radius: 8px;
  52 +}
  53 +#sub-table tbody tr:last-child td:first-child {
  54 + border-bottom-left-radius: 8px;
  55 +}
  56 +#sub-table tbody tr:last-child td:nth-child(2) {
  57 + border-bottom-right-radius: 8px;
  58 +}
  59 +#sub-table tbody tr td:first-child {
  60 + border-top: 1px solid #d7d6d6;
  61 + /* 设置行与行之间分割线的颜色 */
  62 + border-bottom: 1px solid #d7d6d6;
  63 + /* 设置行与行之间分割线的颜色 */
  64 + border-left: 1px solid #d7d6d6;
  65 + /* 设置行与行之间分割线的颜色 */
  66 +}
  67 +#sub-table tbody tr td:nth-child(2) {
  68 + border-top: 1px solid #d7d6d6;
  69 + /* 设置行与行之间分割线的颜色 */
  70 + border-bottom: 1px solid #d7d6d6;
  71 + /* 设置行与行之间分割线的颜色 */
  72 + border-right: 1px solid #d7d6d6;
  73 + /* 设置行与行之间分割线的颜色 */
  74 +}
... ...
src/pages/Order/Order/index.less
... ... @@ -9,7 +9,6 @@
9 9 'WenQuanYi Micro Hei', sans-serif;
10 10 font-size: 13px;
11 11 }
12   -
13 12 //订单编辑抽屉中,订单总额addonAfter的padding去除
14 13 #total-payment .ant-input-number-group-addon {
15 14 padding: 0 !important;
... ...
src/pages/Order/OrderWarning/components/OrderDrawer copy.tsx
... ... @@ -36,7 +36,7 @@ import {
36 36 PAYMENT_CHANNEL_OPTIONS,
37 37 PAYMENT_METHOD_OPTIONS,
38 38 PRODUCT_BELONG_DEPARTMENT_OPTIONS,
39   -} from '../constant';
  39 +} from '../../constant';
40 40 import KingdeeCustomerModal from './KingdeeCustomerModal';
41 41  
42 42 export default ({ onClose, data, subOrders, orderOptType }) => {
... ...
src/pages/Order/OrderWarning/index.tsx
... ... @@ -1841,19 +1841,6 @@ const OrderPage = () =&gt; {
1841 1841 ) : (
1842 1842 ''
1843 1843 )}
1844   - {optRecord.paths?.includes('applyInvoicing') ? (
1845   - <Button
1846   - className="p-0"
1847   - type="link"
1848   - onClick={() => {
1849   - console.log('5656confirminvoice');
1850   - }}
1851   - >
1852   - 确认开票
1853   - </Button>
1854   - ) : (
1855   - ''
1856   - )}
1857 1844  
1858 1845 {optRecord.paths?.includes('applyInvoicing_old') ? (
1859 1846 <Button
... ... @@ -3426,6 +3413,20 @@ const OrderPage = () =&gt; {
3426 3413 ''
3427 3414 )}
3428 3415  
  3416 + {record.paths?.includes('applyInvoicing') ? (
  3417 + <Button
  3418 + type="link"
  3419 + className="p-0"
  3420 + onClick={() => {
  3421 + console.log('5656confirm');
  3422 + }}
  3423 + >
  3424 + 确认开票
  3425 + </Button>
  3426 + ) : (
  3427 + ''
  3428 + )}
  3429 +
3429 3430 {record.paths?.includes('updateOrder') ? (
3430 3431 <Button
3431 3432 className="p-0"
... ... @@ -5833,8 +5834,6 @@ const OrderPage = () =&gt; {
5833 5834 去处理
5834 5835 </Button>
5835 5836 ]}
5836   - // style={{ width: '1500px', height: '1500px' }} // 设置 Modal 的宽度和高度
5837   - // bodyStyle={{ padding: '20px', color: 'red' }} // 设置 Modal 内容的样式
5838 5837 >
5839 5838 <Row
5840 5839 gutter={16}
... ... @@ -5842,7 +5841,7 @@ const OrderPage = () =&gt; {
5842 5841 align="middle" // Vertically center contents
5843 5842 >
5844 5843 <Col span={12}>
5845   - <div style={{ display: 'flex', justifyContent: 'center' }}>
  5844 + <div style={{ display: 'flex', justifyContent: 'center', marginTop: '20px' }}>
5846 5845 <Card
5847 5846 bordered={true}
5848 5847 style={{
... ... @@ -5859,12 +5858,23 @@ const OrderPage = () =&gt; {
5859 5858 color: 'black', // 字体颜色
5860 5859 fontSize: '20px', // 字体大小
5861 5860 }}>
5862   - Card content
  5861 + <div style={{
  5862 + fontWeight: 'bold', // 字体加粗
  5863 + color: 'black', // 字体颜色
  5864 + fontSize: '40px', // 字体大小
  5865 + justifyContent: 'center',
  5866 + display: 'flex',
  5867 + alignItems: 'center',
  5868 + marginBottom: '20px',
  5869 + }}>
  5870 + {invoiceWarningNum}
  5871 + </div>
  5872 + 发票待确认订单
5863 5873 </div>
5864 5874 </Card>
5865 5875 </div></Col>
5866 5876 <Col span={12}>
5867   - <div style={{ display: 'flex', justifyContent: 'center' }}>
  5877 + <div style={{ display: 'flex', justifyContent: 'center', marginTop: '20px' }}>
5868 5878 <Card
5869 5879 bordered={true}
5870 5880 style={{
... ... @@ -5881,12 +5891,23 @@ const OrderPage = () =&gt; {
5881 5891 color: 'black', // 字体颜色
5882 5892 fontSize: '20px', // 字体大小
5883 5893 }}>
5884   - Card content
  5894 + <div style={{
  5895 + fontWeight: 'bold', // 字体加粗
  5896 + color: 'black', // 字体颜色
  5897 + fontSize: '40px', // 字体大小
  5898 + justifyContent: 'center',
  5899 + display: 'flex',
  5900 + alignItems: 'center',
  5901 + marginBottom: '20px',
  5902 + }}>
  5903 + {invoiceRefundWarningNum}
  5904 + </div>
  5905 + 回款待确认订单
5885 5906 </div>
5886 5907 </Card>
5887 5908 </div></Col>
5888 5909 </Row>
5889   - <div style={{ color: 'red' }}>
  5910 + <div style={{ color: 'red', padding: '40px' }}>
5890 5911 <p>预警说明:</p>
5891 5912 <p>1、从订单确认收货之日起,超过5天未和客户确认发票(不开票的订单除外)的订单将会进行第一次提醒;超过15天未和客户确认发票(不开票的订单除外)的订单将会每天进行一次提醒,并限制下单功能</p>
5892 5913 <p>2、从发票确认之日起,超过15天未确认回款的订单将会进行第一次提醒,超过25天未确认回款的订单将会每天进行一次提醒,并限制下单功能</p>
... ...
src/pages/Order/WarningWhitelist/components/AfterSalesDrawer.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderApplyAfterSales } from '@/services';
3   -import { enumToSelect } from '@/utils';
4   -import {
5   - DrawerForm,
6   - ProFormDigit,
7   - ProFormSelect,
8   - ProFormTextArea,
9   - ProFormUploadDragger,
10   -} from '@ant-design/pro-components';
11   -import { Form, message } from 'antd';
12   -import { AFTE_SALES_PLAN_OPTIONS } from '../../constant';
13   -export default ({ setVisible, mainOrder, subOrders, onClose }) => {
14   - let subOrderIds = subOrders?.map((item: { id: any }) => {
15   - return item.id;
16   - });
17   -
18   - let mainOrderId = mainOrder.id;
19   - const [form] = Form.useForm<{
20   - afterSalesNotes: string;
21   - afterSalesPlan: string;
22   - ids: [];
23   - totalPayment: number;
24   - filePaths: any[];
25   - }>();
26   -
27   - return (
28   - <DrawerForm<{
29   - afterSalesNotes: string;
30   - afterSalesPlan: string;
31   - subOrderIds: [];
32   - totalPayment: number;
33   - mainId: number;
34   - filePaths: any[];
35   - }>
36   - title="申请售后"
37   - open
38   - resize={{
39   - onResize() {
40   - console.log('resize!');
41   - },
42   - maxWidth: window.innerWidth * 0.8,
43   - minWidth: 500,
44   - }}
45   - form={form}
46   - autoFocusFirstInput
47   - drawerProps={{
48   - destroyOnClose: true,
49   - onClose: () => {
50   - setVisible(false);
51   - },
52   - }}
53   - onFinish={async (values) => {
54   - values.subOrderIds = subOrderIds;
55   - values.mainId = mainOrderId;
56   - values.filePaths = values.filePaths?.map((file) => {
57   - return { url: file.response.data[0] };
58   - });
59   - let res = await postServiceOrderApplyAfterSales({ data: values });
60   - if (res?.result === RESPONSE_CODE.SUCCESS) {
61   - message.success(res.message);
62   - onClose();
63   - }
64   - }}
65   - >
66   - <ProFormSelect
67   - key="key"
68   - label="售后方案"
69   - width="lg"
70   - showSearch
71   - name="afterSalesPlan"
72   - options={enumToSelect(AFTE_SALES_PLAN_OPTIONS)}
73   - placeholder="请搜索"
74   - rules={[{ required: true, message: '售后方案必填' }]}
75   - ></ProFormSelect>
76   - <ProFormDigit
77   - width="lg"
78   - name="totalPayment"
79   - label="总金额调整"
80   - min={0}
81   - initialValue={mainOrder.totalPayment}
82   - rules={[{ required: true, message: '总金额必填' }]}
83   - />
84   - <ProFormTextArea
85   - width="lg"
86   - label="售后原因"
87   - name="afterSalesNotes"
88   - rules={[{ required: true, message: '售后原因必填' }]}
89   - />
90   - <ProFormUploadDragger
91   - key="filePaths"
92   - label="附件"
93   - name="filePaths"
94   - action="/api/service/order/fileProcess"
95   - fieldProps={{
96   - headers: { Authorization: localStorage.getItem('token') },
97   - }}
98   - />
99   - </DrawerForm>
100   - );
101   -};
src/pages/Order/WarningWhitelist/components/ApplyForInvoicingModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderApplyInvoicing } from '@/services';
3   -import { enumToSelect, getAliYunOSSFileNameFromUrl } from '@/utils';
4   -import {
5   - ModalForm,
6   - ProFormSelect,
7   - ProFormText,
8   - ProFormTextArea,
9   - ProFormUploadDragger,
10   -} from '@ant-design/pro-components';
11   -import { Form, message } from 'antd';
12   -import { useEffect, useState } from 'react';
13   -import { PAYEE_OPTIONS } from '../../constant';
14   -export default ({
15   - setCheckVisible,
16   - isEdit,
17   - subOrders,
18   - isMainOrder,
19   - totalPayment,
20   - onClose,
21   -}) => {
22   - const [isUrgent, setIsUrgent] = useState('');
23   - let sumPrice = totalPayment;
24   -
25   - let ids = subOrders?.map((item) => {
26   - return item.id;
27   - });
28   -
29   - let mainIdSet = new Set();
30   - subOrders?.forEach((item: { mainOrderId: unknown }) => {
31   - mainIdSet.add(item.mainOrderId);
32   - });
33   -
34   - let mainIds = Array.from(mainIdSet).join(',');
35   -
36   - let newListAnnex = [];
37   -
38   - //回显,子订单可以编辑备注跟附件
39   - if (isEdit) {
40   - newListAnnex = subOrders.afterAnnexList?.map((path) => {
41   - let i = 0;
42   - return {
43   - uid: i++,
44   - name: getAliYunOSSFileNameFromUrl(path),
45   - status: 'uploaded',
46   - url: path,
47   - response: { data: [path] },
48   - };
49   - });
50   - subOrders.filePaths = newListAnnex;
51   - }
52   -
53   - const [form] = Form.useForm<{
54   - applyInvoicingNotes: string;
55   - filePaths: any;
56   - subIds: any[];
57   - afterInvoicingUpdate: boolean;
58   - receivingCompany: string;
59   - isUrgent: boolean;
60   - deadline: string;
61   - }>();
62   -
63   - useEffect(() => {
64   - //显示拼接的主订单id
65   - form.setFieldValue('applyInvoicingNotes', mainIds);
66   - }, []);
67   -
68   - return (
69   - <ModalForm<{
70   - applyInvoicingNotes: string;
71   - filePaths: any;
72   - subIds: any[];
73   - afterInvoicingUpdate: boolean;
74   - }>
75   - width={500}
76   - open
77   - title={isEdit ? '修改信息' : '申请开票'}
78   - initialValues={subOrders}
79   - form={form}
80   - autoFocusFirstInput
81   - modalProps={{
82   - okText: '确认',
83   - cancelText: '取消',
84   - destroyOnClose: true,
85   - onCancel: () => {
86   - setCheckVisible(false);
87   - },
88   - }}
89   - submitter={{
90   - render: (props, defaultDoms) => {
91   - return defaultDoms;
92   - },
93   - }}
94   - submitTimeout={2000}
95   - onFinish={async (values) => {
96   - values.subIds = ids;
97   - //附件处理
98   - values.filePaths = values.filePaths?.map((item) => {
99   - return { url: item.response.data[0] };
100   - });
101   -
102   - if (isEdit) {
103   - values.afterInvoicingUpdate = true;
104   - } else {
105   - values.afterInvoicingUpdate = false;
106   - }
107   -
108   - const res = await postServiceOrderApplyInvoicing({ data: values });
109   -
110   - if (res.result === RESPONSE_CODE.SUCCESS) {
111   - message.success(res.message);
112   - onClose();
113   - }
114   - }}
115   - onOpenChange={setCheckVisible}
116   - >
117   - {isMainOrder ? (
118   - <div className="mb-[24px]">
119   - <span>选中子订单金额之和:</span>
120   - <span className="text-red-500">{sumPrice}¥</span>
121   - </div>
122   - ) : (
123   - ''
124   - )}
125   -
126   - <div className="mb-1">
127   - 如果需要合并订单,请将需要合并的订单id写在备注中,id之间用英文逗号隔开。
128   - </div>
129   - <ProFormTextArea
130   - width="lg"
131   - name="applyInvoicingNotes"
132   - key="applyInvoicingNotes"
133   - placeholder="请输入备注"
134   - onMetaChange={(val) => {
135   - console.log(val);
136   - }}
137   - proFieldProps={{
138   - onchange: () => {
139   - message.info('change');
140   - },
141   - }}
142   - />
143   - <ProFormText
144   - width="lg"
145   - name="purchaser"
146   - label="抬头名称"
147   - key="purchaser"
148   - placeholder="请输入抬头名称"
149   - rules={[{ required: true, message: '抬头名称必填' }]}
150   - />
151   - <ProFormSelect
152   - placeholder="选择收款单位"
153   - name="receivingCompany"
154   - width="lg"
155   - key="receivingCompany"
156   - label={
157   - <div>
158   - <span>开票收款单位</span>
159   - <span className="pl-2 text-xs text-gray-400">
160   - 财务开票将依据这个字段,选择对应的公司开票(若对[收款单位]没有要求,请任意选择一个)
161   - </span>
162   - </div>
163   - }
164   - options={enumToSelect(PAYEE_OPTIONS)}
165   - rules={[{ required: true, message: '开票收款单位必填' }]}
166   - />
167   - <ProFormSelect
168   - placeholder="选择是否加急"
169   - name="isUrgent"
170   - width="lg"
171   - key="isUrgent"
172   - label="是否加急"
173   - options={[
174   - { label: '是', value: 'true' },
175   - { label: '否', value: 'false' },
176   - ]}
177   - rules={[{ required: true, message: '是否加急必填' }]}
178   - onChange={(val: any) => {
179   - setIsUrgent(val);
180   - }}
181   - />
182   -
183   - {/* <ProFormDatePicker
184   - key="deadline"
185   - label="期望开票时间"
186   - name="deadline"
187   - rules={[{ required: isUrgent === 'true', message: '期望开票时间必填' }]}
188   - hidden={isUrgent !== 'true'}
189   - /> */}
190   -
191   - <ProFormTextArea
192   - key="invoicingUrgentCause"
193   - label="加急开票原因"
194   - name="invoicingUrgentCause"
195   - rules={[{ required: isUrgent === 'true', message: '加急开票原因' }]}
196   - hidden={isUrgent !== 'true'}
197   - />
198   -
199   - <ProFormUploadDragger
200   - key="2"
201   - label={
202   - <div>
203   - <span>开票明细确认表</span>
204   - <span className="pl-2 text-xs text-gray-400">
205   - 如果开票信息有变更,如开票内容跟下单内容不一致、下单抬头和付款抬头不一致,请上传开票明细确认表。
206   - </span>
207   - </div>
208   - }
209   - name="filePaths"
210   - action="/api/service/order/fileProcess"
211   - fieldProps={{
212   - headers: { Authorization: localStorage.getItem('token') },
213   - }}
214   - />
215   - </ModalForm>
216   - );
217   -};
src/pages/Order/WarningWhitelist/components/AttachmentModal.tsx deleted 100644 → 0
1   -import { getAliYunOSSFileNameFromUrl, isImageName } from '@/utils';
2   -import { ModalForm } from '@ant-design/pro-components';
3   -import { Button, Card, Divider, Empty, Form, Image, List, message } from 'antd';
4   -import Base64 from 'base-64';
5   -import { cloneDeep } from 'lodash';
6   -import React, { useEffect, useState } from 'react';
7   -
8   -export default ({ data, onClose }) => {
9   - let newData = cloneDeep(data);
10   - const [fileList, setFileList] = useState<[]>([]);
11   - console.log(fileList);
12   - const [form] = Form.useForm<{
13   - subOrderId: '';
14   - listAnnex: [];
15   - }>();
16   -
17   - let newListAnnex = newData.listAnnex?.map((path) => {
18   - let i = 0;
19   - return {
20   - uid: i++,
21   - name: getAliYunOSSFileNameFromUrl(path),
22   - status: 'uploaded',
23   - url: path,
24   - response: { data: [path] },
25   - };
26   - });
27   - newData.listAnnex = newListAnnex;
28   -
29   - //将图片和其他文件区分开
30   - let images: any[] = [];
31   - let otherAnnex: any[] = [];
32   - newListAnnex.forEach((item: any) => {
33   - if (isImageName(item.name)) {
34   - images.push(item);
35   - } else {
36   - otherAnnex.push(item);
37   - }
38   - });
39   -
40   - useEffect(() => {
41   - setFileList(newData.listAnnex);
42   - }, []);
43   -
44   - return (
45   - <ModalForm
46   - width={800}
47   - open
48   - title="查看附件"
49   - initialValues={newData}
50   - form={form}
51   - modalProps={{
52   - onCancel: onClose,
53   - }}
54   - submitter={{
55   - render: () => {
56   - return [
57   - <Button
58   - key="back"
59   - onClick={() => {
60   - onClose();
61   - }}
62   - >
63   - 返回
64   - </Button>,
65   - ];
66   - },
67   - }}
68   - >
69   - {newListAnnex?.length <= 0 ? (
70   - <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
71   - ) : (
72   - // <ProFormUploadDragger
73   - // name="listAnnex"
74   - // action="/api/service/order/fileProcess"
75   - // disabled
76   - // fieldProps={{
77   - // headers: { Authorization: localStorage.getItem('token') },
78   - // // onRemove: (file) => {
79   - // // const index = fileList[listMeta.index].indexOf(file);
80   - // // console.log(index);
81   - // // const newFileList = fileList.slice();
82   - // // newFileList.splice(index, 1);
83   - // // setFileList(newFileList);
84   - // // },
85   - // // beforeUpload: (file) => {
86   - // // fileList[listMeta.index] = [...fileList[listMeta.index], file as RcFile];
87   - // // setFileList(fileList);
88   - // // return true;
89   - // // },
90   - // fileList,
91   - // // defaultFileList: itemFileList
92   - // }}
93   - // />
94   - <>
95   - <Card>
96   - <Image.PreviewGroup
97   - className="mr-10"
98   - preview={{
99   - onChange: (current, prev) =>
100   - console.log(`current index: ${current}, prev index: ${prev}`),
101   - }}
102   - >
103   - {images.map((item, index) => (
104   - <React.Fragment key={index}>
105   - <Image
106   - className="max-h-[200px] max-w-[200px]"
107   - src={item.url}
108   - title={item.name}
109   - />{' '}
110   - <Divider type="vertical" />
111   - </React.Fragment>
112   - ))}
113   - </Image.PreviewGroup>
114   - </Card>
115   - <Divider />
116   -
117   - <div>
118   - <List
119   - size="small"
120   - header={<div>其他类型文件</div>}
121   - bordered
122   - dataSource={otherAnnex}
123   - renderItem={(item) => (
124   - <List.Item
125   - actions={[
126   - <Button
127   - type="link"
128   - key="key"
129   - href={item.url}
130   - target="blank"
131   - className="py-1"
132   - >
133   - 下载
134   - </Button>,
135   - <Button
136   - type="link"
137   - key="key"
138   - className="py-1"
139   - onClick={() => {
140   - message.info(item.url);
141   - window.open(
142   - '/previewApi/onlinePreview?url=' +
143   - encodeURIComponent(Base64.encode(item.url)),
144   - );
145   - }}
146   - >
147   - 预览
148   - </Button>,
149   - ]}
150   - >
151   - <div>
152   - <span>{item.name}</span>
153   - </div>
154   - </List.Item>
155   - )}
156   - />
157   - </div>
158   - </>
159   - )}
160   - </ModalForm>
161   - );
162   -};
src/pages/Order/WarningWhitelist/components/BaseModal.tsx deleted 100644 → 0
1   -import { ModalForm } from '@ant-design/pro-components';
2   -import { Form } from 'antd';
3   -
4   -// import { cloneDeep } from 'lodash';
5   -export default ({ setVisible, onClose }) => {
6   - const [form] = Form.useForm<{ name: string; company: string }>();
7   -
8   - return (
9   - <>
10   - <ModalForm<{
11   - name: string;
12   - company: string;
13   - }>
14   - width={500}
15   - open
16   - title="标题"
17   - form={form}
18   - autoFocusFirstInput
19   - modalProps={{
20   - okText: '通过',
21   - cancelText: '取消',
22   - destroyOnClose: true,
23   - onCancel: () => {
24   - setVisible(false);
25   - },
26   - }}
27   - onFinish={async (values) => {
28   - console.log(values);
29   - onClose();
30   - }}
31   - onOpenChange={setVisible}
32   - ></ModalForm>
33   - </>
34   - );
35   -};
src/pages/Order/WarningWhitelist/components/CheckModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postPrepaidAudit,
4   - postServiceOrderAfterSalesCheck,
5   - postServiceOrderAudit,
6   - postServiceOrderFileProcess,
7   - postServiceOrderFinanceCheckOrder,
8   - postServiceOrderLeaderAudit,
9   - postServiceOrderToProcureAudit,
10   -} from '@/services';
11   -import {
12   - ModalForm,
13   - ProFormTextArea,
14   - ProList,
15   -} from '@ant-design/pro-components';
16   -import {
17   - Button,
18   - Col,
19   - Divider,
20   - Form,
21   - Image,
22   - Modal,
23   - Row,
24   - Space,
25   - Tag,
26   - UploadFile,
27   - message,
28   -} from 'antd';
29   -import Upload, { RcFile, UploadProps } from 'antd/es/upload';
30   -import { useEffect, useRef, useState } from 'react';
31   -import {
32   - AFTE_SALES_PLAN_OPTIONS,
33   - CHECK_TYPE,
34   - COMFIR_RECEIPT_IMAGES_NUMBER,
35   -} from '../../constant';
36   -// import { cloneDeep } from 'lodash';
37   -import InvoiceSubOrderInfoTable from '@/pages/Order/Order/components/InvoiceSubOrderInfoTable';
38   -import { enumValueToLabel, transImageFile } from '@/utils';
39   -import { PlusOutlined } from '@ant-design/icons';
40   -import { cloneDeep } from 'lodash';
41   -
42   -export default ({
43   - setCheckVisible,
44   - data,
45   - subOrders,
46   - orderCheckType,
47   - openOrderDrawer,
48   - onClose,
49   -}) => {
50   - const [previewOpen, setPreviewOpen] = useState(false);
51   - const [aPopoverTitle, setAPopoverTitle] = useState('审核');
52   - const [previewImage, setPreviewImage] = useState('');
53   - const [previewTitle, setPreviewTitle] = useState('');
54   - const [paymentReceiptsImages, setPymentReceiptsImages] = useState<any[]>([]);
55   - const fileListObj = useRef<UploadFile[]>([]); //使用引用类型,使得在useEffect里面设置监听事件后,不用更新监听事件也能保持obj与外界一致
56   - const getBase64 = (file: RcFile): Promise<string> =>
57   - new Promise((resolve, reject) => {
58   - const reader = new FileReader();
59   - reader.readAsDataURL(file);
60   - reader.onload = () => resolve(reader.result as string);
61   - reader.onerror = (error) => reject(error);
62   - });
63   - const [fileList, setFileList] = useState<UploadFile[]>([]);
64   - const handleCancel = () => setPreviewOpen(false);
65   - const [messageApi, contextHolder] = message.useMessage();
66   - const [form] = Form.useForm<{ name: string; company: string }>();
67   - let subOrderIds: any[] = subOrders?.map((subOrder) => subOrder.id);
68   - const [mainOrderId] = useState(data.id);
69   -
70   - const [afterSalesInfo, setAfterSalesInfo] = useState<any>();
71   - const [prepaidProofImages, setPrepaidProofImages] = useState<any[]>([]);
72   - /**
73   - * 审核类型
74   - */
75   - function checkType(check: string) {
76   - if (orderCheckType === check) {
77   - return true;
78   - }
79   - return false;
80   - }
81   -
82   - const getOrderAfterSalesInfo = async () => {
83   - // let res = await postServiceOrderQueryAfterSalesInfoSnapshot({
84   - // data: { subOrderIds: subOrderIds },
85   - // });
86   -
87   - //附件
88   - let annex = subOrders[0].afterSalesAnnexList;
89   - let index = 1;
90   - let annexLinks = annex?.map((f) => {
91   - return (
92   - <Button className="p-0 pr-1" type="link" key="key" href={f}>
93   - {'附件' + index++}
94   - </Button>
95   - );
96   - });
97   -
98   - console.log(annexLinks);
99   -
100   - setAfterSalesInfo(
101   - <div className="my-5">
102   - <Row gutter={[16, 24]}>
103   - <Col span={6}>
104   - <span className="text-[#333333]">售后方案</span>
105   - </Col>
106   - <Col span={18}>
107   - {enumValueToLabel(
108   - subOrders[0]?.afterSalesPlan,
109   - AFTE_SALES_PLAN_OPTIONS,
110   - )}
111   - </Col>
112   - <Col span={6}>
113   - <span className="className='text-[#333333]'">售后原因</span>
114   - </Col>
115   - <Col span={18}>{subOrders[0]?.afterSalesNotes}</Col>
116   - <Col span={6}>
117   - <span className="className='text-[#333333]'">附件</span>
118   - </Col>
119   - <Col span={18}>{annexLinks}</Col>
120   - </Row>
121   - </div>,
122   - );
123   - };
124   -
125   - useEffect(() => {
126   - if (checkType(CHECK_TYPE.CONFIRM_DELIVER)) {
127   - setAPopoverTitle('确认发货');
128   - }
129   - getOrderAfterSalesInfo();
130   -
131   - let paymentReceiptsImagesList: any[] = [];
132   - subOrders?.forEach((item: any) => {
133   - if (item.paymentReceiptAnnexList) {
134   - paymentReceiptsImagesList.push(...item.paymentReceiptAnnexList);
135   - }
136   - });
137   - //去重
138   - paymentReceiptsImagesList = [...new Set(paymentReceiptsImagesList)];
139   - setPymentReceiptsImages(paymentReceiptsImagesList);
140   -
141   - //预存审核的凭证
142   - let proofImages: any[] = [];
143   - subOrders?.forEach((item) => {
144   - let images = item.proofImages;
145   - if (images !== null && images !== undefined) {
146   - proofImages.push(...images);
147   - }
148   - });
149   - setPrepaidProofImages(proofImages);
150   - }, []);
151   -
152   - const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => {
153   - //fileListObj得在change里变化,change的参数是已经处理过的file数组
154   - //beforeUpload中的参数file是未处理过,还需要Base64拿到文件数据处理
155   - fileListObj.current = newFileList;
156   - setFileList(newFileList);
157   - };
158   -
159   - /** 粘贴快捷键的回调 */
160   - const onPaste = async (e: any) => {
161   - /** 获取剪切板的数据clipboardData */
162   - let clipboardData = e.clipboardData,
163   - i = 0,
164   - items,
165   - item,
166   - types;
167   -
168   - /** 为空判断 */
169   - if (clipboardData) {
170   - items = clipboardData.items;
171   - if (!items) {
172   - message.info('您的剪贴板中没有照片');
173   - return;
174   - }
175   -
176   - item = items[0];
177   - types = clipboardData.types || [];
178   - /** 遍历剪切板的数据 */
179   - for (; i < types.length; i++) {
180   - if (types[i] === 'Files') {
181   - item = items[i];
182   - break;
183   - }
184   - }
185   -
186   - /** 判断文件是否为图片 */
187   - if (item && item.kind === 'file' && item.type.match(/^image\//i)) {
188   - const imgItem = item.getAsFile();
189   - const newFileList = cloneDeep(fileListObj.current);
190   - let filteredArray = newFileList.filter(
191   - (obj) => obj.status !== 'removed',
192   - ); //过滤掉状态为已删除的照片
193   - const listItem = {
194   - ...imgItem,
195   - status: 'done',
196   - url: await getBase64(imgItem),
197   - originFileObj: imgItem,
198   - };
199   -
200   - if (filteredArray.length >= COMFIR_RECEIPT_IMAGES_NUMBER) {
201   - message.info('发货照片数量不能超过3');
202   - return;
203   - }
204   - fileListObj.current = filteredArray;
205   - filteredArray.push(listItem);
206   - setFileList(filteredArray);
207   - return;
208   - }
209   - }
210   -
211   - message.info('您的剪贴板中没有照片');
212   - };
213   - useEffect(() => {
214   - //回显售后信息
215   - // if (checkType(CHECK_TYPE.AFTER_SALES)) {
216   - // getOrderAfterSalesInfo();
217   - // }
218   -
219   - document.addEventListener('paste', onPaste);
220   - return () => {
221   - document.removeEventListener('paste', onPaste);
222   - };
223   - }, []);
224   - const uploadButton = (
225   - <div>
226   - <PlusOutlined />
227   - <div style={{ marginTop: 8 }}>上传凭证</div>
228   - </div>
229   - );
230   - const handlePreview = async (file: UploadFile) => {
231   - if (!file.url && !file.preview) {
232   - file.preview = await getBase64(file.originFileObj as RcFile);
233   - }
234   - setPreviewImage(file.url || (file.preview as string));
235   - setPreviewOpen(true);
236   - setPreviewTitle(
237   - file.name ||
238   - file.originFileObj?.name ||
239   - file.url!.substring(file.url!.lastIndexOf('/') + 1),
240   - );
241   - };
242   -
243   - const handleBeforeUpload = (file: any) => {
244   - setFileList([...fileList, file]);
245   - return false;
246   - };
247   -
248   - const props: UploadProps = {
249   - onRemove: (file) => {
250   - const index = fileList.indexOf(file);
251   - const newFileList = fileList.slice();
252   - newFileList.splice(index, 1);
253   - setFileList(newFileList);
254   - },
255   - beforeUpload: handleBeforeUpload,
256   - listType: 'picture-card',
257   - onPreview: handlePreview,
258   - fileList,
259   - onChange: handleChange,
260   - accept: 'image/png, image/jpeg, image/png',
261   - // action: '/api/service/order/fileProcess',
262   - name: 'files',
263   - headers: { Authorization: localStorage.getItem('token') },
264   - };
265   -
266   - //仓库审核
267   - async function doCheck(body: object) {
268   - const data = await postServiceOrderAudit({
269   - data: body,
270   - });
271   - if (data.result === RESPONSE_CODE.SUCCESS) {
272   - message.success(data.message);
273   - onClose();
274   - }
275   - }
276   -
277   - /**
278   - *
279   - * @param body 财务审核
280   - */
281   - async function doFinancailCheck(values: any, isAgree: boolean) {
282   - if (fileList.length <= 0) {
283   - message.error('凭证不能为空');
284   - return;
285   - }
286   - messageApi.open({
287   - type: 'loading',
288   - content: '正在上传图片...',
289   - duration: 0,
290   - });
291   - //附件处理
292   - let formData = new FormData();
293   - //附件处理
294   - for (let file of fileList) {
295   - if (file.originFileObj) {
296   - formData.append('files', file.originFileObj as RcFile);
297   - } else {
298   - //有url的话取url(源文件),没url取thumbUrl。有url的时候thumbUrl是略缩图
299   - if (file?.url === undefined || file?.url === null) {
300   - formData.append(
301   - 'files',
302   - transImageFile(file?.thumbUrl),
303   - file?.originFileObj?.name,
304   - );
305   - } else {
306   - formData.append(
307   - 'files',
308   - transImageFile(file?.url),
309   - file?.originFileObj?.name,
310   - );
311   - }
312   - }
313   - }
314   - let res = await postServiceOrderFileProcess({
315   - data: formData,
316   - });
317   - messageApi.destroy();
318   - if (res.result === RESPONSE_CODE.SUCCESS) {
319   - message.success('上传成功!');
320   -
321   - let fileUrls = res?.data?.map((item) => {
322   - return { url: item };
323   - });
324   - //财务审核
325   - const data = await postServiceOrderFinanceCheckOrder({
326   - data: {
327   - checkNotes: values.name,
328   - ids: subOrderIds,
329   - checkPassOrReject: isAgree,
330   - invoicingCheckAnnex: fileUrls,
331   - },
332   - });
333   - if (data.result === RESPONSE_CODE.SUCCESS) {
334   - message.success(data.message);
335   - onClose();
336   - }
337   - } else {
338   - message.success('上传失败');
339   - }
340   - }
341   -
342   - /**
343   - *
344   - * @param body 售后审核
345   - */
346   - async function doAfterSalesCheck(body: object) {
347   - const data = await postServiceOrderAfterSalesCheck({
348   - data: body,
349   - });
350   - if (data.result === RESPONSE_CODE.SUCCESS) {
351   - message.success(data.message);
352   - onClose();
353   - }
354   - }
355   -
356   - /**
357   - *
358   - * @param body 领导审核
359   - */
360   - async function doLeaderCheck(body: object) {
361   - const data = await postServiceOrderLeaderAudit({
362   - data: body,
363   - });
364   - if (data.result === RESPONSE_CODE.SUCCESS) {
365   - message.success(data.message);
366   - onClose();
367   - }
368   - }
369   -
370   - /**
371   - * 预存审核
372   - * @param body
373   - */
374   - async function doPrepaidAudit(body: any) {
375   - const data = await postPrepaidAudit({
376   - data: body,
377   - });
378   - if (data.result === RESPONSE_CODE.SUCCESS) {
379   - message.success(data.message);
380   - onClose();
381   - }
382   - }
383   -
384   - function computeType() {
385   - let type: string = '';
386   - if (checkType(CHECK_TYPE.CONFIRM_DELIVER)) {
387   - type = 'confirm_deliver';
388   - }
389   - if (checkType(CHECK_TYPE.WEARHOUSE_KEEPER)) {
390   - type = 'warehouse_audit';
391   - }
392   - if (checkType(CHECK_TYPE.WAITING_FOR_POST_AUDIT)) {
393   - type = 'post_audit';
394   - }
395   - if (checkType(CHECK_TYPE.NODE_OPERATING_AUDIT)) {
396   - type = 'node_operating_audit';
397   - }
398   - if (checkType(CHECK_TYPE.MODIFY_LEADER_AUDIT)) {
399   - type = 'modify_leader_audit';
400   - }
401   - if (checkType(CHECK_TYPE.URGENT_INVOICE_AUDITING)) {
402   - type = 'urgent_invoice_audit';
403   - }
404   - if (checkType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT)) {
405   - type = 'payment_receipt_audit';
406   - }
407   - if (checkType(CHECK_TYPE.CONFIRM_REISSUE)) {
408   - type = 'confirm_reissue';
409   - }
410   - if (checkType(CHECK_TYPE.CREDIT_AUDIT)) {
411   - type = 'credit_audit';
412   - }
413   - if (checkType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD)) {
414   - type = 'urgent_invoice_audit_old';
415   - }
416   - if (checkType(CHECK_TYPE.CONFIRM_REISSUE_OLD)) {
417   - type = 'confirm_reissue_old';
418   - }
419   - return type;
420   - }
421   -
422   - return (
423   - <>
424   - <ModalForm<{
425   - name: string;
426   - company: string;
427   - }>
428   - width={500}
429   - open
430   - title={aPopoverTitle}
431   - form={form}
432   - autoFocusFirstInput
433   - modalProps={{
434   - okText: '通过',
435   - cancelText: '驳回',
436   - destroyOnClose: true,
437   - onCancel: () => {
438   - setCheckVisible(false);
439   - },
440   - }}
441   - submitter={{
442   - render: (props, defaultDoms) => {
443   - let myDoms = [];
444   - if (!checkType(CHECK_TYPE.CONFIRM_DELIVER)) {
445   - myDoms.push(
446   - <Button
447   - key="驳回"
448   - onClick={async () => {
449   - if (checkType(CHECK_TYPE.AFTER_SALES)) {
450   - doAfterSalesCheck({
451   - applyType: 'after-sales',
452   - isAfterSalesSuccess: false,
453   - subOrderIds: subOrderIds,
454   - mainId: mainOrderId,
455   - afterSalesRejectionNotes: form.getFieldValue('name'),
456   - });
457   - return;
458   - }
459   -
460   - if (checkType(CHECK_TYPE.FINALCIAL)) {
461   - let values = { name: form.getFieldValue('name') };
462   - doFinancailCheck(values, false);
463   - return;
464   - }
465   -
466   - if (checkType(CHECK_TYPE.LEADER_AUDIT)) {
467   - doLeaderCheck({
468   - pass: false,
469   - subOrderIds: subOrderIds,
470   - reason: form.getFieldValue('name'),
471   - });
472   - return;
473   - }
474   -
475   - if (checkType(CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT)) {
476   - doAfterSalesCheck({
477   - applyType: 'order-change-normal',
478   - isAfterSalesSuccess: false,
479   - subOrderIds: subOrderIds,
480   - mainId: mainOrderId,
481   - afterSalesRejectionNotes: form.getFieldValue('name'),
482   - });
483   - return;
484   - }
485   -
486   - //预存审核,先暂时共用同一个审核弹窗
487   - if (checkType(CHECK_TYPE.PREPAID_AUDIT)) {
488   - return doPrepaidAudit({
489   - pass: false,
490   - ids: subOrderIds,
491   - auditNotes: form.getFieldValue('name'),
492   - });
493   - }
494   -
495   - let type = '';
496   - type = computeType();
497   - console.log('type:' + type);
498   - doCheck({
499   - pass: false,
500   - subOrderIds: subOrderIds,
501   - type: type,
502   - notes: form.getFieldValue('name'),
503   - });
504   - }}
505   - >
506   - 驳回
507   - </Button>,
508   - );
509   - }
510   -
511   - //如果是仓库审核,那么显示这个外部采购
512   - if (checkType(CHECK_TYPE.WEARHOUSE_KEEPER)) {
513   - myDoms.push(
514   - <Button
515   - key="外部采购"
516   - onClick={async () => {
517   - let res = await postServiceOrderToProcureAudit({
518   - data: {
519   - subOrderIds: subOrderIds,
520   - },
521   - });
522   -
523   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
524   - message.success(res.message);
525   - onClose();
526   - }
527   - }}
528   - >
529   - 外部采购
530   - </Button>,
531   - );
532   - }
533   -
534   - //确认
535   - myDoms.push(defaultDoms[1]);
536   - return myDoms;
537   - },
538   - }}
539   - submitTimeout={2000}
540   - onFinish={async (values) => {
541   - if (checkType(CHECK_TYPE.AFTER_SALES)) {
542   - //审核通过
543   - return doAfterSalesCheck({
544   - applyType: 'after-sales',
545   - isAfterSalesSuccess: true,
546   - subOrderIds: subOrderIds,
547   - mainId: mainOrderId,
548   - afterSalesRejectionNotes: values.name,
549   - });
550   - }
551   - console.log('h');
552   - if (checkType(CHECK_TYPE.FINALCIAL)) {
553   - doFinancailCheck(values, true);
554   - return;
555   - }
556   -
557   - if (checkType(CHECK_TYPE.LEADER_AUDIT)) {
558   - doLeaderCheck({
559   - pass: true,
560   - subOrderIds: subOrderIds,
561   - reason: values.name,
562   - });
563   - return;
564   - }
565   -
566   - if (checkType(CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT)) {
567   - //审核通过
568   - return doAfterSalesCheck({
569   - applyType: 'order-change-normal',
570   - isAfterSalesSuccess: true,
571   - subOrderIds: subOrderIds,
572   - mainId: mainOrderId,
573   - afterSalesRejectionNotes: values.name,
574   - });
575   - }
576   -
577   - //预存审核,先暂时共用同一个审核弹窗
578   - if (checkType(CHECK_TYPE.PREPAID_AUDIT)) {
579   - return doPrepaidAudit({
580   - pass: true,
581   - ids: subOrderIds,
582   - auditNotes: form.getFieldValue('name'),
583   - });
584   - }
585   -
586   - let type = '';
587   - type = computeType();
588   - doCheck({
589   - pass: true,
590   - subOrderIds: subOrderIds,
591   - type: type,
592   - notes: form.getFieldValue('name'),
593   - });
594   - }}
595   - onOpenChange={setCheckVisible}
596   - >
597   - {checkType(CHECK_TYPE.AFTER_SALES) ? (
598   - <>
599   - {afterSalesInfo}
600   - <Button
601   - className="px-0"
602   - type="link"
603   - onClick={() => {
604   - console.log(data);
605   - openOrderDrawer('after-sales-check', mainOrderId);
606   - }}
607   - >
608   - 查看旧订单
609   - </Button>
610   - </>
611   - ) : (
612   - ''
613   - )}
614   -
615   - {checkType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT) ? (
616   - <>
617   - <Divider orientation="center">
618   - <span className="text-sm">回款凭证</span>
619   - </Divider>
620   - <Image.PreviewGroup
621   - className="mr-10"
622   - preview={{
623   - onChange: (current, prev) =>
624   - console.log(`current index: ${current}, prev index: ${prev}`),
625   - }}
626   - >
627   - {paymentReceiptsImages.map((url) => (
628   - <>
629   - <Image width={120} src={url} /> <Divider type="vertical" />
630   - </>
631   - ))}
632   - </Image.PreviewGroup>
633   - <Divider></Divider>
634   - </>
635   - ) : (
636   - ''
637   - )}
638   -
639   - {checkType(CHECK_TYPE.PREPAID_AUDIT) && (
640   - <>
641   - <Divider orientation="center">
642   - <span className="text-sm">凭证</span>
643   - </Divider>
644   - <Image.PreviewGroup
645   - className="mr-10"
646   - preview={{
647   - onChange: (current, prev) =>
648   - console.log(`current index: ${current}, prev index: ${prev}`),
649   - }}
650   - >
651   - {prepaidProofImages.map((url) => (
652   - <>
653   - <Image width={120} src={url} /> <Divider type="vertical" />
654   - </>
655   - ))}
656   - </Image.PreviewGroup>
657   - <Divider></Divider>
658   - </>
659   - )}
660   -
661   - {checkType('prepaidAudit') ? (
662   - <div>请特别注意手机号码和充值金额。</div>
663   - ) : (
664   - <div>请特别注意订单总金额与订单金额。</div>
665   - )}
666   - {!checkType(CHECK_TYPE.CONFIRM_DELIVER) ? (
667   - <ProFormTextArea
668   - width="lg"
669   - name="name"
670   - placeholder="若驳回,请填写驳回理由"
671   - />
672   - ) : (
673   - <></>
674   - )}
675   - {checkType(CHECK_TYPE.FINALCIAL) ? (
676   - <>
677   - <div className="pb-4 text-xs decoration-gray-50">
678   - 可复制照片粘贴
679   - </div>
680   - <Upload {...props}>
681   - {fileList.length < COMFIR_RECEIPT_IMAGES_NUMBER
682   - ? uploadButton
683   - : ''}
684   - </Upload>
685   - </>
686   - ) : (
687   - ''
688   - )}
689   - {checkType(CHECK_TYPE.CONFIRM_REISSUE) && (
690   - <>
691   - <InvoiceSubOrderInfoTable
692   - subOrderIds={subOrderIds}
693   - ></InvoiceSubOrderInfoTable>
694   - </>
695   - )}
696   - {checkType(CHECK_TYPE.URGENT_INVOICE_AUDITING) ? (
697   - <>
698   - <ProList
699   - rowKey="id"
700   - headerTitle="发票信息"
701   - metas={{
702   - title: {
703   - dataIndex: 'name',
704   - },
705   - avatar: {
706   - dataIndex: 'image',
707   - editable: false,
708   - },
709   - description: {
710   - dataIndex: 'desc',
711   - },
712   - subTitle: {
713   - render: () => {
714   - return (
715   - <Space size={0}>
716   - <Tag color="blue">Ant Design</Tag>
717   - <Tag color="#5BD8A6">TechUI</Tag>
718   - </Space>
719   - );
720   - },
721   - },
722   - actions: {
723   - render: (text, row, index, action) => [
724   - <a
725   - onClick={() => {
726   - action?.startEditable(row.id);
727   - }}
728   - key="link"
729   - >
730   - 编辑
731   - </a>,
732   - ],
733   - },
734   - }}
735   - ></ProList>
736   - </>
737   - ) : (
738   - ''
739   - )}
740   - </ModalForm>
741   -
742   - <Modal
743   - open={previewOpen}
744   - title={previewTitle}
745   - footer={null}
746   - onCancel={handleCancel}
747   - >
748   - <img alt="图片预览" style={{ width: '100%' }} src={previewImage} />
749   - </Modal>
750   - {contextHolder}
751   - </>
752   - );
753   -};
src/pages/Order/WarningWhitelist/components/ConfirmReceiptModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderConfirmReceipt } from '@/services';
3   -import { PlusOutlined } from '@ant-design/icons';
4   -import { Button, Modal, Upload, message } from 'antd';
5   -import { RcFile, UploadFile, UploadProps } from 'antd/es/upload';
6   -import { cloneDeep } from 'lodash';
7   -import { useEffect, useRef, useState } from 'react';
8   -import { COMFIR_RECEIPT_IMAGES_NUMBER } from '../../constant';
9   -export default ({ data, onClose }) => {
10   - const subIds = data?.map((item) => {
11   - return item.id;
12   - });
13   - // const [form] = Form.useForm<{ name: string; company: string }>();
14   - const [previewOpen, setPreviewOpen] = useState(false);
15   - const [previewImage, setPreviewImage] = useState('');
16   - const [previewTitle, setPreviewTitle] = useState('');
17   - const fileListObj = useRef<UploadFile[]>([]); //使用引用类型,使得在useEffect里面设置监听事件后,不用更新监听事件也能保持obj与外界一致
18   - const getBase64 = (file: RcFile): Promise<string> =>
19   - new Promise((resolve, reject) => {
20   - const reader = new FileReader();
21   - reader.readAsDataURL(file);
22   - reader.onload = () => resolve(reader.result as string);
23   - reader.onerror = (error) => reject(error);
24   - });
25   - const [fileList, setFileList] = useState<UploadFile[]>([]);
26   - const [uploading, setUploading] = useState(false);
27   - const handleCancel = () => setPreviewOpen(false);
28   -
29   - const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => {
30   - //fileListObj得在change里变化,change的参数是已经处理过的file数组
31   - //beforeUpload中的参数file是未处理过,还需要Base64拿到文件数据处理
32   - fileListObj.current = newFileList;
33   - setFileList(newFileList);
34   - };
35   -
36   - /** 粘贴快捷键的回调 */
37   - const onPaste = async (e: any) => {
38   - /** 获取剪切板的数据clipboardData */
39   - let clipboardData = e.clipboardData,
40   - i = 0,
41   - items,
42   - item,
43   - types;
44   -
45   - /** 为空判断 */
46   - if (clipboardData) {
47   - items = clipboardData.items;
48   - if (!items) {
49   - message.info('您的剪贴板中没有照片');
50   - return;
51   - }
52   -
53   - item = items[0];
54   - types = clipboardData.types || [];
55   - /** 遍历剪切板的数据 */
56   - for (; i < types.length; i++) {
57   - if (types[i] === 'Files') {
58   - item = items[i];
59   - break;
60   - }
61   - }
62   -
63   - /** 判断文件是否为图片 */
64   - if (item && item.kind === 'file' && item.type.match(/^image\//i)) {
65   - const imgItem = item.getAsFile();
66   - const newFileList = cloneDeep(fileListObj.current);
67   - let filteredArray = newFileList.filter(
68   - (obj) => obj.status !== 'removed',
69   - ); //过滤掉状态为已删除的照片
70   - const listItem = {
71   - ...imgItem,
72   - status: 'done',
73   - url: await getBase64(imgItem),
74   - originFileObj: imgItem,
75   - };
76   -
77   - if (filteredArray.length >= COMFIR_RECEIPT_IMAGES_NUMBER) {
78   - message.info('发货凭证照片数量不能超过3');
79   - return;
80   - }
81   - fileListObj.current = filteredArray;
82   - filteredArray.push(listItem);
83   - setFileList(filteredArray);
84   - return;
85   - }
86   - }
87   -
88   - message.info('您的剪贴板中没有照片');
89   - };
90   - useEffect(() => {
91   - document.addEventListener('paste', onPaste);
92   - return () => {
93   - document.removeEventListener('paste', onPaste);
94   - };
95   - }, []);
96   - const uploadButton = (
97   - <div>
98   - <PlusOutlined />
99   - <div style={{ marginTop: 8 }}>上传凭证</div>
100   - </div>
101   - );
102   - const handlePreview = async (file: UploadFile) => {
103   - if (!file.url && !file.preview) {
104   - file.preview = await getBase64(file.originFileObj as RcFile);
105   - }
106   - setPreviewImage(file.url || (file.preview as string));
107   - setPreviewOpen(true);
108   - setPreviewTitle(
109   - file.name ||
110   - file.originFileObj?.name ||
111   - file.url!.substring(file.url!.lastIndexOf('/') + 1),
112   - );
113   - };
114   -
115   - const handleUpload = async () => {
116   - const formData = new FormData();
117   - fileList.forEach((file) => {
118   - //originFileObj二进制文件
119   - formData.append('files', file.originFileObj as RcFile);
120   - });
121   - // console.log(fileList[0] as RcFile)
122   - // formData.append('file', fileList[0] as RcFile);
123   - formData.append('subIds', subIds);
124   - setUploading(true);
125   - // You can use any AJAX library you like
126   - const res = await postServiceOrderConfirmReceipt({
127   - data: formData,
128   - headers: {
129   - 'Content-Type':
130   - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
131   - },
132   - });
133   -
134   - if (res.result === RESPONSE_CODE.SUCCESS) {
135   - message.success(res.message);
136   - onClose();
137   - }
138   -
139   - setUploading(false);
140   - };
141   -
142   - const props: UploadProps = {
143   - onRemove: (file) => {
144   - const index = fileList.indexOf(file);
145   - const newFileList = fileList.slice();
146   - newFileList.splice(index, 1);
147   - setFileList(newFileList);
148   - },
149   - beforeUpload: (file) => {
150   - setFileList([...fileList, file]);
151   - return false;
152   - },
153   - listType: 'picture-card',
154   - onPreview: handlePreview,
155   - fileList,
156   - onChange: handleChange,
157   - accept: 'image/png, image/jpeg, image/png',
158   - };
159   -
160   - return (
161   - <>
162   - <Modal
163   - width={500}
164   - open
165   - title="确认收货"
166   - footer={[
167   - <Button key="cancel" onClick={onClose}>
168   - 取消
169   - </Button>,
170   - <Button
171   - type="primary"
172   - key="ok"
173   - onClick={handleUpload}
174   - disabled={fileList.length === 0}
175   - loading={uploading}
176   - >
177   - {uploading ? '上传中' : '提交'}
178   - </Button>,
179   - ]}
180   - onCancel={async () => {
181   - onClose();
182   - }}
183   - >
184   - <div className="pt-4 font-semibold">请将买家确认收货的凭证照片上传</div>
185   - <div className="pb-4 text-xs decoration-gray-50">可复制照片粘贴</div>
186   - <Upload {...props}>
187   - {fileList.length < COMFIR_RECEIPT_IMAGES_NUMBER ? uploadButton : ''}
188   - </Upload>
189   - </Modal>
190   - <Modal
191   - open={previewOpen}
192   - title={previewTitle}
193   - footer={null}
194   - onCancel={handleCancel}
195   - >
196   - <img alt="图片预览" style={{ width: '100%' }} src={previewImage} />
197   - </Modal>
198   - </>
199   - );
200   -};
src/pages/Order/WarningWhitelist/components/DeliverInfoDrawer.tsx deleted 100644 → 0
1   -import { postDistrictSelOrderProvince } from '@/services';
2   -import { enumValueToLabel } from '@/utils';
3   -import { getReceivingCompanyOptions } from '@/utils/order';
4   -import { Col, Drawer, Row } from 'antd';
5   -import { useEffect, useState } from 'react';
6   -import { PAYEE_OPTIONS } from '../../constant';
7   -
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]);
35   - return (
36   - <>
37   - <Drawer
38   - width={500}
39   - title="基本信息"
40   - placement="right"
41   - onClose={onClose}
42   - open
43   - >
44   - <Row gutter={[16, 24]}>
45   - <Col span={6}>
46   - <span className="text-[#333333]">收货人</span>
47   - </Col>
48   - <Col span={18}>{data.customerName}</Col>
49   - <Col span={6}>
50   - <span className="className='text-[#333333]'">联系方式</span>
51   - </Col>
52   - <Col span={18}>{data.customerContactNumber}</Col>
53   - <Col span={6}>
54   - <span className="className='text-[#333333]'">省市区</span>
55   - </Col>
56   - <Col span={18}>
57   - {province}&nbsp;{city}&nbsp;{district}
58   - </Col>
59   - <Col span={6}>
60   - <span className="className='text-[#333333]'">收货地址</span>
61   - </Col>
62   - <Col span={18}>{data.customerShippingAddress}</Col>
63   - <Col span={6}>
64   - <span className="className='text-[#333333]'">课题组老师</span>
65   - </Col>
66   - <Col span={18}>{data.institutionContactName}</Col>
67   - <Col span={6}>
68   - <span className="className='text-[#333333]'">单位名称</span>
69   - </Col>
70   - <Col span={18}>{data.institution}</Col>
71   - <Col span={6}>
72   - <span className="className='text-[#333333]'">开户银行</span>
73   - </Col>
74   - <Col span={18}>{data.bank}</Col>
75   -
76   - <Col span={6}>
77   - <span className="className='text-[#333333]'">开票收款单位</span>
78   - </Col>
79   - <Col span={18}>
80   - {enumValueToLabel(
81   - data.receivingCompany,
82   - getReceivingCompanyOptions(PAYEE_OPTIONS),
83   - )}
84   - </Col>
85   -
86   - <Col span={6}>
87   - <span className="className='text-[#333333]'">银行账号</span>
88   - </Col>
89   - <Col span={18}>{data.bankAccountNumber}</Col>
90   - <Col span={6}>
91   - <span className="className='text-[#333333]'">开票识别号</span>
92   - </Col>
93   - <Col span={18}>{data.invoiceIdentificationNumber}</Col>
94   - </Row>
95   - </Drawer>
96   - </>
97   - );
98   -};
src/pages/Order/WarningWhitelist/components/DeliverModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postServiceOrderProcureSend,
4   - postServiceOrderSendProduct,
5   - postServiceOrderSupplierSendOrder,
6   -} from '@/services';
7   -import { enumToSelect } from '@/utils';
8   -import {
9   - ProColumns,
10   - ProForm,
11   - ProFormSelect,
12   - ProFormText,
13   - ProTable,
14   -} from '@ant-design/pro-components';
15   -import {
16   - Button,
17   - Col,
18   - Flex,
19   - Input,
20   - InputNumber,
21   - Modal,
22   - Row,
23   - Select,
24   - message,
25   -} from 'antd';
26   -import { cloneDeep } from 'lodash';
27   -import { useEffect, useRef, useState } from 'react';
28   -import { CHECK_TYPE, LOGISTICS_STATUS_OPTIONS } from '../../constant';
29   -
30   -const DeliverModal = ({
31   - data: propsData,
32   - isSendProduct,
33   - setVisible,
34   - sendType,
35   - onClose,
36   -}) => {
37   - const [data, setData] = useState(propsData || {});
38   - const form = useRef();
39   -
40   - /**
41   - * 是供应商发货还是普通发货
42   - * @param typeString
43   - * @returns
44   - */
45   - function optType(typeString: string) {
46   - if (sendType === typeString) {
47   - return true;
48   - }
49   -
50   - return false;
51   - }
52   -
53   - useEffect(() => {
54   - setData(propsData);
55   - }, [propsData]);
56   -
57   - const handleChange = (key: string, index: number, obj: any) => {
58   - const newData = cloneDeep(data);
59   - if (typeof obj !== 'object') {
60   - newData[index][key] = obj;
61   - } else {
62   - newData[index][key] = obj.target?.value;
63   - }
64   - setData(newData);
65   - };
66   - const columns: ProColumns<any>[] = [
67   - {
68   - title: 'ID',
69   - dataIndex: 'id',
70   - width: 120,
71   - render: (_, record) => <Input value={record.id} disabled />,
72   - },
73   - {
74   - title: '商品编号',
75   - dataIndex: 'productCode',
76   - width: 120,
77   - render: (_, record) => <Input value={record.productCode} disabled />,
78   - },
79   - {
80   - title: '商品名称',
81   - dataIndex: 'productName',
82   - width: 120,
83   - render: (_, record) => <Input value={record.productName} disabled />,
84   - },
85   - {
86   - title: '商品参数',
87   - dataIndex: 'parameters',
88   - width: 80,
89   - render: (_, record) => <Input value={record.parameters} disabled />,
90   - },
91   - {
92   - title: '商品数量',
93   - dataIndex: 'status',
94   - render: (_, record) => <InputNumber value={record.quantity} disabled />,
95   - },
96   - {
97   - title: '包裹数量',
98   - dataIndex: 'packageNumber',
99   - render: (_, record, index) => (
100   - <InputNumber
101   - min={1}
102   - value={record.packageNumber}
103   - defaultValue={1}
104   - onChange={(value) => handleChange('packageNumber', index, value)}
105   - />
106   - ),
107   - },
108   - {
109   - title: '物流方式',
110   - key: 'logisticsMethod',
111   - render: (_, record, index) => (
112   - <Select
113   - style={{ minWidth: 150 }}
114   - placeholder="请输入物流方式"
115   - value={record.logisticsMethod}
116   - options={enumToSelect(LOGISTICS_STATUS_OPTIONS)}
117   - onChange={(value) => {
118   - handleChange('logisticsMethod', index, value); //修改时更改record数据
119   - if (value === 'OTHER_LOGISTICS') {
120   - message.info(
121   - '您选择的是[其他物流方式],请将该物流方式写在备注中',
122   - );
123   - }
124   - }}
125   - />
126   - ),
127   - },
128   - {
129   - title: '物流单号',
130   - key: 'serialNumber',
131   - render: (_, record, index) => (
132   - <Input
133   - placeholder="请输入物流单号"
134   - value={record.serialNumber}
135   - onChange={(value) => {
136   - handleChange('serialNumber', index, value);
137   - }}
138   - />
139   - ),
140   - },
141   - {
142   - title: '物流备注',
143   - dataIndex: 'packageNumber',
144   - render: (_, record, index) => (
145   - <Input.TextArea
146   - value={record.logisticsNotes}
147   - onChange={(value) => handleChange('logisticsNotes', index, value)}
148   - />
149   - ),
150   - },
151   - ];
152   -
153   - return (
154   - <Modal
155   - open
156   - width={1000}
157   - title={isSendProduct ? '发货' : '修改发货信息'}
158   - onOk={async () => {
159   - //请求体封装
160   - let list = data.map((item) => {
161   - return {
162   - id: item.id,
163   - logisticsMethod: item.logisticsMethod,
164   - serialNumber: item.serialNumber,
165   - packageNumber:
166   - item.packageNumber === null || item.packageNumber === undefined
167   - ? 1
168   - : item.packageNumber,
169   - logisticsNotes: item.logisticsNotes,
170   - };
171   - });
172   -
173   - for (let item of list) {
174   - let method = item.logisticsMethod;
175   - let notes = item.logisticsNotes;
176   - if (
177   - method === 'OTHER_LOGISTICS' &&
178   - (notes === '' || notes === undefined)
179   - ) {
180   - message.error(
181   - '请检查:物流方式为[其他物流方式]的记录中,物流备注不能为空!请将实际的物流方式填写在备注中!',
182   - );
183   - return;
184   - }
185   - }
186   - let body = { id: data[0].mainOrderId, list: list, flag: false };
187   - if (isSendProduct) {
188   - body.flag = true;
189   - }
190   - //发货请求
191   - let res;
192   - if (optType(CHECK_TYPE.SUPPLIER)) {
193   - res = await postServiceOrderSupplierSendOrder({ data: body });
194   - } else if (optType(CHECK_TYPE.PROCURE)) {
195   - res = await postServiceOrderProcureSend({ data: body });
196   - } else {
197   - res = await postServiceOrderSendProduct({ data: body });
198   - }
199   -
200   - if (res.result === RESPONSE_CODE.SUCCESS) {
201   - message.success(res.message);
202   - onClose();
203   - }
204   - }}
205   - onCancel={() => {
206   - setVisible(false);
207   - }}
208   - footer={[
209   - <Button
210   - key="back"
211   - onClick={() => {
212   - setVisible(false);
213   - }}
214   - >
215   - 取消
216   - </Button>,
217   - <Button
218   - key="selfDeliver"
219   - type="primary"
220   - onClick={async () => {
221   - //请求体封装
222   - let list = data.map((item) => {
223   - return {
224   - id: item.id,
225   - deliverType: 'SELF_DELIVER',
226   - };
227   - });
228   -
229   - let body = { id: data[0].mainOrderId, list: list, flag: false };
230   - if (isSendProduct) {
231   - body.flag = true;
232   - }
233   - //发货请求
234   - let res;
235   - if (optType(CHECK_TYPE.SUPPLIER)) {
236   - res = await postServiceOrderSupplierSendOrder({ data: body });
237   - } else if (optType(CHECK_TYPE.PROCURE)) {
238   - res = await postServiceOrderProcureSend({ data: body });
239   - } else {
240   - res = await postServiceOrderSendProduct({ data: body });
241   - }
242   -
243   - if (res.result === RESPONSE_CODE.SUCCESS) {
244   - message.success(res.message);
245   - onClose();
246   - }
247   - }}
248   - >
249   - 自行派送
250   - </Button>,
251   - <Button
252   - key="submit"
253   - type="primary"
254   - onClick={async () => {
255   - //请求体封装
256   - let list = data.map((item) => {
257   - return {
258   - id: item.id,
259   - logisticsMethod: item.logisticsMethod,
260   - serialNumber: item.serialNumber,
261   - packageNumber:
262   - item.packageNumber === null ||
263   - item.packageNumber === undefined
264   - ? 1
265   - : item.packageNumber,
266   - logisticsNotes: item.logisticsNotes,
267   - };
268   - });
269   -
270   - for (let item of list) {
271   - let method = item.logisticsMethod;
272   - let notes = item.logisticsNotes;
273   - if (
274   - method === 'OTHER_LOGISTICS' &&
275   - (notes === '' || notes === undefined)
276   - ) {
277   - message.error(
278   - '请检查:物流方式为[其他物流方式]的记录中,物流备注不能为空!请将实际的物流方式填写在备注中!',
279   - );
280   - return;
281   - }
282   - }
283   - let body = { id: data[0].mainOrderId, list: list, flag: false };
284   - if (isSendProduct) {
285   - body.flag = true;
286   - }
287   - //发货请求
288   - let res;
289   - if (optType(CHECK_TYPE.SUPPLIER)) {
290   - res = await postServiceOrderSupplierSendOrder({ data: body });
291   - } else if (optType(CHECK_TYPE.PROCURE)) {
292   - res = await postServiceOrderProcureSend({ data: body });
293   - } else {
294   - res = await postServiceOrderSendProduct({ data: body });
295   - }
296   -
297   - if (res.result === RESPONSE_CODE.SUCCESS) {
298   - message.success(res.message);
299   - onClose();
300   - }
301   - }}
302   - >
303   - 确认
304   - </Button>,
305   - ]}
306   - >
307   - <Flex vertical>
308   - <strong>将物流方式和物流单号更新到下方所有订单</strong>
309   - <span className="text-[red] py-1">
310   - 选择【其他物流方式】时,需要将对应的物流方式填写在备注中。例如:如果发圆通快递,系统上没有这个选项,就需要选【其他物流方式】,然后把“圆通快递”填在备注上。
311   - </span>
312   - </Flex>
313   -
314   - <ProForm
315   - layout="inline"
316   - submitter={false}
317   - className="mb-8"
318   - formRef={form}
319   - >
320   - <Row gutter={[0, 6]}>
321   - <Col>
322   - <ProFormSelect
323   - placeholder="请输入物流方式"
324   - name="logisticsMethod"
325   - width="sm"
326   - label="物流方式"
327   - options={enumToSelect(LOGISTICS_STATUS_OPTIONS)}
328   - />
329   - <ProFormText name="logisticsNotes" label="物流备注"></ProFormText>
330   - </Col>
331   - <Col>
332   - <ProFormText name="serialNumber" label="物流单号"></ProFormText>
333   - </Col>
334   - </Row>
335   -
336   - <Button
337   - type="primary"
338   - onClick={() => {
339   - const values = form.current.getFieldsValue();
340   - if (values.logisticsMethod === 'OTHER_LOGISTICS') {
341   - message.info(
342   - '自动填充成功!您选择的是其他物流方式,请将物流方式写在物流备注中!',
343   - );
344   - }
345   - let newData = cloneDeep(data);
346   - newData = newData.map((item) => ({
347   - ...item,
348   - logisticsMethod: values.logisticsMethod,
349   - serialNumber: values.serialNumber,
350   - logisticsNotes: values.logisticsNotes,
351   - }));
352   - setData(newData);
353   - }}
354   - >
355   - 批量更新
356   - </Button>
357   - </ProForm>
358   - <ProTable<any>
359   - className="px-0"
360   - dataSource={data}
361   - rowKey="id"
362   - pagination={false}
363   - columns={columns}
364   - search={false}
365   - dateFormatter="string"
366   - options={false}
367   - scroll={{ x: 1400 }}
368   - />
369   - </Modal>
370   - );
371   -};
372   -
373   -export default DeliverModal;
src/pages/Order/WarningWhitelist/components/FinancialDrawer.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postServiceOrderEditOrder,
4   - postServiceOrderInvoicing,
5   -} from '@/services';
6   -import { FloatAdd, enumToSelect, enumValueToLabel } from '@/utils';
7   -import { getReceivingCompanyOptions } from '@/utils/order';
8   -import {
9   - DrawerForm,
10   - ProFormDatePicker,
11   - ProFormDigit,
12   - ProFormSelect,
13   - ProFormText,
14   - ProFormTextArea,
15   -} from '@ant-design/pro-components';
16   -import { Button, Form, message } from 'antd';
17   -import { useEffect, useState } from 'react';
18   -import { INVOCING_STATUS_OPTIONS_OLD, PAYEE_OPTIONS } from '../../constant';
19   -
20   -export default ({
21   - mainOrder,
22   - subOrders,
23   - isEdit,
24   - isMainOrder,
25   - cancel,
26   - onClose,
27   -}) => {
28   - const [invoicingStatus, setInvoicingStatus] = useState('');
29   - const subIds = subOrders.map((item) => item.id);
30   - useEffect(() => {
31   - // 在组件挂载或数据变化时,更新组件状态
32   - if (mainOrder) {
33   - setInvoicingStatus(subOrders[0]?.invoicingStatus);
34   - }
35   - }, [mainOrder]);
36   - useEffect(() => {
37   - console.log(JSON.stringify(subOrders));
38   - }, []);
39   -
40   - const [form] = Form.useForm<{ name: string; company: string }>();
41   -
42   - /**
43   - * 自动选择收款公司
44   - * @param receivingCompany
45   - */
46   - function chooseReceivingCompany(receivingCompany: any) {
47   - form.setFieldValue('payee', receivingCompany);
48   - }
49   -
50   - /**
51   - * 计算选中子订单的主订单金额之和
52   - */
53   - function computeTotalPayment() {
54   - let distinctMap = new Map();
55   -
56   - subOrders?.forEach((item: any) => {
57   - distinctMap.set(item.mainOrderId, item.totalPayment);
58   - });
59   -
60   - let sum = 0;
61   - for (let p of distinctMap.values()) {
62   - sum = FloatAdd(p, sum);
63   - }
64   -
65   - form.setFieldValue('money', sum);
66   - }
67   -
68   - return (
69   - <DrawerForm<{
70   - name: string;
71   - company: string;
72   - }>
73   - open
74   - title="财务信息"
75   - resize={{
76   - onResize() {
77   - console.log('resize!');
78   - },
79   - maxWidth: window.innerWidth * 0.8,
80   - minWidth: 400,
81   - }}
82   - initialValues={mainOrder}
83   - form={form}
84   - autoFocusFirstInput
85   - drawerProps={{
86   - destroyOnClose: true,
87   - }}
88   - submitTimeout={2000}
89   - onFinish={async (values) => {
90   - let res;
91   - let body = values;
92   - body.subIds = subIds;
93   - if (isEdit) {
94   - res = await postServiceOrderEditOrder({ data: body });
95   - } else {
96   - res = await postServiceOrderInvoicing({ data: body });
97   - }
98   - if (res.result === RESPONSE_CODE.SUCCESS) {
99   - message.success(res.message);
100   - onClose();
101   - }
102   - }}
103   - onOpenChange={(val) => {
104   - return !val && cancel();
105   - }}
106   - >
107   - {isMainOrder ? (
108   - <ProFormSelect
109   - placeholder="选择是否需要开票"
110   - name="invoicingStatus"
111   - width="lg"
112   - label="是否需要开票"
113   - options={enumToSelect(INVOCING_STATUS_OPTIONS_OLD)}
114   - onChange={setInvoicingStatus}
115   - initialValue={subOrders[0]?.invoicingStatus}
116   - // disabled={mainInfoDisbled}
117   - rules={[{ required: true, message: '是否需要开票必填' }]}
118   - />
119   - ) : (
120   - ''
121   - )}
122   -
123   - <ProFormTextArea
124   - width="lg"
125   - name="invoiceIdentificationNumber"
126   - label="开票信息"
127   - placeholder="请输入开票信息"
128   - disabled
129   - />
130   - <ProFormText
131   - width="lg"
132   - name="bank"
133   - label="开户银行"
134   - placeholder="请输入开户银行"
135   - disabled
136   - />
137   - <ProFormText
138   - width="lg"
139   - name="bankAccountNumber"
140   - label="开户银行账号"
141   - placeholder="请输入开户银行账号"
142   - disabled
143   - />
144   -
145   - {invoicingStatus !== 'UN_INVOICE'
146   - ? [
147   - <ProFormDatePicker
148   - key="invoicingTime"
149   - width="lg"
150   - name="invoicingTime"
151   - label="开票时间"
152   - disabled={isEdit}
153   - rules={[
154   - { required: !isEdit ? true : false, message: '这是必填项' },
155   - ]}
156   - initialValue={subOrders[0]?.invoicingTime}
157   - />,
158   - <ProFormText
159   - key="purchaser"
160   - width="lg"
161   - name="purchaser"
162   - label="抬头名称"
163   - disabled={isEdit}
164   - rules={[
165   - { required: !isEdit ? true : false, message: '这是必填项' },
166   - ]}
167   - initialValue={subOrders[0]?.purchaser}
168   - />,
169   - <ProFormDatePicker
170   - key="financialReceiptIssuanceTime"
171   - width="lg"
172   - name="financialReceiptIssuanceTime"
173   - label="开收据时间"
174   - initialValue={subOrders[0]?.financialReceiptIssuanceTime}
175   - />,
176   - <ProFormDatePicker
177   - key="collectMoneyTime"
178   - width="lg"
179   - name="collectMoneyTime"
180   - label="收款时间"
181   - initialValue={subOrders[0]?.collectMoneyTime}
182   - />,
183   - <ProFormText
184   - width="lg"
185   - key="invoiceNumber"
186   - name="invoiceNumber"
187   - label="发票号码"
188   - initialValue={subOrders[0]?.invoiceNumber}
189   - rules={[{ required: true, message: '发票号码必填' }]}
190   - />,
191   - <div
192   - key="salesChooseReceivingCompany"
193   - hidden={subOrders[0].receivingCompany === null}
194   - >
195   - <span className={'pl-2 text-xs text-gray-400'}>
196   - 销售申请开票时选择了:
197   - {enumValueToLabel(
198   - subOrders[0].receivingCompany,
199   - getReceivingCompanyOptions(PAYEE_OPTIONS),
200   - )}
201   - </span>
202   - <span
203   - hidden={subOrders[0].receivingCompany === 'ANY'}
204   - className={
205   - 'pl-2 text-xs text-[#1677ff] cursor-pointer hover:text-[#64abf7]'
206   - }
207   - onClick={() => {
208   - chooseReceivingCompany(subOrders[0].receivingCompany);
209   - }}
210   - >
211   - 选择
212   - </span>
213   - </div>,
214   - <ProFormSelect
215   - key="payee"
216   - placeholder="选择收款单位"
217   - name="payee"
218   - width="lg"
219   - showSearch
220   - label="收款单位"
221   - options={enumToSelect(PAYEE_OPTIONS)}
222   - initialValue={subOrders[0]?.payee}
223   - rules={[{ required: true, message: '收款单位必填' }]}
224   - />,
225   -
226   - <div id="total-payment" key="money">
227   - <ProFormDigit
228   - key="money"
229   - name="money"
230   - width="lg"
231   - label="金额"
232   - rules={[{ required: true, message: '金额必填' }]}
233   - tooltip="点击计算,合计所有子订单对应主订单总额"
234   - fieldProps={{
235   - addonAfter: (
236   - <Button
237   - className="rounded-l-none"
238   - type="primary"
239   - onClick={computeTotalPayment}
240   - >
241   - 计算
242   - </Button>
243   - ),
244   - }}
245   - />
246   - </div>,
247   - ]
248   - : ''}
249   -
250   - <ProFormSelect
251   - placeholder="是否完全开票"
252   - name="afterInvoicingStatus"
253   - width="lg"
254   - label="是否完全开票"
255   - options={[
256   - { label: '完全开票', value: 'COMPLETE_INVOICING' },
257   - { label: '部分开票', value: 'PARTIAL_INVOICING' },
258   - ]}
259   - // disabled={mainInfoDisbled}
260   - initialValue={
261   - subOrders[0]?.afterInvoicingStatus === 'APPLY_FOR_INVOICING'
262   - ? 'COMPLETE_INVOICING'
263   - : subOrders[0]?.afterInvoicingStatus
264   - }
265   - rules={[{ required: true, message: '是否完全开票必填' }]}
266   - />
267   - <ProFormTextArea
268   - width="lg"
269   - name="invoicingNotes"
270   - label="备注"
271   - initialValue={subOrders[0]?.invoicingNotes}
272   - />
273   - </DrawerForm>
274   - );
275   -};
src/pages/Order/WarningWhitelist/components/FinancialEditDrawer.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderNoNeedInvoicingEdit } from '@/services';
3   -import { enumToSelect } from '@/utils';
4   -import {
5   - DrawerForm,
6   - ProFormDatePicker,
7   - ProFormSelect,
8   - ProFormText,
9   -} from '@ant-design/pro-components';
10   -import { Form, message } from 'antd';
11   -import { useEffect, useState } from 'react';
12   -import { INVOCING_STATUS_OPTIONS_OLD } from '../../constant';
13   -
14   -export default ({ mainOrder, subOrders, setVisible, isMainOrder, onClose }) => {
15   - const [invoicingStatus, setInvoicingStatus] = useState('');
16   - useEffect(() => {
17   - setInvoicingStatus(subOrders[0]?.invoicingStatus);
18   - }, []);
19   - const subOrderIds = subOrders?.map((subOrder) => {
20   - return subOrder?.id;
21   - });
22   - const mainOrderId = mainOrder.id;
23   - const [form] = Form.useForm<{
24   - collectMoneyTime: string;
25   - subIds: [];
26   - financialReceiptIssuanceTime: string;
27   - }>();
28   -
29   - //回显开收据时间和收款时间
30   - if (!isMainOrder) {
31   - form.setFieldValue('collectMoneyTime', subOrders[0].collectMoneyTime);
32   - form.setFieldValue(
33   - 'financialReceiptIssuanceTime',
34   - subOrders[0].financialReceiptIssuanceTime,
35   - );
36   - }
37   -
38   - return (
39   - <DrawerForm<{
40   - collectMoneyTime: string;
41   - financialReceiptIssuanceTime: string;
42   - subIds: [];
43   - }>
44   - open
45   - title={isMainOrder ? '编辑开票信息' : '编辑收款时间'}
46   - resize={{
47   - onResize() {
48   - console.log('resize!');
49   - },
50   - maxWidth: window.innerWidth * 0.8,
51   - minWidth: 400,
52   - }}
53   - initialValues={mainOrder}
54   - form={form}
55   - autoFocusFirstInput
56   - drawerProps={{
57   - destroyOnClose: true,
58   - }}
59   - submitTimeout={2000}
60   - onFinish={async (values) => {
61   - let body = {
62   - ...values,
63   - mainOrderId: mainOrderId,
64   - subIds: subOrderIds,
65   - };
66   -
67   - if (!isMainOrder) {
68   - body.invoicingStatus = 'UN_INVOICE';
69   - }
70   -
71   - let res = await postServiceOrderNoNeedInvoicingEdit({
72   - data: body,
73   - });
74   - if (res.result === RESPONSE_CODE.SUCCESS) {
75   - message.success(res.message);
76   - onClose();
77   - }
78   - }}
79   - onOpenChange={(val) => {
80   - return !val && setVisible(val);
81   - }}
82   - >
83   - {isMainOrder ? (
84   - <ProFormSelect
85   - placeholder="选择是否需要开票"
86   - name="invoicingStatus"
87   - width="lg"
88   - label="是否需要开票"
89   - options={enumToSelect(INVOCING_STATUS_OPTIONS_OLD)}
90   - onChange={setInvoicingStatus}
91   - initialValue={subOrders[0]?.invoicingStatus}
92   - // disabled={mainInfoDisbled}
93   - rules={[{ required: true, message: '是否需要开票必填' }]}
94   - />
95   - ) : (
96   - ''
97   - )}
98   -
99   - {invoicingStatus !== 'UN_INVOICE' ? (
100   - <>
101   - <ProFormText
102   - key="invoiceIdentificationNumber"
103   - width="lg"
104   - name="invoiceIdentificationNumber"
105   - label="开票信息"
106   - placeholder="请输入开票信息"
107   - rules={[{ required: true, message: '开票信息必填' }]}
108   - />
109   - <ProFormText
110   - key="bank"
111   - width="lg"
112   - name="bank"
113   - label="开户银行"
114   - placeholder="请输入开户银行"
115   - />
116   - <ProFormText
117   - key="bankAccountNumber"
118   - width="lg"
119   - name="bankAccountNumber"
120   - label="开户银行账号"
121   - placeholder="请输入开户银行账号"
122   - />
123   - </>
124   - ) : (
125   - ''
126   - )}
127   -
128   - <ProFormDatePicker
129   - key="financialReceiptIssuanceTime"
130   - width="lg"
131   - name="financialReceiptIssuanceTime"
132   - label="开收据时间"
133   - // rules={[
134   - // {
135   - // required: !isMainOrder && invoicingStatus === 'UN_INVOICE',
136   - // message: '开收据时间必填',
137   - // },
138   - // ]}
139   - />
140   - <ProFormDatePicker
141   - key="collectMoneyTime"
142   - width="lg"
143   - name="collectMoneyTime"
144   - label="收款时间"
145   - // rules={[
146   - // {
147   - // required: !isMainOrder && invoicingStatus === 'UN_INVOICE',
148   - // message: '收款时间必填',
149   - // },
150   - // ]}
151   - />
152   - </DrawerForm>
153   - );
154   -};
src/pages/Order/WarningWhitelist/components/FinancialMergeDrawer.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { enumToSelect } from '@/utils';
3   -import {
4   - DrawerForm,
5   - ProFormDatePicker,
6   - ProFormDigit,
7   - ProFormSelect,
8   - ProFormText,
9   - ProFormTextArea,
10   -} from '@ant-design/pro-components';
11   -import { Form, message } from 'antd';
12   -import { PAYEE_OPTIONS } from '../../constant';
13   -
14   -export default ({ dataList, setVisible, onClose }) => {
15   - // let subOrderIds = dataList?.map((item) => {
16   - // return item.id;
17   - // });
18   - let firstMainOrder = dataList[0];
19   - let bank = firstMainOrder?.bank;
20   - let bankAccountNumber = firstMainOrder?.bankAccountNumber;
21   - let invoiceIdentificationNumber = firstMainOrder?.invoiceIdentificationNumber;
22   -
23   - const [form] = Form.useForm<{
24   - invoicingTime: string;
25   - financialReceiptIssuanceTime: string;
26   - invoicingNotes: string;
27   - afterInvoicingStatus: string;
28   - collectMoneyTime: string;
29   - }>();
30   - return (
31   - <DrawerForm
32   - open
33   - title="合并开票"
34   - resize={{
35   - onResize() {
36   - console.log('resize!');
37   - },
38   - maxWidth: window.innerWidth * 0.8,
39   - minWidth: 400,
40   - }}
41   - form={form}
42   - autoFocusFirstInput
43   - drawerProps={{
44   - destroyOnClose: true,
45   - }}
46   - submitTimeout={2000}
47   - onFinish={async (values) => {
48   - console.log(values);
49   - let res;
50   - let body = values;
51   - body.subIds = subIds;
52   - body.mainOrderId = mainOrder.id;
53   - body.mainorderOrSubOrderInvoicing = isMainOrder;
54   - if (isEdit) {
55   - res = await postServiceOrderEditOrder({ data: body });
56   - } else {
57   - res = await postServiceOrderInvoicing({ data: body });
58   - }
59   - if (res.result === RESPONSE_CODE.SUCCESS) {
60   - message.success(res.message);
61   - onClose();
62   - }
63   - }}
64   - onOpenChange={(val) => {
65   - return !val && setVisible();
66   - }}
67   - >
68   - <ProFormText
69   - width="lg"
70   - name="invoiceIdentificationNumber"
71   - label="开票信息"
72   - placeholder="请输入开票信息"
73   - initialValue={invoiceIdentificationNumber}
74   - disabled
75   - />
76   - <ProFormText
77   - width="lg"
78   - name="bank"
79   - label="开户银行"
80   - placeholder="请输入开户银行"
81   - initialValue={bank}
82   - disabled
83   - />
84   - <ProFormText
85   - width="lg"
86   - name="bankAccountNumber"
87   - label="开户银行账号"
88   - placeholder="请输入开户银行账号"
89   - initialValue={bankAccountNumber}
90   - disabled
91   - />
92   -
93   - <ProFormDatePicker
94   - key="invoicingTime"
95   - width="lg"
96   - name="invoicingTime"
97   - label="开票时间"
98   - rules={[{ required: true, message: '这是必填项' }]}
99   - />
100   - <ProFormDatePicker
101   - key="financialReceiptIssuanceTime"
102   - width="lg"
103   - name="financialReceiptIssuanceTime"
104   - label="开收据时间"
105   - />
106   - <ProFormDatePicker
107   - key="collectMoneyTime"
108   - width="lg"
109   - name="collectMoneyTime"
110   - label="收款时间"
111   - />
112   - <ProFormText
113   - width="lg"
114   - key="invoiceNumber"
115   - name="invoiceNumber"
116   - label="发票号码"
117   - rules={[{ required: true, message: '发票号码必填' }]}
118   - />
119   - <ProFormSelect
120   - key="payee"
121   - placeholder="选择收款单位"
122   - name="payee"
123   - width="lg"
124   - label="收款单位"
125   - options={enumToSelect(PAYEE_OPTIONS)}
126   - rules={[{ required: true, message: '收款单位必填' }]}
127   - />
128   -
129   - <ProFormDigit
130   - key="money"
131   - name="money"
132   - width="lg"
133   - label="金额"
134   - rules={[{ required: true, message: '金额必填' }]}
135   - />
136   - <ProFormSelect
137   - placeholder="是否完全开票"
138   - name="afterInvoicingStatus"
139   - width="lg"
140   - label="是否完全开票"
141   - options={[
142   - { label: '完全开票', value: 'COMPLETE_INVOICING' },
143   - { label: '部分开票', value: 'PARTIAL_INVOICING' },
144   - ]}
145   - initialValue={'COMPLETE_INVOICING'}
146   - />
147   - <ProFormTextArea width="lg" name="invoicingNotes" label="备注" />
148   - </DrawerForm>
149   - );
150   -};
src/pages/Order/WarningWhitelist/components/FinancialReceiptsModal.tsx deleted 100644 → 0
1   -import { postServiceOrderUpdateHirePurchase } from '@/services';
2   -import {
3   - EditableProTable,
4   - ModalForm,
5   - ProColumns,
6   - ProForm,
7   -} from '@ant-design/pro-components';
8   -import { Form } from 'antd';
9   -import { useState } from 'react';
10   -
11   -// import { cloneDeep } from 'lodash';
12   -export default ({ setVisible, datas, onClose }) => {
13   - const [form] = Form.useForm<{ name: string; company: string }>();
14   - type DataSourceType = {
15   - id: React.Key;
16   - hirePurchaseMethod?: string;
17   - hirePurchaseMethodName?: string;
18   - money?: number;
19   - updateTime?: string;
20   - notes?: string;
21   - };
22   - const defaultData: DataSourceType[] = [
23   - {
24   - id: 1,
25   - hirePurchaseMethod: 'ADVANCE_CHARGE',
26   - hirePurchaseMethodName: '预付款',
27   - money: undefined,
28   - updateTime: undefined,
29   - notes: undefined,
30   - },
31   - {
32   - id: 2,
33   - hirePurchaseMethod: 'PAYMENT_FOR_SHIPMENT',
34   - hirePurchaseMethodName: '发货款',
35   - money: undefined,
36   - updateTime: undefined,
37   - notes: undefined,
38   - },
39   - {
40   - id: 3,
41   - hirePurchaseMethod: 'ACCEPTANCE_PAYMENT',
42   - hirePurchaseMethodName: '验收款',
43   - money: undefined,
44   - updateTime: undefined,
45   - notes: undefined,
46   - },
47   - {
48   - id: 4,
49   - hirePurchaseMethod: 'BALANCE_PAYMENT',
50   - hirePurchaseMethodName: '尾款',
51   - money: undefined,
52   - updateTime: undefined,
53   - notes: undefined,
54   - },
55   - ];
56   - const [editableKeys, setEditableRowKeys] = useState<React.Key[]>(() =>
57   - // defaultData.map((item) => item.id),
58   - [1, 2, 3, 4],
59   - );
60   - const columns: ProColumns<DataSourceType>[] = [
61   - {
62   - title: '款项',
63   - dataIndex: 'hirePurchaseMethodName',
64   - editable: false,
65   - width: '10%',
66   - },
67   - {
68   - title: '已收金额',
69   - dataIndex: 'money',
70   - valueType: 'digit',
71   - width: '15%',
72   - },
73   - {
74   - title: '收款时间',
75   - dataIndex: 'updateTime',
76   - valueType: 'dateTime',
77   - width: '25%',
78   - },
79   - {
80   - title: '备注',
81   - dataIndex: 'receiptsNotes',
82   - },
83   - ];
84   - return (
85   - <>
86   - <ModalForm<{
87   - name: string;
88   - company: string;
89   - }>
90   - width={1100}
91   - open
92   - title="收款记录"
93   - form={form}
94   - autoFocusFirstInput
95   - modalProps={{
96   - okText: '保存',
97   - cancelText: '取消',
98   - destroyOnClose: true,
99   - onCancel: () => {
100   - setVisible(false);
101   - },
102   - }}
103   - onFinish={async (values) => {
104   - let res = await postServiceOrderUpdateHirePurchase({
105   - data: {
106   - mainOrderId: datas[0].id,
107   - list: values.dataSource,
108   - },
109   - });
110   - console.log(res);
111   - onClose();
112   - }}
113   - onOpenChange={setVisible}
114   - >
115   - <ProForm.Item
116   - label=""
117   - name="dataSource"
118   - initialValue={defaultData}
119   - trigger="onValuesChange"
120   - >
121   - <EditableProTable<DataSourceType>
122   - rowKey="id"
123   - toolBarRender={false}
124   - columns={columns}
125   - recordCreatorProps={{
126   - newRecordType: 'dataSource',
127   - position: 'top',
128   - record: () => ({
129   - id: Date.now(),
130   - addonBefore: 'ccccccc',
131   - decs: 'testdesc',
132   - }),
133   - style: {
134   - display: 'none',
135   - },
136   - }}
137   - editable={{
138   - type: 'multiple',
139   - editableKeys,
140   - onChange: setEditableRowKeys,
141   - actionRender: (row, _, dom) => {
142   - return [dom.delete];
143   - },
144   - }}
145   - />
146   - </ProForm.Item>
147   -
148   - {/* <ProForm.Group>
149   - <ProFormText
150   - width="sm"
151   - name="name1"
152   - label="款项"
153   - tooltip="最长为 24 位"
154   - initialValue={"预付款"}
155   - disabled
156   - placeholder="请输入名称"
157   - />
158   -
159   - <ProFormText
160   - width="sm"
161   - name="company"
162   - label="收款时间"
163   - placeholder="请输入名称"
164   - />
165   -
166   - <ProFormText
167   - width="sm"
168   - name="price"
169   - label="收款金额"
170   - placeholder="请输入名称"
171   - />
172   -
173   - <ProFormText
174   - width="sm"
175   - name="notes"
176   - label="备注"
177   - placeholder="请输入名称"
178   - />
179   - </ProForm.Group>
180   -
181   - <ProForm.Group>
182   - <ProFormText
183   - width="sm"
184   - name="name2"
185   - initialValue={"发货款"}
186   - disabled
187   - tooltip="最长为 24 位"
188   - placeholder="请输入名称"
189   - />
190   -
191   - <ProFormText
192   - width="sm"
193   - name="company"
194   - placeholder="请输入名称"
195   - />
196   -
197   - <ProFormText
198   - width="sm"
199   - name="price"
200   - placeholder="请输入名称"
201   - />
202   -
203   - <ProFormText
204   - width="sm"
205   - name="notes"
206   - placeholder="请输入名称"
207   - />
208   - </ProForm.Group>
209   -
210   - <ProForm.Group>
211   - <ProFormText
212   - width="sm"
213   - name="name3"
214   - initialValue={"验收款"}
215   - disabled
216   - tooltip="最长为 24 位"
217   - placeholder="请输入名称"
218   - />
219   -
220   - <ProFormText
221   - width="sm"
222   - name="company"
223   - placeholder="请输入名称"
224   - />
225   -
226   - <ProFormText
227   - width="sm"
228   - name="price"
229   - placeholder="请输入名称"
230   - />
231   -
232   - <ProFormText
233   - width="sm"
234   - name="notes"
235   - placeholder="请输入名称"
236   - />
237   - </ProForm.Group>
238   -
239   - <ProForm.Group>
240   - <ProFormText
241   - width="sm"
242   - name="name4"
243   - disabled
244   - initialValue={"尾款"}
245   - tooltip="最长为 24 位"
246   - placeholder="请输入名称"
247   - />
248   -
249   - <ProFormText
250   - width="sm"
251   - name="company"
252   - placeholder="请输入名称"
253   - />
254   -
255   - <ProFormText
256   - width="sm"
257   - name="price"
258   - placeholder="请输入名称"
259   - />
260   -
261   - <ProFormText
262   - width="sm"
263   - name="notes"
264   - placeholder="请输入名称"
265   - />
266   - </ProForm.Group> */}
267   - </ModalForm>
268   - </>
269   - );
270   -};
src/pages/Order/WarningWhitelist/components/HistoryModal.tsx deleted 100644 → 0
1   -import { postServiceOrderQueryHistoryOrderRecord } from '@/services';
2   -import { formatDateTime } from '@/utils';
3   -import { Button, Col, Empty, Flex, Modal, Row, Spin } from 'antd';
4   -import { useEffect, useState } from 'react';
5   -
6   -export default ({ subOrders, isCancelledOrder, onClose }) => {
7   - let subOrderIds = subOrders?.map((subOrder: any) => {
8   - return subOrder.id;
9   - });
10   -
11   - const [data, setData] = useState([]);
12   - const [loading, setLoading] = useState(true);
13   - let i = 0;
14   -
15   - const handleOk = () => {
16   - onClose();
17   - };
18   -
19   - /**
20   - * 获取历史记录
21   - */
22   - const getHistory = async () => {
23   - let res = await postServiceOrderQueryHistoryOrderRecord({
24   - data: { ids: subOrderIds, isDeleteQueryOrder: isCancelledOrder },
25   - });
26   - setData(res.data);
27   - setLoading(false);
28   - };
29   -
30   - const getRecord = (history: any) => {
31   - let record = [];
32   - record.push(
33   - <span className="pr-2 text-[#5E5E5E]">
34   - {formatDateTime(history.createTime)}
35   - </span>,
36   - );
37   -
38   - record.push(<span className="text-[#3b83e5]">{history.createByName}</span>);
39   -
40   - record.push(<span>进行了</span>);
41   -
42   - // let label = enumValueToLabel(history.status, ORDER_STATUS_OPTIONS);
43   -
44   - // if (
45   - // history.record !== 'INVOICING' && history.record !== 'order-change-normal' && history.record !== 'order-change-normal-CHECK' &&
46   - // history.record?.indexOf(':') === -1 &&
47   - // label !== undefined &&
48   - // label !== ''
49   - // ) {
50   - // record.push(
51   - // <>
52   - // <span>,订单状态为:</span>
53   - // <span className="text-[#3b83e5]">{label}</span>
54   - // </>,
55   - // );
56   - // }
57   -
58   - if (history.record?.indexOf(':') !== -1) {
59   - let values = history.record?.split(':');
60   - let type = values[0];
61   - let target = values[1];
62   - if (target === 'null') {
63   - target = '未指定';
64   - }
65   - //采购转发
66   - if (type === 'PROCURE_CONVERT_PROCURE') {
67   - record.push(
68   - <>
69   - <span>采购转发,{history.createByName}将订单转发给了</span>
70   - <span className="text-[#3b83e5]">{target}</span>
71   - </>,
72   - );
73   - }
74   - } else {
75   - record.push(
76   - <span className="text-[#3b83e5]">
77   - {history.recordText +
78   - (history.record === 'INVOICING'
79   - ? '(开票号码:' + history.invoiceNumber + ')'
80   - : '')}
81   - </span>,
82   - );
83   - }
84   -
85   - if (history.notes !== null) {
86   - record.push(<span className="pl-1">{'备注:' + history.notes}</span>);
87   - }
88   -
89   - if (history.description !== null) {
90   - record.push(
91   - <span className="pl-1">{'描述:' + history.description}</span>,
92   - );
93   - }
94   -
95   - return record;
96   - };
97   -
98   - useEffect(() => {
99   - getHistory();
100   - }, []);
101   -
102   - const handleCancel = () => {
103   - onClose();
104   - };
105   -
106   - return (
107   - <>
108   - <Modal
109   - title="订单历史记录"
110   - open
111   - width={650}
112   - onOk={handleOk}
113   - onCancel={handleCancel}
114   - footer={() => (
115   - <>
116   - <Button onClick={handleCancel}>返回</Button>
117   - </>
118   - )}
119   - >
120   - <Spin tip="加载中" spinning={loading}>
121   - <Row className="max-h-[500px] overflow-auto" gutter={[0, 14]}>
122   - {data.map((item) => {
123   - return (
124   - <Col span={24} key={i}>
125   - <Flex vertical>
126   - <div>
127   - <span className="py-2 text-[#5E5E5E]">
128   - {'商品' + ++i}
129   - </span>
130   - <span className="text-[#8C8C8C]">
131   - -【{item.productName}】
132   - </span>
133   - </div>
134   -
135   - <Flex vertical>
136   - {item.historySubOrderRecordDto?.map((history) => {
137   - return (
138   - <div className="py-1" key={history.id}>
139   - {getRecord(history)}
140   - </div>
141   - );
142   - })}
143   - </Flex>
144   - </Flex>
145   - </Col>
146   - );
147   - })}
148   - </Row>
149   - {data?.length <= 0 ? (
150   - <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
151   - ) : (
152   - ''
153   - )}
154   - </Spin>
155   - </Modal>
156   - </>
157   - );
158   -};
src/pages/Order/WarningWhitelist/components/ImagesViewerModal.tsx deleted 100644 → 0
1   -import { postServiceOrderViewImages } from '@/services';
2   -import { Button, Divider, Image, Modal } from 'antd';
3   -import { useEffect, useState } from 'react';
4   -export default ({ setVisible, optType, onClose, orderRow }) => {
5   - const [images, setImages] = useState<any[]>([]);
6   - const [title, setTitle] = useState("收货凭证");
7   - const handleOk = () => {
8   - onClose();
9   - setVisible(false);
10   - };
11   -
12   - const handleCancel = () => {
13   - onClose();
14   - setVisible(false);
15   - };
16   -
17   - async function getImages() {
18   - const res = await postServiceOrderViewImages({
19   - data: { subId: orderRow.id },
20   - });
21   - const images = res.data;
22   - setImages(images);
23   - }
24   - useEffect(() => {
25   - if (optType === 'shippingReceipt') {
26   - setTitle("收货凭证");
27   - getImages();
28   - } else if (optType === 'paymentReceipt') {
29   - let paymentReceiptsImagesList: any[] = [];
30   - if (orderRow.paymentReceiptAnnexList) {
31   - paymentReceiptsImagesList.push(...orderRow.paymentReceiptAnnexList);
32   - }
33   - //去重
34   - paymentReceiptsImagesList = [...new Set(paymentReceiptsImagesList)];
35   - setImages(paymentReceiptsImagesList);
36   - }
37   -
38   - }, []);
39   -
40   - return (
41   - <>
42   - <Modal
43   - title={title}
44   - open
45   - onOk={handleOk}
46   - onCancel={handleCancel}
47   - footer={[
48   - <Button key="back" onClick={handleCancel}>
49   - 返回
50   - </Button>,
51   - ]}
52   - >
53   - <Image.PreviewGroup
54   - className="mr-10"
55   - preview={{
56   - onChange: (current, prev) =>
57   - console.log(`current index: ${current}, prev index: ${prev}`),
58   - }}
59   - >
60   - {images.map((url) => (
61   - <>
62   - <Image width={120} src={url} /> <Divider type="vertical" />
63   - </>
64   - ))}
65   - </Image.PreviewGroup>
66   - </Modal>
67   - </>
68   - );
69   -};
src/pages/Order/WarningWhitelist/components/ImportExpressBillModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postOrderImportImportWeightAndVolume } from '@/services';
3   -import { ModalForm, ProFormUploadDragger } from '@ant-design/pro-components';
4   -import { Button, Form, message } from 'antd';
5   -
6   -export default () => {
7   - const [form] = Form.useForm();
8   - const [messageApi, contextHolder] = message.useMessage();
9   - return (
10   - <>
11   - <ModalForm
12   - title="导入重量、体积"
13   - trigger={<Button type="primary">导入重量、体积</Button>}
14   - form={form}
15   - autoFocusFirstInput
16   - modalProps={{
17   - destroyOnClose: true,
18   - }}
19   - submitTimeout={2000}
20   - onFinish={async (values) => {
21   - console.log(values);
22   - const formData = new FormData();
23   - formData.append('file', values.express[0].originFileObj);
24   - messageApi.open({
25   - type: 'loading',
26   - content: '正在导入...',
27   - duration: 0,
28   - });
29   - const res = await postOrderImportImportWeightAndVolume({
30   - data: formData,
31   - headers: {
32   - 'Content-Type':
33   - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
34   - },
35   - });
36   - if (res.result === RESPONSE_CODE.SUCCESS) {
37   - message.error('导入成功');
38   - } else {
39   - message.error('导入失败');
40   - }
41   - messageApi.destroy();
42   - return true;
43   - }}
44   - >
45   - <ProFormUploadDragger max={1} label="上传快递单" name="express" />
46   - </ModalForm>
47   - {contextHolder}
48   - </>
49   - );
50   -};
src/pages/Order/WarningWhitelist/components/ImportModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderImportExcel } from '@/services';
3   -import { orderExport } from '@/services/order';
4   -import { UploadOutlined } from '@ant-design/icons';
5   -import { Button, Modal, Upload, message } from 'antd';
6   -import { RcFile, UploadFile, UploadProps } from 'antd/es/upload';
7   -import { useState } from 'react';
8   -export default ({ onClose }) => {
9   - // const [form] = Form.useForm<{ name: string; company: string }>();
10   - const [messageApi, contextHolder] = message.useMessage();
11   - const [fileList, setFileList] = useState<UploadFile[]>([]);
12   - const [uploading, setUploading] = useState(false);
13   - const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) =>
14   - setFileList(newFileList);
15   -
16   - const exportLoading = (content: string) => {
17   - messageApi.open({
18   - type: 'loading',
19   - content: content,
20   - duration: 0,
21   - });
22   - };
23   -
24   - const exportLoadingDestory = () => {
25   - messageApi.destroy();
26   - };
27   - const downloadTemplate = async () => {
28   - exportLoading('正在下载模板...');
29   - orderExport(
30   - '/api/service/order/exportTemplate',
31   - '订单.xlsx',
32   - 'post',
33   - {},
34   - exportLoadingDestory,
35   - );
36   - };
37   -
38   - const handleUpload = async () => {
39   - const formData = new FormData();
40   - fileList.forEach((file) => {
41   - //originFileObj二进制文件
42   - formData.append('file', file.originFileObj as RcFile);
43   - });
44   - // console.log(fileList[0] as RcFile)
45   - // formData.append('file', fileList[0] as RcFile);
46   - setUploading(true);
47   - // You can use any AJAX library you like
48   - const res = await postServiceOrderImportExcel({
49   - data: formData,
50   - headers: {
51   - 'Content-Type':
52   - 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq',
53   - },
54   - });
55   -
56   - if (res.result === RESPONSE_CODE.SUCCESS) {
57   - message.success(res.message);
58   - onClose();
59   - } else {
60   - if (res.message === '表格中没有数据') {
61   - setUploading(false);
62   - return;
63   - }
64   - //存在错误信息,下载错误信息模板
65   - exportLoading('正在下载错误信息...');
66   - orderExport(
67   - '/api/service/order/errorExcelInformation',
68   - '订单.xlsx',
69   - 'post',
70   - formData,
71   - exportLoadingDestory,
72   - );
73   - }
74   -
75   - setUploading(false);
76   - };
77   -
78   - const props: UploadProps = {
79   - onRemove: (file) => {
80   - const index = fileList.indexOf(file);
81   - const newFileList = fileList.slice();
82   - newFileList.splice(index, 1);
83   - setFileList(newFileList);
84   - },
85   - beforeUpload: (file) => {
86   - setFileList([...fileList, file]);
87   -
88   - return false;
89   - },
90   - fileList,
91   - onChange: handleChange,
92   - accept: '.xlsx',
93   - };
94   -
95   - return (
96   - <>
97   - <Modal
98   - width={500}
99   - open
100   - title="批量发货"
101   - footer={[
102   - <Button key="cancel" onClick={onClose}>
103   - 取消
104   - </Button>,
105   - <Button
106   - type="primary"
107   - key="ok"
108   - onClick={handleUpload}
109   - disabled={fileList.length === 0}
110   - loading={uploading}
111   - >
112   - {uploading ? '上传中' : '提交'}
113   - </Button>,
114   - ]}
115   - onCancel={async () => {
116   - onClose();
117   - }}
118   - >
119   - <div className="py-4 font-semibold">
120   - 导入发货信息
121   - <Button type="link" onClick={downloadTemplate}>
122   - 下载模板
123   - </Button>
124   - </div>
125   - <Upload {...props}>
126   - <Button icon={<UploadOutlined />} disabled={fileList.length > 0}>
127   - 点击选择文件
128   - </Button>
129   - </Upload>
130   - </Modal>
131   - {contextHolder}
132   - </>
133   - );
134   -};
src/pages/Order/WarningWhitelist/components/InvoiceSubOrderInfoTable.tsx deleted 100644 → 0
1   -import { postServiceOrderGetReissueInfo } from '@/services';
2   -import type { ProColumns } from '@ant-design/pro-components';
3   -import { ProTable } from '@ant-design/pro-components';
4   -import { Button, Divider } from 'antd';
5   -import { useEffect, useState } from 'react';
6   -
7   -const columns: ProColumns[] = [
8   - {
9   - title: '发票号码',
10   - width: 80,
11   - dataIndex: 'invoiceNumber',
12   - render: (_) => _,
13   - },
14   - {
15   - title: '关联订单',
16   - dataIndex: 'subOrderIds',
17   - render: (_, { subOrderIds }) => {
18   - console.log(JSON.stringify(_));
19   - console.log(JSON.stringify(subOrderIds));
20   - return (
21   - <>
22   - {subOrderIds.map((subOrderId, index) => {
23   - return (
24   - <>
25   - <Button
26   - key={index}
27   - className="pl-1 pr-0"
28   - type="link"
29   - target="_blank"
30   - href={'/order?id=' + subOrderId}
31   - >
32   - {subOrderId}
33   - </Button>
34   - <Divider type="vertical" />
35   - </>
36   - );
37   - })}
38   - </>
39   - );
40   - },
41   - },
42   -];
43   -
44   -export default ({ subOrderIds }) => {
45   - const [reissueInfos, setReissueInfos] = useState([]);
46   - useEffect(() => {
47   - console.log('info');
48   - const getReissueInfo = async () => {
49   - let res = await postServiceOrderGetReissueInfo({
50   - data: subOrderIds,
51   - });
52   - setReissueInfos(res.data);
53   - };
54   - getReissueInfo();
55   - }, []);
56   - return (
57   - <ProTable
58   - dataSource={reissueInfos}
59   - rowKey="key"
60   - pagination={false}
61   - size={'small'}
62   - //设置左右下边距为0
63   - options={false}
64   - columns={columns}
65   - search={false}
66   - dateFormatter="string"
67   - headerTitle="发票信息"
68   - />
69   - );
70   -};
src/pages/Order/WarningWhitelist/components/InvoicingDrawerForm.tsx deleted 100644 → 0
1   -// import { PlusOutlined } from '@ant-design/icons';
2   -import InvoiceModal from '@/pages/Invoice/InvoiceVerification/components/InvoiceModal';
3   -import {
4   - postServiceConstGetPayeeEnum,
5   - postServiceConstInitInvoiceDetailNames,
6   - postServiceConstInvoiceType,
7   - postServiceConstInvoicingType,
8   - postServiceConstListInvoiceDetailNames,
9   - postServiceInvoiceApplyInvoice,
10   - postServiceInvoiceQueryCompanyInfo,
11   - postServiceInvoiceWaitReissueInvoices,
12   -} from '@/services';
13   -import { FloatAdd, FloatSub, enum2ReverseSelect, enumToSelect } from '@/utils';
14   -import { convertCurrency } from '@/utils/numberUtil';
15   -import {
16   - DrawerForm,
17   - FormListActionType,
18   - ProCard,
19   - ProFormDigit,
20   - ProFormGroup,
21   - ProFormInstance,
22   - ProFormList,
23   - ProFormMoney,
24   - ProFormSelect,
25   - ProFormText,
26   - ProFormTextArea,
27   -} from '@ant-design/pro-components';
28   -import { Button, Divider, Form, Space, Tooltip, message } from 'antd';
29   -import { useEffect, useRef, useState } from 'react';
30   -
31   -export default ({ dataList, setVisible, mainOrder, onClose }) => {
32   - // let subOrderIds = dataList?.map((item) => {
33   - // return item.id;
34   - // })
35   - const [form] = Form.useForm();
36   - const [projectOptions] = useState();
37   - const [dataListCopy] = useState(dataList);
38   - const listActionRef = useRef<FormListActionType>();
39   - const formRef = useRef<ProFormInstance>();
40   - useEffect(() => {
41   - const initOptions = async () => {
42   - const res = await postServiceConstInitInvoiceDetailNames({
43   - data: dataListCopy.map((item) => {
44   - return item.productName;
45   - }),
46   - });
47   - const options = res.data;
48   - const datas = dataListCopy.map((item) => {
49   - return {
50   - ...item,
51   - projectName: options[item.productName],
52   - };
53   - });
54   - const initialValue = datas.map((item) => {
55   - return {
56   - productName: item.productName,
57   - projectName: item.projectName,
58   - subOrderId: item.id,
59   - specification: item.parameters,
60   - unit: item.unit,
61   - quantity: item.quantity,
62   - price: item.productPrice,
63   - totalPrice: item.subOrderPayment,
64   - };
65   - });
66   - form.setFieldValue('invoiceDetails', initialValue);
67   - form.setFieldValue('contacts', mainOrder.customerName);
68   - };
69   - initOptions();
70   - }, []);
71   -
72   - useEffect(() => {}, [projectOptions]);
73   -
74   - function copyToClipboard(text: string) {
75   - // 创建一个临时的textarea元素
76   - const textarea = document.createElement('textarea');
77   - textarea.value = text;
78   -
79   - // 将textarea元素添加到DOM中
80   - document.body.appendChild(textarea);
81   -
82   - // 选中textarea中的文本
83   - textarea.select();
84   -
85   - try {
86   - // 尝试执行复制命令
87   - document.execCommand('copy');
88   - return true;
89   - } catch (err) {
90   - return false;
91   - } finally {
92   - // 移除临时的textarea元素
93   - document.body.removeChild(textarea);
94   - }
95   - }
96   -
97   - useEffect(() => {}, []);
98   - return (
99   - <DrawerForm
100   - open
101   - title="申请开票"
102   - resize={{
103   - maxWidth: window.innerWidth * 0.8,
104   - minWidth: 500,
105   - }}
106   - form={form}
107   - formRef={formRef}
108   - autoFocusFirstInput
109   - drawerProps={{
110   - destroyOnClose: true,
111   - }}
112   - submitter={{
113   - render: (props, defaultDoms) => {
114   - return [
115   - <InvoiceModal
116   - key={'invoicePreview'}
117   - button={<Button type="primary"> 发票预览 </Button>}
118   - getRecord={() => {
119   - const totalPrice = form
120   - .getFieldValue('invoiceDetails')
121   - .reduce((accumulator, currentValue) => {
122   - return FloatAdd(accumulator, currentValue.totalPrice);
123   - }, 0);
124   - const partyBName = form.getFieldValue('partyBName');
125   - const openBank = form.getFieldValue('openBank');
126   - const bankAccount = form.getFieldValue('bankAccount');
127   - const bankCode = form.getFieldValue('bankCode');
128   - return {
129   - ...form.getFieldsValue(),
130   - totalPrice: totalPrice,
131   - totalPriceText: convertCurrency(totalPrice),
132   - comment:
133   - '开户名称: ' +
134   - partyBName +
135   - '\n' +
136   - '开户行: ' +
137   - openBank +
138   - '\n' +
139   - '账号: ' +
140   - bankAccount +
141   - '\n' +
142   - '银行联行号: ' +
143   - bankCode,
144   - };
145   - }}
146   - />,
147   - ...defaultDoms,
148   - ];
149   - },
150   - }}
151   - submitTimeout={2000}
152   - onFinish={async (values) => {
153   - postServiceInvoiceApplyInvoice({
154   - data: {
155   - ...values,
156   - subOrderIds: dataListCopy.map((item) => {
157   - return item.id;
158   - }),
159   - },
160   - });
161   - onClose();
162   - }}
163   - onOpenChange={(val) => {
164   - return !val && setVisible();
165   - }}
166   - >
167   - <ProFormList
168   - name="subOrderIdObjs"
169   - readonly={true}
170   - label="开票订单"
171   - initialValue={dataListCopy.map((item) => {
172   - return {
173   - value: item.id,
174   - };
175   - })}
176   - deleteIconProps={false}
177   - copyIconProps={false}
178   - >
179   - <ProFormGroup key="group">
180   - <ProFormText readonly={true} name="value" label="" />
181   - </ProFormGroup>
182   - </ProFormList>
183   - <ProFormSelect
184   - name="ReissueInvoiceRecordIds"
185   - label="重开的发票"
186   - fieldProps={{
187   - mode: 'multiple',
188   - }}
189   - placeholder="请选择重开发票"
190   - request={async () => {
191   - let reissueIds = dataListCopy.map((item) => {
192   - return item.id;
193   - });
194   - let res = await postServiceInvoiceWaitReissueInvoices({
195   - data: reissueIds,
196   - });
197   - return enum2ReverseSelect(res.data);
198   - }}
199   - />
200   - <ProFormSelect
201   - key="key"
202   - label="购方名称"
203   - width="lg"
204   - showSearch
205   - name="partyAName"
206   - placeholder="请搜索购方"
207   - rules={[{ required: true, message: '购方名称必填' }]}
208   - onChange={(_, option) => {
209   - form.setFieldValue('partyATaxid', option.taxId);
210   - }}
211   - fieldProps={{
212   - optionItemRender(item) {
213   - if (item.type === 'add') {
214   - return <>{item.name}</>;
215   - }
216   - return (
217   - <>
218   - {item.name}
219   - <Divider type="vertical" />
220   - {item.taxId}
221   - </>
222   - );
223   - },
224   - }}
225   - debounceTime={1000}
226   - request={async (value) => {
227   - const keywords = value.keyWords;
228   - const res = await postServiceInvoiceQueryCompanyInfo({
229   - data: {
230   - nameLike: keywords,
231   - taxIdIsNotNull: true,
232   - },
233   - });
234   - let options = res?.data?.map((company) => {
235   - return {
236   - ...company,
237   - label: company.name,
238   - value: company.name,
239   - key: company.id,
240   - };
241   - });
242   -
243   - //第一个商品默认为要新增的商品
244   - if (keywords.trim() !== '') {
245   - options.unshift({
246   - name: keywords,
247   - type: 'add',
248   - label: keywords,
249   - value: keywords,
250   - key: keywords,
251   - });
252   - }
253   - return options;
254   - }}
255   - />
256   - <ProFormText
257   - width="md"
258   - name="partyATaxid"
259   - label="购方税号"
260   - rules={[{ required: true, message: '购方税号必填' }]}
261   - placeholder="请输入名称"
262   - />
263   - <ProFormText
264   - width="md"
265   - name="partyAOpenBank"
266   - label="开户银行"
267   - placeholder="请输入名称"
268   - />
269   - <ProFormText
270   - width="md"
271   - name="partyABankAccount"
272   - label="开户行账号"
273   - placeholder="请输入名称"
274   - />
275   - <ProFormText
276   - name="contacts"
277   - label="联系人"
278   - rules={[{ required: true, message: '请选择银行联行号!' }]}
279   - />
280   - <ProFormSelect
281   - name="invoicingType"
282   - label="开具类型"
283   - request={async () => {
284   - let invoicingTypeRet = await postServiceConstInvoicingType();
285   - let options = enumToSelect(invoicingTypeRet.data);
286   - return options;
287   - }}
288   - placeholder="请选择开具类型"
289   - rules={[{ required: true, message: '请选择开具类型!' }]}
290   - />
291   - <ProFormSelect
292   - name="type"
293   - label="开票类型"
294   - placeholder="请选择开票类型"
295   - rules={[{ required: true, message: '请选择开票类型!' }]}
296   - request={async () => {
297   - let invoiceTypeRet = await postServiceConstInvoiceType();
298   - let options = enumToSelect(invoiceTypeRet.data);
299   - return options;
300   - }}
301   - />
302   - <ProFormSelect
303   - name="partyB"
304   - label="开票收款单位"
305   - request={async () => {
306   - const res = await postServiceConstGetPayeeEnum();
307   - let options = res?.data?.map((payee: any) => {
308   - return {
309   - ...payee,
310   - label: payee.payeeName,
311   - value: payee.name,
312   - };
313   - });
314   - return options;
315   - }}
316   - onChange={(_, option) => {
317   - if (option) {
318   - form.setFieldsValue({
319   - partyBName: option.payeeName,
320   - partyBTaxid: option.taxId,
321   - bankAccount: option.bankAccount,
322   - openBank: option.openBank,
323   - bankCode: option.bankCode,
324   - });
325   - }
326   - }}
327   - placeholder="请选择收款单位"
328   - rules={[{ required: true, message: '请选择收款单位!' }]}
329   - />
330   - <ProFormText
331   - name="partyBName"
332   - label="开票收款单位名称"
333   - hidden
334   - rules={[{ required: true, message: '请选择收款单位!' }]}
335   - />
336   - <ProFormText
337   - name="partyBTaxid"
338   - label="开票收款单位税号"
339   - hidden
340   - rules={[{ required: true, message: '请选择收款单位!' }]}
341   - />
342   - <ProFormText
343   - name="bankAccount"
344   - label="账号"
345   - hidden
346   - rules={[{ required: true, message: '请选择账号!' }]}
347   - />
348   - <ProFormText
349   - name="openBank"
350   - label="开户行"
351   - hidden
352   - rules={[{ required: true, message: '请选择开户行!' }]}
353   - />
354   - <ProFormText
355   - name="bankCode"
356   - label="银行联行号"
357   - hidden
358   - rules={[{ required: true, message: '请选择银行联行号!' }]}
359   - />
360   - <ProFormSelect
361   - name="isUrgent"
362   - label="是否加急"
363   - valueEnum={{
364   - true: '是',
365   - false: '否',
366   - }}
367   - placeholder="请选择是否加急"
368   - rules={[{ required: true, message: '请选择是否加急!' }]}
369   - />
370   - <ProFormMoney
371   - label="开票金额"
372   - name="price"
373   - locale="zh-CN"
374   - disabled={true}
375   - rules={[{ required: true, message: '请填写开票金额!' }]}
376   - initialValue={dataListCopy.reduce((accumulator, currentValue) => {
377   - return accumulator + currentValue.subOrderPayment;
378   - }, 0)}
379   - />
380   - <ProFormList
381   - name="invoiceDetails"
382   - label="开票明细"
383   - actionRef={listActionRef}
384   - actionGuard={{
385   - beforeRemoveRow: async (index) => {
386   - const list = listActionRef.current?.getList();
387   - const totalPrice = list[index].totalPrice;
388   - form.setFieldValue(
389   - 'price',
390   - FloatSub(form.getFieldValue('price'), totalPrice),
391   - );
392   - return true;
393   - },
394   - }}
395   - rules={[
396   - {
397   - required: true,
398   - validator: async (_, value) => {
399   - if (value && value.length > 0) {
400   - return;
401   - }
402   - throw new Error('至少要有一项!');
403   - },
404   - },
405   - ]}
406   - itemRender={(doms, listMeta) => {
407   - return (
408   - <ProCard
409   - bordered
410   - extra={doms.action}
411   - title={'明细' + (listMeta.index + 1)}
412   - style={{
413   - marginBlockEnd: 8,
414   - }}
415   - >
416   - <Tooltip title="点击复制商品名称">
417   - <Space
418   - className="hover:cursor-pointer"
419   - style={{
420   - margin: 16,
421   - marginTop: 4,
422   - marginLeft: 0,
423   - fontSize: 15,
424   - }}
425   - onClick={() => {
426   - copyToClipboard(listMeta.record.productName);
427   - message.info('商品名称复制成功!');
428   - }}
429   - >
430   - 商品名称:{listMeta.record.productName}
431   - </Space>
432   - </Tooltip>
433   - <ProFormSelect
434   - key={'projectName' + listMeta.index}
435   - width="md"
436   - showSearch
437   - name="projectName"
438   - rules={[{ required: true, message: '请输入开票项目名称!' }]}
439   - request={async (value) => {
440   - const keywords = value.keyWords;
441   - const res = await postServiceConstListInvoiceDetailNames({
442   - data: {
443   - nameLike: keywords,
444   - },
445   - });
446   - let options = res?.data?.map((c: any) => {
447   - return {
448   - ...c,
449   - label:
450   - '*' +
451   - c.productAndServiceCatagoryAbbreviation +
452   - '*' +
453   - c.name,
454   - value:
455   - '*' +
456   - c.productAndServiceCatagoryAbbreviation +
457   - '*' +
458   - c?.name,
459   - key: c.id,
460   - };
461   - });
462   - return options;
463   - }}
464   - fieldProps={{
465   - filterOption() {
466   - return true;
467   - },
468   - }}
469   - onChange={(_, option) => {
470   - let index = listMeta.index;
471   - let copyList = form.getFieldValue('invoiceDetails');
472   - let currentData = copyList[index];
473   - currentData.projectName =
474   - '*' +
475   - option.productAndServiceCatagoryAbbreviation +
476   - '*' +
477   - option.name;
478   - form.setFieldValue('invoiceDetails', copyList);
479   - }}
480   - debounceTime={1000}
481   - label="项目名称"
482   - initialValue={listMeta.record.projectName}
483   - placeholder="请输入名称"
484   - />
485   - <ProFormText
486   - key={'specification' + listMeta.index}
487   - name="specification"
488   - label="规格型号"
489   - rules={[
490   - {
491   - message: '规格型号不能为空!',
492   - required: true,
493   - },
494   - {
495   - validator: (_, value) => {
496   - let len = 0;
497   - // 判断是否为全角字符
498   - for (let i = 0; i < value.length; i++) {
499   - // 获取字符的Unicode值
500   - const code = value.charCodeAt(i);
501   - // 判断是否为全角字符
502   - if (
503   - (code >= 0xff01 && code <= 0xff5e) ||
504   - (code >= 0x4e00 && code <= 0x9fff)
505   - ) {
506   - len += 2; // 全角字符
507   - } else {
508   - len += 1; // 半角字符
509   - }
510   - }
511   - if (len <= 40) {
512   - return Promise.resolve();
513   - }
514   - return Promise.reject(
515   - new Error('规格型号不能超过40个字符!'),
516   - );
517   - },
518   - },
519   - ]}
520   - placeholder="请输入名称"
521   - />
522   - <ProFormText
523   - key={'unit' + listMeta.index}
524   - name="unit"
525   - label="单位"
526   - placeholder="请输入名称"
527   - />
528   - <ProFormDigit
529   - key={'quantity' + listMeta.index}
530   - label="数量"
531   - name="quantity"
532   - rules={[
533   - {
534   - validator: (_, value) => {
535   - if (value === undefined || value > 0) {
536   - return Promise.resolve();
537   - }
538   - return Promise.reject(new Error('数量必须大于0'));
539   - },
540   - },
541   - ]}
542   - />
543   - <ProFormDigit
544   - key={'price' + listMeta.index}
545   - label="单价"
546   - name="price"
547   - rules={[
548   - {
549   - validator: (_, value) => {
550   - if (value === undefined || value > 0) {
551   - return Promise.resolve();
552   - }
553   - return Promise.reject(new Error('单价必须大于0'));
554   - },
555   - },
556   - ]}
557   - />
558   - <ProFormMoney
559   - key={'totalPrice' + listMeta.index}
560   - label="金额"
561   - name="totalPrice"
562   - onChange={() => {
563   - const invoiceDetails = form.getFieldValue('invoiceDetails');
564   - console.log('invoiceDetails', invoiceDetails);
565   - const totalPrice = invoiceDetails.reduce(
566   - (accumulator, currentValue) => {
567   - return FloatAdd(accumulator, currentValue.totalPrice);
568   - },
569   - 0,
570   - );
571   - console.log('totalPrice', totalPrice);
572   - form.setFieldValue('price', totalPrice);
573   - }}
574   - rules={[
575   - {
576   - validator: (_, value) => {
577   - if (value === undefined || value > 0) {
578   - return Promise.resolve();
579   - }
580   - return Promise.reject(new Error('金额必须大于0'));
581   - },
582   - },
583   - ]}
584   - locale="zh-CN"
585   - />
586   - </ProCard>
587   - );
588   - }}
589   - ></ProFormList>
590   - <ProFormTextArea
591   - name="applyInvoicingNotes"
592   - label="备注"
593   - placeholder="请输入名称"
594   - />
595   - </DrawerForm>
596   - );
597   -};
src/pages/Order/WarningWhitelist/components/KingdeeCustomerModal.tsx deleted 100644 → 0
1   -import {
2   - postKingdeeRepCustomerDetail,
3   - postKingdeeRepCustomerSave,
4   -} from '@/services';
5   -import { getTeacherCustomFieldNumber } from '@/utils/kingdee';
6   -import { CloseCircleOutlined } from '@ant-design/icons';
7   -import {
8   - ModalForm,
9   - ProFormGroup,
10   - ProFormList,
11   - ProFormText,
12   -} from '@ant-design/pro-components';
13   -import { Form, message } from 'antd';
14   -
15   -// import { cloneDeep } from 'lodash';
16   -export default ({ setVisible, data, onClose }) => {
17   - const [form] = Form.useForm();
18   -
19   - /**
20   - * 回显客户信息
21   - * @param id
22   - */
23   - async function queryAndShowCustomer(id: any) {
24   - //查询客户信息
25   - let res = await postKingdeeRepCustomerDetail({
26   - data: {
27   - id: id,
28   - },
29   - });
30   -
31   - if (res) {
32   - form.setFieldValue('name', res.name);
33   - form.setFieldValue('id', res.id);
34   - form.setFieldValue('contact_persons', res.bomentity);
35   - let customFiledNumber = await getTeacherCustomFieldNumber();
36   - form.setFieldValue('teacherName', res.custom_field[customFiledNumber]);
37   - }
38   - }
39   -
40   - if (data) {
41   - //修改
42   - if (data.id) {
43   - queryAndShowCustomer(data.id);
44   - } else {
45   - //新增
46   - form.setFieldValue('name', data.name);
47   - form.setFieldValue('contact_persons', [{}]);
48   - }
49   - }
50   - return (
51   - <>
52   - <ModalForm
53   - width={900}
54   - open
55   - title="客户信息"
56   - form={form}
57   - autoFocusFirstInput
58   - modalProps={{
59   - okText: '保存',
60   - cancelText: '取消',
61   - destroyOnClose: true,
62   - onCancel: () => {
63   - setVisible(false);
64   - },
65   - }}
66   - onFinish={async (values) => {
67   - //查询客户自定义字段,课题组
68   - let custom_field_umber = await getTeacherCustomFieldNumber();
69   -
70   - if (custom_field_umber) {
71   - let customFieldObj = {};
72   - customFieldObj[custom_field_umber] = values.teacherName;
73   - values.custom_field = customFieldObj;
74   - }
75   - let customSaveRes = await postKingdeeRepCustomerSave({
76   - data: values,
77   - });
78   - if (customSaveRes) {
79   - let id_number_map = customSaveRes.id_number_map;
80   - let ids = customSaveRes.ids;
81   - if (id_number_map && ids) {
82   - message.success('保存成功');
83   - let id = ids[0];
84   - onClose(id);
85   - }
86   - }
87   - }}
88   - onOpenChange={setVisible}
89   - >
90   - <ProFormText key="key" name="id" label="id" placeholder="id" hidden />
91   - <ProFormGroup key="group">
92   - <ProFormText
93   - name="name"
94   - width="md"
95   - label={
96   - <>
97   - <span>客户名称</span>
98   - <span className="pl-2 text-xs text-gray-400">
99   - 请按照[单位]-[姓名][手机号]命名,例如:清华大学-张三12345678919
100   - </span>
101   - </>
102   - }
103   - initialValue={data}
104   - placeholder="请输入客户名称"
105   - rules={[
106   - {
107   - required: true,
108   - pattern: new RegExp('^.+-.+$'),
109   - message:
110   - '格式错误,若无单位可写:“无-姓名手机号”,例如:无-张三12345678919',
111   - },
112   - { required: true, message: '客户名称必填' },
113   - ]}
114   - />
115   - <ProFormText
116   - name="teacherName"
117   - width="md"
118   - label="课题组老师"
119   - placeholder="请输入课题组老师"
120   - rules={[
121   - { required: true, message: '课题组老师必填,若没有请填“无”' },
122   - ]}
123   - />
124   - </ProFormGroup>
125   -
126   - <ProFormList
127   - creatorButtonProps={{ disabled: false }}
128   - name="contact_persons"
129   - label="联系人信息"
130   - actionGuard={{
131   - beforeRemoveRow: async () => {
132   - return new Promise((resolve) => {
133   - let contactPersons = form.getFieldValue('contact_persons');
134   - if (contactPersons.length === 1) {
135   - message.error('至少要有一个联系人');
136   - resolve(false);
137   - return;
138   - }
139   - resolve(true);
140   - });
141   - },
142   - beforeAddRow: (defaultValue) => {
143   - defaultValue.id = undefined; //复制的时候要把id去掉
144   - return defaultValue;
145   - },
146   - }}
147   - deleteIconProps={{
148   - Icon: CloseCircleOutlined,
149   - tooltipText: '不需要这行了',
150   - }}
151   - >
152   - <ProFormGroup key="group">
153   - {[
154   - <ProFormText
155   - key="key"
156   - name="id"
157   - label="id"
158   - placeholder="id"
159   - hidden
160   - />,
161   - <ProFormText
162   - key="key"
163   - name="contact_person"
164   - label="收货人姓名"
165   - placeholder="联系人姓名"
166   - rules={[{ required: true, message: '收货人姓名必填' }]}
167   - />,
168   - <ProFormText
169   - key="key"
170   - name="mobile"
171   - label="联系方式"
172   - placeholder="联系方式"
173   - rules={[{ required: true, message: '联系方式必填' }]}
174   - />,
175   - <ProFormText
176   - key="key"
177   - name="contact_address"
178   - label="收货地址"
179   - width="md"
180   - placeholder="请输入收货地址"
181   - rules={[{ required: true, message: '收货地址必填' }]}
182   - />,
183   - ]}
184   - </ProFormGroup>
185   - </ProFormList>
186   - </ModalForm>
187   - </>
188   - );
189   -};
src/pages/Order/WarningWhitelist/components/LazySelect.tsx deleted 100644 → 0
1   -import { Select, Spin } from 'antd';
2   -import debounce from 'lodash/debounce';
3   -import difference from 'lodash/difference';
4   -import { useEffect, useState } from 'react';
5   -
6   -/**
7   - * 懒加载 Select ,适用于数据超大的下拉框
8   - * @param {Select 官方属性} props
9   - */
10   -const LazySelect = (props) => {
11   - const { value, onChange, query, pageSize } = props;
12   - // 清除 porps 中 query,避免控制台警告
13   - const selectProps = { ...props, query: undefined };
14   -
15   - const [selected, setSelected] = useState(value);
16   - const [data, setData] = useState([]);
17   - const [loading, setLoading] = useState(false);
18   - const [current, setCurrent] = useState(1);
19   - const [total, setTotal] = useState(0);
20   - const [searchText] = useState('');
21   -
22   - const getSelectedArray = (obj) => {
23   - let selectedValues = obj;
24   - // 如果是单选,将值封装为数组
25   - if (obj && obj instanceof Array === false) {
26   - selectedValues = [obj];
27   - }
28   - return selectedValues;
29   - };
30   -
31   - // 添加 300 毫秒防抖
32   - const handleQuery = debounce(async (param) => {
33   - setLoading(true);
34   - const resp = await query(param);
35   - const resData = resp.data;
36   - let options = resData?.data?.map((p: any) => {
37   - return {
38   - ...p,
39   - label: p.productName,
40   - value: p.productName,
41   - key: p.id,
42   - };
43   - });
44   - // 搜索服务端异步加载
45   - // const handleSearch = (filter) => {
46   - // setSearchText(filter);
47   - // handleQuery({
48   - // filter,
49   - // selectedValues: getSelectedArray(selected),
50   - // pageSize,
51   - // current
52   - // });
53   - // };
54   -
55   - //第一个商品默认为要新增的商品
56   - // if (searchValue?.trim() !== "") {
57   - // options.unshift({ productName: searchValue, type: "add", label: searchValue, value: searchValue })
58   - // }
59   - // return options;
60   - setTotal(resData.total);
61   - setData(data.concat(options));
62   - setLoading(false);
63   - }, 300);
64   -
65   - // 组件初始化时加载一次数据
66   - useEffect(() => {
67   - handleQuery({
68   - filter: '',
69   - selectedValues: getSelectedArray(value),
70   - });
71   - }, []);
72   -
73   - // 外部注入的 value 变化后,如果 value 在 data 中不存在,则加载数据
74   - useEffect(() => {
75   - setSelected(value);
76   - const dataKeys = data.map((item) => item.value);
77   - const diff = difference(getSelectedArray(value), dataKeys);
78   - if (diff && diff.length > 0) {
79   - handleQuery({
80   - filter: '',
81   - selectedValues: getSelectedArray(value),
82   - });
83   - }
84   - }, [value]);
85   -
86   - const keywordChange = (newWord: string) => {
87   - setData([]);
88   - setTotal(0);
89   - setCurrent(1);
90   - handleSearch(newWord);
91   - };
92   -
93   - const handleChange = (newValue, option) => {
94   - setSelected(newValue);
95   - if (onChange) {
96   - // 将值通过 onChange 传递到外部
97   - onChange(newValue, option);
98   - }
99   - };
100   -
101   - const scrollEnd = (e) => {
102   - e.persist();
103   - const { target } = e;
104   - // 滚动 触底 看接口是否还有剩余的值没传过来
105   - if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
106   - if (current * pageSize < total) {
107   - setCurrent(current + 1);
108   - handleSearch(searchText);
109   - }
110   - }
111   - };
112   -
113   - return (
114   - <Select
115   - {...selectProps}
116   - value={selected}
117   - loading={loading}
118   - onSearch={keywordChange}
119   - onChange={handleChange}
120   - onPopupScroll={scrollEnd}
121   - filterOption={false}
122   - options={data}
123   - showSearch
124   - showArrow
125   - notFoundContent={loading ? <Spin size="small" /> : null}
126   - >
127   - {/* {data.map(d => (
128   - <Option key={d.value} title={d.label}>
129   - {d.label}
130   - </Option>
131   - ))} */}
132   - </Select>
133   - );
134   -};
135   -
136   -export default LazySelect;
src/pages/Order/WarningWhitelist/components/MessageListDrawer.tsx deleted 100644 → 0
1   -import ButtonConfirm from '@/components/ButtomConfirm';
2   -import { RESPONSE_CODE } from '@/constants/enum';
3   -import {
4   - postOrderErpMessageQueryMyMessage,
5   - postOrderErpMessageRead,
6   - postOrderErpMessageReadAll,
7   -} from '@/services';
8   -import { formatDateTime, getUserInfo } from '@/utils';
9   -import { UserOutlined } from '@ant-design/icons';
10   -import {
11   - Avatar,
12   - Badge,
13   - Button,
14   - Checkbox,
15   - Drawer,
16   - Flex,
17   - List,
18   - message,
19   -} from 'antd';
20   -import { useEffect, useState } from 'react';
21   -
22   -export default ({ setVisible }) => {
23   - const userInfo = getUserInfo();
24   - const [current, setCurrent] = useState<number>(1); //当前页码
25   - const [total, setTotal] = useState(0);
26   - const [messageListData, setMessageListData] = useState<any[]>([]); //列表数据
27   - const [loading, setLoading] = useState(false);
28   - const [initLoading, setInitLoading] = useState(true);
29   - const [onlyUnread, setOnlyUnread] = useState(false);
30   - const [readFlagList, setReadFlagList] = useState<any[]>([]); //消息未读标识
31   -
32   - /**
33   - * 获取消息列表
34   - */
35   - async function getMessageListData() {
36   - setLoading(true);
37   - let res = await postOrderErpMessageQueryMyMessage({
38   - data: {
39   - username: userInfo.username,
40   - current: current,
41   - isReaded: onlyUnread ? onlyUnread : null,
42   - },
43   - }).finally(() => {
44   - setLoading(false);
45   - });
46   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
47   - setMessageListData([...messageListData, ...res?.data?.data]);
48   - let reqReadNumList = res?.data?.data?.map((item: any) => {
49   - return item.isReaded;
50   - });
51   -
52   - setReadFlagList([...readFlagList, ...reqReadNumList]);
53   - setTotal(res?.data?.total);
54   - }
55   - }
56   -
57   - /**
58   - * 跳转到订单列表
59   - */
60   - function toOrderList(mainOrderIds: any) {
61   - window.open('/order?id=' + mainOrderIds.join(","), '_blank');
62   - }
63   -
64   - /**
65   - * 仅展示未读
66   - */
67   - function onlyUnreadChange() {
68   - setOnlyUnread(!onlyUnread);
69   - setCurrent(1);
70   - setMessageListData([]);
71   - setReadFlagList([]);
72   - }
73   -
74   - /**
75   - * 仅展示未读
76   - */
77   - async function read(ids: any[]) {
78   - let res = await postOrderErpMessageRead({
79   - data: ids,
80   - });
81   -
82   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
83   - message.success('已读');
84   - return true;
85   - }
86   -
87   - return false;
88   - }
89   -
90   - /**
91   - * 全部标记为已读
92   - */
93   - async function readAll() {
94   - let res = await postOrderErpMessageReadAll();
95   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
96   - message.success(res.message);
97   - let newReadFlagList = readFlagList.map(() => true);
98   - setReadFlagList(newReadFlagList);
99   - }
100   - }
101   -
102   - const loadMore =
103   - !initLoading && !loading && messageListData.length < total ? (
104   - <div
105   - style={{
106   - textAlign: 'center',
107   - marginTop: 12,
108   - height: 32,
109   - lineHeight: '32px',
110   - }}
111   - >
112   - <Button
113   - onClick={() => {
114   - setCurrent(current + 1);
115   - }}
116   - >
117   - 加载更多
118   - </Button>
119   - </div>
120   - ) : messageListData.length > 0 && messageListData.length >= total ? (
121   - <span>没有更多消息了</span>
122   - ) : null;
123   -
124   - useEffect(() => {
125   - getMessageListData().finally(() => {
126   - setInitLoading(false);
127   - });
128   - }, [onlyUnread, current]);
129   -
130   - return (
131   - <>
132   - <Drawer
133   - title="消息列表"
134   - onClose={() => {
135   - setVisible(false);
136   - }}
137   - open={true}
138   - width={450}
139   - styles={{ body: { paddingTop: 0 } }}
140   - >
141   - <Flex align="center" justify="space-between">
142   - <div>
143   - <Checkbox onChange={onlyUnreadChange} checked={onlyUnread}>
144   - 仅展示未读
145   - </Checkbox>
146   - </div>
147   -
148   - <ButtonConfirm
149   - title={'是否全部标记为已读?'}
150   - text={'全部标记为已读'}
151   - className="p-0"
152   - onConfirm={readAll}
153   - placement="bottomLeft"
154   - />
155   - </Flex>
156   -
157   - <List
158   - className="demo-loadmore-list"
159   - loading={initLoading}
160   - itemLayout="horizontal"
161   - loadMore={loadMore}
162   - dataSource={messageListData}
163   - renderItem={(item: any, index: any) => (
164   - <List.Item key={item.id}>
165   - <List.Item.Meta
166   - avatar={
167   - <Badge dot={!readFlagList[index]}>
168   - <Avatar shape="square" icon={<UserOutlined />} />
169   - </Badge>
170   - }
171   - />
172   - <Flex
173   - vertical
174   - className="w-full hover:cursor-pointer"
175   - onClick={async () => {
176   - toOrderList(item.mainOrderIds);
177   -
178   - let readSuccess = await read([item.mesUsrRelId]);
179   - if (readSuccess) {
180   - let newUnreadNumList = [...readFlagList];
181   - newUnreadNumList[index] = true;
182   - setReadFlagList([...newUnreadNumList]);
183   - }
184   - }}
185   - >
186   - <Flex>
187   - <div>
188   - {item.content}
189   - {/* <span className="text-[#8C8C8C]">
190   - (点击跳转到对应主订单)
191   - </span> */}
192   - </div>
193   - </Flex>
194   - <Flex>
195   - <span className="text-xs text-[#8C8C8C] pt-1">
196   - {formatDateTime(item.createTime)}
197   - </span>
198   - </Flex>
199   - </Flex>
200   - </List.Item>
201   - )}
202   - />
203   - </Drawer>
204   - </>
205   - );
206   -};
src/pages/Order/WarningWhitelist/components/ModifiedDiffModal.tsx deleted 100644 → 0
1   -import { postServiceOrderModifiedDiff } from '@/services';
2   -import { enumValueToLabel, getAliYunOSSFileNameFromUrl } from '@/utils';
3   -import { getReceivingCompanyOptions, isSupplier } from '@/utils/order';
4   -import { Button, Divider, Modal, Space, Table, TableProps } from 'antd';
5   -import { useEffect, useState } from 'react';
6   -import {
7   - PAYEE_OPTIONS,
8   - PAYMENT_CHANNEL_OPTIONS,
9   - PAYMENT_METHOD_OPTIONS,
10   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
11   - SHIPPING_WAREHOUSE_OPTIONS,
12   -} from '../../constant';
13   -import '../table.less';
14   -
15   -export default ({ setVisible, subOrders, mainOrder, onClose }) => {
16   - let subIds = subOrders?.map((item: any) => {
17   - return item.id;
18   - });
19   -
20   - let mainId = mainOrder?.id;
21   -
22   - const [subOrderDiffs, setSubOrderDiffs] = useState([]);
23   - const [mainOrderDiffs, setMainOrderDiffs] = useState([]);
24   -
25   - function isSupplierUnvisibleField(field: any) {
26   - //主订单字段
27   - let unvisibleFields = [
28   - 'receivingCompany',
29   - 'invoiceIdentificationNumber',
30   - 'bankAccountNumber',
31   - 'bank',
32   - 'totalPayment',
33   - 'institution',
34   - 'institutionContactName',
35   - ];
36   - //子订单字段
37   - unvisibleFields.push(
38   - ...[
39   - 'listAnnex',
40   - 'shippingWarehouse',
41   - 'productBelongBusiness',
42   - 'subOrderPayment',
43   - 'productPrice',
44   - ],
45   - );
46   -
47   - return isSupplier() && unvisibleFields.includes(field);
48   - }
49   -
50   - async function loadData() {
51   - let res = await postServiceOrderModifiedDiff({
52   - data: {
53   - subOrderIds: subIds,
54   - mainOrderId: mainId,
55   - },
56   - });
57   - let subOrderDiffs = res?.data?.subOrderDiffs;
58   - let mainOrderDiffs = res?.data?.mainOrderDiffs;
59   -
60   - setSubOrderDiffs(subOrderDiffs);
61   - setMainOrderDiffs(mainOrderDiffs);
62   - }
63   -
64   - useEffect(() => {
65   - loadData();
66   - }, []);
67   -
68   - function toChineseName(key: any, text: any) {
69   - let newText = text;
70   - if (key === '所属事业部') {
71   - newText = enumValueToLabel(text, PRODUCT_BELONG_DEPARTMENT_OPTIONS);
72   - }
73   - if (key === '发货仓库') {
74   - newText = enumValueToLabel(text, SHIPPING_WAREHOUSE_OPTIONS);
75   - }
76   - if (key === '支付渠道') {
77   - newText = enumValueToLabel(text, PAYMENT_CHANNEL_OPTIONS);
78   - }
79   - if (key === '支付方式') {
80   - newText = enumValueToLabel(text, PAYMENT_METHOD_OPTIONS);
81   - }
82   - if (key === '单价' || key === '合计') {
83   - newText = '¥' + newText;
84   - }
85   - if (key === '开票收款单位') {
86   - newText = enumValueToLabel(
87   - text,
88   - getReceivingCompanyOptions(PAYEE_OPTIONS),
89   - );
90   - }
91   - return newText;
92   - }
93   -
94   - function cellRender(value: any, record: any) {
95   - if (record.fieldName === '附件') {
96   - return (
97   - <Space className="max-w-[300px]" wrap>
98   - {value?.map((item: any, index: any) => {
99   - let fileName = getAliYunOSSFileNameFromUrl(item);
100   - return (
101   - <Button
102   - className="p-0 pr-2"
103   - key={index}
104   - danger={record.isDiff}
105   - type="link"
106   - onClick={() => {
107   - window.open(
108   - '/previewApi/onlinePreview?url=' +
109   - encodeURIComponent(Base64.encode(item)),
110   - );
111   - }}
112   - >
113   - {fileName}
114   - </Button>
115   - );
116   - })}
117   - </Space>
118   - );
119   - }
120   - return (
121   - <div
122   - title={toChineseName(record.fieldName, value)}
123   - className="max-w-[250px] whitespace-no-wrap overflow-hidden overflow-ellipsis"
124   - >
125   - <span className={record.isDiff ? 'text-[red]' : ''}>
126   - {toChineseName(record.fieldName, value)}
127   - </span>
128   - </div>
129   - );
130   - }
131   -
132   - interface DataType {
133   - fieldName: string;
134   - oldValue: string;
135   - newValue: string;
136   - isDiff: boolean;
137   - }
138   -
139   - const columns: TableProps<DataType>['columns'] = [
140   - {
141   - title: '字段名',
142   - dataIndex: 'fieldName',
143   - key: 'fieldName',
144   - render(value) {
145   - return (
146   - <div
147   - title={value}
148   - className="max-w-[80px] whitespace-no-wrap overflow-hidden overflow-ellipsis"
149   - >
150   - {value}
151   - </div>
152   - );
153   - },
154   - },
155   - {
156   - title: '修改前字段值',
157   - dataIndex: 'oldValue',
158   - key: 'oldValue',
159   - render(value, record) {
160   - return cellRender(value, record);
161   - },
162   - },
163   - {
164   - title: '修改后(当前)字段值',
165   - dataIndex: 'newValue',
166   - key: 'newValue',
167   - render(value, record) {
168   - return cellRender(value, record);
169   - },
170   - },
171   - ];
172   -
173   - function loadSubOrderDiffTable(item: any, index: any) {
174   - //转换为表格数据
175   - let oldDatas = item[0];
176   - let curDatas = item[1];
177   - let diffFiledNames = oldDatas?.diffFieldsName;
178   -
179   - let tableData = [];
180   - let visibleFields = [
181   - ['productName', '商品名称'],
182   - ['productCode', '商品编码'],
183   - ['parameters', '商品参数'],
184   - ['quantity', '数量'],
185   - ['productPrice', '单价'],
186   - ['unit', '单位'],
187   - ['subOrderPayment', '合计'],
188   - ['productBelongBusiness', '所属事业部'],
189   - ['shippingWarehouse', '发货仓库'],
190   - ['notes', '备注'],
191   - ['paymentChannel', '支付渠道'],
192   - ['paymentMethod', '支付方式'],
193   - ['listAnnex', '附件'],
194   - ];
195   - for (let field of visibleFields) {
196   - let filedKey = field[0];
197   - let filedName = field[1];
198   -
199   - if (!isSupplierUnvisibleField(filedKey)) {
200   - tableData.push({
201   - fieldName: filedName,
202   - oldValue: oldDatas[filedKey],
203   - newValue: curDatas[filedKey],
204   - isDiff: diffFiledNames?.includes(filedKey),
205   - });
206   - }
207   - }
208   - return (
209   - <>
210   - <Divider orientation="left">商品{index + 1}:</Divider>
211   - <Table
212   - className="myTable"
213   - size="small"
214   - pagination={false}
215   - key={index}
216   - columns={columns}
217   - dataSource={tableData}
218   - />
219   - </>
220   - );
221   - }
222   -
223   - function loadMainOrderDiffTable(item: any, index: any) {
224   - if (!item || item.length <= 0) {
225   - return;
226   - }
227   - //转换为表格数据
228   - let oldDatas = item[0];
229   - let curDatas = item[1];
230   - let diffFiledNames = oldDatas?.diffFieldsName;
231   -
232   - let tableData = [];
233   - let visibleFields = [
234   - ['salesCode', '销售代号'],
235   - ['customerName', '收货人姓名'],
236   - ['customerContactNumber', '收货人联系手机号'],
237   - ['customerShippingAddress', '收货人地址信息'],
238   - ['institutionContactName', '单位联系人'],
239   - ['institution', '单位'],
240   - ['totalPayment', '支付总金额'],
241   - ['notes', '备注'],
242   - ['bank', '开户银行'],
243   - ['bankAccountNumber', '银行账号'],
244   - ['invoiceIdentificationNumber', '开票识别号'],
245   - ['receivingCompany', '开票收款单位'],
246   - ];
247   - for (let field of visibleFields) {
248   - let filedKey = field[0];
249   - let filedName = field[1];
250   -
251   - if (!isSupplierUnvisibleField(filedKey)) {
252   - tableData.push({
253   - fieldName: filedName,
254   - oldValue: oldDatas[filedKey],
255   - newValue: curDatas[filedKey],
256   - isDiff: diffFiledNames?.includes(filedKey),
257   - });
258   - }
259   - }
260   - return (
261   - <Table
262   - className="myTable"
263   - size="small"
264   - pagination={false}
265   - key={index}
266   - columns={columns}
267   - dataSource={tableData}
268   - />
269   - );
270   - }
271   -
272   - return (
273   - <>
274   - <Modal
275   - width={700}
276   - open
277   - title="信息对比"
278   - okText="返回"
279   - cancelText={false}
280   - onOk={() => {
281   - setVisible(false);
282   - onClose();
283   - }}
284   - onCancel={() => {
285   - setVisible(false);
286   - }}
287   - cancelButtonProps={{
288   - hidden: true,
289   - }}
290   - destroyOnClose={true}
291   - >
292   - <Divider>主订单信息:</Divider>
293   - {loadMainOrderDiffTable(mainOrderDiffs, 0)}
294   -
295   - <Divider>子订单信息:</Divider>
296   - {subOrderDiffs?.map((item: any, index) => {
297   - return loadSubOrderDiffTable(item, index);
298   - })}
299   - </Modal>
300   - </>
301   - );
302   -};
src/pages/Order/WarningWhitelist/components/OrderDrawer copy.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postKingdeeRepCustomer,
4   - postKingdeeRepCustomerDetail,
5   - postKingdeeRepMaterial,
6   - postKingdeeRepMaterialUnit,
7   - postKingdeeRepMeasureUnit,
8   - postServiceOrderAddOrder,
9   - postServiceOrderQuerySalesCode,
10   - postServiceOrderUpdateOrder,
11   -} from '@/services';
12   -import {
13   - enumToSelect,
14   - getAliYunOSSFileNameFromUrl,
15   - getUserInfo,
16   -} from '@/utils';
17   -import { getTeacherCustomFieldNumber } from '@/utils/kingdee';
18   -import {
19   - DrawerForm,
20   - FormListActionType,
21   - ProCard,
22   - ProFormDateTimePicker,
23   - ProFormDigit,
24   - ProFormList,
25   - ProFormSelect,
26   - ProFormText,
27   - ProFormTextArea,
28   - ProFormUploadDragger,
29   -} from '@ant-design/pro-components';
30   -import { Button, Form, message } from 'antd';
31   -import { cloneDeep } from 'lodash';
32   -import { useEffect, useRef, useState } from 'react';
33   -import {
34   - INVOCING_STATUS_OPTIONS,
35   - INVOCING_STATUS_OPTIONS_OLD,
36   - PAYMENT_CHANNEL_OPTIONS,
37   - PAYMENT_METHOD_OPTIONS,
38   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
39   -} from '../constant';
40   -import KingdeeCustomerModal from './KingdeeCustomerModal';
41   -
42   -export default ({ onClose, data, subOrders, orderOptType }) => {
43   - const [invoicingStatus, setInvoicingStatus] = useState('');
44   - const [salesCodeOptions, setSalesCodeOptions] = useState([]);
45   - const [customer, setCustomer] = useState({});
46   - const [kingdeeCstomerModalVisible, setKingdeeCstomerModalVisible] =
47   - useState(false);
48   - const [
49   - productParametersDisabledFlagList,
50   - setProductParametersDisabledFlagList,
51   - ] = useState([]);
52   - // const [productInvStockOptionsList, setProductInvStockOptionsList] = useState(
53   - // [],
54   - // ); //商品的仓库选项
55   - const [productUnitOptionsList, setProductUnitOptionsList] = useState([]); //商品的单位选项
56   - const [productCustomerContactOptions, setProductCustomerContactOptions] =
57   - useState([]); //客户的收货人选项
58   - const [form] = Form.useForm<{
59   - salesCode: '';
60   - customerName: '';
61   - customerContactNumber: '';
62   - institution: '';
63   - institutionContactName: '';
64   - customerShippingAddress: '';
65   - totalPayment: '';
66   - paymentChannel: '';
67   - paymentMethod: '';
68   - productBelongBusiness: '';
69   - invoicingStatus: '';
70   - invoiceIdentificationNumber: '';
71   - invoicingTime: '';
72   - bank: '';
73   - bankAccountNumber: '';
74   - deleteSubOrderLists: [];
75   - notes: '';
76   - list: [
77   - {
78   - productCode: '';
79   - productName: '';
80   - quantity: '';
81   - productPrice: '';
82   - parameters: '';
83   - subOrderPayment: '';
84   - unit: '';
85   - serialNumber: '';
86   - notes: '';
87   - },
88   - ];
89   - }>();
90   -
91   - let originSubOrders = cloneDeep(subOrders);
92   - /**
93   - * 获取当前的操作类型boolean值
94   - * @param type 操作类型,如果与当前匹配返回true
95   - */
96   - function optType(type: string) {
97   - return orderOptType === type;
98   - }
99   -
100   - /**
101   - *
102   - * @returns 获取开票选项
103   - */
104   - function getInvoicingSelect() {
105   - if (optType('edit')) {
106   - return enumToSelect(INVOCING_STATUS_OPTIONS_OLD);
107   - }
108   - return enumToSelect(INVOCING_STATUS_OPTIONS);
109   - }
110   -
111   - const fileList: any = [];
112   -
113   - const getSalesCodeOptions = async () => {
114   - const res = await postServiceOrderQuerySalesCode();
115   - let options = res.data?.map((item) => {
116   - return {
117   - label: item.userName,
118   - value: item.userName,
119   - number: item.number,
120   - };
121   - });
122   - setSalesCodeOptions(options);
123   -
124   - if (optType('copy') || optType('edit')) {
125   - let includeFlag = false;
126   - //销售代码校验,如果是旧的销售代码,则提示并清空
127   - for (let option of options) {
128   - if (option.value === data.salesCode) {
129   - includeFlag = true;
130   - }
131   - }
132   - if (!includeFlag) {
133   - form.resetFields(['salesCode']);
134   - message.warning('检测到销售代码为旧的,已清空,请重新选择');
135   - }
136   - }
137   - };
138   -
139   - //复制的时候,如果是不需要开票,要把开票信息清空
140   - if (optType('copy') && data.invoicingStatus === 'UN_INVOICE') {
141   - data.invoiceIdentificationNumber = undefined;
142   - }
143   -
144   - if (subOrders !== undefined && subOrders.length > 0) {
145   - data.list = subOrders;
146   - }
147   -
148   - const actionRef = useRef<
149   - FormListActionType<{
150   - name: string;
151   - }>
152   - >();
153   -
154   - useEffect(() => {
155   - form.setFieldsValue({ ...data });
156   - //如果是新建,需要清空list
157   - if (optType('add')) {
158   - form.resetFields(['list']);
159   - }
160   - }, [data]);
161   -
162   - /**
163   - * 选择客户后自动为收货人Select添加选项,填充课题组和单位信息
164   - * @param option 客户选项
165   - */
166   - async function autoFillCustomerContactSelectOptions(customerId: any) {
167   - //查询单位详细信息
168   - let res = await postKingdeeRepCustomerDetail({
169   - data: {
170   - id: customerId,
171   - },
172   - });
173   -
174   - //erp客户名称
175   - form.setFieldValue('erpCustomerName', res?.name);
176   -
177   - //重新设置当前option
178   - form.setFieldValue('erpCustomerId', {
179   - label: res?.name,
180   - value: res?.id,
181   - id: res?.id,
182   - });
183   -
184   - //查询客户自定义字段,课题组
185   - let entity_number = await getTeacherCustomFieldNumber();
186   -
187   - //在单位详细信息中拿到自定义字段的值
188   - let customField = res?.custom_field;
189   - if (customField) {
190   - let teacherName = customField[entity_number];
191   - //填充到课题组老师表单字段中
192   - form.setFieldValue('institutionContactName', teacherName);
193   - }
194   -
195   - //单位名称,从客户名称中获取,客户名称规则<单位名称>-<联系人名称和电话>
196   - let namePortions = res?.name?.split('-');
197   - if (namePortions && namePortions.length >= 2) {
198   - form.setFieldValue('institution', namePortions[0]);
199   - }
200   -
201   - //如果原来的收货信息没有包含在这次查询出来的收货人选项中,那么清除原来的收货人信息
202   - let existFlag = false;
203   -
204   - //填充收货人选项
205   - let newProductCustomerContactOptions = res?.bomentity?.map((item) => {
206   - let address =
207   - item.contact_person + ',' + item.mobile + ',' + item.contact_address;
208   - if (address === data.contactAddress) {
209   - existFlag = true;
210   - }
211   - return { ...item, label: address, value: address };
212   - });
213   -
214   - setProductCustomerContactOptions(newProductCustomerContactOptions);
215   -
216   - if (!existFlag) {
217   - //清空原来的收货人信息
218   - form.setFieldValue('customerShippingAddress', undefined);
219   - form.setFieldValue('customerContactNumber', undefined);
220   - form.setFieldValue('customerName', undefined);
221   - form.setFieldValue('erpCustomerAddress', undefined);
222   - }
223   - }
224   -
225   - /**
226   - * 回显金蝶信息
227   - */
228   - async function showKindeeInfo() {
229   - //客户信息
230   - if (data.customerId) {
231   - //客户回显
232   - autoFillCustomerContactSelectOptions(data.customerId);
233   - }
234   -
235   - //商品单位回显
236   - let list = data?.subOrderInformationLists;
237   - if (list) {
238   - let newProductUnitOptionsList = [...productUnitOptionsList];
239   - for (let i = 0; i < list.length; i++) {
240   - newProductUnitOptionsList[i] = [
241   - { label: list[i].unit, value: list[i].unitId },
242   - ];
243   - }
244   - setProductUnitOptionsList(newProductUnitOptionsList);
245   - }
246   - }
247   -
248   - /**
249   - *
250   - * @param option 商品名称所对应的商品数据
251   - * @param currentRowData list中当前行的数据
252   - */
253   - async function autoFillProductInfo(
254   - option: any,
255   - currentRowData: any,
256   - index: any,
257   - ) {
258   - let newProductParametersDisabledFlagList = [
259   - ...productParametersDisabledFlagList,
260   - ];
261   - let newProductUnitOptionsList = [...productUnitOptionsList];
262   - newProductUnitOptionsList[index] = [];
263   -
264   - //是新增商品
265   - if (option.type === 'add') {
266   - //商品参数开放权限可以编辑
267   - newProductParametersDisabledFlagList[index] = false;
268   -
269   - //清空商品信息
270   - let copyList = form.getFieldValue('list');
271   - let currentData = copyList[index];
272   - currentData.productCode = undefined;
273   - currentData.parameters = undefined;
274   - currentData.unit = undefined;
275   - currentData.subOrderPayment = undefined;
276   - currentData.quantity = undefined;
277   - currentData.notes = undefined;
278   - currentData.productPrice = undefined;
279   - form.setFieldValue('list', copyList);
280   -
281   - //查询计量单价列表
282   - let res = await postKingdeeRepMeasureUnit({ data: {} });
283   - if (res && res?.rows) {
284   - for (let row of res?.rows) {
285   - newProductUnitOptionsList[index].push({
286   - label: row.name,
287   - value: row.id,
288   - });
289   - }
290   - }
291   - } else {
292   - //选择的是已有的商品,进行内容自动填充
293   - let copyList = form.getFieldValue('list');
294   - let currentData = copyList[index];
295   - currentData.productCode = option?.number;
296   - currentData.parameters = option?.model;
297   - currentData.unit = option?.base_unit_name;
298   -
299   - //商品id
300   - currentData.materialId = option?.id;
301   -
302   - //单位
303   - currentData.unit = option.base_unit_name;
304   - currentData.unitId = option.base_unit_id;
305   -
306   - form.setFieldValue('list', copyList);
307   -
308   - //商品所在的仓库选项填充
309   - // let res = await postKingdeeRepMaterialStock({
310   - // data: {
311   - // material_id: option.id,
312   - // },
313   - // });
314   - // let newProductInvStockOptionsList = [...productInvStockOptionsList];
315   - // newProductInvStockOptionsList[index] = res?.rows?.map((item) => {
316   - // return { label: item.inv_stock, value: item.inv_stock_id };
317   - // });
318   - // setProductInvStockOptionsList(newProductInvStockOptionsList);
319   -
320   - //商品单位填充,查询商品单位列表
321   - let res = await postKingdeeRepMaterialUnit({
322   - data: { material_id: option.id },
323   - });
324   - if (res && res.rows) {
325   - for (let row of res.rows) {
326   - newProductUnitOptionsList[index].push({
327   - label: row.unit_name,
328   - value: row.unit_id,
329   - });
330   - }
331   - }
332   - //商品参数不允许编辑
333   - newProductParametersDisabledFlagList[index] = true;
334   - }
335   -
336   - setProductParametersDisabledFlagList(newProductParametersDisabledFlagList);
337   - setProductUnitOptionsList(newProductUnitOptionsList);
338   - }
339   -
340   - /**
341   - * 选择收货人后自动填充信息
342   - * @param option 收货人信息
343   - */
344   - async function autoFillCustomerInfo(option: any) {
345   - form.setFieldValue('customerShippingAddress', option.contact_address);
346   - form.setFieldValue('customerContactNumber', option.mobile);
347   - form.setFieldValue('customerName', option.contact_person);
348   -
349   - //erp收货地址:需要与客户联系人中的地址一样:姓名,手机号,地址
350   - form.setFieldValue('contactAddress', option.value);
351   - }
352   -
353   - /**
354   - * 填充销售代表的信息
355   - * @param option
356   - */
357   - function autoFillSalesInfo(option: any) {
358   - console.log(option);
359   - //销售代表对应职员编码填充
360   - form.setFieldValue('empNumber', option.number);
361   - }
362   -
363   - /**
364   - * 选择商品单位后自动填充
365   - * @param option
366   - * @param index
367   - */
368   - function autoFillUnit(option: any, index: any) {
369   - let copyList = form.getFieldValue('list');
370   - let currentData = copyList[index];
371   - currentData.unit = option?.label;
372   - form.setFieldValue('list', copyList);
373   - }
374   -
375   - /**
376   - * 计算子订单金额
377   - * @param listMeta 当前商品信息
378   - */
379   - function computeSubOrderPayment(listMeta: any) {
380   - let quantity = listMeta?.record?.quantity;
381   - let productPrice = listMeta?.record?.productPrice;
382   - quantity = quantity === '' || quantity === undefined ? 0 : quantity;
383   - productPrice =
384   - productPrice === '' || productPrice === undefined ? 0 : productPrice;
385   -
386   - listMeta.subOrderPayment = quantity * productPrice;
387   - let list = form.getFieldValue('list');
388   - list[listMeta?.index].subOrderPayment = quantity * productPrice;
389   - form.setFieldValue('list', list);
390   - }
391   -
392   - /**
393   - * 计算支付总额
394   - */
395   - function computeTotalPayment() {
396   - let list = form.getFieldValue('list');
397   - let totalPayment = 0;
398   - list?.forEach((subOrder: any) => {
399   - let subOrderPayment = subOrder?.subOrderPayment;
400   - if (subOrderPayment === '' || subOrderPayment === undefined) {
401   - totalPayment += 0;
402   - } else {
403   - totalPayment += subOrderPayment;
404   - }
405   - });
406   - form.setFieldValue('totalPayment', totalPayment);
407   - }
408   -
409   - useEffect(() => {
410   - getSalesCodeOptions();
411   - showKindeeInfo();
412   - }, []);
413   -
414   - useEffect(() => {
415   - // 在组件挂载或数据变化时,更新组件状态
416   - if (data) {
417   - setInvoicingStatus(data.invoicingStatus);
418   - }
419   - }, [data]);
420   -
421   - // let mainInfoDisbled = optType('edit');
422   - if (optType('edit') || optType('copy')) {
423   - //如果是复制,需要开票,不回显是否需要开票字段
424   - if (optType('copy')) {
425   - if (data.invoicingStatus === 'INVOICED') {
426   - data.invoicingStatus = undefined;
427   - }
428   - }
429   - //订单修改和新增的子订单列表命名是list
430   - data.list = data.subOrderInformationLists;
431   - //主订单事业部默认显示子订单第一条的事业部
432   - data.productBelongBusiness = data.list[0].productBelongBusiness;
433   - data.paymentMethod = data.list[0].paymentMethod;
434   - data.paymentChannel = data.list[0].paymentChannel;
435   - data.invoicingStatus = data.list[0].invoicingStatus;
436   -
437   - data.list = data.list?.map((item) => {
438   - item.filePaths = item.listAnnex?.map((path) => {
439   - let i = 0;
440   - return {
441   - uid: i++,
442   - name: getAliYunOSSFileNameFromUrl(path),
443   - status: 'uploaded',
444   - url: path,
445   - response: { data: [path] },
446   - };
447   - });
448   - return item;
449   - });
450   - }
451   -
452   - return (
453   - <>
454   - <DrawerForm<{
455   - deleteSubOrderLists: any;
456   - name: string;
457   - company: string;
458   - }>
459   - open
460   - width="35%"
461   - title={optType('add') || optType('copy') ? '新建订单' : '修改订单'}
462   - resize={{
463   - onResize() {
464   - console.log('resize!');
465   - },
466   - maxWidth: window.innerWidth * 0.8,
467   - minWidth: 400,
468   - }}
469   - // layout="horizontal"
470   - // labelCol={{ span: 8 }}
471   - form={form}
472   - autoFocusFirstInput
473   - drawerProps={{
474   - destroyOnClose: true,
475   - maskClosable: false,
476   - }}
477   - submitTimeout={2000}
478   - onFinish={async (values) => {
479   - let res = {};
480   - //附件处理
481   - let list = values.list;
482   - // console.log(list);
483   - list = list.map((item) => {
484   - item.filePaths = item.filePaths?.map((file) => {
485   - console.log(file);
486   - return { url: file.response.data[0] };
487   - });
488   - return item;
489   - });
490   -
491   - values.list = list;
492   - values.institution = values.institution?.trim();
493   - values.institutionContactName = values.institutionContactName?.trim();
494   -
495   - if (typeof values.erpCustomerId !== 'string') {
496   - values.erpCustomerId = values.erpCustomerId?.id;
497   - }
498   -
499   - if (optType('add') || optType('copy')) {
500   - res = await postServiceOrderAddOrder({ data: values });
501   - } else {
502   - //计算已删除的子订单id
503   - const originIds = originSubOrders.map((item) => {
504   - return item.id;
505   - });
506   - const curIds = form.getFieldValue('list')?.map((item) => {
507   - return item.id;
508   - });
509   - let diff = originIds.filter((item) => !curIds.includes(item));
510   - values.deleteSubOrderLists = diff;
511   - res = await postServiceOrderUpdateOrder({ data: values });
512   - }
513   -
514   - if (res.result === RESPONSE_CODE.SUCCESS) {
515   - message.success(res.message);
516   - // 不返回不会关闭弹框
517   - onClose(true);
518   - return true;
519   - }
520   - }}
521   - onOpenChange={(val) => {
522   - return !val && onClose();
523   - }}
524   - >
525   - <h2>订单基本信息</h2>
526   - <ProFormText
527   - key="id"
528   - name="id"
529   - width="lg"
530   - disabled
531   - label="id"
532   - placeholder="id"
533   - hidden
534   - />
535   -
536   - <ProFormText
537   - key="empNumber"
538   - name="empNumber"
539   - width="lg"
540   - label="销售职员编码"
541   - placeholder="销售职员编码"
542   - hidden
543   - />
544   -
545   - <ProFormSelect
546   - name="salesCode"
547   - key="salesCode"
548   - width="lg"
549   - showSearch
550   - label="销售代表"
551   - placeholder="请输入销售代表"
552   - rules={[{ required: true, message: '销售代表必填' }]}
553   - options={salesCodeOptions}
554   - onChange={(_, option) => {
555   - autoFillSalesInfo(option);
556   - }}
557   - // disabled={mainInfoDisbled}
558   - />
559   -
560   - <ProFormText
561   - key="erpCustomerName"
562   - name="erpCustomerName"
563   - hidden
564   - ></ProFormText>
565   -
566   - <ProFormText
567   - key="contactAddress"
568   - name="contactAddress"
569   - hidden
570   - ></ProFormText>
571   -
572   - <ProFormSelect
573   - name="erpCustomerId"
574   - key="erpCustomerId"
575   - width="lg"
576   - showSearch
577   - label={
578   - <>
579   - <span>客户</span>
580   - <span
581   - className="pl-2 text-xs text-[#1677ff] cursor-pointer"
582   - onClick={() => {
583   - let customerId = form.getFieldValue('erpCustomerId');
584   - if (typeof customerId === 'string') {
585   - setCustomer({ ...customer, id: customerId });
586   - } else {
587   - setCustomer({ ...customer, id: customerId.id });
588   - }
589   - setKingdeeCstomerModalVisible(true);
590   - }}
591   - >
592   - 编辑客户信息
593   - </span>
594   - </>
595   - }
596   - placeholder="请选择客户"
597   - rules={[{ required: true, message: '客户必填' }]}
598   - onChange={(_, option) => {
599   - //新增客户
600   - if (option.type === 'add') {
601   - setCustomer({ name: option.name });
602   - setKingdeeCstomerModalVisible(true);
603   - return;
604   - }
605   - autoFillCustomerContactSelectOptions(option.id);
606   - }}
607   - initialValue={{
608   - label: data?.erpCustomerName,
609   - value: data?.customerId,
610   - id: data?.customerId,
611   - }}
612   - fieldProps={{
613   - optionItemRender(item) {
614   - if (item.type === 'add') {
615   - return (
616   - <div title={item.name + '(新增客户)'}>
617   - <span style={{ color: '#333333' }}>{item.name}</span>
618   - {' | '}
619   - <span style={{ color: 'orange' }}>自定义</span>
620   - </div>
621   - );
622   - }
623   - return (
624   - <div
625   - title={
626   - item.name +
627   - ' | ' +
628   - item.customerContactNumber +
629   - ' | ' +
630   - (item.customerShippingAddress === undefined
631   - ? '无地址'
632   - : item.customerShippingAddress) +
633   - ' | ' +
634   - item.institutionContactName +
635   - ' | ' +
636   - item.institution
637   - }
638   - >
639   - <span style={{ color: '#333333' }}>{item.name}</span>
640   - </div>
641   - );
642   - },
643   - }}
644   - debounceTime={1000}
645   - request={async (value, {}) => {
646   - const keywords = value.keyWords;
647   - const res = await postKingdeeRepCustomer({
648   - data: { search: keywords },
649   - });
650   - console.log(res);
651   -
652   - let options = res?.rows?.map((c: any) => {
653   - return {
654   - ...c,
655   - label: c.name,
656   - value: c.id,
657   - key: c.id,
658   - };
659   - });
660   -
661   - //第一个商品默认为要新增客户
662   - if (keywords.trim() !== '') {
663   - options.unshift({
664   - name: keywords,
665   - type: 'add',
666   - label: keywords,
667   - value: 3.1415926,
668   - key: keywords,
669   - });
670   - }
671   - return options;
672   - }}
673   - />
674   - <ProFormSelect
675   - key="customerName"
676   - label="收货人"
677   - width="lg"
678   - showSearch
679   - name="customerName"
680   - placeholder="请选择收货人"
681   - rules={[{ required: true, message: '收货人必填' }]}
682   - onChange={(_, option) => {
683   - autoFillCustomerInfo(option);
684   - }}
685   - initialValue={data.contactAddress}
686   - options={productCustomerContactOptions}
687   - />
688   - <ProFormText
689   - width="lg"
690   - key="customerContactNumber"
691   - name="customerContactNumber"
692   - label="联系方式"
693   - placeholder="请输入联系方式"
694   - rules={[{ required: true, message: '联系方式必填' }]}
695   - disabled
696   - />
697   - <ProFormText
698   - width="lg"
699   - key="institution"
700   - name="institution"
701   - label="单位"
702   - placeholder="请输入单位"
703   - rules={[{ required: true, message: '单位必填' }]}
704   - disabled
705   - />
706   - <ProFormText
707   - width="lg"
708   - key="institutionContactName"
709   - name="institutionContactName"
710   - label="课题组"
711   - placeholder="请输入课题组"
712   - rules={[{ required: true, message: '课题组必填' }]}
713   - disabled
714   - />
715   - <ProFormTextArea
716   - width="lg"
717   - key="customerShippingAddress"
718   - name="customerShippingAddress"
719   - label="收货地址"
720   - placeholder="请输入收货地址"
721   - rules={[{ required: true, message: '收货地址必填' }]}
722   - disabled
723   - />
724   - <div id="total-payment">
725   - <ProFormDigit
726   - name="totalPayment"
727   - width="lg"
728   - key="totalPayment"
729   - label="支付总额(¥)"
730   - rules={[{ required: true, message: '支付总额必填' }]}
731   - tooltip="点击计算,合计所有子订单金额"
732   - fieldProps={{
733   - addonAfter: (
734   - <Button
735   - className="rounded-l-none"
736   - type="primary"
737   - onClick={computeTotalPayment}
738   - >
739   - 计算
740   - </Button>
741   - ),
742   - }}
743   - // disabled={mainInfoDisbled}
744   - />
745   - </div>
746   -
747   - <ProFormSelect
748   - placeholder="请输入支付渠道"
749   - name="paymentChannel"
750   - width="lg"
751   - key="paymentChannel"
752   - label="支付渠道"
753   - options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)}
754   - rules={[{ required: true, message: '支付渠道必填' }]}
755   - // disabled={mainInfoDisbled}
756   - />
757   - <ProFormSelect
758   - placeholder="请输入支付方式"
759   - name="paymentMethod"
760   - width="lg"
761   - key="paymentMethod"
762   - label="支付方式"
763   - options={enumToSelect(PAYMENT_METHOD_OPTIONS)}
764   - rules={[{ required: true, message: '支付方式必填' }]}
765   - // disabled={mainInfoDisbled}
766   - />
767   - <ProFormSelect
768   - placeholder="选择是否需要开票"
769   - name="invoicingStatus"
770   - width="lg"
771   - key="invoicingStatus"
772   - label="是否需要开票"
773   - options={getInvoicingSelect()}
774   - // disabled={mainInfoDisbled}
775   - onChange={(_, option) => {
776   - setInvoicingStatus(option.value);
777   - if (option.value === 'UN_INVOICE') {
778   - form.setFieldValue('invoiceIdentificationNumber', undefined);
779   - form.setFieldValue('bank', undefined);
780   - form.setFieldValue('bankAccountNumber', undefined);
781   - }
782   - }}
783   - rules={[{ required: true, message: '是否需要开票必填' }]}
784   - />
785   - <ProFormText
786   - width="lg"
787   - name="invoiceIdentificationNumber"
788   - label="开票信息"
789   - key="invoiceIdentificationNumber"
790   - // disabled={mainInfoDisbled}
791   - hidden={invoicingStatus === 'UN_INVOICE'}
792   - placeholder="请输入开票信息"
793   - rules={[
794   - {
795   - required: invoicingStatus === 'UN_INVOICE' ? false : true,
796   - message: '开票信息必填',
797   - },
798   - ]}
799   - />
800   -
801   - {getUserInfo().roleSmallVO?.code === 'admin' ? (
802   - <ProFormDateTimePicker
803   - width="lg"
804   - key="invoicingTime"
805   - name="invoicingTime"
806   - // disabled={mainInfoDisbled}
807   - hidden={invoicingStatus === 'UN_INVOICE'}
808   - label="开票时间"
809   - placeholder="请输入开票时间"
810   - />
811   - ) : (
812   - ''
813   - )}
814   - <ProFormText
815   - width="lg"
816   - name="bank"
817   - key="bank"
818   - label="开户银行"
819   - // disabled={mainInfoDisbled}
820   - hidden={invoicingStatus === 'UN_INVOICE'}
821   - placeholder="请输入开户银行"
822   - />
823   - <ProFormText
824   - width="lg"
825   - key="bankAccountNumber"
826   - name="bankAccountNumber"
827   - hidden={invoicingStatus === 'UN_INVOICE'}
828   - label="银行账号"
829   - // disabled={mainInfoDisbled}
830   - placeholder="请输入银行账号"
831   - />
832   - <ProFormTextArea
833   - width="lg"
834   - name="notes"
835   - label="备注"
836   - key="notes"
837   - // disabled={mainInfoDisbled}
838   - placeholder="请输入备注"
839   - rules={[
840   - {
841   - max: 120, // 最大长度为120个字符
842   - message: '备注不能超过120个字符',
843   - },
844   - ]}
845   - />
846   -
847   - <h2>商品信息</h2>
848   - <ProFormList
849   - creatorButtonProps={{ disabled: false }}
850   - name="list"
851   - label=""
852   - copyIconProps={false} //复制按钮不显示
853   - initialValue={[
854   - {
855   - productCode: '',
856   - productName: '',
857   - quantity: '',
858   - productPrice: '',
859   - parameters: '',
860   - subOrderPayment: '',
861   - },
862   - ]}
863   - actionGuard={{
864   - beforeRemoveRow: async (index) => {
865   - return new Promise((resolve) => {
866   - if (index === 0) {
867   - message.error('第一行数据不能删除');
868   - resolve(false);
869   - return;
870   - }
871   - resolve(true);
872   - });
873   - },
874   - }}
875   - itemRender={(doms, listMeta) => {
876   - if (optType('edit')) {
877   - let i = 0;
878   - let defaultFileList = listMeta.record?.listAnnex?.map((annex) => {
879   - return {
880   - uid: i++,
881   - name: annex,
882   - status: 'uploaded',
883   - url: annex,
884   - response: { data: [annex] },
885   - };
886   - });
887   - fileList[listMeta.index] = defaultFileList;
888   - }
889   - let itemFileList = fileList[listMeta.index];
890   - return (
891   - <ProCard
892   - bordered
893   - extra={doms.action}
894   - title={'商品' + (listMeta.index + 1)}
895   - style={{
896   - marginBlockEnd: 8,
897   - }}
898   - >
899   - {[
900   - <ProFormText
901   - key={'material' + listMeta.index}
902   - name="materialId"
903   - hidden
904   - ></ProFormText>,
905   - <ProFormSelect
906   - key="key"
907   - label="商品名称"
908   - width="lg"
909   - showSearch
910   - name="productName"
911   - // options={options}
912   - placeholder="请搜索商品"
913   - rules={[{ required: true, message: '商品名称必填' }]}
914   - onChange={(_, option) => {
915   - autoFillProductInfo(option, listMeta, listMeta.index);
916   - }}
917   - initialValue={{
918   - label: listMeta?.record?.productName,
919   - value: listMeta?.record?.materialId,
920   - }}
921   - fieldProps={{
922   - optionItemRender(item) {
923   - if (item.type === 'add') {
924   - return (
925   - <div title={item.name + '(新增商品信息)'}>
926   - <span style={{ color: '#333333' }}>
927   - {item.label}
928   - </span>
929   - {' | '}
930   - <span style={{ color: 'orange' }}>新增商品</span>
931   - </div>
932   - );
933   - }
934   - return (
935   - <div
936   - title={
937   - item.label +
938   - ' | ' +
939   - (item.model === undefined
940   - ? '无参数'
941   - : item.model) +
942   - ' | ' +
943   - item.base_unit_name
944   - }
945   - >
946   - <span style={{ color: '#333333' }}>
947   - {item.label}
948   - </span>
949   - {' | '}
950   - <span style={{ color: '#339999' }}>
951   - {item.model === undefined ? '无参数' : item.model}
952   - </span>
953   - {' | '}
954   - <span style={{ color: '#666666' }}>
955   - {item.base_unit_name === undefined
956   - ? '无单位'
957   - : item.base_unit_name}
958   - </span>
959   - </div>
960   - );
961   - },
962   - }}
963   - debounceTime={1000}
964   - request={async (value) => {
965   - const keywords = value.keyWords;
966   - const res = await postKingdeeRepMaterial({
967   - data: { search: keywords },
968   - });
969   - let options = res?.rows?.map((p: any) => {
970   - return {
971   - ...p,
972   - label: p.name,
973   - value: p.id + '|' + p.name,
974   - key: p.id,
975   - };
976   - });
977   -
978   - //第一个商品默认为要新增的商品
979   - if (keywords.trim() !== '') {
980   - options.unshift({
981   - productName: keywords,
982   - type: 'add',
983   - label: keywords,
984   - value: 13 + '|' + keywords,
985   - key: keywords,
986   - });
987   - }
988   - return options;
989   - }}
990   - />,
991   - <ProFormText
992   - key={'productCode' + listMeta.index}
993   - width="lg"
994   - name="productCode"
995   - disabled
996   - label={
997   - <>
998   - <span>商品编码</span>
999   - <span className="pl-2 text-xs text-gray-400">
1000   - 新增商品时,商品编码由系统自动生成
1001   - </span>
1002   - </>
1003   - }
1004   - placeholder="商品编码"
1005   - />,
1006   - // <ProFormSelect
1007   - // key="inv_stock"
1008   - // placeholder="请选择仓库"
1009   - // name="invStockId"
1010   - // width="lg"
1011   - // label="仓库"
1012   - // options={productInvStockOptionsList[listMeta.index]}
1013   - // />,
1014   - <ProFormText
1015   - key={'parameters' + listMeta.index}
1016   - width="lg"
1017   - name="parameters"
1018   - label="商品参数"
1019   - placeholder="请输入商品参数"
1020   - rules={[{ required: true, message: '商品参数必填' }]}
1021   - disabled={
1022   - productParametersDisabledFlagList[listMeta.index] !==
1023   - false
1024   - }
1025   - />,
1026   - <ProFormDigit
1027   - key={'quantity' + listMeta.index}
1028   - width="lg"
1029   - name="quantity"
1030   - label="商品数量"
1031   - fieldProps={{
1032   - onChange: (value) => {
1033   - listMeta.record.quantity = value;
1034   - computeSubOrderPayment(listMeta);
1035   - },
1036   - }}
1037   - placeholder="请输入商品数量"
1038   - rules={[{ required: true, message: '商品数量必填' }]}
1039   - />,
1040   -
1041   - <ProFormDigit
1042   - key={'productPrice' + listMeta.index}
1043   - width="lg"
1044   - name="productPrice"
1045   - label="商品单价"
1046   - fieldProps={{
1047   - onChange: (value) => {
1048   - listMeta.record.productPrice = value;
1049   - computeSubOrderPayment(listMeta);
1050   - },
1051   - }}
1052   - placeholder="请输入商品单价"
1053   - rules={[{ required: true, message: '商品单价必填' }]}
1054   - />,
1055   -
1056   - <ProFormSelect
1057   - key="unitId"
1058   - placeholder="请选择单位"
1059   - name="unitId"
1060   - width="lg"
1061   - label="单位"
1062   - showSearch
1063   - onChange={(_, option) => {
1064   - autoFillUnit(option, listMeta.index);
1065   - }}
1066   - options={productUnitOptionsList[listMeta.index]}
1067   - rules={[{ required: true, message: '商品单位必填' }]}
1068   - />,
1069   - <ProFormText
1070   - key={'unit' + listMeta.index}
1071   - width="lg"
1072   - name="unit"
1073   - label="商品单位"
1074   - placeholder="请输入商品单位"
1075   - rules={[{ required: true, message: '商品单位必填' }]}
1076   - hidden
1077   - />,
1078   -
1079   - <ProFormDigit
1080   - width="lg"
1081   - key={'subOrderPayment' + listMeta.index}
1082   - name="subOrderPayment"
1083   - label="子订单金额"
1084   - placeholder="请输入子订单金额"
1085   - tooltip="商品数量和单价变化后会自动计算子订单金额"
1086   - rules={[{ required: true, message: '子订单金额必填' }]}
1087   - />,
1088   - <ProFormSelect
1089   - key={'productBelongBusiness' + listMeta.index}
1090   - placeholder="请输入所属事业部"
1091   - name="productBelongBusiness"
1092   - width="lg"
1093   - label="所属事业部"
1094   - options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)}
1095   - initialValue={'EXPERIMENTAL_CONSUMABLES'}
1096   - rules={[{ required: true, message: '所属事业部必填' }]}
1097   - // disabled={mainInfoDisbled}
1098   - />,
1099   - <ProFormTextArea
1100   - key={'notes' + listMeta.index}
1101   - width="lg"
1102   - name="notes"
1103   - label={
1104   - <div>
1105   - <span>备注</span>
1106   - <span className="pl-2 text-xs text-gray-400">
1107   - 备注将体现在出货单上,请将需要仓管看见的信息写在备注上,例如需要开收据等信息。
1108   - </span>
1109   - </div>
1110   - }
1111   - placeholder="请输入备注"
1112   - rules={[
1113   - {
1114   - max: 120, // 最大长度为120个字符
1115   - message: '备注不能超过120个字符',
1116   - },
1117   - ]}
1118   - />,
1119   - <>
1120   - <ProFormUploadDragger
1121   - key={'filePaths' + listMeta.index}
1122   - label="附件"
1123   - name="filePaths"
1124   - action="/api/service/order/fileProcess"
1125   - fieldProps={{
1126   - headers: {
1127   - Authorization: localStorage.getItem('token'),
1128   - },
1129   - itemFileList,
1130   - }}
1131   - />
1132   - </>,
1133   - ]}
1134   - </ProCard>
1135   - );
1136   - }}
1137   - actionRef={actionRef}
1138   - ></ProFormList>
1139   - </DrawerForm>
1140   -
1141   - {kingdeeCstomerModalVisible && (
1142   - <KingdeeCustomerModal
1143   - setVisible={setKingdeeCstomerModalVisible}
1144   - data={customer}
1145   - onClose={(customerId: any) => {
1146   - setKingdeeCstomerModalVisible(false);
1147   - //回显已经新建好的客户
1148   - autoFillCustomerContactSelectOptions(customerId);
1149   - }}
1150   - />
1151   - )}
1152   - </>
1153   - );
1154   -};
src/pages/Order/WarningWhitelist/components/OrderDrawer.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postCanrdApiUserAddressList,
4   - postCanrdApiUserDetail,
5   - postCanrdApiUserNowMoneyCheck,
6   - postDistrictSelectByLevel,
7   - postDistrictSelectByNameAndLevel,
8   - postDistrictSelOrderProvince,
9   - postKingdeeRepCustomerDetail,
10   - postKingdeeRepMaterial,
11   - postKingdeeRepMaterialUnit,
12   - postKingdeeRepMeasureUnit,
13   - postPrepaidPhoneAvailableList,
14   - postServiceOrderAddOrder,
15   - postServiceOrderAfterSalesQuerySnapshotOrder,
16   - postServiceOrderApplyAfterSales,
17   - postServiceOrderApplyModify,
18   - postServiceOrderUpdateOrder,
19   -} from '@/services';
20   -import {
21   - enumToSelect,
22   - FloatAdd,
23   - FloatMul,
24   - getAliYunOSSFileNameFromUrl,
25   - getUserInfo,
26   -} from '@/utils';
27   -import { getTeacherCustomFieldNumber } from '@/utils/kingdee';
28   -import { getSalesCodeOptions } from '@/utils/order';
29   -import { getDefaultString } from '@/utils/StringUtil';
30   -import {
31   - DrawerForm,
32   - FormListActionType,
33   - ProCard,
34   - ProFormDateTimePicker,
35   - ProFormDigit,
36   - ProFormList,
37   - ProFormSelect,
38   - ProFormText,
39   - ProFormTextArea,
40   - ProFormUploadDragger,
41   -} from '@ant-design/pro-components';
42   -import { Button, Form, message, Modal } from 'antd';
43   -import { cloneDeep } from 'lodash';
44   -import { useEffect, useRef, useState } from 'react';
45   -import {
46   - AFTE_SALES_PLAN_OPTIONS,
47   - INVOCING_STATUS_OPTIONS,
48   - INVOCING_STATUS_OPTIONS_OLD,
49   - PAYEE_OPTIONS,
50   - PAYMENT_CHANNEL_OPTIONS,
51   - PAYMENT_METHOD_OPTIONS,
52   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
53   - SHIPPING_WAREHOUSE_OPTIONS,
54   -} from '../../constant';
55   -import KingdeeCustomerModal from './KingdeeCustomerModal';
56   -
57   -export default ({ onClose, data, subOrders, orderOptType }) => {
58   - const [invoicingStatus, setInvoicingStatus] = useState('');
59   - const [salesCodeOptions, setSalesCodeOptions] = useState([]);
60   - const [submitBtnLoading, setSubmitBtnLoading] = useState(false);
61   - const [drawerTitle, setDrawerTitle] = useState('');
62   - const [hasLocalData, setHasLocalData] = useState(false);
63   - // const [customer, setCustomer] = useState({});
64   - const [localSaveLoading, setLocalSaveLoading] = useState(false);
65   - const [kingdeeCstomerModalVisible, setKingdeeCstomerModalVisible] =
66   - useState(false);
67   - const [paymentMethod, setPaymentMethod] = useState('');
68   - const [customerRequestCount, setCustomerRequestCount] = useState(0);
69   - const [
70   - productParametersDisabledFlagList,
71   - setProductParametersDisabledFlagList,
72   - ] = useState([]);
73   - // const [productInvStockOptionsList, setProductInvStockOptionsList] = useState(
74   - // [],
75   - // ); //商品的仓库选项
76   - const [productUnitOptionsList, setProductUnitOptionsList] = useState([]); //商品的单位选项
77   - //省市区
78   - const [province, setProvince] = useState('');
79   - const [city, setCity] = useState('');
80   - const [district, setDistrict] = useState('');
81   - // const [productCustomerContactOptions, setProductCustomerContactOptions] =
82   - // useState([]); //客户的收货人选项
83   - const [form] = Form.useForm<{
84   - isLocalData: boolean;
85   - salesCode: '';
86   - customerName: '';
87   - customerContactNumber: '';
88   - institution: '';
89   - institutionContactName: '';
90   - customerShippingAddress: '';
91   - totalPayment: '';
92   - paymentChannel: '';
93   - paymentMethod: '';
94   - productBelongBusiness: '';
95   - invoicingStatus: '';
96   - invoiceIdentificationNumber: '';
97   - invoicingTime: '';
98   - bank: '';
99   - bankAccountNumber: '';
100   - deleteSubOrderLists: [];
101   - filePaths: [];
102   - notes: '';
103   - invoiceFirst: boolean;
104   - list: [
105   - {
106   - productCode: '';
107   - productName: '';
108   - quantity: '';
109   - productPrice: '';
110   - parameters: '';
111   - subOrderPayment: '';
112   - unit: '';
113   - serialNumber: '';
114   - notes: '';
115   - },
116   - ];
117   - }>();
118   - const [accountOptions, setAccountOptions] = useState<any>([]);
119   -
120   - let copyData = cloneDeep(data);
121   -
122   - let originSubOrders = cloneDeep(subOrders);
123   -
124   - /**
125   - * 获取当前的操作类型boolean值
126   - * @param type 操作类型,如果与当前匹配返回true
127   - */
128   - function optType(type: string) {
129   - return orderOptType === type;
130   - }
131   -
132   - /**
133   - * 获取销售代码枚举,在复制和编辑的时候判断是否为旧的代码
134   - */
135   - const loadSalesCodeOptions = async () => {
136   - let options = await getSalesCodeOptions();
137   - setSalesCodeOptions(options);
138   -
139   - if (optType('copy') || optType('edit')) {
140   - let includeFlag = false;
141   - //销售代码校验,如果是旧的销售代码,则提示并清空
142   - for (let option of options) {
143   - if (option.value === copyData.salesCode) {
144   - includeFlag = true;
145   - }
146   - }
147   -
148   - if (!includeFlag) {
149   - form.resetFields(['salesCode']);
150   - message.warning('检测到销售代码为旧的,已清空,请重新选择');
151   - }
152   - }
153   - };
154   -
155   - /**
156   - * 选择客户后自动为收货人Select添加选项,填充课题组和单位信息
157   - * @param option 客户选项
158   - */
159   - async function autoFillCustomerContactSelectOptions(customerId: any) {
160   - //查询单位详细信息
161   - let res = await postKingdeeRepCustomerDetail({
162   - data: {
163   - id: customerId,
164   - },
165   - });
166   -
167   - //erp客户名称
168   - form.setFieldValue('erpCustomerName', res?.name);
169   -
170   - //重新设置当前option
171   - form.setFieldValue('erpCustomerId', {
172   - label: res?.name,
173   - value: res?.id,
174   - id: res?.id,
175   - });
176   -
177   - //查询客户自定义字段,课题组
178   - let entity_number = await getTeacherCustomFieldNumber();
179   -
180   - //在单位详细信息中拿到自定义字段的值
181   - let customField = res?.custom_field;
182   - if (customField) {
183   - let teacherName = customField[entity_number];
184   - //填充到课题组老师表单字段中
185   - form.setFieldValue('institutionContactName', teacherName);
186   - }
187   -
188   - //单位名称,从客户名称中获取,客户名称规则<单位名称>-<联系人名称和电话>
189   - let namePortions = res?.name?.split('-');
190   - if (namePortions && namePortions.length >= 2) {
191   - form.setFieldValue('institution', namePortions[0]);
192   - }
193   -
194   - //如果原来的收货信息没有包含在这次查询出来的收货人选项中,那么清除原来的收货人信息
195   - let existFlag = false;
196   -
197   - //填充收货人选项
198   - // let newProductCustomerContactOptions = res?.bomentity?.map((item) => {
199   - // let address =
200   - // item.contact_person + ',' + item.mobile + ',' + item.contact_address;
201   - // if (address === data.contactAddress) {
202   - // existFlag = true;
203   - // }
204   - // return { ...item, label: address, value: address };
205   - // });
206   -
207   - // setProductCustomerContactOptions(newProductCustomerContactOptions);
208   -
209   - if (!existFlag) {
210   - //清空原来的收货人信息
211   - form.setFieldValue('customerShippingAddress', undefined);
212   - form.setFieldValue('customerContactNumber', undefined);
213   - form.setFieldValue('customerName', undefined);
214   - form.setFieldValue('erpCustomerAddress', undefined);
215   - }
216   - }
217   -
218   - /**
219   - * 回显金蝶信息
220   - */
221   - // async function showKindeeInfo() {
222   - // //客户信息
223   - // if (copyData.customerId) {
224   - // //客户回显
225   - // autoFillCustomerContactSelectOptions(copyData.customerId);
226   - // }
227   -
228   - // //商品单位回显
229   - // let list = copyData?.subOrderInformationLists;
230   - // if (list) {
231   - // let newProductUnitOptionsList = [...productUnitOptionsList];
232   - // for (let i = 0; i < list.length; i++) {
233   - // newProductUnitOptionsList[i] = [
234   - // { label: list[i].unit, value: list[i].unitId },
235   - // ];
236   - // }
237   - // setProductUnitOptionsList(newProductUnitOptionsList);
238   - // }
239   - // }
240   -
241   - /**
242   - * 加载预存账号的options
243   - */
244   - async function loadAccountOptions(phone: any) {
245   - let newAccountOptions = [];
246   - //预存账号id
247   - let uid = copyData.prepaidUid;
248   - let res = await postCanrdApiUserDetail({ data: { uid: uid } });
249   - if (res && res.result === RESPONSE_CODE.SUCCESS && res.data !== null) {
250   - let uidDetail = res.data;
251   - uidDetail.value = uid;
252   - uidDetail.label = uidDetail.realName;
253   - newAccountOptions.push(uidDetail);
254   - }
255   -
256   - // 查询当前手机号允许使用的预存账号
257   - if (phone) {
258   - let res = await postPrepaidPhoneAvailableList({ data: { phone: phone } });
259   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
260   - let uidDetails = res.data;
261   - for (let detail of uidDetails) {
262   - detail.value = detail.uid;
263   - detail.label = detail.realName;
264   - newAccountOptions.push(detail);
265   - }
266   - }
267   - }
268   -
269   - console.log(newAccountOptions);
270   - setAccountOptions(newAccountOptions);
271   - }
272   -
273   - /**
274   - * 构建回显数据
275   - */
276   - function buildOrderData() {
277   - // let mainInfoDisbled = optType('edit');
278   - if (!optType('add')) {
279   - if (subOrders !== undefined && subOrders.length > 0) {
280   - copyData.subOrderInformationLists = subOrders;
281   - }
282   -
283   - //如果是复制,需要开票,不回显是否需要开票字段
284   - if (optType('copy')) {
285   - if (copyData.invoicingStatus === 'INVOICED') {
286   - copyData.invoicingStatus = undefined;
287   -
288   - //复制的时候,如果是不需要开票,要把开票信息清空
289   - if (copyData.invoicingStatus === 'UN_INVOICE') {
290   - copyData.invoiceIdentificationNumber = undefined;
291   - }
292   - }
293   - }
294   - //主订单事业部默认显示子订单第一条的事业部
295   - copyData.productBelongBusiness =
296   - copyData.subOrderInformationLists[0].productBelongBusiness;
297   - copyData.paymentMethod =
298   - copyData.subOrderInformationLists[0].paymentMethod;
299   - copyData.paymentChannel =
300   - copyData.subOrderInformationLists[0].paymentChannel;
301   - copyData.invoicingStatus =
302   - copyData.subOrderInformationLists[0].invoicingStatus;
303   -
304   - copyData.customerNameString = copyData.customerName;
305   -
306   - setPaymentMethod(copyData.paymentMethod);
307   -
308   - //子订单数据处理:子订单在表单中的命名为list
309   - let i = 0;
310   - let newList = copyData.subOrderInformationLists?.map((item) => {
311   - item.filePaths = item.listAnnex?.map((path) => {
312   - return {
313   - uid: i++,
314   - name: getAliYunOSSFileNameFromUrl(path),
315   - status: 'uploaded',
316   - url: path,
317   - response: { data: [path] },
318   - };
319   - });
320   - return item;
321   - });
322   -
323   - copyData['list'] = newList;
324   -
325   - //发货仓库处理
326   - for (let listItem of copyData.list) {
327   - if (listItem.shippingWarehouse === null) {
328   - listItem.shippingWarehouse = 'DALANG_WAREHOUSE';
329   - }
330   - }
331   - setInvoicingStatus(copyData.invoicingStatus);
332   - form.setFieldsValue({ ...copyData });
333   - //如果是新建,需要清空list
334   - if (optType('add')) {
335   - form.resetFields(['list']);
336   - }
337   -
338   - if (!optType('after-sales-check')) {
339   - // showKindeeInfo();
340   - }
341   -
342   - loadAccountOptions(form.getFieldValue('customerContactNumber'));
343   - }
344   - }
345   -
346   - /**
347   - * 获取旧订单信息
348   - * @param id
349   - */
350   - async function getOldOrderData(id: any) {
351   - let res = await postServiceOrderAfterSalesQuerySnapshotOrder({
352   - data: {
353   - mainOrderId: id,
354   - },
355   - });
356   -
357   - copyData = res.data.mainOrder;
358   - copyData.subOrderInformationLists = res.data.subOrders;
359   - originSubOrders = res.data.subOrders;
360   -
361   - //客户显示
362   - form.setFieldValue('erpCustomerId', {
363   - label: copyData.erpCustomerName,
364   - value: copyData.customerId,
365   - });
366   -
367   - buildOrderData();
368   - }
369   -
370   - /**
371   - *
372   - * @returns 获取开票选项
373   - */
374   - function getInvoicingSelect() {
375   - if (optType('edit') || optType('after-sales-check')) {
376   - return enumToSelect(INVOCING_STATUS_OPTIONS_OLD);
377   - }
378   - return enumToSelect(INVOCING_STATUS_OPTIONS);
379   - }
380   -
381   - const fileList: any = [];
382   -
383   - useEffect(() => {
384   - //弹窗标题
385   - if (optType('add')) {
386   - setDrawerTitle('新增订单');
387   - }
388   - if (optType('copy')) {
389   - setDrawerTitle('复制订单');
390   - }
391   - if (optType('edit')) {
392   - setDrawerTitle('修改订单');
393   - }
394   - if (optType('after-sales')) {
395   - setDrawerTitle('申请售后');
396   - }
397   - if (optType('after-sales-check')) {
398   - setDrawerTitle('订单信息');
399   - }
400   - if (optType('order-change-normal')) {
401   - setDrawerTitle('申请修改');
402   - }
403   - }, []);
404   -
405   - const actionRef = useRef<
406   - FormListActionType<{
407   - name: string;
408   - }>
409   - >();
410   -
411   - useEffect(() => {
412   - form.setFieldsValue({ ...data });
413   - //如果是新建,需要清空list
414   - if (optType('add')) {
415   - form.resetFields(['list']);
416   - }
417   - }, [data]);
418   -
419   - /**
420   - * 所属部门修改事件
421   - * 如果选择实验耗材事业部,那么发货仓库默认是大朗仓库
422   - * @param val
423   - */
424   - function productBelongBusinessChange(val: any, index: any) {
425   - if (val === 'EXPERIMENTAL_CONSUMABLES') {
426   - let list = form.getFieldValue('list');
427   - let currentData = list[index];
428   - if (currentData) {
429   - currentData.shippingWarehouse = 'DALANG_WAREHOUSE';
430   - form.setFieldValue('list', list);
431   - message.info('已默认选择大朗仓库');
432   - }
433   - }
434   - }
435   -
436   - /**
437   - *
438   - * @param option 商品名称所对应的商品数据
439   - * @param currentRowData list中当前行的数据
440   - */
441   - async function autoFillProductInfo(
442   - option: any,
443   - currentRowData: any,
444   - index: any,
445   - ) {
446   - let newProductParametersDisabledFlagList = [
447   - ...productParametersDisabledFlagList,
448   - ];
449   - let newProductUnitOptionsList = [...productUnitOptionsList];
450   - newProductUnitOptionsList[index] = [];
451   -
452   - //是新增商品
453   - if (option.type === 'add') {
454   - //商品参数开放权限可以编辑
455   - newProductParametersDisabledFlagList[index] = false;
456   -
457   - //清空商品信息
458   - let copyList = form.getFieldValue('list');
459   - let currentData = copyList[index];
460   - currentData.productCode = undefined;
461   - currentData.parameters = undefined;
462   - currentData.unit = undefined;
463   - currentData.subOrderPayment = undefined;
464   - currentData.quantity = undefined;
465   - currentData.notes = undefined;
466   - currentData.productPrice = undefined;
467   -
468   - currentData.unitId = undefined;
469   - currentData.materialId = undefined;
470   - form.setFieldValue('list', copyList);
471   -
472   - //todo 查询计量单价列表
473   - if (false) {
474   - let res = await postKingdeeRepMeasureUnit({ data: {} });
475   - if (res && res?.rows) {
476   - for (let row of res?.rows) {
477   - newProductUnitOptionsList[index].push({
478   - label: row.name,
479   - value: row.id,
480   - });
481   - }
482   - }
483   - }
484   - } else {
485   - //选择的是已有的商品,进行内容自动填充
486   - let copyList = form.getFieldValue('list');
487   - let currentData = copyList[index];
488   - currentData.productCode = option?.number;
489   - currentData.parameters = option?.model;
490   - currentData.unit = option?.base_unit_name;
491   -
492   - //商品id
493   - currentData.materialId = option?.id;
494   -
495   - //单位
496   - currentData.unit = option.base_unit_name;
497   - currentData.unitId = option.base_unit_id;
498   -
499   - form.setFieldValue('list', copyList);
500   -
501   - //商品所在的仓库选项填充
502   - // let res = await postKingdeeRepMaterialStock({
503   - // data: {
504   - // material_id: option.id,
505   - // },
506   - // });
507   - // let newProductInvStockOptionsList = [...productInvStockOptionsList];
508   - // newProductInvStockOptionsList[index] = res?.rows?.map((item) => {
509   - // return { label: item.inv_stock, value: item.inv_stock_id };
510   - // });
511   - // setProductInvStockOptionsList(newProductInvStockOptionsList);
512   -
513   - //商品单位填充,查询商品单位列表
514   - let res = await postKingdeeRepMaterialUnit({
515   - data: { material_id: option.id },
516   - });
517   - if (res && res.rows) {
518   - for (let row of res.rows) {
519   - newProductUnitOptionsList[index].push({
520   - label: row.unit_name,
521   - value: row.unit_id,
522   - });
523   - }
524   - }
525   - //商品参数不允许编辑
526   - newProductParametersDisabledFlagList[index] = true;
527   - }
528   -
529   - setProductParametersDisabledFlagList(newProductParametersDisabledFlagList);
530   - setProductUnitOptionsList(newProductUnitOptionsList);
531   - }
532   -
533   - /**
534   - * 选择收货人后自动填充信息
535   - * @param option 收货人信息
536   - */
537   - async function autoFillCustomerInfo(option: any) {
538   - if (option === undefined || option === null || option.type === 'add') {
539   - form.setFieldValue('customerShippingAddress', undefined);
540   - form.setFieldValue('customerContactNumber', undefined);
541   - form.setFieldValue('institution', undefined);
542   - form.setFieldValue('institutionContactName', undefined);
543   - form.setFieldValue('customerShippingAddress', undefined);
544   -
545   - if (option !== undefined && option !== null) {
546   - form.setFieldValue('customerNameString', option.name);
547   - }
548   - } else {
549   - form.setFieldValue('customerShippingAddress', option.fullAddress);
550   - form.setFieldValue('customerContactNumber', option.phone);
551   - form.setFieldValue('institution', option.institution);
552   - form.setFieldValue(
553   - 'institutionContactName',
554   - option.institutionContactName,
555   - );
556   - form.setFieldValue(
557   - 'customerShippingAddress',
558   - getDefaultString(option.province) +
559   - getDefaultString(option.city) +
560   - getDefaultString(option.district) +
561   - getDefaultString(option.detail),
562   - );
563   - form.setFieldValue('customerNameString', option.realName);
564   -
565   - loadAccountOptions(option.phone);
566   - }
567   -
568   - //erp收货地址:需要与客户联系人中的地址一样:姓名,手机号,地址
569   - // form.setFieldValue('contactAddress', option.value);
570   - }
571   -
572   - /**
573   - * 填充销售代表的信息
574   - * @param option
575   - */
576   - function autoFillSalesInfo(option: any) {
577   - //销售代表对应职员编码填充
578   - form.setFieldValue('empNumber', option.number);
579   - }
580   -
581   - /**
582   - * todo 选择商品单位后自动填充
583   - * @param option
584   - * @param index
585   - */
586   - // function autoFillUnit(option: any, index: any) {
587   - // let copyList = form.getFieldValue('list');
588   - // let currentData = copyList[index];
589   - // currentData.unit = option?.label;
590   - // form.setFieldValue('list', copyList);
591   - // }
592   -
593   - /**
594   - * 计算子订单金额
595   - * @param listMeta 当前商品信息
596   - */
597   - function computeSubOrderPayment(listMeta: any) {
598   - let quantity = listMeta?.record?.quantity;
599   - let productPrice = listMeta?.record?.productPrice;
600   - quantity = quantity === '' || quantity === undefined ? 0 : quantity;
601   - productPrice =
602   - productPrice === '' || productPrice === undefined ? 0 : productPrice;
603   - quantity = parseInt(quantity);
604   - productPrice = parseFloat(productPrice);
605   -
606   - listMeta.subOrderPayment = FloatMul(quantity, productPrice);
607   - let list = form.getFieldValue('list');
608   - list[listMeta?.index].subOrderPayment = FloatMul(quantity, productPrice);
609   - form.setFieldValue('list', list);
610   - }
611   -
612   - /**
613   - * 计算支付总额
614   - */
615   - function computeTotalPayment() {
616   - let list = form.getFieldValue('list');
617   - let totalPayment = 0;
618   - list?.forEach((subOrder: any) => {
619   - let subOrderPayment = subOrder?.subOrderPayment;
620   - if (subOrderPayment !== '' && subOrderPayment !== undefined) {
621   - totalPayment = FloatAdd(subOrderPayment, totalPayment);
622   - }
623   - });
624   - form.setFieldValue('totalPayment', totalPayment);
625   - }
626   -
627   - /**
628   - * 检查用户额度
629   - * @param option
630   - */
631   - const checkAccountMoney = async (uid: any, subPrice: any) => {
632   - let res = await postCanrdApiUserNowMoneyCheck({
633   - data: { uid: uid, subPrice: subPrice },
634   - });
635   - if (res && res.result === RESPONSE_CODE.SUCCESS && res.data) {
636   - let data = res.data;
637   - let isCredit = data.isCredit;
638   - if (isCredit) {
639   - return true;
640   - }
641   -
642   - message.error(
643   - '用户余额不足,当前预减的金额为:' +
644   - data.subPrice +
645   - ',当前账号余额为:' +
646   - data.nowMoney +
647   - ',当前账号可赊账额度为:' +
648   - data.creditLimit,
649   - );
650   - return false;
651   - }
652   -
653   - return false;
654   - };
655   -
656   - /**
657   - * 总金额改变触发事件
658   - * 如果是预存单,需要检查余额
659   - * @param value
660   - */
661   - const totalPaymentChange = (value: any) => {
662   - let paymentMethod = form.getFieldValue('paymentMethod');
663   - let prepaidUid = form.getFieldValue('prepaidUid');
664   - if (
665   - value &&
666   - paymentMethod &&
667   - paymentMethod === 'WITHHOLDING_ADVANCE_DEPOSIT' &&
668   - prepaidUid
669   - ) {
670   - let valid = checkAccountMoney(prepaidUid, value);
671   - if (!valid) {
672   - form.setFieldValue('prepaidUid', undefined);
673   - }
674   - }
675   - };
676   -
677   - /**
678   - * 检查客户是否可以编辑
679   - * @returns
680   - */
681   - // const customerEditable = () => {
682   - // let erpCustomerId = form.getFieldValue('erpCustomerId');
683   - // if (
684   - // optType('after-sales-check') ||
685   - // erpCustomerId === null ||
686   - // erpCustomerId === undefined
687   - // ) {
688   - // return false;
689   - // }
690   -
691   - // return true;
692   - // };
693   -
694   - /**
695   - * 是否有草稿
696   - */
697   - function checkHasLocalData() {
698   - let preOrderData = localStorage.getItem('preOrderData');
699   - let hasLocalData =
700   - preOrderData !== null &&
701   - preOrderData !== undefined &&
702   - preOrderData !== '';
703   - setHasLocalData(hasLocalData);
704   - return hasLocalData;
705   - }
706   -
707   - /**
708   - * 保存表单数据到本地
709   - */
710   - function saveFormDataToLocal() {
711   - let preOrderData = localStorage.getItem('preOrderData');
712   - let values = form.getFieldsValue();
713   - values.isLocalData = true; //标识为本地草稿数据
714   - let formData = JSON.stringify(values);
715   -
716   - //检查本地是否已有数据
717   - if (preOrderData) {
718   - Modal.confirm({
719   - title: '提示',
720   - content: '检测到本地有订单数据,是否覆盖?',
721   - onOk: () => {
722   - localStorage.setItem('preOrderData', formData);
723   - message.success('本地保存成功');
724   - },
725   - onCancel: () => {
726   - message.info('取消保存');
727   - },
728   - });
729   - } else {
730   - localStorage.setItem('preOrderData', formData);
731   - message.success('本地保存成功');
732   - }
733   -
734   - checkHasLocalData();
735   - setLocalSaveLoading(false);
736   - }
737   -
738   - /**
739   - * 使用草稿数据
740   - */
741   - function useLocalFormData() {
742   - let preOrderData = localStorage.getItem('preOrderData');
743   - if (preOrderData) {
744   - let formData = JSON.parse(preOrderData);
745   - formData.customerName = {
746   - label: formData.customerNameString,
747   - value: formData.customerName,
748   - };
749   - console.log(formData);
750   - form.setFieldsValue(formData);
751   - setPaymentMethod(formData.paymentMethod);
752   - }
753   - }
754   -
755   - const validateContactNumber = (_: any, value: any) => {
756   - const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
757   - const phoneRegex = /^\d{1,11}(-\d{1,11})?$/;
758   -
759   - if (emailRegex.test(value) || phoneRegex.test(value)) {
760   - return Promise.resolve();
761   - }
762   - return Promise.reject(
763   - new Error('联系方式必须是邮箱或手机号格式(不能包含空格等特殊符号)'),
764   - );
765   - };
766   -
767   - /**
768   - * 刪除草稿数据
769   - */
770   - function removeLocalFormData() {
771   - localStorage.removeItem('preOrderData');
772   - }
773   -
774   - useEffect(() => {
775   - checkHasLocalData();
776   - loadSalesCodeOptions();
777   - if (optType('after-sales-check')) {
778   - getOldOrderData(data.id);
779   - } else {
780   - buildOrderData();
781   - }
782   - }, []);
783   -
784   - return (
785   - <>
786   - <DrawerForm<{
787   - isLocalData: any;
788   - deleteSubOrderLists: any;
789   - name: string;
790   - company: string;
791   - }>
792   - open
793   - width="35%"
794   - title={drawerTitle}
795   - resize={{
796   - onResize() {
797   - console.log('resize!');
798   - },
799   - maxWidth: window.innerWidth * 0.8,
800   - minWidth: 400,
801   - }}
802   - onFinishFailed={() => {
803   - message.error('表单项存在错误,请检查');
804   - setSubmitBtnLoading(false);
805   - }}
806   - submitter={{
807   - render: (props) => {
808   - return [
809   - <Button
810   - key="cancel"
811   - onClick={() => {
812   - onClose();
813   - }}
814   - >
815   - 取消
816   - </Button>,
817   - <Button
818   - key="localSave"
819   - loading={localSaveLoading}
820   - hidden={!optType('add') && !optType('copy')}
821   - onClick={() => {
822   - setLocalSaveLoading(true);
823   - saveFormDataToLocal();
824   - }}
825   - >
826   - 本地保存
827   - </Button>,
828   - <Button
829   - key="ok"
830   - type="primary"
831   - loading={submitBtnLoading}
832   - disabled={optType('after-sales-check')}
833   - onClick={() => {
834   - setSubmitBtnLoading(true);
835   - props.submit();
836   - }}
837   - >
838   - 提交
839   - </Button>,
840   - ];
841   - },
842   - }}
843   - form={form}
844   - autoFocusFirstInput
845   - drawerProps={{
846   - destroyOnClose: true,
847   - maskClosable: false,
848   - extra: [
849   - <Button
850   - key="useLocalData"
851   - hidden={!hasLocalData}
852   - type="link"
853   - onClick={() => {
854   - useLocalFormData();
855   - }}
856   - >
857   - 使用草稿
858   - </Button>,
859   - ],
860   - }}
861   - submitTimeout={2000}
862   - onFinish={async (values) => {
863   - let res = {};
864   - //附件处理
865   - let list = values.list;
866   - // console.log(list);
867   - list = list.map((item) => {
868   - item.filePaths = item.filePaths?.map((file) => {
869   - return { url: file.response.data[0] };
870   - });
871   - return item;
872   - });
873   -
874   - values.list = list;
875   - values.institution = values.institution?.trim();
876   - values.institutionContactName = values.institutionContactName?.trim();
877   - values.customerName = values.customerNameString.trim();
878   - // values.customerShippingAddress =
879   - // province + city + district + values.customerShippingAddress;
880   -
881   - if (typeof values.erpCustomerId !== 'string') {
882   - values.erpCustomerId = values.erpCustomerId?.id;
883   - }
884   - values.province = province;
885   - values.city = city;
886   - values.district = district;
887   - //新增
888   - if (optType('add') || optType('copy')) {
889   - res = await postServiceOrderAddOrder({ data: values });
890   - }
891   - //修改或者申请售后或者申请修改
892   - if (
893   - optType('edit') ||
894   - optType('after-sales') ||
895   - optType('order-change-normal')
896   - ) {
897   - //计算已删除的子订单id
898   -
899   - let originIds = [];
900   - if (originSubOrders !== undefined && originSubOrders.length > 0) {
901   - originIds = originSubOrders?.map((item) => {
902   - return item.id;
903   - });
904   - }
905   -
906   - const curIds = form.getFieldValue('list')?.map((item) => {
907   - return item.id;
908   - });
909   - let diff = originIds.filter((item) => !curIds.includes(item));
910   - values.deleteSubOrderLists = diff;
911   -
912   - if (optType('edit')) {
913   - values.province = province;
914   - values.city = city;
915   - values.district = district;
916   - res = await postServiceOrderUpdateOrder({ data: values });
917   - }
918   -
919   - values.applyType = orderOptType;
920   - if (optType('after-sales')) {
921   - values.filePaths = values.filePaths?.map((file) => {
922   - return { url: file.response.data[0] };
923   - });
924   - res = await postServiceOrderApplyAfterSales({ data: values });
925   - }
926   -
927   - if (optType('order-change-normal')) {
928   - values.filePaths = values.filePaths?.map((file) => {
929   - return { url: file.response.data[0] };
930   - });
931   - res = await postServiceOrderApplyModify({ data: values });
932   - }
933   - }
934   -
935   - if (res.result === RESPONSE_CODE.SUCCESS) {
936   - message.success(res.message);
937   - // 不返回不会关闭弹框
938   - onClose(true);
939   -
940   - //判断保存的数据是否是本地草稿,是的话将草稿删除
941   - let isLocalData = form.getFieldValue('isLocalData');
942   - if (isLocalData) {
943   - removeLocalFormData();
944   - checkHasLocalData();
945   - }
946   -
947   - return true;
948   - }
949   -
950   - setSubmitBtnLoading(false);
951   - }}
952   - onOpenChange={(val) => {
953   - return !val && onClose();
954   - }}
955   - >
956   - {optType('after-sales') ? (
957   - <>
958   - <h2>售后信息</h2>
959   - <ProFormSelect
960   - key="key"
961   - label="售后方案"
962   - width="lg"
963   - showSearch
964   - name="afterSalesPlan"
965   - options={enumToSelect(AFTE_SALES_PLAN_OPTIONS)}
966   - placeholder="请搜索"
967   - rules={[{ required: true, message: '售后方案必填' }]}
968   - ></ProFormSelect>
969   - <ProFormTextArea
970   - width="lg"
971   - label="售后原因"
972   - name="afterSalesNotes"
973   - rules={[{ required: true, message: '售后原因必填' }]}
974   - />
975   - <ProFormUploadDragger
976   - key="filePaths"
977   - label="售后附件"
978   - name="filePaths"
979   - action="/api/service/order/fileProcess"
980   - fieldProps={{
981   - headers: { Authorization: localStorage.getItem('token') },
982   - }}
983   - />
984   - </>
985   - ) : (
986   - ''
987   - )}
988   -
989   - <h2>订单基本信息</h2>
990   - <ProFormText
991   - key="id"
992   - name="id"
993   - width="lg"
994   - disabled
995   - label="id"
996   - placeholder="id"
997   - hidden
998   - />
999   - <ProFormText
1000   - key="empNumber"
1001   - name="empNumber"
1002   - width="lg"
1003   - label="销售职员编码"
1004   - placeholder="销售职员编码"
1005   - hidden
1006   - />
1007   - <ProFormSelect
1008   - name="salesCode"
1009   - key="salesCode"
1010   - width="lg"
1011   - showSearch
1012   - label="销售代表"
1013   - placeholder="请输入销售代表"
1014   - rules={[{ required: true, message: '销售代表必填' }]}
1015   - options={salesCodeOptions}
1016   - onChange={(_, option) => {
1017   - autoFillSalesInfo(option);
1018   - }}
1019   - disabled={optType('after-sales-check')}
1020   - />
1021   - <ProFormText
1022   - key="erpCustomerName"
1023   - name="erpCustomerName"
1024   - hidden
1025   - ></ProFormText>
1026   - <ProFormText
1027   - key="customerNameString"
1028   - name="customerNameString"
1029   - hidden
1030   - ></ProFormText>
1031   -
1032   - <ProFormText
1033   - key="contactAddress"
1034   - name="contactAddress"
1035   - hidden
1036   - ></ProFormText>
1037   - <ProFormSelect
1038   - key="customerName"
1039   - label="收货人"
1040   - width="lg"
1041   - showSearch
1042   - name="customerName"
1043   - placeholder="请选择收货人"
1044   - rules={[{ required: true, message: '收货人必填' }]}
1045   - onChange={(_, option) => {
1046   - autoFillCustomerInfo(option);
1047   - }}
1048   - fieldProps={{
1049   - filterOption() {
1050   - return true;
1051   - },
1052   - optionItemRender(item: any) {
1053   - if (item.type === 'add') {
1054   - return (
1055   - <div title={item.name + '(新增客户)'}>
1056   - <span style={{ color: '#333333' }}>{item.name}</span>
1057   - {' | '}
1058   - <span style={{ color: 'orange' }}>自定义</span>
1059   - </div>
1060   - );
1061   - }
1062   -
1063   - let title = '';
1064   - let realName = item.realName;
1065   - let phone = item.phone;
1066   - let province = item.province;
1067   - let city = item.city;
1068   - let district = item.district;
1069   - let detail = item.detail;
1070   - let institution = item.institution;
1071   - let institutionContactName = item.institutionContactName;
1072   -
1073   - let address =
1074   - getDefaultString(province) +
1075   - getDefaultString(city) +
1076   - getDefaultString(district) +
1077   - getDefaultString(detail);
1078   -
1079   - title =
1080   - getDefaultString(realName) +
1081   - '|' +
1082   - getDefaultString(phone) +
1083   - '|' +
1084   - getDefaultString(institution) +
1085   - '|' +
1086   - getDefaultString(institutionContactName) +
1087   - '|' +
1088   - address;
1089   -
1090   - return (
1091   - <div title={title} className="whitespace-normal">
1092   - <span style={{ color: '#333333' }}>
1093   - {getDefaultString(realName)}
1094   - </span>
1095   - |
1096   - <span className="text-sky-600">
1097   - {getDefaultString(phone)}
1098   - </span>
1099   - |
1100   - <span style={{ color: '#333333' }}>
1101   - {getDefaultString(institution)}
1102   - </span>
1103   - |
1104   - <span style={{ color: '#333333' }}>
1105   - {getDefaultString(institutionContactName)}
1106   - </span>
1107   - |<span className="text-orange-400">{address}</span>
1108   - </div>
1109   - );
1110   - },
1111   - }}
1112   - debounceTime={1000}
1113   - request={async (value, { }) => {
1114   - const keywords = value.keyWords;
1115   - if (keywords === '') {
1116   - return [];
1117   - }
1118   - const res = await postCanrdApiUserAddressList({
1119   - data: { keywords: keywords },
1120   - });
1121   - let options = res?.data?.map((c: any) => {
1122   - return {
1123   - ...c,
1124   - label: c.name,
1125   - value: c.id,
1126   - key: c.id,
1127   - };
1128   - });
1129   - console.log(form.getFieldValue('customerShippingAddress'));
1130   - console.log(form.getFieldValue('id'));
1131   - if (form.getFieldValue('id') !== undefined) {
1132   - const resp = await postDistrictSelOrderProvince({
1133   - data: form.getFieldValue('id'),
1134   - });
1135   - if (resp && resp.data) {
1136   - if (resp.data.province) {
1137   - setProvince(resp.data.province);
1138   - form.setFieldValue('province', resp.data.province);
1139   - }
1140   - if (resp.data.city) {
1141   - setCity(resp.data.city);
1142   - form.setFieldValue('city', resp.data.city);
1143   - }
1144   - if (resp.data.district) {
1145   - setDistrict(resp.data.district);
1146   - form.setFieldValue('district', resp.data.district);
1147   - }
1148   - }
1149   - console.log(form.getFieldsValue());
1150   - }
1151   - //判断如果是在修改或者复制,那么第一次请求的时候,默认生成当前收货人信息的option
1152   -
1153   - let realName = form.getFieldValue('customerName');
1154   - let detail = form.getFieldValue('customerShippingAddress');
1155   - let institution = form.getFieldValue('institution');
1156   - let institutionContactName = form.getFieldValue(
1157   - 'institutionContactNam',
1158   - );
1159   - if (customerRequestCount === 0) {
1160   - setCustomerRequestCount(1);
1161   - options.push({
1162   - label: realName,
1163   - value: realName,
1164   - key: realName,
1165   - realName: realName,
1166   - detail: detail,
1167   - institution: institution,
1168   - institutionContactName: institutionContactName,
1169   - });
1170   - }
1171   - //第一个商品默认为要新增客户
1172   - if (keywords.trim() !== '') {
1173   - options.unshift({
1174   - name: keywords,
1175   - type: 'add',
1176   - label: keywords,
1177   - value: 3.1415926,
1178   - key: keywords,
1179   - });
1180   - }
1181   -
1182   - return options;
1183   - }}
1184   - />
1185   -
1186   - <ProFormText
1187   - width="lg"
1188   - key="customerContactNumber"
1189   - name="customerContactNumber"
1190   - label="联系方式"
1191   - placeholder="请输入联系方式"
1192   - fieldProps={{
1193   - onBlur: (v) => {
1194   - loadAccountOptions(v.target.value);
1195   - },
1196   - }}
1197   - rules={[
1198   - { required: true, message: '联系方式必填' },
1199   - { validator: validateContactNumber },
1200   - ]}
1201   - />
1202   - <ProFormText
1203   - width="lg"
1204   - key="institution"
1205   - name="institution"
1206   - label="单位"
1207   - placeholder="请输入单位"
1208   - rules={[{ required: true, message: '单位必填' }]}
1209   - />
1210   - <ProFormText
1211   - width="lg"
1212   - key="institutionContactName"
1213   - name="institutionContactName"
1214   - label="课题组"
1215   - placeholder="请输入课题组"
1216   - rules={[{ required: true, message: '课题组必填' }]}
1217   - />
1218   - {/*<ProFormSelect
1219   - key={'institutionContactName'}
1220   - width="md"
1221   - showSearch
1222   - name="institutionContactName"
1223   - rules={[{ required: true, message: '请输入课题组名称!' }]}
1224   - request={async (value) => {
1225   - const keywords = value.keyWords;
1226   - const res = await postResearchGroupsNameSet({
1227   - data: {
1228   - groupName: keywords,
1229   - },
1230   - });
1231   - let options = res?.data?.map((c: any) => {
1232   - return {
1233   - label: c,
1234   - value: c,
1235   - key: c,
1236   - };
1237   - });
1238   - return options;
1239   - }}
1240   - fieldProps={{
1241   - filterOption() {
1242   - return true;
1243   - },
1244   - }}
1245   - debounceTime={1000}
1246   - label="课题组名称"
1247   - placeholder="请输入名称"
1248   - />*/}
1249   - <div
1250   - style={{
1251   - display: 'flex',
1252   - justifyContent: 'space-between',
1253   - width: 340,
1254   - }}
1255   - >
1256   - <ProFormSelect
1257   - name="province"
1258   - key="province"
1259   - width={100}
1260   - label="省"
1261   - allowClear={false}
1262   - fieldProps={{
1263   - labelInValue: true,
1264   - }}
1265   - onChange={(value) => {
1266   - console.log(value);
1267   -
1268   - if (value !== undefined || value !== null) {
1269   - console.log('setProvince');
1270   -
1271   - setProvince(value?.value);
1272   - }
1273   - }}
1274   - placeholder="请选择"
1275   - rules={[
1276   - {
1277   - required: true,
1278   - message: '请选择!',
1279   - },
1280   - ]}
1281   - request={async () => {
1282   - let province = [];
1283   - let res = await postDistrictSelectByLevel({ data: 1 });
1284   - if (res) {
1285   - res.data.forEach((item) => {
1286   - province.push({ value: item.district, label: item.district });
1287   - });
1288   - }
1289   - return province;
1290   - }}
1291   - />
1292   - <ProFormSelect
1293   - key={province}
1294   - name="city"
1295   - width={100}
1296   - label="市"
1297   - allowClear={false}
1298   - disabled={province === ''}
1299   - fieldProps={{
1300   - labelInValue: true,
1301   - }}
1302   - placeholder="请选择"
1303   - onChange={(value) => {
1304   - if (value !== undefined || value !== null) {
1305   - setCity(value?.value);
1306   - }
1307   - }}
1308   - rules={[
1309   - {
1310   - required: true,
1311   - message: '请选择!',
1312   - },
1313   - ]}
1314   - request={async () => {
1315   - let cityOptions = [];
1316   - console.log(form.getFieldValue('id'));
1317   - if (form.getFieldValue('id')) {
1318   - const resp = await postDistrictSelOrderProvince({
1319   - data: form.getFieldValue('id'),
1320   - });
1321   - if (
1322   - resp.data.province !== null &&
1323   - resp.data.province !== undefined
1324   - ) {
1325   - console.log('province is ok');
1326   - let res = await postDistrictSelectByNameAndLevel({
1327   - data: { district: resp.data.province, level: 1 },
1328   - });
1329   - if (res && res.data) {
1330   - cityOptions = res.data.map((item) => ({
1331   - value: item.district,
1332   - label: item.district,
1333   - }));
1334   - }
1335   - }
1336   - }
1337   - if (province !== '') {
1338   - console.log(province);
1339   - console.log('province is okk');
1340   - let res = await postDistrictSelectByNameAndLevel({
1341   - data: { district: province, level: 1 },
1342   - });
1343   - if (res && res.data) {
1344   - cityOptions = res.data.map((item) => ({
1345   - value: item.district,
1346   - label: item.district,
1347   - }));
1348   - }
1349   - }
1350   - return cityOptions;
1351   - }}
1352   - />
1353   - <ProFormSelect
1354   - key={city ? city.toString() : 'district'}
1355   - name="district"
1356   - width={100}
1357   - label="区"
1358   - allowClear={false}
1359   - onChange={(value) => {
1360   - if (value !== undefined || value !== null) {
1361   - setDistrict(value?.value);
1362   - }
1363   - }}
1364   - disabled={city === ''}
1365   - fieldProps={{
1366   - labelInValue: true,
1367   - }}
1368   - placeholder="请选择"
1369   - rules={[
1370   - {
1371   - required: true,
1372   - message: '请选择!',
1373   - },
1374   - ]}
1375   - request={async () => {
1376   - let districtOptions = [];
1377   - if (form.getFieldValue('id')) {
1378   - const resp = await postDistrictSelOrderProvince({
1379   - data: form.getFieldValue('id'),
1380   - });
1381   - if (resp.data.city !== null && resp.data.city !== undefined) {
1382   - let res = await postDistrictSelectByNameAndLevel({
1383   - data: { district: resp.data.city, level: 2 },
1384   - });
1385   - if (res && res.data) {
1386   - districtOptions = res.data.map((item) => ({
1387   - value: item.district,
1388   - label: item.district,
1389   - }));
1390   - }
1391   - }
1392   - }
1393   - if (city !== '') {
1394   - let res = await postDistrictSelectByNameAndLevel({
1395   - data: { district: city, level: 2 },
1396   - });
1397   - if (res && res.data) {
1398   - districtOptions = res.data.map((item) => ({
1399   - value: item.district,
1400   - label: item.district,
1401   - }));
1402   - }
1403   - }
1404   - return districtOptions;
1405   - }}
1406   - />
1407   - </div>
1408   - <ProFormTextArea
1409   - width="lg"
1410   - key="customerShippingAddress"
1411   - name="customerShippingAddress"
1412   - label="收货地址"
1413   - placeholder="请输入收货地址"
1414   - rules={[{ required: true, message: '收货地址必填' }]}
1415   - />
1416   - <div id="total-payment">
1417   - <ProFormDigit
1418   - name="totalPayment"
1419   - width="lg"
1420   - key="totalPayment"
1421   - label="支付总额(¥)"
1422   - rules={[
1423   - { required: true, message: '支付总额必填' },
1424   - {
1425   - validator: (_, value) => {
1426   - let paymentMethod = form.getFieldValue('paymentMethod');
1427   - if (
1428   - value <= 0 &&
1429   - paymentMethod &&
1430   - paymentMethod === 'WITHHOLDING_ADVANCE_DEPOSIT'
1431   - ) {
1432   - return Promise.reject(
1433   - new Error(
1434   - '支付总额必须大于0 (扣预存的订单现在也必须填写实际金额)',
1435   - ),
1436   - );
1437   - }
1438   - return Promise.resolve();
1439   - },
1440   - },
1441   - ]}
1442   - tooltip="点击计算,合计所有子订单金额"
1443   - fieldProps={{
1444   - addonAfter: (
1445   - <Button
1446   - className="rounded-l-none"
1447   - type="primary"
1448   - disabled={optType('after-sales-check')}
1449   - onClick={computeTotalPayment}
1450   - >
1451   - 计算
1452   - </Button>
1453   - ),
1454   - onChange: (value: any) => {
1455   - totalPaymentChange(value);
1456   - },
1457   - }}
1458   - disabled={optType('after-sales-check')}
1459   - />
1460   - </div>
1461   -
1462   - <ProFormSelect
1463   - placeholder="请输入支付渠道"
1464   - name="paymentChannel"
1465   - width="lg"
1466   - key="paymentChannel"
1467   - label="支付渠道"
1468   - options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)}
1469   - rules={[{ required: true, message: '支付渠道必填' }]}
1470   - disabled={optType('after-sales-check')}
1471   - />
1472   - <ProFormSelect
1473   - placeholder="请输入支付方式"
1474   - name="paymentMethod"
1475   - width="lg"
1476   - key="paymentMethod"
1477   - label="支付方式"
1478   - onChange={(val: any) => {
1479   - setPaymentMethod(val);
1480   - }}
1481   - options={enumToSelect(PAYMENT_METHOD_OPTIONS)}
1482   - rules={[{ required: true, message: '支付方式必填' }]}
1483   - disabled={optType('after-sales-check')}
1484   - />
1485   - <ProFormSelect
1486   - name="prepaidUid"
1487   - key="prepaidUid"
1488   - width="lg"
1489   - hidden={paymentMethod !== 'WITHHOLDING_ADVANCE_DEPOSIT'}
1490   - showSearch
1491   - label="预存账号"
1492   - onChange={(value: any) => {
1493   - //检查用户额度
1494   - let valid = checkAccountMoney(
1495   - value,
1496   - form.getFieldValue('totalPayment'),
1497   - );
1498   - if (!valid) {
1499   - form.setFieldValue('prepaidUid', undefined);
1500   - }
1501   - }}
1502   - placeholder="请选择预存账号"
1503   - rules={[
1504   - {
1505   - required: paymentMethod === 'WITHHOLDING_ADVANCE_DEPOSIT',
1506   - message: '支付方式为扣预存时,预存账号必填',
1507   - },
1508   - ]}
1509   - fieldProps={{
1510   - filterOption() {
1511   - return true;
1512   - },
1513   - optionItemRender(item) {
1514   - let name =
1515   - item.label +
1516   - ' | ' +
1517   - item.institution +
1518   - ' | ' +
1519   - item.nowMoney +
1520   - '¥' +
1521   - ' | ' +
1522   - item.phone;
1523   - return (
1524   - <div title={name}>
1525   - <span style={{ color: '#333333' }}>{name}</span>
1526   - </div>
1527   - );
1528   - },
1529   - }}
1530   - debounceTime={1000}
1531   - // request={async (value, {}) => {
1532   - // const keywords = value.keyWords;
1533   - // const res = await postCanrdApiUserList({
1534   - // data: { keywords: keywords, pageSize: 50 },
1535   - // });
1536   - // let options = res?.data?.data?.map((c: any) => {
1537   - // return {
1538   - // ...c,
1539   - // label: c.realName,
1540   - // value: c.uid,
1541   - // key: c.uid,
1542   - // };
1543   - // });
1544   - // return options;
1545   - // }}
1546   - options={accountOptions}
1547   - />
1548   - <ProFormSelect
1549   - placeholder="选择是否需要开票"
1550   - name="invoicingStatus"
1551   - width="lg"
1552   - key="invoicingStatus"
1553   - label="是否需要开票"
1554   - options={getInvoicingSelect()}
1555   - disabled={optType('after-sales-check')}
1556   - onChange={(_, option) => {
1557   - setInvoicingStatus(option.value);
1558   - if (option.value === 'UN_INVOICE') {
1559   - form.setFieldValue('invoiceIdentificationNumber', undefined);
1560   - form.setFieldValue('bank', undefined);
1561   - form.setFieldValue('bankAccountNumber', undefined);
1562   - form.setFieldValue('invoiceFirst', false);
1563   - }
1564   - }}
1565   - rules={[{ required: true, message: '是否需要开票必填' }]}
1566   - />
1567   - <ProFormSelect
1568   - placeholder="是否开票后发货"
1569   - name="invoiceFirst"
1570   - width="lg"
1571   - key="invoiceFirst"
1572   - label="是否开票后发货"
1573   - disabled={optType('after-sales-check')}
1574   - hidden={invoicingStatus === 'UN_INVOICE'}
1575   - options={[
1576   - {
1577   - value: true,
1578   - label: '是',
1579   - },
1580   - {
1581   - value: false,
1582   - label: '否',
1583   - },
1584   - ]}
1585   - />
1586   -
1587   - <ProFormSelect
1588   - placeholder="收款单位"
1589   - name="receivingCompany"
1590   - width="lg"
1591   - key="receivingCompany"
1592   - showSearch
1593   - label="开票收款单位"
1594   - tooltip="财务开票将依据这个字段,选择对应的公司开票"
1595   - options={enumToSelect(PAYEE_OPTIONS)}
1596   - disabled={optType('after-sales-check')}
1597   - hidden={invoicingStatus === 'UN_INVOICE'}
1598   - />
1599   -
1600   - <ProFormTextArea
1601   - width="lg"
1602   - name="invoiceIdentificationNumber"
1603   - label="开票信息"
1604   - key="invoiceIdentificationNumber"
1605   - disabled={optType('after-sales-check')}
1606   - hidden={invoicingStatus === 'UN_INVOICE'}
1607   - placeholder="请输入开票信息"
1608   - rules={[
1609   - {
1610   - required: invoicingStatus === 'UN_INVOICE' ? false : true,
1611   - message: '开票信息必填',
1612   - },
1613   - ]}
1614   - />
1615   -
1616   - {getUserInfo().roleSmallVO?.code === 'admin' ? (
1617   - <ProFormDateTimePicker
1618   - width="lg"
1619   - key="invoicingTime"
1620   - name="invoicingTime"
1621   - disabled={optType('after-sales-check')}
1622   - hidden={invoicingStatus === 'UN_INVOICE'}
1623   - label="开票时间"
1624   - placeholder="请输入开票时间"
1625   - />
1626   - ) : (
1627   - ''
1628   - )}
1629   - <ProFormText
1630   - width="lg"
1631   - name="bank"
1632   - key="bank"
1633   - label="开户银行"
1634   - disabled={optType('after-sales-check')}
1635   - hidden={invoicingStatus === 'UN_INVOICE'}
1636   - placeholder="请输入开户银行"
1637   - />
1638   - <ProFormText
1639   - width="lg"
1640   - key="bankAccountNumber"
1641   - name="bankAccountNumber"
1642   - hidden={invoicingStatus === 'UN_INVOICE'}
1643   - label="银行账号"
1644   - disabled={optType('after-sales-check')}
1645   - placeholder="请输入银行账号"
1646   - />
1647   - <ProFormTextArea
1648   - width="lg"
1649   - name="notes"
1650   - label="备注"
1651   - key="notes"
1652   - disabled={optType('after-sales-check')}
1653   - placeholder="请输入备注"
1654   - rules={[
1655   - {
1656   - max: 1000, // 最大长度为1000个字符
1657   - message: '备注不能超过1000个字符',
1658   - },
1659   - {
1660   - validator: (rule, value) => {
1661   - let totalPayment = form.getFieldValue('totalPayment');
1662   - let list = form.getFieldValue('list');
1663   - let reduce = list.reduce(
1664   - (sum, item) => FloatAdd(sum, item.subOrderPayment),
1665   - 0,
1666   - );
1667   - if (reduce === totalPayment || value) {
1668   - return Promise.resolve();
1669   - }
1670   - return Promise.reject(new Error('请填写订单金额不一致的原因'));
1671   - },
1672   - },
1673   - ]}
1674   - />
1675   -
1676   - <h2>商品信息</h2>
1677   - <ProFormList
1678   - creatorButtonProps={{ disabled: optType('after-sales-check') }}
1679   - deleteIconProps={!optType('after-sales-check')}
1680   - name="list"
1681   - label=""
1682   - copyIconProps={false} //复制按钮不显示
1683   - initialValue={[
1684   - {
1685   - productCode: '',
1686   - productName: '',
1687   - quantity: '',
1688   - productPrice: '',
1689   - parameters: '',
1690   - subOrderPayment: '',
1691   - },
1692   - ]}
1693   - actionGuard={{
1694   - beforeRemoveRow: async () => {
1695   - return new Promise((resolve) => {
1696   - let list = form.getFieldValue('list');
1697   - if (list && list.length === 1) {
1698   - message.error('至少需要保留一个商品');
1699   - resolve(false);
1700   - return;
1701   - }
1702   - resolve(true);
1703   - });
1704   - },
1705   - }}
1706   - itemRender={(doms, listMeta) => {
1707   - if (optType('edit')) {
1708   - let i = 0;
1709   - let defaultFileList = listMeta.record?.listAnnex?.map((annex) => {
1710   - return {
1711   - uid: i++,
1712   - name: annex,
1713   - status: 'uploaded',
1714   - url: annex,
1715   - response: { data: [annex] },
1716   - };
1717   - });
1718   - fileList[listMeta.index] = defaultFileList;
1719   - }
1720   - let itemFileList = fileList[listMeta.index];
1721   - return (
1722   - <ProCard
1723   - bordered
1724   - extra={doms.action}
1725   - title={'商品' + (listMeta.index + 1)}
1726   - style={{
1727   - marginBlockEnd: 8,
1728   - }}
1729   - >
1730   - {[
1731   - <ProFormText
1732   - key={'material' + listMeta.index}
1733   - name="materialId"
1734   - hidden
1735   - ></ProFormText>,
1736   - <ProFormSelect
1737   - key="key"
1738   - label="商品名称"
1739   - width="lg"
1740   - showSearch
1741   - name="productName"
1742   - disabled={optType('after-sales-check')}
1743   - placeholder="请搜索商品"
1744   - tooltip="空格将作为或条件。例如输入[极片 电池],那么查找出来的将是包含[极片]或者包含[电池]的搜索结果"
1745   - rules={[{ required: true, message: '商品名称必填' }]}
1746   - onChange={(_, option) => {
1747   - autoFillProductInfo(option, listMeta, listMeta.index);
1748   - }}
1749   - initialValue={{
1750   - label: listMeta?.record?.productName,
1751   - value: listMeta?.record?.materialId,
1752   - }}
1753   - fieldProps={{
1754   - filterOption() {
1755   - return true;
1756   - },
1757   - optionItemRender(item) {
1758   - if (item.type === 'add') {
1759   - return (
1760   - <div title={item.name + '(新增商品信息)'}>
1761   - <span style={{ color: '#333333' }}>
1762   - {item.label}
1763   - </span>
1764   - {' | '}
1765   - <span style={{ color: 'orange' }}>新增商品</span>
1766   - </div>
1767   - );
1768   - }
1769   - return (
1770   - <div
1771   - title={
1772   - item.label +
1773   - ' | ' +
1774   - (item.model === undefined
1775   - ? '无参数'
1776   - : item.model) +
1777   - ' | ' +
1778   - item.base_unit_name
1779   - }
1780   - >
1781   - <span style={{ color: '#333333' }}>
1782   - {item.label}
1783   - </span>
1784   - {' | '}
1785   - <span style={{ color: '#339999' }}>
1786   - {item.model === undefined ? '无参数' : item.model}
1787   - </span>
1788   - {' | '}
1789   - <span style={{ color: '#666666' }}>
1790   - {item.base_unit_name === undefined
1791   - ? '无单位'
1792   - : item.base_unit_name}
1793   - </span>
1794   - </div>
1795   - );
1796   - },
1797   - }}
1798   - debounceTime={1000}
1799   - request={async (value) => {
1800   - const keywords = value.keyWords;
1801   - const res = await postKingdeeRepMaterial({
1802   - data: { search: keywords },
1803   - });
1804   - console.log(res.customerShippingAddress);
1805   -
1806   - let options = res?.rows?.map((p: any) => {
1807   - return {
1808   - ...p,
1809   - label: p.name,
1810   - value: p.id + '|' + p.name,
1811   - key: p.id,
1812   - };
1813   - });
1814   -
1815   - //第一个商品默认为要新增的商品
1816   - if (keywords.trim() !== '') {
1817   - options.unshift({
1818   - productName: keywords,
1819   - type: 'add',
1820   - label: keywords,
1821   - value: 13 + '|' + keywords,
1822   - key: keywords,
1823   - });
1824   - }
1825   - return options;
1826   - }}
1827   - />,
1828   - <ProFormText
1829   - key="orderStatus"
1830   - name="orderStatus"
1831   - width="lg"
1832   - disabled
1833   - label="orderStatus"
1834   - placeholder="orderStatus"
1835   - hidden
1836   - />,
1837   - <ProFormText
1838   - key={'productCode' + listMeta.index}
1839   - width="lg"
1840   - name="productCode"
1841   - disabled
1842   - label={
1843   - <>
1844   - <span>商品编码</span>
1845   - <span className="pl-2 text-xs text-gray-400">
1846   - 新增商品时,商品编码由系统自动生成
1847   - </span>
1848   - </>
1849   - }
1850   - placeholder="未输入商品名称"
1851   - />,
1852   - // <ProFormSelect
1853   - // key="inv_stock"
1854   - // placeholder="请选择仓库"
1855   - // name="invStockId"
1856   - // width="lg"
1857   - // label="仓库"
1858   - // options={productInvStockOptionsList[listMeta.index]}
1859   - // />,
1860   - <ProFormText
1861   - key={'parameters' + listMeta.index}
1862   - width="lg"
1863   - name="parameters"
1864   - label="商品参数"
1865   - placeholder="请输入商品参数"
1866   - disabled={
1867   - productParametersDisabledFlagList[listMeta.index] !==
1868   - false || optType('after-sales-check')
1869   - }
1870   - />,
1871   - <ProFormDigit
1872   - key={'quantity' + listMeta.index}
1873   - width="lg"
1874   - name="quantity"
1875   - label="商品数量"
1876   - fieldProps={{
1877   - onChange: (value) => {
1878   - // 确保变更后的值为整数
1879   - const intValue = parseInt(value, 10);
1880   - if (!isNaN(intValue)) {
1881   - listMeta.record.quantity = intValue;
1882   - computeSubOrderPayment(listMeta);
1883   - }
1884   - },
1885   - parser: (value) => {
1886   - // 将输入的值转换为整数,如果不是合法数字则返回空字符串触发校验错误
1887   - return value ? parseInt(value, 10) : '';
1888   - },
1889   - formatter: (value) => {
1890   - // 在显示时始终将其格式化为不带小数部分的整数字符串
1891   - return value ? value.toString() : '';
1892   - },
1893   - }}
1894   - placeholder="请输入商品数量"
1895   - disabled={optType('after-sales-check')}
1896   - rules={[{ required: true, message: '商品数量必填' }]}
1897   - />,
1898   - <ProFormDigit
1899   - key={'productPrice' + listMeta.index}
1900   - width="lg"
1901   - name="productPrice"
1902   - label="商品单价"
1903   - fieldProps={{
1904   - onChange: (value) => {
1905   - listMeta.record.productPrice = value;
1906   - computeSubOrderPayment(listMeta);
1907   - },
1908   - }}
1909   - placeholder="请输入商品单价"
1910   - disabled={optType('after-sales-check')}
1911   - rules={[{ required: true, message: '商品单价必填' }]}
1912   - />,
1913   - <ProFormText
1914   - key={'unit' + listMeta.index}
1915   - width="lg"
1916   - name="unit"
1917   - label="商品单位"
1918   - placeholder="请输入商品单位"
1919   - disabled={
1920   - productParametersDisabledFlagList[listMeta.index] !==
1921   - false || optType('after-sales-check')
1922   - }
1923   - rules={[{ required: true, message: '商品单位必填' }]}
1924   - />,
1925   -
1926   - <ProFormDigit
1927   - width="lg"
1928   - key={'subOrderPayment' + listMeta.index}
1929   - name="subOrderPayment"
1930   - label="子订单金额"
1931   - placeholder="请输入子订单金额"
1932   - tooltip="商品数量和单价变化后会自动计算子订单金额"
1933   - disabled={optType('after-sales-check')}
1934   - rules={[{ required: true, message: '子订单金额必填' }]}
1935   - />,
1936   - <ProFormSelect
1937   - key={'productBelongBusiness' + listMeta.index}
1938   - placeholder="请输入所属事业部"
1939   - name="productBelongBusiness"
1940   - width="lg"
1941   - label="所属事业部"
1942   - options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)}
1943   - onChange={(val: any) => {
1944   - productBelongBusinessChange(val, listMeta.index);
1945   - }}
1946   - initialValue={'EXPERIMENTAL_CONSUMABLES'}
1947   - rules={[{ required: true, message: '所属事业部必填' }]}
1948   - disabled={optType('after-sales-check')}
1949   - />,
1950   - <ProFormSelect
1951   - key={'shippingWarehouse' + listMeta.index}
1952   - placeholder="请选择发货仓库"
1953   - name="shippingWarehouse"
1954   - width="lg"
1955   - label="发货仓库"
1956   - options={enumToSelect(SHIPPING_WAREHOUSE_OPTIONS)}
1957   - disabled={optType('after-sales-check')}
1958   - />,
1959   - <ProFormTextArea
1960   - key={'notes' + listMeta.index}
1961   - width="lg"
1962   - name="notes"
1963   - disabled={optType('after-sales-check')}
1964   - label={
1965   - <div>
1966   - <span>备注</span>
1967   - <span className="pl-2 text-xs text-gray-400">
1968   - 备注将体现在出货单上,请将需要仓管看见的信息写在备注上,例如需要开收据等信息。
1969   - </span>
1970   - </div>
1971   - }
1972   - placeholder="请输入备注"
1973   - rules={[
1974   - {
1975   - max: 1000, // 最大长度为1000个字符
1976   - message: '备注不能超过1000个字符',
1977   - },
1978   - ]}
1979   - />,
1980   - <>
1981   - <ProFormUploadDragger
1982   - key={'filePaths' + listMeta.index}
1983   - label="附件"
1984   - name="filePaths"
1985   - action="/api/service/order/fileProcess"
1986   - disabled={optType('after-sales-check')}
1987   - fieldProps={{
1988   - headers: {
1989   - Authorization: localStorage.getItem('token'),
1990   - },
1991   - itemFileList,
1992   - }}
1993   - />
1994   - </>,
1995   - ]}
1996   - </ProCard>
1997   - );
1998   - }}
1999   - actionRef={actionRef}
2000   - ></ProFormList>
2001   - </DrawerForm>
2002   - {kingdeeCstomerModalVisible && (
2003   - <KingdeeCustomerModal
2004   - setVisible={setKingdeeCstomerModalVisible}
2005   - data={customer}
2006   - onClose={(customerId: any) => {
2007   - setKingdeeCstomerModalVisible(false);
2008   - //回显已经新建好的客户
2009   - autoFillCustomerContactSelectOptions(customerId);
2010   - }}
2011   - />
2012   - )}
2013   - </>
2014   - );
2015   -};
src/pages/Order/WarningWhitelist/components/OrderNotesEditModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderNotesEdit } from '@/services';
3   -import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
4   -import { Form, message } from 'antd';
5   -export default ({ setNotesEditVisible, notes, ids, notesType, onClose }) => {
6   - const [form] = Form.useForm<{ name: string; company: string }>();
7   - return (
8   - <ModalForm<{
9   - name: string;
10   - company: string;
11   - }>
12   - width={500}
13   - open
14   - title="修改备注"
15   - form={form}
16   - autoFocusFirstInput
17   - modalProps={{
18   - okText: '保存',
19   - cancelText: '取消',
20   - destroyOnClose: true,
21   - onCancel: () => {
22   - setNotesEditVisible(false);
23   - },
24   - }}
25   - submitTimeout={2000}
26   - onFinish={async (values) => {
27   - let body = {
28   - id: ids[0],
29   - notes: values.name,
30   - notesType: notesType,
31   - };
32   - const res = await postServiceOrderNotesEdit({ data: body });
33   - if (res.result === RESPONSE_CODE.SUCCESS) {
34   - message.success(res.message);
35   - onClose();
36   - }
37   - }}
38   - onOpenChange={setNotesEditVisible}
39   - >
40   - <ProFormTextArea
41   - width="lg"
42   - name="name"
43   - initialValue={notes}
44   - placeholder="填写备注内容"
45   - />
46   - </ModalForm>
47   - );
48   -};
src/pages/Order/WarningWhitelist/components/OtherInfoModal.tsx deleted 100644 → 0
1   -import { Col, Modal, Row } from 'antd';
2   -
3   -const DeliverModal = ({ data, setVisible }) => {
4   - return (
5   - <Modal
6   - open
7   - width={900}
8   - title={'其他信息'}
9   - onOk={async () => {}}
10   - onCancel={() => {
11   - setVisible(false);
12   - }}
13   - >
14   - <Row gutter={[16, 24]}>
15   - <Col span={6}>
16   - <span className="text-[#333333]">销售申请开票附件</span>
17   - </Col>
18   - <Col span={18}>{data.customerName}</Col>
19   - <Col span={6}>
20   - <span className="className='text-[#333333]'">联系方式</span>
21   - </Col>
22   - <Col span={18}>{data.customerContactNumber}</Col>
23   -
24   - <Col span={6}>
25   - <span className="className='text-[#333333]'">收货地址</span>
26   - </Col>
27   - <Col span={18}>{data.customerShippingAddress}</Col>
28   -
29   - <Col span={6}>
30   - <span className="className='text-[#333333]'">单位联系人</span>
31   - </Col>
32   - <Col span={18}>{data.institutionContactName}</Col>
33   - <Col span={6}>
34   - <span className="className='text-[#333333]'">单位名称</span>
35   - </Col>
36   - <Col span={18}>{data.institution}</Col>
37   - <Col span={6}>
38   - <span className="className='text-[#333333]'">开户银行</span>
39   - </Col>
40   - <Col span={18}>{data.bank}</Col>
41   -
42   - <Col span={6}>
43   - <span className="className='text-[#333333]'">银行账号</span>
44   - </Col>
45   - <Col span={18}>{data.bankAccountNumber}</Col>
46   - <Col span={6}>
47   - <span className="className='text-[#333333]'">开票识别号</span>
48   - </Col>
49   - <Col span={18}>{data.invoiceIdentificationNumber}</Col>
50   - </Row>
51   - </Modal>
52   - );
53   -};
54   -
55   -export default DeliverModal;
src/pages/Order/WarningWhitelist/components/ProcureCheckModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postServiceOrderProcureCheckOrder,
4   - postServiceOrderProcureConvertWarehouseKeeper,
5   - postServiceOrderQuerySupplier,
6   -} from '@/services';
7   -import {
8   - ModalForm,
9   - ProFormSelect,
10   - ProFormTextArea,
11   -} from '@ant-design/pro-components';
12   -import { Button, Form, Input, Popconfirm, message } from 'antd';
13   -import { useState } from 'react';
14   -export default ({ setCheckVisible, isMainOrder, orders, onClose }) => {
15   - const [form] = Form.useForm<{ supplier: string }>();
16   - const [checkNotes, setCheckNotes] = useState<string>('');
17   -
18   - console.log(isMainOrder);
19   -
20   - let ids: any[] = orders.map((order: any) => order.id);
21   - async function doCheck(body: object) {
22   - const data = await postServiceOrderProcureCheckOrder({
23   - data: body,
24   - });
25   - if (data.result === RESPONSE_CODE.SUCCESS) {
26   - message.success(data.message);
27   - onClose();
28   - }
29   - }
30   -
31   - return (
32   - <ModalForm<{
33   - supplier: string;
34   - }>
35   - width={500}
36   - open
37   - title="采购审核"
38   - form={form}
39   - autoFocusFirstInput
40   - modalProps={{
41   - okText: '确认',
42   - cancelText: '取消',
43   - destroyOnClose: true,
44   - onCancel: () => {
45   - setCheckVisible(false);
46   - },
47   - }}
48   - submitter={{
49   - render: (props, defaultDoms) => {
50   - return [
51   - defaultDoms[0],
52   - <>
53   - <Popconfirm
54   - title="是否转回仓库"
55   - description={
56   - <div>
57   - <div className="py-2">
58   - <span>转回仓库后将由仓库管理员进行打印、发货</span>
59   - </div>
60   - <Input.TextArea
61   - placeholder="请填写备注"
62   - onChange={(e: any) => {
63   - setCheckNotes(e.target.value);
64   - }}
65   - rows={4}
66   - ></Input.TextArea>
67   - </div>
68   - }
69   - onConfirm={async () => {
70   - let res = await postServiceOrderProcureConvertWarehouseKeeper(
71   - {
72   - data: {
73   - subIds: ids,
74   - checkNotes: checkNotes,
75   - },
76   - },
77   - );
78   -
79   - if (res?.result === RESPONSE_CODE.SUCCESS) {
80   - message.success(res.message);
81   - onClose();
82   - return true;
83   - }
84   - }}
85   - okText="确定"
86   - cancelText="取消"
87   - >
88   - <Button type="primary">转回仓库</Button>
89   - </Popconfirm>
90   - </>,
91   - defaultDoms[1],
92   - ];
93   - },
94   - }}
95   - submitTimeout={2000}
96   - onFinish={async (values) => {
97   - if (values.supplier === '0') {
98   - message.error('选择转回仓库请点击转回仓库按钮!');
99   - return;
100   - }
101   - let procureIsPrintAndSend = true;
102   - return doCheck({
103   - ...values,
104   - subOrderIds: ids,
105   - procureIsPrintAndSend: procureIsPrintAndSend,
106   - });
107   - }}
108   - onOpenChange={setCheckVisible}
109   - >
110   - <ProFormSelect
111   - key="key"
112   - label="采购名称"
113   - width="lg"
114   - name="supplier"
115   - // options={options}
116   - placeholder="请选择采购"
117   - rules={[{ required: true, message: '采购名称必填' }]}
118   - request={async () => {
119   - const res = await postServiceOrderQuerySupplier();
120   - let options = res.data?.map((item) => {
121   - return { label: item, value: item };
122   - });
123   - options.push({ label: '转回仓库', value: '0' });
124   - return options;
125   - }}
126   - />
127   -
128   - <ProFormTextArea label="备注" name="procureNotes" key="procureNotes" />
129   - </ModalForm>
130   - );
131   -};
src/pages/Order/WarningWhitelist/components/ProcureConvertModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postServiceOrderProcureConvertProcure,
4   - postServiceOrderProcureConvertWarehouseKeeper,
5   - postServiceOrderProvideProcurementRoles,
6   -} from '@/services';
7   -import {
8   - ModalForm,
9   - ProFormSelect,
10   - ProFormTextArea,
11   -} from '@ant-design/pro-components';
12   -import { Form, message } from 'antd';
13   -export default ({ setVisible, subOrders, onClose }) => {
14   - const [form] = Form.useForm<{
15   - procureName: string;
16   - procureConvertNotes: string;
17   - }>();
18   -
19   - let subOrderIds: any[] = subOrders?.map((subOrder) => subOrder.id);
20   -
21   - return (
22   - <ModalForm<{
23   - procureName: string;
24   - procureConvertNotes: string;
25   - }>
26   - width={500}
27   - open
28   - title="采购转发"
29   - form={form}
30   - autoFocusFirstInput
31   - modalProps={{
32   - okText: '确认',
33   - cancelText: '取消',
34   - destroyOnClose: true,
35   - onCancel: () => {
36   - setVisible(false);
37   - },
38   - }}
39   - submitter={{
40   - render: (props, defaultDoms) => {
41   - return defaultDoms;
42   - },
43   - }}
44   - submitTimeout={2000}
45   - onFinish={async (values) => {
46   - let data;
47   - if (values.procureName === '仓库') {
48   - //转给仓库
49   - data = await postServiceOrderProcureConvertWarehouseKeeper({
50   - data: {
51   - subIds: subOrderIds,
52   - checkNotes: values.procureConvertNotes,
53   - },
54   - });
55   - } else {
56   - data = await postServiceOrderProcureConvertProcure({
57   - data: {
58   - procureName: values.procureName,
59   - procureConvertNotes: values.procureConvertNotes,
60   - subIds: subOrderIds,
61   - },
62   - });
63   - }
64   -
65   - if (data.result === RESPONSE_CODE.SUCCESS) {
66   - message.success(data.message);
67   - onClose();
68   - }
69   - }}
70   - onOpenChange={setVisible}
71   - >
72   - <ProFormSelect
73   - key="key"
74   - label="采购名称"
75   - width="lg"
76   - name="procureName"
77   - // options={options}
78   - placeholder="请选择采购"
79   - rules={[{ required: true, message: '采购必填' }]}
80   - request={async () => {
81   - const res = await postServiceOrderProvideProcurementRoles();
82   - let options = res.data?.map((item) => {
83   - return { label: item, value: item };
84   - });
85   - return options;
86   - }}
87   - />
88   -
89   - <ProFormTextArea
90   - key="key"
91   - label="转发备注"
92   - width="lg"
93   - name="procureConvertNotes"
94   - placeholder="请填写转发备注"
95   - />
96   - </ModalForm>
97   - );
98   -};
src/pages/Order/WarningWhitelist/components/ProcureNotesEditModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderNotesEdit } from '@/services';
3   -import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
4   -import { Form, message } from 'antd';
5   -export default ({ setNotesEditVisible, notesType, data, onClose }) => {
6   - const [form] = Form.useForm<{ procureNotes: string }>();
7   - return (
8   - <ModalForm<{
9   - procureNotes: string;
10   - }>
11   - width={500}
12   - open
13   - title="修改备注"
14   - form={form}
15   - autoFocusFirstInput
16   - modalProps={{
17   - okText: '保存',
18   - cancelText: '取消',
19   - destroyOnClose: true,
20   - onCancel: () => {
21   - setNotesEditVisible(false);
22   - },
23   - }}
24   - submitTimeout={2000}
25   - onFinish={async (values) => {
26   - let body = {
27   - id: data.id,
28   - notes: values.procureNotes,
29   - notesType: notesType,
30   - };
31   - const res = await postServiceOrderNotesEdit({ data: body });
32   - if (res.result === RESPONSE_CODE.SUCCESS) {
33   - message.success(res.message);
34   - onClose();
35   - }
36   - }}
37   - onOpenChange={setNotesEditVisible}
38   - >
39   - <ProFormTextArea
40   - width="lg"
41   - key="procureNotes"
42   - name="procureNotes"
43   - initialValue={data.procureNotes}
44   - placeholder="填写备注内容"
45   - />
46   - </ModalForm>
47   - );
48   -};
src/pages/Order/WarningWhitelist/components/ProductionTimeModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderEditProductionTime } from '@/services';
3   -import { ModalForm, ProFormDatePicker } from '@ant-design/pro-components';
4   -import { Form, message } from 'antd';
5   -
6   -// import { cloneDeep } from 'lodash';
7   -export default ({ setVisible, subOrders, onClose }) => {
8   - const [form] = Form.useForm<{
9   - productionStartTime: string;
10   - productionEndTime: string;
11   - }>();
12   - let ids = subOrders?.map((item: { id: any }) => {
13   - return item.id;
14   - });
15   - let defaultValue = {};
16   - if (subOrders && subOrders.length > 0) {
17   - defaultValue = subOrders[0];
18   - }
19   - return (
20   - <>
21   - <ModalForm<{
22   - productionStartTime: string;
23   - productionEndTime: string;
24   - }>
25   - width={500}
26   - open
27   - title="生产时间"
28   - form={form}
29   - autoFocusFirstInput
30   - initialValues={defaultValue}
31   - modalProps={{
32   - okText: '保存',
33   - cancelText: '取消',
34   - destroyOnClose: true,
35   - onCancel: () => {
36   - setVisible(false);
37   - },
38   - }}
39   - onFinish={async (values) => {
40   - if (values.productionStartTime > values.productionEndTime) {
41   - message.error('开始时间不能大于结束时间');
42   - return;
43   - }
44   - let res = await postServiceOrderEditProductionTime({
45   - data: {
46   - ...values,
47   - ids: ids,
48   - },
49   - });
50   -
51   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
52   - message.success(res.message);
53   - onClose();
54   - }
55   - }}
56   - onOpenChange={setVisible}
57   - >
58   - <span className="text-[red] leading-8">
59   - 如果选中多个子订单,将默认回显第一个子订单的生产时间
60   - </span>
61   - <ProFormDatePicker
62   - width="lg"
63   - key="productionStartTime"
64   - name="productionStartTime"
65   - label="开始时间"
66   - placeholder="请输入开始时间"
67   - rules={[{ required: true, message: '开始时间必填' }]}
68   - />
69   -
70   - <ProFormDatePicker
71   - width="lg"
72   - key="productionEndTime"
73   - name="productionEndTime"
74   - label="结束时间"
75   - placeholder="请输入结束时间"
76   - rules={[{ required: true, message: '结束时间必填' }]}
77   - />
78   - </ModalForm>
79   - </>
80   - );
81   -};
src/pages/Order/WarningWhitelist/components/ReissueModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postServiceInvoiceFindInvoice,
4   - postServiceInvoiceReissue,
5   - postServiceOrderFindServiceOrder,
6   -} from '@/services';
7   -import {
8   - ModalForm,
9   - ProFormSelect,
10   - ProFormText,
11   - ProFormTextArea,
12   -} from '@ant-design/pro-components';
13   -import { Form } from 'antd';
14   -import { useEffect, useState } from 'react';
15   -
16   -export default ({ setVisible, subOrders, onClose }) => {
17   - const [invoiceSelectList, setInvoiceSelectList] = useState([]);
18   - const [mainOrders, setMainOrders] = useState('');
19   - const [submitting, setSubmitting] = useState(false);
20   -
21   - const [form] = Form.useForm<{ invoiceId: string; notes: string }>();
22   -
23   - let getInvoiceSelectList = async () => {
24   - const res = await postServiceInvoiceFindInvoice({
25   - data: {
26   - subOrderIdIn: subOrders.map((item) => item.id),
27   - },
28   - });
29   - setInvoiceSelectList([]);
30   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
31   - let temInvoiceSelectList = [];
32   - res.data.forEach((item) => {
33   - temInvoiceSelectList.push({
34   - label: item.invoiceNumber,
35   - value: item.id,
36   - });
37   - });
38   - setInvoiceSelectList(temInvoiceSelectList);
39   - }
40   - };
41   - useEffect(() => {
42   - getInvoiceSelectList();
43   - }, []);
44   - return (
45   - <ModalForm<{
46   - invoiceId: string;
47   - notes: string;
48   - }>
49   - title="重新开票"
50   - form={form}
51   - width={500}
52   - open
53   - autoFocusFirstInput
54   - initialValues={{}}
55   - modalProps={{
56   - okText: '确认',
57   - cancelText: '取消',
58   - destroyOnClose: true,
59   - onCancel: () => {
60   - setVisible(false);
61   - },
62   - }}
63   - submitting={submitting}
64   - onFinish={async (values) => {
65   - setSubmitting(true);
66   - postServiceInvoiceReissue({
67   - data: values,
68   - });
69   - setVisible(false);
70   - onClose();
71   - }}
72   - submitTimeout={2000}
73   - >
74   - <ProFormSelect
75   - width="lg"
76   - name="invoiceId"
77   - label="选择要重新开的发票"
78   - options={invoiceSelectList}
79   - onChange={async (value) => {
80   - console.log(value);
81   - let result = await postServiceOrderFindServiceOrder({
82   - data: {
83   - invoiceId: value,
84   - },
85   - });
86   - if (result && result.result === RESPONSE_CODE.SUCCESS) {
87   - //对data里面每个元素的id用,进行拼接
88   - let map = result.data.map((item) => item.id);
89   - let str = map.join(',');
90   - setMainOrders(str);
91   - }
92   - }}
93   - />
94   - <ProFormText
95   - width="lg"
96   - name="purchaser"
97   - label="抬头名称"
98   - key="purchaser"
99   - placeholder="请输入抬头名称"
100   - rules={[{ required: true, message: '抬头名称必填' }]}
101   - />
102   - <ProFormText
103   - width="md"
104   - name="关联订单"
105   - label="发票关联订单号"
106   - readonly={true}
107   - value={mainOrders}
108   - />
109   - <ProFormTextArea
110   - width="lg"
111   - name="notes"
112   - rules={[
113   - {
114   - required: true, // 设置为必填
115   - message: '必须填写重新开票原因', // 当未填写时显示的提示信息
116   - },
117   - ]}
118   - placeholder="请填写订单重新开票的原因"
119   - />
120   - </ModalForm>
121   - );
122   -};
src/pages/Order/WarningWhitelist/components/ReissueModal_old.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import {
3   - postServiceInvoiceFindInvoiceOld,
4   - postServiceInvoiceReissueOld,
5   - postServiceOrderFindServiceOrder,
6   -} from '@/services';
7   -import {
8   - ModalForm,
9   - ProFormSelect,
10   - ProFormText,
11   - ProFormTextArea,
12   -} from '@ant-design/pro-components';
13   -import { Form } from 'antd';
14   -import { useEffect, useState } from 'react';
15   -
16   -export default ({ setVisible, mainOrder, onClose }) => {
17   - const [invoiceSelectList, setInvoiceSelectList] = useState([]);
18   - const [mainOrders, setMainOrders] = useState('');
19   - const [submitting, setSubmitting] = useState(false);
20   -
21   - const [form] = Form.useForm<{ invoiceId: string; notes: string }>();
22   -
23   - let getInvoiceSelectList = async () => {
24   - console.log(mainOrder);
25   - const res = await postServiceInvoiceFindInvoiceOld({
26   - data: {
27   - mainOrderId: mainOrder.id,
28   - },
29   - });
30   - setInvoiceSelectList([]);
31   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
32   - let temInvoiceSelectList = [];
33   - res.data.forEach((item) => {
34   - temInvoiceSelectList.push({
35   - label: item.invoiceNumber,
36   - value: item.id,
37   - });
38   - });
39   - setInvoiceSelectList(temInvoiceSelectList);
40   - }
41   - };
42   - useEffect(() => {
43   - getInvoiceSelectList();
44   - }, []);
45   - return (
46   - <ModalForm<{
47   - invoiceId: string;
48   - notes: string;
49   - }>
50   - title="重新开票(旧)"
51   - form={form}
52   - width={500}
53   - open
54   - autoFocusFirstInput
55   - initialValues={{}}
56   - modalProps={{
57   - okText: '确认',
58   - cancelText: '取消',
59   - destroyOnClose: true,
60   - onCancel: () => {
61   - setVisible(false);
62   - },
63   - }}
64   - submitting={submitting}
65   - onFinish={async (values) => {
66   - setSubmitting(true);
67   - postServiceInvoiceReissueOld({
68   - data: values,
69   - });
70   - setVisible(false);
71   - onClose();
72   - }}
73   - submitTimeout={2000}
74   - >
75   - <ProFormSelect
76   - width="lg"
77   - name="invoiceId"
78   - label="选择要重新开的发票"
79   - options={invoiceSelectList}
80   - onChange={async (value) => {
81   - console.log(value);
82   - let result = await postServiceOrderFindServiceOrder({
83   - data: {
84   - invoiceId: value,
85   - },
86   - });
87   - if (result && result.result === RESPONSE_CODE.SUCCESS) {
88   - //对data里面每个元素的id用,进行拼接
89   - let map = result.data.map((item) => item.id);
90   - let str = map.join(',');
91   - setMainOrders(str);
92   - }
93   - }}
94   - />
95   - <ProFormText
96   - width="lg"
97   - name="purchaser"
98   - label="抬头名称"
99   - key="purchaser"
100   - placeholder="请输入抬头名称"
101   - rules={[{ required: true, message: '抬头名称必填' }]}
102   - />
103   - <ProFormText
104   - width="md"
105   - name="关联订单"
106   - label="发票关联订单号"
107   - readonly={true}
108   - value={mainOrders}
109   - />
110   - <ProFormTextArea
111   - width="lg"
112   - name="notes"
113   - rules={[
114   - {
115   - required: true, // 设置为必填
116   - message: '必须填写重新开票原因', // 当未填写时显示的提示信息
117   - },
118   - ]}
119   - placeholder="请填写订单重新开票的原因"
120   - />
121   - </ModalForm>
122   - );
123   -};
src/pages/Order/WarningWhitelist/components/ShippingWarehouseChangeModal.tsx deleted 100644 → 0
1   -import { RESPONSE_CODE } from '@/constants/enum';
2   -import { postServiceOrderShippingWarehouseChange } from '@/services';
3   -import { enumToSelect } from '@/utils';
4   -import { ModalForm, ProFormSelect } from '@ant-design/pro-components';
5   -import { Form, message } from 'antd';
6   -import { SHIPPING_WAREHOUSE_OPTIONS } from '../../constant';
7   -
8   -export default ({
9   - setVisible,
10   - subOrderIds,
11   - originShippingWarehouse,
12   - onClose,
13   -}) => {
14   - const [form] = Form.useForm<{ shippingWarehouse: string }>();
15   -
16   - let newOriginShippingWarehouse = originShippingWarehouse;
17   - if (
18   - originShippingWarehouse === null ||
19   - originShippingWarehouse === undefined
20   - ) {
21   - newOriginShippingWarehouse = 'DALANG_WAREHOUSE';
22   - }
23   - return (
24   - <>
25   - <ModalForm<{
26   - shippingWarehouse: string;
27   - }>
28   - width={500}
29   - open
30   - title="修改发货仓库"
31   - form={form}
32   - autoFocusFirstInput
33   - modalProps={{
34   - okText: '保存',
35   - cancelText: '取消',
36   - destroyOnClose: true,
37   - onCancel: () => {
38   - setVisible(false);
39   - },
40   - }}
41   - onFinish={async (values) => {
42   - let res = await postServiceOrderShippingWarehouseChange({
43   - data: {
44   - ...values,
45   - ids: subOrderIds,
46   - },
47   - });
48   -
49   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
50   - message.success(res.message);
51   - }
52   - onClose();
53   - }}
54   - onOpenChange={setVisible}
55   - >
56   - <ProFormSelect
57   - key={'shippingWarehouse'}
58   - placeholder="请选择发货仓库"
59   - name="shippingWarehouse"
60   - width="lg"
61   - label="发货仓库"
62   - rules={[{ required: true, message: '发货仓库必填' }]}
63   - initialValue={newOriginShippingWarehouse}
64   - options={enumToSelect(SHIPPING_WAREHOUSE_OPTIONS)}
65   - />
66   - ,
67   - </ModalForm>
68   - </>
69   - );
70   -};
src/pages/Order/WarningWhitelist/components/UploadPayBillModal.tsx deleted 100644 → 0
1   -import { ModalForm } from '@ant-design/pro-components';
2   -import { Form, Modal, Upload, UploadFile, UploadProps, message } from 'antd';
3   -import { RcFile } from 'antd/lib/upload';
4   -import { cloneDeep } from 'lodash';
5   -import { useEffect, useRef, useState } from 'react';
6   -import { COMFIR_RECEIPT_IMAGES_NUMBER } from '../../constant';
7   -import { PlusOutlined } from '@ant-design/icons';
8   -import { transImageFile } from '@/utils';
9   -import { postServiceOrderFileProcess, postServiceOrderUploadPaymentReceipt } from '@/services';
10   -import { RESPONSE_CODE } from '@/constants/enum';
11   -
12   -// import { cloneDeep } from 'lodash';
13   -export default ({ setVisible, subOrders, mainOrder, onClose }) => {
14   - const [form] = Form.useForm();
15   - const [previewOpen, setPreviewOpen] = useState(false);
16   - const [previewImage, setPreviewImage] = useState('');
17   - const [previewTitle, setPreviewTitle] = useState('');
18   - const handleCancel = () => setPreviewOpen(false);
19   - const [fileList, setFileList] = useState<UploadFile[]>([]);
20   - const getBase64 = (file: RcFile): Promise<string> =>
21   - new Promise((resolve, reject) => {
22   - const reader = new FileReader();
23   - reader.readAsDataURL(file);
24   - reader.onload = () => resolve(reader.result as string);
25   - reader.onerror = (error) => reject(error);
26   - });
27   -
28   - const subOrderIds = subOrders?.map((item: any) => { return item.id });
29   - const fileListObj = useRef<UploadFile[]>([]); //使用引用类型,使得在useEffect里面设置监听事件后,不用更新监听事件也能保持obj与外界一致
30   - const handleBeforeUpload = (file: any) => {
31   - setFileList([...fileList, file]);
32   - return false;
33   - };
34   - const uploadButton = (
35   - <div>
36   - <PlusOutlined />
37   - <div style={{ marginTop: 8 }}>上传凭证</div>
38   - </div>
39   - );
40   - /** 粘贴快捷键的回调 */
41   - const onPaste = async (e: any) => {
42   - /** 获取剪切板的数据clipboardData */
43   - let clipboardData = e.clipboardData,
44   - i = 0,
45   - items,
46   - item,
47   - types;
48   -
49   - /** 为空判断 */
50   - if (clipboardData) {
51   - items = clipboardData.items;
52   - if (!items) {
53   - message.info('您的剪贴板中没有照片');
54   - return;
55   - }
56   -
57   - item = items[0];
58   - types = clipboardData.types || [];
59   - /** 遍历剪切板的数据 */
60   - for (; i < types.length; i++) {
61   - if (types[i] === 'Files') {
62   - item = items[i];
63   - break;
64   - }
65   - }
66   -
67   - /** 判断文件是否为图片 */
68   - if (item && item.kind === 'file' && item.type.match(/^image\//i)) {
69   - const imgItem = item.getAsFile();
70   - const newFileList = cloneDeep(fileListObj.current);
71   - let filteredArray = newFileList.filter(
72   - (obj) => obj.status !== 'removed',
73   - ); //过滤掉状态为已删除的照片
74   - const listItem = {
75   - ...imgItem,
76   - status: 'done',
77   - url: await getBase64(imgItem),
78   - originFileObj: imgItem,
79   - };
80   -
81   - if (filteredArray.length >= COMFIR_RECEIPT_IMAGES_NUMBER) {
82   - message.info('发货照片数量不能超过3');
83   - return;
84   - }
85   - fileListObj.current = filteredArray;
86   - filteredArray.push(listItem);
87   - setFileList(filteredArray);
88   - return;
89   - }
90   - }
91   -
92   - message.info('您的剪贴板中没有照片');
93   - };
94   - const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => {
95   - //fileListObj得在change里变化,change的参数是已经处理过的file数组
96   - //beforeUpload中的参数file是未处理过,还需要Base64拿到文件数据处理
97   - fileListObj.current = newFileList;
98   - setFileList(newFileList);
99   - };
100   - const handlePreview = async (file: UploadFile) => {
101   - if (!file.url && !file.preview) {
102   - file.preview = await getBase64(file.originFileObj as RcFile);
103   - }
104   - setPreviewImage(file.url || (file.preview as string));
105   - setPreviewOpen(true);
106   - setPreviewTitle(
107   - file.name ||
108   - file.originFileObj?.name ||
109   - file.url!.substring(file.url!.lastIndexOf('/') + 1),
110   - );
111   - };
112   - const props: UploadProps = {
113   - onRemove: (file) => {
114   - const index = fileList.indexOf(file);
115   - const newFileList = fileList.slice();
116   - newFileList.splice(index, 1);
117   - setFileList(newFileList);
118   - },
119   - beforeUpload: handleBeforeUpload,
120   - listType: 'picture-card',
121   - onPreview: handlePreview,
122   - fileList,
123   - onChange: handleChange,
124   - accept: 'image/png, image/jpeg, image/png',
125   - // action: '/api/service/order/fileProcess',
126   - name: 'files',
127   - headers: { Authorization: localStorage.getItem('token') },
128   - };
129   -
130   - useEffect(() => {
131   -
132   - document.addEventListener('paste', onPaste);
133   - return () => {
134   - document.removeEventListener('paste', onPaste);
135   - };
136   - }, []);
137   - return (
138   - <>
139   - <ModalForm<{
140   - filePaths: any;
141   - }>
142   - width={500}
143   - open
144   - title="回款凭证上传"
145   - form={form}
146   - autoFocusFirstInput
147   - modalProps={{
148   - okText: '提交',
149   - cancelText: '取消',
150   - destroyOnClose: true,
151   - onCancel: () => {
152   - setVisible(false);
153   - },
154   - }}
155   - onFinish={async () => {
156   - if (fileList.length <= 0) {
157   - message.error('请上传至少一张凭证');
158   - return;
159   - }
160   - message.open({
161   - type: 'loading',
162   - content: '正在上传凭证...',
163   - duration: 0,
164   - });
165   - //附件处理
166   - let formData = new FormData();
167   - //附件处理
168   - for (let file of fileList) {
169   - if (file.originFileObj) {
170   - formData.append('files', file.originFileObj as RcFile);
171   - } else {
172   - //有url的话取url(源文件),没url取thumbUrl。有url的时候thumbUrl是略缩图
173   - if (file?.url === undefined || file?.url === null) {
174   - formData.append(
175   - 'files',
176   - transImageFile(file?.thumbUrl),
177   - file?.originFileObj?.name,
178   - );
179   - } else {
180   - formData.append(
181   - 'files',
182   - transImageFile(file?.url),
183   - file?.originFileObj?.name,
184   - );
185   - }
186   - }
187   - }
188   - let res = await postServiceOrderFileProcess({
189   - data: formData,
190   - });
191   - message.destroy();
192   - if (res.result === RESPONSE_CODE.SUCCESS) {
193   - let fileUrls = res?.data?.map((item) => {
194   - return { url: item };
195   - });
196   - //财务审核
197   - const data = await postServiceOrderUploadPaymentReceipt({
198   - data: {
199   - subOrderIds: subOrderIds,
200   - filePaths: fileUrls,
201   - },
202   - });
203   - if (data.result === RESPONSE_CODE.SUCCESS) {
204   - message.success(data.message);
205   - onClose();
206   - }
207   - } else {
208   - message.success('上传失败');
209   - }
210   - onClose();
211   - }}
212   - onOpenChange={setVisible}
213   - >
214   -
215   - <div className="pb-4 text-xs decoration-gray-50">
216   - 可复制照片粘贴
217   - </div>
218   - <Upload {...props}>
219   - {fileList.length < COMFIR_RECEIPT_IMAGES_NUMBER
220   - ? uploadButton
221   - : ''}
222   - </Upload>
223   - </ModalForm>
224   -
225   - <Modal
226   - open={previewOpen}
227   - title={previewTitle}
228   - footer={null}
229   - onCancel={handleCancel}
230   - >
231   - <img alt="图片预览" style={{ width: '100%' }} src={previewImage} />
232   - </Modal>
233   - </>
234   - );
235   -};
src/pages/Order/WarningWhitelist/index.css 0 → 100644
src/pages/Order/WarningWhitelist/index.less
1   -// 嵌套表格去掉左方多余部分
2   -.order-page-container .ant-table .ant-table-middle {
3   - margin-inline: 0 !important;
4   -}
5   -
6   -.order-page-container td {
7   - font-family: 'San Francisco', 'Helvetica Neue', Helvetica, Arial,
8   - 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC',
9   - 'WenQuanYi Micro Hei', sans-serif;
10   - font-size: 13px;
11   -}
12   -
13   -//订单编辑抽屉中,订单总额addonAfter的padding去除
14   -#total-payment .ant-input-number-group-addon {
15   - padding: 0 !important;
16   -}
17   -
18   -.order-page-container table:hover,
19   -.order-page-container tr:hover,
20   -.order-page-container thead:hover {
21   - background: none !important;
22   -}
23   -
24   -#main-table .ant-table-tbody > tr.ant-table-row:hover > td {
25   - background: none !important;
26   -}
27   -
28   -.order-page-container .ant-pro-card {
29   - background-color: transparent;
30   -}
31   -
32   -#main-table .ant-table-tbody .ant-table-cell {
33   - padding: 10px 0 0;
34   -}
35   -
36   -.order-page-container .ant-pagination {
37   - background-color: #fff !important;
38   - padding: 10px;
39   - border-radius: 8px;
40   -}
41   -
42   -.order-page-container .ant-pro-table .ant-form {
43   - background-color: #fff;
44   - border-radius: 8px;
45   -}
46   -
47   -#main-table .ant-table-tbody {
48   - background-color: #f5f5f5;
49   -}
50   -
51   -.order-page-container .ant-pro-card-body {
52   - padding: 0 !important;
53   -}
54   -
55   -.order-page-container .ant-table-thead .ant-table-cell {
56   - background-color: #fff !important;
57   - border-radius: 8px !important;
58   -}
59   -
60   -#sub-table tbody td {
61   - padding: 10px 0 !important;
62   -}
63   -
64   -// 子订单第一行的上边两个角为圆角
65   -#sub-table tbody tr:first-child td:first-child {
66   - border-top-left-radius: 8px;
67   -}
68   -
69   -#sub-table tbody tr:first-child td:nth-child(2) {
70   - border-top-right-radius: 8px;
71   -}
72   -
73   -//子订单最后一行的下边两个角为圆角
74   -#sub-table tbody tr:last-child td:first-child {
75   - border-bottom-left-radius: 8px;
76   -}
77   -
78   -#sub-table tbody tr:last-child td:nth-child(2) {
79   - border-bottom-right-radius: 8px;
80   -}
81   -
82   -//子订单边线颜色
83   -#sub-table tbody tr td:first-child {
84   - border-top: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */
85   - border-bottom: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */
86   - border-left: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */
87   -}
88   -
89   -#sub-table tbody tr td:nth-child(2) {
90   - border-top: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */
91   - border-bottom: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */
92   - border-right: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */
93   -}
94   -
95   -//tooltip字体颜色自定义
96   -// .order-tooltip .ant-tooltip-inner{
97   -// color: black !important;
98   -// }
src/pages/Order/WarningWhitelist/index.tsx
1   -import ButtonConfirm from '@/components/ButtomConfirm';
2   -import { RESPONSE_CODE } from '@/constants/enum';
3   -import ImportExpressBillModal from '@/pages/Order/Order/components/ImportExpressBillModal';
4   -import InvoicingDrawerForm from '@/pages/Order/Order/components/InvoicingDrawerForm';
5   -import ReissueModal from '@/pages/Order/Order/components/ReissueModal';
6   -import ReissueModal_old from '@/pages/Order/Order/components/ReissueModal_old';
7   -import {
8   - postKingdeeRepSalBillOutbound,
9   - postKingdeeRepSalOrderSave,
10   - postServiceConstCanApplyAfterInvoicingStatus,
11   - postServiceInvoiceCancelApply,
12   - postServiceOrderCancelSend,
13   - postServiceOrderGetCurrentOptNode,
14   - postServiceOrderNoNeedSend,
15   - postServiceOrderOrderCancel,
16   - postServiceOrderProcureOrder,
17   - postServiceOrderProcurePrint,
18   - postServiceOrderProvideProcurementRoles,
19   - postServiceOrderQueryServiceOrder,
20   - postServiceOrderSaleCancelInvoicing,
21   - postServiceOrderSalesConfirm,
22   -} from '@/services';
23   -import { orderExport } from '@/services/order';
24   -import {
25   - FloatAdd,
26   - copyToClipboard,
27   - enumToProTableEnumValue,
28   - enumValueToLabel,
29   - formatDateTime,
30   - formatdate,
31   - getAliYunOSSFileNameFromUrl,
32   - isImageName,
33   -} from '@/utils';
34   -import {
35   - getReceivingCompanyOptions,
36   - isAdmin,
37   - isExaminer,
38   - isFinance,
39   - isProcure,
40   - isSales,
41   - isSupplier,
42   - isWarehousekeeper,
43   -} from '@/utils/order';
44   -import { getUserInfo } from '@/utils/user';
45   -import {
46   - ClockCircleTwoTone,
47   - ContainerTwoTone,
48   - CopyOutlined,
49   - CopyTwoTone,
50   - DownOutlined,
51   - EditTwoTone,
52   - QuestionCircleOutlined,
53   -} from '@ant-design/icons';
54 1 import {
55 2 ActionType,
  3 + ModalForm,
56 4 ProColumns,
57   - ProFormInstance,
  5 + ProFormText,
58 6 ProTable,
59 7 } from '@ant-design/pro-components';
60 8 import {
... ... @@ -74,5001 +22,308 @@ import {
74 22 Tag,
75 23 Tooltip,
76 24 message,
  25 + Tabs,
77 26 } from 'antd';
78   -import Base64 from 'base-64';
79   -import { cloneDeep } from 'lodash';
80   -import React, { Key, useEffect, useMemo, useRef, useState } from 'react';
81   -import OrderPrintModal from '../../OrderPrint/OrderPrintModal';
82   -import AfterSalesDrawer from './components/AfterSalesDrawer';
83   -import ApplyForInvoicingModal from './components/ApplyForInvoicingModal';
84   -import AttachmentModal from './components/AttachmentModal';
85   -import CheckModal from './components/CheckModal';
86   -import ConfirmReceiptModal from './components/ConfirmReceiptModal';
87   -import DeliverInfoDrawer from './components/DeliverInfoDrawer';
88   -import DeliverModal from './components/DeliverModal';
89   -import FinancialDrawer from './components/FinancialDrawer';
90   -import FinancialEditDrawer from './components/FinancialEditDrawer';
91   -import FinancialMergeDrawer from './components/FinancialMergeDrawer';
92   -import FinancialReceiptsModal from './components/FinancialReceiptsModal';
93   -import HistoryModal from './components/HistoryModal';
94   -import ImagesViewerModal from './components/ImagesViewerModal';
95   -import ImportModal from './components/ImportModal';
96   -import ModifiedDiffModal from './components/ModifiedDiffModal';
97   -import OrderDrawer from './components/OrderDrawer';
98   -import OrderNotesEditModal from './components/OrderNotesEditModal';
99   -import ProcureCheckModal from './components/ProcureCheckModal';
100   -import ProcureConvertModal from './components/ProcureConvertModal';
101   -import ProductionTimeModal from './components/ProductionTimeModal';
102   -import ShippingWarehouseChangeModal from './components/ShippingWarehouseChangeModal';
103   -import UploadPayBillModal from './components/UploadPayBillModal';
  27 +import ButtonConfirm from '@/components/ButtomConfirm';
  28 +import { RESPONSE_CODE } from '@/constants/enum';
104 29 import {
105   - AFTER_INVOICING_STATUS,
106   - CHECK_TYPE,
107   - LOGISTICS_STATUS_OPTIONS,
108   - MAIN_ORDER_COLUMNS,
109   - MODIFIED_AUDIT_STATUS_OPTIONS,
110   - ORDER_STATUS_OPTIONS,
111   - PAYEE_OPTIONS,
112   - PAYMENT_CHANNEL_OPTIONS,
113   - PAYMENT_RECEIPTS_STATUS_OPTIONS,
114   - POST_AUDIT_OPTIONS,
115   - PROCURE_ORDER_STATUS,
116   - PROCURE_PRIMARY_ORDER_STATUS_OPTIONS,
117   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
118   - SHIPPING_WAREHOUSE_OPTIONS,
119   - TAGS_COLOR,
120   - getInvoicingType,
121   - getNeedInvoicing,
122   -} from '../constant';
123   -import './index.less';
124   -import { OrderListItemType, OrderType } from './type.d';
125   -
126   -const OrderPage = () => {
127   - const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false);
128   - const [checkVisible, setCheckVisible] = useState<boolean>(false);
129   - const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false);
130   - const [allMainChecked, setAllMainChecked] = useState(false);
131   - const [imagesViewerModalVisible, setImagesViewerModalVisible] =
132   - useState<boolean>(false);
133   - const [data, setData] = useState([]); //列表数据
134   - const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false);
135   - const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] =
136   - useState<boolean>(false);
137   - const [attachmentModalVisible, setAttachmentModalVisible] =
138   - useState<boolean>(false);
139   - const [uploadPayBillModalVisible, setUploadPayBillModalVisible] =
140   - useState<boolean>(false);
141   - const [modifiedDiffModalVisible, setModifiedDiffModalVisible] =
142   - useState<boolean>(false);
143   - const [financialReceiptsModalVisible, setFinancialReceiptsModalVisible] =
144   - useState(false);
145   - const [financialVisible, setFinancialVisible] = useState<boolean>(false);
146   - const [financialEditVisible, setFinancialEditVisible] =
147   - useState<boolean>(false);
148   - const [afterSalesDrawerVisible, setAfterSalesDrawerVisible] =
149   - useState<boolean>(false);
150   - const [historyModalVisible, setHistoryModalVisible] =
151   - useState<boolean>(false);
152   - const [isRePrintOrder, setIsRePrintOrder] = useState<boolean>(false);
153   - const [isSendProduct, setIsSendProduct] = useState<boolean>(false);
154   - const [isMainOrder, setIsMainOrder] = useState<boolean>(false);
155   - const [importModalVisible, setImportModalVisible] = useState<boolean>(false);
156   - const [reissueVisible, setReissueVisible] = useState<boolean>(false);
157   - const [reissueVisibleOld, setReissueVisibleOld] = useState<boolean>(false);
158   - const [applyForInvoicingVisible, setApplyForInvoicingVisible] =
159   - useState<boolean>(false);
160   - const [procureCheckModalVisible, setProcureCheckModalVisible] =
161   - useState<boolean>(false);
162   - const [procureConvertModalVisible, setProcureConvertModalVisible] =
163   - useState<boolean>(false);
164   - const [invoicingDrawerFormVisible, setInvoicingDrawerFormVisible] =
165   - useState<boolean>(false);
166   - const [confirmReceiptVisible, setConfirmReceiptVisible] =
167   - useState<boolean>(false);
168   - const [productionTimeModalVisible, setProductionTimeModalVisible] =
169   - useState<boolean>(false);
170   - const [deliverVisible, setDeliverVisible] = useState<boolean>(false);
171   - const [deliverInfoDrawerVisible, setDeliverInfoDrawerVisible] =
172   - useState<boolean>(false);
173   - const [orderOptType, setOrderOptType] = useState<string>('');
174   - const [isEdit, setIsEdit] = useState<boolean>(false);
175   - const [expandedRowKeys] = useState<Key[]>([]);
176   - const [notesType, setNotesType] = useState(1);
177   - const [notes, setNotes] = useState(1);
178   - const [rolePath, setRolePath] = useState([]); //当前角色权限(新增跟打印按钮)
179   - const userInfo = getUserInfo();
180   - // const [tableHeight, setTableHeight] = useState(200);
181   - const [selectedRows, setSelectedRows] = useState([]);
182   - const [mainOrderIdSubOrderIdRelationsMap] = useState(new Map()); //主订单id与子订单id的对照关系,用于主订单子订单的勾选校验,子订单全选中对应的主订单自动勾选上
183   - const [selectedMainOrderKeys, setSelectedMainOrderKeys] = useState<any[]>([]);
184   - const [selectedSubOrderKeys, setSelectedSubOrderKeys] = useState<any[]>([]);
185   - const [pageSize, setPageSize] = useState(10);
186   - const [currentPage, setCurrentPage] = useState(1);
187   - const [orderCheckType, setOrderCheckType] = useState('');
188   - const [imagesViewerOptType, setImagesViewerOptType] = useState('');
189   - const [filterCondifion, setFilterCondition] = useState(0);
190   - const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据
191   - const [subOrderSelectedMap, setSubOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合
192   - const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id
193   - const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id
194   - const [subOrderCount, setSubOrderCount] = useState(0);
195   - const [sorted, setSorted] = useState(false);
196   - const mainTableRef = useRef<ActionType>();
197   - const mainTableFormRef = useRef<ProFormInstance>();
198   - let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储
199   - const [messageApi, contextHolder] = message.useMessage();
200   - const [
201   - shippingWarehouseChangeModalVisible,
202   - setShippingWarehouseChangeModalVisible,
203   - ] = useState(false);
204   - const [canApplyAfterInvoicingStatus, setCanApplyAfterInvoicingStatus] =
205   - useState([]);
206   - const [ids, setIds] = useState([]);
207   - const [recordOptNode, setRecordOptNode] = useState(null);
208   - const roleCode = userInfo?.roleSmallVO?.code;
209   - const canMergeInvoicing = useMemo(() => {
210   - if (subOrderSelectedMap.size === 0) {
211   - return false;
212   - }
213   - // 检查 value.items 中的每个元素
214   - console.log(
215   - 'map' + JSON.stringify([...subOrderSelectedMap.values()].flat()),
216   - );
217   - return [...subOrderSelectedMap.values()]
218   - .flat()
219   - .every((subItem) => subItem.paths.includes('applyInvoicing_old'));
220   - }, [selectedSubOrderKeys]);
221   -
222   - const triggerRecordOptNode = async (id) => {
223   - const res = await postServiceOrderGetCurrentOptNode({
224   - query: {
225   - id,
226   - },
227   - });
228   - setRecordOptNode(res.data);
229   - };
230   -
231   - const exportLoading = () => {
232   - messageApi.open({
233   - type: 'loading',
234   - content: '正在导出文件...',
235   - duration: 0,
236   - });
237   - };
238   -
239   - const exportLoadingDestory = () => {
240   - messageApi.destroy();
241   - };
242   -
243   - const refreshTable = () => {
244   - mainTableRef.current?.reload();
245   - //刷新表格数据的时候,取消选中行
246   - setSelectedRows([]);
247   - setSelectedSubOrderKeys([]);
248   - };
249   -
250   - /*useEffect(() => {
251   - let initAfterInvoicingStatus = async () => {
252   - const afteInvoicingStatus = await getAfterInvoicingStatus();
253   - setAfterInvoicingStatus(afteInvoicingStatus);
254   - };
255   - initAfterInvoicingStatus();
256   - }, []);*/
257   -
258   - useEffect(() => {
259   - // 使用URLSearchParams来解析查询参数
260   - const params = new URLSearchParams(location.search);
261   - const id = params.get('id');
262   - const subOrderId = params.get('subOrderId');
263   - if (id) {
264   - mainTableFormRef.current?.setFieldValue('id', id);
265   - }
266   - if (subOrderId) {
267   - mainTableFormRef.current?.setFieldValue('subOrderId', subOrderId);
268   - }
269   - }, []);
270   -
271   - useEffect(() => {
272   - const initEnum = async () => {
273   - let invoiceTypeRet = await postServiceConstCanApplyAfterInvoicingStatus();
274   - if (invoiceTypeRet.result === RESPONSE_CODE.SUCCESS) {
275   - setCanApplyAfterInvoicingStatus(invoiceTypeRet.data);
276   - }
277   - };
278   - initEnum();
279   - }, []);
280   -
281   - /**
282   - * 复制订单到剪贴板
283   - * @param record
284   - */
285   - function copyOrderToClipboard(record: any) {
286   - let text = '';
287   - text += record?.id;
288   - text += ',' + record?.salesCode;
289   - text += ',' + record?.customerName;
290   -
291   - text += ',' + record?.customerContactNumber;
292   -
293   - text += ',' + record?.customerShippingAddress;
294   -
295   - if (!isSupplier()) {
296   - text += ',' + record?.institutionContactName;
297   - text += ',' + record?.institution;
298   - }
299   - record?.subOrderInformationLists?.forEach((item) => {
300   - text += '\n';
301   - text += item?.productName;
302   - text += ' ' + item?.parameters;
303   - text += ' ' + item?.quantity;
304   - text += ' ' + item?.unit;
305   - if (!isSupplier()) {
306   - text += ' ¥' + item?.subOrderPayment;
307   - }
308   - text += ' ' + item?.id;
309   - });
310   - if (copyToClipboard(text)) {
311   - message.info('已复制到剪贴板');
312   - } else {
313   - message.info('无法复制到剪贴板');
314   - }
315   - }
316   -
317   - const MyToolTip = ({ title, content }) => {
318   - return (
319   - <Tooltip
320   - color="#FFFFFF"
321   - placement="bottom"
322   - title={<div className="px-5 py-4 text-black">{title}</div>}
323   - >
324   - {content}
325   - </Tooltip>
326   - );
327   - };
328   -
329   - /**
330   - * 检查是否可以打印
331   - * @param paths 按钮集合
332   - * @returns
333   - */
334   - function checkePrintable(paths: any) {
335   - if (
336   - !paths?.includes('printOrder') &&
337   - !paths?.includes('supplierPrint') &&
338   - !paths?.includes('procurePrint') &&
339   - !paths?.includes('rePrintOrder')
340   - ) {
341   - return false;
342   - }
343   -
344   - return true;
345   - }
346   -
347   - /**
348   - * 财务是否选中排序
349   - * @param e
350   - */
351   - function financeSorted(e: any) {
352   - let checked = e?.target.checked;
353   - setSorted(checked);
354   - refreshTable();
355   - }
356   -
357   - /**
358   - * 重置当前的操作对象
359   - */
360   - function clearOptObject() {
361   - setCurrentMainId(undefined);
362   - setCurretnOptSubId(undefined);
363   - setIsMainOrder(false);
364   - }
365   -
366   - /**
367   - * 初始化当前的操作对象
368   - * @param subId
369   - * @param mainId
370   - */
371   - function createOptObject(subId: any, mainId: any) {
372   - setCurrentMainId(mainId);
373   - setCurretnOptSubId(subId);
374   - }
375   -
376   - /**
377   - * 检查当前操作是否异常
378   - */
379   - // function checkOptValid() {
380   - // if ((currentOptMainId === undefined || currentOptMainId === null) && (curretnOptSubId === undefined || curretnOptSubId === null)) {
381   - // message.error("页面错误:当前操作对象为空,请联系系统管理员");
382   - // return false;
383   - // }
384   -
385   - // //检查数据是否存在
386   - // //主订单数据
387   - // if (!Array.from(mainOrderIdSubOrderIdRelationsMap.keys()).includes(currentOptMainId)) {
388   - // message.error("页面错误:当前操作主订单对象为空,请联系系统管理员");
389   - // }
390   -
391   - // //子订单
392   - // let allSubIds = [];
393   - // for (const idList of mainOrderIdSubOrderIdRelationsMap.values()) {
394   - // allSubIds.push(...idList);
395   - // }
396   - // if (!allSubIds.includes(curretnOptSubId)) {
397   - // message.error("页面错误:当前操作子订单对象为空,请联系系统管理员");
398   - // return false
399   - // }
400   -
401   - // return true;
402   - // }
403   -
404   - /**
405   - * 获取当前选中子订单的其中一个主订单
406   - */
407   - function getFirstMainOrder() {
408   - let mainId = [...subOrderSelectedMap.values()].flat()[0].mainOrderId;
409   - for (let item of data) {
410   - if (item.id === mainId) {
411   - return item;
412   - }
413   - }
414   -
415   - return null;
416   - }
417   -
418   - /**
419   - * 返回当前操作的主订单数据
420   - */
421   - function buildMainOrder() {
422   - if (currentOptMainId === undefined || currentOptMainId === null) {
423   - message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
424   - return;
425   - }
426   -
427   - let mainOrderClone = null;
428   - let matchedData = data.filter((item) => {
429   - return item.id === currentOptMainId;
430   - });
431   - if (matchedData.length > 0) {
432   - mainOrderClone = cloneDeep(matchedData[0]);
433   - }
434   -
435   - if (mainOrderClone === null) {
436   - message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员');
437   - }
438   -
439   - return mainOrderClone;
440   - }
441   -
442   - /**
443   - * 返回当前操作的子订单集合
444   - */
445   - function buildSubOrders() {
446   - if (currentOptMainId === undefined || currentOptMainId === null) {
447   - message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
448   - return;
449   - }
450   -
451   - let cloneSubOrders = [];
  30 + postOldInvoicingWhiteListBatchAdd,
  31 + postOldInvoicingWhiteListPage,
  32 + postOldInvoicingWhiteListRemove,
  33 +} from '@/services';
  34 +import { PlusOutlined } from '@ant-design/icons';
  35 +import { useRef } from 'react';
  36 +export const waitTimePromise = async (time: number = 100) => {
  37 + return new Promise((resolve) => {
  38 + setTimeout(() => {
  39 + resolve(true);
  40 + }, time);
  41 + });
  42 +};
452 43  
453   - //如果没有传当前操作的子订单id,说明是操作主订单
454   - if (curretnOptSubId === undefined || curretnOptSubId === null) {
455   - //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象
456   - let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId);
457   - if (
458   - currentOptSubOrders === null ||
459   - currentOptSubOrders === undefined ||
460   - currentOptSubOrders.length === 0
461   - ) {
462   - for (let item of data) {
463   - if (item.id === currentOptMainId) {
464   - for (let subOrder of item?.subOrderInformationLists) {
465   - cloneSubOrders.push(cloneDeep(subOrder));
466   - }
467   - }
468   - }
469   - } else {
470   - cloneSubOrders = currentOptSubOrders.map((item) => {
471   - return cloneDeep(item);
472   - });
473   - }
474   - } else {
475   - //操作的是子订单
476   - for (let item of data) {
477   - if (item.id === currentOptMainId) {
478   - for (let subOrder of item?.subOrderInformationLists) {
479   - if (subOrder.id === curretnOptSubId) {
480   - cloneSubOrders.push(cloneDeep(subOrder));
481   - break;
482   - }
  44 +export const waitTime = async (time: number = 100) => {
  45 + await waitTimePromise(time);
  46 +};
  47 +const warningWhitelist = () => {
  48 + const columnsAccount: ProColumns[] = [
  49 + {
  50 + title: '序号',
  51 + dataIndex: 'index',
  52 + valueType: 'indexBorder',
  53 + width: 48,
  54 + },
  55 + {
  56 + title: '销售账号',
  57 + dataIndex: 'mainOrderId',
  58 + ellipsis: true,
  59 + },
  60 + {
  61 + title: '添加人',
  62 + dataIndex: 'createByName',
  63 + hideInSearch: true,
  64 + ellipsis: true,
  65 + },
  66 + {
  67 + title: '添加时间',
  68 + valueType: 'dateTimeRange',
  69 + hideInTable: true,
  70 + search: {
  71 + transform: (value) => {
  72 + if (value) {
  73 + return {
  74 + createTimeGe: value[0],
  75 + createTimeLe: value[1],
  76 + };
483 77 }
484   - }
485   - }
486   - }
487   -
488   - if (cloneSubOrders.length === 0) {
489   - message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员');
490   - return;
491   - }
492   -
493   - return cloneSubOrders;
494   - }
495   -
496   - /**
497   - * 获取当前操作申请开票的订单总金额
498   - */
499   - function getApplyInvoicingTotalPayment() {
500   - let subOrders = isMainOrder
501   - ? [...subOrderSelectedMap.values()].flat()
502   - : buildSubOrders();
503   -
504   - let totalPayment = 0;
505   - if (subOrders && subOrders.length > 0) {
506   - let mainIds = subOrders?.map((item: any) => {
507   - return item.mainOrderId;
508   - });
509   -
510   - let uniqueMainIds = [...new Set(mainIds)];
511   -
512   - let dataMap = data.reduce((map, obj: any) => {
513   - map.set(obj.id, obj);
514   - return map;
515   - }, new Map());
516   -
517   - uniqueMainIds.forEach((id: any) => {
518   - let o = dataMap.get(id);
519   - if (o) {
520   - totalPayment = FloatAdd(totalPayment, o.totalPayment);
521   - }
522   - });
523   - }
524   - return totalPayment;
525   - }
526   -
527   - /**
528   - * 根据主订单id,将该主订单下的所有子订单取消选中
529   - */
530   - const removeSelectedSubOrderKeysByMainOrderId = (id: any) => {
531   - let currentMainOrderAllSubOrderIds =
532   - mainOrderIdSubOrderIdRelationsMap.get(id);
533   - if (currentMainOrderAllSubOrderIds) {
534   - let newSelectedSubOrderKeys = selectedSubOrderKeys.filter((item) => {
535   - return !currentMainOrderAllSubOrderIds.includes(item);
536   - });
537   - setSelectedSubOrderKeys(newSelectedSubOrderKeys);
538   - }
539   - };
540   -
541   - /**
542   - * 根据主订单id取消选中主订单
543   - * @param id
544   - */
545   - const removeSelecetMainOrderKeyByMainOrderId = (id: any) => {
546   - if (selectedMainOrderKeys.includes(id)) {
547   - let newSelectedMainOrderKeys = selectedMainOrderKeys.filter((item) => {
548   - return item !== id;
549   - });
550   - setSelectedMainOrderKeys(newSelectedMainOrderKeys);
551   - }
552   - };
553   -
554   - const onCheckboxChange = (record: never) => {
555   - let newSelectedMainOrderKeys = [];
556   - if (selectedMainOrderKeys.includes(record.id)) {
557   - newSelectedMainOrderKeys = selectedMainOrderKeys.filter(
558   - (key) => key !== record.id,
559   - );
560   - removeSelectedSubOrderKeysByMainOrderId(record.id);
561   - setSelectedRows([]);
562   -
563   - //删除选中主订单的信息
564   - mainOrderSelectedMap.delete(record.id);
565   - //删除选中主订单附属子订单的信息
566   - subOrderSelectedMap.delete(record.id);
567   - //总选中按钮取消选中
568   - setAllMainChecked(false);
569   - } else {
570   - newSelectedMainOrderKeys = [...selectedMainOrderKeys, record.id];
571   - //子订单全部自动选中
572   - let subIds = record.subOrderInformationLists?.map((item) => {
573   - return item.id;
574   - });
575   - let newSelectedSubOrderKeys = [...selectedSubOrderKeys];
576   - for (let subId of subIds) {
577   - if (!selectedSubOrderKeys.includes(subId)) {
578   - newSelectedSubOrderKeys.push(subId);
579   - }
580   - }
581   - setSelectedSubOrderKeys(newSelectedSubOrderKeys);
582   -
583   - setSelectedRows(record.subOrderInformationLists);
584   -
585   - //选中主订单
586   - mainOrderSelectedMap.set(record.id, record);
587   - //选中子订单
588   - subOrderSelectedMap.set(record.id, record.subOrderInformationLists);
589   - setSubOrderSelectedMap(new Map(subOrderSelectedMap));
590   -
591   - //如果所有主订单都勾选上了,那么勾选上总选中按钮
592   - if (
593   - mainOrderSelectedMap?.size === mainOrderIdSubOrderIdRelationsMap.size
594   - ) {
595   - setAllMainChecked(true);
596   - }
597   - }
598   - setSelectedMainOrderKeys(newSelectedMainOrderKeys);
599   - };
600   - // const handleTableExpand = (mainOrderIds: any) => {
601   - // setExpandedRowKeys(mainOrderIds);
602   - // };
603   -
604   - const allMainCheckBoxChange = () => {
605   - let checked = !allMainChecked;
606   - setAllMainChecked(checked);
607   -
608   - if (checked) {
609   - let mainOrderIds = data?.map((item) => {
610   - mainOrderSelectedMap.set(item.id, item);
611   - return item.id;
612   - });
613   -
614   - let subOrderIds = [];
615   - for (let subIdList of mainOrderIdSubOrderIdRelationsMap.values()) {
616   - subOrderIds.push(...subIdList);
617   - }
618   -
619   - if (data) {
620   - for (let item of data) {
621   - mainOrderSelectedMap.set(item.id, item);
622   -
623   - subOrderSelectedMap.set(item.id, item.subOrderInformationLists);
624   - }
625   - }
626   -
627   - setSelectedMainOrderKeys(mainOrderIds);
628   - setSelectedSubOrderKeys(subOrderIds);
629   - } else {
630   - setSelectedMainOrderKeys([]);
631   - setSelectedSubOrderKeys([]);
632   - mainOrderSelectedMap.clear();
633   - subOrderSelectedMap.clear();
634   - }
635   - };
636   -
637   - //表头渲染
638   - const OrderTableHeader = () => {
639   - return (
640   - <Flex className="w-full">
641   - <Flex className="w-[1%] ml-[7px]">
642   - <Checkbox
643   - onChange={allMainCheckBoxChange}
644   - checked={allMainChecked}
645   - ></Checkbox>
646   - </Flex>
647   - <Flex className="w-[30%] ml-[1%]">
648   - <span className="font-medium">商品信息</span>
649   - </Flex>
650   - <Flex className="w-[13%]">
651   - <span className="font-medium">交易金额</span>
652   - </Flex>
653   -
654   - {!isSupplier() ? (
655   - <>
656   - <Flex className="w-[10%]">
657   - <span className="font-medium">支付</span>
658   - </Flex>
659   - <Flex className="w-[12%]">
660   - <span className="font-medium">其他</span>
661   - </Flex>
662   - </>
663   - ) : (
664   - ''
665   - )}
666   -
667   - <Flex className="w-[10%]">
668   - <span className="font-medium">交易状态</span>
669   - </Flex>
670   - <Flex className="w-[17%]">
671   - <span className="font-medium">操作</span>
672   - </Flex>
673   - </Flex>
674   - );
675   - };
676   - //子订单内容渲染
677   - const SubOderRander = ({ record, optRecord }) => {
678   - /**
679   - * 获取订单状态标签
680   - * @param optRecord
681   - */
682   - function getOrderStatusTag(optRecord: any): import('react').ReactNode {
683   - console.log(optRecord);
684   -
685   - const orderStatus = optRecord.orderStatus;
686   - const paymentMethod = optRecord.paymentMethod;
687   - let orderStatusTagText = enumValueToLabel(
688   - optRecord.orderStatus,
689   - ORDER_STATUS_OPTIONS,
690   - );
691   -
692   - if (orderStatus === 'WAIT_CONFIRM_DELIVER_AFTER_INVOICE') {
693   - if (optRecord.afterInvoicingStatus !== 'COMPLETE_INVOICING') {
694   - orderStatusTagText = '待开票';
695   - } else {
696   - orderStatusTagText = '待确认发货';
697   - }
698   - }
699   -
700   - //如果是未审核或者领导已审核,付款状态为预付款则需要财务审核【财务待审核】,否则仓库审核【】
701   - if (orderStatus === 'UNAUDITED' || orderStatus === 'LEADER_AUDITED') {
702   - if (paymentMethod === 'PAYMENT_IN_ADVANCE') {
703   - orderStatusTagText = '财务待审核';
704   - } else {
705   - orderStatusTagText = '仓库待审核';
706   - }
707   - }
708   -
709   - //如果是财务已审核,显示为【仓库待审核】
710   - if (orderStatus === 'FINANCE_PROCESS') {
711   - orderStatusTagText = '仓库待审核';
712   - }
713   -
714   - if (orderStatus === 'AUDIT_FAILED') {
715   - return (
716   - <MyToolTip
717   - key="key"
718   - title={optRecord.checkNotes + ' ' + optRecord.postAuditNotes}
719   - content={
720   - <>
721   - <Tag
722   - color={TAGS_COLOR.get(optRecord.orderStatus)}
723   - style={{ marginRight: '4px' }}
724   - >
725   - {orderStatusTagText}
726   - </Tag>
727   - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
728   - </>
729   - }
730   - />
731   - );
732   - }
733   -
734   - if (
735   - orderStatus === 'AFTER_SALES_COMPLETION' ||
736   - orderStatus === 'IN_AFTER_SALES'
737   - ) {
738   - return (
739   - <Tag
740   - color={TAGS_COLOR.get(optRecord.orderStatus)}
741   - style={{ marginRight: '4px' }}
742   - >
743   - {orderStatusTagText}
744   - </Tag>
745   - );
746   - }
747   -
748   - if (orderStatus === 'PROCURE_CONVERT_WAREHOUSE_KEEPER') {
749   - return (
750   - <MyToolTip
751   - key="key"
752   - title={optRecord.checkNotes}
753   - content={
754   - <>
755   - <Tag
756   - color={TAGS_COLOR.get(optRecord.orderStatus)}
757   - style={{ marginRight: '4px' }}
758   - >
759   - {orderStatusTagText}
760   - </Tag>
761   - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
762   - </>
763   - }
764   - />
765   - );
766   - }
767   -
768   - return (
769   - <Tag key="key" color={TAGS_COLOR.get(optRecord.orderStatus)}>
770   - {orderStatusTagText}
771   - </Tag>
772   - );
773   - }
774   -
775   - /**
776   - * 获取后置审核状态标签
777   - * @param optRecord
778   - */
779   - function getPostAuditStatusTag(optRecord: any): import('react').ReactNode {
780   - return (
781   - <Tag key="key" color={TAGS_COLOR.get(optRecord.postAuditStatus)}>
782   - {enumValueToLabel(optRecord.postAuditStatus, POST_AUDIT_OPTIONS)}
783   - </Tag>
784   - );
785   - }
786   -
787   - //申请开票附件处理
788   - const getAfterAnnexList = () => {
789   - // let links = [];
790   - let afterAnnexList = optRecord.afterAnnexList;
791   - let i = 1;
792   - let images = [];
793   - let otherAnnex = [];
794   - if (afterAnnexList?.length > 0) {
795   - for (let url of afterAnnexList) {
796   - let name = getAliYunOSSFileNameFromUrl(url);
797   - if (isImageName(name)) {
798   - images.push({ name: name, url: url });
799   - } else {
800   - otherAnnex.push({ name: '附件' + i++, url: url });
  78 + },
  79 + },
  80 + },
  81 + {
  82 + title: '操作',
  83 + valueType: 'option',
  84 + key: 'option',
  85 + render: (text, record, _, action) => [
  86 + <ButtonConfirm
  87 + key="delete"
  88 + className="p-0"
  89 + title={'确认删除此项吗?'}
  90 + text="删除"
  91 + onConfirm={async () => {
  92 + await postOldInvoicingWhiteListRemove({
  93 + query: {
  94 + mainOrderId: record.mainOrderId,
  95 + },
  96 + });
  97 + action?.reload();
  98 + }}
  99 + />,
  100 + ],
  101 + },
  102 + ];
  103 + const columnsInvoice: ProColumns[] = [
  104 + {
  105 + title: '序号',
  106 + dataIndex: 'index',
  107 + valueType: 'indexBorder',
  108 + width: 48,
  109 + },
  110 + {
  111 + title: '订单号',
  112 + dataIndex: 'mainOrderId',
  113 + ellipsis: true,
  114 + },
  115 + {
  116 + title: '所属销售',
  117 + dataIndex: 'mainOrderId',
  118 + ellipsis: true,
  119 + hideInSearch: true,
  120 + },
  121 + {
  122 + title: '添加人',
  123 + dataIndex: 'createByName',
  124 + hideInSearch: true,
  125 + ellipsis: true,
  126 + },
  127 + {
  128 + title: '添加时间',
  129 + valueType: 'dateTimeRange',
  130 + hideInTable: true,
  131 + search: {
  132 + transform: (value) => {
  133 + if (value) {
  134 + return {
  135 + createTimeGe: value[0],
  136 + createTimeLe: value[1],
  137 + };
801 138 }
802   - }
803   - }
804   -
805   - return (
806   - <div className="pl-1">
807   - <Image.PreviewGroup
808   - className="mr-10"
809   - preview={{
810   - onChange: (current, prev) =>
811   - console.log(`current index: ${current}, prev index: ${prev}`),
812   - }}
813   - >
814   - {images.map((item, index) => (
815   - <React.Fragment key={index}>
816   - {index > 0 ? <Divider type="vertical" /> : ''}
817   - <Image
818   - className="max-h-[50px] max-w-[70px]"
819   - src={item.url}
820   - title={item.name}
821   - />{' '}
822   - </React.Fragment>
823   - ))}
824   - </Image.PreviewGroup>
825   - {otherAnnex.map((item, index) => {
826   - return (
827   - <Popconfirm
828   - title="下载或预览"
829   - key={index}
830   - onConfirm={() => {
831   - window.open(
832   - '/previewApi/onlinePreview?url=' +
833   - encodeURIComponent(Base64.encode(item.url)),
834   - );
835   - }}
836   - onCancel={() => {
837   - window.open(item.url);
838   - }}
839   - okText="预览"
840   - cancelText="下载"
841   - >
842   - <Button className="px-1" key={index} type="link">
843   - {item.name}
844   - </Button>
845   - </Popconfirm>
846   - );
847   - })}
848   - </div>
849   - );
850   - };
851   -
852   - //财务审核附件处理
853   - const getInvoicingCheckAnnexList = () => {
854   - let invoicingCheckAnnexList = optRecord.invoicingCheckAnnexList;
855   - return (
  139 + },
  140 + },
  141 + },
  142 + {
  143 + title: '操作',
  144 + valueType: 'option',
  145 + key: 'option',
  146 + render: (text, record, _, action) => [
  147 + <ButtonConfirm
  148 + key="delete"
  149 + className="p-0"
  150 + title={'确认删除此项吗?'}
  151 + text="删除"
  152 + onConfirm={async () => {
  153 + await postOldInvoicingWhiteListRemove({
  154 + query: {
  155 + mainOrderId: record.mainOrderId,
  156 + },
  157 + });
  158 + action?.reload();
  159 + }}
  160 + />,
  161 + ],
  162 + },
  163 + ];
  164 + const actionRef = useRef<ActionType>();
  165 + const tabsItems = [
  166 + {
  167 + key: 1,
  168 + label: '帐号白名单',
  169 + children: (
856 170 <div>
857   - <Image.PreviewGroup
858   - className="mr-10"
859   - preview={{
860   - onChange: (current, prev) =>
861   - console.log(`current index: ${current}, prev index: ${prev}`),
  171 + <ProTable
  172 + columns={columnsAccount}
  173 + actionRef={actionRef}
  174 + cardBordered
  175 + request={async (params) => {
  176 + const res = await postOldInvoicingWhiteListPage({
  177 + data: params,
  178 + });
  179 + return res.data;
862 180 }}
863   - >
864   - {invoicingCheckAnnexList.map((url, index) => (
865   - <React.Fragment key={index}>
866   - <Image className="max-h-[50px] max-w-[70px]" src={url} />{' '}
867   - <Divider type="vertical" />
868   - </React.Fragment>
869   - ))}
870   - </Image.PreviewGroup>
871   - </div>
872   - );
873   - };
874   -
875   - return (
876   - <>
877   - <Flex className="w-full border-b-indigo-500">
878   - <Flex vertical className="w-[31%]" gap="small">
879   - {/* 商品名称 */}
880   - <div>
881   - <div
882   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer"
883   - onClick={() => {
884   - copyToClipboard(optRecord.productName);
885   - message.info('商品名称复制成功:' + optRecord.productName);
886   - }}
887   - title={optRecord.productName}
888   - >
889   - <span className="font-medium text-black ">
890   - {optRecord.productName}
891   - </span>
892   - </div>
893   - <div className="text-xs text-[#8C8C8C]">
894   - <span
895   - className="cursor-pointer"
896   - onClick={() => {
897   - copyToClipboard(optRecord.id);
898   - message.info('子订单编号复制成功:' + optRecord.id);
899   - }}
900   - >
901   - {optRecord.id}
902   - </span>
903   - {(roleCode === 'salesRepresentative' ||
904   - roleCode === 'salesManager') &&
905   - !optRecord.isCurrentUserOrder ? (
906   - <span className="text-[#f44e4e]">(非本账号订单)</span>
907   - ) : (
908   - ''
909   - )}
910   - {optRecord.modifiedOptFlag !== null ? (
911   - <span className="text-[#f44e4e] cursor-pointer">
912   - {optRecord.modifiedOptFlag === 'MODIFY' ? '(修改中)' : ''}
913   - {optRecord.modifiedOptFlag === 'DELETE' ? '(删除中)' : ''}
914   - {optRecord.modifiedOptFlag === 'INSERT' ? '(新增中)' : ''}
915   - </span>
916   - ) : (
917   - ''
918   - )}
919   -
920   - {optRecord.modified ? (
921   - <Tooltip title="点击查看详情">
922   - <span
923   - className="text-[#f44e4e] cursor-pointer"
924   - onClick={async () => {
925   - createOptObject(optRecord.id, record.id);
926   - setModifiedDiffModalVisible(true);
927   - }}
928   - >
929   - (内容有变化)
930   - </span>
931   - </Tooltip>
932   - ) : (
933   - ''
934   - )}
935   - {!optRecord.logicDelete ? (
936   - <span className="text-[#f44e4e]">(已作废)</span>
937   - ) : (
938   - ''
939   - )}
940   - </div>
941   - </div>
942   -
943   - <div
944   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer"
945   - title={optRecord.parameters}
946   - onClick={() => {
947   - copyToClipboard(optRecord.parameters);
948   - message.info('商品名称复制成功:' + optRecord.parameters);
949   - }}
950   - >
951   - <span className="text-[#8C8C8C]">
952   - 参数:{optRecord.parameters}
953   - </span>
954   - </div>
955   - </Flex>
956   - <Flex className="w-[13%]" vertical gap="small">
957   - {!isSupplier() ? (
958   - <>
959   - <div
960   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
961   - title={optRecord.productPrice}
962   - >
963   - <span className="text-[#8C8C8C]">单价:</span>
964   - <span className="text-slate-700">
965   - ¥{optRecord.productPrice}
966   - </span>
967   - </div>
968   - </>
969   - ) : (
970   - ''
971   - )}
972   -
973   - <div
974   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
975   - title={optRecord.quantity}
976   - >
977   - <span className="text-[#8C8C8C]">数量:</span>
978   - <span className="text-slate-700">
979   - x{optRecord.quantity + ' '}
980   - </span>
981   - <span className="text-[#8C8C8C]">{optRecord.unit}</span>
982   - </div>
983   -
984   - {!isSupplier() ? (
985   - <div
986   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
987   - title={optRecord.subOrderPayment}
988   - >
989   - <span className="text-[#8C8C8C]">合计:</span>
990   - <span className="text-slate-700">
991   - ¥{optRecord.subOrderPayment}
992   - </span>
993   - </div>
994   - ) : (
995   - ''
996   - )}
997   - </Flex>
998   -
999   - <Flex className="w-[10%]" vertical gap="small">
1000   - {!isSupplier() ? (
1001   - <>
1002   - {/* 支付方式 */}
1003   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1004   - <span className="text-slate-700">
1005   - {optRecord.paymentMethodText}
1006   - </span>
1007   - </div>
1008   - {/* 支付渠道 */}
1009   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1010   - <span className="text-slate-700">
1011   - {enumValueToLabel(
1012   - optRecord.paymentChannel,
1013   - PAYMENT_CHANNEL_OPTIONS,
1014   - )}
1015   - </span>
1016   - </div>
1017   - {/* 回款审核状态 */}
1018   - {optRecord.paymentReceiptStatus !== null ? (
1019   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1020   - <Tag
1021   - className="hover:cursor-pointer"
1022   - onMouseEnter={(e: any) => {
1023   - e.target.innerText = '点击查看回款凭证';
1024   - }}
1025   - onMouseLeave={(e: any) => {
1026   - e.target.innerText = enumValueToLabel(
1027   - optRecord.paymentReceiptStatus,
1028   - PAYMENT_RECEIPTS_STATUS_OPTIONS,
1029   - );
1030   - }}
1031   - onClick={() => {
1032   - createOptObject(optRecord.id, record.id);
1033   - setImagesViewerOptType('paymentReceipt');
1034   - setImagesViewerModalVisible(true);
1035   - }}
1036   - key="key"
1037   - color={TAGS_COLOR.get(optRecord.paymentReceiptStatus)}
1038   - >
1039   - {enumValueToLabel(
1040   - optRecord.paymentReceiptStatus,
1041   - PAYMENT_RECEIPTS_STATUS_OPTIONS,
1042   - )}
1043   - </Tag>
1044   - </div>
1045   - ) : (
1046   - ''
1047   - )}
1048   - </>
1049   - ) : (
1050   - ''
1051   - )}
1052   - </Flex>
1053   - <Flex className="w-[13%]" vertical gap="small">
1054   - {!isSupplier() ? (
1055   - <>
1056   - {/* 所属部门 */}
1057   - <div
1058   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
1059   - title={enumValueToLabel(
1060   - optRecord.productBelongBusiness,
1061   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
1062   - )}
1063   - >
1064   - <span className="text-slate-700">
1065   - {enumValueToLabel(
1066   - optRecord.productBelongBusiness,
1067   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
1068   - )}
1069   - </span>
1070   - </div>
1071   -
1072   - {/* 开票类型 */}
1073   - {optRecord.invoicingStatus !== null ? (
1074   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1075   - <span className="text-slate-700">
1076   - {getInvoicingType(optRecord)}
1077   - </span>
1078   - </div>
1079   - ) : (
1080   - ''
1081   - )}
1082   -
1083   - {/* 开票状态 */}
1084   - {optRecord.afterInvoicingStatus !== null ? (
1085   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1086   - <Tooltip
1087   - title={
1088   - optRecord.invoicingUrgentCause !== null &&
1089   - optRecord.afterInvoicingStatus ===
1090   - 'URGENT_INVOICE_AUDITING'
1091   - ? optRecord.invoicingUrgentCause
1092   - : enumValueToLabel(
1093   - optRecord.afterInvoicingStatus,
1094   - AFTER_INVOICING_STATUS,
1095   - )
1096   - }
1097   - >
1098   - <Tag
1099   - color={TAGS_COLOR.get(optRecord.afterInvoicingStatus)}
1100   - >
1101   - {enumValueToLabel(
1102   - optRecord.afterInvoicingStatus,
1103   - AFTER_INVOICING_STATUS,
1104   - )}
1105   - </Tag>
1106   - </Tooltip>
1107   - </div>
1108   - ) : (
1109   - ''
1110   - )}
1111   -
1112   - {/* 是否加急图标显示 */}
1113   - {optRecord.isUrgent ? (
1114   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1115   - <Tooltip
1116   - title={'期望开票时间:' + formatdate(optRecord.deadline)}
1117   - >
1118   - <Tag color="red">加急开票</Tag>
1119   - </Tooltip>
1120   - </div>
1121   - ) : (
1122   - ''
1123   - )}
1124   -
1125   - {(roleCode === 'warehouseKeeper' || roleCode === 'admin') &&
1126   - optRecord.shippingWarehouse !== null ? (
1127   - <div
1128   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
1129   - title={enumValueToLabel(
1130   - optRecord.shippingWarehouse,
1131   - SHIPPING_WAREHOUSE_OPTIONS,
1132   - )}
1133   - >
1134   - <span className="text-slate-700">
1135   - {enumValueToLabel(
1136   - optRecord.shippingWarehouse,
1137   - SHIPPING_WAREHOUSE_OPTIONS,
1138   - )}
1139   - </span>
1140   - </div>
1141   - ) : (
1142   - ''
1143   - )}
1144   -
1145   - {/* 生产时间 */}
1146   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1147   - {optRecord.productionStartTime !== null ||
1148   - optRecord.productionEndTime !== null ? (
1149   - <MyToolTip
1150   - title={
1151   - formatdate(optRecord.productionStartTime) +
1152   - ' 至 ' +
1153   - formatdate(optRecord.productionEndTime)
1154   - }
1155   - content={
1156   - <Button type="link" size="small" style={{ padding: 0 }}>
1157   - 生产时间
1158   - </Button>
1159   - }
1160   - />
1161   - ) : (
1162   - ''
1163   - )}
1164   - </div>
1165   - </>
1166   - ) : (
1167   - ''
1168   - )}
1169   - </Flex>
1170   -
1171   - <Flex className="w-[10%]" vertical gap="small">
1172   - {/* 开票状态 */}
1173   - {!isSupplier() ? (
1174   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1175   - <Tag
1176   - color={
1177   - optRecord.invoicingTime === null ||
1178   - optRecord.invoicingTime === undefined
1179   - ? TAGS_COLOR.get(optRecord.invoicingStatus)
1180   - : 'success'
1181   - }
1182   - >
1183   - {getNeedInvoicing(optRecord)}
1184   - </Tag>
1185   - </div>
1186   - ) : (
1187   - ''
1188   - )}
1189   -
1190   - {/* 订单状态 */}
1191   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1192   - {getOrderStatusTag(optRecord)}
1193   - </div>
1194   -
1195   - {/* 后置审核状态 */}
1196   - {optRecord.postAuditStatus !== null ? (
1197   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1198   - {getPostAuditStatusTag(optRecord)}
1199   - </div>
1200   - ) : (
1201   - ''
1202   - )}
1203   -
1204   - {/**采购是否已下单状态 */}
1205   - {optRecord.procureOrderStatus !== null &&
1206   - optRecord.procureOrderStatus !== undefined ? (
1207   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1208   - <Tag color="success">
1209   - {enumValueToLabel(
1210   - optRecord.procureOrderStatus,
1211   - PROCURE_ORDER_STATUS,
1212   - )}
1213   - </Tag>
1214   - </div>
1215   - ) : (
1216   - ''
1217   - )}
1218   -
1219   - {/* 物流信息 */}
1220   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1221   - {optRecord.orderStatus === 'CONFIRM_RECEIPT' ||
1222   - optRecord.orderStatus === 'AFTER_SALES_COMPLETION' ||
1223   - optRecord.orderStatus === 'IN_AFTER_SALES' ||
1224   - optRecord.orderStatus === 'SHIPPED' ? (
1225   - <MyToolTip
1226   - title={
1227   - optRecord.serialNumber === undefined
1228   - ? '暂无物流信息'
1229   - : enumValueToLabel(
1230   - optRecord.logisticsMethod,
1231   - LOGISTICS_STATUS_OPTIONS,
1232   - ) +
1233   - ' ' +
1234   - optRecord.serialNumber +
1235   - ' ' +
1236   - optRecord.logisticsNotes
1237   - }
1238   - content={
1239   - <Button type="link" size="small" style={{ padding: 0 }}>
1240   - 物流信息
1241   - </Button>
1242   - }
1243   - />
1244   - ) : (
1245   - ''
1246   - )}
1247   -
1248   - {/* 修改审核状态 */}
1249   - {optRecord.modifiedAuditStatus !== null &&
1250   - optRecord.modifiedAuditStatus !== 'AUDIT_FAILURE' ? (
1251   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1252   - <Tooltip
1253   - title={recordOptNode ? recordOptNode : <Spin />}
1254   - onOpenChange={(open) => {
1255   - console.log('open:' + open);
1256   - console.log('id:' + optRecord.id);
1257   - if (open) {
1258   - triggerRecordOptNode(optRecord.id);
1259   - } else {
1260   - setRecordOptNode(null);
1261   - }
1262   - }}
1263   - >
1264   - <Tag color={TAGS_COLOR.get(optRecord.modifiedAuditStatus)}>
1265   - {enumValueToLabel(
1266   - optRecord.modifiedAuditStatus,
1267   - MODIFIED_AUDIT_STATUS_OPTIONS,
1268   - )}
1269   - </Tag>
1270   - </Tooltip>
1271   - </div>
1272   - ) : (
1273   - ''
1274   - )}
1275   -
1276   - {optRecord.modifiedAuditStatus === 'AUDIT_FAILURE' ? (
1277   - <MyToolTip
1278   - key="key"
1279   - title={optRecord.modifiedAuditNotes}
1280   - content={
1281   - <>
1282   - <Tag
1283   - color={TAGS_COLOR.get(optRecord.modifiedAuditNotes)}
1284   - style={{ marginRight: '4px' }}
1285   - >
1286   - {enumValueToLabel(
1287   - optRecord.modifiedAuditStatus,
1288   - MODIFIED_AUDIT_STATUS_OPTIONS,
1289   - )}
1290   - </Tag>
1291   - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
1292   - </>
1293   - }
1294   - />
1295   - ) : (
1296   - ''
1297   - )}
1298   - </div>
1299   - </Flex>
1300   - <Flex className="w-[18%]" wrap="wrap" gap="small">
1301   - {optRecord.paths?.includes('postAudit') ? (
1302   - <Button
1303   - className="p-0"
1304   - type="link"
1305   - onClick={() => {
1306   - createOptObject(optRecord.id, record.id);
1307   - setCheckVisible(true);
1308   - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT);
1309   - }}
1310   - >
1311   - 后置审核
1312   - </Button>
1313   - ) : (
1314   - ''
1315   - )}
1316   - {/* 加急审核 */}
1317   - {optRecord.paths?.includes('URGENT_INVOICE_AUDITING') ? (
1318   - <Button
1319   - className="p-0"
1320   - type="link"
1321   - onClick={() => {
1322   - console.log('here');
1323   - setCurrentMainId(record.id);
1324   - setCurretnOptSubId(optRecord.id);
1325   - setCheckVisible(true);
1326   - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING);
1327   - }}
1328   - >
1329   - 加急审核(新)
1330   - </Button>
1331   - ) : (
1332   - ''
1333   - )}
1334   - {optRecord.paths?.includes('URGENT_INVOICE_AUDITING_old') ? (
1335   - <Button
1336   - className="p-0"
1337   - type="link"
1338   - onClick={() => {
1339   - console.log('here');
1340   - setCurrentMainId(record.id);
1341   - setCurretnOptSubId(optRecord.id);
1342   - setCheckVisible(true);
1343   - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD);
1344   - }}
1345   - >
1346   - 加急审核(旧)
1347   - </Button>
1348   - ) : (
1349   - ''
1350   - )}
1351   - {optRecord.paths?.includes('salesConfirm') && (
1352   - <ButtonConfirm
1353   - className="p-0"
1354   - title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。"
1355   - text="订单确认"
1356   - onConfirm={async () => {
1357   - let res = await postServiceOrderSalesConfirm({
1358   - data: {
1359   - subOrderIds: [optRecord.id],
1360   - },
1361   - });
1362   -
1363   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
1364   - message.success(res.message);
1365   - refreshTable();
1366   - }
1367   - }}
1368   - />
1369   - )}
1370   - {optRecord.paths?.includes('uploadPaymentReceiptBill') ? (
1371   - <Button
1372   - className="p-0"
1373   - type="link"
1374   - onClick={() => {
1375   - createOptObject(optRecord.id, record.id);
1376   - setUploadPayBillModalVisible(true);
1377   - }}
1378   - >
1379   - 回款
1380   - </Button>
1381   - ) : (
1382   - ''
1383   - )}
1384   - {optRecord.paths?.includes('reissue_old') ? (
1385   - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'||
1386   - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/
1387   - <Button
1388   - className="p-0"
1389   - type="link"
1390   - onClick={() => {
1391   - setCurrentMainId(record.id);
1392   - setReissueVisibleOld(true);
1393   - }}
1394   - >
1395   - 重新开票(旧)
1396   - </Button>
1397   - ) : (
1398   - ''
1399   - )}
1400   - {optRecord.paths?.includes('reissue') ? (
1401   - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'||
1402   - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/
1403   - <Button
1404   - className="p-0"
1405   - type="link"
1406   - onClick={() => {
1407   - setCurrentMainId(record.id);
1408   - setCurretnOptSubId(optRecord.id);
1409   - setReissueVisible(true);
1410   - }}
1411   - >
1412   - 重新开票(新)
1413   - </Button>
1414   - ) : (
1415   - ''
1416   - )}
1417   -
1418   - {optRecord.paths?.includes('confirmReissue_old') ? (
1419   - <Button
1420   - className="p-0"
1421   - type="link"
1422   - onClick={() => {
1423   - setCurrentMainId(record.id);
1424   - setCurretnOptSubId(optRecord.id);
1425   - setCheckVisible(true);
1426   - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD);
1427   - }}
1428   - >
1429   - 重新开票审核(旧)
1430   - </Button>
1431   - ) : (
1432   - ''
1433   - )}
1434   - {optRecord.paths?.includes('confirmReissue') ? (
1435   - <Button
1436   - className="p-0"
1437   - type="link"
1438   - onClick={() => {
1439   - setCurrentMainId(record.id);
1440   - setCurretnOptSubId(optRecord.id);
1441   - setCheckVisible(true);
1442   - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE);
1443   - }}
1444   - >
1445   - 重新开票审核(新)
1446   - </Button>
1447   - ) : (
1448   - ''
1449   - )}
1450   -
1451   - {optRecord.paths?.includes('leaderAudit') ? (
1452   - <Button
1453   - className="p-0"
1454   - type="link"
1455   - onClick={() => {
1456   - setCurrentMainId(record.id);
1457   - setCurretnOptSubId(optRecord.id);
1458   - setCheckVisible(true);
1459   - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT);
1460   - }}
1461   - >
1462   - 审核
1463   - </Button>
1464   - ) : (
1465   - ''
1466   - )}
1467   -
1468   - {optRecord.paths?.includes('creditAudit') ? (
1469   - <Button
1470   - className="p-0"
1471   - type="link"
1472   - onClick={() => {
1473   - setCurrentMainId(record.id);
1474   - setCurretnOptSubId(optRecord.id);
1475   - setCheckVisible(true);
1476   - setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT);
1477   - }}
1478   - >
1479   - 赊账审核
1480   - </Button>
1481   - ) : (
1482   - ''
1483   - )}
1484   -
1485   - {optRecord.paths?.includes('auditPaymentReceipt') ? (
1486   - <Button
1487   - className="p-0"
1488   - type="link"
1489   - onClick={() => {
1490   - createOptObject(optRecord.id, record.id);
1491   - setCheckVisible(true);
1492   - setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT);
1493   - }}
1494   - >
1495   - 回款审核
1496   - </Button>
1497   - ) : (
1498   - ''
1499   - )}
1500   -
1501   - {optRecord.paths?.includes('modifiedAuditRequest') ? (
1502   - <Button
1503   - className="p-0"
1504   - type="link"
1505   - onClick={() => {
1506   - createOptObject(optRecord.id, record.id);
1507   - setCheckVisible(true);
1508   - setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT);
1509   - }}
1510   - >
1511   - 节点修改审核
1512   - </Button>
1513   - ) : (
1514   - ''
1515   - )}
1516   -
1517   - {optRecord.paths?.includes('applyModify') ? (
1518   - <Button
1519   - className="p-0"
1520   - type="link"
1521   - onClick={() => {
1522   - createOptObject(optRecord.id, record.id);
1523   - setOrderDrawerVisible(true);
1524   - setOrderOptType('order-change-normal');
1525   - }}
1526   - >
1527   - 申请修改
1528   - </Button>
1529   - ) : (
1530   - ''
1531   - )}
1532   -
1533   - {optRecord.paths?.includes('modifiedLeaderAuditRequest') ? (
1534   - <Button
1535   - className="p-0"
1536   - type="link"
1537   - onClick={() => {
1538   - createOptObject(optRecord.id, record.id);
1539   - setCheckVisible(true);
1540   - setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT);
1541   - }}
1542   - >
1543   - 领导修改审核
1544   - </Button>
1545   - ) : (
1546   - ''
1547   - )}
1548   -
1549   - {optRecord.paths?.includes('shippingWarehouseChangeRequest') ? (
1550   - <Button
1551   - className="p-0"
1552   - type="link"
1553   - onClick={() => {
1554   - setIds([optRecord.id]);
1555   - createOptObject(optRecord.id, record.id);
1556   - setShippingWarehouseChangeModalVisible(true);
1557   - }}
1558   - >
1559   - 修改仓库
1560   - </Button>
1561   - ) : (
1562   - ''
1563   - )}
1564   -
1565   - {optRecord.paths?.includes('saleCancelInvoicing_old') ? (
1566   - <ButtonConfirm
1567   - className="p-0"
1568   - title="确认取消申请开票?"
1569   - text="取消申请(旧)"
1570   - onConfirm={async () => {
1571   - let res = await postServiceOrderSaleCancelInvoicing({
1572   - data: {
1573   - subOrderIds: [optRecord.id],
1574   - },
1575   - });
1576   -
1577   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
1578   - message.success(res.message);
1579   - refreshTable();
1580   - }
1581   - }}
1582   - />
1583   - ) : (
1584   - ''
1585   - )}
1586   - {optRecord.paths?.includes('saleCancelInvoicing') ? (
1587   - <ButtonConfirm
1588   - className="p-0"
1589   - title="确认取消申请开票?"
1590   - text="取消申请(新)"
1591   - onConfirm={async () => {
1592   - let res = await postServiceInvoiceCancelApply({
1593   - data: {
1594   - subOrderIds: [optRecord.id],
1595   - },
  181 + rowKey="id"
  182 + search={{
  183 + labelWidth: 'auto',
  184 + }}
  185 + options={{
  186 + setting: {
  187 + listsHeight: 400,
  188 + },
  189 + }}
  190 + pagination={{
  191 + showSizeChanger: true, // 显示可以选择每页显示条数的下拉菜单
  192 + pageSizeOptions: ['10', '20', '50', '100'], // 设置可以选择的每页显示条数选项
  193 + }}
  194 + dateFormatter="string"
  195 + // headerTitle="添加"
  196 + toolBarRender={() => [
  197 + <ModalForm
  198 + key="add"
  199 + title="添加帐号"
  200 + width={500}
  201 + trigger={
  202 + <Button type="primary">
  203 + <PlusOutlined />
  204 + 添加
  205 + </Button>
  206 + }
  207 + autoFocusFirstInput
  208 + modalProps={{
  209 + destroyOnClose: true,
  210 + onCancel: () => console.log('run'),
  211 + }}
  212 + submitTimeout={2000}
  213 + onFinish={async (values) => {
  214 + const res = await postOldInvoicingWhiteListBatchAdd({
  215 + data: values,
1596 216 });
1597   -
1598   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
1599   - message.success(res.message);
1600   - refreshTable();
  217 + if (res.result === RESPONSE_CODE.SUCCESS) {
  218 + actionRef.current?.reload();
  219 + message.success('添加成功');
  220 + return true;
1601 221 }
1602 222 }}
1603   - />
1604   - ) : (
1605   - ''
1606   - )}
1607   - {optRecord.paths?.includes('noNeedInvoicingEdit') ? (
1608   - <Button
1609   - className="p-0"
1610   - type="link"
1611   - onClick={() => {
1612   - createOptObject(optRecord.id, record.id);
1613   - setFinancialEditVisible(true);
1614   - setIsMainOrder(false);
1615   - }}
1616   - >
1617   - 编辑时间
1618   - </Button>
1619   - ) : (
1620   - ''
1621   - )}
1622   - {optRecord.paths?.includes('sendProduct') ? (
1623   - <Button
1624   - className="p-0"
1625   - type="link"
1626   - onClick={() => {
1627   - createOptObject(optRecord.id, record.id);
1628   - setDeliverVisible(true);
1629   - setIsSendProduct(true);
1630   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
1631   - }}
1632   - >
1633   - 仓库发货
1634   - </Button>
1635   - ) : (
1636   - ''
1637   - )}
1638   -
1639   - {optRecord.paths?.includes('supplierSendOrder') ? (
1640   - <Button
1641   - className="p-0"
1642   - type="link"
1643   - onClick={() => {
1644   - optRecord.mainOrderId = record.id;
1645   - setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染
1646   - setDeliverVisible(true);
1647   - setIsSendProduct(true);
1648   - setOrderCheckType(CHECK_TYPE.SUPPLIER);
1649   - }}
1650   - >
1651   - 供应商发货
1652   - </Button>
1653   - ) : (
1654   - ''
1655   - )}
1656   -
1657   - {optRecord.paths?.includes('procureSend') ? (
1658   - <Button
1659   - className="p-0"
1660   - type="link"
1661   - onClick={() => {
1662   - createOptObject(optRecord.id, record.id);
1663   - setDeliverVisible(true);
1664   - setIsSendProduct(true);
1665   - setOrderCheckType(CHECK_TYPE.PROCURE);
1666   - }}
1667   - >
1668   - {isSupplier() ? '发货' : '采购发货'}
1669   - </Button>
1670   - ) : (
1671   - ''
1672   - )}
1673   -
1674   - {optRecord.paths?.includes('editProductionTime') ? (
1675   - <Button
1676   - className="p-0"
1677   - type="link"
1678   - onClick={() => {
1679   - createOptObject(optRecord.id, record.id);
1680   - setProductionTimeModalVisible(true);
1681   - }}
1682   - >
1683   - 生产时间
1684   - </Button>
1685   - ) : (
1686   - ''
1687   - )}
1688   -
1689   - {optRecord.paths?.includes('queryAnnex') &&
1690   - optRecord.listAnnex?.length > 0 ? (
1691   - <Button
1692   - className="p-0"
1693   - type="link"
1694   - onClick={() => {
1695   - optRecord.mainOrderId = record.id;
1696   - createOptObject(optRecord.id, record.id);
1697   - setAttachmentModalVisible(true);
1698   - }}
1699   - >
1700   - 附件
1701   - </Button>
1702   - ) : (
1703   - ''
1704   - )}
1705   -
1706   - {optRecord.paths?.includes('modifySendInformation') ? (
1707   - <Button
1708   - className="p-0"
1709   - type="link"
1710   - onClick={() => {
1711   - createOptObject(optRecord.id, record.id);
1712   - setDeliverVisible(true);
1713   - setIsSendProduct(false);
1714   - }}
1715 223 >
1716   - 修改发货信息
1717   - </Button>
1718   - ) : (
1719   - ''
1720   - )}
1721   -
1722   - {optRecord.paths?.includes('printOrder') ? (
1723   - <Button
1724   - className="p-0"
1725   - type="link"
1726   - onClick={async () => {
1727   - createOptObject(optRecord.id, record.id);
1728   - setOrderPrintVisible(true);
1729   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
1730   - }}
1731   - >
1732   - 仓库打印
1733   - </Button>
1734   - ) : (
1735   - ''
1736   - )}
1737   -
1738   - {optRecord.paths?.includes('supplierPrint') ? (
1739   - <Button
1740   - className="p-0"
1741   - type="link"
1742   - onClick={async () => {
1743   - createOptObject(optRecord.id, record.id);
1744   - setOrderPrintVisible(true);
1745   - setOrderCheckType(CHECK_TYPE.SUPPLIER);
1746   - }}
1747   - >
1748   - 供应商打印
1749   - </Button>
1750   - ) : (
1751   - ''
1752   - )}
1753   -
1754   - {optRecord.paths?.includes('procurePrint') ? (
1755   - <ButtonConfirm
1756   - className="p-0"
1757   - title="确认打印?"
1758   - text="采购打印"
1759   - onConfirm={async () => {
1760   - let res = await postServiceOrderProcurePrint({
1761   - data: {
1762   - ids: [optRecord.id],
  224 + <ProFormText
  225 + name="orderIdsText"
  226 + label="销售账号"
  227 + placeholder="请输入销售账号"
  228 + rules={[
  229 + {
  230 + required: true,
  231 + message: '请输入销售账号',
1763 232 },
  233 + ]}
  234 + ></ProFormText>
  235 + </ModalForm>,
  236 + ]}
  237 + />
  238 + </div>
  239 + )
  240 + },
  241 + {
  242 + key: 2,
  243 + label: '订单白名单',
  244 + children: (
  245 + <div>
  246 + <ProTable
  247 + columns={columnsInvoice}
  248 + actionRef={actionRef}
  249 + cardBordered
  250 + request={async (params) => {
  251 + const res = await postOldInvoicingWhiteListPage({
  252 + data: params,
  253 + });
  254 + return res.data;
  255 + }}
  256 + rowKey="id"
  257 + search={{
  258 + labelWidth: 'auto',
  259 + }}
  260 + options={{
  261 + setting: {
  262 + listsHeight: 400,
  263 + },
  264 + }}
  265 + pagination={{
  266 + showSizeChanger: true, // 显示可以选择每页显示条数的下拉菜单
  267 + pageSizeOptions: ['10', '20', '50', '100'], // 设置可以选择的每页显示条数选项
  268 + }}
  269 + dateFormatter="string"
  270 + // headerTitle="添加"
  271 + toolBarRender={() => [
  272 + <ModalForm
  273 + key="add"
  274 + title="添加订单"
  275 + width={500}
  276 + trigger={
  277 + <Button type="primary">
  278 + <PlusOutlined />
  279 + 添加
  280 + </Button>
  281 + }
  282 + autoFocusFirstInput
  283 + modalProps={{
  284 + destroyOnClose: true,
  285 + onCancel: () => console.log('run'),
  286 + }}
  287 + submitTimeout={2000}
  288 + onFinish={async (values) => {
  289 + const res = await postOldInvoicingWhiteListBatchAdd({
  290 + data: values,
1764 291 });
1765   -
1766 292 if (res.result === RESPONSE_CODE.SUCCESS) {
1767   - message.success(res.message);
1768   - refreshTable();
  293 + actionRef.current?.reload();
  294 + message.success('添加成功');
  295 + return true;
1769 296 }
1770 297 }}
1771   - />
1772   - ) : (
1773   - // <Button
1774   - // className="p-0"
1775   - // type="link"
1776   - // onClick={async () => {
1777   - // setOrderPrintVisible(true);
1778   - // setSelectedRows([optRecord]);
1779   - // setOrderRow(record);
1780   - // setOrderCheckType(CHECK_TYPE.PROCURE);
1781   - // }}
1782   - // >
1783   - // 采购打印
1784   - // </Button>
1785   - ''
1786   - )}
1787   -
1788   - {optRecord.paths?.includes('editOrder') && false ? (
1789   - <Button
1790   - className="p-0"
1791   - type="link"
1792   - onClick={() => {
1793   - createOptObject(optRecord.id, record.id);
1794   - setFinancialVisible(true);
1795   - setIsEdit(true);
1796   - }}
1797 298 >
1798   - 编辑
1799   - </Button>
1800   - ) : (
1801   - ''
1802   - )}
1803   -
1804   - {optRecord.paths?.includes('invoicing') ? (
1805   - <Button
1806   - className="p-0"
1807   - type="link"
1808   - onClick={() => {
1809   - createOptObject(optRecord.id, record.id);
1810   - setFinancialVisible(true);
1811   - setIsEdit(false);
1812   - setIsMainOrder(false);
1813   - }}
1814   - >
1815   - 开票
1816   - </Button>
1817   - ) : (
1818   - ''
1819   - )}
1820   -
1821   - {optRecord.paths?.includes('applyInvoicing') ? (
1822   - <Button
1823   - className="p-0"
1824   - type="link"
1825   - onClick={() => {
1826   - setInvoicingDrawerFormVisible(true);
1827   - createOptObject(optRecord.id, record.id);
1828   - setIsEdit(false);
1829   - setIsMainOrder(false);
1830   - }}
1831   - >
1832   - 申请开票(新)
1833   - </Button>
1834   - ) : (
1835   - ''
1836   - )}
1837   -
1838   - {optRecord.paths?.includes('applyInvoicing_old') ? (
1839   - <Button
1840   - className="p-0"
1841   - type="link"
1842   - onClick={() => {
1843   - setApplyForInvoicingVisible(true);
1844   - createOptObject(optRecord.id, record.id);
1845   - setIsEdit(false);
1846   - setIsMainOrder(false);
1847   - }}
1848   - >
1849   - 申请开票(旧)
1850   - </Button>
1851   - ) : (
1852   - ''
1853   - )}
1854   -
1855   - {optRecord.paths?.includes('checkOrder') ? (
1856   - <Button
1857   - className="p-0"
1858   - type="link"
1859   - onClick={() => {
1860   - setCurrentMainId(record.id);
1861   - setCurretnOptSubId(optRecord.id);
1862   - setCheckVisible(true);
1863   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
1864   - }}
1865   - >
1866   - 审核
1867   - </Button>
1868   - ) : (
1869   - ''
1870   - )}
1871   -
1872   - {optRecord.paths?.includes('afterSalesCheck') ? (
1873   - <Button
1874   - className="p-0"
1875   - type="link"
1876   - onClick={() => {
1877   - createOptObject(optRecord.id, record.id);
1878   - setCheckVisible(true);
1879   - setOrderCheckType(CHECK_TYPE.AFTER_SALES);
1880   - }}
1881   - >
1882   - 售后审核
1883   - </Button>
1884   - ) : (
1885   - ''
1886   - )}
1887   -
1888   - {optRecord.paths?.includes('financeCheckOrder') ? (
1889   - <Button
1890   - className="p-0"
1891   - type="link"
1892   - onClick={() => {
1893   - createOptObject(optRecord.id, record.id);
1894   - setCheckVisible(true);
1895   - setOrderCheckType(CHECK_TYPE.FINALCIAL);
1896   - }}
1897   - >
1898   - 财务审核
1899   - </Button>
1900   - ) : (
1901   - ''
1902   - )}
1903   -
1904   - {optRecord.paths?.includes('procureCheckOrder') ? (
1905   - <Button
1906   - className="p-0"
1907   - type="link"
1908   - onClick={() => {
1909   - createOptObject(optRecord.id, record.id);
1910   - setOrderCheckType(CHECK_TYPE.PROCURE);
1911   - setProcureCheckModalVisible(true);
1912   - }}
1913   - >
1914   - 采购审核
1915   - </Button>
1916   - ) : (
1917   - ''
1918   - )}
1919   -
1920   - {optRecord.paths?.includes('procureConvertProcure') ? (
1921   - <Button
1922   - className="p-0"
1923   - type="link"
1924   - onClick={() => {
1925   - createOptObject(optRecord.id, record.id);
1926   - setOrderCheckType(CHECK_TYPE.PROCURE);
1927   - setProcureConvertModalVisible(true);
1928   - }}
1929   - >
1930   - 转发
1931   - </Button>
1932   - ) : (
1933   - ''
1934   - )}
1935   -
1936   - {optRecord.paths?.includes('rePrintOrder') ? (
1937   - <Button
1938   - className="p-0"
1939   - type="link"
1940   - onClick={() => {
1941   - createOptObject(optRecord.id, record.id);
1942   - setOrderPrintVisible(true);
1943   - setIsRePrintOrder(true);
1944   - }}
1945   - >
1946   - 重新打印
1947   - </Button>
1948   - ) : (
1949   - ''
1950   - )}
1951   -
1952   - {optRecord.paths?.includes('confirmReceipt') ? (
1953   - <Button
1954   - className="p-0"
1955   - type="link"
1956   - onClick={() => {
1957   - createOptObject(optRecord.id, record.id);
1958   - setConfirmReceiptVisible(true);
1959   - }}
1960   - >
1961   - 确认收货
1962   - </Button>
1963   - ) : (
1964   - ''
1965   - )}
1966   -
1967   - {optRecord.paths?.includes('applyAfterSales') ? (
1968   - <Button
1969   - className="p-0"
1970   - type="link"
1971   - onClick={() => {
1972   - createOptObject(optRecord.id, record.id);
1973   - setOrderDrawerVisible(true);
1974   - setOrderOptType('after_sales');
1975   - }}
1976   - >
1977   - 申请售后
1978   - </Button>
1979   - ) : (
1980   - ''
1981   - )}
1982   -
1983   - {optRecord.paths?.includes('procureOrder') ? (
1984   - <ButtonConfirm
1985   - className="p-0"
1986   - title="是否已下单?"
1987   - text="下单"
1988   - onConfirm={async () => {
1989   - let res = await postServiceOrderProcureOrder({
1990   - data: { subIds: [optRecord.id] },
1991   - });
1992   - if (res.result === RESPONSE_CODE.SUCCESS) {
1993   - message.success(res.message);
1994   - refreshTable();
1995   - return true;
1996   - }
1997   - }}
1998   - />
1999   - ) : (
2000   - ''
2001   - )}
2002   -
2003   - {optRecord.paths?.includes('cancelSend') ? (
2004   - <ButtonConfirm
2005   - className="p-0"
2006   - title="是否取消发货"
2007   - text="取消发货"
2008   - onConfirm={async () => {
2009   - let res = await postServiceOrderCancelSend({
2010   - data: { subIds: [optRecord.id] },
2011   - });
2012   - if (res.result === RESPONSE_CODE.SUCCESS) {
2013   - message.success(res.message);
2014   - refreshTable();
2015   - return true;
2016   - }
2017   - }}
2018   - />
2019   - ) : (
2020   - ''
2021   - )}
2022   -
2023   - {optRecord.paths?.includes('noNeedSend') ? (
2024   - <ButtonConfirm
2025   - className="p-0"
2026   - title="此订单是否无需发货?"
2027   - text="无需发货"
2028   - onConfirm={async () => {
2029   - let res = await postServiceOrderNoNeedSend({
2030   - data: { ids: [optRecord.id] },
2031   - });
2032   - if (res.result === RESPONSE_CODE.SUCCESS) {
2033   - message.success(res.message);
2034   - refreshTable();
2035   - return true;
2036   - }
2037   - }}
2038   - />
2039   - ) : (
2040   - ''
2041   - )}
2042   -
2043   - {optRecord.paths?.includes('viewImages') ? (
2044   - <Button
2045   - className="p-0"
2046   - type="link"
2047   - onClick={() => {
2048   - createOptObject(optRecord.id, record.id);
2049   - setImagesViewerOptType('shippingReceipt');
2050   - setImagesViewerModalVisible(true);
2051   - }}
2052   - >
2053   - 查看收货凭证
2054   - </Button>
2055   - ) : (
2056   - ''
2057   - )}
2058   -
2059   - {optRecord.paths?.includes('confirmDeliver') ? (
2060   - <Button
2061   - className="p-0"
2062   - type="link"
2063   - onClick={() => {
2064   - createOptObject(optRecord.id, record.id);
2065   - setOrderCheckType(CHECK_TYPE.CONFIRM_DELIVER);
2066   - setCheckVisible(true);
2067   - }}
2068   - >
2069   - 确认发货
2070   - </Button>
2071   - ) : (
2072   - ''
2073   - )}
2074   -
2075   - {optRecord.paths?.includes('orderCancel') ? (
2076   - <ButtonConfirm
2077   - className="p-0"
2078   - title="确认作废?"
2079   - text="作废"
2080   - onConfirm={async () => {
2081   - let body = { ids: [optRecord.id], checkIsMainOrderId: false };
2082   - const data = await postServiceOrderOrderCancel({
2083   - data: body,
2084   - });
2085   - if (data.result === RESPONSE_CODE.SUCCESS) {
2086   - message.success(data.message);
2087   - refreshTable();
2088   - }
2089   - }}
2090   - />
2091   - ) : (
2092   - ''
2093   - )}
2094   - </Flex>
2095   - </Flex>
2096   -
2097   - <Flex title={optRecord.notes}>
2098   - <div
2099   - className="max-w-[1100px] overflow-hidden whitespace-normal overflow-ellipsis hover:cursor-pointer"
2100   - onClick={() => {
2101   - copyToClipboard(optRecord.notes);
2102   - message.info('备注复制成功:' + optRecord.notes);
2103   - }}
2104   - >
2105   - <span className="text-[#8C8C8C]">
2106   - 备注:
2107   - {optRecord.notes === null ? '暂无备注' : optRecord.notes}
2108   - </span>
2109   - </div>
2110   - {!isSupplier() && (isSales() || isWarehousekeeper() || isAdmin()) && (
2111   - <EditTwoTone
2112   - className="pl-1 pr-1 hover:curcor-pointer"
2113   - onClick={() => {
2114   - setNotesEditVisible(true);
2115   - setSelectedRows([optRecord.id]);
2116   - setNotes(optRecord.notes);
2117   - setNotesType(1);
2118   - }}
2119   - />
2120   - )}
2121   - </Flex>
2122   -
2123   - {(isProcure() || isWarehousekeeper() || isSales() || isAdmin()) &&
2124   - !isSupplier() ? (
2125   - <div className="pt-2">
2126   - <Flex title={optRecord.supplierName}>
2127   - <div>
2128   - <span className="text-[#8C8C8C]">
2129   - 所属采购:
2130   - {optRecord.supplierName === null
2131   - ? '暂无'
2132   - : optRecord.supplierName}
2133   - </span>
2134   - </div>
2135   -
2136   - <Divider type="vertical" />
2137   -
2138   - <div className="overflow-hidden whitespace-normal overflow-ellipsis hover:cursor-pointer">
2139   - <span className="text-[#8C8C8C]">
2140   - 采购备注:
2141   - {optRecord.procureNotes === null
2142   - ? '暂无备注'
2143   - : optRecord.procureNotes}
2144   - </span>
2145   - </div>
2146   - {/* 编辑备注按钮 */}
2147   - {(isProcure() || isAdmin()) && (
2148   - <EditTwoTone
2149   - className="pl-1 pr-1 hover:curcor-pointer"
2150   - onClick={() => {
2151   - setSelectedRows([optRecord.id]);
2152   - setNotes(optRecord.procureNotes);
2153   - setNotesEditVisible(true);
2154   - setNotesType(2);
2155   - }}
2156   - />
2157   - )}
2158   - </Flex>
2159   -
2160   - {(isAdmin() || isProcure()) && (
2161   - <Flex title={optRecord.supplierNotes}>
2162   - <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis">
2163   - <span className="text-[#8C8C8C]">
2164   - 供应商备注:
2165   - {optRecord.supplierNotes === null
2166   - ? '暂无备注'
2167   - : optRecord.supplierNotes}
2168   - </span>
2169   - </div>
2170   - {/* 编辑备注按钮 */}
2171   - <EditTwoTone
2172   - className="pl-1 hover:curcor-pointer"
2173   - onClick={() => {
2174   - setSelectedRows([optRecord.id]);
2175   - setNotes(optRecord.supplierNotes);
2176   - setNotesEditVisible(true);
2177   - setNotesType(3);
2178   - }}
2179   - />
2180   - </Flex>
2181   - )}
2182   - </div>
2183   - ) : (
2184   - ''
2185   - )}
2186   -
2187   - {isAdmin() || isSales() || isFinance() ? (
2188   - <Flex title={optRecord.notes} className="pt-2">
2189   - <div className="flex items-center">
2190   - <div className="flex items-center max-w-[500px]">
2191   - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
2192   - <Tooltip
2193   - title={optRecord.applyInvoicingNotes}
2194   - placement="topLeft"
2195   - >
2196   - <span className="text-[#8C8C8C]">
2197   - 申请开票备注:
2198   - {optRecord.applyInvoicingNotes === undefined ||
2199   - optRecord.applyInvoicingNotes === null
2200   - ? '暂无备注'
2201   - : optRecord.applyInvoicingNotes}
2202   - </span>
2203   - </Tooltip>
2204   - </div>
2205   -
2206   - {getAfterAnnexList()}
2207   -
2208   - <Tooltip title="编辑">
2209   - <EditTwoTone
2210   - className="pl-1 hover:curcor-pointer"
2211   - onClick={() => {
2212   - setNotesEditVisible(true);
2213   - setSelectedRows([optRecord.id]);
2214   - setNotes(optRecord.applyInvoicingNotes);
2215   - setNotesType(4);
2216   - }}
2217   - />
2218   - </Tooltip>
2219   - </div>
2220   - <Divider type="vertical" className="mx-5" />
2221   - <div className="flex items-center max-w-[500px]">
2222   - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
2223   - <Tooltip title={optRecord.checkNotes} placement="topLeft">
2224   - <span className="text-[#8C8C8C] mr-3">
2225   - 财务审核备注:
2226   - {optRecord.checkNotes === undefined ||
2227   - optRecord.checkNotes === null
2228   - ? '暂无备注'
2229   - : optRecord.checkNotes}
2230   - </span>
2231   - </Tooltip>
2232   - </div>
2233   -
2234   - {getInvoicingCheckAnnexList()}
2235   - </div>
2236   - </div>
2237   - </Flex>
2238   - ) : (
2239   - ''
2240   - )}
2241   -
2242   - {isAdmin() || isSales() || isFinance() ? (
2243   - <Flex title={optRecord.notes} className="pt-2">
2244   - <div className="flex items-center">
2245   - <div className="flex items-center max-w-[500px]">
2246   - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
2247   - <Tooltip title={optRecord.reissueNotes} placement="topLeft">
2248   - <span className="text-[#8C8C8C]">
2249   - 重新开票备注:
2250   - {optRecord.reissueNotes === undefined ||
2251   - optRecord.reissueNotes === null
2252   - ? '暂无备注'
2253   - : optRecord.reissueNotes}
2254   - </span>
2255   - </Tooltip>
2256   - </div>
2257   -
2258   - <Tooltip title="编辑">
2259   - <EditTwoTone
2260   - className="pl-1 hover:curcor-pointer"
2261   - onClick={() => {
2262   - setNotesEditVisible(true);
2263   - setSelectedRows([optRecord.id]);
2264   - setNotes(optRecord.reissueNotes);
2265   - setNotesType(5);
2266   - }}
2267   - />
2268   - </Tooltip>
2269   - </div>
2270   - <Divider type="vertical" className="mx-5" />
2271   - </div>
2272   - </Flex>
2273   - ) : (
2274   - ''
2275   - )}
2276   - </>
2277   - );
2278   - };
2279   - const expandedRowRender = (record) => {
2280   - let subOrders = record.subOrderInformationLists;
2281   -
2282   - return (
2283   - <ProTable
2284   - id="sub-table"
2285   - className="w-full "
2286   - showHeader={false}
2287   - columns={[
2288   - {
2289   - title: 'ID',
2290   - dataIndex: 'id',
2291   - key: 'id',
2292   - render: (text: any, optRecord: any) => {
2293   - return <SubOderRander record={record} optRecord={optRecord} />;
2294   - },
2295   - },
2296   - ]}
2297   - rowSelection={{
2298   - onSelect: (row: any) => {
2299   - let subId = row.id;
2300   - let mainId = row.mainOrderId;
2301   - let newSelectedSubOrderKeys = [...selectedSubOrderKeys];
2302   - let currentMainOrderSelectedSubOrderList =
2303   - subOrderSelectedMap.get(mainId);
2304   - if (!selectedSubOrderKeys.includes(subId)) {
2305   - //选中子订单
2306   - newSelectedSubOrderKeys.push(subId);
2307   -
2308   - //在Map中添加对应的主订单中的子订单
2309   - if (currentMainOrderSelectedSubOrderList) {
2310   - currentMainOrderSelectedSubOrderList.push(row);
2311   - } else {
2312   - currentMainOrderSelectedSubOrderList = [row];
2313   - }
2314   -
2315   - //如果该主订单的所有子订单都选中了,那么勾选上主订单
2316   - if (
2317   - currentMainOrderSelectedSubOrderList?.length ===
2318   - mainOrderIdSubOrderIdRelationsMap.get(mainId)?.length
2319   - ) {
2320   - selectedMainOrderKeys.push(mainId, record);
2321   - mainOrderSelectedMap.set(mainId, record);
2322   - }
2323   -
2324   - //如果所有主订单都勾选上了,那么勾选上总选中按钮
2325   - if (
2326   - mainOrderSelectedMap?.size ===
2327   - mainOrderIdSubOrderIdRelationsMap.size
2328   - ) {
2329   - setAllMainChecked(true);
2330   - }
2331   - } else {
2332   - //取消选中子订单
2333   - newSelectedSubOrderKeys = newSelectedSubOrderKeys.filter(
2334   - (item) => {
2335   - return item !== subId;
2336   - },
2337   - );
2338   -
2339   - removeSelecetMainOrderKeyByMainOrderId(mainId); //某个子订单取消勾选了,对应的主订单也要取消勾选
2340   -
2341   - //在Map中删除掉对应的主订单中的子订单
2342   - if (currentMainOrderSelectedSubOrderList) {
2343   - currentMainOrderSelectedSubOrderList =
2344   - currentMainOrderSelectedSubOrderList.filter((item) => {
2345   - return item.id !== subId;
2346   - });
2347   - } else {
2348   - subOrderSelectedMap.set(mainId, [row]);
2349   - }
2350   -
2351   - mainOrderSelectedMap.delete(mainId);
2352   - //总选中按钮取消选中
2353   - setAllMainChecked(false);
2354   - }
2355   -
2356   - //如果该主订单已经没有子订单选中,删除key
2357   - if (currentMainOrderSelectedSubOrderList?.length === 0) {
2358   - subOrderSelectedMap.delete(record.id);
2359   - } else {
2360   - subOrderSelectedMap.set(
2361   - record.id,
2362   - currentMainOrderSelectedSubOrderList,
2363   - );
2364   - }
2365   -
2366   - setSelectedSubOrderKeys(newSelectedSubOrderKeys);
2367   - setSelectedRows(currentMainOrderSelectedSubOrderList);
2368   - },
2369   - selectedRowKeys: selectedSubOrderKeys,
2370   - // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
2371   - // 注释该行则默认不显示下拉选项
2372   - // selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
2373   - // defaultSelectedRowKeys: [],
2374   - }}
2375   - rowKey="id"
2376   - headerTitle={false}
2377   - search={false}
2378   - options={false}
2379   - dataSource={subOrders}
2380   - pagination={false}
2381   - tableAlertRender={false}
2382   - />
2383   - );
2384   - };
2385   -
2386   - // 主订单内容渲染
2387   - const MainOrderColumnRender = ({ record }: { record: OrderListItemType }) => {
2388   - return (
2389   - <Flex vertical={true}>
2390   - {/* 编号、时间、销售信息 */}
2391   - <Flex
2392   - className="px-4 py-4 bg-white rounded-t-lg"
2393   - justify="space-between"
2394   - >
2395   - <Flex wrap="wrap" gap="middle" vertical>
2396   - <Flex>
2397   - <Flex>
2398   - <Checkbox
2399   - onChange={() => onCheckboxChange(record)}
2400   - checked={selectedMainOrderKeys.includes(record.id)}
2401   - >
2402   - <Space split={<Divider type="vertical" />}>
2403   - <div>
2404   - <span className="text-[#8C8C8C]">订单号:</span>
2405   - <span className="text-slate-700">{record.id}</span>
2406   - {record.modified ? (
2407   - <Tooltip title="点击查看详情">
2408   - <span
2409   - className="text-[#f44e4e] cursor-pointer"
2410   - onClick={async () => {
2411   - createOptObject(null, record.id);
2412   - setModifiedDiffModalVisible(true);
2413   - }}
2414   - >
2415   - (修改过)
2416   - </span>
2417   - </Tooltip>
2418   - ) : (
2419   - ''
2420   - )}
2421   - </div>
2422   - </Space>
2423   - </Checkbox>
2424   - <Tooltip title="点击复制订单号">
2425   - <CopyOutlined
2426   - className="hover:cursor-pointer"
2427   - style={{ color: '#8C8C8C' }}
2428   - onClick={() => {
2429   - copyToClipboard(record.id);
2430   - message.info('订单号复制成功!');
2431   - }}
2432   - />
2433   - </Tooltip>
2434   - <Divider type="vertical" />
2435   - <span>{formatDateTime(record.createTime)}</span>
2436   - <Divider type="vertical" />
2437   - <Space split={<Divider type="vertical" />}>
2438   - <div
2439   - className="hover:cursor-pointer"
2440   - onClick={() => {
2441   - copyToClipboard(record.salesCode);
2442   - message.info('代表复制成功:' + record.salesCode);
2443   - }}
2444   - >
2445   - <span className="text-[#8C8C8C]">代表:</span>
2446   - <span className="text-slate-700">{record.salesCode}</span>
2447   - </div>
2448   - {!isSupplier() ? (
2449   - <>
2450   - <div
2451   - title={record.institution}
2452   - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]"
2453   - >
2454   - <span className="text-[#8C8C8C]">单位:</span>
2455   - <span className="text-slate-700">
2456   - {record.institution}
2457   - </span>
2458   - </div>
2459   - <span>
2460   - <span className="text-[#8C8C8C]">联系人:</span>
2461   - <span className="text-slate-700">
2462   - {record.institutionContactName + ' '}
2463   - </span>
2464   - </span>
2465   - </>
2466   - ) : (
2467   - ''
2468   - )}
2469   - <div
2470   - title={record.institution}
2471   - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]"
2472   - >
2473   - <span
2474   - className="hover:cursor-pointer"
2475   - onClick={() => {
2476   - copyToClipboard(record.customerName);
2477   - message.info('收货人复制成功:' + record.customerName);
2478   - }}
2479   - >
2480   - <span className="text-[#8C8C8C]">收货人:</span>
2481   - {!isSupplier() && (
2482   - <Tooltip className="order-tooltip" title="详情">
2483   - <ContainerTwoTone
2484   - className="px-1 hover:curcor-pointer"
2485   - onClick={() => {
2486   - createOptObject(null, record.id);
2487   - setDeliverInfoDrawerVisible(true);
2488   - }}
2489   - />
2490   - </Tooltip>
2491   - )}
2492   - <span className="text-slate-700">
2493   - {record.customerName + ' '}
2494   - </span>
2495   - </span>
2496   - </div>
2497   -
2498   - {isSupplier() ? (
2499   - <div
2500   - title={record.customerShippingAddress}
2501   - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px] hover:cursor-pointer"
2502   - onClick={() => {
2503   - copyToClipboard(record.customerShippingAddress);
2504   - message.info(
2505   - '收货地址复制成功:' + record.customerShippingAddress,
2506   - );
2507   - }}
2508   - >
2509   - <span className="text-[#8C8C8C]">收货地址:</span>
2510   - <span className="text-slate-700">
2511   - {record.customerShippingAddress}
2512   - </span>
2513   - </div>
2514   - ) : (
2515   - ''
2516   - )}
2517   - </Space>
2518   - </Flex>
2519   - </Flex>
2520   -
2521   - {isSupplier() ? (
2522   - <Flex className="pl-6" align="center">
2523   - <Flex
2524   - className="hover:cursor-pointer"
2525   - onClick={() => {
2526   - copyToClipboard(record.customerContactNumber);
2527   - message.info(
2528   - '联系电话复制成功:' + record.customerContactNumber,
2529   - );
2530   - }}
2531   - >
2532   - <span className="text-[#8C8C8C]">联系电话:</span>
2533   - <span className="text-slate-700">
2534   - {record.customerContactNumber + ' '}
2535   - </span>
2536   - </Flex>
2537   - </Flex>
2538   - ) : (
2539   - ''
2540   - )}
2541   -
2542   - <Flex className="pl-6" align="center">
2543   - {roleCode === 'finance' ? (
2544   - <div
2545   - title={enumValueToLabel(
2546   - record.receivingCompany,
2547   - getReceivingCompanyOptions(PAYEE_OPTIONS),
2548   - )}
2549   - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px]"
2550   - >
2551   - <span className="text-[#8C8C8C]">开票收款单位:</span>
2552   - <span className="text-slate-700">
2553   - {record.receivingCompany !== null
2554   - ? enumValueToLabel(
2555   - record.receivingCompany,
2556   - getReceivingCompanyOptions(PAYEE_OPTIONS),
2557   - )
2558   - : '暂无'}
2559   - </span>
2560   - </div>
2561   - ) : (
2562   - ''
2563   - )}
2564   -
2565   - {roleCode === 'finance' ? <Divider type="vertical" /> : ''}
2566   -
2567   - <div title={record.notes}>
2568   - <div
2569   - className="max-w-[850px] whitespace-normal overflow-hidden overflow-ellipsis hover:cursor-pointer"
2570   - onClick={() => {
2571   - copyToClipboard(record.notes);
2572   - message.info('备注复制成功:' + record.notes);
2573   - }}
2574   - >
2575   - <span className="text-[#8C8C8C]">备注:</span>
2576   - <span className="ml-2">
2577   - {record.notes === null ? '暂无备注' : record.notes}
2578   - </span>
2579   - </div>
2580   - </div>
2581   -
2582   - {!isSupplier() ? (
2583   - <Tooltip title="编辑">
2584   - <EditTwoTone
2585   - className="pl-1 hover:curcor-pointer"
2586   - onClick={() => {
2587   - setNotesEditVisible(true);
2588   - setSelectedRows([record.id]);
2589   - setNotes(record.notes);
2590   - setNotesType(0);
2591   - }}
2592   - />
2593   - </Tooltip>
2594   - ) : (
2595   - ''
2596   - )}
2597   -
2598   - {record.goodsWeight !== null ? (
2599   - <div title={record.goodsWeight + 'kg'} className="pl-3">
2600   - <div
2601   - className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer"
2602   - onClick={() => {
2603   - copyToClipboard(record.goodsWeight + 'kg');
2604   - message.info(
2605   - '包裹重量复制成功:' + record.goodsWeight + 'kg',
2606   - );
2607   - }}
2608   - >
2609   - <span className="text-[#8C8C8C]">包裹重量:</span>
2610   - <span className="ml-2">{record.goodsWeight + 'kg'}</span>
2611   - </div>
2612   - </div>
2613   - ) : (
2614   - ''
2615   - )}
2616   -
2617   - {record.goodsVolume !== null ? (
2618   - <div title={record.goodsVolume + 'm³'} className="pl-3">
2619   - <div
2620   - className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer"
2621   - onClick={() => {
2622   - copyToClipboard(record.goodsVolume + 'm³');
2623   - message.info(
2624   - '包裹体积复制成功:' + record.goodsVolume + 'm³',
2625   - );
2626   - }}
2627   - >
2628   - <span className="text-[#8C8C8C]">包裹体积:</span>
2629   - <span className="ml-2">{record.goodsVolume + 'm³'}</span>
2630   - </div>
2631   - </div>
2632   - ) : (
2633   - ''
2634   - )}
2635   - </Flex>
2636   - </Flex>
2637   - <Flex wrap="wrap" gap="middle" vertical>
2638   - <Flex justify="flex-end">
2639   - <Flex wrap="wrap" gap="middle" align="center">
2640   - {!isSupplier() ? (
2641   - <div>
2642   - <span className="text-[#8C8C8C]">总金额:¥</span>
2643   - <span className="text-lg font-medium">
2644   - {record.totalPayment}
2645   - </span>
2646   - </div>
2647   - ) : (
2648   - ''
2649   - )}
2650   -
2651   - {rolePath?.includes('addOrder') ? (
2652   - <Tooltip title="复制">
2653   - <CopyTwoTone
2654   - className="hover:cursor-pointer"
2655   - onClick={() => {
2656   - createOptObject(null, record.id);
2657   - copyOrderToClipboard(record);
2658   - setOrderOptType('copy');
2659   - setOrderDrawerVisible(true);
2660   - }}
2661   - />
2662   - </Tooltip>
2663   - ) : (
2664   - <Tooltip title="复制文本">
2665   - <CopyTwoTone
2666   - className="hover:cursor-pointer"
2667   - onClick={() => {
2668   - copyOrderToClipboard(record);
2669   - }}
2670   - />
2671   - </Tooltip>
2672   - )}
2673   - {!isSupplier() ? (
2674   - <Tooltip title="历史">
2675   - <ClockCircleTwoTone
2676   - className="hover:cursor-pointer"
2677   - onClick={() => {
2678   - setHistoryModalVisible(true);
2679   - if (subOrderSelectedMap.get(record.id)?.length) {
2680   - setSelectedRows(subOrderSelectedMap.get(record.id));
2681   - } else {
2682   - setSelectedRows(record.subOrderInformationLists);
2683   - }
2684   - }}
2685   - />
2686   - </Tooltip>
2687   - ) : (
2688   - ''
2689   - )}
2690   - </Flex>
2691   - </Flex>
2692   - <Flex justify="flex-end">
2693   - <Space.Compact direction="vertical" align="end">
2694   - <Space wrap>
2695   - {record.paths?.includes('postAudit') ? (
2696   - <Button
2697   - className="p-0"
2698   - type="link"
2699   - onClick={() => {
2700   - setCurrentMainId(record.id);
2701   - setCurretnOptSubId(null);
2702   - setCheckVisible(true);
2703   - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT);
2704   - }}
2705   - >
2706   - 后置审核
2707   - </Button>
2708   - ) : (
2709   - ''
2710   - )}
2711   - {record.paths?.includes('URGENT_INVOICE_AUDITING') ? (
2712   - <Button
2713   - className="p-0"
2714   - type="link"
2715   - onClick={() => {
2716   - createOptObject(null, record.id);
2717   - setCheckVisible(true);
2718   - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING);
2719   - }}
2720   - >
2721   - 加急审核(新)
2722   - </Button>
2723   - ) : (
2724   - ''
2725   - )}
2726   - {record.paths?.includes('URGENT_INVOICE_AUDITING_old') ? (
2727   - <Button
2728   - className="p-0"
2729   - type="link"
2730   - onClick={() => {
2731   - createOptObject(null, record.id);
2732   - setCheckVisible(true);
2733   - setOrderCheckType(
2734   - CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD,
2735   - );
2736   - }}
2737   - >
2738   - 加急审核(旧)
2739   - </Button>
2740   - ) : (
2741   - ''
2742   - )}
2743   - {record.paths?.includes('salesConfirm') && (
2744   - <ButtonConfirm
2745   - className="p-0"
2746   - title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。"
2747   - text="订单确认"
2748   - onConfirm={async () => {
2749   - let subIds = subOrderSelectedMap
2750   - .get(record.id)
2751   - ?.map((item) => {
2752   - return item.id;
2753   - });
2754   - if (subIds === null || subIds === undefined) {
2755   - subIds = record.subOrderInformationLists.map(
2756   - (item) => {
2757   - return item.id;
2758   - },
2759   - );
2760   - }
2761   - let res = await postServiceOrderSalesConfirm({
2762   - data: {
2763   - subOrderIds: subIds,
2764   - },
2765   - });
2766   -
2767   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
2768   - message.success(res.message);
2769   - refreshTable();
2770   - }
2771   - }}
2772   - />
2773   - )}
2774   - {record.paths?.includes('uploadPaymentReceiptBill') ? (
2775   - <Button
2776   - className="p-0"
2777   - type="link"
2778   - onClick={() => {
2779   - createOptObject(null, record.id);
2780   - setUploadPayBillModalVisible(true);
2781   - }}
2782   - >
2783   - 回款
2784   - </Button>
2785   - ) : (
2786   - ''
2787   - )}
2788   -
2789   - {record.paths?.includes('modifiedAuditRequest') ? (
2790   - <Button
2791   - className="p-0"
2792   - type="link"
2793   - onClick={() => {
2794   - createOptObject(null, record.id);
2795   - setCheckVisible(true);
2796   - setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT);
2797   - }}
2798   - >
2799   - 节点修改审核
2800   - </Button>
2801   - ) : (
2802   - ''
2803   - )}
2804   -
2805   - {record.paths?.includes('auditPaymentReceipt') ? (
2806   - <Button
2807   - className="p-0"
2808   - type="link"
2809   - onClick={() => {
2810   - createOptObject(null, record.id);
2811   - setCheckVisible(true);
2812   - setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT);
2813   - }}
2814   - >
2815   - 回款审核
2816   - </Button>
2817   - ) : (
2818   - ''
2819   - )}
2820   -
2821   - {record.paths?.includes('modifiedLeaderAuditRequest') ? (
2822   - <Button
2823   - className="p-0"
2824   - type="link"
2825   - onClick={() => {
2826   - createOptObject(null, record.id);
2827   - setCheckVisible(true);
2828   - setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT);
2829   - }}
2830   - >
2831   - 领导修改审核
2832   - </Button>
2833   - ) : (
2834   - ''
2835   - )}
2836   -
2837   - {false ? (
2838   - <Button
2839   - className="p-0"
2840   - type="link"
2841   - onClick={() => {
2842   - createOptObject(null, record.id);
2843   - setFinancialReceiptsModalVisible(true);
2844   - setIsEdit(true);
2845   - }}
2846   - >
2847   - 收款记录
2848   - </Button>
2849   - ) : (
2850   - ''
2851   - )}
2852   -
2853   - {record.paths?.includes('reissue_old') ? (
2854   - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'||
2855   - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/
2856   - <Button
2857   - className="p-0"
2858   - type="link"
2859   - onClick={() => {
2860   - setCurrentMainId(record.id);
2861   - setReissueVisibleOld(true);
2862   - console.log(reissueVisible);
2863   - }}
2864   - >
2865   - 重新开票(旧)
2866   - </Button>
2867   - ) : (
2868   - ''
2869   - )}
2870   -
2871   - {record.paths?.includes('confirmReissue_old') ? (
2872   - <Button
2873   - className="p-0"
2874   - type="link"
2875   - onClick={() => {
2876   - setCurrentMainId(record.id);
2877   - setCurretnOptSubId(null);
2878   - setCheckVisible(true);
2879   - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD);
2880   - }}
2881   - >
2882   - 重新开票审核(旧)
2883   - </Button>
2884   - ) : (
2885   - ''
2886   - )}
2887   -
2888   - {record.paths?.includes('reissue') ? (
2889   - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'||
2890   - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/
2891   - <Button
2892   - className="p-0"
2893   - type="link"
2894   - onClick={() => {
2895   - setCurrentMainId(record.id);
2896   - setReissueVisible(true);
2897   - }}
2898   - >
2899   - 重新开票(新)
2900   - </Button>
2901   - ) : (
2902   - ''
2903   - )}
2904   -
2905   - {record.paths?.includes('confirmReissue') ? (
2906   - <Button
2907   - className="p-0"
2908   - type="link"
2909   - onClick={() => {
2910   - setCurrentMainId(record.id);
2911   - setCurretnOptSubId(null);
2912   - setCheckVisible(true);
2913   - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE);
2914   - }}
2915   - >
2916   - 重新开票审核(新)
2917   - </Button>
2918   - ) : (
2919   - ''
2920   - )}
2921   -
2922   - {record.paths?.includes('procureOrder') ? (
2923   - <ButtonConfirm
2924   - className="p-0"
2925   - title="是否下单?"
2926   - text="下单"
2927   - onConfirm={async () => {
2928   - let subIds = subOrderSelectedMap
2929   - .get(record.id)
2930   - ?.map((item) => {
2931   - return item.id;
2932   - });
2933   - if (subIds === null || subIds === undefined) {
2934   - subIds = record.subOrderInformationLists.map(
2935   - (item) => {
2936   - return item.id;
2937   - },
2938   - );
2939   - }
2940   - let res = await postServiceOrderProcureOrder({
2941   - data: { subIds: subIds },
2942   - });
2943   - if (res.result === RESPONSE_CODE.SUCCESS) {
2944   - message.success(res.message);
2945   - refreshTable();
2946   - return true;
2947   - }
2948   - }}
2949   - />
2950   - ) : (
2951   - ''
2952   - )}
2953   -
2954   - {record.paths?.includes('cancelSend') ? (
2955   - <ButtonConfirm
2956   - className="p-0"
2957   - title="是否取消发货?"
2958   - text="取消发货"
2959   - onConfirm={async () => {
2960   - let subIds = subOrderSelectedMap
2961   - .get(record.id)
2962   - ?.map((item) => {
2963   - return item.id;
2964   - });
2965   - if (subIds === null || subIds === undefined) {
2966   - subIds = record.subOrderInformationLists.map(
2967   - (item) => {
2968   - return item.id;
2969   - },
2970   - );
2971   - }
2972   - let res = await postServiceOrderCancelSend({
2973   - data: { subIds: subIds },
2974   - });
2975   - if (res.result === RESPONSE_CODE.SUCCESS) {
2976   - message.success(res.message);
2977   - refreshTable();
2978   - return true;
2979   - }
2980   - }}
2981   - />
2982   - ) : (
2983   - ''
2984   - )}
2985   -
2986   - {record.paths?.includes('applyModify') ? (
2987   - <Button
2988   - className="p-0"
2989   - type="link"
2990   - onClick={() => {
2991   - createOptObject(null, record.id);
2992   - setOrderDrawerVisible(true);
2993   - setOrderOptType('order-change-normal');
2994   - }}
2995   - >
2996   - 申请修改
2997   - </Button>
2998   - ) : (
2999   - ''
3000   - )}
3001   -
3002   - {record.paths?.includes('leaderAudit') ? (
3003   - <Button
3004   - className="p-0"
3005   - type="link"
3006   - onClick={() => {
3007   - let selectedSubOrders = subOrderSelectedMap.get(
3008   - record.id,
3009   - );
3010   - setSelectedRows(selectedSubOrders);
3011   - if (selectedSubOrders === undefined) {
3012   - selectedSubOrders = record.subOrderInformationLists;
3013   - }
3014   - for (let i = 0; i < selectedSubOrders.length; i++) {
3015   - if (
3016   - selectedSubOrders[i].orderStatus !==
3017   - 'LEADER_PROCESS'
3018   - ) {
3019   - message.error('请选择领导待审核的子订单进行审核');
3020   - return;
3021   - }
3022   - }
3023   - createOptObject(null, record.id);
3024   - setCheckVisible(true);
3025   - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT);
3026   - }}
3027   - >
3028   - 审核
3029   - </Button>
3030   - ) : (
3031   - ''
3032   - )}
3033   -
3034   - {record.paths?.includes('changeOrderAudit') ? (
3035   - <Button
3036   - className="p-0"
3037   - type="link"
3038   - onClick={() => {
3039   - let selectedSubOrders = subOrderSelectedMap.get(
3040   - record.id,
3041   - );
3042   - setSelectedRows(selectedSubOrders);
3043   - if (selectedSubOrders === undefined) {
3044   - selectedSubOrders = record.subOrderInformationLists;
3045   - }
3046   - for (let i = 0; i < selectedSubOrders.length; i++) {
3047   - if (
3048   - selectedSubOrders[i].orderStatus !==
3049   - 'MODIFY_APPLY_WAIT_FOR_AUDIT'
3050   - ) {
3051   - message.error('请选择[修改待审核]的子订单进行审核');
3052   - return;
3053   - }
3054   - }
3055   - createOptObject(null, record.id);
3056   - setCheckVisible(true);
3057   - setOrderCheckType(
3058   - CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT,
3059   - );
3060   - }}
3061   - >
3062   - 审核
3063   - </Button>
3064   - ) : (
3065   - ''
3066   - )}
3067   -
3068   - {record.paths?.includes('creditAudit') ? (
3069   - <Button
3070   - className="p-0"
3071   - type="link"
3072   - onClick={() => {
3073   - let selectedSubOrders = subOrderSelectedMap.get(
3074   - record.id,
3075   - );
3076   - setSelectedRows(selectedSubOrders);
3077   - if (selectedSubOrders === undefined) {
3078   - selectedSubOrders = record.subOrderInformationLists;
3079   - }
3080   - for (let i = 0; i < selectedSubOrders.length; i++) {
3081   - if (
3082   - selectedSubOrders[i].orderStatus !==
3083   - 'CREDIT_CONFIRM'
3084   - ) {
3085   - message.error('请选择[赊账待审核]的子订单进行审核');
3086   - return;
3087   - }
3088   - }
3089   - createOptObject(null, record.id);
3090   - setCheckVisible(true);
3091   - setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT);
3092   - }}
3093   - >
3094   - 赊账审核
3095   - </Button>
3096   - ) : (
3097   - ''
3098   - )}
3099   -
3100   - {record.paths?.includes('editProductionTime') ? (
3101   - <Button
3102   - className="p-0"
3103   - type="link"
3104   - onClick={() => {
3105   - createOptObject(null, record.id);
3106   - setProductionTimeModalVisible(true);
3107   - }}
3108   - >
3109   - 生产时间
3110   - </Button>
3111   - ) : (
3112   - ''
3113   - )}
3114   -
3115   - {record.paths?.includes('procureConvertProcure') ? (
3116   - <Button
3117   - className="p-0"
3118   - type="link"
3119   - onClick={() => {
3120   - let selectedSubOrders = subOrderSelectedMap.get(
3121   - record.id,
3122   - );
3123   - if (selectedSubOrders === undefined) {
3124   - selectedSubOrders = record.subOrderInformationLists;
3125   - }
3126   -
3127   - for (let i = 0; i < selectedSubOrders.length; i++) {
3128   - if (
3129   - !selectedSubOrders[i].paths.includes(
3130   - 'procureConvertProcure',
3131   - )
3132   - ) {
3133   - message.error('请选择允许转发的子订单进行转发');
3134   - return;
3135   - }
3136   - }
3137   - createOptObject(null, record.id);
3138   - setOrderCheckType(CHECK_TYPE.PROCURE);
3139   - setProcureConvertModalVisible(true);
3140   - }}
3141   - >
3142   - 转发
3143   - </Button>
3144   - ) : (
3145   - ''
3146   - )}
3147   - {record.paths?.includes('sendProduct') ? (
3148   - <Button
3149   - className="p-0"
3150   - type="link"
3151   - onClick={() => {
3152   - if (!subOrderSelectedMap.get(record.id)?.length) {
3153   - return message.error('请选择选择子订单');
3154   - }
3155   - createOptObject(null, record.id);
3156   - setDeliverVisible(true);
3157   - setIsSendProduct(true);
3158   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
3159   - }}
3160   - >
3161   - 仓库发货
3162   - </Button>
3163   - ) : (
3164   - ''
3165   - )}
3166   -
3167   - {/* 供应商发货 */}
3168   - {record.paths?.includes('supplierSendOrder') ? (
3169   - <Button
3170   - className="p-0"
3171   - type="link"
3172   - onClick={() => {
3173   - if (!subOrderSelectedMap.get(record.id)?.length) {
3174   - return message.error('请选择选择子订单');
3175   - }
3176   - createOptObject(null, record.id);
3177   - setDeliverVisible(true);
3178   - setIsSendProduct(true);
3179   - setOrderCheckType(CHECK_TYPE.SUPPLIER);
3180   - }}
3181   - >
3182   - 供应商发货
3183   - </Button>
3184   - ) : (
3185   - ''
3186   - )}
3187   -
3188   - {record.paths?.includes('procureSend') ? (
3189   - <Button
3190   - className="p-0"
3191   - type="link"
3192   - onClick={() => {
3193   - if (!subOrderSelectedMap.get(record.id)?.length) {
3194   - return message.error('请选择选择子订单');
3195   - }
3196   - createOptObject(null, record.id);
3197   - setDeliverVisible(true);
3198   - setIsSendProduct(true);
3199   - setOrderCheckType(CHECK_TYPE.PROCURE);
3200   - }}
3201   - >
3202   - {isSupplier() ? '发货' : '采购发货'}
3203   - </Button>
3204   - ) : (
3205   - ''
3206   - )}
3207   -
3208   - {record.paths?.includes('printOrder') ? (
3209   - <Button
3210   - className="p-0"
3211   - type="link"
3212   - onClick={() => {
3213   - const selectedSubOrders = subOrderSelectedMap.get(
3214   - record.id,
3215   - );
3216   - if (!selectedSubOrders?.length) {
3217   - return message.error('请选择选择子订单');
3218   - }
3219   -
3220   - for (let subOrderRecord of selectedSubOrders) {
3221   - let paths = subOrderRecord.paths;
3222   - if (!checkePrintable(paths)) {
3223   - return message.error('请选择可以打印的子订单');
3224   - }
3225   - }
3226   - createOptObject(null, record.id);
3227   - setOrderPrintVisible(true);
3228   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
3229   - }}
3230   - >
3231   - 仓库打印
3232   - </Button>
3233   - ) : (
3234   - ''
3235   - )}
3236   -
3237   - {record.paths?.includes('supplierPrint') ? (
3238   - <Button
3239   - className="p-0"
3240   - type="link"
3241   - onClick={() => {
3242   - if (!subOrderSelectedMap.get(record.id)?.length) {
3243   - return message.error('请选择选择子订单');
3244   - }
3245   -
3246   - createOptObject(null, record.id);
3247   - setOrderPrintVisible(true);
3248   - setOrderCheckType(CHECK_TYPE.SUPPLIER);
3249   - }}
3250   - >
3251   - 供应商打印
3252   - </Button>
3253   - ) : (
3254   - ''
3255   - )}
3256   -
3257   - {record.paths?.includes('rePrintOrder') ? (
3258   - <Button
3259   - className="p-0"
3260   - type="link"
3261   - onClick={() => {
3262   - if (!subOrderSelectedMap.get(record.id)?.length) {
3263   - return message.error('请选择选择子订单');
3264   - }
3265   - createOptObject(null, record.id);
3266   - setOrderPrintVisible(true);
3267   - setIsRePrintOrder(true);
3268   - }}
3269   - >
3270   - 重新打印
3271   - </Button>
3272   - ) : (
3273   - ''
3274   - )}
3275   - {record.paths?.includes('confirmReceipt') ? (
3276   - <Button
3277   - className="p-0"
3278   - type="link"
3279   - onClick={() => {
3280   - createOptObject(null, record.id);
3281   - setConfirmReceiptVisible(true);
3282   - }}
3283   - >
3284   - 确认收货
3285   - </Button>
3286   - ) : (
3287   - ''
3288   - )}
3289   - {record.paths?.includes('modifySendInformation') ? (
3290   - <Button
3291   - className="p-0"
3292   - type="link"
3293   - onClick={() => {
3294   - if (!subOrderSelectedMap.get(record.id)?.length) {
3295   - return message.error(
3296   - '请选择已经发货或者已经确认收货的子订单',
3297   - );
3298   - }
3299   - for (let row of subOrderSelectedMap.get(record.id)) {
3300   - if (
3301   - row.orderStatus !== 'CONFIRM_RECEIPT' &&
3302   - row.orderStatus !== 'SHIPPED'
3303   - ) {
3304   - return message.error(
3305   - '请选择已经发货或者已经确认收货的子订单',
3306   - );
3307   - }
3308   - }
3309   - createOptObject(null, record.id);
3310   - setDeliverVisible(true);
3311   - setIsSendProduct(false);
3312   - }}
3313   - >
3314   - 修改发货信息
3315   - </Button>
3316   - ) : (
3317   - ''
3318   - )}
3319   - {record.paths?.includes('invoicing') ? (
3320   - <Button
3321   - type="link"
3322   - className="p-0"
3323   - onClick={() => {
3324   - createOptObject(null, record.id);
3325   - setFinancialVisible(true);
3326   - setIsEdit(false);
3327   - }}
3328   - >
3329   - 开票
3330   - </Button>
3331   - ) : (
3332   - ''
3333   - )}
3334   -
3335   - {record.paths?.includes('applyInvoicing_old') ? (
3336   - <Button
3337   - type="link"
3338   - className="p-0"
3339   - onClick={() => {
3340   - let selectedSubOrders = subOrderSelectedMap.get(
3341   - record.id,
3342   - );
3343   - if (selectedSubOrders === undefined) {
3344   - selectedSubOrders = record.subOrderInformationLists;
3345   - }
3346   - for (let i = 0; i < selectedSubOrders.length; i++) {
3347   - if (
3348   - selectedSubOrders[i].invoicingStatus ===
3349   - 'UN_INVOICE' ||
3350   - selectedSubOrders[i].afterInvoicingStatus ===
3351   - 'APPLY_FOR_INVOICING'
3352   - ) {
3353   - message.error(
3354   - '请选择需要开票且未申请开票的子订单进行申请',
3355   - );
3356   - return;
3357   - }
3358   - }
3359   -
3360   - createOptObject(null, record.id);
3361   - setApplyForInvoicingVisible(true);
3362   - setIsEdit(false);
3363   - setIsMainOrder(false);
3364   - }}
3365   - >
3366   - 申请开票(旧)
3367   - </Button>
3368   - ) : (
3369   - ''
3370   - )}
3371   -
3372   - {record.paths?.includes('applyInvoicing') ? (
3373   - <Button
3374   - type="link"
3375   - className="p-0"
3376   - onClick={() => {
3377   - let selectedSubOrders = subOrderSelectedMap.get(
3378   - record.id,
3379   - );
3380   - if (selectedSubOrders === undefined) {
3381   - selectedSubOrders = record.subOrderInformationLists;
3382   - }
3383   - for (let i = 0; i < selectedSubOrders.length; i++) {
3384   - if (
3385   - selectedSubOrders[i].invoicingStatus ===
3386   - 'UN_INVOICE' ||
3387   - selectedSubOrders[i].afterInvoicingStatus ===
3388   - 'APPLY_FOR_INVOICING'
3389   - ) {
3390   - message.error(
3391   - '请选择需要开票且未申请开票的子订单进行申请',
3392   - );
3393   - return;
3394   - }
3395   - }
3396   -
3397   - createOptObject(null, record.id);
3398   - setInvoicingDrawerFormVisible(true);
3399   - setIsEdit(false);
3400   - setIsMainOrder(false);
3401   - }}
3402   - >
3403   - 申请开票(新)
3404   - </Button>
3405   - ) : (
3406   - ''
3407   - )}
3408   -
3409   - {record.paths?.includes('updateOrder') ? (
3410   - <Button
3411   - className="p-0"
3412   - type="link"
3413   - onClick={() => {
3414   - //勾选的子订单:如果有勾选,后面只校验有勾选的
3415   -
3416   - let selectedSubOrders = subOrderSelectedMap.get(
3417   - record.id,
3418   - );
3419   - if (
3420   - selectedSubOrders === undefined ||
3421   - selectedSubOrders.length === 0
3422   - ) {
3423   - selectedSubOrders = record.subOrderInformationLists;
3424   - }
3425   - for (
3426   - let index = 0;
3427   - index < selectedSubOrders.length;
3428   - index++
3429   - ) {
3430   - let orderStatus =
3431   - selectedSubOrders[index].orderStatus;
3432   - //仓库管理员在审核之后的任何时候都可以编辑
3433   - if (
3434   - roleCode !== 'warehouseKeeper' &&
3435   - roleCode !== 'admin'
3436   - ) {
3437   - //是审核通过及之后的订单
3438   - if (
3439   - orderStatus !== 'UNAUDITED' &&
3440   - orderStatus !== 'AUDIT_FAILED' &&
3441   - orderStatus !== 'LEADER_PROCESS' &&
3442   - orderStatus !== 'SALES_CONFIRM' &&
3443   - orderStatus !== 'CREDIT_CONFIRM'
3444   - ) {
3445   - message.error(
3446   - '请选择【未审核、审核失败、销售待确认、赊账待审核】的订单进行编辑',
3447   - );
3448   - return;
3449   - }
3450   - } else {
3451   - //仓库管理员只能编辑是还未审核的订单
3452   - if (
3453   - roleCode !== 'admin' &&
3454   - (orderStatus === 'UNAUDITED' ||
3455   - orderStatus === 'AUDIT_FAILED')
3456   - ) {
3457   - message.error('请选择已审核的订单进行编辑');
3458   - return;
3459   - }
3460   - }
3461   - }
3462   -
3463   - createOptObject(null, record.id);
3464   - setOrderDrawerVisible(true);
3465   - setOrderOptType('edit');
3466   - }}
3467   - >
3468   - 编辑
3469   - </Button>
3470   - ) : (
3471   - ''
3472   - )}
3473   -
3474   - {record?.subOrderInformationLists[0].paths?.includes(
3475   - 'noNeedInvoicingEdit',
3476   - ) ? (
3477   - <Button
3478   - className="p-0"
3479   - type="link"
3480   - onClick={() => {
3481   - createOptObject(null, record.id);
3482   - setFinancialEditVisible(true);
3483   - setIsMainOrder(true);
3484   - }}
3485   - >
3486   - 财务编辑
3487   - </Button>
3488   - ) : (
3489   - ''
3490   - )}
3491   -
3492   - {record.paths?.includes('checkOrder') ? (
3493   - <Button
3494   - className="p-0"
3495   - type="link"
3496   - onClick={() => {
3497   - let selectedSubOrders = subOrderSelectedMap.get(
3498   - record.id,
3499   - );
3500   - setSelectedRows(selectedSubOrders);
3501   - if (selectedSubOrders === undefined) {
3502   - selectedSubOrders = record.subOrderInformationLists;
3503   - }
3504   - for (let i = 0; i < selectedSubOrders.length; i++) {
3505   - let orderStatus = selectedSubOrders[i].orderStatus;
3506   - if (
3507   - orderStatus !== 'UNAUDITED' &&
3508   - orderStatus !== 'FINANCE_PROCESS' &&
3509   - orderStatus !== 'LEADER_AUDITED'
3510   - ) {
3511   - message.error(
3512   - '请选择未审核或者领导已审核的子订单进行审核',
3513   - );
3514   - return;
3515   - }
3516   - }
3517   -
3518   - createOptObject(null, record.id);
3519   - setCheckVisible(true);
3520   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
3521   - }}
3522   - >
3523   - 审核
3524   - </Button>
3525   - ) : (
3526   - ''
3527   - )}
3528   -
3529   - {record.paths?.includes('afterSalesCheck') ? (
3530   - <Button
3531   - className="p-0"
3532   - type="link"
3533   - onClick={() => {
3534   - let selectedSubOrders = subOrderSelectedMap.get(
3535   - record.id,
3536   - );
3537   - setSelectedRows(selectedSubOrders);
3538   - if (selectedSubOrders === undefined) {
3539   - selectedSubOrders = record.subOrderInformationLists;
3540   - }
3541   - for (let i = 0; i < selectedSubOrders.length; i++) {
3542   - if (
3543   - selectedSubOrders[i].orderStatus !==
3544   - 'IN_AFTER_SALES'
3545   - ) {
3546   - message.error('请选择售后中的子订单进行审核');
3547   - return;
3548   - }
3549   - }
3550   -
3551   - createOptObject(null, record.id);
3552   - setCheckVisible(true);
3553   - setOrderCheckType(CHECK_TYPE.AFTER_SALES);
3554   - }}
3555   - >
3556   - 售后审核
3557   - </Button>
3558   - ) : (
3559   - ''
3560   - )}
3561   -
3562   - {record.paths?.includes('noNeedSend') ? (
3563   - <ButtonConfirm
3564   - className="p-0"
3565   - title="此订单是否无需发货?"
3566   - text="无需发货"
3567   - onConfirm={async () => {
3568   - let selectedSubOrders = subOrderSelectedMap.get(
3569   - record.id,
3570   - );
3571   - if (selectedSubOrders === undefined) {
3572   - selectedSubOrders = record.subOrderInformationLists;
3573   - }
3574   - setSelectedRows(selectedSubOrders);
3575   - for (let i = 0; i < selectedSubOrders.length; i++) {
3576   - if (
3577   - selectedSubOrders[i].orderStatus !== 'AUDITED' &&
3578   - selectedSubOrders[i].orderStatus !==
3579   - 'PROCURE_PROCESS' &&
3580   - selectedSubOrders[i].orderStatus !==
3581   - 'PROCURE_PROCESS_FOR_MINE' &&
3582   - selectedSubOrders[i].orderStatus !==
3583   - 'PROCURE_WAIT_SHIP' &&
3584   - selectedSubOrders[i].orderStatus !==
3585   - 'SUPPLIER_WAIT_SHIP' &&
3586   - selectedSubOrders[i].orderStatus !== 'WAIT_SHIP'
3587   - ) {
3588   - message.error(
3589   - '请选择未发货的子订单进行无需发货操作',
3590   - );
3591   - return;
3592   - }
3593   - }
3594   -
3595   - const data = await postServiceOrderNoNeedSend({
3596   - data: {
3597   - ids: selectedSubOrders.map((item) => {
3598   - return item.id;
3599   - }),
3600   - },
3601   - });
3602   - if (data.result === RESPONSE_CODE.SUCCESS) {
3603   - message.success(data.message);
3604   - refreshTable();
3605   - }
3606   - }}
3607   - />
3608   - ) : (
3609   - ''
3610   - )}
3611   -
3612   - {record.paths?.includes('saleCancelInvoicing_old') ? (
3613   - <ButtonConfirm
3614   - className="p-0"
3615   - title="确认取消申请开票?"
3616   - text="取消申请(旧)"
3617   - onConfirm={async () => {
3618   - let selectedSubOrders = subOrderSelectedMap.get(
3619   - record.id,
3620   - );
3621   - if (selectedSubOrders === undefined) {
3622   - selectedSubOrders = record.subOrderInformationLists;
3623   - }
3624   -
3625   - console.log(selectedSubOrders);
3626   - for (let i = 0; i < selectedSubOrders.length; i++) {
3627   - if (
3628   - selectedSubOrders[i].afterInvoicingStatus !==
3629   - 'APPLY_FOR_INVOICING'
3630   - ) {
3631   - message.error(
3632   - '请选择已[申请开票]的子订单进行取消申请',
3633   - );
3634   - return;
3635   - }
3636   - }
3637   - let res = await postServiceOrderSaleCancelInvoicing({
3638   - data: {
3639   - subOrderIds: selectedSubOrders.map((item) => {
3640   - return item.id;
3641   - }),
3642   - },
3643   - });
3644   -
3645   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
3646   - message.success(res.message);
3647   - refreshTable();
3648   - }
3649   - }}
3650   - />
3651   - ) : (
3652   - ''
3653   - )}
3654   - {/* 财务审核:主订单暂无 */}
3655   - {record.paths?.includes('financeCheckOrder') ? (
3656   - <Button
3657   - className="p-0"
3658   - type="link"
3659   - onClick={() => {
3660   - let selectedSubOrders = subOrderSelectedMap.get(
3661   - record.id,
3662   - );
3663   - setSelectedRows(selectedSubOrders);
3664   - if (selectedSubOrders === undefined) {
3665   - selectedSubOrders = record.subOrderInformationLists;
3666   - }
3667   - for (let i = 0; i < selectedSubOrders.length; i++) {
3668   - if (
3669   - selectedSubOrders[i].orderStatus !== 'UNAUDITED' &&
3670   - selectedSubOrders[i].orderStatus !==
3671   - 'FINANCE_PROCESS' &&
3672   - selectedSubOrders[i].orderStatus !==
3673   - 'LEADER_AUDITED'
3674   - ) {
3675   - message.error(
3676   - '请选择[未审核]、[财务待审核]、[领导已审核]的子订单进行审核',
3677   - );
3678   - return;
3679   - }
3680   - }
3681   - createOptObject(null, record.id);
3682   - setCheckVisible(true);
3683   - setOrderCheckType(CHECK_TYPE.FINALCIAL);
3684   - }}
3685   - >
3686   - 财务审核
3687   - </Button>
3688   - ) : (
3689   - ''
3690   - )}
3691   -
3692   - {/* 采购审核 */}
3693   - {record.paths?.includes('procureCheckOrder') ? (
3694   - <Button
3695   - className="p-0"
3696   - type="link"
3697   - onClick={() => {
3698   - let selectedSubOrders = subOrderSelectedMap.get(
3699   - record.id,
3700   - );
3701   - setSelectedRows(selectedSubOrders);
3702   - if (selectedSubOrders === undefined) {
3703   - selectedSubOrders = record.subOrderInformationLists;
3704   - }
3705   - for (let i = 0; i < selectedSubOrders.length; i++) {
3706   - if (
3707   - selectedSubOrders[i].orderStatus !==
3708   - 'PROCURE_UN_PROCESS'
3709   - ) {
3710   - message.error('请选择未审核的子订单进行审核');
3711   - return;
3712   - }
3713   - }
3714   -
3715   - createOptObject(null, record.id);
3716   - setProcureCheckModalVisible(true);
3717   - setOrderCheckType(CHECK_TYPE.PROCURE);
3718   - }}
3719   - >
3720   - 采购审核
3721   - </Button>
3722   - ) : (
3723   - ''
3724   - )}
3725   -
3726   - {record.paths?.includes('applyAfterSales') ? (
3727   - <Button
3728   - className="p-0"
3729   - type="link"
3730   - onClick={() => {
3731   - let selectedSubOrders = subOrderSelectedMap.get(
3732   - record.id,
3733   - );
3734   - if (selectedSubOrders === undefined) {
3735   - selectedSubOrders = record.subOrderInformationLists;
3736   - }
3737   - setSelectedRows(selectedSubOrders);
3738   - for (let i = 0; i < selectedSubOrders.length; i++) {
3739   - if (
3740   - selectedSubOrders[i].orderStatus !==
3741   - 'CONFIRM_RECEIPT' &&
3742   - selectedSubOrders[i].orderStatus !==
3743   - 'AFTER_SALES_FAILURE'
3744   - ) {
3745   - message.error('请选择确认收货状态的子订单进行售后');
3746   - return;
3747   - }
3748   - }
3749   -
3750   - createOptObject(null, record.id);
3751   - setOrderDrawerVisible(true);
3752   - setOrderOptType('after-sales');
3753   - }}
3754   - >
3755   - 申请售后
3756   - </Button>
3757   - ) : (
3758   - ''
3759   - )}
3760   -
3761   - {/* {record.paths?.includes('afterSalesCompletion') ? (
3762   - <ButtonConfirm
3763   - className="p-0"
3764   - title="售后是否已完成?"
3765   - text="完成售后"
3766   - onConfirm={async () => {
3767   - let selectedSubOrders = subOrderSelectedMap.get(record.id);
3768   - if (selectedSubOrders === undefined) {
3769   - selectedSubOrders = record.subOrderInformationLists;
3770   - }
3771   - for (let i = 0; i < selectedSubOrders.length; i++) {
3772   - if (
3773   - selectedSubOrders[i].orderStatus !==
3774   - 'IN_AFTER_SALES'
3775   - ) {
3776   - message.error(
3777   - '请选择售后中状态的子订单进行完成售后',
3778   - );
3779   - return false;
3780   - }
3781   - }
3782   -
3783   - const ids = selectedSubOrders?.map((item) => {
3784   - return item.id;
3785   - });
3786   -
3787   - let body = {
3788   - ids: ids,
3789   - };
3790   - const data = await postServiceOrderAfterSalesCompletion(
3791   - {
3792   - data: body,
3793   - },
3794   - );
3795   - if (data.result === RESPONSE_CODE.SUCCESS) {
3796   - message.success(data.message);
3797   - refreshTable();
3798   - }
3799   - }}
3800   - />
3801   - ) : (
3802   - ''
3803   - )} */}
3804   -
3805   - {record.paths?.includes('salOrderSave') ? (
3806   - <ButtonConfirm
3807   - className="p-0"
3808   - title="是否推送至金蝶ERP?"
3809   - text="推送ERP"
3810   - onConfirm={async () => {
3811   - let res = await postKingdeeRepSalOrderSave({
3812   - data: {
3813   - id: record.id,
3814   - },
3815   - });
3816   -
3817   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
3818   - message.success('推送成功');
3819   - mainTableRef.current.reload();
3820   - }
3821   - }}
3822   - />
3823   - ) : (
3824   - ''
3825   - )}
3826   -
3827   - {record.paths?.includes('salBillOutbound') ? (
3828   - <ButtonConfirm
3829   - className="p-0"
3830   - title="是否下推金蝶ERP出库单?"
3831   - text="下推出库"
3832   - onConfirm={async () => {
3833   - let res = await postKingdeeRepSalBillOutbound({
3834   - data: {
3835   - id: record.id,
3836   - },
3837   - });
3838   -
3839   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
3840   - message.success('下推成功');
3841   - mainTableRef.current.reload();
3842   - }
3843   - }}
3844   - />
3845   - ) : (
3846   - ''
3847   - )}
3848   -
3849   - {record.paths?.includes('orderCancel') ? (
3850   - <ButtonConfirm
3851   - className="p-0"
3852   - title="确认作废?"
3853   - text="作废"
3854   - onConfirm={async () => {
3855   - let body = {
3856   - ids: [record.id],
3857   - checkIsMainOrderId: true,
3858   - };
3859   - const data = await postServiceOrderOrderCancel({
3860   - data: body,
3861   - });
3862   - if (data.result === RESPONSE_CODE.SUCCESS) {
3863   - message.success(data.message);
3864   - refreshTable();
3865   - }
3866   - }}
3867   - />
3868   - ) : (
3869   - ''
3870   - )}
3871   -
3872   - {record.paths?.includes('procurePrint') ? (
3873   - <ButtonConfirm
3874   - className="p-0"
3875   - title="确认打印?"
3876   - text="采购打印"
3877   - onConfirm={async () => {
3878   - let selectedSubOrders = subOrderSelectedMap.get(
3879   - record.id,
3880   - );
3881   - if (selectedSubOrders === undefined) {
3882   - selectedSubOrders = record.subOrderInformationLists;
3883   - }
3884   - for (let i = 0; i < selectedSubOrders.length; i++) {
3885   - if (
3886   - selectedSubOrders[i].orderStatus !==
3887   - 'PROCURE_PROCESS_FOR_MINE'
3888   - ) {
3889   - message.error(
3890   - '请选择采购待打印状态的子订单进行打印',
3891   - );
3892   - return false;
3893   - }
3894   - }
3895   -
3896   - const ids = selectedSubOrders?.map((item) => {
3897   - return item.id;
3898   - });
3899   - let res = await postServiceOrderProcurePrint({
3900   - data: {
3901   - ids: ids,
3902   - },
3903   - });
3904   -
3905   - if (res.result === RESPONSE_CODE.SUCCESS) {
3906   - message.success(res.message);
3907   - refreshTable();
3908   - }
3909   - }}
3910   - />
3911   - ) : (
3912   - // <Button
3913   - // className="p-0"
3914   - // type="link"
3915   - // onClick={() => {
3916   - // if (!subOrderSelectedMap.get(record.id)?.length) {
3917   - // return message.error('请选择选择子订单');
3918   - // }
3919   - // setSelectedRows(subOrderSelectedMap.get(record.id));
3920   - // setOrderRow(record);
3921   - // setOrderPrintVisible(true);
3922   - // setOrderCheckType(CHECK_TYPE.PROCURE);
3923   - // }}
3924   - // >
3925   - // 采购打印
3926   - // </Button>
3927   - ''
3928   - )}
3929   - </Space>
3930   - </Space.Compact>
3931   - </Flex>
3932   - </Flex>
3933   - </Flex>
3934   -
3935   - <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg">
3936   - {expandedRowRender(record)}
3937   - </Flex>
3938   - </Flex>
3939   - );
3940   - };
3941   -
3942   - // 主订单列表
3943   - const mainOrdersColumns: ProColumns<OrderType>[] = MAIN_ORDER_COLUMNS.map(
3944   - (item) => {
3945   - //首能账号只能搜索订单编号
3946   - let canSearchIndex = [
3947   - 'id',
3948   - 'salesCode',
3949   - 'subNotes',
3950   - 'orderStatus',
3951   - 'createTime',
3952   - 'modifiedAuditStatus',
3953   - ];
3954   - if (isSupplier() && !canSearchIndex.includes(item.dataIndex)) {
3955   - item.search = false;
3956   - }
3957   -
3958   - canSearchIndex = [
3959   - 'id',
3960   - 'salesCode',
3961   - 'customerName',
3962   - 'institution',
3963   - 'productName',
3964   - 'orderStatus',
3965   - 'createTime',
3966   - ];
3967   -
3968   - if (isExaminer() && !canSearchIndex.includes(item.dataIndex)) {
3969   - item.search = false;
3970   - }
3971   -
3972   - if (item.dataIndex === 'name') {
3973   - return {
3974   - ...item,
3975   - title: <OrderTableHeader />,
3976   - render: (text, record) => {
3977   - return <MainOrderColumnRender record={record} />;
3978   - },
3979   - };
3980   - }
3981   -
3982   - /**
3983   - * 采购的订单状态筛选内容
3984   - */
3985   - if (roleCode === 'procure' && item.dataIndex === 'orderStatus') {
3986   - item.valueEnum = enumToProTableEnumValue(
3987   - PROCURE_PRIMARY_ORDER_STATUS_OPTIONS,
3988   - );
3989   - }
3990   - return item;
3991   - },
3992   - );
3993   -
3994   - /**
3995   - * 采购可以筛选供应商备注
3996   - */
3997   - if ((roleCode === 'procure' || roleCode === 'admin') && !isSupplier()) {
3998   - mainOrdersColumns.push({
3999   - title: '供应商备注',
4000   - width: 120,
4001   - dataIndex: 'supplierNotes',
4002   - valueType: 'text',
4003   - hideInTable: true,
4004   - });
4005   - }
4006   -
4007   - /**
4008   - * 采购可以筛选其他采购
4009   - */
4010   - if ((roleCode === 'procure' || roleCode === 'admin') && !isSupplier()) {
4011   - mainOrdersColumns.push({
4012   - title: '采购名称',
4013   - width: 120,
4014   - dataIndex: 'supplierName',
4015   - valueType: 'select',
4016   - request: async () => {
4017   - const res = await postServiceOrderProvideProcurementRoles();
4018   - let options = res.data?.map((item) => {
4019   - return { label: item, value: item };
4020   - });
4021   - return options;
4022   - },
4023   - hideInTable: true,
4024   - });
4025   - }
4026   -
4027   - /**
4028   - * 排除采购
4029   - */
4030   - if ((roleCode === 'procure' || roleCode === 'admin') && !isSupplier()) {
4031   - mainOrdersColumns.push({
4032   - title: '采购排除',
4033   - width: 120,
4034   - dataIndex: 'excludeProcureNames',
4035   - fieldProps: {
4036   - mode: 'multiple',
4037   - },
4038   - valueType: 'select',
4039   - request: async () => {
4040   - const res = await postServiceOrderProvideProcurementRoles();
4041   - let options = res.data?.map((item) => {
4042   - return { label: item, value: item };
4043   - });
4044   - return options;
4045   - },
4046   - hideInTable: true,
4047   - });
4048   - }
4049   -
4050   - /**
4051   - * 仓库可以筛选发货仓库
4052   - */
4053   - if (roleCode === 'warehouseKeeper' || roleCode === 'admin') {
4054   - mainOrdersColumns.push({
4055   - title: '发货仓库',
4056   - width: 120,
4057   - dataIndex: 'shippingWarehouse',
4058   - valueType: 'select',
4059   - valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS),
4060   - hideInTable: true,
4061   - });
4062   - }
4063   -
4064   - //判断是否是采购,是的话新增一个筛选条件
4065   - if (roleCode === 'procure' || roleCode === 'admin') {
4066   - mainOrdersColumns.push({
4067   - title: isSupplier() ? '下单状态' : '采购下单状态',
4068   - dataIndex: 'procureOrderStatus',
4069   - valueType: 'select',
4070   - hideInTable: true,
4071   - valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS),
4072   - });
4073   - }
4074   -
4075   - function toolBarRender() {
4076   - let toolBtns = [];
4077   - let radios: any[] = [];
4078   -
4079   - radios.push(<Radio value={0}>全部</Radio>);
4080   -
4081   - if (
4082   - roleCode === 'admin' ||
4083   - roleCode === 'salesManager' ||
4084   - roleCode === 'salesRepresentative'
4085   - ) {
4086   - radios.push(<Radio value={70}>只看作废</Radio>);
4087   - }
4088   -
4089   - if (roleCode === 'warehouseKeeper') {
4090   - radios.push(<Radio value={40}>待处理</Radio>);
4091   - }
4092   -
4093   - //采购可以筛选出需要处理的订单
4094   - if (roleCode === 'procure' && !isSupplier()) {
4095   - radios.push(<Radio value={60}>其他采购</Radio>);
4096   - radios.push(<Radio value={10}>待处理</Radio>);
4097   - }
4098   -
4099   - //财务可以将需要处理的订单排序到前面
4100   - if (roleCode === 'finance') {
4101   - radios.push(<Radio value={50}>加急</Radio>);
4102   -
4103   - radios.push(<Radio value={40}>待处理</Radio>);
4104   -
4105   - radios.push(<Checkbox onChange={financeSorted}>排序</Checkbox>);
4106   - }
4107   -
4108   - if (roleCode === 'salesRepresentative' || roleCode === 'salesManager') {
4109   - radios.push(<Radio value={30}>只看我创建</Radio>);
4110   -
4111   - radios.push(<Radio value={40}>待审核</Radio>);
4112   - }
4113   -
4114   - if (roleCode === 'admin') {
4115   - radios.push(<Radio value={10}>待处理</Radio>);
4116   - radios.push(<Checkbox onChange={financeSorted}>排序</Checkbox>);
4117   - }
4118   -
4119   - //筛选按钮配置
4120   - let radioGroup = (
4121   - <Radio.Group
4122   - onChange={(e: any) => {
4123   - setFilterCondition(e.target.value);
4124   - refreshTable();
4125   - }}
4126   - defaultValue={0}
4127   - >
4128   - {radios}
4129   - </Radio.Group>
4130   - );
4131   -
4132   - toolBtns.push(radioGroup);
4133   -
4134   - toolBtns.push(<ImportExpressBillModal></ImportExpressBillModal>);
4135   -
4136   - //导出按钮配置
4137   - const exportItems: MenuProps['items'] = [
4138   - {
4139   - label: '导出查询结果订单',
4140   - key: '2',
4141   - onClick: async () => {
4142   - let body = { flag: 50, ...searchParams };
4143   - exportLoading();
4144   - orderExport(
4145   - '/api/service/order/export',
4146   - '订单导出结果.xls',
4147   - 'POST',
4148   - body,
4149   - exportLoadingDestory,
4150   - );
4151   - },
4152   - },
4153   - {
4154   - label: '导出已选中订单',
4155   - key: '1',
4156   - onClick: async () => {
4157   - if (mainOrderSelectedMap.size === 0) {
4158   - message.error('请选择订单');
4159   - return;
4160   - }
4161   - let body = { flag: 30, id: Array.from(mainOrderSelectedMap.keys()) };
4162   - exportLoading();
4163   - orderExport(
4164   - '/api/service/order/export',
4165   - '订单导出结果.xls',
4166   - 'POST',
4167   - body,
4168   - exportLoadingDestory,
4169   - );
4170   - },
4171   - },
4172   - {
4173   - label: '导出当天订单',
4174   - key: '4',
4175   - onClick: async () => {
4176   - let body = { flag: 40, ids: [] };
4177   - exportLoading();
4178   - orderExport(
4179   - '/api/service/order/export',
4180   - '订单导出结果.xls',
4181   - 'POST',
4182   - body,
4183   - exportLoadingDestory,
4184   - );
4185   - },
4186   - },
4187   - {
4188   - label: '导出所有订单',
4189   - key: '3',
4190   - onClick: async () => {
4191   - let body = { flag: 10, ids: [] };
4192   - exportLoading();
4193   - orderExport(
4194   - '/api/service/order/export',
4195   - '订单导出结果.xls',
4196   - 'POST',
4197   - body,
4198   - exportLoadingDestory,
4199   - );
4200   - },
4201   - },
4202   - ];
4203   -
4204   - const exportMenuProps = {
4205   - items: exportItems,
4206   - onClick: () => { },
4207   - };
4208   -
4209   - //导出按钮配置
4210   - const auditItems: MenuProps['items'] = [
4211   - {
4212   - label: '后置审核',
4213   - key: '1',
4214   - onClick: async () => {
4215   - setIsMainOrder(true);
4216   - setCheckVisible(true);
4217   - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT);
4218   - },
4219   - },
4220   - {
4221   - label: '加急开票审核(旧)',
4222   - key: '2',
4223   - disabled: true,
4224   - onClick: async () => {
4225   - setIsMainOrder(true);
4226   - setCheckVisible(true);
4227   - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD);
4228   - },
4229   - },
4230   - {
4231   - label: '领导审核',
4232   - key: '3',
4233   - onClick: async () => {
4234   - setIsMainOrder(true);
4235   - setCheckVisible(true);
4236   - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT);
4237   - },
4238   - },
4239   - {
4240   - label: '修改申请审核',
4241   - key: '4',
4242   - onClick: async () => {
4243   - setIsMainOrder(true);
4244   - setCheckVisible(true);
4245   - setOrderCheckType(CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT);
4246   - },
4247   - },
4248   - ];
4249   -
4250   - const auditProps = {
4251   - items: auditItems,
4252   - onClick: () => { },
4253   - };
4254   -
4255   - if (rolePath?.includes('leaderMergeAudit')) {
4256   - toolBtns.push(
4257   - <Dropdown
4258   - disabled={selectedSubOrderKeys.length === 0}
4259   - menu={auditProps}
4260   - >
4261   - <Button>
4262   - <Space>
4263   - 一键审核
4264   - <DownOutlined />
4265   - </Space>
4266   - </Button>
4267   - </Dropdown>,
4268   - );
4269   - }
4270   -
4271   - if (rolePath?.includes('mergeAudit')) {
4272   - toolBtns.push(
4273   - <Button
4274   - type="primary"
4275   - key="out"
4276   - onClick={() => {
4277   - setIsMainOrder(true);
4278   - if (roleCode === 'procure') {
4279   - setProcureCheckModalVisible(true);
4280   - }
4281   -
4282   - if (roleCode === 'warehouseKeeper') {
4283   - setCheckVisible(true);
4284   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
4285   - }
4286   - }}
4287   - disabled={selectedSubOrderKeys?.length === 0}
4288   - >
4289   - 一键审核
4290   - </Button>,
4291   - );
4292   - }
4293   -
4294   - if (rolePath?.includes('mergeProcureOrder')) {
4295   - toolBtns.push(
4296   - <Button
4297   - key="mergeProcureOrder"
4298   - type="primary"
4299   - disabled={selectedSubOrderKeys.length === 0}
4300   - onClick={() => {
4301   - Modal.confirm({
4302   - title: '一键下单',
4303   - content: '选中的订单是否都已下单?',
4304   - onOk: async () => {
4305   - let res = await postServiceOrderProcureOrder({
4306   - data: { subIds: [...selectedSubOrderKeys.values()].flat() },
4307   - });
4308   - if (res.result === RESPONSE_CODE.SUCCESS) {
4309   - message.success(res.message);
4310   - refreshTable();
4311   - return true;
4312   - }
4313   - },
4314   - });
4315   - }}
4316   - >
4317   - 一键下单
4318   - </Button>,
4319   - );
4320   - }
4321   -
4322   - if (rolePath?.includes('mergeApplyInvoicing')) {
4323   - toolBtns.push(
4324   - <Button
4325   - type="primary"
4326   - key="out"
4327   - onClick={() => {
4328   - setIsEdit(false);
4329   - setIsMainOrder(true);
4330   - setApplyForInvoicingVisible(true);
4331   - }}
4332   - disabled={!canMergeInvoicing} /*{selectedSubOrderKeys?.length === 0}*/
4333   - >
4334   - {roleCode === 'admin' ? '合并(销售)' : '合并开票'}
4335   - </Button>,
4336   - );
4337   - }
4338   -
4339   - <Button
4340   - type="primary"
4341   - key="out"
4342   - onClick={() => {
4343   - setIsEdit(false);
4344   - setIsMainOrder(true);
4345   - setInvoicingDrawerFormVisible(true);
4346   - }}
4347   - disabled={selectedSubOrderKeys?.length === 0}
4348   - >
4349   - 申请开票(旧)
4350   - </Button>;
4351   -
4352   - if (rolePath?.includes('mergeInvoicing')) {
4353   - toolBtns.push(
4354   - <Button
4355   - type="primary"
4356   - key="out"
4357   - onClick={() => {
4358   - //检查订单状态是否正确
4359   - // 遍历Map中的键值对
4360   - let errorIds = new Set();
4361   - [...subOrderSelectedMap.values()].flat().forEach((subOrder) => {
4362   - if (
4363   - subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING' &&
4364   - subOrder.afterInvoicingStatus !== 'PARTIAL_INVOICING'
4365   - ) {
4366   - errorIds.add(subOrder.mainOrderId);
4367   - return;
4368   - }
4369   - });
4370   - if (errorIds.size > 0) {
4371   - message.error(
4372   - '订单号为:' +
4373   - [...errorIds.values()].join(',') +
4374   - '的订单存在不是[申请开票]或者[部分开票]状态的子订单,请检查!',
4375   - );
4376   - return;
4377   - }
4378   - setIsMainOrder(true);
4379   - setFinancialVisible(true);
4380   - }}
4381   - disabled={selectedSubOrderKeys?.length === 0}
4382   - >
4383   - {roleCode === 'admin' ? '合并(财务)' : '合并开票'}
4384   - </Button>,
4385   - );
4386   - }
4387   -
4388   - toolBtns.push(
4389   - <Button
4390   - type="primary"
4391   - key="inv"
4392   - onClick={() => {
4393   - setIsMainOrder(true);
4394   - let flat = [...subOrderSelectedMap.values()].flat();
4395   - //遍历flat,判断afterInvoicingStatusList存在于canApplyAfterInvoicingStatus
4396   - flat.forEach((item) => {
4397   - if (
4398   - item.invoicingStatus === 'UN_INVOICE' ||
4399   - (item.afterInvoicingStatus !== null &&
4400   - !canApplyAfterInvoicingStatus.includes(
4401   - item.afterInvoicingStatus,
4402   - ))
4403   - ) {
4404   - message.error('存在不能进行开票的订单');
4405   - return;
4406   - }
4407   - });
4408   - //遍历afterInvoicingStatusList
4409   - setInvoicingDrawerFormVisible(true);
4410   - }}
4411   - disabled={selectedSubOrderKeys?.length === 0}
4412   - >
4413   - 申请开票
4414   - </Button>,
4415   - );
4416   -
4417   - if (rolePath?.includes('addOrder')) {
4418   - toolBtns.push(
4419   - <Button
4420   - type="primary"
4421   - key="out"
4422   - onClick={() => {
4423   - setOrderDrawerVisible(true);
4424   - setOrderOptType('add');
4425   - }}
4426   - >
4427   - 新增
4428   - </Button>,
4429   - );
4430   - }
4431   -
4432   - if (rolePath?.includes('importExcel')) {
4433   - toolBtns.push(
4434   - <Button
4435   - type="primary"
4436   - key="out"
4437   - onClick={() => {
4438   - setImportModalVisible(true);
4439   - }}
4440   - >
4441   - 批量发货
4442   - </Button>,
4443   - );
4444   - }
4445   -
4446   - if (rolePath?.includes('export')) {
4447   - toolBtns.push(
4448   - <Dropdown menu={exportMenuProps}>
4449   - <Button>
4450   - <Space>
4451   - 导出
4452   - <DownOutlined />
4453   - </Space>
4454   - </Button>
4455   - </Dropdown>,
4456   - );
  299 + <ProFormText
  300 + name="orderIdsText"
  301 + label="订单号"
  302 + placeholder="请输入订单号"
  303 + rules={[
  304 + {
  305 + required: true,
  306 + message: '请输入订单号',
  307 + },
  308 + ]}
  309 + ></ProFormText>
  310 + </ModalForm>,
  311 + ]}
  312 + />
  313 + </div>
  314 + )
4457 315 }
4458   -
4459   - return toolBtns;
4460   - }
4461   -
  316 + ]
4462 317 return (
4463   - <div className="order-page-container">
4464   - <div id="resizeDiv"></div>
4465   - <ProTable
4466   - id="main-table"
4467   - // tableStyle={{backgroundColor:'red'}}
4468   -
4469   - actionRef={mainTableRef}
4470   - formRef={mainTableFormRef}
4471   - expandIconColumnIndex={-1}
4472   - columns={mainOrdersColumns}
4473   - rowKey="id"
4474   - pagination={{
4475   - showQuickJumper: true,
4476   - pageSize: pageSize,
4477   - current: currentPage,
4478   - showSizeChanger: true,
4479   - onChange: (page, size) => {
4480   - setPageSize(size);
4481   - setCurrentPage(page);
4482   - },
4483   - showTotal: (total, range) => {
4484   - return (
4485   - <>
4486   - <span>
4487   - {'第 ' +
4488   - range[0] +
4489   - '-' +
4490   - range[1] +
4491   - ' 条/总共 ' +
4492   - total +
4493   - ' 条主订单 '}
4494   - </span>
4495   - <span className="text-[#8C8C8C]">
4496   - {' (' + subOrderCount + ' 条子订单)'}
4497   - </span>
4498   - </>
4499   - );
4500   - },
4501   - }}
4502   - // showHeader={false}
4503   - expandedRowKeys={expandedRowKeys}
4504   - // expandable={{ expandedRowRender }}
4505   - dateFormatter="string"
4506   - options={false}
4507   - headerTitle=""
4508   - search={{
4509   - labelWidth: 'auto',
4510   - // onCollapse: resize,
4511   - }}
4512   - request={async (
4513   - // 第一个参数 params 查询表单和 params 参数的结合
4514   - // 第一个参数中一定会有 pageSize 和 current ,这两个参数是 antd 的规范
4515   - params,
4516   - sorter,
4517   - filter,
4518   - ) => {
4519   - //订单id处理
4520   - /**
4521   - * 以params中的id为主,如果params没id,则取url中的id
4522   - * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来
4523   - */
4524   - let orderIds = mainTableFormRef.current?.getFieldValue('id');
4525   - let subOrderId =
4526   - mainTableFormRef.current?.getFieldValue('subOrderId');
4527   - params.id = params.id || orderIds;
4528   - params.subOrderId = params.subOrderId || subOrderId;
4529   - if (params.id !== '') {
4530   - params.id = params.id?.replace(/ /g, '');
4531   - if (params.id?.indexOf(',')) {
4532   - params.id = params.id.split(',');
4533   - params.id = params.id.filter((id) => {
4534   - return id !== '';
4535   - });
4536   - }
4537   - }
4538   -
4539   - params.condition = filterCondifion;
4540   -
4541   - //排序
4542   - params.sorted = sorted;
4543   - //是否只查看已作废
4544   - params.isDeleteQueryOrder = filterCondifion === 70;
4545   - //保存这个搜索条件
4546   - setSearchParam(params);
4547   - const { data } = await postServiceOrderQueryServiceOrder({
4548   - // ...params,
4549   - // FIXME: remove @ts-ignore
4550   - // @ts-ignore
4551   - sorter,
4552   - filter,
4553   - data: { ...params },
4554   - });
4555   -
4556   - setRolePath(data.specialPath);
4557   - setSubOrderCount(data.count);
4558   - setAllMainChecked(false);
4559   - setSelectedMainOrderKeys([]);
4560   - subOrderSelectedMap.clear();
4561   - mainOrderSelectedMap.clear();
4562   - setData(data?.data);
4563   -
4564   - //主订单id与子订单id的对照关系保存
4565   - mainOrderIdSubOrderIdRelationsMap.clear();
4566   - for (let row of data?.data) {
4567   - let mianOrderId = row.id;
4568   - let subOrderIds = row.subOrderInformationLists?.map((item) => {
4569   - //目前子订单存储的totalPayment不准确,这里重新处理取主订单的totalPayment
4570   - //totalPayment在财务开票计算金额时使用到
4571   - item.totalPayment = row.totalPayment;
4572   - return item.id;
4573   - });
4574   - mainOrderIdSubOrderIdRelationsMap.set(mianOrderId, subOrderIds);
4575   - }
4576   -
4577   - return {
4578   - data: data?.data || [],
4579   - total: data?.total || 0,
4580   - };
4581   - }}
4582   - toolbar={{
4583   - multipleLine: true,
4584   - }}
4585   - toolBarRender={() => {
4586   - return toolBarRender();
  318 + <div>
  319 + <Tabs
  320 + defaultActiveKey="1"
  321 + items={tabsItems}
  322 + onChange={(value) => {
  323 + console.log(value, '5656tabsvalue');
4587 324 }}
4588 325 />
4589   -
4590   - {orderDrawerVisible && (
4591   - <OrderDrawer
4592   - data={orderOptType === 'add' ? {} : buildMainOrder()}
4593   - subOrders={orderOptType === 'add' ? [] : buildSubOrders()}
4594   - onClose={(isSuccess: boolean) => {
4595   - setOrderDrawerVisible(false);
4596   - clearOptObject();
4597   - if (isSuccess) {
4598   - refreshTable();
4599   - }
4600   - }}
4601   - orderOptType={orderOptType}
4602   - />
4603   - )}
4604   -
4605   - {checkVisible && (
4606   - <CheckModal
4607   - setCheckVisible={(val: boolean) => {
4608   - setCheckVisible(val);
4609   - if (!val) {
4610   - clearOptObject();
4611   - }
4612   - }}
4613   - data={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
4614   - subOrders={
4615   - isMainOrder
4616   - ? [...subOrderSelectedMap.values()].flat()
4617   - : buildSubOrders()
4618   - }
4619   - orderCheckType={orderCheckType}
4620   - openOrderDrawer={(type: any, id: any) => {
4621   - setCurrentMainId(id);
4622   - setOrderOptType(type);
4623   - setOrderDrawerVisible(true);
4624   - }}
4625   - onClose={() => {
4626   - clearOptObject();
4627   - setCheckVisible(false);
4628   - refreshTable();
4629   - }}
4630   - />
4631   - )}
4632   -
4633   - {applyForInvoicingVisible && (
4634   - <ApplyForInvoicingModal
4635   - setCheckVisible={(val: boolean) => {
4636   - setApplyForInvoicingVisible(val);
4637   - if (!val) {
4638   - clearOptObject();
4639   - }
4640   - }}
4641   - subOrders={
4642   - isMainOrder
4643   - ? [...subOrderSelectedMap.values()].flat()
4644   - : buildSubOrders()
4645   - }
4646   - totalPayment={getApplyInvoicingTotalPayment()}
4647   - isMainOrder={isMainOrder}
4648   - isEdit={isEdit}
4649   - onClose={() => {
4650   - setApplyForInvoicingVisible(false);
4651   - setIsMainOrder(false);
4652   - clearOptObject();
4653   - refreshTable();
4654   - }}
4655   - />
4656   - )}
4657   -
4658   - {notesEditVisible && (
4659   - <OrderNotesEditModal
4660   - setNotesEditVisible={(val: boolean) => {
4661   - setNotesEditVisible(val);
4662   - if (!val) {
4663   - clearOptObject();
4664   - }
4665   - }}
4666   - ids={selectedRows}
4667   - notesType={notesType}
4668   - notes={notes}
4669   - onClose={() => {
4670   - setNotesEditVisible(false);
4671   - setSelectedRows([]);
4672   - setNotes(notes);
4673   - setNotesType(1);
4674   - refreshTable();
4675   - }}
4676   - />
4677   - )}
4678   -
4679   - {deliverVisible && (
4680   - <DeliverModal
4681   - data={buildSubOrders()}
4682   - isSendProduct={isSendProduct}
4683   - setVisible={(val: boolean) => {
4684   - setDeliverVisible(val);
4685   - if (!val) {
4686   - clearOptObject();
4687   - }
4688   - }}
4689   - sendType={orderCheckType}
4690   - onClose={() => {
4691   - clearOptObject();
4692   - setDeliverVisible(false);
4693   - setIsSendProduct(false);
4694   - refreshTable();
4695   - }}
4696   - />
4697   - )}
4698   -
4699   - {financialVisible && (
4700   - <FinancialDrawer
4701   - isEdit={isEdit}
4702   - mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
4703   - subOrders={
4704   - isMainOrder
4705   - ? [...subOrderSelectedMap.values()].flat()
4706   - : buildSubOrders()
4707   - }
4708   - isMainOrder={isMainOrder}
4709   - cancel={() => {
4710   - setFinancialVisible(false);
4711   - clearOptObject();
4712   - setIsMainOrder(false);
4713   - setIsEdit(false);
4714   - }}
4715   - onClose={() => {
4716   - setFinancialVisible(false);
4717   - clearOptObject();
4718   - refreshTable();
4719   - setIsMainOrder(false);
4720   - setIsEdit(false);
4721   - }}
4722   - />
4723   - )}
4724   -
4725   - {financialEditVisible && (
4726   - <FinancialEditDrawer
4727   - mainOrder={buildMainOrder()}
4728   - subOrders={buildSubOrders()}
4729   - isMainOrder={isMainOrder}
4730   - setVisible={() => {
4731   - setFinancialEditVisible(false);
4732   - clearOptObject();
4733   - }}
4734   - onClose={() => {
4735   - setFinancialEditVisible(false);
4736   - refreshTable();
4737   - setIsMainOrder(false);
4738   - clearOptObject();
4739   - }}
4740   - />
4741   - )}
4742   -
4743   - {orderPrintVisible && (
4744   - <OrderPrintModal
4745   - mainOrder={buildMainOrder()}
4746   - subOrders={buildSubOrders()}
4747   - isRePrint={isRePrintOrder}
4748   - setVisible={(val: boolean) => {
4749   - setOrderPrintVisible(val);
4750   - if (!val) {
4751   - clearOptObject();
4752   - }
4753   - }}
4754   - printOptType={orderCheckType}
4755   - onClose={() => {
4756   - setOrderPrintVisible(false);
4757   - clearOptObject();
4758   - setIsRePrintOrder(false);
4759   - refreshTable();
4760   - }}
4761   - />
4762   - )}
4763   -
4764   - {confirmReceiptVisible && (
4765   - <ConfirmReceiptModal
4766   - data={buildSubOrders()}
4767   - onClose={() => {
4768   - setConfirmReceiptVisible(false);
4769   - clearOptObject();
4770   - refreshTable();
4771   - }}
4772   - />
4773   - )}
4774   -
4775   - {imagesViewerModalVisible && (
4776   - <ImagesViewerModal
4777   - optType={imagesViewerOptType}
4778   - setVisible={(val: boolean) => {
4779   - setImagesViewerModalVisible(val);
4780   - if (!val) {
4781   - clearOptObject();
4782   - }
4783   - }}
4784   - onClose={() => {
4785   - setImagesViewerModalVisible(false);
4786   - }}
4787   - orderRow={buildSubOrders()[0]}
4788   - />
4789   - )}
4790   -
4791   - {importModalVisible && (
4792   - <ImportModal
4793   - onClose={() => {
4794   - setImportModalVisible(false);
4795   - refreshTable();
4796   - }}
4797   - />
4798   - )}
4799   -
4800   - {attachmentModalVisible && (
4801   - <AttachmentModal
4802   - data={buildSubOrders()[0]}
4803   - onClose={() => {
4804   - setAttachmentModalVisible(false);
4805   - clearOptObject();
4806   - }}
4807   - />
4808   - )}
4809   -
4810   - {historyModalVisible && (
4811   - <HistoryModal
4812   - subOrders={selectedRows}
4813   - isCancelledOrder={filterCondifion === 70}
4814   - onClose={() => {
4815   - setHistoryModalVisible(false);
4816   - setSelectedRows({});
4817   - clearOptObject();
4818   - }}
4819   - />
4820   - )}
4821   -
4822   - {deliverInfoDrawerVisible && (
4823   - <DeliverInfoDrawer
4824   - data={buildMainOrder()}
4825   - onClose={() => {
4826   - setDeliverInfoDrawerVisible(false);
4827   - clearOptObject();
4828   - }}
4829   - />
4830   - )}
4831   -
4832   - {deliverInfoDrawerVisible && (
4833   - <DeliverInfoDrawer
4834   - data={buildMainOrder()}
4835   - onClose={() => {
4836   - setDeliverInfoDrawerVisible(false);
4837   - clearOptObject();
4838   - }}
4839   - />
4840   - )}
4841   -
4842   - {procureCheckModalVisible && (
4843   - <ProcureCheckModal
4844   - setCheckVisible={(val: boolean) => {
4845   - setProcureCheckModalVisible(val);
4846   - if (!val) {
4847   - clearOptObject();
4848   - }
4849   - }}
4850   - isMainOrder={isMainOrder}
4851   - orders={
4852   - isMainOrder
4853   - ? [...subOrderSelectedMap.values()].flat()
4854   - : buildSubOrders()
4855   - }
4856   - onClose={() => {
4857   - setProcureCheckModalVisible(false);
4858   - clearOptObject();
4859   - setIsMainOrder(false);
4860   - refreshTable();
4861   - }}
4862   - />
4863   - )}
4864   -
4865   - {afterSalesDrawerVisible && (
4866   - <AfterSalesDrawer
4867   - setVisible={(val: boolean) => {
4868   - setAfterSalesDrawerVisible(val);
4869   - if (!val) {
4870   - clearOptObject();
4871   - }
4872   - }}
4873   - mainOrder={buildMainOrder()}
4874   - subOrders={buildSubOrders()}
4875   - onClose={() => {
4876   - setAfterSalesDrawerVisible(false);
4877   - clearOptObject();
4878   - refreshTable();
4879   - }}
4880   - />
4881   - )}
4882   -
4883   - {procureConvertModalVisible && (
4884   - <ProcureConvertModal
4885   - setVisible={(val: boolean) => {
4886   - setProcureConvertModalVisible(val);
4887   - if (!val) {
4888   - clearOptObject();
4889   - }
4890   - }}
4891   - subOrders={buildSubOrders()}
4892   - onClose={() => {
4893   - setProcureConvertModalVisible(false);
4894   - clearOptObject();
4895   - refreshTable();
4896   - }}
4897   - />
4898   - )}
4899   -
4900   - {financialMergeDrawerVisible && (
4901   - <FinancialMergeDrawer
4902   - setVisible={(val: boolean) => {
4903   - setFinancialMergeDrawerVisible(val);
4904   - if (!val) {
4905   - clearOptObject();
4906   - }
4907   - }}
4908   - dataList={
4909   - isMainOrder
4910   - ? [...subOrderSelectedMap.values()].flat()
4911   - : buildSubOrders()
4912   - }
4913   - onClose={() => {
4914   - setFinancialMergeDrawerVisible(false);
4915   - setIsMainOrder(false);
4916   - clearOptObject();
4917   - refreshTable();
4918   - }}
4919   - />
4920   - )}
4921   -
4922   - {financialReceiptsModalVisible && (
4923   - <FinancialReceiptsModal
4924   - setVisible={(val: boolean) => {
4925   - setFinancialReceiptsModalVisible(val);
4926   - if (!val) {
4927   - clearOptObject();
4928   - }
4929   - }}
4930   - datas={selectedRows}
4931   - onClose={() => {
4932   - setFinancialReceiptsModalVisible(false);
4933   - setSelectedRows({});
4934   - refreshTable();
4935   - }}
4936   - />
4937   - )}
4938   -
4939   - {shippingWarehouseChangeModalVisible && (
4940   - <ShippingWarehouseChangeModal
4941   - setVisible={(val: boolean) => {
4942   - setShippingWarehouseChangeModalVisible(val);
4943   - if (!val) {
4944   - clearOptObject();
4945   - }
4946   - }}
4947   - subOrderIds={ids}
4948   - originShippingWarehouse={buildSubOrders()[0].shippingWarehouse}
4949   - onClose={() => {
4950   - setShippingWarehouseChangeModalVisible(false);
4951   - clearOptObject();
4952   - setIds([]);
4953   - refreshTable();
4954   - }}
4955   - />
4956   - )}
4957   - {reissueVisible && (
4958   - <ReissueModal
4959   - setVisible={(val: boolean) => {
4960   - setReissueVisible(val);
4961   - if (!val) {
4962   - clearOptObject();
4963   - }
4964   - }}
4965   - subOrders={
4966   - isMainOrder
4967   - ? [...subOrderSelectedMap.values()].flat()
4968   - : buildSubOrders()
4969   - }
4970   - onClose={() => {
4971   - setReissueVisible(false);
4972   - clearOptObject();
4973   - refreshTable();
4974   - }}
4975   - />
4976   - )}
4977   - {reissueVisibleOld && (
4978   - <ReissueModal_old
4979   - setVisible={(val: boolean) => {
4980   - setReissueVisibleOld(val);
4981   - console.log(reissueVisible);
4982   - if (!val) {
4983   - clearOptObject();
4984   - }
4985   - }}
4986   - mainOrder={buildMainOrder()}
4987   - subOrders={buildSubOrders()}
4988   - onClose={() => {
4989   - setReissueVisibleOld(false);
4990   - clearOptObject();
4991   - refreshTable();
4992   - }}
4993   - />
4994   - )}
4995   - {productionTimeModalVisible && (
4996   - <ProductionTimeModal
4997   - setVisible={(val: boolean) => {
4998   - setProductionTimeModalVisible(val);
4999   - if (!val) {
5000   - clearOptObject();
5001   - }
5002   - }}
5003   - subOrders={buildSubOrders()}
5004   - onClose={() => {
5005   - setProductionTimeModalVisible(false);
5006   - clearOptObject();
5007   - refreshTable();
5008   - }}
5009   - />
5010   - )}
5011   -
5012   - {modifiedDiffModalVisible && (
5013   - <ModifiedDiffModal
5014   - setVisible={(val: boolean) => {
5015   - setModifiedDiffModalVisible(val);
5016   - if (!val) {
5017   - clearOptObject();
5018   - }
5019   - }}
5020   - subOrders={buildSubOrders()}
5021   - mainOrder={buildMainOrder()}
5022   - onClose={() => {
5023   - setModifiedDiffModalVisible(false);
5024   - clearOptObject();
5025   - }}
5026   - />
5027   - )}
5028   -
5029   - {uploadPayBillModalVisible && (
5030   - <UploadPayBillModal
5031   - setVisible={(val: boolean) => {
5032   - setUploadPayBillModalVisible(val);
5033   - if (!val) {
5034   - clearOptObject();
5035   - }
5036   - }}
5037   - subOrders={buildSubOrders()}
5038   - mainOrder={buildMainOrder()}
5039   - onClose={() => {
5040   - setUploadPayBillModalVisible(false);
5041   - clearOptObject();
5042   - refreshTable();
5043   - }}
5044   - />
5045   - )}
5046   - {invoicingDrawerFormVisible && (
5047   - <InvoicingDrawerForm
5048   - dataList={
5049   - isMainOrder
5050   - ? [...subOrderSelectedMap.values()].flat()
5051   - : buildSubOrders()
5052   - }
5053   - setVisible={(val: boolean) => {
5054   - setInvoicingDrawerFormVisible(val);
5055   - if (!val) {
5056   - clearOptObject();
5057   - }
5058   - }}
5059   - mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
5060   - onClose={() => {
5061   - setInvoicingDrawerFormVisible(false);
5062   - setIsMainOrder(true);
5063   - clearOptObject();
5064   - refreshTable();
5065   - }}
5066   - />
5067   - )}
5068   - {contextHolder}
5069   - <FloatButton.BackTop visibilityHeight={0} />
5070 326 </div>
5071   - );
5072   -};
5073   -
5074   -export default OrderPage;
  327 + )
  328 +}
  329 +export default warningWhitelist
... ...
src/pages/OrderReport/components/OrderStatisticCard.tsx
... ... @@ -306,6 +306,65 @@ export default ({ data, statisticsMethod, reFreshData }) =&gt; {
306 306 <CardContent unit="单" content={data?.unSendOrderNumber} />
307 307 </ProCard>
308 308 </ProCard>
  309 + <ProCard title="" ghost gutter={8}>
  310 + <ProCard
  311 + className="order-statictis-card"
  312 + bordered
  313 + title={<CardTitle title='待开票订单' />}
  314 + >
  315 + <CardContent
  316 + content={data?.waitInvoicingCount}
  317 + />
  318 + </ProCard>
  319 + <ProCard
  320 + className="order-statictis-card"
  321 + bordered
  322 + title={<CardTitle title='待开票订单总金额' />}
  323 + >
  324 + <CardContent
  325 + unit="¥"
  326 + content={data?.waitInvoicingPriceSum}
  327 + />
  328 + </ProCard>
  329 + <ProCard
  330 + className="order-statictis-card"
  331 + bordered
  332 + title={<CardTitle title='已开票未回款订单' />}
  333 + >
  334 + <CardContent
  335 + content={data?.invoicedNotReiceptCount}
  336 + />
  337 + </ProCard>
  338 + <ProCard
  339 + className="order-statictis-card"
  340 + bordered
  341 + title={<CardTitle title='已开票未回款订单总金额' />}
  342 + >
  343 + <CardContent
  344 + unit="¥"
  345 + content={data?.invoicedNotReiceptPriceSum}
  346 + />
  347 + </ProCard>
  348 + <ProCard
  349 + className="order-statictis-card"
  350 + bordered
  351 + title={<CardTitle title='已开票已回款订单' />}
  352 + >
  353 + <CardContent
  354 + content={data?.invoicedAndReiceptedCount}
  355 + />
  356 + </ProCard>
  357 + <ProCard
  358 + className="order-statictis-card"
  359 + bordered
  360 + title={<CardTitle title='已开票已回款订单总金额' />}
  361 + >
  362 + <CardContent
  363 + unit="¥"
  364 + content={data?.invoicedAndReiceptedPriceSum}
  365 + />
  366 + </ProCard>
  367 + </ProCard>
309 368  
310 369 <ModalForm<{
311 370 statisticsMethod: string;
... ...