Commit 2043dafad69f5751954a0396f85eff610a723c07

Authored by boyang
1 parent de4ea95b

fix: 排查回款bug

dist.zip 0 → 100644
No preview for this file type
src/pages/Order/OrderWarning/index.tsx
... ... @@ -188,7 +188,9 @@ const OrderPage = () => {
188 188 const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据
189 189 const [subOrderSelectedMap, setSubOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合
190 190 const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id
  191 + // const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id
191 192 const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id
  193 + // const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id
192 194 const [subOrderCount, setSubOrderCount] = useState(0);
193 195 const [sorted] = useState(false);
194 196 const mainTableRef = useRef<ActionType>();
... ... @@ -331,8 +333,10 @@ const OrderPage = () =&gt; {
331 333 * @param mainId
332 334 */
333 335 function createOptObject(subId: any, mainId: any) {
  336 + console.log(currentOptMainId, '5656createOptObject1', curretnOptSubId);
334 337 setCurrentMainId(mainId);
335 338 setCurretnOptSubId(subId);
  339 + console.log(currentOptMainId, '5656createOptObject2', curretnOptSubId);
336 340 }
337 341  
338 342 /**
... ... @@ -381,7 +385,12 @@ const OrderPage = () =&gt; {
381 385 * 返回当前操作的主订单数据
382 386 */
383 387 function buildMainOrder() {
384   - if (currentOptMainId === undefined || currentOptMainId === null) {
  388 + console.log(
  389 + currentOptMainId,
  390 + '5656buildMainOrder currentOptMainId/curretnOptSubId',
  391 + curretnOptSubId,
  392 + );
  393 + if (!currentOptMainId) {
385 394 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
386 395 return;
387 396 }
... ... @@ -390,14 +399,14 @@ const OrderPage = () =&gt; {
390 399 let matchedData = data.filter((item) => {
391 400 return item.id === currentOptMainId;
392 401 });
  402 + console.log(data, '5656buildMainOrder2 data/matchedData', matchedData);
393 403 if (matchedData.length > 0) {
394 404 mainOrderClone = cloneDeep(matchedData[0]);
395 405 }
396   -
397   - if (mainOrderClone === null) {
  406 + console.log(mainOrderClone, '5656buildMainOrder mainOrderClone');
  407 + if (!mainOrderClone) {
398 408 message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员');
399 409 }
400   -
401 410 return mainOrderClone;
402 411 }
403 412  
... ... @@ -405,7 +414,12 @@ const OrderPage = () =&gt; {
405 414 * 返回当前操作的子订单集合
406 415 */
407 416 function buildSubOrders() {
408   - if (currentOptMainId === undefined || currentOptMainId === null) {
  417 + console.log(
  418 + curretnOptSubId,
  419 + '5656buildSubOrders currentOptMainId/currentOptMainId',
  420 + currentOptMainId,
  421 + );
  422 + if (!currentOptMainId) {
409 423 message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
410 424 return;
411 425 }
... ... @@ -414,8 +428,14 @@ const OrderPage = () =&gt; {
414 428  
415 429 //如果没有传当前操作的子订单id,说明是操作主订单
416 430 if (curretnOptSubId === undefined || curretnOptSubId === null) {
  431 + // if (!curretnOptSubId) {
417 432 //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象
418 433 let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId);
  434 + console.log(
  435 + subOrderSelectedMap,
  436 + '5656buildSubOrders subOrderSelectedMap/currentOptSubOrders',
  437 + currentOptSubOrders,
  438 + );
419 439 if (
420 440 currentOptSubOrders === null ||
421 441 currentOptSubOrders === undefined ||
... ... @@ -435,6 +455,11 @@ const OrderPage = () =&gt; {
435 455 }
436 456 } else {
437 457 //操作的是子订单
  458 + console.log(
  459 + subOrderSelectedMap,
  460 + '5656buildSubOrders2 subOrderSelectedMap/data',
  461 + data,
  462 + );
438 463 for (let item of data) {
439 464 if (item.id === currentOptMainId) {
440 465 for (let subOrder of item?.subOrderInformationLists) {
... ... @@ -446,12 +471,15 @@ const OrderPage = () =&gt; {
446 471 }
447 472 }
448 473 }
449   -
  474 + console.log(
  475 + cloneSubOrders,
  476 + '5656cloneSubOrders/length',
  477 + cloneSubOrders.length,
  478 + );
450 479 if (cloneSubOrders.length === 0) {
451 480 message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员');
452 481 return;
453 482 }
454   -
455 483 return cloneSubOrders;
456 484 }
457 485  
... ... @@ -1334,6 +1362,11 @@ const OrderPage = () =&gt; {
1334 1362 className="p-0"
1335 1363 type="link"
1336 1364 onClick={() => {
  1365 + console.log(
  1366 + optRecord.id,
  1367 + '5656optRecord.id, record.id',
  1368 + record.id,
  1369 + );
1337 1370 createOptObject(optRecord.id, record.id);
1338 1371 setUploadPayBillModalVisible(true);
1339 1372 }}
... ...
src/pages/Order/OrderWarning/indexhide.tsx deleted 100644 → 0
1   -import ButtonConfirm from '@/components/ButtomConfirm';
2   -import { RESPONSE_CODE } from '@/constants/enum';
3   -import ImportExpressBillModal from '@/pages/Order/OrderWarning/components/ImportExpressBillModal';
4   -import InvoicingDrawerForm from '@/pages/Order/OrderWarning/components/InvoicingDrawerForm';
5   -import ReissueModal from '@/pages/Order/OrderWarning/components/ReissueModal';
6   -import ReissueModal_old from '@/pages/Order/OrderWarning/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   - postServiceOrderWarningOrderStatistics,
23   -} from '@/services';
24   -import { orderExport } from '@/services/order';
25   -import {
26   - FloatAdd,
27   - copyToClipboard,
28   - enumToProTableEnumValue,
29   - enumValueToLabel,
30   - formatDateTime,
31   - formatdate,
32   - getAliYunOSSFileNameFromUrl,
33   - isImageName,
34   -} from '@/utils';
35   -import {
36   - getReceivingCompanyOptions,
37   - isAdmin,
38   - isExaminer,
39   - isFinance,
40   - isProcure,
41   - isSales,
42   - isSupplier,
43   - isWarehousekeeper,
44   -} from '@/utils/order';
45   -import { getUserInfo } from '@/utils/user';
46   -import {
47   - ClockCircleTwoTone,
48   - ContainerTwoTone,
49   - CopyOutlined,
50   - CopyTwoTone,
51   - DownOutlined,
52   - EditTwoTone,
53   - QuestionCircleOutlined,
54   -} from '@ant-design/icons';
55   -import {
56   - ActionType,
57   - ProColumns,
58   - ProFormInstance,
59   - ProTable,
60   - ProForm,
61   - ProFormRadio,
62   -} from '@ant-design/pro-components';
63   -import {
64   - Button,
65   - Checkbox,
66   - Divider,
67   - Dropdown,
68   - Flex,
69   - FloatButton,
70   - Image,
71   - MenuProps,
72   - Modal,
73   - Popconfirm,
74   - Radio,
75   - Space,
76   - Spin,
77   - Tag,
78   - Tooltip,
79   - message,
80   - Tabs,
81   - Badge,
82   - Card,
83   - Col,
84   - Row,
85   -} from 'antd';
86   -import Base64 from 'base-64';
87   -import { cloneDeep } from 'lodash';
88   -import React, { Key, useEffect, useMemo, useRef, useState } from 'react';
89   -import OrderPrintModal from '../../OrderPrint/OrderPrintModal';
90   -import AfterSalesDrawer from './components/AfterSalesDrawer';
91   -import ApplyForInvoicingModal from './components/ApplyForInvoicingModal';
92   -import AttachmentModal from './components/AttachmentModal';
93   -import CheckModal from './components/CheckModal';
94   -import ConfirmReceiptModal from './components/ConfirmReceiptModal';
95   -import DeliverInfoDrawer from './components/DeliverInfoDrawer';
96   -import DeliverModal from './components/DeliverModal';
97   -import FinancialDrawer from './components/FinancialDrawer';
98   -import FinancialEditDrawer from './components/FinancialEditDrawer';
99   -import FinancialMergeDrawer from './components/FinancialMergeDrawer';
100   -import FinancialReceiptsModal from './components/FinancialReceiptsModal';
101   -import HistoryModal from './components/HistoryModal';
102   -import ImagesViewerModal from './components/ImagesViewerModal';
103   -import ImportModal from './components/ImportModal';
104   -import ModifiedDiffModal from './components/ModifiedDiffModal';
105   -import OrderDrawer from './components/OrderDrawer';
106   -import OrderNotesEditModal from './components/OrderNotesEditModal';
107   -import ProcureCheckModal from './components/ProcureCheckModal';
108   -import ProcureConvertModal from './components/ProcureConvertModal';
109   -import ProductionTimeModal from './components/ProductionTimeModal';
110   -import ShippingWarehouseChangeModal from './components/ShippingWarehouseChangeModal';
111   -import UploadPayBillModal from './components/UploadPayBillModal';
112   -import {
113   - AFTER_INVOICING_STATUS,
114   - CHECK_TYPE,
115   - LOGISTICS_STATUS_OPTIONS,
116   - MAIN_ORDER_COLUMNS,
117   - MODIFIED_AUDIT_STATUS_OPTIONS,
118   - ORDER_STATUS_OPTIONS,
119   - PAYEE_OPTIONS,
120   - PAYMENT_CHANNEL_OPTIONS,
121   - PAYMENT_RECEIPTS_STATUS_OPTIONS,
122   - POST_AUDIT_OPTIONS,
123   - PROCURE_ORDER_STATUS,
124   - PROCURE_PRIMARY_ORDER_STATUS_OPTIONS,
125   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
126   - SHIPPING_WAREHOUSE_OPTIONS,
127   - TAGS_COLOR,
128   - getInvoicingType,
129   - getNeedInvoicing,
130   -} from '../constant';
131   -import './index.less';
132   -import { OrderListItemType, OrderType } from './type.d';
133   -import { format } from 'date-fns';
134   -import { useParams } from '@umijs/max';
135   -
136   -const OrderPage = () => {
137   - const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false);
138   - const [checkVisible, setCheckVisible] = useState<boolean>(false);
139   - const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false);
140   - const [allMainChecked, setAllMainChecked] = useState(false);
141   - const [imagesViewerModalVisible, setImagesViewerModalVisible] =
142   - useState<boolean>(false);
143   - const [data, setData] = useState([]); //列表数据
144   - const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false);
145   - const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] =
146   - useState<boolean>(false);
147   - const [attachmentModalVisible, setAttachmentModalVisible] =
148   - useState<boolean>(false);
149   - const [uploadPayBillModalVisible, setUploadPayBillModalVisible] =
150   - useState<boolean>(false);
151   - const [modifiedDiffModalVisible, setModifiedDiffModalVisible] =
152   - useState<boolean>(false);
153   - const [financialReceiptsModalVisible, setFinancialReceiptsModalVisible] =
154   - useState(false);
155   - const [financialVisible, setFinancialVisible] = useState<boolean>(false);
156   - const [financialEditVisible, setFinancialEditVisible] =
157   - useState<boolean>(false);
158   - const [afterSalesDrawerVisible, setAfterSalesDrawerVisible] =
159   - useState<boolean>(false);
160   - const [historyModalVisible, setHistoryModalVisible] =
161   - useState<boolean>(false);
162   - const [isRePrintOrder, setIsRePrintOrder] = useState<boolean>(false);
163   - const [isSendProduct, setIsSendProduct] = useState<boolean>(false);
164   - const [isMainOrder, setIsMainOrder] = useState<boolean>(false);
165   - const [importModalVisible, setImportModalVisible] = useState<boolean>(false);
166   - const [reissueVisible, setReissueVisible] = useState<boolean>(false);
167   - const [reissueVisibleOld, setReissueVisibleOld] = useState<boolean>(false);
168   - const [applyForInvoicingVisible, setApplyForInvoicingVisible] =
169   - useState<boolean>(false);
170   - const [procureCheckModalVisible, setProcureCheckModalVisible] =
171   - useState<boolean>(false);
172   - const [procureConvertModalVisible, setProcureConvertModalVisible] =
173   - useState<boolean>(false);
174   - const [invoicingDrawerFormVisible, setInvoicingDrawerFormVisible] =
175   - useState<boolean>(false);
176   - const [confirmReceiptVisible, setConfirmReceiptVisible] =
177   - useState<boolean>(false);
178   - const [productionTimeModalVisible, setProductionTimeModalVisible] =
179   - useState<boolean>(false);
180   - const [deliverVisible, setDeliverVisible] = useState<boolean>(false);
181   - const [deliverInfoDrawerVisible, setDeliverInfoDrawerVisible] =
182   - useState<boolean>(false);
183   - const [orderOptType, setOrderOptType] = useState<string>('');
184   - const [isEdit, setIsEdit] = useState<boolean>(false);
185   - const [expandedRowKeys] = useState<Key[]>([]);
186   - const [notesType, setNotesType] = useState(1);
187   - const [notes, setNotes] = useState(1);
188   - const [rolePath, setRolePath] = useState([]); //当前角色权限(新增跟打印按钮)
189   - const userInfo = getUserInfo();
190   - // const [tableHeight, setTableHeight] = useState(200);
191   - const [selectedRows, setSelectedRows] = useState([]);
192   - const [mainOrderIdSubOrderIdRelationsMap] = useState(new Map()); //主订单id与子订单id的对照关系,用于主订单子订单的勾选校验,子订单全选中对应的主订单自动勾选上
193   - const [selectedMainOrderKeys, setSelectedMainOrderKeys] = useState<any[]>([]);
194   - const [selectedSubOrderKeys, setSelectedSubOrderKeys] = useState<any[]>([]);
195   - const [pageSize, setPageSize] = useState(10);
196   - const [currentPage, setCurrentPage] = useState(1);
197   - const [orderCheckType, setOrderCheckType] = useState('');
198   - const [imagesViewerOptType, setImagesViewerOptType] = useState('');
199   - const [filterCondifion, setFilterCondition] = useState(0);
200   - const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据
201   - const [subOrderSelectedMap, setSubOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合
202   - const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id
203   - const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id
204   - const [subOrderCount, setSubOrderCount] = useState(0);
205   - const [sorted, setSorted] = useState(false);
206   - const mainTableRef = useRef<ActionType>();
207   - const mainTableFormRef = useRef<ProFormInstance>();
208   - let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储
209   - const [messageApi, contextHolder] = message.useMessage();
210   - const [
211   - shippingWarehouseChangeModalVisible,
212   - setShippingWarehouseChangeModalVisible,
213   - ] = useState(false);
214   - const [canApplyAfterInvoicingStatus, setCanApplyAfterInvoicingStatus] =
215   - useState([]);
216   - const [ids, setIds] = useState([]);
217   - const [recordOptNode, setRecordOptNode] = useState(null);
218   - const roleCode = userInfo?.roleSmallVO?.code;
219   - const canMergeInvoicing = useMemo(() => {
220   - if (subOrderSelectedMap.size === 0) {
221   - return false;
222   - }
223   - // 检查 value.items 中的每个元素
224   - console.log(
225   - 'map' + JSON.stringify([...subOrderSelectedMap.values()].flat()),
226   - );
227   - return [...subOrderSelectedMap.values()]
228   - .flat()
229   - .every((subItem) => subItem.paths.includes('applyInvoicing_old'));
230   - }, [selectedSubOrderKeys]);
231   -
232   - const triggerRecordOptNode = async (id) => {
233   - const res = await postServiceOrderGetCurrentOptNode({
234   - query: {
235   - id,
236   - },
237   - });
238   - setRecordOptNode(res.data);
239   - };
240   -
241   - const exportLoading = () => {
242   - messageApi.open({
243   - type: 'loading',
244   - content: '正在导出文件...',
245   - duration: 0,
246   - });
247   - };
248   -
249   - const exportLoadingDestory = () => {
250   - messageApi.destroy();
251   - };
252   -
253   - const refreshTable = () => {
254   - mainTableRef.current?.reload();
255   - //刷新表格数据的时候,取消选中行
256   - setSelectedRows([]);
257   - setSelectedSubOrderKeys([]);
258   - };
259   -
260   - /*useEffect(() => {
261   - let initAfterInvoicingStatus = async () => {
262   - const afteInvoicingStatus = await getAfterInvoicingStatus();
263   - setAfterInvoicingStatus(afteInvoicingStatus);
264   - };
265   - initAfterInvoicingStatus();
266   - }, []);*/
267   -
268   - useEffect(() => {
269   - // 使用URLSearchParams来解析查询参数
270   - const params = new URLSearchParams(location.search);
271   - const id = params.get('id');
272   - const subOrderId = params.get('subOrderId');
273   - if (id) {
274   - mainTableFormRef.current?.setFieldValue('id', id);
275   - }
276   - if (subOrderId) {
277   - mainTableFormRef.current?.setFieldValue('subOrderId', subOrderId);
278   - }
279   - }, []);
280   -
281   - useEffect(() => {
282   - const initEnum = async () => {
283   - let invoiceTypeRet = await postServiceConstCanApplyAfterInvoicingStatus();
284   - if (invoiceTypeRet.result === RESPONSE_CODE.SUCCESS) {
285   - setCanApplyAfterInvoicingStatus(invoiceTypeRet.data);
286   - }
287   - };
288   - initEnum();
289   - }, []);
290   -
291   - /**
292   - * 复制订单到剪贴板
293   - * @param record
294   - */
295   - function copyOrderToClipboard(record: any) {
296   - let text = '';
297   - text += record?.id;
298   - text += ',' + record?.salesCode;
299   - text += ',' + record?.customerName;
300   -
301   - text += ',' + record?.customerContactNumber;
302   -
303   - text += ',' + record?.customerShippingAddress;
304   -
305   - if (!isSupplier()) {
306   - text += ',' + record?.institutionContactName;
307   - text += ',' + record?.institution;
308   - }
309   - record?.subOrderInformationLists?.forEach((item) => {
310   - text += '\n';
311   - text += item?.productName;
312   - text += ' ' + item?.parameters;
313   - text += ' ' + item?.quantity;
314   - text += ' ' + item?.unit;
315   - if (!isSupplier()) {
316   - text += ' ¥' + item?.subOrderPayment;
317   - }
318   - text += ' ' + item?.id;
319   - });
320   - if (copyToClipboard(text)) {
321   - message.info('已复制到剪贴板');
322   - } else {
323   - message.info('无法复制到剪贴板');
324   - }
325   - }
326   -
327   - const MyToolTip = ({ title, content }) => {
328   - return (
329   - <Tooltip
330   - color="#FFFFFF"
331   - placement="bottom"
332   - title={<div className="px-5 py-4 text-black">{title}</div>}
333   - >
334   - {content}
335   - </Tooltip>
336   - );
337   - };
338   -
339   - /**
340   - * 检查是否可以打印
341   - * @param paths 按钮集合
342   - * @returns
343   - */
344   - function checkePrintable(paths: any) {
345   - if (
346   - !paths?.includes('printOrder') &&
347   - !paths?.includes('supplierPrint') &&
348   - !paths?.includes('procurePrint') &&
349   - !paths?.includes('rePrintOrder')
350   - ) {
351   - return false;
352   - }
353   -
354   - return true;
355   - }
356   -
357   - /**
358   - * 财务是否选中排序
359   - * @param e
360   - */
361   - function financeSorted(e: any) {
362   - let checked = e?.target.checked;
363   - setSorted(checked);
364   - refreshTable();
365   - }
366   -
367   - /**
368   - * 重置当前的操作对象
369   - */
370   - function clearOptObject() {
371   - setCurrentMainId(undefined);
372   - setCurretnOptSubId(undefined);
373   - setIsMainOrder(false);
374   - }
375   -
376   - /**
377   - * 初始化当前的操作对象
378   - * @param subId
379   - * @param mainId
380   - */
381   - function createOptObject(subId: any, mainId: any) {
382   - setCurrentMainId(mainId);
383   - setCurretnOptSubId(subId);
384   - }
385   -
386   - /**
387   - * 检查当前操作是否异常
388   - */
389   - // function checkOptValid() {
390   - // if ((currentOptMainId === undefined || currentOptMainId === null) && (curretnOptSubId === undefined || curretnOptSubId === null)) {
391   - // message.error("页面错误:当前操作对象为空,请联系系统管理员");
392   - // return false;
393   - // }
394   -
395   - // //检查数据是否存在
396   - // //主订单数据
397   - // if (!Array.from(mainOrderIdSubOrderIdRelationsMap.keys()).includes(currentOptMainId)) {
398   - // message.error("页面错误:当前操作主订单对象为空,请联系系统管理员");
399   - // }
400   -
401   - // //子订单
402   - // let allSubIds = [];
403   - // for (const idList of mainOrderIdSubOrderIdRelationsMap.values()) {
404   - // allSubIds.push(...idList);
405   - // }
406   - // if (!allSubIds.includes(curretnOptSubId)) {
407   - // message.error("页面错误:当前操作子订单对象为空,请联系系统管理员");
408   - // return false
409   - // }
410   -
411   - // return true;
412   - // }
413   -
414   - /**
415   - * 获取当前选中子订单的其中一个主订单
416   - */
417   - function getFirstMainOrder() {
418   - let mainId = [...subOrderSelectedMap.values()].flat()[0].mainOrderId;
419   - for (let item of data) {
420   - if (item.id === mainId) {
421   - return item;
422   - }
423   - }
424   -
425   - return null;
426   - }
427   -
428   - /**
429   - * 返回当前操作的主订单数据
430   - */
431   - function buildMainOrder() {
432   - if (currentOptMainId === undefined || currentOptMainId === null) {
433   - message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
434   - return;
435   - }
436   -
437   - let mainOrderClone = null;
438   - let matchedData = data.filter((item) => {
439   - return item.id === currentOptMainId;
440   - });
441   - if (matchedData.length > 0) {
442   - mainOrderClone = cloneDeep(matchedData[0]);
443   - }
444   -
445   - if (mainOrderClone === null) {
446   - message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员');
447   - }
448   -
449   - return mainOrderClone;
450   - }
451   -
452   - /**
453   - * 返回当前操作的子订单集合
454   - */
455   - function buildSubOrders() {
456   - if (currentOptMainId === undefined || currentOptMainId === null) {
457   - message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员');
458   - return;
459   - }
460   -
461   - let cloneSubOrders = [];
462   -
463   - //如果没有传当前操作的子订单id,说明是操作主订单
464   - if (curretnOptSubId === undefined || curretnOptSubId === null) {
465   - //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象
466   - let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId);
467   - if (
468   - currentOptSubOrders === null ||
469   - currentOptSubOrders === undefined ||
470   - currentOptSubOrders.length === 0
471   - ) {
472   - for (let item of data) {
473   - if (item.id === currentOptMainId) {
474   - for (let subOrder of item?.subOrderInformationLists) {
475   - cloneSubOrders.push(cloneDeep(subOrder));
476   - }
477   - }
478   - }
479   - } else {
480   - cloneSubOrders = currentOptSubOrders.map((item) => {
481   - return cloneDeep(item);
482   - });
483   - }
484   - } else {
485   - //操作的是子订单
486   - for (let item of data) {
487   - if (item.id === currentOptMainId) {
488   - for (let subOrder of item?.subOrderInformationLists) {
489   - if (subOrder.id === curretnOptSubId) {
490   - cloneSubOrders.push(cloneDeep(subOrder));
491   - break;
492   - }
493   - }
494   - }
495   - }
496   - }
497   -
498   - if (cloneSubOrders.length === 0) {
499   - message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员');
500   - return;
501   - }
502   -
503   - return cloneSubOrders;
504   - }
505   -
506   - /**
507   - * 获取当前操作申请开票的订单总金额
508   - */
509   - function getApplyInvoicingTotalPayment() {
510   - let subOrders = isMainOrder
511   - ? [...subOrderSelectedMap.values()].flat()
512   - : buildSubOrders();
513   -
514   - let totalPayment = 0;
515   - if (subOrders && subOrders.length > 0) {
516   - let mainIds = subOrders?.map((item: any) => {
517   - return item.mainOrderId;
518   - });
519   -
520   - let uniqueMainIds = [...new Set(mainIds)];
521   -
522   - let dataMap = data.reduce((map, obj: any) => {
523   - map.set(obj.id, obj);
524   - return map;
525   - }, new Map());
526   -
527   - uniqueMainIds.forEach((id: any) => {
528   - let o = dataMap.get(id);
529   - if (o) {
530   - totalPayment = FloatAdd(totalPayment, o.totalPayment);
531   - }
532   - });
533   - }
534   - return totalPayment;
535   - }
536   -
537   - /**
538   - * 根据主订单id,将该主订单下的所有子订单取消选中
539   - */
540   - const removeSelectedSubOrderKeysByMainOrderId = (id: any) => {
541   - let currentMainOrderAllSubOrderIds =
542   - mainOrderIdSubOrderIdRelationsMap.get(id);
543   - if (currentMainOrderAllSubOrderIds) {
544   - let newSelectedSubOrderKeys = selectedSubOrderKeys.filter((item) => {
545   - return !currentMainOrderAllSubOrderIds.includes(item);
546   - });
547   - setSelectedSubOrderKeys(newSelectedSubOrderKeys);
548   - }
549   - };
550   -
551   - /**
552   - * 根据主订单id取消选中主订单
553   - * @param id
554   - */
555   - const removeSelecetMainOrderKeyByMainOrderId = (id: any) => {
556   - if (selectedMainOrderKeys.includes(id)) {
557   - let newSelectedMainOrderKeys = selectedMainOrderKeys.filter((item) => {
558   - return item !== id;
559   - });
560   - setSelectedMainOrderKeys(newSelectedMainOrderKeys);
561   - }
562   - };
563   -
564   - const onCheckboxChange = (record: never) => {
565   - let newSelectedMainOrderKeys = [];
566   - if (selectedMainOrderKeys.includes(record.id)) {
567   - newSelectedMainOrderKeys = selectedMainOrderKeys.filter(
568   - (key) => key !== record.id,
569   - );
570   - removeSelectedSubOrderKeysByMainOrderId(record.id);
571   - setSelectedRows([]);
572   -
573   - //删除选中主订单的信息
574   - mainOrderSelectedMap.delete(record.id);
575   - //删除选中主订单附属子订单的信息
576   - subOrderSelectedMap.delete(record.id);
577   - //总选中按钮取消选中
578   - setAllMainChecked(false);
579   - } else {
580   - newSelectedMainOrderKeys = [...selectedMainOrderKeys, record.id];
581   - //子订单全部自动选中
582   - let subIds = record.subOrderInformationLists?.map((item) => {
583   - return item.id;
584   - });
585   - let newSelectedSubOrderKeys = [...selectedSubOrderKeys];
586   - for (let subId of subIds) {
587   - if (!selectedSubOrderKeys.includes(subId)) {
588   - newSelectedSubOrderKeys.push(subId);
589   - }
590   - }
591   - setSelectedSubOrderKeys(newSelectedSubOrderKeys);
592   -
593   - setSelectedRows(record.subOrderInformationLists);
594   -
595   - //选中主订单
596   - mainOrderSelectedMap.set(record.id, record);
597   - //选中子订单
598   - subOrderSelectedMap.set(record.id, record.subOrderInformationLists);
599   - setSubOrderSelectedMap(new Map(subOrderSelectedMap));
600   -
601   - //如果所有主订单都勾选上了,那么勾选上总选中按钮
602   - if (
603   - mainOrderSelectedMap?.size === mainOrderIdSubOrderIdRelationsMap.size
604   - ) {
605   - setAllMainChecked(true);
606   - }
607   - }
608   - setSelectedMainOrderKeys(newSelectedMainOrderKeys);
609   - };
610   - // const handleTableExpand = (mainOrderIds: any) => {
611   - // setExpandedRowKeys(mainOrderIds);
612   - // };
613   -
614   - const allMainCheckBoxChange = () => {
615   - let checked = !allMainChecked;
616   - setAllMainChecked(checked);
617   -
618   - if (checked) {
619   - let mainOrderIds = data?.map((item) => {
620   - mainOrderSelectedMap.set(item.id, item);
621   - return item.id;
622   - });
623   -
624   - let subOrderIds = [];
625   - for (let subIdList of mainOrderIdSubOrderIdRelationsMap.values()) {
626   - subOrderIds.push(...subIdList);
627   - }
628   -
629   - if (data) {
630   - for (let item of data) {
631   - mainOrderSelectedMap.set(item.id, item);
632   -
633   - subOrderSelectedMap.set(item.id, item.subOrderInformationLists);
634   - }
635   - }
636   -
637   - setSelectedMainOrderKeys(mainOrderIds);
638   - setSelectedSubOrderKeys(subOrderIds);
639   - } else {
640   - setSelectedMainOrderKeys([]);
641   - setSelectedSubOrderKeys([]);
642   - mainOrderSelectedMap.clear();
643   - subOrderSelectedMap.clear();
644   - }
645   - };
646   -
647   - //表头渲染
648   - const OrderTableHeader = () => {
649   - return (
650   - <Flex className="w-full">
651   - <Flex className="w-[1%] ml-[7px]">
652   - <Checkbox
653   - onChange={allMainCheckBoxChange}
654   - checked={allMainChecked}
655   - ></Checkbox>
656   - </Flex>
657   - <Flex className="w-[30%] ml-[1%]">
658   - <span className="font-medium">商品信息</span>
659   - </Flex>
660   - <Flex className="w-[13%]">
661   - <span className="font-medium">交易金额</span>
662   - </Flex>
663   -
664   - {!isSupplier() ? (
665   - <>
666   - <Flex className="w-[10%]">
667   - <span className="font-medium">支付</span>
668   - </Flex>
669   - <Flex className="w-[12%]">
670   - <span className="font-medium">其他</span>
671   - </Flex>
672   - </>
673   - ) : (
674   - ''
675   - )}
676   -
677   - <Flex className="w-[10%]">
678   - <span className="font-medium">交易状态</span>
679   - </Flex>
680   - <Flex className="w-[17%]">
681   - <span className="font-medium">操作</span>
682   - </Flex>
683   - </Flex>
684   - );
685   - };
686   - //子订单内容渲染
687   - const SubOderRander = ({ record, optRecord }) => {
688   - /**
689   - * 获取订单状态标签
690   - * @param optRecord
691   - */
692   - function getOrderStatusTag(optRecord: any): import('react').ReactNode {
693   - console.log(optRecord);
694   -
695   - const orderStatus = optRecord.orderStatus;
696   - const paymentMethod = optRecord.paymentMethod;
697   - let orderStatusTagText = enumValueToLabel(
698   - optRecord.orderStatus,
699   - ORDER_STATUS_OPTIONS,
700   - );
701   -
702   - if (orderStatus === 'WAIT_CONFIRM_DELIVER_AFTER_INVOICE') {
703   - if (optRecord.afterInvoicingStatus !== 'COMPLETE_INVOICING') {
704   - orderStatusTagText = '待开票';
705   - } else {
706   - orderStatusTagText = '待确认发货';
707   - }
708   - }
709   -
710   - //如果是未审核或者领导已审核,付款状态为预付款则需要财务审核【财务待审核】,否则仓库审核【】
711   - if (orderStatus === 'UNAUDITED' || orderStatus === 'LEADER_AUDITED') {
712   - if (paymentMethod === 'PAYMENT_IN_ADVANCE') {
713   - orderStatusTagText = '财务待审核';
714   - } else {
715   - orderStatusTagText = '仓库待审核';
716   - }
717   - }
718   -
719   - //如果是财务已审核,显示为【仓库待审核】
720   - if (orderStatus === 'FINANCE_PROCESS') {
721   - orderStatusTagText = '仓库待审核';
722   - }
723   -
724   - if (orderStatus === 'AUDIT_FAILED') {
725   - return (
726   - <MyToolTip
727   - key="key"
728   - title={optRecord.checkNotes + ' ' + optRecord.postAuditNotes}
729   - content={
730   - <>
731   - <Tag
732   - color={TAGS_COLOR.get(optRecord.orderStatus)}
733   - style={{ marginRight: '4px' }}
734   - >
735   - {orderStatusTagText}
736   - </Tag>
737   - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
738   - </>
739   - }
740   - />
741   - );
742   - }
743   -
744   - if (
745   - orderStatus === 'AFTER_SALES_COMPLETION' ||
746   - orderStatus === 'IN_AFTER_SALES'
747   - ) {
748   - return (
749   - <Tag
750   - color={TAGS_COLOR.get(optRecord.orderStatus)}
751   - style={{ marginRight: '4px' }}
752   - >
753   - {orderStatusTagText}
754   - </Tag>
755   - );
756   - }
757   -
758   - if (orderStatus === 'PROCURE_CONVERT_WAREHOUSE_KEEPER') {
759   - return (
760   - <MyToolTip
761   - key="key"
762   - title={optRecord.checkNotes}
763   - content={
764   - <>
765   - <Tag
766   - color={TAGS_COLOR.get(optRecord.orderStatus)}
767   - style={{ marginRight: '4px' }}
768   - >
769   - {orderStatusTagText}
770   - </Tag>
771   - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
772   - </>
773   - }
774   - />
775   - );
776   - }
777   -
778   - return (
779   - <Tag key="key" color={TAGS_COLOR.get(optRecord.orderStatus)}>
780   - {orderStatusTagText}
781   - </Tag>
782   - );
783   - }
784   -
785   - /**
786   - * 获取后置审核状态标签
787   - * @param optRecord
788   - */
789   - function getPostAuditStatusTag(optRecord: any): import('react').ReactNode {
790   - return (
791   - <Tag key="key" color={TAGS_COLOR.get(optRecord.postAuditStatus)}>
792   - {enumValueToLabel(optRecord.postAuditStatus, POST_AUDIT_OPTIONS)}
793   - </Tag>
794   - );
795   - }
796   -
797   - //申请开票附件处理
798   - const getAfterAnnexList = () => {
799   - // let links = [];
800   - let afterAnnexList = optRecord.afterAnnexList;
801   - let i = 1;
802   - let images = [];
803   - let otherAnnex = [];
804   - if (afterAnnexList?.length > 0) {
805   - for (let url of afterAnnexList) {
806   - let name = getAliYunOSSFileNameFromUrl(url);
807   - if (isImageName(name)) {
808   - images.push({ name: name, url: url });
809   - } else {
810   - otherAnnex.push({ name: '附件' + i++, url: url });
811   - }
812   - }
813   - }
814   -
815   - return (
816   - <div className="pl-1">
817   - <Image.PreviewGroup
818   - className="mr-10"
819   - preview={{
820   - onChange: (current, prev) =>
821   - console.log(`current index: ${current}, prev index: ${prev}`),
822   - }}
823   - >
824   - {images.map((item, index) => (
825   - <React.Fragment key={index}>
826   - {index > 0 ? <Divider type="vertical" /> : ''}
827   - <Image
828   - className="max-h-[50px] max-w-[70px]"
829   - src={item.url}
830   - title={item.name}
831   - />{' '}
832   - </React.Fragment>
833   - ))}
834   - </Image.PreviewGroup>
835   - {otherAnnex.map((item, index) => {
836   - return (
837   - <Popconfirm
838   - title="下载或预览"
839   - key={index}
840   - onConfirm={() => {
841   - window.open(
842   - '/previewApi/onlinePreview?url=' +
843   - encodeURIComponent(Base64.encode(item.url)),
844   - );
845   - }}
846   - onCancel={() => {
847   - window.open(item.url);
848   - }}
849   - okText="预览"
850   - cancelText="下载"
851   - >
852   - <Button className="px-1" key={index} type="link">
853   - {item.name}
854   - </Button>
855   - </Popconfirm>
856   - );
857   - })}
858   - </div>
859   - );
860   - };
861   -
862   - //财务审核附件处理
863   - const getInvoicingCheckAnnexList = () => {
864   - let invoicingCheckAnnexList = optRecord.invoicingCheckAnnexList;
865   - return (
866   - <div>
867   - <Image.PreviewGroup
868   - className="mr-10"
869   - preview={{
870   - onChange: (current, prev) =>
871   - console.log(`current index: ${current}, prev index: ${prev}`),
872   - }}
873   - >
874   - {invoicingCheckAnnexList.map((url, index) => (
875   - <React.Fragment key={index}>
876   - <Image className="max-h-[50px] max-w-[70px]" src={url} />{' '}
877   - <Divider type="vertical" />
878   - </React.Fragment>
879   - ))}
880   - </Image.PreviewGroup>
881   - </div>
882   - );
883   - };
884   -
885   - return (
886   - <>
887   - <Flex className="w-full border-b-indigo-500">
888   - <Flex vertical className="w-[31%]" gap="small">
889   - {/* 商品名称 */}
890   - <div>
891   - <div
892   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer"
893   - onClick={() => {
894   - copyToClipboard(optRecord.productName);
895   - message.info('商品名称复制成功:' + optRecord.productName);
896   - }}
897   - title={optRecord.productName}
898   - >
899   - <span className="font-medium text-black ">
900   - {optRecord.productName}
901   - </span>
902   - </div>
903   - <div className="text-xs text-[#8C8C8C]">
904   - <span
905   - className="cursor-pointer"
906   - onClick={() => {
907   - copyToClipboard(optRecord.id);
908   - message.info('子订单编号复制成功:' + optRecord.id);
909   - }}
910   - >
911   - {optRecord.id}
912   - </span>
913   - {(roleCode === 'salesRepresentative' ||
914   - roleCode === 'salesManager') &&
915   - !optRecord.isCurrentUserOrder ? (
916   - <span className="text-[#f44e4e]">(非本账号订单)</span>
917   - ) : (
918   - ''
919   - )}
920   - {optRecord.modifiedOptFlag !== null ? (
921   - <span className="text-[#f44e4e] cursor-pointer">
922   - {optRecord.modifiedOptFlag === 'MODIFY' ? '(修改中)' : ''}
923   - {optRecord.modifiedOptFlag === 'DELETE' ? '(删除中)' : ''}
924   - {optRecord.modifiedOptFlag === 'INSERT' ? '(新增中)' : ''}
925   - </span>
926   - ) : (
927   - ''
928   - )}
929   -
930   - {optRecord.modified ? (
931   - <Tooltip title="点击查看详情">
932   - <span
933   - className="text-[#f44e4e] cursor-pointer"
934   - onClick={async () => {
935   - createOptObject(optRecord.id, record.id);
936   - setModifiedDiffModalVisible(true);
937   - }}
938   - >
939   - (内容有变化)
940   - </span>
941   - </Tooltip>
942   - ) : (
943   - ''
944   - )}
945   - {!optRecord.logicDelete ? (
946   - <span className="text-[#f44e4e]">(已作废)</span>
947   - ) : (
948   - ''
949   - )}
950   - </div>
951   - </div>
952   -
953   - <div
954   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer"
955   - title={optRecord.parameters}
956   - onClick={() => {
957   - copyToClipboard(optRecord.parameters);
958   - message.info('商品名称复制成功:' + optRecord.parameters);
959   - }}
960   - >
961   - <span className="text-[#8C8C8C]">
962   - 参数:{optRecord.parameters}
963   - </span>
964   - </div>
965   - </Flex>
966   - <Flex className="w-[13%]" vertical gap="small">
967   - {!isSupplier() ? (
968   - <>
969   - <div
970   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
971   - title={optRecord.productPrice}
972   - >
973   - <span className="text-[#8C8C8C]">单价:</span>
974   - <span className="text-slate-700">
975   - ¥{optRecord.productPrice}
976   - </span>
977   - </div>
978   - </>
979   - ) : (
980   - ''
981   - )}
982   -
983   - <div
984   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
985   - title={optRecord.quantity}
986   - >
987   - <span className="text-[#8C8C8C]">数量:</span>
988   - <span className="text-slate-700">
989   - x{optRecord.quantity + ' '}
990   - </span>
991   - <span className="text-[#8C8C8C]">{optRecord.unit}</span>
992   - </div>
993   -
994   - {!isSupplier() ? (
995   - <div
996   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
997   - title={optRecord.subOrderPayment}
998   - >
999   - <span className="text-[#8C8C8C]">合计:</span>
1000   - <span className="text-slate-700">
1001   - ¥{optRecord.subOrderPayment}
1002   - </span>
1003   - </div>
1004   - ) : (
1005   - ''
1006   - )}
1007   - </Flex>
1008   -
1009   - <Flex className="w-[10%]" vertical gap="small">
1010   - {!isSupplier() ? (
1011   - <>
1012   - {/* 支付方式 */}
1013   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1014   - <span className="text-slate-700">
1015   - {optRecord.paymentMethodText}
1016   - </span>
1017   - </div>
1018   - {/* 支付渠道 */}
1019   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1020   - <span className="text-slate-700">
1021   - {enumValueToLabel(
1022   - optRecord.paymentChannel,
1023   - PAYMENT_CHANNEL_OPTIONS,
1024   - )}
1025   - </span>
1026   - </div>
1027   - {/* 回款审核状态 */}
1028   - {optRecord.paymentReceiptStatus !== null ? (
1029   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1030   - <Tag
1031   - className="hover:cursor-pointer"
1032   - onMouseEnter={(e: any) => {
1033   - e.target.innerText = '点击查看回款凭证';
1034   - }}
1035   - onMouseLeave={(e: any) => {
1036   - e.target.innerText = enumValueToLabel(
1037   - optRecord.paymentReceiptStatus,
1038   - PAYMENT_RECEIPTS_STATUS_OPTIONS,
1039   - );
1040   - }}
1041   - onClick={() => {
1042   - createOptObject(optRecord.id, record.id);
1043   - setImagesViewerOptType('paymentReceipt');
1044   - setImagesViewerModalVisible(true);
1045   - }}
1046   - key="key"
1047   - color={TAGS_COLOR.get(optRecord.paymentReceiptStatus)}
1048   - >
1049   - {enumValueToLabel(
1050   - optRecord.paymentReceiptStatus,
1051   - PAYMENT_RECEIPTS_STATUS_OPTIONS,
1052   - )}
1053   - </Tag>
1054   - </div>
1055   - ) : (
1056   - ''
1057   - )}
1058   - </>
1059   - ) : (
1060   - ''
1061   - )}
1062   - </Flex>
1063   - <Flex className="w-[13%]" vertical gap="small">
1064   - {!isSupplier() ? (
1065   - <>
1066   - {/* 所属部门 */}
1067   - <div
1068   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
1069   - title={enumValueToLabel(
1070   - optRecord.productBelongBusiness,
1071   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
1072   - )}
1073   - >
1074   - <span className="text-slate-700">
1075   - {enumValueToLabel(
1076   - optRecord.productBelongBusiness,
1077   - PRODUCT_BELONG_DEPARTMENT_OPTIONS,
1078   - )}
1079   - </span>
1080   - </div>
1081   -
1082   - {/* 开票类型 */}
1083   - {optRecord.invoicingStatus !== null ? (
1084   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1085   - <span className="text-slate-700">
1086   - {getInvoicingType(optRecord)}
1087   - </span>
1088   - </div>
1089   - ) : (
1090   - ''
1091   - )}
1092   -
1093   - {/* 开票状态 */}
1094   - {optRecord.afterInvoicingStatus !== null ? (
1095   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1096   - <Tooltip
1097   - title={
1098   - optRecord.invoicingUrgentCause !== null &&
1099   - optRecord.afterInvoicingStatus ===
1100   - 'URGENT_INVOICE_AUDITING'
1101   - ? optRecord.invoicingUrgentCause
1102   - : enumValueToLabel(
1103   - optRecord.afterInvoicingStatus,
1104   - AFTER_INVOICING_STATUS,
1105   - )
1106   - }
1107   - >
1108   - <Tag
1109   - color={TAGS_COLOR.get(optRecord.afterInvoicingStatus)}
1110   - >
1111   - {enumValueToLabel(
1112   - optRecord.afterInvoicingStatus,
1113   - AFTER_INVOICING_STATUS,
1114   - )}
1115   - </Tag>
1116   - </Tooltip>
1117   - </div>
1118   - ) : (
1119   - ''
1120   - )}
1121   -
1122   - {/* 是否加急图标显示 */}
1123   - {optRecord.isUrgent ? (
1124   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1125   - <Tooltip
1126   - title={'期望开票时间:' + formatdate(optRecord.deadline)}
1127   - >
1128   - <Tag color="red">加急开票</Tag>
1129   - </Tooltip>
1130   - </div>
1131   - ) : (
1132   - ''
1133   - )}
1134   -
1135   - {(roleCode === 'warehouseKeeper' || roleCode === 'admin') &&
1136   - optRecord.shippingWarehouse !== null ? (
1137   - <div
1138   - className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
1139   - title={enumValueToLabel(
1140   - optRecord.shippingWarehouse,
1141   - SHIPPING_WAREHOUSE_OPTIONS,
1142   - )}
1143   - >
1144   - <span className="text-slate-700">
1145   - {enumValueToLabel(
1146   - optRecord.shippingWarehouse,
1147   - SHIPPING_WAREHOUSE_OPTIONS,
1148   - )}
1149   - </span>
1150   - </div>
1151   - ) : (
1152   - ''
1153   - )}
1154   -
1155   - {/* 生产时间 */}
1156   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1157   - {optRecord.productionStartTime !== null ||
1158   - optRecord.productionEndTime !== null ? (
1159   - <MyToolTip
1160   - title={
1161   - formatdate(optRecord.productionStartTime) +
1162   - ' 至 ' +
1163   - formatdate(optRecord.productionEndTime)
1164   - }
1165   - content={
1166   - <Button type="link" size="small" style={{ padding: 0 }}>
1167   - 生产时间
1168   - </Button>
1169   - }
1170   - />
1171   - ) : (
1172   - ''
1173   - )}
1174   - </div>
1175   - </>
1176   - ) : (
1177   - ''
1178   - )}
1179   - </Flex>
1180   -
1181   - <Flex className="w-[10%]" vertical gap="small">
1182   - {/* 开票状态 */}
1183   - {!isSupplier() ? (
1184   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1185   - <Tag
1186   - color={
1187   - optRecord.invoicingTime === null ||
1188   - optRecord.invoicingTime === undefined
1189   - ? TAGS_COLOR.get(optRecord.invoicingStatus)
1190   - : 'success'
1191   - }
1192   - >
1193   - {getNeedInvoicing(optRecord)}
1194   - </Tag>
1195   - </div>
1196   - ) : (
1197   - ''
1198   - )}
1199   -
1200   - {/* 订单状态 */}
1201   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1202   - {getOrderStatusTag(optRecord)}
1203   - </div>
1204   -
1205   - {/* 后置审核状态 */}
1206   - {optRecord.postAuditStatus !== null ? (
1207   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1208   - {getPostAuditStatusTag(optRecord)}
1209   - </div>
1210   - ) : (
1211   - ''
1212   - )}
1213   -
1214   - {/**采购是否已下单状态 */}
1215   - {optRecord.procureOrderStatus !== null &&
1216   - optRecord.procureOrderStatus !== undefined ? (
1217   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1218   - <Tag color="success">
1219   - {enumValueToLabel(
1220   - optRecord.procureOrderStatus,
1221   - PROCURE_ORDER_STATUS,
1222   - )}
1223   - </Tag>
1224   - </div>
1225   - ) : (
1226   - ''
1227   - )}
1228   -
1229   - {/* 物流信息 */}
1230   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1231   - {optRecord.orderStatus === 'CONFIRM_RECEIPT' ||
1232   - optRecord.orderStatus === 'AFTER_SALES_COMPLETION' ||
1233   - optRecord.orderStatus === 'IN_AFTER_SALES' ||
1234   - optRecord.orderStatus === 'SHIPPED' ? (
1235   - <MyToolTip
1236   - title={
1237   - optRecord.serialNumber === undefined
1238   - ? '暂无物流信息'
1239   - : enumValueToLabel(
1240   - optRecord.logisticsMethod,
1241   - LOGISTICS_STATUS_OPTIONS,
1242   - ) +
1243   - ' ' +
1244   - optRecord.serialNumber +
1245   - ' ' +
1246   - optRecord.logisticsNotes
1247   - }
1248   - content={
1249   - <Button type="link" size="small" style={{ padding: 0 }}>
1250   - 物流信息
1251   - </Button>
1252   - }
1253   - />
1254   - ) : (
1255   - ''
1256   - )}
1257   -
1258   - {/* 修改审核状态 */}
1259   - {optRecord.modifiedAuditStatus !== null &&
1260   - optRecord.modifiedAuditStatus !== 'AUDIT_FAILURE' ? (
1261   - <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
1262   - <Tooltip
1263   - title={recordOptNode ? recordOptNode : <Spin />}
1264   - onOpenChange={(open) => {
1265   - console.log('open:' + open);
1266   - console.log('id:' + optRecord.id);
1267   - if (open) {
1268   - triggerRecordOptNode(optRecord.id);
1269   - } else {
1270   - setRecordOptNode(null);
1271   - }
1272   - }}
1273   - >
1274   - <Tag color={TAGS_COLOR.get(optRecord.modifiedAuditStatus)}>
1275   - {enumValueToLabel(
1276   - optRecord.modifiedAuditStatus,
1277   - MODIFIED_AUDIT_STATUS_OPTIONS,
1278   - )}
1279   - </Tag>
1280   - </Tooltip>
1281   - </div>
1282   - ) : (
1283   - ''
1284   - )}
1285   -
1286   - {optRecord.modifiedAuditStatus === 'AUDIT_FAILURE' ? (
1287   - <MyToolTip
1288   - key="key"
1289   - title={optRecord.modifiedAuditNotes}
1290   - content={
1291   - <>
1292   - <Tag
1293   - color={TAGS_COLOR.get(optRecord.modifiedAuditNotes)}
1294   - style={{ marginRight: '4px' }}
1295   - >
1296   - {enumValueToLabel(
1297   - optRecord.modifiedAuditStatus,
1298   - MODIFIED_AUDIT_STATUS_OPTIONS,
1299   - )}
1300   - </Tag>
1301   - <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
1302   - </>
1303   - }
1304   - />
1305   - ) : (
1306   - ''
1307   - )}
1308   - </div>
1309   - </Flex>
1310   - <Flex className="w-[18%]" wrap="wrap" gap="small">
1311   - {optRecord.paths?.includes('postAudit') ? (
1312   - <Button
1313   - className="p-0"
1314   - type="link"
1315   - onClick={() => {
1316   - createOptObject(optRecord.id, record.id);
1317   - setCheckVisible(true);
1318   - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT);
1319   - }}
1320   - >
1321   - 后置审核
1322   - </Button>
1323   - ) : (
1324   - ''
1325   - )}
1326   - {/* 加急审核 */}
1327   - {optRecord.paths?.includes('URGENT_INVOICE_AUDITING') ? (
1328   - <Button
1329   - className="p-0"
1330   - type="link"
1331   - onClick={() => {
1332   - console.log('here');
1333   - setCurrentMainId(record.id);
1334   - setCurretnOptSubId(optRecord.id);
1335   - setCheckVisible(true);
1336   - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING);
1337   - }}
1338   - >
1339   - 加急审核(新)
1340   - </Button>
1341   - ) : (
1342   - ''
1343   - )}
1344   - {optRecord.paths?.includes('URGENT_INVOICE_AUDITING_old') ? (
1345   - <Button
1346   - className="p-0"
1347   - type="link"
1348   - onClick={() => {
1349   - console.log('here');
1350   - setCurrentMainId(record.id);
1351   - setCurretnOptSubId(optRecord.id);
1352   - setCheckVisible(true);
1353   - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD);
1354   - }}
1355   - >
1356   - 加急审核(旧)
1357   - </Button>
1358   - ) : (
1359   - ''
1360   - )}
1361   - {optRecord.paths?.includes('salesConfirm') && (
1362   - <ButtonConfirm
1363   - className="p-0"
1364   - title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。"
1365   - text="订单确认"
1366   - onConfirm={async () => {
1367   - let res = await postServiceOrderSalesConfirm({
1368   - data: {
1369   - subOrderIds: [optRecord.id],
1370   - },
1371   - });
1372   -
1373   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
1374   - message.success(res.message);
1375   - refreshTable();
1376   - }
1377   - }}
1378   - />
1379   - )}
1380   - {optRecord.paths?.includes('uploadPaymentReceiptBill') ? (
1381   - <Button
1382   - className="p-0"
1383   - type="link"
1384   - onClick={() => {
1385   - createOptObject(optRecord.id, record.id);
1386   - setUploadPayBillModalVisible(true);
1387   - }}
1388   - >
1389   - 回款
1390   - </Button>
1391   - ) : (
1392   - ''
1393   - )}
1394   - {optRecord.paths?.includes('reissue_old') ? (
1395   - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'||
1396   - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/
1397   - <Button
1398   - className="p-0"
1399   - type="link"
1400   - onClick={() => {
1401   - setCurrentMainId(record.id);
1402   - setReissueVisibleOld(true);
1403   - }}
1404   - >
1405   - 重新开票(旧)
1406   - </Button>
1407   - ) : (
1408   - ''
1409   - )}
1410   - {optRecord.paths?.includes('reissue') ? (
1411   - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'||
1412   - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/
1413   - <Button
1414   - className="p-0"
1415   - type="link"
1416   - onClick={() => {
1417   - setCurrentMainId(record.id);
1418   - setCurretnOptSubId(optRecord.id);
1419   - setReissueVisible(true);
1420   - }}
1421   - >
1422   - 重新开票(新)
1423   - </Button>
1424   - ) : (
1425   - ''
1426   - )}
1427   -
1428   - {optRecord.paths?.includes('confirmReissue_old') ? (
1429   - <Button
1430   - className="p-0"
1431   - type="link"
1432   - onClick={() => {
1433   - setCurrentMainId(record.id);
1434   - setCurretnOptSubId(optRecord.id);
1435   - setCheckVisible(true);
1436   - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD);
1437   - }}
1438   - >
1439   - 重新开票审核(旧)
1440   - </Button>
1441   - ) : (
1442   - ''
1443   - )}
1444   - {optRecord.paths?.includes('confirmReissue') ? (
1445   - <Button
1446   - className="p-0"
1447   - type="link"
1448   - onClick={() => {
1449   - setCurrentMainId(record.id);
1450   - setCurretnOptSubId(optRecord.id);
1451   - setCheckVisible(true);
1452   - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE);
1453   - }}
1454   - >
1455   - 重新开票审核(新)
1456   - </Button>
1457   - ) : (
1458   - ''
1459   - )}
1460   -
1461   - {optRecord.paths?.includes('leaderAudit') ? (
1462   - <Button
1463   - className="p-0"
1464   - type="link"
1465   - onClick={() => {
1466   - setCurrentMainId(record.id);
1467   - setCurretnOptSubId(optRecord.id);
1468   - setCheckVisible(true);
1469   - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT);
1470   - }}
1471   - >
1472   - 审核
1473   - </Button>
1474   - ) : (
1475   - ''
1476   - )}
1477   -
1478   - {optRecord.paths?.includes('creditAudit') ? (
1479   - <Button
1480   - className="p-0"
1481   - type="link"
1482   - onClick={() => {
1483   - setCurrentMainId(record.id);
1484   - setCurretnOptSubId(optRecord.id);
1485   - setCheckVisible(true);
1486   - setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT);
1487   - }}
1488   - >
1489   - 赊账审核
1490   - </Button>
1491   - ) : (
1492   - ''
1493   - )}
1494   -
1495   - {optRecord.paths?.includes('auditPaymentReceipt') ? (
1496   - <Button
1497   - className="p-0"
1498   - type="link"
1499   - onClick={() => {
1500   - createOptObject(optRecord.id, record.id);
1501   - setCheckVisible(true);
1502   - setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT);
1503   - }}
1504   - >
1505   - 回款审核
1506   - </Button>
1507   - ) : (
1508   - ''
1509   - )}
1510   -
1511   - {optRecord.paths?.includes('modifiedAuditRequest') ? (
1512   - <Button
1513   - className="p-0"
1514   - type="link"
1515   - onClick={() => {
1516   - createOptObject(optRecord.id, record.id);
1517   - setCheckVisible(true);
1518   - setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT);
1519   - }}
1520   - >
1521   - 节点修改审核
1522   - </Button>
1523   - ) : (
1524   - ''
1525   - )}
1526   -
1527   - {optRecord.paths?.includes('applyModify') ? (
1528   - <Button
1529   - className="p-0"
1530   - type="link"
1531   - onClick={() => {
1532   - createOptObject(optRecord.id, record.id);
1533   - setOrderDrawerVisible(true);
1534   - setOrderOptType('order-change-normal');
1535   - }}
1536   - >
1537   - 申请修改
1538   - </Button>
1539   - ) : (
1540   - ''
1541   - )}
1542   -
1543   - {optRecord.paths?.includes('modifiedLeaderAuditRequest') ? (
1544   - <Button
1545   - className="p-0"
1546   - type="link"
1547   - onClick={() => {
1548   - createOptObject(optRecord.id, record.id);
1549   - setCheckVisible(true);
1550   - setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT);
1551   - }}
1552   - >
1553   - 领导修改审核
1554   - </Button>
1555   - ) : (
1556   - ''
1557   - )}
1558   -
1559   - {optRecord.paths?.includes('shippingWarehouseChangeRequest') ? (
1560   - <Button
1561   - className="p-0"
1562   - type="link"
1563   - onClick={() => {
1564   - setIds([optRecord.id]);
1565   - createOptObject(optRecord.id, record.id);
1566   - setShippingWarehouseChangeModalVisible(true);
1567   - }}
1568   - >
1569   - 修改仓库
1570   - </Button>
1571   - ) : (
1572   - ''
1573   - )}
1574   -
1575   - {optRecord.paths?.includes('saleCancelInvoicing_old') ? (
1576   - <ButtonConfirm
1577   - className="p-0"
1578   - title="确认取消申请开票?"
1579   - text="取消申请(旧)"
1580   - onConfirm={async () => {
1581   - let res = await postServiceOrderSaleCancelInvoicing({
1582   - data: {
1583   - subOrderIds: [optRecord.id],
1584   - },
1585   - });
1586   -
1587   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
1588   - message.success(res.message);
1589   - refreshTable();
1590   - }
1591   - }}
1592   - />
1593   - ) : (
1594   - ''
1595   - )}
1596   - {optRecord.paths?.includes('saleCancelInvoicing') ? (
1597   - <ButtonConfirm
1598   - className="p-0"
1599   - title="确认取消申请开票?"
1600   - text="取消申请(新)"
1601   - onConfirm={async () => {
1602   - let res = await postServiceInvoiceCancelApply({
1603   - data: {
1604   - subOrderIds: [optRecord.id],
1605   - },
1606   - });
1607   -
1608   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
1609   - message.success(res.message);
1610   - refreshTable();
1611   - }
1612   - }}
1613   - />
1614   - ) : (
1615   - ''
1616   - )}
1617   - {optRecord.paths?.includes('noNeedInvoicingEdit') ? (
1618   - <Button
1619   - className="p-0"
1620   - type="link"
1621   - onClick={() => {
1622   - createOptObject(optRecord.id, record.id);
1623   - setFinancialEditVisible(true);
1624   - setIsMainOrder(false);
1625   - }}
1626   - >
1627   - 编辑时间
1628   - </Button>
1629   - ) : (
1630   - ''
1631   - )}
1632   - {optRecord.paths?.includes('sendProduct') ? (
1633   - <Button
1634   - className="p-0"
1635   - type="link"
1636   - onClick={() => {
1637   - createOptObject(optRecord.id, record.id);
1638   - setDeliverVisible(true);
1639   - setIsSendProduct(true);
1640   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
1641   - }}
1642   - >
1643   - 仓库发货
1644   - </Button>
1645   - ) : (
1646   - ''
1647   - )}
1648   -
1649   - {optRecord.paths?.includes('supplierSendOrder') ? (
1650   - <Button
1651   - className="p-0"
1652   - type="link"
1653   - onClick={() => {
1654   - optRecord.mainOrderId = record.id;
1655   - setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染
1656   - setDeliverVisible(true);
1657   - setIsSendProduct(true);
1658   - setOrderCheckType(CHECK_TYPE.SUPPLIER);
1659   - }}
1660   - >
1661   - 供应商发货
1662   - </Button>
1663   - ) : (
1664   - ''
1665   - )}
1666   -
1667   - {optRecord.paths?.includes('procureSend') ? (
1668   - <Button
1669   - className="p-0"
1670   - type="link"
1671   - onClick={() => {
1672   - createOptObject(optRecord.id, record.id);
1673   - setDeliverVisible(true);
1674   - setIsSendProduct(true);
1675   - setOrderCheckType(CHECK_TYPE.PROCURE);
1676   - }}
1677   - >
1678   - {isSupplier() ? '发货' : '采购发货'}
1679   - </Button>
1680   - ) : (
1681   - ''
1682   - )}
1683   -
1684   - {optRecord.paths?.includes('editProductionTime') ? (
1685   - <Button
1686   - className="p-0"
1687   - type="link"
1688   - onClick={() => {
1689   - createOptObject(optRecord.id, record.id);
1690   - setProductionTimeModalVisible(true);
1691   - }}
1692   - >
1693   - 生产时间
1694   - </Button>
1695   - ) : (
1696   - ''
1697   - )}
1698   -
1699   - {optRecord.paths?.includes('queryAnnex') &&
1700   - optRecord.listAnnex?.length > 0 ? (
1701   - <Button
1702   - className="p-0"
1703   - type="link"
1704   - onClick={() => {
1705   - optRecord.mainOrderId = record.id;
1706   - createOptObject(optRecord.id, record.id);
1707   - setAttachmentModalVisible(true);
1708   - }}
1709   - >
1710   - 附件
1711   - </Button>
1712   - ) : (
1713   - ''
1714   - )}
1715   -
1716   - {optRecord.paths?.includes('modifySendInformation') ? (
1717   - <Button
1718   - className="p-0"
1719   - type="link"
1720   - onClick={() => {
1721   - createOptObject(optRecord.id, record.id);
1722   - setDeliverVisible(true);
1723   - setIsSendProduct(false);
1724   - }}
1725   - >
1726   - 修改发货信息
1727   - </Button>
1728   - ) : (
1729   - ''
1730   - )}
1731   -
1732   - {optRecord.paths?.includes('printOrder') ? (
1733   - <Button
1734   - className="p-0"
1735   - type="link"
1736   - onClick={async () => {
1737   - createOptObject(optRecord.id, record.id);
1738   - setOrderPrintVisible(true);
1739   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
1740   - }}
1741   - >
1742   - 仓库打印
1743   - </Button>
1744   - ) : (
1745   - ''
1746   - )}
1747   -
1748   - {optRecord.paths?.includes('supplierPrint') ? (
1749   - <Button
1750   - className="p-0"
1751   - type="link"
1752   - onClick={async () => {
1753   - createOptObject(optRecord.id, record.id);
1754   - setOrderPrintVisible(true);
1755   - setOrderCheckType(CHECK_TYPE.SUPPLIER);
1756   - }}
1757   - >
1758   - 供应商打印
1759   - </Button>
1760   - ) : (
1761   - ''
1762   - )}
1763   -
1764   - {optRecord.paths?.includes('procurePrint') ? (
1765   - <ButtonConfirm
1766   - className="p-0"
1767   - title="确认打印?"
1768   - text="采购打印"
1769   - onConfirm={async () => {
1770   - let res = await postServiceOrderProcurePrint({
1771   - data: {
1772   - ids: [optRecord.id],
1773   - },
1774   - });
1775   -
1776   - if (res.result === RESPONSE_CODE.SUCCESS) {
1777   - message.success(res.message);
1778   - refreshTable();
1779   - }
1780   - }}
1781   - />
1782   - ) : (
1783   - // <Button
1784   - // className="p-0"
1785   - // type="link"
1786   - // onClick={async () => {
1787   - // setOrderPrintVisible(true);
1788   - // setSelectedRows([optRecord]);
1789   - // setOrderRow(record);
1790   - // setOrderCheckType(CHECK_TYPE.PROCURE);
1791   - // }}
1792   - // >
1793   - // 采购打印
1794   - // </Button>
1795   - ''
1796   - )}
1797   -
1798   - {optRecord.paths?.includes('editOrder') && false ? (
1799   - <Button
1800   - className="p-0"
1801   - type="link"
1802   - onClick={() => {
1803   - createOptObject(optRecord.id, record.id);
1804   - setFinancialVisible(true);
1805   - setIsEdit(true);
1806   - }}
1807   - >
1808   - 编辑
1809   - </Button>
1810   - ) : (
1811   - ''
1812   - )}
1813   -
1814   - {optRecord.paths?.includes('invoicing') ? (
1815   - <Button
1816   - className="p-0"
1817   - type="link"
1818   - onClick={() => {
1819   - createOptObject(optRecord.id, record.id);
1820   - setFinancialVisible(true);
1821   - setIsEdit(false);
1822   - setIsMainOrder(false);
1823   - }}
1824   - >
1825   - 开票
1826   - </Button>
1827   - ) : (
1828   - ''
1829   - )}
1830   -
1831   - {optRecord.paths?.includes('applyInvoicing') ? (
1832   - <Button
1833   - className="p-0"
1834   - type="link"
1835   - onClick={() => {
1836   - setInvoicingDrawerFormVisible(true);
1837   - createOptObject(optRecord.id, record.id);
1838   - setIsEdit(false);
1839   - setIsMainOrder(false);
1840   - }}
1841   - >
1842   - 申请开票(新)
1843   - </Button>
1844   - ) : (
1845   - ''
1846   - )}
1847   -
1848   - {optRecord.paths?.includes('applyInvoicing_old') ? (
1849   - <Button
1850   - className="p-0"
1851   - type="link"
1852   - onClick={() => {
1853   - setApplyForInvoicingVisible(true);
1854   - createOptObject(optRecord.id, record.id);
1855   - setIsEdit(false);
1856   - setIsMainOrder(false);
1857   - }}
1858   - >
1859   - 申请开票(旧)
1860   - </Button>
1861   - ) : (
1862   - ''
1863   - )}
1864   -
1865   - {optRecord.paths?.includes('checkOrder') ? (
1866   - <Button
1867   - className="p-0"
1868   - type="link"
1869   - onClick={() => {
1870   - setCurrentMainId(record.id);
1871   - setCurretnOptSubId(optRecord.id);
1872   - setCheckVisible(true);
1873   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
1874   - }}
1875   - >
1876   - 审核
1877   - </Button>
1878   - ) : (
1879   - ''
1880   - )}
1881   -
1882   - {optRecord.paths?.includes('afterSalesCheck') ? (
1883   - <Button
1884   - className="p-0"
1885   - type="link"
1886   - onClick={() => {
1887   - createOptObject(optRecord.id, record.id);
1888   - setCheckVisible(true);
1889   - setOrderCheckType(CHECK_TYPE.AFTER_SALES);
1890   - }}
1891   - >
1892   - 售后审核
1893   - </Button>
1894   - ) : (
1895   - ''
1896   - )}
1897   -
1898   - {optRecord.paths?.includes('financeCheckOrder') ? (
1899   - <Button
1900   - className="p-0"
1901   - type="link"
1902   - onClick={() => {
1903   - createOptObject(optRecord.id, record.id);
1904   - setCheckVisible(true);
1905   - setOrderCheckType(CHECK_TYPE.FINALCIAL);
1906   - }}
1907   - >
1908   - 财务审核
1909   - </Button>
1910   - ) : (
1911   - ''
1912   - )}
1913   -
1914   - {optRecord.paths?.includes('procureCheckOrder') ? (
1915   - <Button
1916   - className="p-0"
1917   - type="link"
1918   - onClick={() => {
1919   - createOptObject(optRecord.id, record.id);
1920   - setOrderCheckType(CHECK_TYPE.PROCURE);
1921   - setProcureCheckModalVisible(true);
1922   - }}
1923   - >
1924   - 采购审核
1925   - </Button>
1926   - ) : (
1927   - ''
1928   - )}
1929   -
1930   - {optRecord.paths?.includes('procureConvertProcure') ? (
1931   - <Button
1932   - className="p-0"
1933   - type="link"
1934   - onClick={() => {
1935   - createOptObject(optRecord.id, record.id);
1936   - setOrderCheckType(CHECK_TYPE.PROCURE);
1937   - setProcureConvertModalVisible(true);
1938   - }}
1939   - >
1940   - 转发
1941   - </Button>
1942   - ) : (
1943   - ''
1944   - )}
1945   -
1946   - {optRecord.paths?.includes('rePrintOrder') ? (
1947   - <Button
1948   - className="p-0"
1949   - type="link"
1950   - onClick={() => {
1951   - createOptObject(optRecord.id, record.id);
1952   - setOrderPrintVisible(true);
1953   - setIsRePrintOrder(true);
1954   - }}
1955   - >
1956   - 重新打印
1957   - </Button>
1958   - ) : (
1959   - ''
1960   - )}
1961   -
1962   - {optRecord.paths?.includes('confirmReceipt') ? (
1963   - <Button
1964   - className="p-0"
1965   - type="link"
1966   - onClick={() => {
1967   - createOptObject(optRecord.id, record.id);
1968   - setConfirmReceiptVisible(true);
1969   - }}
1970   - >
1971   - 确认收货
1972   - </Button>
1973   - ) : (
1974   - ''
1975   - )}
1976   -
1977   - {optRecord.paths?.includes('applyAfterSales') ? (
1978   - <Button
1979   - className="p-0"
1980   - type="link"
1981   - onClick={() => {
1982   - createOptObject(optRecord.id, record.id);
1983   - setOrderDrawerVisible(true);
1984   - setOrderOptType('after_sales');
1985   - }}
1986   - >
1987   - 申请售后
1988   - </Button>
1989   - ) : (
1990   - ''
1991   - )}
1992   -
1993   - {optRecord.paths?.includes('procureOrder') ? (
1994   - <ButtonConfirm
1995   - className="p-0"
1996   - title="是否已下单?"
1997   - text="下单"
1998   - onConfirm={async () => {
1999   - let res = await postServiceOrderProcureOrder({
2000   - data: { subIds: [optRecord.id] },
2001   - });
2002   - if (res.result === RESPONSE_CODE.SUCCESS) {
2003   - message.success(res.message);
2004   - refreshTable();
2005   - return true;
2006   - }
2007   - }}
2008   - />
2009   - ) : (
2010   - ''
2011   - )}
2012   -
2013   - {optRecord.paths?.includes('cancelSend') ? (
2014   - <ButtonConfirm
2015   - className="p-0"
2016   - title="是否取消发货"
2017   - text="取消发货"
2018   - onConfirm={async () => {
2019   - let res = await postServiceOrderCancelSend({
2020   - data: { subIds: [optRecord.id] },
2021   - });
2022   - if (res.result === RESPONSE_CODE.SUCCESS) {
2023   - message.success(res.message);
2024   - refreshTable();
2025   - return true;
2026   - }
2027   - }}
2028   - />
2029   - ) : (
2030   - ''
2031   - )}
2032   -
2033   - {optRecord.paths?.includes('noNeedSend') ? (
2034   - <ButtonConfirm
2035   - className="p-0"
2036   - title="此订单是否无需发货?"
2037   - text="无需发货"
2038   - onConfirm={async () => {
2039   - let res = await postServiceOrderNoNeedSend({
2040   - data: { ids: [optRecord.id] },
2041   - });
2042   - if (res.result === RESPONSE_CODE.SUCCESS) {
2043   - message.success(res.message);
2044   - refreshTable();
2045   - return true;
2046   - }
2047   - }}
2048   - />
2049   - ) : (
2050   - ''
2051   - )}
2052   -
2053   - {optRecord.paths?.includes('viewImages') ? (
2054   - <Button
2055   - className="p-0"
2056   - type="link"
2057   - onClick={() => {
2058   - createOptObject(optRecord.id, record.id);
2059   - setImagesViewerOptType('shippingReceipt');
2060   - setImagesViewerModalVisible(true);
2061   - }}
2062   - >
2063   - 查看收货凭证
2064   - </Button>
2065   - ) : (
2066   - ''
2067   - )}
2068   -
2069   - {optRecord.paths?.includes('confirmDeliver') ? (
2070   - <Button
2071   - className="p-0"
2072   - type="link"
2073   - onClick={() => {
2074   - createOptObject(optRecord.id, record.id);
2075   - setOrderCheckType(CHECK_TYPE.CONFIRM_DELIVER);
2076   - setCheckVisible(true);
2077   - }}
2078   - >
2079   - 确认发货
2080   - </Button>
2081   - ) : (
2082   - ''
2083   - )}
2084   -
2085   - {optRecord.paths?.includes('orderCancel') ? (
2086   - <ButtonConfirm
2087   - className="p-0"
2088   - title="确认作废?"
2089   - text="作废"
2090   - onConfirm={async () => {
2091   - let body = { ids: [optRecord.id], checkIsMainOrderId: false };
2092   - const data = await postServiceOrderOrderCancel({
2093   - data: body,
2094   - });
2095   - if (data.result === RESPONSE_CODE.SUCCESS) {
2096   - message.success(data.message);
2097   - refreshTable();
2098   - }
2099   - }}
2100   - />
2101   - ) : (
2102   - ''
2103   - )}
2104   - </Flex>
2105   - </Flex>
2106   -
2107   - <Flex title={optRecord.notes}>
2108   - <div
2109   - className="max-w-[1100px] overflow-hidden whitespace-normal overflow-ellipsis hover:cursor-pointer"
2110   - onClick={() => {
2111   - copyToClipboard(optRecord.notes);
2112   - message.info('备注复制成功:' + optRecord.notes);
2113   - }}
2114   - >
2115   - <span className="text-[#8C8C8C]">
2116   - 备注:
2117   - {optRecord.notes === null ? '暂无备注' : optRecord.notes}
2118   - </span>
2119   - </div>
2120   - {!isSupplier() && (isSales() || isWarehousekeeper() || isAdmin()) && (
2121   - <EditTwoTone
2122   - className="pl-1 pr-1 hover:curcor-pointer"
2123   - onClick={() => {
2124   - setNotesEditVisible(true);
2125   - setSelectedRows([optRecord.id]);
2126   - setNotes(optRecord.notes);
2127   - setNotesType(1);
2128   - }}
2129   - />
2130   - )}
2131   - </Flex>
2132   -
2133   - {(isProcure() || isWarehousekeeper() || isSales() || isAdmin()) &&
2134   - !isSupplier() ? (
2135   - <div className="pt-2">
2136   - <Flex title={optRecord.supplierName}>
2137   - <div>
2138   - <span className="text-[#8C8C8C]">
2139   - 所属采购:
2140   - {optRecord.supplierName === null
2141   - ? '暂无'
2142   - : optRecord.supplierName}
2143   - </span>
2144   - </div>
2145   -
2146   - <Divider type="vertical" />
2147   -
2148   - <div className="overflow-hidden whitespace-normal overflow-ellipsis hover:cursor-pointer">
2149   - <span className="text-[#8C8C8C]">
2150   - 采购备注:
2151   - {optRecord.procureNotes === null
2152   - ? '暂无备注'
2153   - : optRecord.procureNotes}
2154   - </span>
2155   - </div>
2156   - {/* 编辑备注按钮 */}
2157   - {(isProcure() || isAdmin()) && (
2158   - <EditTwoTone
2159   - className="pl-1 pr-1 hover:curcor-pointer"
2160   - onClick={() => {
2161   - setSelectedRows([optRecord.id]);
2162   - setNotes(optRecord.procureNotes);
2163   - setNotesEditVisible(true);
2164   - setNotesType(2);
2165   - }}
2166   - />
2167   - )}
2168   - </Flex>
2169   -
2170   - {(isAdmin() || isProcure()) && (
2171   - <Flex title={optRecord.supplierNotes}>
2172   - <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis">
2173   - <span className="text-[#8C8C8C]">
2174   - 供应商备注:
2175   - {optRecord.supplierNotes === null
2176   - ? '暂无备注'
2177   - : optRecord.supplierNotes}
2178   - </span>
2179   - </div>
2180   - {/* 编辑备注按钮 */}
2181   - <EditTwoTone
2182   - className="pl-1 hover:curcor-pointer"
2183   - onClick={() => {
2184   - setSelectedRows([optRecord.id]);
2185   - setNotes(optRecord.supplierNotes);
2186   - setNotesEditVisible(true);
2187   - setNotesType(3);
2188   - }}
2189   - />
2190   - </Flex>
2191   - )}
2192   - </div>
2193   - ) : (
2194   - ''
2195   - )}
2196   -
2197   - {isAdmin() || isSales() || isFinance() ? (
2198   - <Flex title={optRecord.notes} className="pt-2">
2199   - <div className="flex items-center">
2200   - <div className="flex items-center max-w-[500px]">
2201   - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
2202   - <Tooltip
2203   - title={optRecord.applyInvoicingNotes}
2204   - placement="topLeft"
2205   - >
2206   - <span className="text-[#8C8C8C]">
2207   - 申请开票备注:
2208   - {optRecord.applyInvoicingNotes === undefined ||
2209   - optRecord.applyInvoicingNotes === null
2210   - ? '暂无备注'
2211   - : optRecord.applyInvoicingNotes}
2212   - </span>
2213   - </Tooltip>
2214   - </div>
2215   -
2216   - {getAfterAnnexList()}
2217   -
2218   - <Tooltip title="编辑">
2219   - <EditTwoTone
2220   - className="pl-1 hover:curcor-pointer"
2221   - onClick={() => {
2222   - setNotesEditVisible(true);
2223   - setSelectedRows([optRecord.id]);
2224   - setNotes(optRecord.applyInvoicingNotes);
2225   - setNotesType(4);
2226   - }}
2227   - />
2228   - </Tooltip>
2229   - </div>
2230   - <Divider type="vertical" className="mx-5" />
2231   - <div className="flex items-center max-w-[500px]">
2232   - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
2233   - <Tooltip title={optRecord.checkNotes} placement="topLeft">
2234   - <span className="text-[#8C8C8C] mr-3">
2235   - 财务审核备注:
2236   - {optRecord.checkNotes === undefined ||
2237   - optRecord.checkNotes === null
2238   - ? '暂无备注'
2239   - : optRecord.checkNotes}
2240   - </span>
2241   - </Tooltip>
2242   - </div>
2243   -
2244   - {getInvoicingCheckAnnexList()}
2245   - </div>
2246   - </div>
2247   - </Flex>
2248   - ) : (
2249   - ''
2250   - )}
2251   -
2252   - {isAdmin() || isSales() || isFinance() ? (
2253   - <Flex title={optRecord.notes} className="pt-2">
2254   - <div className="flex items-center">
2255   - <div className="flex items-center max-w-[500px]">
2256   - <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
2257   - <Tooltip title={optRecord.reissueNotes} placement="topLeft">
2258   - <span className="text-[#8C8C8C]">
2259   - 重新开票备注:
2260   - {optRecord.reissueNotes === undefined ||
2261   - optRecord.reissueNotes === null
2262   - ? '暂无备注'
2263   - : optRecord.reissueNotes}
2264   - </span>
2265   - </Tooltip>
2266   - </div>
2267   -
2268   - <Tooltip title="编辑">
2269   - <EditTwoTone
2270   - className="pl-1 hover:curcor-pointer"
2271   - onClick={() => {
2272   - setNotesEditVisible(true);
2273   - setSelectedRows([optRecord.id]);
2274   - setNotes(optRecord.reissueNotes);
2275   - setNotesType(5);
2276   - }}
2277   - />
2278   - </Tooltip>
2279   - </div>
2280   - <Divider type="vertical" className="mx-5" />
2281   - </div>
2282   - </Flex>
2283   - ) : (
2284   - ''
2285   - )}
2286   - </>
2287   - );
2288   - };
2289   - const expandedRowRender = (record) => {
2290   - let subOrders = record.subOrderInformationLists;
2291   -
2292   - return (
2293   - <ProTable
2294   - id="sub-table"
2295   - className="w-full "
2296   - showHeader={false}
2297   - columns={[
2298   - {
2299   - title: 'ID',
2300   - dataIndex: 'id',
2301   - key: 'id',
2302   - render: (text: any, optRecord: any) => {
2303   - return <SubOderRander record={record} optRecord={optRecord} />;
2304   - },
2305   - },
2306   - ]}
2307   - rowSelection={{
2308   - onSelect: (row: any) => {
2309   - let subId = row.id;
2310   - let mainId = row.mainOrderId;
2311   - let newSelectedSubOrderKeys = [...selectedSubOrderKeys];
2312   - let currentMainOrderSelectedSubOrderList =
2313   - subOrderSelectedMap.get(mainId);
2314   - if (!selectedSubOrderKeys.includes(subId)) {
2315   - //选中子订单
2316   - newSelectedSubOrderKeys.push(subId);
2317   -
2318   - //在Map中添加对应的主订单中的子订单
2319   - if (currentMainOrderSelectedSubOrderList) {
2320   - currentMainOrderSelectedSubOrderList.push(row);
2321   - } else {
2322   - currentMainOrderSelectedSubOrderList = [row];
2323   - }
2324   -
2325   - //如果该主订单的所有子订单都选中了,那么勾选上主订单
2326   - if (
2327   - currentMainOrderSelectedSubOrderList?.length ===
2328   - mainOrderIdSubOrderIdRelationsMap.get(mainId)?.length
2329   - ) {
2330   - selectedMainOrderKeys.push(mainId, record);
2331   - mainOrderSelectedMap.set(mainId, record);
2332   - }
2333   -
2334   - //如果所有主订单都勾选上了,那么勾选上总选中按钮
2335   - if (
2336   - mainOrderSelectedMap?.size ===
2337   - mainOrderIdSubOrderIdRelationsMap.size
2338   - ) {
2339   - setAllMainChecked(true);
2340   - }
2341   - } else {
2342   - //取消选中子订单
2343   - newSelectedSubOrderKeys = newSelectedSubOrderKeys.filter(
2344   - (item) => {
2345   - return item !== subId;
2346   - },
2347   - );
2348   -
2349   - removeSelecetMainOrderKeyByMainOrderId(mainId); //某个子订单取消勾选了,对应的主订单也要取消勾选
2350   -
2351   - //在Map中删除掉对应的主订单中的子订单
2352   - if (currentMainOrderSelectedSubOrderList) {
2353   - currentMainOrderSelectedSubOrderList =
2354   - currentMainOrderSelectedSubOrderList.filter((item) => {
2355   - return item.id !== subId;
2356   - });
2357   - } else {
2358   - subOrderSelectedMap.set(mainId, [row]);
2359   - }
2360   -
2361   - mainOrderSelectedMap.delete(mainId);
2362   - //总选中按钮取消选中
2363   - setAllMainChecked(false);
2364   - }
2365   -
2366   - //如果该主订单已经没有子订单选中,删除key
2367   - if (currentMainOrderSelectedSubOrderList?.length === 0) {
2368   - subOrderSelectedMap.delete(record.id);
2369   - } else {
2370   - subOrderSelectedMap.set(
2371   - record.id,
2372   - currentMainOrderSelectedSubOrderList,
2373   - );
2374   - }
2375   -
2376   - setSelectedSubOrderKeys(newSelectedSubOrderKeys);
2377   - setSelectedRows(currentMainOrderSelectedSubOrderList);
2378   - },
2379   - selectedRowKeys: selectedSubOrderKeys,
2380   - // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
2381   - // 注释该行则默认不显示下拉选项
2382   - // selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
2383   - // defaultSelectedRowKeys: [],
2384   - }}
2385   - rowKey="id"
2386   - headerTitle={false}
2387   - search={false}
2388   - options={false}
2389   - dataSource={subOrders}
2390   - pagination={false}
2391   - tableAlertRender={false}
2392   - />
2393   - );
2394   - };
2395   -
2396   - // 主订单内容渲染
2397   - const MainOrderColumnRender = ({ record }: { record: OrderListItemType }) => {
2398   - return (
2399   - <Flex vertical={true}>
2400   - {/* 编号、时间、销售信息 */}
2401   - <Flex
2402   - className="px-4 py-4 bg-white rounded-t-lg"
2403   - justify="space-between"
2404   - >
2405   - <Flex wrap="wrap" gap="middle" vertical>
2406   - <Flex>
2407   - <Flex>
2408   - <Checkbox
2409   - onChange={() => onCheckboxChange(record)}
2410   - checked={selectedMainOrderKeys.includes(record.id)}
2411   - >
2412   - <Space split={<Divider type="vertical" />}>
2413   - <div>
2414   - <span className="text-[#8C8C8C]">订单号:</span>
2415   - <span className="text-slate-700">{record.id}</span>
2416   - {record.modified ? (
2417   - <Tooltip title="点击查看详情">
2418   - <span
2419   - className="text-[#f44e4e] cursor-pointer"
2420   - onClick={async () => {
2421   - createOptObject(null, record.id);
2422   - setModifiedDiffModalVisible(true);
2423   - }}
2424   - >
2425   - (修改过)
2426   - </span>
2427   - </Tooltip>
2428   - ) : (
2429   - ''
2430   - )}
2431   - </div>
2432   - </Space>
2433   - </Checkbox>
2434   - <Tooltip title="点击复制订单号">
2435   - <CopyOutlined
2436   - className="hover:cursor-pointer"
2437   - style={{ color: '#8C8C8C' }}
2438   - onClick={() => {
2439   - copyToClipboard(record.id);
2440   - message.info('订单号复制成功!');
2441   - }}
2442   - />
2443   - </Tooltip>
2444   - <Divider type="vertical" />
2445   - <span>{formatDateTime(record.createTime)}</span>
2446   - <Divider type="vertical" />
2447   - <Space split={<Divider type="vertical" />}>
2448   - <div
2449   - className="hover:cursor-pointer"
2450   - onClick={() => {
2451   - copyToClipboard(record.salesCode);
2452   - message.info('代表复制成功:' + record.salesCode);
2453   - }}
2454   - >
2455   - <span className="text-[#8C8C8C]">代表:</span>
2456   - <span className="text-slate-700">{record.salesCode}</span>
2457   - </div>
2458   - {!isSupplier() ? (
2459   - <>
2460   - <div
2461   - title={record.institution}
2462   - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]"
2463   - >
2464   - <span className="text-[#8C8C8C]">单位:</span>
2465   - <span className="text-slate-700">
2466   - {record.institution}
2467   - </span>
2468   - </div>
2469   - <span>
2470   - <span className="text-[#8C8C8C]">联系人:</span>
2471   - <span className="text-slate-700">
2472   - {record.institutionContactName + ' '}
2473   - </span>
2474   - </span>
2475   - </>
2476   - ) : (
2477   - ''
2478   - )}
2479   - <div
2480   - title={record.institution}
2481   - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]"
2482   - >
2483   - <span
2484   - className="hover:cursor-pointer"
2485   - onClick={() => {
2486   - copyToClipboard(record.customerName);
2487   - message.info('收货人复制成功:' + record.customerName);
2488   - }}
2489   - >
2490   - <span className="text-[#8C8C8C]">收货人:</span>
2491   - {!isSupplier() && (
2492   - <Tooltip className="order-tooltip" title="详情">
2493   - <ContainerTwoTone
2494   - className="px-1 hover:curcor-pointer"
2495   - onClick={() => {
2496   - createOptObject(null, record.id);
2497   - setDeliverInfoDrawerVisible(true);
2498   - }}
2499   - />
2500   - </Tooltip>
2501   - )}
2502   - <span className="text-slate-700">
2503   - {record.customerName + ' '}
2504   - </span>
2505   - </span>
2506   - </div>
2507   -
2508   - {isSupplier() ? (
2509   - <div
2510   - title={record.customerShippingAddress}
2511   - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px] hover:cursor-pointer"
2512   - onClick={() => {
2513   - copyToClipboard(record.customerShippingAddress);
2514   - message.info(
2515   - '收货地址复制成功:' + record.customerShippingAddress,
2516   - );
2517   - }}
2518   - >
2519   - <span className="text-[#8C8C8C]">收货地址:</span>
2520   - <span className="text-slate-700">
2521   - {record.customerShippingAddress}
2522   - </span>
2523   - </div>
2524   - ) : (
2525   - ''
2526   - )}
2527   - </Space>
2528   - </Flex>
2529   - </Flex>
2530   -
2531   - {isSupplier() ? (
2532   - <Flex className="pl-6" align="center">
2533   - <Flex
2534   - className="hover:cursor-pointer"
2535   - onClick={() => {
2536   - copyToClipboard(record.customerContactNumber);
2537   - message.info(
2538   - '联系电话复制成功:' + record.customerContactNumber,
2539   - );
2540   - }}
2541   - >
2542   - <span className="text-[#8C8C8C]">联系电话:</span>
2543   - <span className="text-slate-700">
2544   - {record.customerContactNumber + ' '}
2545   - </span>
2546   - </Flex>
2547   - </Flex>
2548   - ) : (
2549   - ''
2550   - )}
2551   -
2552   - <Flex className="pl-6" align="center">
2553   - {roleCode === 'finance' ? (
2554   - <div
2555   - title={enumValueToLabel(
2556   - record.receivingCompany,
2557   - getReceivingCompanyOptions(PAYEE_OPTIONS),
2558   - )}
2559   - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px]"
2560   - >
2561   - <span className="text-[#8C8C8C]">开票收款单位:</span>
2562   - <span className="text-slate-700">
2563   - {record.receivingCompany !== null
2564   - ? enumValueToLabel(
2565   - record.receivingCompany,
2566   - getReceivingCompanyOptions(PAYEE_OPTIONS),
2567   - )
2568   - : '暂无'}
2569   - </span>
2570   - </div>
2571   - ) : (
2572   - ''
2573   - )}
2574   -
2575   - {roleCode === 'finance' ? <Divider type="vertical" /> : ''}
2576   -
2577   - <div title={record.notes}>
2578   - <div
2579   - className="max-w-[850px] whitespace-normal overflow-hidden overflow-ellipsis hover:cursor-pointer"
2580   - onClick={() => {
2581   - copyToClipboard(record.notes);
2582   - message.info('备注复制成功:' + record.notes);
2583   - }}
2584   - >
2585   - <span className="text-[#8C8C8C]">备注:</span>
2586   - <span className="ml-2">
2587   - {record.notes === null ? '暂无备注' : record.notes}
2588   - </span>
2589   - </div>
2590   - </div>
2591   -
2592   - {!isSupplier() ? (
2593   - <Tooltip title="编辑">
2594   - <EditTwoTone
2595   - className="pl-1 hover:curcor-pointer"
2596   - onClick={() => {
2597   - setNotesEditVisible(true);
2598   - setSelectedRows([record.id]);
2599   - setNotes(record.notes);
2600   - setNotesType(0);
2601   - }}
2602   - />
2603   - </Tooltip>
2604   - ) : (
2605   - ''
2606   - )}
2607   -
2608   - {record.goodsWeight !== null ? (
2609   - <div title={record.goodsWeight + 'kg'} className="pl-3">
2610   - <div
2611   - className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer"
2612   - onClick={() => {
2613   - copyToClipboard(record.goodsWeight + 'kg');
2614   - message.info(
2615   - '包裹重量复制成功:' + record.goodsWeight + 'kg',
2616   - );
2617   - }}
2618   - >
2619   - <span className="text-[#8C8C8C]">包裹重量:</span>
2620   - <span className="ml-2">{record.goodsWeight + 'kg'}</span>
2621   - </div>
2622   - </div>
2623   - ) : (
2624   - ''
2625   - )}
2626   -
2627   - {record.goodsVolume !== null ? (
2628   - <div title={record.goodsVolume + 'm³'} className="pl-3">
2629   - <div
2630   - className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer"
2631   - onClick={() => {
2632   - copyToClipboard(record.goodsVolume + 'm³');
2633   - message.info(
2634   - '包裹体积复制成功:' + record.goodsVolume + 'm³',
2635   - );
2636   - }}
2637   - >
2638   - <span className="text-[#8C8C8C]">包裹体积:</span>
2639   - <span className="ml-2">{record.goodsVolume + 'm³'}</span>
2640   - </div>
2641   - </div>
2642   - ) : (
2643   - ''
2644   - )}
2645   - </Flex>
2646   - </Flex>
2647   - <Flex wrap="wrap" gap="middle" vertical>
2648   - <Flex justify="flex-end">
2649   - <Flex wrap="wrap" gap="middle" align="center">
2650   - {!isSupplier() ? (
2651   - <div>
2652   - <span className="text-[#8C8C8C]">总金额:¥</span>
2653   - <span className="text-lg font-medium">
2654   - {record.totalPayment}
2655   - </span>
2656   - </div>
2657   - ) : (
2658   - ''
2659   - )}
2660   -
2661   - {rolePath?.includes('addOrder') ? (
2662   - <Tooltip title="复制">
2663   - <CopyTwoTone
2664   - className="hover:cursor-pointer"
2665   - onClick={() => {
2666   - createOptObject(null, record.id);
2667   - copyOrderToClipboard(record);
2668   - setOrderOptType('copy');
2669   - setOrderDrawerVisible(true);
2670   - }}
2671   - />
2672   - </Tooltip>
2673   - ) : (
2674   - <Tooltip title="复制文本">
2675   - <CopyTwoTone
2676   - className="hover:cursor-pointer"
2677   - onClick={() => {
2678   - copyOrderToClipboard(record);
2679   - }}
2680   - />
2681   - </Tooltip>
2682   - )}
2683   - {!isSupplier() ? (
2684   - <Tooltip title="历史">
2685   - <ClockCircleTwoTone
2686   - className="hover:cursor-pointer"
2687   - onClick={() => {
2688   - setHistoryModalVisible(true);
2689   - if (subOrderSelectedMap.get(record.id)?.length) {
2690   - setSelectedRows(subOrderSelectedMap.get(record.id));
2691   - } else {
2692   - setSelectedRows(record.subOrderInformationLists);
2693   - }
2694   - }}
2695   - />
2696   - </Tooltip>
2697   - ) : (
2698   - ''
2699   - )}
2700   - </Flex>
2701   - </Flex>
2702   - <Flex justify="flex-end">
2703   - <Space.Compact direction="vertical" align="end">
2704   - <Space wrap>
2705   - {record.paths?.includes('postAudit') ? (
2706   - <Button
2707   - className="p-0"
2708   - type="link"
2709   - onClick={() => {
2710   - setCurrentMainId(record.id);
2711   - setCurretnOptSubId(null);
2712   - setCheckVisible(true);
2713   - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT);
2714   - }}
2715   - >
2716   - 后置审核
2717   - </Button>
2718   - ) : (
2719   - ''
2720   - )}
2721   - {record.paths?.includes('URGENT_INVOICE_AUDITING') ? (
2722   - <Button
2723   - className="p-0"
2724   - type="link"
2725   - onClick={() => {
2726   - createOptObject(null, record.id);
2727   - setCheckVisible(true);
2728   - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING);
2729   - }}
2730   - >
2731   - 加急审核(新)
2732   - </Button>
2733   - ) : (
2734   - ''
2735   - )}
2736   - {record.paths?.includes('URGENT_INVOICE_AUDITING_old') ? (
2737   - <Button
2738   - className="p-0"
2739   - type="link"
2740   - onClick={() => {
2741   - createOptObject(null, record.id);
2742   - setCheckVisible(true);
2743   - setOrderCheckType(
2744   - CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD,
2745   - );
2746   - }}
2747   - >
2748   - 加急审核(旧)
2749   - </Button>
2750   - ) : (
2751   - ''
2752   - )}
2753   - {record.paths?.includes('salesConfirm') && (
2754   - <ButtonConfirm
2755   - className="p-0"
2756   - title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。"
2757   - text="订单确认"
2758   - onConfirm={async () => {
2759   - let subIds = subOrderSelectedMap
2760   - .get(record.id)
2761   - ?.map((item) => {
2762   - return item.id;
2763   - });
2764   - if (subIds === null || subIds === undefined) {
2765   - subIds = record.subOrderInformationLists.map(
2766   - (item) => {
2767   - return item.id;
2768   - },
2769   - );
2770   - }
2771   - let res = await postServiceOrderSalesConfirm({
2772   - data: {
2773   - subOrderIds: subIds,
2774   - },
2775   - });
2776   -
2777   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
2778   - message.success(res.message);
2779   - refreshTable();
2780   - }
2781   - }}
2782   - />
2783   - )}
2784   - {record.paths?.includes('uploadPaymentReceiptBill') ? (
2785   - <Button
2786   - className="p-0"
2787   - type="link"
2788   - onClick={() => {
2789   - createOptObject(null, record.id);
2790   - setUploadPayBillModalVisible(true);
2791   - }}
2792   - >
2793   - 回款
2794   - </Button>
2795   - ) : (
2796   - ''
2797   - )}
2798   -
2799   - {record.paths?.includes('modifiedAuditRequest') ? (
2800   - <Button
2801   - className="p-0"
2802   - type="link"
2803   - onClick={() => {
2804   - createOptObject(null, record.id);
2805   - setCheckVisible(true);
2806   - setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT);
2807   - }}
2808   - >
2809   - 节点修改审核
2810   - </Button>
2811   - ) : (
2812   - ''
2813   - )}
2814   -
2815   - {record.paths?.includes('auditPaymentReceipt') ? (
2816   - <Button
2817   - className="p-0"
2818   - type="link"
2819   - onClick={() => {
2820   - createOptObject(null, record.id);
2821   - setCheckVisible(true);
2822   - setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT);
2823   - }}
2824   - >
2825   - 回款审核
2826   - </Button>
2827   - ) : (
2828   - ''
2829   - )}
2830   -
2831   - {record.paths?.includes('modifiedLeaderAuditRequest') ? (
2832   - <Button
2833   - className="p-0"
2834   - type="link"
2835   - onClick={() => {
2836   - createOptObject(null, record.id);
2837   - setCheckVisible(true);
2838   - setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT);
2839   - }}
2840   - >
2841   - 领导修改审核
2842   - </Button>
2843   - ) : (
2844   - ''
2845   - )}
2846   -
2847   - {false ? (
2848   - <Button
2849   - className="p-0"
2850   - type="link"
2851   - onClick={() => {
2852   - createOptObject(null, record.id);
2853   - setFinancialReceiptsModalVisible(true);
2854   - setIsEdit(true);
2855   - }}
2856   - >
2857   - 收款记录
2858   - </Button>
2859   - ) : (
2860   - ''
2861   - )}
2862   -
2863   - {record.paths?.includes('reissue_old') ? (
2864   - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'||
2865   - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/
2866   - <Button
2867   - className="p-0"
2868   - type="link"
2869   - onClick={() => {
2870   - setCurrentMainId(record.id);
2871   - setReissueVisibleOld(true);
2872   - console.log(reissueVisible);
2873   - }}
2874   - >
2875   - 重新开票(旧)
2876   - </Button>
2877   - ) : (
2878   - ''
2879   - )}
2880   -
2881   - {record.paths?.includes('confirmReissue_old') ? (
2882   - <Button
2883   - className="p-0"
2884   - type="link"
2885   - onClick={() => {
2886   - setCurrentMainId(record.id);
2887   - setCurretnOptSubId(null);
2888   - setCheckVisible(true);
2889   - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD);
2890   - }}
2891   - >
2892   - 重新开票审核(旧)
2893   - </Button>
2894   - ) : (
2895   - ''
2896   - )}
2897   -
2898   - {record.paths?.includes('reissue') ? (
2899   - /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'||
2900   - optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/
2901   - <Button
2902   - className="p-0"
2903   - type="link"
2904   - onClick={() => {
2905   - setCurrentMainId(record.id);
2906   - setReissueVisible(true);
2907   - }}
2908   - >
2909   - 重新开票(新)
2910   - </Button>
2911   - ) : (
2912   - ''
2913   - )}
2914   -
2915   - {record.paths?.includes('confirmReissue') ? (
2916   - <Button
2917   - className="p-0"
2918   - type="link"
2919   - onClick={() => {
2920   - setCurrentMainId(record.id);
2921   - setCurretnOptSubId(null);
2922   - setCheckVisible(true);
2923   - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE);
2924   - }}
2925   - >
2926   - 重新开票审核(新)
2927   - </Button>
2928   - ) : (
2929   - ''
2930   - )}
2931   -
2932   - {record.paths?.includes('procureOrder') ? (
2933   - <ButtonConfirm
2934   - className="p-0"
2935   - title="是否下单?"
2936   - text="下单"
2937   - onConfirm={async () => {
2938   - let subIds = subOrderSelectedMap
2939   - .get(record.id)
2940   - ?.map((item) => {
2941   - return item.id;
2942   - });
2943   - if (subIds === null || subIds === undefined) {
2944   - subIds = record.subOrderInformationLists.map(
2945   - (item) => {
2946   - return item.id;
2947   - },
2948   - );
2949   - }
2950   - let res = await postServiceOrderProcureOrder({
2951   - data: { subIds: subIds },
2952   - });
2953   - if (res.result === RESPONSE_CODE.SUCCESS) {
2954   - message.success(res.message);
2955   - refreshTable();
2956   - return true;
2957   - }
2958   - }}
2959   - />
2960   - ) : (
2961   - ''
2962   - )}
2963   -
2964   - {record.paths?.includes('cancelSend') ? (
2965   - <ButtonConfirm
2966   - className="p-0"
2967   - title="是否取消发货?"
2968   - text="取消发货"
2969   - onConfirm={async () => {
2970   - let subIds = subOrderSelectedMap
2971   - .get(record.id)
2972   - ?.map((item) => {
2973   - return item.id;
2974   - });
2975   - if (subIds === null || subIds === undefined) {
2976   - subIds = record.subOrderInformationLists.map(
2977   - (item) => {
2978   - return item.id;
2979   - },
2980   - );
2981   - }
2982   - let res = await postServiceOrderCancelSend({
2983   - data: { subIds: subIds },
2984   - });
2985   - if (res.result === RESPONSE_CODE.SUCCESS) {
2986   - message.success(res.message);
2987   - refreshTable();
2988   - return true;
2989   - }
2990   - }}
2991   - />
2992   - ) : (
2993   - ''
2994   - )}
2995   -
2996   - {record.paths?.includes('applyModify') ? (
2997   - <Button
2998   - className="p-0"
2999   - type="link"
3000   - onClick={() => {
3001   - createOptObject(null, record.id);
3002   - setOrderDrawerVisible(true);
3003   - setOrderOptType('order-change-normal');
3004   - }}
3005   - >
3006   - 申请修改
3007   - </Button>
3008   - ) : (
3009   - ''
3010   - )}
3011   -
3012   - {record.paths?.includes('leaderAudit') ? (
3013   - <Button
3014   - className="p-0"
3015   - type="link"
3016   - onClick={() => {
3017   - let selectedSubOrders = subOrderSelectedMap.get(
3018   - record.id,
3019   - );
3020   - setSelectedRows(selectedSubOrders);
3021   - if (selectedSubOrders === undefined) {
3022   - selectedSubOrders = record.subOrderInformationLists;
3023   - }
3024   - for (let i = 0; i < selectedSubOrders.length; i++) {
3025   - if (
3026   - selectedSubOrders[i].orderStatus !==
3027   - 'LEADER_PROCESS'
3028   - ) {
3029   - message.error('请选择领导待审核的子订单进行审核');
3030   - return;
3031   - }
3032   - }
3033   - createOptObject(null, record.id);
3034   - setCheckVisible(true);
3035   - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT);
3036   - }}
3037   - >
3038   - 审核
3039   - </Button>
3040   - ) : (
3041   - ''
3042   - )}
3043   -
3044   - {record.paths?.includes('changeOrderAudit') ? (
3045   - <Button
3046   - className="p-0"
3047   - type="link"
3048   - onClick={() => {
3049   - let selectedSubOrders = subOrderSelectedMap.get(
3050   - record.id,
3051   - );
3052   - setSelectedRows(selectedSubOrders);
3053   - if (selectedSubOrders === undefined) {
3054   - selectedSubOrders = record.subOrderInformationLists;
3055   - }
3056   - for (let i = 0; i < selectedSubOrders.length; i++) {
3057   - if (
3058   - selectedSubOrders[i].orderStatus !==
3059   - 'MODIFY_APPLY_WAIT_FOR_AUDIT'
3060   - ) {
3061   - message.error('请选择[修改待审核]的子订单进行审核');
3062   - return;
3063   - }
3064   - }
3065   - createOptObject(null, record.id);
3066   - setCheckVisible(true);
3067   - setOrderCheckType(
3068   - CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT,
3069   - );
3070   - }}
3071   - >
3072   - 审核
3073   - </Button>
3074   - ) : (
3075   - ''
3076   - )}
3077   -
3078   - {record.paths?.includes('creditAudit') ? (
3079   - <Button
3080   - className="p-0"
3081   - type="link"
3082   - onClick={() => {
3083   - let selectedSubOrders = subOrderSelectedMap.get(
3084   - record.id,
3085   - );
3086   - setSelectedRows(selectedSubOrders);
3087   - if (selectedSubOrders === undefined) {
3088   - selectedSubOrders = record.subOrderInformationLists;
3089   - }
3090   - for (let i = 0; i < selectedSubOrders.length; i++) {
3091   - if (
3092   - selectedSubOrders[i].orderStatus !==
3093   - 'CREDIT_CONFIRM'
3094   - ) {
3095   - message.error('请选择[赊账待审核]的子订单进行审核');
3096   - return;
3097   - }
3098   - }
3099   - createOptObject(null, record.id);
3100   - setCheckVisible(true);
3101   - setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT);
3102   - }}
3103   - >
3104   - 赊账审核
3105   - </Button>
3106   - ) : (
3107   - ''
3108   - )}
3109   -
3110   - {record.paths?.includes('editProductionTime') ? (
3111   - <Button
3112   - className="p-0"
3113   - type="link"
3114   - onClick={() => {
3115   - createOptObject(null, record.id);
3116   - setProductionTimeModalVisible(true);
3117   - }}
3118   - >
3119   - 生产时间
3120   - </Button>
3121   - ) : (
3122   - ''
3123   - )}
3124   -
3125   - {record.paths?.includes('procureConvertProcure') ? (
3126   - <Button
3127   - className="p-0"
3128   - type="link"
3129   - onClick={() => {
3130   - let selectedSubOrders = subOrderSelectedMap.get(
3131   - record.id,
3132   - );
3133   - if (selectedSubOrders === undefined) {
3134   - selectedSubOrders = record.subOrderInformationLists;
3135   - }
3136   -
3137   - for (let i = 0; i < selectedSubOrders.length; i++) {
3138   - if (
3139   - !selectedSubOrders[i].paths.includes(
3140   - 'procureConvertProcure',
3141   - )
3142   - ) {
3143   - message.error('请选择允许转发的子订单进行转发');
3144   - return;
3145   - }
3146   - }
3147   - createOptObject(null, record.id);
3148   - setOrderCheckType(CHECK_TYPE.PROCURE);
3149   - setProcureConvertModalVisible(true);
3150   - }}
3151   - >
3152   - 转发
3153   - </Button>
3154   - ) : (
3155   - ''
3156   - )}
3157   - {record.paths?.includes('sendProduct') ? (
3158   - <Button
3159   - className="p-0"
3160   - type="link"
3161   - onClick={() => {
3162   - if (!subOrderSelectedMap.get(record.id)?.length) {
3163   - return message.error('请选择选择子订单');
3164   - }
3165   - createOptObject(null, record.id);
3166   - setDeliverVisible(true);
3167   - setIsSendProduct(true);
3168   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
3169   - }}
3170   - >
3171   - 仓库发货
3172   - </Button>
3173   - ) : (
3174   - ''
3175   - )}
3176   -
3177   - {/* 供应商发货 */}
3178   - {record.paths?.includes('supplierSendOrder') ? (
3179   - <Button
3180   - className="p-0"
3181   - type="link"
3182   - onClick={() => {
3183   - if (!subOrderSelectedMap.get(record.id)?.length) {
3184   - return message.error('请选择选择子订单');
3185   - }
3186   - createOptObject(null, record.id);
3187   - setDeliverVisible(true);
3188   - setIsSendProduct(true);
3189   - setOrderCheckType(CHECK_TYPE.SUPPLIER);
3190   - }}
3191   - >
3192   - 供应商发货
3193   - </Button>
3194   - ) : (
3195   - ''
3196   - )}
3197   -
3198   - {record.paths?.includes('procureSend') ? (
3199   - <Button
3200   - className="p-0"
3201   - type="link"
3202   - onClick={() => {
3203   - if (!subOrderSelectedMap.get(record.id)?.length) {
3204   - return message.error('请选择选择子订单');
3205   - }
3206   - createOptObject(null, record.id);
3207   - setDeliverVisible(true);
3208   - setIsSendProduct(true);
3209   - setOrderCheckType(CHECK_TYPE.PROCURE);
3210   - }}
3211   - >
3212   - {isSupplier() ? '发货' : '采购发货'}
3213   - </Button>
3214   - ) : (
3215   - ''
3216   - )}
3217   -
3218   - {record.paths?.includes('printOrder') ? (
3219   - <Button
3220   - className="p-0"
3221   - type="link"
3222   - onClick={() => {
3223   - const selectedSubOrders = subOrderSelectedMap.get(
3224   - record.id,
3225   - );
3226   - if (!selectedSubOrders?.length) {
3227   - return message.error('请选择选择子订单');
3228   - }
3229   -
3230   - for (let subOrderRecord of selectedSubOrders) {
3231   - let paths = subOrderRecord.paths;
3232   - if (!checkePrintable(paths)) {
3233   - return message.error('请选择可以打印的子订单');
3234   - }
3235   - }
3236   - createOptObject(null, record.id);
3237   - setOrderPrintVisible(true);
3238   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
3239   - }}
3240   - >
3241   - 仓库打印
3242   - </Button>
3243   - ) : (
3244   - ''
3245   - )}
3246   -
3247   - {record.paths?.includes('supplierPrint') ? (
3248   - <Button
3249   - className="p-0"
3250   - type="link"
3251   - onClick={() => {
3252   - if (!subOrderSelectedMap.get(record.id)?.length) {
3253   - return message.error('请选择选择子订单');
3254   - }
3255   -
3256   - createOptObject(null, record.id);
3257   - setOrderPrintVisible(true);
3258   - setOrderCheckType(CHECK_TYPE.SUPPLIER);
3259   - }}
3260   - >
3261   - 供应商打印
3262   - </Button>
3263   - ) : (
3264   - ''
3265   - )}
3266   -
3267   - {record.paths?.includes('rePrintOrder') ? (
3268   - <Button
3269   - className="p-0"
3270   - type="link"
3271   - onClick={() => {
3272   - if (!subOrderSelectedMap.get(record.id)?.length) {
3273   - return message.error('请选择选择子订单');
3274   - }
3275   - createOptObject(null, record.id);
3276   - setOrderPrintVisible(true);
3277   - setIsRePrintOrder(true);
3278   - }}
3279   - >
3280   - 重新打印
3281   - </Button>
3282   - ) : (
3283   - ''
3284   - )}
3285   - {record.paths?.includes('confirmReceipt') ? (
3286   - <Button
3287   - className="p-0"
3288   - type="link"
3289   - onClick={() => {
3290   - createOptObject(null, record.id);
3291   - setConfirmReceiptVisible(true);
3292   - }}
3293   - >
3294   - 确认收货
3295   - </Button>
3296   - ) : (
3297   - ''
3298   - )}
3299   - {record.paths?.includes('modifySendInformation') ? (
3300   - <Button
3301   - className="p-0"
3302   - type="link"
3303   - onClick={() => {
3304   - if (!subOrderSelectedMap.get(record.id)?.length) {
3305   - return message.error(
3306   - '请选择已经发货或者已经确认收货的子订单',
3307   - );
3308   - }
3309   - for (let row of subOrderSelectedMap.get(record.id)) {
3310   - if (
3311   - row.orderStatus !== 'CONFIRM_RECEIPT' &&
3312   - row.orderStatus !== 'SHIPPED'
3313   - ) {
3314   - return message.error(
3315   - '请选择已经发货或者已经确认收货的子订单',
3316   - );
3317   - }
3318   - }
3319   - createOptObject(null, record.id);
3320   - setDeliverVisible(true);
3321   - setIsSendProduct(false);
3322   - }}
3323   - >
3324   - 修改发货信息
3325   - </Button>
3326   - ) : (
3327   - ''
3328   - )}
3329   - {record.paths?.includes('invoicing') ? (
3330   - <Button
3331   - type="link"
3332   - className="p-0"
3333   - onClick={() => {
3334   - createOptObject(null, record.id);
3335   - setFinancialVisible(true);
3336   - setIsEdit(false);
3337   - }}
3338   - >
3339   - 开票
3340   - </Button>
3341   - ) : (
3342   - ''
3343   - )}
3344   -
3345   - {record.paths?.includes('applyInvoicing_old') ? (
3346   - <Button
3347   - type="link"
3348   - className="p-0"
3349   - onClick={() => {
3350   - let selectedSubOrders = subOrderSelectedMap.get(
3351   - record.id,
3352   - );
3353   - if (selectedSubOrders === undefined) {
3354   - selectedSubOrders = record.subOrderInformationLists;
3355   - }
3356   - for (let i = 0; i < selectedSubOrders.length; i++) {
3357   - if (
3358   - selectedSubOrders[i].invoicingStatus ===
3359   - 'UN_INVOICE' ||
3360   - selectedSubOrders[i].afterInvoicingStatus ===
3361   - 'APPLY_FOR_INVOICING'
3362   - ) {
3363   - message.error(
3364   - '请选择需要开票且未申请开票的子订单进行申请',
3365   - );
3366   - return;
3367   - }
3368   - }
3369   -
3370   - createOptObject(null, record.id);
3371   - setApplyForInvoicingVisible(true);
3372   - setIsEdit(false);
3373   - setIsMainOrder(false);
3374   - }}
3375   - >
3376   - 申请开票(旧)
3377   - </Button>
3378   - ) : (
3379   - ''
3380   - )}
3381   -
3382   - {record.paths?.includes('applyInvoicing') ? (
3383   - <Button
3384   - type="link"
3385   - className="p-0"
3386   - onClick={() => {
3387   - let selectedSubOrders = subOrderSelectedMap.get(
3388   - record.id,
3389   - );
3390   - if (selectedSubOrders === undefined) {
3391   - selectedSubOrders = record.subOrderInformationLists;
3392   - }
3393   - for (let i = 0; i < selectedSubOrders.length; i++) {
3394   - if (
3395   - selectedSubOrders[i].invoicingStatus ===
3396   - 'UN_INVOICE' ||
3397   - selectedSubOrders[i].afterInvoicingStatus ===
3398   - 'APPLY_FOR_INVOICING'
3399   - ) {
3400   - message.error(
3401   - '请选择需要开票且未申请开票的子订单进行申请',
3402   - );
3403   - return;
3404   - }
3405   - }
3406   -
3407   - createOptObject(null, record.id);
3408   - setInvoicingDrawerFormVisible(true);
3409   - setIsEdit(false);
3410   - setIsMainOrder(false);
3411   - }}
3412   - >
3413   - 申请开票(新)
3414   - </Button>
3415   - ) : (
3416   - ''
3417   - )}
3418   -
3419   - {record.paths?.includes('applyInvoicing') ? (
3420   - <Button
3421   - type="link"
3422   - className="p-0"
3423   - onClick={() => {
3424   - console.log('5656confirm');
3425   - }}
3426   - >
3427   - 确认开票
3428   - </Button>
3429   - ) : (
3430   - ''
3431   - )}
3432   -
3433   - {record.paths?.includes('updateOrder') ? (
3434   - <Button
3435   - className="p-0"
3436   - type="link"
3437   - onClick={() => {
3438   - //勾选的子订单:如果有勾选,后面只校验有勾选的
3439   -
3440   - let selectedSubOrders = subOrderSelectedMap.get(
3441   - record.id,
3442   - );
3443   - if (
3444   - selectedSubOrders === undefined ||
3445   - selectedSubOrders.length === 0
3446   - ) {
3447   - selectedSubOrders = record.subOrderInformationLists;
3448   - }
3449   - for (
3450   - let index = 0;
3451   - index < selectedSubOrders.length;
3452   - index++
3453   - ) {
3454   - let orderStatus =
3455   - selectedSubOrders[index].orderStatus;
3456   - //仓库管理员在审核之后的任何时候都可以编辑
3457   - if (
3458   - roleCode !== 'warehouseKeeper' &&
3459   - roleCode !== 'admin'
3460   - ) {
3461   - //是审核通过及之后的订单
3462   - if (
3463   - orderStatus !== 'UNAUDITED' &&
3464   - orderStatus !== 'AUDIT_FAILED' &&
3465   - orderStatus !== 'LEADER_PROCESS' &&
3466   - orderStatus !== 'SALES_CONFIRM' &&
3467   - orderStatus !== 'CREDIT_CONFIRM'
3468   - ) {
3469   - message.error(
3470   - '请选择【未审核、审核失败、销售待确认、赊账待审核】的订单进行编辑',
3471   - );
3472   - return;
3473   - }
3474   - } else {
3475   - //仓库管理员只能编辑是还未审核的订单
3476   - if (
3477   - roleCode !== 'admin' &&
3478   - (orderStatus === 'UNAUDITED' ||
3479   - orderStatus === 'AUDIT_FAILED')
3480   - ) {
3481   - message.error('请选择已审核的订单进行编辑');
3482   - return;
3483   - }
3484   - }
3485   - }
3486   -
3487   - createOptObject(null, record.id);
3488   - setOrderDrawerVisible(true);
3489   - setOrderOptType('edit');
3490   - }}
3491   - >
3492   - 编辑
3493   - </Button>
3494   - ) : (
3495   - ''
3496   - )}
3497   -
3498   - {record?.subOrderInformationLists[0].paths?.includes(
3499   - 'noNeedInvoicingEdit',
3500   - ) ? (
3501   - <Button
3502   - className="p-0"
3503   - type="link"
3504   - onClick={() => {
3505   - createOptObject(null, record.id);
3506   - setFinancialEditVisible(true);
3507   - setIsMainOrder(true);
3508   - }}
3509   - >
3510   - 财务编辑
3511   - </Button>
3512   - ) : (
3513   - ''
3514   - )}
3515   -
3516   - {record.paths?.includes('checkOrder') ? (
3517   - <Button
3518   - className="p-0"
3519   - type="link"
3520   - onClick={() => {
3521   - let selectedSubOrders = subOrderSelectedMap.get(
3522   - record.id,
3523   - );
3524   - setSelectedRows(selectedSubOrders);
3525   - if (selectedSubOrders === undefined) {
3526   - selectedSubOrders = record.subOrderInformationLists;
3527   - }
3528   - for (let i = 0; i < selectedSubOrders.length; i++) {
3529   - let orderStatus = selectedSubOrders[i].orderStatus;
3530   - if (
3531   - orderStatus !== 'UNAUDITED' &&
3532   - orderStatus !== 'FINANCE_PROCESS' &&
3533   - orderStatus !== 'LEADER_AUDITED'
3534   - ) {
3535   - message.error(
3536   - '请选择未审核或者领导已审核的子订单进行审核',
3537   - );
3538   - return;
3539   - }
3540   - }
3541   -
3542   - createOptObject(null, record.id);
3543   - setCheckVisible(true);
3544   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
3545   - }}
3546   - >
3547   - 审核
3548   - </Button>
3549   - ) : (
3550   - ''
3551   - )}
3552   -
3553   - {record.paths?.includes('afterSalesCheck') ? (
3554   - <Button
3555   - className="p-0"
3556   - type="link"
3557   - onClick={() => {
3558   - let selectedSubOrders = subOrderSelectedMap.get(
3559   - record.id,
3560   - );
3561   - setSelectedRows(selectedSubOrders);
3562   - if (selectedSubOrders === undefined) {
3563   - selectedSubOrders = record.subOrderInformationLists;
3564   - }
3565   - for (let i = 0; i < selectedSubOrders.length; i++) {
3566   - if (
3567   - selectedSubOrders[i].orderStatus !==
3568   - 'IN_AFTER_SALES'
3569   - ) {
3570   - message.error('请选择售后中的子订单进行审核');
3571   - return;
3572   - }
3573   - }
3574   -
3575   - createOptObject(null, record.id);
3576   - setCheckVisible(true);
3577   - setOrderCheckType(CHECK_TYPE.AFTER_SALES);
3578   - }}
3579   - >
3580   - 售后审核
3581   - </Button>
3582   - ) : (
3583   - ''
3584   - )}
3585   -
3586   - {record.paths?.includes('noNeedSend') ? (
3587   - <ButtonConfirm
3588   - className="p-0"
3589   - title="此订单是否无需发货?"
3590   - text="无需发货"
3591   - onConfirm={async () => {
3592   - let selectedSubOrders = subOrderSelectedMap.get(
3593   - record.id,
3594   - );
3595   - if (selectedSubOrders === undefined) {
3596   - selectedSubOrders = record.subOrderInformationLists;
3597   - }
3598   - setSelectedRows(selectedSubOrders);
3599   - for (let i = 0; i < selectedSubOrders.length; i++) {
3600   - if (
3601   - selectedSubOrders[i].orderStatus !== 'AUDITED' &&
3602   - selectedSubOrders[i].orderStatus !==
3603   - 'PROCURE_PROCESS' &&
3604   - selectedSubOrders[i].orderStatus !==
3605   - 'PROCURE_PROCESS_FOR_MINE' &&
3606   - selectedSubOrders[i].orderStatus !==
3607   - 'PROCURE_WAIT_SHIP' &&
3608   - selectedSubOrders[i].orderStatus !==
3609   - 'SUPPLIER_WAIT_SHIP' &&
3610   - selectedSubOrders[i].orderStatus !== 'WAIT_SHIP'
3611   - ) {
3612   - message.error(
3613   - '请选择未发货的子订单进行无需发货操作',
3614   - );
3615   - return;
3616   - }
3617   - }
3618   -
3619   - const data = await postServiceOrderNoNeedSend({
3620   - data: {
3621   - ids: selectedSubOrders.map((item) => {
3622   - return item.id;
3623   - }),
3624   - },
3625   - });
3626   - if (data.result === RESPONSE_CODE.SUCCESS) {
3627   - message.success(data.message);
3628   - refreshTable();
3629   - }
3630   - }}
3631   - />
3632   - ) : (
3633   - ''
3634   - )}
3635   -
3636   - {record.paths?.includes('saleCancelInvoicing_old') ? (
3637   - <ButtonConfirm
3638   - className="p-0"
3639   - title="确认取消申请开票?"
3640   - text="取消申请(旧)"
3641   - onConfirm={async () => {
3642   - let selectedSubOrders = subOrderSelectedMap.get(
3643   - record.id,
3644   - );
3645   - if (selectedSubOrders === undefined) {
3646   - selectedSubOrders = record.subOrderInformationLists;
3647   - }
3648   -
3649   - console.log(selectedSubOrders);
3650   - for (let i = 0; i < selectedSubOrders.length; i++) {
3651   - if (
3652   - selectedSubOrders[i].afterInvoicingStatus !==
3653   - 'APPLY_FOR_INVOICING'
3654   - ) {
3655   - message.error(
3656   - '请选择已[申请开票]的子订单进行取消申请',
3657   - );
3658   - return;
3659   - }
3660   - }
3661   - let res = await postServiceOrderSaleCancelInvoicing({
3662   - data: {
3663   - subOrderIds: selectedSubOrders.map((item) => {
3664   - return item.id;
3665   - }),
3666   - },
3667   - });
3668   -
3669   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
3670   - message.success(res.message);
3671   - refreshTable();
3672   - }
3673   - }}
3674   - />
3675   - ) : (
3676   - ''
3677   - )}
3678   - {/* 财务审核:主订单暂无 */}
3679   - {record.paths?.includes('financeCheckOrder') ? (
3680   - <Button
3681   - className="p-0"
3682   - type="link"
3683   - onClick={() => {
3684   - let selectedSubOrders = subOrderSelectedMap.get(
3685   - record.id,
3686   - );
3687   - setSelectedRows(selectedSubOrders);
3688   - if (selectedSubOrders === undefined) {
3689   - selectedSubOrders = record.subOrderInformationLists;
3690   - }
3691   - for (let i = 0; i < selectedSubOrders.length; i++) {
3692   - if (
3693   - selectedSubOrders[i].orderStatus !== 'UNAUDITED' &&
3694   - selectedSubOrders[i].orderStatus !==
3695   - 'FINANCE_PROCESS' &&
3696   - selectedSubOrders[i].orderStatus !==
3697   - 'LEADER_AUDITED'
3698   - ) {
3699   - message.error(
3700   - '请选择[未审核]、[财务待审核]、[领导已审核]的子订单进行审核',
3701   - );
3702   - return;
3703   - }
3704   - }
3705   - createOptObject(null, record.id);
3706   - setCheckVisible(true);
3707   - setOrderCheckType(CHECK_TYPE.FINALCIAL);
3708   - }}
3709   - >
3710   - 财务审核
3711   - </Button>
3712   - ) : (
3713   - ''
3714   - )}
3715   -
3716   - {/* 采购审核 */}
3717   - {record.paths?.includes('procureCheckOrder') ? (
3718   - <Button
3719   - className="p-0"
3720   - type="link"
3721   - onClick={() => {
3722   - let selectedSubOrders = subOrderSelectedMap.get(
3723   - record.id,
3724   - );
3725   - setSelectedRows(selectedSubOrders);
3726   - if (selectedSubOrders === undefined) {
3727   - selectedSubOrders = record.subOrderInformationLists;
3728   - }
3729   - for (let i = 0; i < selectedSubOrders.length; i++) {
3730   - if (
3731   - selectedSubOrders[i].orderStatus !==
3732   - 'PROCURE_UN_PROCESS'
3733   - ) {
3734   - message.error('请选择未审核的子订单进行审核');
3735   - return;
3736   - }
3737   - }
3738   -
3739   - createOptObject(null, record.id);
3740   - setProcureCheckModalVisible(true);
3741   - setOrderCheckType(CHECK_TYPE.PROCURE);
3742   - }}
3743   - >
3744   - 采购审核
3745   - </Button>
3746   - ) : (
3747   - ''
3748   - )}
3749   -
3750   - {record.paths?.includes('applyAfterSales') ? (
3751   - <Button
3752   - className="p-0"
3753   - type="link"
3754   - onClick={() => {
3755   - let selectedSubOrders = subOrderSelectedMap.get(
3756   - record.id,
3757   - );
3758   - if (selectedSubOrders === undefined) {
3759   - selectedSubOrders = record.subOrderInformationLists;
3760   - }
3761   - setSelectedRows(selectedSubOrders);
3762   - for (let i = 0; i < selectedSubOrders.length; i++) {
3763   - if (
3764   - selectedSubOrders[i].orderStatus !==
3765   - 'CONFIRM_RECEIPT' &&
3766   - selectedSubOrders[i].orderStatus !==
3767   - 'AFTER_SALES_FAILURE'
3768   - ) {
3769   - message.error('请选择确认收货状态的子订单进行售后');
3770   - return;
3771   - }
3772   - }
3773   -
3774   - createOptObject(null, record.id);
3775   - setOrderDrawerVisible(true);
3776   - setOrderOptType('after-sales');
3777   - }}
3778   - >
3779   - 申请售后
3780   - </Button>
3781   - ) : (
3782   - ''
3783   - )}
3784   -
3785   - {/* {record.paths?.includes('afterSalesCompletion') ? (
3786   - <ButtonConfirm
3787   - className="p-0"
3788   - title="售后是否已完成?"
3789   - text="完成售后"
3790   - onConfirm={async () => {
3791   - let selectedSubOrders = subOrderSelectedMap.get(record.id);
3792   - if (selectedSubOrders === undefined) {
3793   - selectedSubOrders = record.subOrderInformationLists;
3794   - }
3795   - for (let i = 0; i < selectedSubOrders.length; i++) {
3796   - if (
3797   - selectedSubOrders[i].orderStatus !==
3798   - 'IN_AFTER_SALES'
3799   - ) {
3800   - message.error(
3801   - '请选择售后中状态的子订单进行完成售后',
3802   - );
3803   - return false;
3804   - }
3805   - }
3806   -
3807   - const ids = selectedSubOrders?.map((item) => {
3808   - return item.id;
3809   - });
3810   -
3811   - let body = {
3812   - ids: ids,
3813   - };
3814   - const data = await postServiceOrderAfterSalesCompletion(
3815   - {
3816   - data: body,
3817   - },
3818   - );
3819   - if (data.result === RESPONSE_CODE.SUCCESS) {
3820   - message.success(data.message);
3821   - refreshTable();
3822   - }
3823   - }}
3824   - />
3825   - ) : (
3826   - ''
3827   - )} */}
3828   -
3829   - {record.paths?.includes('salOrderSave') ? (
3830   - <ButtonConfirm
3831   - className="p-0"
3832   - title="是否推送至金蝶ERP?"
3833   - text="推送ERP"
3834   - onConfirm={async () => {
3835   - let res = await postKingdeeRepSalOrderSave({
3836   - data: {
3837   - id: record.id,
3838   - },
3839   - });
3840   -
3841   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
3842   - message.success('推送成功');
3843   - mainTableRef.current.reload();
3844   - }
3845   - }}
3846   - />
3847   - ) : (
3848   - ''
3849   - )}
3850   -
3851   - {record.paths?.includes('salBillOutbound') ? (
3852   - <ButtonConfirm
3853   - className="p-0"
3854   - title="是否下推金蝶ERP出库单?"
3855   - text="下推出库"
3856   - onConfirm={async () => {
3857   - let res = await postKingdeeRepSalBillOutbound({
3858   - data: {
3859   - id: record.id,
3860   - },
3861   - });
3862   -
3863   - if (res && res.result === RESPONSE_CODE.SUCCESS) {
3864   - message.success('下推成功');
3865   - mainTableRef.current.reload();
3866   - }
3867   - }}
3868   - />
3869   - ) : (
3870   - ''
3871   - )}
3872   -
3873   - {record.paths?.includes('orderCancel') ? (
3874   - <ButtonConfirm
3875   - className="p-0"
3876   - title="确认作废?"
3877   - text="作废"
3878   - onConfirm={async () => {
3879   - let body = {
3880   - ids: [record.id],
3881   - checkIsMainOrderId: true,
3882   - };
3883   - const data = await postServiceOrderOrderCancel({
3884   - data: body,
3885   - });
3886   - if (data.result === RESPONSE_CODE.SUCCESS) {
3887   - message.success(data.message);
3888   - refreshTable();
3889   - }
3890   - }}
3891   - />
3892   - ) : (
3893   - ''
3894   - )}
3895   -
3896   - {record.paths?.includes('procurePrint') ? (
3897   - <ButtonConfirm
3898   - className="p-0"
3899   - title="确认打印?"
3900   - text="采购打印"
3901   - onConfirm={async () => {
3902   - let selectedSubOrders = subOrderSelectedMap.get(
3903   - record.id,
3904   - );
3905   - if (selectedSubOrders === undefined) {
3906   - selectedSubOrders = record.subOrderInformationLists;
3907   - }
3908   - for (let i = 0; i < selectedSubOrders.length; i++) {
3909   - if (
3910   - selectedSubOrders[i].orderStatus !==
3911   - 'PROCURE_PROCESS_FOR_MINE'
3912   - ) {
3913   - message.error(
3914   - '请选择采购待打印状态的子订单进行打印',
3915   - );
3916   - return false;
3917   - }
3918   - }
3919   -
3920   - const ids = selectedSubOrders?.map((item) => {
3921   - return item.id;
3922   - });
3923   - let res = await postServiceOrderProcurePrint({
3924   - data: {
3925   - ids: ids,
3926   - },
3927   - });
3928   -
3929   - if (res.result === RESPONSE_CODE.SUCCESS) {
3930   - message.success(res.message);
3931   - refreshTable();
3932   - }
3933   - }}
3934   - />
3935   - ) : (
3936   - // <Button
3937   - // className="p-0"
3938   - // type="link"
3939   - // onClick={() => {
3940   - // if (!subOrderSelectedMap.get(record.id)?.length) {
3941   - // return message.error('请选择选择子订单');
3942   - // }
3943   - // setSelectedRows(subOrderSelectedMap.get(record.id));
3944   - // setOrderRow(record);
3945   - // setOrderPrintVisible(true);
3946   - // setOrderCheckType(CHECK_TYPE.PROCURE);
3947   - // }}
3948   - // >
3949   - // 采购打印
3950   - // </Button>
3951   - ''
3952   - )}
3953   - </Space>
3954   - </Space.Compact>
3955   - </Flex>
3956   - </Flex>
3957   - </Flex>
3958   -
3959   - <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg">
3960   - {expandedRowRender(record)}
3961   - </Flex>
3962   - </Flex>
3963   - );
3964   - };
3965   -
3966   - // 主订单列表
3967   - const mainOrdersColumns: ProColumns<OrderType>[] = MAIN_ORDER_COLUMNS.map(
3968   - (item) => {
3969   - //首能账号只能搜索订单编号
3970   - let canSearchIndex = [
3971   - 'id',
3972   - 'salesCode',
3973   - 'subNotes',
3974   - 'orderStatus',
3975   - 'createTime',
3976   - 'modifiedAuditStatus',
3977   - ];
3978   - if (isSupplier() && !canSearchIndex.includes(item.dataIndex)) {
3979   - item.search = false;
3980   - }
3981   -
3982   - canSearchIndex = [
3983   - 'id',
3984   - 'salesCode',
3985   - 'customerName',
3986   - 'institution',
3987   - 'productName',
3988   - 'orderStatus',
3989   - 'createTime',
3990   - ];
3991   -
3992   - if (isExaminer() && !canSearchIndex.includes(item.dataIndex)) {
3993   - item.search = false;
3994   - }
3995   -
3996   - if (item.dataIndex === 'name') {
3997   - return {
3998   - ...item,
3999   - title: <OrderTableHeader />,
4000   - render: (text, record) => {
4001   - return <MainOrderColumnRender record={record} />;
4002   - },
4003   - };
4004   - }
4005   -
4006   - /**
4007   - * 采购的订单状态筛选内容
4008   - */
4009   - if (roleCode === 'procure' && item.dataIndex === 'orderStatus') {
4010   - item.valueEnum = enumToProTableEnumValue(
4011   - PROCURE_PRIMARY_ORDER_STATUS_OPTIONS,
4012   - );
4013   - }
4014   - return item;
4015   - },
4016   - );
4017   -
4018   - /**
4019   - * 采购可以筛选供应商备注
4020   - */
4021   - if ((roleCode === 'procure' || roleCode === 'admin') && !isSupplier()) {
4022   - mainOrdersColumns.push({
4023   - title: '供应商备注',
4024   - width: 120,
4025   - dataIndex: 'supplierNotes',
4026   - valueType: 'text',
4027   - hideInTable: true,
4028   - });
4029   - }
4030   -
4031   - /**
4032   - * 采购可以筛选其他采购
4033   - */
4034   - if ((roleCode === 'procure' || roleCode === 'admin') && !isSupplier()) {
4035   - mainOrdersColumns.push({
4036   - title: '采购名称',
4037   - width: 120,
4038   - dataIndex: 'supplierName',
4039   - valueType: 'select',
4040   - request: async () => {
4041   - const res = await postServiceOrderProvideProcurementRoles();
4042   - let options = res.data?.map((item) => {
4043   - return { label: item, value: item };
4044   - });
4045   - return options;
4046   - },
4047   - hideInTable: true,
4048   - });
4049   - }
4050   -
4051   - /**
4052   - * 排除采购
4053   - */
4054   - if ((roleCode === 'procure' || roleCode === 'admin') && !isSupplier()) {
4055   - mainOrdersColumns.push({
4056   - title: '采购排除',
4057   - width: 120,
4058   - dataIndex: 'excludeProcureNames',
4059   - fieldProps: {
4060   - mode: 'multiple',
4061   - },
4062   - valueType: 'select',
4063   - request: async () => {
4064   - const res = await postServiceOrderProvideProcurementRoles();
4065   - let options = res.data?.map((item) => {
4066   - return { label: item, value: item };
4067   - });
4068   - return options;
4069   - },
4070   - hideInTable: true,
4071   - });
4072   - }
4073   -
4074   - /**
4075   - * 仓库可以筛选发货仓库
4076   - */
4077   - if (roleCode === 'warehouseKeeper' || roleCode === 'admin') {
4078   - mainOrdersColumns.push({
4079   - title: '发货仓库',
4080   - width: 120,
4081   - dataIndex: 'shippingWarehouse',
4082   - valueType: 'select',
4083   - valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS),
4084   - hideInTable: true,
4085   - });
4086   - }
4087   -
4088   - //判断是否是采购,是的话新增一个筛选条件
4089   - if (roleCode === 'procure' || roleCode === 'admin') {
4090   - mainOrdersColumns.push({
4091   - title: isSupplier() ? '下单状态' : '采购下单状态',
4092   - dataIndex: 'procureOrderStatus',
4093   - valueType: 'select',
4094   - hideInTable: true,
4095   - valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS),
4096   - });
4097   - }
4098   -
4099   - function toolBarRender() {
4100   - let toolBtns = [];
4101   - let radios: any[] = [];
4102   -
4103   - radios.push(<Radio value={0}>全部</Radio>);
4104   -
4105   - if (
4106   - roleCode === 'admin' ||
4107   - roleCode === 'salesManager' ||
4108   - roleCode === 'salesRepresentative'
4109   - ) {
4110   - radios.push(<Radio value={70}>只看作废</Radio>);
4111   - }
4112   -
4113   - if (roleCode === 'warehouseKeeper') {
4114   - radios.push(<Radio value={40}>待处理</Radio>);
4115   - }
4116   -
4117   - //采购可以筛选出需要处理的订单
4118   - if (roleCode === 'procure' && !isSupplier()) {
4119   - radios.push(<Radio value={60}>其他采购</Radio>);
4120   - radios.push(<Radio value={10}>待处理</Radio>);
4121   - }
4122   -
4123   - //财务可以将需要处理的订单排序到前面
4124   - if (roleCode === 'finance') {
4125   - radios.push(<Radio value={50}>加急</Radio>);
4126   -
4127   - radios.push(<Radio value={40}>待处理</Radio>);
4128   -
4129   - radios.push(<Checkbox onChange={financeSorted}>排序</Checkbox>);
4130   - }
4131   -
4132   - if (roleCode === 'salesRepresentative' || roleCode === 'salesManager') {
4133   - radios.push(<Radio value={30}>只看我创建</Radio>);
4134   -
4135   - radios.push(<Radio value={40}>待审核</Radio>);
4136   - }
4137   -
4138   - if (roleCode === 'admin') {
4139   - radios.push(<Radio value={10}>待处理</Radio>);
4140   - radios.push(<Checkbox onChange={financeSorted}>排序</Checkbox>);
4141   - }
4142   -
4143   - //筛选按钮配置
4144   - let radioGroup = (
4145   - <Radio.Group
4146   - onChange={(e: any) => {
4147   - setFilterCondition(e.target.value);
4148   - refreshTable();
4149   - }}
4150   - defaultValue={0}
4151   - >
4152   - {radios}
4153   - </Radio.Group>
4154   - );
4155   -
4156   - toolBtns.push(radioGroup);
4157   -
4158   - toolBtns.push(<ImportExpressBillModal></ImportExpressBillModal>);
4159   -
4160   - //导出按钮配置
4161   - const exportItems: MenuProps['items'] = [
4162   - {
4163   - label: '导出查询结果订单',
4164   - key: '2',
4165   - onClick: async () => {
4166   - let body = { flag: 50, ...searchParams };
4167   - exportLoading();
4168   - orderExport(
4169   - '/api/service/order/export',
4170   - '订单导出结果.xls',
4171   - 'POST',
4172   - body,
4173   - exportLoadingDestory,
4174   - );
4175   - },
4176   - },
4177   - {
4178   - label: '导出已选中订单',
4179   - key: '1',
4180   - onClick: async () => {
4181   - if (mainOrderSelectedMap.size === 0) {
4182   - message.error('请选择订单');
4183   - return;
4184   - }
4185   - let body = { flag: 30, id: Array.from(mainOrderSelectedMap.keys()) };
4186   - exportLoading();
4187   - orderExport(
4188   - '/api/service/order/export',
4189   - '订单导出结果.xls',
4190   - 'POST',
4191   - body,
4192   - exportLoadingDestory,
4193   - );
4194   - },
4195   - },
4196   - {
4197   - label: '导出当天订单',
4198   - key: '4',
4199   - onClick: async () => {
4200   - let body = { flag: 40, ids: [] };
4201   - exportLoading();
4202   - orderExport(
4203   - '/api/service/order/export',
4204   - '订单导出结果.xls',
4205   - 'POST',
4206   - body,
4207   - exportLoadingDestory,
4208   - );
4209   - },
4210   - },
4211   - {
4212   - label: '导出所有订单',
4213   - key: '3',
4214   - onClick: async () => {
4215   - let body = { flag: 10, ids: [] };
4216   - exportLoading();
4217   - orderExport(
4218   - '/api/service/order/export',
4219   - '订单导出结果.xls',
4220   - 'POST',
4221   - body,
4222   - exportLoadingDestory,
4223   - );
4224   - },
4225   - },
4226   - ];
4227   -
4228   - const exportMenuProps = {
4229   - items: exportItems,
4230   - onClick: () => { },
4231   - };
4232   -
4233   - //导出按钮配置
4234   - const auditItems: MenuProps['items'] = [
4235   - {
4236   - label: '后置审核',
4237   - key: '1',
4238   - onClick: async () => {
4239   - setIsMainOrder(true);
4240   - setCheckVisible(true);
4241   - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT);
4242   - },
4243   - },
4244   - {
4245   - label: '加急开票审核(旧)',
4246   - key: '2',
4247   - disabled: true,
4248   - onClick: async () => {
4249   - setIsMainOrder(true);
4250   - setCheckVisible(true);
4251   - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD);
4252   - },
4253   - },
4254   - {
4255   - label: '领导审核',
4256   - key: '3',
4257   - onClick: async () => {
4258   - setIsMainOrder(true);
4259   - setCheckVisible(true);
4260   - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT);
4261   - },
4262   - },
4263   - {
4264   - label: '修改申请审核',
4265   - key: '4',
4266   - onClick: async () => {
4267   - setIsMainOrder(true);
4268   - setCheckVisible(true);
4269   - setOrderCheckType(CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT);
4270   - },
4271   - },
4272   - ];
4273   -
4274   - const auditProps = {
4275   - items: auditItems,
4276   - onClick: () => { },
4277   - };
4278   -
4279   - if (rolePath?.includes('leaderMergeAudit')) {
4280   - toolBtns.push(
4281   - <Dropdown
4282   - disabled={selectedSubOrderKeys.length === 0}
4283   - menu={auditProps}
4284   - >
4285   - <Button>
4286   - <Space>
4287   - 一键审核
4288   - <DownOutlined />
4289   - </Space>
4290   - </Button>
4291   - </Dropdown>,
4292   - );
4293   - }
4294   -
4295   - if (rolePath?.includes('mergeAudit')) {
4296   - toolBtns.push(
4297   - <Button
4298   - type="primary"
4299   - key="out"
4300   - onClick={() => {
4301   - setIsMainOrder(true);
4302   - if (roleCode === 'procure') {
4303   - setProcureCheckModalVisible(true);
4304   - }
4305   -
4306   - if (roleCode === 'warehouseKeeper') {
4307   - setCheckVisible(true);
4308   - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER);
4309   - }
4310   - }}
4311   - disabled={selectedSubOrderKeys?.length === 0}
4312   - >
4313   - 一键审核
4314   - </Button>,
4315   - );
4316   - }
4317   -
4318   - if (rolePath?.includes('mergeProcureOrder')) {
4319   - toolBtns.push(
4320   - <Button
4321   - key="mergeProcureOrder"
4322   - type="primary"
4323   - disabled={selectedSubOrderKeys.length === 0}
4324   - onClick={() => {
4325   - Modal.confirm({
4326   - title: '一键下单',
4327   - content: '选中的订单是否都已下单?',
4328   - onOk: async () => {
4329   - let res = await postServiceOrderProcureOrder({
4330   - data: { subIds: [...selectedSubOrderKeys.values()].flat() },
4331   - });
4332   - if (res.result === RESPONSE_CODE.SUCCESS) {
4333   - message.success(res.message);
4334   - refreshTable();
4335   - return true;
4336   - }
4337   - },
4338   - });
4339   - }}
4340   - >
4341   - 一键下单
4342   - </Button>,
4343   - );
4344   - }
4345   -
4346   - if (rolePath?.includes('mergeApplyInvoicing')) {
4347   - toolBtns.push(
4348   - <Button
4349   - type="primary"
4350   - key="out"
4351   - onClick={() => {
4352   - setIsEdit(false);
4353   - setIsMainOrder(true);
4354   - setApplyForInvoicingVisible(true);
4355   - }}
4356   - disabled={!canMergeInvoicing} /*{selectedSubOrderKeys?.length === 0}*/
4357   - >
4358   - {roleCode === 'admin' ? '合并(销售)' : '合并开票'}
4359   - </Button>,
4360   - );
4361   - }
4362   -
4363   - <Button
4364   - type="primary"
4365   - key="out"
4366   - onClick={() => {
4367   - setIsEdit(false);
4368   - setIsMainOrder(true);
4369   - setInvoicingDrawerFormVisible(true);
4370   - }}
4371   - disabled={selectedSubOrderKeys?.length === 0}
4372   - >
4373   - 申请开票(旧)
4374   - </Button>;
4375   -
4376   - if (rolePath?.includes('mergeInvoicing')) {
4377   - toolBtns.push(
4378   - <Button
4379   - type="primary"
4380   - key="out"
4381   - onClick={() => {
4382   - //检查订单状态是否正确
4383   - // 遍历Map中的键值对
4384   - let errorIds = new Set();
4385   - [...subOrderSelectedMap.values()].flat().forEach((subOrder) => {
4386   - if (
4387   - subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING' &&
4388   - subOrder.afterInvoicingStatus !== 'PARTIAL_INVOICING'
4389   - ) {
4390   - errorIds.add(subOrder.mainOrderId);
4391   - return;
4392   - }
4393   - });
4394   - if (errorIds.size > 0) {
4395   - message.error(
4396   - '订单号为:' +
4397   - [...errorIds.values()].join(',') +
4398   - '的订单存在不是[申请开票]或者[部分开票]状态的子订单,请检查!',
4399   - );
4400   - return;
4401   - }
4402   - setIsMainOrder(true);
4403   - setFinancialVisible(true);
4404   - }}
4405   - disabled={selectedSubOrderKeys?.length === 0}
4406   - >
4407   - {roleCode === 'admin' ? '合并(财务)' : '合并开票'}
4408   - </Button>,
4409   - );
4410   - }
4411   -
4412   - toolBtns.push(
4413   - <Button
4414   - type="primary"
4415   - key="inv"
4416   - onClick={() => {
4417   - setIsMainOrder(true);
4418   - let flat = [...subOrderSelectedMap.values()].flat();
4419   - //遍历flat,判断afterInvoicingStatusList存在于canApplyAfterInvoicingStatus
4420   - flat.forEach((item) => {
4421   - if (
4422   - item.invoicingStatus === 'UN_INVOICE' ||
4423   - (item.afterInvoicingStatus !== null &&
4424   - !canApplyAfterInvoicingStatus.includes(
4425   - item.afterInvoicingStatus,
4426   - ))
4427   - ) {
4428   - message.error('存在不能进行开票的订单');
4429   - return;
4430   - }
4431   - });
4432   - //遍历afterInvoicingStatusList
4433   - setInvoicingDrawerFormVisible(true);
4434   - }}
4435   - disabled={selectedSubOrderKeys?.length === 0}
4436   - >
4437   - 申请开票
4438   - </Button>,
4439   - );
4440   -
4441   - if (rolePath?.includes('addOrder')) {
4442   - toolBtns.push(
4443   - <Button
4444   - type="primary"
4445   - key="out"
4446   - onClick={() => {
4447   - setOrderDrawerVisible(true);
4448   - setOrderOptType('add');
4449   - }}
4450   - >
4451   - 新增
4452   - </Button>,
4453   - );
4454   - }
4455   -
4456   - if (rolePath?.includes('importExcel')) {
4457   - toolBtns.push(
4458   - <Button
4459   - type="primary"
4460   - key="out"
4461   - onClick={() => {
4462   - setImportModalVisible(true);
4463   - }}
4464   - >
4465   - 批量发货
4466   - </Button>,
4467   - );
4468   - }
4469   -
4470   - if (rolePath?.includes('export')) {
4471   - toolBtns.push(
4472   - <Dropdown menu={exportMenuProps}>
4473   - <Button>
4474   - <Space>
4475   - 导出
4476   - <DownOutlined />
4477   - </Space>
4478   - </Button>
4479   - </Dropdown>,
4480   - );
4481   - }
4482   -
4483   - return toolBtns;
4484   - }
4485   - //选择天数1
4486   - const options1 = [
4487   - {
4488   - label: '超过15天',
4489   - value: 15,
4490   - },
4491   - {
4492   - label: '超过25天',
4493   - value: 25,
4494   - },
4495   - ];
4496   - //选择天数
4497   - const [calDate, setCalDate] = useState<string | null>(null);
4498   - const [value1, setValue1] = useState();
4499   - const radioOnChange1 = ({ target: { value } }) => {
4500   - console.log('radio1 checked5656', value);
4501   - const currentDate = new Date();
4502   -
4503   - // 创建一个新的日期对象,并在当前日期的基础上加上 daysToAdd 天
4504   - const newDate = new Date(currentDate);
4505   - newDate.setDate(currentDate.getDate() + value);
4506   - const formattedDate = format(newDate, 'yyyy-MM-dd HH:mm:ss');
4507   - console.log(formattedDate, '5656newdate');
4508   - setCalDate(formattedDate);
4509   - setValue1(value);
4510   - };
4511   - //选择天数2
4512   - const options2 = [
4513   - {
4514   - label: '超过15天',
4515   - value: 15,
4516   - },
4517   - {
4518   - label: '超过25天',
4519   - value: 25,
4520   - },
4521   - ];
4522   - const [value2, setValue2] = useState();
4523   - const radioOnChange2 = ({ target: { value } }) => {
4524   - console.log('radio2 checked5656', value);
4525   - setValue2(value);
4526   - };
4527   - const confirmInvoice = () => {
4528   - console.log('5656confirm');
4529   - }
4530   - const [invoiceWarningNum, setInvoiceWarningNum] = useState(1);
4531   - const [invoiceRefundWarningNum, setInvoiceRefundWarningNum] = useState(1);
4532   - async function getInvoiceWarningNum() {
4533   - const res = await postServiceOrderWarningOrderStatistics();
4534   - setInvoiceWarningNum(res.data.waitConfirmInvoice);
4535   - setInvoiceRefundWarningNum(res.data.waitConfirmReceipt);
4536   - }
4537   -
4538   - useEffect(() => {
4539   - //预警订单数
4540   - getInvoiceWarningNum();
4541   - }, []);
4542   - const tabsItems = [
4543   - {
4544   - key: 1,
4545   - label: (
4546   - <span>
4547   - 发票确认预警
4548   - <Badge count={invoiceWarningNum} style={{ marginLeft: 8 }} />
4549   - </span>
4550   - ),
4551   - children: (
4552   - <div>
4553   - <div style={{ position: 'relative' }}>
4554   - <Radio.Group options={options1} onChange={radioOnChange1} value={value1} />
4555   - <Button
4556   - size='large'
4557   - type="primary"
4558   - onClick={confirmInvoice}
4559   - style={{ position: 'absolute', right: '20px' }}
4560   - >
4561   - 确认开票
4562   - </Button>
4563   - </div>
4564   - <div style={{ height: '25px' }}></div>
4565   - <ProTable
4566   - id="main-table"
4567   - // tableStyle={{backgroundColor:'red'}}
4568   -
4569   - actionRef={mainTableRef}
4570   - formRef={mainTableFormRef}
4571   - expandIconColumnIndex={-1}
4572   - columns={mainOrdersColumns}
4573   - rowKey="id"
4574   - pagination={{
4575   - showQuickJumper: true,
4576   - pageSize: pageSize,
4577   - current: currentPage,
4578   - showSizeChanger: true,
4579   - onChange: (page, size) => {
4580   - setPageSize(size);
4581   - setCurrentPage(page);
4582   - },
4583   - showTotal: (total, range) => {
4584   - return (
4585   - <>
4586   - <span>
4587   - {'第 ' +
4588   - range[0] +
4589   - '-' +
4590   - range[1] +
4591   - ' 条/总共 ' +
4592   - total +
4593   - ' 条主订单 '}
4594   - </span>
4595   - <span className="text-[#8C8C8C]">
4596   - {' (' + subOrderCount + ' 条子订单)'}
4597   - </span>
4598   - </>
4599   - );
4600   - },
4601   - }}
4602   - // showHeader={false}
4603   - expandedRowKeys={expandedRowKeys}
4604   - // expandable={{ expandedRowRender }}
4605   - dateFormatter="string"
4606   - options={false}
4607   - headerTitle=""
4608   - search={false}
4609   - // labelWidth: 'auto',
4610   - // onCollapse: resize,
4611   - request={
4612   - async (
4613   - // 第一个参数 params 查询表单和 params 参数的结合
4614   - // 第一个参数中一定会有 pageSize 和 current ,这两个参数是 antd 的规范
4615   - params,
4616   - sorter,
4617   - filter,
4618   - ) => {
4619   - //订单id处理
4620   - /**
4621   - * 以params中的id为主,如果params没id,则取url中的id
4622   - * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来
4623   - */
4624   - let orderIds = mainTableFormRef.current?.getFieldValue('id');
4625   - let subOrderId =
4626   - mainTableFormRef.current?.getFieldValue('subOrderId');
4627   - params.id = params.id || orderIds;
4628   - params.subOrderId = params.subOrderId || subOrderId;
4629   - if (params.id !== '') {
4630   - params.id = params.id?.replace(/ /g, '');
4631   - if (params.id?.indexOf(',')) {
4632   - params.id = params.id.split(',');
4633   - params.id = params.id.filter((id) => {
4634   - return id !== '';
4635   - });
4636   - }
4637   - }
4638   -
4639   - params.condition = filterCondifion;
4640   -
4641   - //排序
4642   - params.sorted = sorted;
4643   - //是否只查看已作废
4644   - params.isDeleteQueryOrder = filterCondifion === 70;
4645   - //保存这个搜索条件
4646   - params.orderStatus = 'CONFIRM_RECEIPT';
4647   - params.invoicingStatus = 'UN_INVOICE';
4648   - params.statusDatetimeGe = calDate;
4649   - console.log(params, '5656finalparams');
4650   - setSearchParam(params);
4651   - //订单标记1
4652   - const { data } = await postServiceOrderQueryServiceOrder({
4653   - // ...params,
4654   - // FIXME: remove @ts-ignore
4655   - // @ts-ignore
4656   - sorter,
4657   - filter,
4658   - data: { ...params },
4659   - });
4660   -
4661   - setRolePath(data.specialPath);
4662   - setSubOrderCount(data.count);
4663   - setAllMainChecked(false);
4664   - setSelectedMainOrderKeys([]);
4665   - subOrderSelectedMap.clear();
4666   - mainOrderSelectedMap.clear();
4667   - setData(data?.data);
4668   -
4669   - //主订单id与子订单id的对照关系保存
4670   - mainOrderIdSubOrderIdRelationsMap.clear();
4671   - for (let row of data?.data) {
4672   - let mianOrderId = row.id;
4673   - let subOrderIds = row.subOrderInformationLists?.map((item) => {
4674   - //目前子订单存储的totalPayment不准确,这里重新处理取主订单的totalPayment
4675   - //totalPayment在财务开票计算金额时使用到
4676   - item.totalPayment = row.totalPayment;
4677   - return item.id;
4678   - });
4679   - mainOrderIdSubOrderIdRelationsMap.set(mianOrderId, subOrderIds);
4680   - }
4681   -
4682   - return {
4683   - data: data?.data || [],
4684   - total: data?.total || 0,
4685   - };
4686   - }}
4687   - toolbar={{
4688   - multipleLine: true,
4689   - }}
4690   - // toolBarRender={() => {
4691   - // return toolBarRender();
4692   - // }}
4693   - />
4694   -
4695   - {orderDrawerVisible && (
4696   - <OrderDrawer
4697   - data={orderOptType === 'add' ? {} : buildMainOrder()}
4698   - subOrders={orderOptType === 'add' ? [] : buildSubOrders()}
4699   - onClose={(isSuccess: boolean) => {
4700   - setOrderDrawerVisible(false);
4701   - clearOptObject();
4702   - if (isSuccess) {
4703   - refreshTable();
4704   - }
4705   - }}
4706   - orderOptType={orderOptType}
4707   - />
4708   - )}
4709   -
4710   - {checkVisible && (
4711   - <CheckModal
4712   - setCheckVisible={(val: boolean) => {
4713   - setCheckVisible(val);
4714   - if (!val) {
4715   - clearOptObject();
4716   - }
4717   - }}
4718   - data={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
4719   - subOrders={
4720   - isMainOrder
4721   - ? [...subOrderSelectedMap.values()].flat()
4722   - : buildSubOrders()
4723   - }
4724   - orderCheckType={orderCheckType}
4725   - openOrderDrawer={(type: any, id: any) => {
4726   - setCurrentMainId(id);
4727   - setOrderOptType(type);
4728   - setOrderDrawerVisible(true);
4729   - }}
4730   - onClose={() => {
4731   - clearOptObject();
4732   - setCheckVisible(false);
4733   - refreshTable();
4734   - }}
4735   - />
4736   - )}
4737   -
4738   - {applyForInvoicingVisible && (
4739   - <ApplyForInvoicingModal
4740   - setCheckVisible={(val: boolean) => {
4741   - setApplyForInvoicingVisible(val);
4742   - if (!val) {
4743   - clearOptObject();
4744   - }
4745   - }}
4746   - subOrders={
4747   - isMainOrder
4748   - ? [...subOrderSelectedMap.values()].flat()
4749   - : buildSubOrders()
4750   - }
4751   - totalPayment={getApplyInvoicingTotalPayment()}
4752   - isMainOrder={isMainOrder}
4753   - isEdit={isEdit}
4754   - onClose={() => {
4755   - setApplyForInvoicingVisible(false);
4756   - setIsMainOrder(false);
4757   - clearOptObject();
4758   - refreshTable();
4759   - }}
4760   - />
4761   - )}
4762   -
4763   - {notesEditVisible && (
4764   - <OrderNotesEditModal
4765   - setNotesEditVisible={(val: boolean) => {
4766   - setNotesEditVisible(val);
4767   - if (!val) {
4768   - clearOptObject();
4769   - }
4770   - }}
4771   - ids={selectedRows}
4772   - notesType={notesType}
4773   - notes={notes}
4774   - onClose={() => {
4775   - setNotesEditVisible(false);
4776   - setSelectedRows([]);
4777   - setNotes(notes);
4778   - setNotesType(1);
4779   - refreshTable();
4780   - }}
4781   - />
4782   - )}
4783   -
4784   - {deliverVisible && (
4785   - <DeliverModal
4786   - data={buildSubOrders()}
4787   - isSendProduct={isSendProduct}
4788   - setVisible={(val: boolean) => {
4789   - setDeliverVisible(val);
4790   - if (!val) {
4791   - clearOptObject();
4792   - }
4793   - }}
4794   - sendType={orderCheckType}
4795   - onClose={() => {
4796   - clearOptObject();
4797   - setDeliverVisible(false);
4798   - setIsSendProduct(false);
4799   - refreshTable();
4800   - }}
4801   - />
4802   - )}
4803   -
4804   - {financialVisible && (
4805   - <FinancialDrawer
4806   - isEdit={isEdit}
4807   - mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
4808   - subOrders={
4809   - isMainOrder
4810   - ? [...subOrderSelectedMap.values()].flat()
4811   - : buildSubOrders()
4812   - }
4813   - isMainOrder={isMainOrder}
4814   - cancel={() => {
4815   - setFinancialVisible(false);
4816   - clearOptObject();
4817   - setIsMainOrder(false);
4818   - setIsEdit(false);
4819   - }}
4820   - onClose={() => {
4821   - setFinancialVisible(false);
4822   - clearOptObject();
4823   - refreshTable();
4824   - setIsMainOrder(false);
4825   - setIsEdit(false);
4826   - }}
4827   - />
4828   - )}
4829   -
4830   - {financialEditVisible && (
4831   - <FinancialEditDrawer
4832   - mainOrder={buildMainOrder()}
4833   - subOrders={buildSubOrders()}
4834   - isMainOrder={isMainOrder}
4835   - setVisible={() => {
4836   - setFinancialEditVisible(false);
4837   - clearOptObject();
4838   - }}
4839   - onClose={() => {
4840   - setFinancialEditVisible(false);
4841   - refreshTable();
4842   - setIsMainOrder(false);
4843   - clearOptObject();
4844   - }}
4845   - />
4846   - )}
4847   -
4848   - {orderPrintVisible && (
4849   - <OrderPrintModal
4850   - mainOrder={buildMainOrder()}
4851   - subOrders={buildSubOrders()}
4852   - isRePrint={isRePrintOrder}
4853   - setVisible={(val: boolean) => {
4854   - setOrderPrintVisible(val);
4855   - if (!val) {
4856   - clearOptObject();
4857   - }
4858   - }}
4859   - printOptType={orderCheckType}
4860   - onClose={() => {
4861   - setOrderPrintVisible(false);
4862   - clearOptObject();
4863   - setIsRePrintOrder(false);
4864   - refreshTable();
4865   - }}
4866   - />
4867   - )}
4868   -
4869   - {confirmReceiptVisible && (
4870   - <ConfirmReceiptModal
4871   - data={buildSubOrders()}
4872   - onClose={() => {
4873   - setConfirmReceiptVisible(false);
4874   - clearOptObject();
4875   - refreshTable();
4876   - }}
4877   - />
4878   - )}
4879   -
4880   - {imagesViewerModalVisible && (
4881   - <ImagesViewerModal
4882   - optType={imagesViewerOptType}
4883   - setVisible={(val: boolean) => {
4884   - setImagesViewerModalVisible(val);
4885   - if (!val) {
4886   - clearOptObject();
4887   - }
4888   - }}
4889   - onClose={() => {
4890   - setImagesViewerModalVisible(false);
4891   - }}
4892   - orderRow={buildSubOrders()[0]}
4893   - />
4894   - )}
4895   -
4896   - {importModalVisible && (
4897   - <ImportModal
4898   - onClose={() => {
4899   - setImportModalVisible(false);
4900   - refreshTable();
4901   - }}
4902   - />
4903   - )}
4904   -
4905   - {attachmentModalVisible && (
4906   - <AttachmentModal
4907   - data={buildSubOrders()[0]}
4908   - onClose={() => {
4909   - setAttachmentModalVisible(false);
4910   - clearOptObject();
4911   - }}
4912   - />
4913   - )}
4914   -
4915   - {historyModalVisible && (
4916   - <HistoryModal
4917   - subOrders={selectedRows}
4918   - isCancelledOrder={filterCondifion === 70}
4919   - onClose={() => {
4920   - setHistoryModalVisible(false);
4921   - setSelectedRows({});
4922   - clearOptObject();
4923   - }}
4924   - />
4925   - )}
4926   -
4927   - {deliverInfoDrawerVisible && (
4928   - <DeliverInfoDrawer
4929   - data={buildMainOrder()}
4930   - onClose={() => {
4931   - setDeliverInfoDrawerVisible(false);
4932   - clearOptObject();
4933   - }}
4934   - />
4935   - )}
4936   -
4937   - {deliverInfoDrawerVisible && (
4938   - <DeliverInfoDrawer
4939   - data={buildMainOrder()}
4940   - onClose={() => {
4941   - setDeliverInfoDrawerVisible(false);
4942   - clearOptObject();
4943   - }}
4944   - />
4945   - )}
4946   -
4947   - {procureCheckModalVisible && (
4948   - <ProcureCheckModal
4949   - setCheckVisible={(val: boolean) => {
4950   - setProcureCheckModalVisible(val);
4951   - if (!val) {
4952   - clearOptObject();
4953   - }
4954   - }}
4955   - isMainOrder={isMainOrder}
4956   - orders={
4957   - isMainOrder
4958   - ? [...subOrderSelectedMap.values()].flat()
4959   - : buildSubOrders()
4960   - }
4961   - onClose={() => {
4962   - setProcureCheckModalVisible(false);
4963   - clearOptObject();
4964   - setIsMainOrder(false);
4965   - refreshTable();
4966   - }}
4967   - />
4968   - )}
4969   -
4970   - {afterSalesDrawerVisible && (
4971   - <AfterSalesDrawer
4972   - setVisible={(val: boolean) => {
4973   - setAfterSalesDrawerVisible(val);
4974   - if (!val) {
4975   - clearOptObject();
4976   - }
4977   - }}
4978   - mainOrder={buildMainOrder()}
4979   - subOrders={buildSubOrders()}
4980   - onClose={() => {
4981   - setAfterSalesDrawerVisible(false);
4982   - clearOptObject();
4983   - refreshTable();
4984   - }}
4985   - />
4986   - )}
4987   -
4988   - {procureConvertModalVisible && (
4989   - <ProcureConvertModal
4990   - setVisible={(val: boolean) => {
4991   - setProcureConvertModalVisible(val);
4992   - if (!val) {
4993   - clearOptObject();
4994   - }
4995   - }}
4996   - subOrders={buildSubOrders()}
4997   - onClose={() => {
4998   - setProcureConvertModalVisible(false);
4999   - clearOptObject();
5000   - refreshTable();
5001   - }}
5002   - />
5003   - )}
5004   -
5005   - {financialMergeDrawerVisible && (
5006   - <FinancialMergeDrawer
5007   - setVisible={(val: boolean) => {
5008   - setFinancialMergeDrawerVisible(val);
5009   - if (!val) {
5010   - clearOptObject();
5011   - }
5012   - }}
5013   - dataList={
5014   - isMainOrder
5015   - ? [...subOrderSelectedMap.values()].flat()
5016   - : buildSubOrders()
5017   - }
5018   - onClose={() => {
5019   - setFinancialMergeDrawerVisible(false);
5020   - setIsMainOrder(false);
5021   - clearOptObject();
5022   - refreshTable();
5023   - }}
5024   - />
5025   - )}
5026   -
5027   - {financialReceiptsModalVisible && (
5028   - <FinancialReceiptsModal
5029   - setVisible={(val: boolean) => {
5030   - setFinancialReceiptsModalVisible(val);
5031   - if (!val) {
5032   - clearOptObject();
5033   - }
5034   - }}
5035   - datas={selectedRows}
5036   - onClose={() => {
5037   - setFinancialReceiptsModalVisible(false);
5038   - setSelectedRows({});
5039   - refreshTable();
5040   - }}
5041   - />
5042   - )}
5043   -
5044   - {shippingWarehouseChangeModalVisible && (
5045   - <ShippingWarehouseChangeModal
5046   - setVisible={(val: boolean) => {
5047   - setShippingWarehouseChangeModalVisible(val);
5048   - if (!val) {
5049   - clearOptObject();
5050   - }
5051   - }}
5052   - subOrderIds={ids}
5053   - originShippingWarehouse={buildSubOrders()[0].shippingWarehouse}
5054   - onClose={() => {
5055   - setShippingWarehouseChangeModalVisible(false);
5056   - clearOptObject();
5057   - setIds([]);
5058   - refreshTable();
5059   - }}
5060   - />
5061   - )}
5062   - {reissueVisible && (
5063   - <ReissueModal
5064   - setVisible={(val: boolean) => {
5065   - setReissueVisible(val);
5066   - if (!val) {
5067   - clearOptObject();
5068   - }
5069   - }}
5070   - subOrders={
5071   - isMainOrder
5072   - ? [...subOrderSelectedMap.values()].flat()
5073   - : buildSubOrders()
5074   - }
5075   - onClose={() => {
5076   - setReissueVisible(false);
5077   - clearOptObject();
5078   - refreshTable();
5079   - }}
5080   - />
5081   - )}
5082   - {reissueVisibleOld && (
5083   - <ReissueModal_old
5084   - setVisible={(val: boolean) => {
5085   - setReissueVisibleOld(val);
5086   - console.log(reissueVisible);
5087   - if (!val) {
5088   - clearOptObject();
5089   - }
5090   - }}
5091   - mainOrder={buildMainOrder()}
5092   - subOrders={buildSubOrders()}
5093   - onClose={() => {
5094   - setReissueVisibleOld(false);
5095   - clearOptObject();
5096   - refreshTable();
5097   - }}
5098   - />
5099   - )}
5100   - {productionTimeModalVisible && (
5101   - <ProductionTimeModal
5102   - setVisible={(val: boolean) => {
5103   - setProductionTimeModalVisible(val);
5104   - if (!val) {
5105   - clearOptObject();
5106   - }
5107   - }}
5108   - subOrders={buildSubOrders()}
5109   - onClose={() => {
5110   - setProductionTimeModalVisible(false);
5111   - clearOptObject();
5112   - refreshTable();
5113   - }}
5114   - />
5115   - )}
5116   -
5117   - {modifiedDiffModalVisible && (
5118   - <ModifiedDiffModal
5119   - setVisible={(val: boolean) => {
5120   - setModifiedDiffModalVisible(val);
5121   - if (!val) {
5122   - clearOptObject();
5123   - }
5124   - }}
5125   - subOrders={buildSubOrders()}
5126   - mainOrder={buildMainOrder()}
5127   - onClose={() => {
5128   - setModifiedDiffModalVisible(false);
5129   - clearOptObject();
5130   - }}
5131   - />
5132   - )}
5133   -
5134   - {uploadPayBillModalVisible && (
5135   - <UploadPayBillModal
5136   - setVisible={(val: boolean) => {
5137   - setUploadPayBillModalVisible(val);
5138   - if (!val) {
5139   - clearOptObject();
5140   - }
5141   - }}
5142   - subOrders={buildSubOrders()}
5143   - mainOrder={buildMainOrder()}
5144   - onClose={() => {
5145   - setUploadPayBillModalVisible(false);
5146   - clearOptObject();
5147   - refreshTable();
5148   - }}
5149   - />
5150   - )}
5151   - {invoicingDrawerFormVisible && (
5152   - <InvoicingDrawerForm
5153   - dataList={
5154   - isMainOrder
5155   - ? [...subOrderSelectedMap.values()].flat()
5156   - : buildSubOrders()
5157   - }
5158   - setVisible={(val: boolean) => {
5159   - setInvoicingDrawerFormVisible(val);
5160   - if (!val) {
5161   - clearOptObject();
5162   - }
5163   - }}
5164   - mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
5165   - onClose={() => {
5166   - setInvoicingDrawerFormVisible(false);
5167   - setIsMainOrder(true);
5168   - clearOptObject();
5169   - refreshTable();
5170   - }}
5171   - />
5172   - )}
5173   - {contextHolder}
5174   - <FloatButton.BackTop visibilityHeight={0} />
5175   - </div>
5176   - )
5177   - },
5178   - {
5179   - key: 2,
5180   - label: (
5181   - <span>
5182   - 订单回款预警
5183   - <Badge count={invoiceRefundWarningNum} style={{ marginLeft: 8 }} />
5184   - </span>
5185   - ),
5186   - children: (
5187   - <div>
5188   - <Radio.Group options={options2} onChange={radioOnChange2} value={value2} />
5189   - <div style={{ height: '25px' }}></div>
5190   - <ProTable
5191   - id="main-table"
5192   - // tableStyle={{backgroundColor:'red'}}
5193   -
5194   - actionRef={mainTableRef}
5195   - formRef={mainTableFormRef}
5196   - expandIconColumnIndex={-1}
5197   - columns={mainOrdersColumns}
5198   - rowKey="id"
5199   - pagination={{
5200   - showQuickJumper: true,
5201   - pageSize: pageSize,
5202   - current: currentPage,
5203   - showSizeChanger: true,
5204   - onChange: (page, size) => {
5205   - setPageSize(size);
5206   - setCurrentPage(page);
5207   - },
5208   - showTotal: (total, range) => {
5209   - return (
5210   - <>
5211   - <span>
5212   - {'第 ' +
5213   - range[0] +
5214   - '-' +
5215   - range[1] +
5216   - ' 条/总共 ' +
5217   - total +
5218   - ' 条主订单 '}
5219   - </span>
5220   - <span className="text-[#8C8C8C]">
5221   - {' (' + subOrderCount + ' 条子订单)'}
5222   - </span>
5223   - </>
5224   - );
5225   - },
5226   - }}
5227   - // showHeader={false}
5228   - expandedRowKeys={expandedRowKeys}
5229   - // expandable={{ expandedRowRender }}
5230   - dateFormatter="string"
5231   - options={false}
5232   - headerTitle=""
5233   - search={false}
5234   - // labelWidth: 'auto',
5235   - // onCollapse: resize,
5236   - request={async (
5237   - // 第一个参数 params 查询表单和 params 参数的结合
5238   - // 第一个参数中一定会有 pageSize 和 current ,这两个参数是 antd 的规范
5239   - params,
5240   - sorter,
5241   - filter,
5242   - ) => {
5243   - params.orderStatus = 'CONFIRM_INVOICE';
5244   - console.log(params, '5656params')
5245   - //订单id处理
5246   - /**
5247   - * 以params中的id为主,如果params没id,则取url中的id
5248   - * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来
5249   - */
5250   - let orderIds = mainTableFormRef.current?.getFieldValue('id');
5251   - let subOrderId =
5252   - mainTableFormRef.current?.getFieldValue('subOrderId');
5253   - params.id = params.id || orderIds;
5254   - params.subOrderId = params.subOrderId || subOrderId;
5255   - if (params.id !== '') {
5256   - params.id = params.id?.replace(/ /g, '');
5257   - if (params.id?.indexOf(',')) {
5258   - params.id = params.id.split(',');
5259   - params.id = params.id.filter((id) => {
5260   - return id !== '';
5261   - });
5262   - }
5263   - }
5264   -
5265   - params.condition = filterCondifion;
5266   -
5267   - //排序
5268   - params.sorted = sorted;
5269   - //是否只查看已作废
5270   - params.isDeleteQueryOrder = filterCondifion === 70;
5271   - //保存这个搜索条件
5272   - setSearchParam(params);
5273   -
5274   - useEffect(() => {
5275   - //预警订单
5276   - }, []);
5277   - //订单标记2
5278   - const { data } = await postServiceOrderQueryServiceOrder({
5279   - // ...params,
5280   - // FIXME: remove @ts-ignore
5281   - // @ts-ignore
5282   - sorter,
5283   - filter,
5284   - data: { ...params },
5285   - });
5286   -
5287   - setRolePath(data.specialPath);
5288   - setSubOrderCount(data.count);
5289   - setAllMainChecked(false);
5290   - setSelectedMainOrderKeys([]);
5291   - subOrderSelectedMap.clear();
5292   - mainOrderSelectedMap.clear();
5293   - setData(data?.data);
5294   -
5295   - //主订单id与子订单id的对照关系保存
5296   - mainOrderIdSubOrderIdRelationsMap.clear();
5297   - for (let row of data?.data) {
5298   - let mianOrderId = row.id;
5299   - let subOrderIds = row.subOrderInformationLists?.map((item) => {
5300   - //目前子订单存储的totalPayment不准确,这里重新处理取主订单的totalPayment
5301   - //totalPayment在财务开票计算金额时使用到
5302   - item.totalPayment = row.totalPayment;
5303   - return item.id;
5304   - });
5305   - mainOrderIdSubOrderIdRelationsMap.set(mianOrderId, subOrderIds);
5306   - }
5307   -
5308   - return {
5309   - data: data?.data || [],
5310   - total: data?.total || 0,
5311   - };
5312   - }}
5313   - toolbar={{
5314   - multipleLine: true,
5315   - }}
5316   - // toolBarRender={() => {
5317   - // return toolBarRender();
5318   - // }}
5319   - />
5320   -
5321   - {orderDrawerVisible && (
5322   - <OrderDrawer
5323   - data={orderOptType === 'add' ? {} : buildMainOrder()}
5324   - subOrders={orderOptType === 'add' ? [] : buildSubOrders()}
5325   - onClose={(isSuccess: boolean) => {
5326   - setOrderDrawerVisible(false);
5327   - clearOptObject();
5328   - if (isSuccess) {
5329   - refreshTable();
5330   - }
5331   - }}
5332   - orderOptType={orderOptType}
5333   - />
5334   - )}
5335   -
5336   - {
5337   - checkVisible && (
5338   - <CheckModal
5339   - setCheckVisible={(val: boolean) => {
5340   - setCheckVisible(val);
5341   - if (!val) {
5342   - clearOptObject();
5343   - }
5344   - }}
5345   - data={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
5346   - subOrders={
5347   - isMainOrder
5348   - ? [...subOrderSelectedMap.values()].flat()
5349   - : buildSubOrders()
5350   - }
5351   - orderCheckType={orderCheckType}
5352   - openOrderDrawer={(type: any, id: any) => {
5353   - setCurrentMainId(id);
5354   - setOrderOptType(type);
5355   - setOrderDrawerVisible(true);
5356   - }}
5357   - onClose={() => {
5358   - clearOptObject();
5359   - setCheckVisible(false);
5360   - refreshTable();
5361   - }}
5362   - />
5363   - )
5364   - }
5365   -
5366   - {
5367   - applyForInvoicingVisible && (
5368   - <ApplyForInvoicingModal
5369   - setCheckVisible={(val: boolean) => {
5370   - setApplyForInvoicingVisible(val);
5371   - if (!val) {
5372   - clearOptObject();
5373   - }
5374   - }}
5375   - subOrders={
5376   - isMainOrder
5377   - ? [...subOrderSelectedMap.values()].flat()
5378   - : buildSubOrders()
5379   - }
5380   - totalPayment={getApplyInvoicingTotalPayment()}
5381   - isMainOrder={isMainOrder}
5382   - isEdit={isEdit}
5383   - onClose={() => {
5384   - setApplyForInvoicingVisible(false);
5385   - setIsMainOrder(false);
5386   - clearOptObject();
5387   - refreshTable();
5388   - }}
5389   - />
5390   - )
5391   - }
5392   -
5393   - {
5394   - notesEditVisible && (
5395   - <OrderNotesEditModal
5396   - setNotesEditVisible={(val: boolean) => {
5397   - setNotesEditVisible(val);
5398   - if (!val) {
5399   - clearOptObject();
5400   - }
5401   - }}
5402   - ids={selectedRows}
5403   - notesType={notesType}
5404   - notes={notes}
5405   - onClose={() => {
5406   - setNotesEditVisible(false);
5407   - setSelectedRows([]);
5408   - setNotes(notes);
5409   - setNotesType(1);
5410   - refreshTable();
5411   - }}
5412   - />
5413   - )
5414   - }
5415   -
5416   - {
5417   - deliverVisible && (
5418   - <DeliverModal
5419   - data={buildSubOrders()}
5420   - isSendProduct={isSendProduct}
5421   - setVisible={(val: boolean) => {
5422   - setDeliverVisible(val);
5423   - if (!val) {
5424   - clearOptObject();
5425   - }
5426   - }}
5427   - sendType={orderCheckType}
5428   - onClose={() => {
5429   - clearOptObject();
5430   - setDeliverVisible(false);
5431   - setIsSendProduct(false);
5432   - refreshTable();
5433   - }}
5434   - />
5435   - )
5436   - }
5437   -
5438   - {
5439   - financialVisible && (
5440   - <FinancialDrawer
5441   - isEdit={isEdit}
5442   - mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
5443   - subOrders={
5444   - isMainOrder
5445   - ? [...subOrderSelectedMap.values()].flat()
5446   - : buildSubOrders()
5447   - }
5448   - isMainOrder={isMainOrder}
5449   - cancel={() => {
5450   - setFinancialVisible(false);
5451   - clearOptObject();
5452   - setIsMainOrder(false);
5453   - setIsEdit(false);
5454   - }}
5455   - onClose={() => {
5456   - setFinancialVisible(false);
5457   - clearOptObject();
5458   - refreshTable();
5459   - setIsMainOrder(false);
5460   - setIsEdit(false);
5461   - }}
5462   - />
5463   - )
5464   - }
5465   -
5466   - {
5467   - financialEditVisible && (
5468   - <FinancialEditDrawer
5469   - mainOrder={buildMainOrder()}
5470   - subOrders={buildSubOrders()}
5471   - isMainOrder={isMainOrder}
5472   - setVisible={() => {
5473   - setFinancialEditVisible(false);
5474   - clearOptObject();
5475   - }}
5476   - onClose={() => {
5477   - setFinancialEditVisible(false);
5478   - refreshTable();
5479   - setIsMainOrder(false);
5480   - clearOptObject();
5481   - }}
5482   - />
5483   - )
5484   - }
5485   -
5486   - {
5487   - orderPrintVisible && (
5488   - <OrderPrintModal
5489   - mainOrder={buildMainOrder()}
5490   - subOrders={buildSubOrders()}
5491   - isRePrint={isRePrintOrder}
5492   - setVisible={(val: boolean) => {
5493   - setOrderPrintVisible(val);
5494   - if (!val) {
5495   - clearOptObject();
5496   - }
5497   - }}
5498   - printOptType={orderCheckType}
5499   - onClose={() => {
5500   - setOrderPrintVisible(false);
5501   - clearOptObject();
5502   - setIsRePrintOrder(false);
5503   - refreshTable();
5504   - }}
5505   - />
5506   - )
5507   - }
5508   -
5509   - {
5510   - confirmReceiptVisible && (
5511   - <ConfirmReceiptModal
5512   - data={buildSubOrders()}
5513   - onClose={() => {
5514   - setConfirmReceiptVisible(false);
5515   - clearOptObject();
5516   - refreshTable();
5517   - }}
5518   - />
5519   - )
5520   - }
5521   -
5522   - {
5523   - imagesViewerModalVisible && (
5524   - <ImagesViewerModal
5525   - optType={imagesViewerOptType}
5526   - setVisible={(val: boolean) => {
5527   - setImagesViewerModalVisible(val);
5528   - if (!val) {
5529   - clearOptObject();
5530   - }
5531   - }}
5532   - onClose={() => {
5533   - setImagesViewerModalVisible(false);
5534   - }}
5535   - orderRow={buildSubOrders()[0]}
5536   - />
5537   - )
5538   - }
5539   -
5540   - {
5541   - importModalVisible && (
5542   - <ImportModal
5543   - onClose={() => {
5544   - setImportModalVisible(false);
5545   - refreshTable();
5546   - }}
5547   - />
5548   - )
5549   - }
5550   -
5551   - {
5552   - attachmentModalVisible && (
5553   - <AttachmentModal
5554   - data={buildSubOrders()[0]}
5555   - onClose={() => {
5556   - setAttachmentModalVisible(false);
5557   - clearOptObject();
5558   - }}
5559   - />
5560   - )
5561   - }
5562   -
5563   - {
5564   - historyModalVisible && (
5565   - <HistoryModal
5566   - subOrders={selectedRows}
5567   - isCancelledOrder={filterCondifion === 70}
5568   - onClose={() => {
5569   - setHistoryModalVisible(false);
5570   - setSelectedRows({});
5571   - clearOptObject();
5572   - }}
5573   - />
5574   - )
5575   - }
5576   -
5577   - {
5578   - deliverInfoDrawerVisible && (
5579   - <DeliverInfoDrawer
5580   - data={buildMainOrder()}
5581   - onClose={() => {
5582   - setDeliverInfoDrawerVisible(false);
5583   - clearOptObject();
5584   - }}
5585   - />
5586   - )
5587   - }
5588   -
5589   - {
5590   - deliverInfoDrawerVisible && (
5591   - <DeliverInfoDrawer
5592   - data={buildMainOrder()}
5593   - onClose={() => {
5594   - setDeliverInfoDrawerVisible(false);
5595   - clearOptObject();
5596   - }}
5597   - />
5598   - )
5599   - }
5600   -
5601   - {
5602   - procureCheckModalVisible && (
5603   - <ProcureCheckModal
5604   - setCheckVisible={(val: boolean) => {
5605   - setProcureCheckModalVisible(val);
5606   - if (!val) {
5607   - clearOptObject();
5608   - }
5609   - }}
5610   - isMainOrder={isMainOrder}
5611   - orders={
5612   - isMainOrder
5613   - ? [...subOrderSelectedMap.values()].flat()
5614   - : buildSubOrders()
5615   - }
5616   - onClose={() => {
5617   - setProcureCheckModalVisible(false);
5618   - clearOptObject();
5619   - setIsMainOrder(false);
5620   - refreshTable();
5621   - }}
5622   - />
5623   - )
5624   - }
5625   -
5626   - {
5627   - afterSalesDrawerVisible && (
5628   - <AfterSalesDrawer
5629   - setVisible={(val: boolean) => {
5630   - setAfterSalesDrawerVisible(val);
5631   - if (!val) {
5632   - clearOptObject();
5633   - }
5634   - }}
5635   - mainOrder={buildMainOrder()}
5636   - subOrders={buildSubOrders()}
5637   - onClose={() => {
5638   - setAfterSalesDrawerVisible(false);
5639   - clearOptObject();
5640   - refreshTable();
5641   - }}
5642   - />
5643   - )
5644   - }
5645   -
5646   - {
5647   - procureConvertModalVisible && (
5648   - <ProcureConvertModal
5649   - setVisible={(val: boolean) => {
5650   - setProcureConvertModalVisible(val);
5651   - if (!val) {
5652   - clearOptObject();
5653   - }
5654   - }}
5655   - subOrders={buildSubOrders()}
5656   - onClose={() => {
5657   - setProcureConvertModalVisible(false);
5658   - clearOptObject();
5659   - refreshTable();
5660   - }}
5661   - />
5662   - )
5663   - }
5664   -
5665   - {
5666   - financialMergeDrawerVisible && (
5667   - <FinancialMergeDrawer
5668   - setVisible={(val: boolean) => {
5669   - setFinancialMergeDrawerVisible(val);
5670   - if (!val) {
5671   - clearOptObject();
5672   - }
5673   - }}
5674   - dataList={
5675   - isMainOrder
5676   - ? [...subOrderSelectedMap.values()].flat()
5677   - : buildSubOrders()
5678   - }
5679   - onClose={() => {
5680   - setFinancialMergeDrawerVisible(false);
5681   - setIsMainOrder(false);
5682   - clearOptObject();
5683   - refreshTable();
5684   - }}
5685   - />
5686   - )
5687   - }
5688   -
5689   - {
5690   - financialReceiptsModalVisible && (
5691   - <FinancialReceiptsModal
5692   - setVisible={(val: boolean) => {
5693   - setFinancialReceiptsModalVisible(val);
5694   - if (!val) {
5695   - clearOptObject();
5696   - }
5697   - }}
5698   - datas={selectedRows}
5699   - onClose={() => {
5700   - setFinancialReceiptsModalVisible(false);
5701   - setSelectedRows({});
5702   - refreshTable();
5703   - }}
5704   - />
5705   - )
5706   - }
5707   -
5708   - {
5709   - shippingWarehouseChangeModalVisible && (
5710   - <ShippingWarehouseChangeModal
5711   - setVisible={(val: boolean) => {
5712   - setShippingWarehouseChangeModalVisible(val);
5713   - if (!val) {
5714   - clearOptObject();
5715   - }
5716   - }}
5717   - subOrderIds={ids}
5718   - originShippingWarehouse={buildSubOrders()[0].shippingWarehouse}
5719   - onClose={() => {
5720   - setShippingWarehouseChangeModalVisible(false);
5721   - clearOptObject();
5722   - setIds([]);
5723   - refreshTable();
5724   - }}
5725   - />
5726   - )
5727   - }
5728   - {
5729   - reissueVisible && (
5730   - <ReissueModal
5731   - setVisible={(val: boolean) => {
5732   - setReissueVisible(val);
5733   - if (!val) {
5734   - clearOptObject();
5735   - }
5736   - }}
5737   - subOrders={
5738   - isMainOrder
5739   - ? [...subOrderSelectedMap.values()].flat()
5740   - : buildSubOrders()
5741   - }
5742   - onClose={() => {
5743   - setReissueVisible(false);
5744   - clearOptObject();
5745   - refreshTable();
5746   - }}
5747   - />
5748   - )
5749   - }
5750   - {
5751   - reissueVisibleOld && (
5752   - <ReissueModal_old
5753   - setVisible={(val: boolean) => {
5754   - setReissueVisibleOld(val);
5755   - console.log(reissueVisible);
5756   - if (!val) {
5757   - clearOptObject();
5758   - }
5759   - }}
5760   - mainOrder={buildMainOrder()}
5761   - subOrders={buildSubOrders()}
5762   - onClose={() => {
5763   - setReissueVisibleOld(false);
5764   - clearOptObject();
5765   - refreshTable();
5766   - }}
5767   - />
5768   - )
5769   - }
5770   - {
5771   - productionTimeModalVisible && (
5772   - <ProductionTimeModal
5773   - setVisible={(val: boolean) => {
5774   - setProductionTimeModalVisible(val);
5775   - if (!val) {
5776   - clearOptObject();
5777   - }
5778   - }}
5779   - subOrders={buildSubOrders()}
5780   - onClose={() => {
5781   - setProductionTimeModalVisible(false);
5782   - clearOptObject();
5783   - refreshTable();
5784   - }}
5785   - />
5786   - )
5787   - }
5788   -
5789   - {
5790   - modifiedDiffModalVisible && (
5791   - <ModifiedDiffModal
5792   - setVisible={(val: boolean) => {
5793   - setModifiedDiffModalVisible(val);
5794   - if (!val) {
5795   - clearOptObject();
5796   - }
5797   - }}
5798   - subOrders={buildSubOrders()}
5799   - mainOrder={buildMainOrder()}
5800   - onClose={() => {
5801   - setModifiedDiffModalVisible(false);
5802   - clearOptObject();
5803   - }}
5804   - />
5805   - )
5806   - }
5807   -
5808   - {
5809   - uploadPayBillModalVisible && (
5810   - <UploadPayBillModal
5811   - setVisible={(val: boolean) => {
5812   - setUploadPayBillModalVisible(val);
5813   - if (!val) {
5814   - clearOptObject();
5815   - }
5816   - }}
5817   - subOrders={buildSubOrders()}
5818   - mainOrder={buildMainOrder()}
5819   - onClose={() => {
5820   - setUploadPayBillModalVisible(false);
5821   - clearOptObject();
5822   - refreshTable();
5823   - }}
5824   - />
5825   - )
5826   - }
5827   - {
5828   - invoicingDrawerFormVisible && (
5829   - <InvoicingDrawerForm
5830   - dataList={
5831   - isMainOrder
5832   - ? [...subOrderSelectedMap.values()].flat()
5833   - : buildSubOrders()
5834   - }
5835   - setVisible={(val: boolean) => {
5836   - setInvoicingDrawerFormVisible(val);
5837   - if (!val) {
5838   - clearOptObject();
5839   - }
5840   - }}
5841   - mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()}
5842   - onClose={() => {
5843   - setInvoicingDrawerFormVisible(false);
5844   - setIsMainOrder(true);
5845   - clearOptObject();
5846   - refreshTable();
5847   - }}
5848   - />
5849   - )
5850   - }
5851   - {contextHolder}
5852   - <FloatButton.BackTop visibilityHeight={0} />
5853   - </div >
5854   - )
5855   - }
5856   - ]
5857   - const [open, setOpen] = useState(true);
5858   - //隐藏弹窗
5859   - const hideModal = () => {
5860   - setOpen(false);
5861   - };
5862   - return (
5863   - <div className="order-page-container">
5864   - <div id="resizeDiv"></div>
5865   - <Modal
5866   - title="订单预警提醒"
5867   - open={open}
5868   - width={800}
5869   - closable={false}
5870   - footer={[
5871   - <Button key="confirm" size='large' type="primary" onClick={hideModal}>
5872   - 去处理
5873   - </Button>
5874   - ]}
5875   - >
5876   - <Row
5877   - gutter={16}
5878   - justify="space-between" // Aligns Cols to the start and end
5879   - align="middle" // Vertically center contents
5880   - >
5881   - <Col span={12}>
5882   - <div style={{ display: 'flex', justifyContent: 'center', marginTop: '20px' }}>
5883   - <Card
5884   - bordered={true}
5885   - style={{
5886   - backgroundColor: '#f0f0f0', // 背景颜色
5887   - width: '200px', // 卡片宽度
5888   - height: '200px', // 卡片高度
5889   - display: 'flex',
5890   - alignItems: 'center',
5891   - justifyContent: 'center'
5892   - }}
5893   - >
5894   - <div style={{
5895   - fontWeight: 'bold', // 字体加粗
5896   - color: 'black', // 字体颜色
5897   - fontSize: '20px', // 字体大小
5898   - }}>
5899   - <div style={{
5900   - fontWeight: 'bold', // 字体加粗
5901   - color: 'black', // 字体颜色
5902   - fontSize: '40px', // 字体大小
5903   - justifyContent: 'center',
5904   - display: 'flex',
5905   - alignItems: 'center',
5906   - marginBottom: '20px',
5907   - }}>
5908   - {invoiceWarningNum}
5909   - </div>
5910   - 发票待确认订单
5911   - </div>
5912   - </Card>
5913   - </div></Col>
5914   - <Col span={12}>
5915   - <div style={{ display: 'flex', justifyContent: 'center', marginTop: '20px' }}>
5916   - <Card
5917   - bordered={true}
5918   - style={{
5919   - backgroundColor: '#f0f0f0', // 背景颜色
5920   - width: '200px', // 卡片宽度
5921   - height: '200px', // 卡片高度
5922   - display: 'flex',
5923   - alignItems: 'center',
5924   - justifyContent: 'center'
5925   - }}
5926   - >
5927   - <div style={{
5928   - fontWeight: 'bold', // 字体加粗
5929   - color: 'black', // 字体颜色
5930   - fontSize: '20px', // 字体大小
5931   - }}>
5932   - <div style={{
5933   - fontWeight: 'bold', // 字体加粗
5934   - color: 'black', // 字体颜色
5935   - fontSize: '40px', // 字体大小
5936   - justifyContent: 'center',
5937   - display: 'flex',
5938   - alignItems: 'center',
5939   - marginBottom: '20px',
5940   - }}>
5941   - {invoiceRefundWarningNum}
5942   - </div>
5943   - 回款待确认订单
5944   - </div>
5945   - </Card>
5946   - </div></Col>
5947   - </Row>
5948   - <div style={{ color: 'red', padding: '40px' }}>
5949   - <p>预警说明:</p>
5950   - <p>1、从订单确认收货之日起,超过5天未和客户确认发票(不开票的订单除外)的订单将会进行第一次提醒;超过15天未和客户确认发票(不开票的订单除外)的订单将会每天进行一次提醒,并限制下单功能</p>
5951   - <p>2、从发票确认之日起,超过15天未确认回款的订单将会进行第一次提醒,超过25天未确认回款的订单将会每天进行一次提醒,并限制下单功能</p>
5952   - </div>
5953   - </Modal>
5954   - <Tabs
5955   - defaultActiveKey="1"
5956   - items={tabsItems}
5957   - onChange={(value) => {
5958   - console.log(value, '5656');
5959   - }}
5960   - />
5961   - </div>
5962   - );
5963   -};
5964   -// //选择天数1
5965   -// const options1 = [
5966   -// {
5967   -// label: '超过5天',
5968   -// value: '1',
5969   -// },
5970   -// {
5971   -// label: '超过15天',
5972   -// value: '2',
5973   -// },
5974   -// ];
5975   -// const [value1, setValue1] = useState('Apple');
5976   -// const radioOnChange1 = ({ target: { value } }) => {
5977   -// console.log('radio1 checked', value);
5978   -// setValue1(value);
5979   -// };
5980   -//选择天数2
5981   -
5982   -export default OrderPage;