Blame view

src/pages/Order/index.tsx 90 KB
sanmu authored
1
import ButtonConfirm from '@/components/ButtomConfirm';
zhongnanhuang authored
2
3
import { RESPONSE_CODE } from '@/constants/enum';
import {
zhongnanhuang authored
4
  postServiceOrderNoNeedSend,
zhongnanhuang authored
5
  postServiceOrderOrderCancel,
6
  postServiceOrderProcureOrder,
zhongnanhuang authored
7
  postServiceOrderProcurePrint,
zhongnanhuang authored
8
9
10
  postServiceOrderQueryServiceOrder,
} from '@/services';
import { orderExport } from '@/services/order';
11
12
13
14
15
16
import {
  copyToClipboard,
  enumToProTableEnumValue,
  enumValueToLabel,
  formatDateTime,
} from '@/utils';
zhongnanhuang authored
17
import { getUserInfo } from '@/utils/user';
zhongnanhuang authored
18
import {
zhongnanhuang authored
19
  ClockCircleTwoTone,
zhongnanhuang authored
20
  ContainerTwoTone,
zhongnanhuang authored
21
  CopyTwoTone,
zhongnanhuang authored
22
  DownOutlined,
zhongnanhuang authored
23
  EditTwoTone,
zhongnanhuang authored
24
  EllipsisOutlined,
zhongnanhuang authored
25
  QuestionCircleOutlined,
zhongnanhuang authored
26
} from '@ant-design/icons';
calmound authored
27
28
import {
  PageContainer,
sanmu authored
29
30
  ProColumns,
  ProTable,
calmound authored
31
} from '@ant-design/pro-components';
zhongnanhuang authored
32
import { history } from '@umijs/max';
zhongnanhuang authored
33
import {
zhongnanhuang authored
34
  Avatar,
zhongnanhuang authored
35
36
  Button,
  Checkbox,
zhongnanhuang authored
37
  Divider,
zhongnanhuang authored
38
39
  Dropdown,
  Flex,
40
  Image,
zhongnanhuang authored
41
42
43
  MenuProps,
  Space,
  Tag,
zhongnanhuang authored
44
  Tooltip,
zhongnanhuang authored
45
46
47
  message,
} from 'antd';
import { cloneDeep } from 'lodash';
48
import React, { Key, useRef, useState } from 'react';
zhongnanhuang authored
49
import OrderPrintModal from '../OrderPrint/OrderPrintModal';
zhongnanhuang authored
50
import AfterSalesDrawer from './components/AfterSalesDrawer';
zhongnanhuang authored
51
import ApplyForInvoicingModal from './components/ApplyForInvoicingModal';
zhongnanhuang authored
52
import AttachmentModal from './components/AttachmentModal';
sanmu authored
53
import CheckModal from './components/CheckModal';
zhongnanhuang authored
54
import ConfirmReceiptModal from './components/ConfirmReceiptModal';
zhongnanhuang authored
55
import DeliverInfoDrawer from './components/DeliverInfoDrawer';
sanmu authored
56
import DeliverModal from './components/DeliverModal';
zhongnanhuang authored
57
import FinancialDrawer from './components/FinancialDrawer';
58
import FinancialEditDrawer from './components/FinancialEditDrawer';
59
import FinancialMergeDrawer from './components/FinancialMergeDrawer';
zhongnanhuang authored
60
import FinancialReceiptsModal from './components/FinancialReceiptsModal';
zhongnanhuang authored
61
import HistoryModal from './components/HistoryModal';
zhongnanhuang authored
62
import ImportModal from './components/ImportModal';
sanmu authored
63
import OrderDrawer from './components/OrderDrawer';
zhongnanhuang authored
64
import OrderNotesEditModal from './components/OrderNotesEditModal';
zhongnanhuang authored
65
import ProcureCheckModal from './components/ProcureCheckModal';
66
import ProcureConvertModal from './components/ProcureConvertModal';
zhongnanhuang authored
67
import SubOrderComfirmReceiptImagesModal from './components/SubOrderComfirmReceiptImagesModal';
68
import {
69
  AFTER_INVOICING_STATUS,
zhongnanhuang authored
70
  CHECK_TYPE,
zhongnanhuang authored
71
  LOGISTICS_STATUS_OPTIONS,
72
73
74
75
  MAIN_ORDER_COLUMNS,
  ORDER_STATUS_OPTIONS,
  PAYMENT_CHANNEL_OPTIONS,
  PAYMENT_METHOD_OPTIONS,
76
  PROCURE_ORDER_STATUS,
zhongnanhuang authored
77
  PRODUCT_BELONG_DEPARTMENT_OPTIONS,
zhongnanhuang authored
78
  TAGS_COLOR,
zhongnanhuang authored
79
80
  getInvoicingType,
  getNeedInvoicing,
81
} from './constant';
sanmu authored
82
import './index.less';
sanmu authored
83
import { OrderListItemType, OrderType } from './type.d';
calmound authored
84
sanmu authored
85
const OrderPage = () => {
sanmu authored
86
  const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false);
sanmu authored
87
  const [checkVisible, setCheckVisible] = useState<boolean>(false);
zhongnanhuang authored
88
  const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false);
89
  const [allMainChecked, setAllMainChecked] = useState(false);
zhongnanhuang authored
90
91
92
93
  const [
    subOrderConfirmReceiptImagesVisible,
    setSubOrderConfirmReceiptImagesVisible,
  ] = useState<boolean>(false);
94
  const [data, setData] = useState([]); //列表数据
95
  const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false);
96
97
  const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] =
    useState<boolean>(false);
zhongnanhuang authored
98
99
  const [attachmentModalVisible, setAttachmentModalVisible] =
    useState<boolean>(false);
zhongnanhuang authored
100
101
  const [financialReceiptsModalVisible, setFinancialReceiptsModalVisible] =
    useState(false);
zhongnanhuang authored
102
  const [financialVisible, setFinancialVisible] = useState<boolean>(false);
103
104
  const [financialEditVisible, setFinancialEditVisible] =
    useState<boolean>(false);
zhongnanhuang authored
105
106
  const [afterSalesDrawerVisible, setAfterSalesDrawerVisible] =
    useState<boolean>(false);
zhongnanhuang authored
107
108
  const [historyModalVisible, setHistoryModalVisible] =
    useState<boolean>(false);
zhongnanhuang authored
109
110
111
  const [isRePrintOrder, setIsRePrintOrder] = useState<boolean>(false);
  const [isSendProduct, setIsSendProduct] = useState<boolean>(false);
  const [isMainOrder, setIsMainOrder] = useState<boolean>(false);
zhongnanhuang authored
112
  const [importModalVisible, setImportModalVisible] = useState<boolean>(false);
zhongnanhuang authored
113
114
  const [applyForInvoicingVisible, setApplyForInvoicingVisible] =
    useState<boolean>(false);
zhongnanhuang authored
115
116
  const [procureCheckModalVisible, setProcureCheckModalVisible] =
    useState<boolean>(false);
117
118
  const [procureConvertModalVisible, setProcureConvertModalVisible] =
    useState<boolean>(false);
zhongnanhuang authored
119
120
  const [confirmReceiptVisible, setConfirmReceiptVisible] =
    useState<boolean>(false);
sanmu authored
121
  const [deliverVisible, setDeliverVisible] = useState<boolean>(false);
zhongnanhuang authored
122
123
  const [deliverInfoDrawerVisible, setDeliverInfoDrawerVisible] =
    useState<boolean>(false);
124
  const [orderOptType, setOrderOptType] = useState<string>('');
zhongnanhuang authored
125
  const [isEdit, setIsEdit] = useState<boolean>(false);
126
  const [expandedRowKeys, setExpandedRowKeys] = useState<Key[]>([]);
sanmu authored
127
  const [orderRow, setOrderRow] = useState<Partial<OrderType>>({});
zhongnanhuang authored
128
  const [mainOrderAllItemKeys, setMainOrderAllItemKeys] = useState([]);
zhongnanhuang authored
129
  const [rolePath, setRolePath] = useState([]); //当前角色权限(新增跟打印按钮)
zhongnanhuang authored
130
  const userInfo = getUserInfo();
zhongnanhuang authored
131
  // const [tableHeight, setTableHeight] = useState(200);
sanmu authored
132
133
  const [selectedRows, setSelectedRows] = useState({});
  const [selectedRowObj, setSelectedRowObj] = useState({});
134
  const [selectedItems, setSelectedItems] = useState([]);
zhongnanhuang authored
135
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
zhongnanhuang authored
136
137
  const [pageSize, setPageSize] = useState(10);
  const [currentPage, setCurrentPage] = useState(1);
zhongnanhuang authored
138
  const [orderCheckType, setOrderCheckType] = useState('');
zhongnanhuang authored
139
  const [onlyShowCancelOrder, setOnlyShowCancelOrder] = useState(false);
zhongnanhuang authored
140
141
  const [onlyShowProcureToBeProcessed, setOnlyShowProcureToBeProcessed] =
    useState(false);
142
  const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map
143
  const [mainOrderSelectedRows, setMainOrderSelectedRows] = useState([]); //选中的主订单集合
zhongnanhuang authored
144
145
  const [onlyShowFinancialToBeProcessed, setOnlyShowFinancialToBeProcessed] =
    useState(false);
146
  const mainTableRef = useRef();
zhongnanhuang authored
147
  let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储
zhongnanhuang authored
148
149
  const [messageApi, contextHolder] = message.useMessage();
zhongnanhuang authored
150
151
152
153
154
155
156
157
158
159
160
  // const openCheckNotes = (checkNotes: string) => {
  //   Modal.info({
  //     title: '驳回备注',
  //     content: (
  //       <div>
  //         <p>{checkNotes}</p>
  //       </div>
  //     ),
  //     onOk() { },
  //   });
  // };
zhongnanhuang authored
161
zhongnanhuang authored
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
  const exportLoading = () => {
    messageApi.open({
      type: 'loading',
      content: '正在导出文件...',
      duration: 0,
    });
  };

  const exportLoadingDestory = () => {
    messageApi.destroy();
  };

  const refreshTable = () => {
    mainTableRef.current?.reload();
    //刷新表格数据的时候,取消选中行
    setSelectedRowObj([]);
    setSelectedRows([]);
    setSelectedRowKeys([]);
  };
181
zhongnanhuang authored
182
183
184
185
186
  function changeCancelOrderShow(e: any) {
    setOnlyShowCancelOrder(e.target.checked);
    refreshTable();
  }
zhongnanhuang authored
187
188
189
190
191
192
193
194
195
196
  function changeProcureToBeProcessed(e: any) {
    setOnlyShowProcureToBeProcessed(e.target.checked);
    refreshTable();
  }

  function changeFinancialToBeProcessed(e: any) {
    setOnlyShowFinancialToBeProcessed(e.target.checked);
    refreshTable();
  }
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
  /**
   * 复制订单到剪贴板
   * @param record
   */
  function copyOrderToClipboard(record: any) {
    let text = '';
    text += record?.id;
    text += ',' + record?.customerName;
    text += ',' + record?.customerContactNumber;
    text += ',' + record?.customerShippingAddress;
    record?.subOrderInformationLists?.forEach((item) => {
      text += '\n';
      text += item?.productName;
      text += ' ' + item?.parameters;
      text += ' ' + item?.quantity;
      text += ' ' + item?.unit;
    });
    if (copyToClipboard(text)) {
      message.info('已复制到剪贴板');
    } else {
      message.info('无法复制到剪贴板');
    }
  }
zhongnanhuang authored
221
222
223
224
225
226
227
228
229
  // const resize = () => {
  //   // 计算元素底部到视口顶部的距离
  //   let bottomDistance = document
  //     .getElementById('mainTable')
  //     ?.getElementsByClassName('ant-table-thead')[0]
  //     .getBoundingClientRect().bottom;
  //   // 获取屏幕高度
  //   let screenHeight =
  //     window.innerHeight || document.documentElement.clientHeight;
230
zhongnanhuang authored
231
232
  //   // 计算元素底部到屏幕底部的距离
  //   let bottomToScreenBottomDistance = screenHeight - bottomDistance;
233
zhongnanhuang authored
234
235
  //   // //底部分页元素的高度
  //   // var pH = screenHeight - document.getElementById("main-table").getElementsByClassName('ant-table-body')[0].getBoundingClientRect().bottom;
236
zhongnanhuang authored
237
238
  //   setTableHeight(bottomToScreenBottomDistance - 88);
  // };
239
zhongnanhuang authored
240
241
242
243
244
  // useEffect(() => {
  //   resize();
  //   // 添加事件监听器,当窗口大小改变时调用resize方法
  //   window.addEventListener('resize', resize);
  // });
245
zhongnanhuang authored
246
247
248
249
250
251
252
253
254
255
256
257
  const MyToolTip = ({ title, content }) => {
    return (
      <Tooltip
        color="#FFFFFF"
        placement="bottom"
        title={<div className="px-5 py-4 text-black">{title}</div>}
      >
        {content}
      </Tooltip>
    );
  };
zhongnanhuang authored
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
  /**
   * 检查是否可以打印
   * @param paths 按钮集合
   * @returns
   */
  function checkePrintable(paths: any) {
    if (
      !paths?.includes('printOrder') &&
      !paths?.includes('supplierPrint') &&
      !paths?.includes('procurePrint') &&
      !paths?.includes('rePrintOrder')
    ) {
      return false;
    }

    return true;
  }
zhongnanhuang authored
276
277
278
279
280
  const onCheckboxChange = (record: never) => {
    let newSelectedItems = [];
    if (selectedItems.includes(record.id)) {
      newSelectedItems = selectedItems.filter((key) => key !== record.id);
      setSelectedRowKeys([]);
281
      console.log(selectedRowObj);
zhongnanhuang authored
282
283
284
285
286
287
      setSelectedRowObj({
        ...setSelectedRowObj,
        [record.id]: [],
      });
      selectedRowObj[record.id] = [];
      setSelectedRows([]);
288
289
290

      //取消选中主订单
      mainOrderSelectedMap.delete(record.id);
zhongnanhuang authored
291
292
293
294
295
296
297
    } else {
      newSelectedItems = [...selectedItems, record.id];
      //子订单全部自动选中
      let subIds = record.subOrderInformationLists?.map((item) => {
        return item.id;
      });
      setSelectedRowKeys(subIds);
298
zhongnanhuang authored
299
300
301
302
303
304
      setSelectedRowObj({
        ...setSelectedRowObj,
        [record.id]: record.subOrderInformationLists,
      });
      selectedRowObj[record.id] = record.subOrderInformationLists;
      setSelectedRows(record.subOrderInformationLists);
305
306
307

      //选中主订单
      mainOrderSelectedMap.set(record.id, record);
zhongnanhuang authored
308
    }
309
310
    setSelectedItems(newSelectedItems);
  };
zhongnanhuang authored
311
312
313
314
  const handleTableExpand = (mainOrderIds: any) => {
    setExpandedRowKeys(mainOrderIds);
  };
315
316
317
  const allMainCheckBoxChange = () => {
    let checked = !allMainChecked;
    setAllMainChecked(checked);
318
319

    mainOrderSelectedMap.clear();
320
321
    if (checked) {
      let mainOrderIds = data?.map((item) => {
322
        mainOrderSelectedMap.set(item.id, item);
323
324
325
        return item.id;
      });
zhongnanhuang authored
326
327
      let rowObj = {};
      data?.forEach((item) => {
328
329
330
331
332
333
334
335
336
        let id = item.id;
        rowObj[id] = item;
      });
      setSelectedItems(mainOrderIds);
    } else {
      setSelectedItems([]);
    }
  };
zhongnanhuang authored
337
338
339
340
  //表头渲染
  const OrderTableHeader = () => {
    return (
      <Flex className="w-full">
341
342
343
344
345
346
347
        <Flex className="w-[1%] ml-[7px]">
          <Checkbox
            onChange={allMainCheckBoxChange}
            checked={allMainChecked}
          ></Checkbox>
        </Flex>
        <Flex className="w-[30%] ml-[1%]">
zhongnanhuang authored
348
349
          <span className="font-medium">商品信息</span>
        </Flex>
350
        <Flex className="w-[13%]">
zhongnanhuang authored
351
352
353
354
355
          <span className="font-medium">交易金额</span>
        </Flex>
        <Flex className="w-[10%]">
          <span className="font-medium">支付</span>
        </Flex>
356
        <Flex className="w-[12%]">
zhongnanhuang authored
357
358
359
360
361
362
363
364
          <span className="font-medium">其他</span>
        </Flex>
        <Flex className="w-[10%]">
          <span className="font-medium">交易状态</span>
        </Flex>
        <Flex className="w-[17%]">
          <span className="font-medium">操作</span>
        </Flex>
zhongnanhuang authored
365
366
367
368
369
      </Flex>
    );
  };
  //子订单内容渲染
  const SubOderRander = ({ record, optRecord }) => {
zhongnanhuang authored
370
371
372
373
374
375
376
377
378
    /**
     * 获取订单状态标签
     * @param optRecord
     */
    function getOrderStatusTag(optRecord: any): import('react').ReactNode {
      const orderStatus = optRecord.orderStatus;
      if (orderStatus === 'AUDIT_FAILED') {
        return (
          <MyToolTip
379
            key="key"
zhongnanhuang authored
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
            title={optRecord.checkNotes}
            content={
              <>
                <Tag
                  color={TAGS_COLOR.get(optRecord.orderStatus)}
                  style={{ marginRight: '4px' }}
                >
                  {enumValueToLabel(
                    optRecord.orderStatus,
                    ORDER_STATUS_OPTIONS,
                  )}
                </Tag>
                <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
              </>
            }
          />
        );
      }

      if (
        orderStatus === 'AFTER_SALES_COMPLETION' ||
        orderStatus === 'IN_AFTER_SALES'
      ) {
        return (
zhongnanhuang authored
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
          // <MyToolTip
          //   key="key"
          //   title={
          //     enumValueToLabel(
          //       optRecord.afterSalesPlan,
          //       AFTE_SALES_PLAN_OPTIONS,
          //     ) +
          //     ' ' +
          //     optRecord.afterSalesNotes
          //   }
          //   content={
          //     <>
          //       <Tag
          //         color={TAGS_COLOR.get(optRecord.orderStatus)}
          //         style={{ marginRight: '4px' }}
          //       >
          //         {enumValueToLabel(
          //           optRecord.orderStatus,
          //           ORDER_STATUS_OPTIONS,
          //         )}
          //       </Tag>
          //       <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
          //     </>
          //   }
          // />
          <Tag
            color={TAGS_COLOR.get(optRecord.orderStatus)}
            style={{ marginRight: '4px' }}
          >
            {enumValueToLabel(optRecord.orderStatus, ORDER_STATUS_OPTIONS)}
          </Tag>
zhongnanhuang authored
435
436
437
        );
      }
zhongnanhuang authored
438
439
440
      if (orderStatus === 'PROCURE_CONVERT_WAREHOUSE_KEEPER') {
        return (
          <MyToolTip
441
            key="key"
zhongnanhuang authored
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
            title={optRecord.checkNotes}
            content={
              <>
                <Tag
                  color={TAGS_COLOR.get(optRecord.orderStatus)}
                  style={{ marginRight: '4px' }}
                >
                  {enumValueToLabel(
                    optRecord.orderStatus,
                    ORDER_STATUS_OPTIONS,
                  )}
                </Tag>
                <QuestionCircleOutlined style={{ color: '#C1C1C1' }} />
              </>
            }
          />
        );
      }
zhongnanhuang authored
461
      return (
462
        <Tag key="key" color={TAGS_COLOR.get(optRecord.orderStatus)}>
zhongnanhuang authored
463
464
465
466
467
          {enumValueToLabel(optRecord.orderStatus, ORDER_STATUS_OPTIONS)}
        </Tag>
      );
    }
468
469
470
471
472
473
474
475
    //申请开票附件处理
    const getAfterAnnexList = () => {
      let links = [];
      let afterAnnexList = optRecord.afterAnnexList;
      let i = 1;
      if (afterAnnexList?.length > 0) {
        for (let url of afterAnnexList) {
          links.push(
476
            <a key={i} className="pl-2" href={url}>
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
              附件{i++}
            </a>,
          );
        }
      }

      return links;
    };

    //财务审核附件处理
    const getInvoicingCheckAnnexList = () => {
      let invoicingCheckAnnexList = optRecord.invoicingCheckAnnexList;
      return (
        <div>
          <Image.PreviewGroup
            className="mr-10"
            preview={{
              onChange: (current, prev) =>
                console.log(`current index: ${current}, prev index: ${prev}`),
            }}
zhongnanhuang authored
497
          >
498
499
            {invoicingCheckAnnexList.map((url, index) => (
              <React.Fragment key={index}>
500
501
                <Image className="max-h-[50px] max-w-[70px]" src={url} />{' '}
                <Divider type="vertical" />
502
              </React.Fragment>
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
            ))}
          </Image.PreviewGroup>
        </div>
      );
    };

    return (
      <>
        <Flex className="w-full border-b-indigo-500">
          <Flex vertical className="w-[31%]" gap="small">
            {/* 商品名称 */}
            <div
              className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
              title={optRecord.productName}
            >
              <span className="font-medium text-black ">
                {optRecord.productName}
              </span>
            </div>
            <div
              className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
              title={optRecord.parameters}
            >
zhongnanhuang authored
526
              <span className="text-[#8C8C8C]">
527
                参数:{optRecord.parameters}
zhongnanhuang authored
528
              </span>
zhongnanhuang authored
529
            </div>
530
531
532
533
534
535
536
537
538
            <Flex title={optRecord.notes}>
              <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis">
                <span className="text-[#8C8C8C]">
                  备注:
                  {optRecord.notes === undefined ? '暂无备注' : optRecord.notes}
                </span>
              </div>
              {/* 编辑备注按钮 */}
              <EditTwoTone
zhongnanhuang authored
539
                className="pl-1 hover:curcor-pointer"
540
541
542
543
544
545
546
                onClick={() => {
                  setNotesEditVisible(true);
                  setOrderRow(optRecord);
                  setIsMainOrder(false);
                }}
              />
            </Flex>
547
548
549
            {/* {optRecord.applyInvoicingNotes !== undefined &&
            optRecord.applyInvoicingNotes !== null ? (
550
551
552
553
554
555
556
557
558
559
            <Flex title={optRecord.notes}>
              <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis">
                <span className="text-[#8C8C8C]">
                  开票备注:
                  {optRecord.applyInvoicingNotes}
                </span>
              </div>
            </Flex>
          ) : (
            ''
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
          )} */}
          </Flex>
          <Flex className="w-[13%]" vertical gap="small">
            <div
              className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
              title={optRecord.productPrice}
            >
              <span className="text-[#8C8C8C]">单价:</span>
              <span className="text-slate-700">¥{optRecord.productPrice}</span>
            </div>
            <div
              className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
              title={optRecord.quantity}
            >
              <span className="text-[#8C8C8C]">数量:</span>
575
576
577
578
              <span className="text-slate-700">
                x{optRecord.quantity + ' '}
              </span>
              <span className="text-[#8C8C8C]">{optRecord.unit}</span>
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
            </div>
            <div
              className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
              title={optRecord.subOrderPayment}
            >
              <span className="text-[#8C8C8C]">合计:</span>
              <span className="text-slate-700">
                ¥{optRecord.subOrderPayment}
              </span>
            </div>
          </Flex>
          <Flex className="w-[10%]" vertical gap="small">
            {/* 支付方式 */}
            <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
              <span className="text-slate-700">
                {enumValueToLabel(
                  optRecord.paymentMethod,
                  PAYMENT_METHOD_OPTIONS,
                )}
              </span>
            </div>
            {/* 支付渠道 */}
            <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
              <span className="text-slate-700">
                {enumValueToLabel(
                  optRecord.paymentChannel,
                  PAYMENT_CHANNEL_OPTIONS,
                )}
              </span>
            </div>
          </Flex>
          <Flex className="w-[13%]" vertical gap="small">
            {/* 所属部门 */}
            <div
              className="overflow-hidden whitespace-no-wrap overflow-ellipsis"
              title={enumValueToLabel(
zhongnanhuang authored
615
616
617
                optRecord.productBelongBusiness,
                PRODUCT_BELONG_DEPARTMENT_OPTIONS,
              )}
618
619
620
621
622
623
624
625
            >
              <span className="text-slate-700">
                {enumValueToLabel(
                  optRecord.productBelongBusiness,
                  PRODUCT_BELONG_DEPARTMENT_OPTIONS,
                )}
              </span>
            </div>
zhongnanhuang authored
626
627
628
629
630
631
632
633
634
635
636
637
638
            {/* 开票类型 */}
            {getInvoicingType(optRecord) === undefined ? (
              <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
                <span className="text-slate-700">
                  {getInvoicingType(optRecord)}
                </span>
              </div>
            ) : (
              ''
            )}

            {/* 开票状态 */}
639
640
            <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
              <span className="text-slate-700">
641
642
643
644
                {enumValueToLabel(
                  optRecord.afterInvoicingStatus,
                  AFTER_INVOICING_STATUS,
                )}
645
646
              </span>
            </div>
647
          </Flex>
zhongnanhuang authored
648
649
650
651
652
653
654
655
656
657
          <Flex className="w-[10%]" vertical gap="small">
            {/* 开票状态 */}
            <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
              <Tag
                color={
                  optRecord.invoicingTime === null ||
                  optRecord.invoicingTime === undefined
                    ? TAGS_COLOR.get(optRecord.invoicingStatus)
                    : 'success'
zhongnanhuang authored
658
                }
659
660
661
662
663
664
665
666
667
              >
                {getNeedInvoicing(optRecord)}
              </Tag>
            </div>
            {/* 订单状态 */}
            <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
              {getOrderStatusTag(optRecord)}
            </div>
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
            {/**采购是否已下单状态 */}
            {optRecord.procureOrderStatus !== null &&
            optRecord.procureOrderStatus !== undefined ? (
              <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
                <Tag color="success">
                  {enumValueToLabel(
                    optRecord.procureOrderStatus,
                    PROCURE_ORDER_STATUS,
                  )}
                </Tag>
              </div>
            ) : (
              ''
            )}
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
            {/* 物流信息 */}
            <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
              {optRecord.orderStatus === 'CONFIRM_RECEIPT' ||
              optRecord.orderStatus === 'AFTER_SALES_COMPLETION' ||
              optRecord.orderStatus === 'IN_AFTER_SALES' ||
              optRecord.orderStatus === 'SHIPPED' ? (
                <MyToolTip
                  title={
                    optRecord.serialNumber === undefined
                      ? '暂无物流信息'
                      : enumValueToLabel(
                          optRecord.logisticsMethod,
                          LOGISTICS_STATUS_OPTIONS,
                        ) +
                        '  ' +
                        optRecord.serialNumber
                  }
                  content={
                    <Button type="link" size="small" style={{ padding: 0 }}>
                      物流信息
                    </Button>
                  }
                />
              ) : (
                ''
              )}
            </div>
          </Flex>
          <Flex className="w-[18%]" wrap="wrap" gap="small">
712
713
714
715
716
717
718
            {optRecord.subPath?.includes('noNeedInvoicingEdit') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setFinancialEditVisible(true);
                  setSelectedRows([optRecord]);
719
                  setOrderRow(record);
720
721
722
                  setIsMainOrder(false);
                }}
              >
723
                编辑时间
724
725
726
727
              </Button>
            ) : (
              ''
            )}
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
            {optRecord.subPath?.includes('sendProduct') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  optRecord.mainOrderId = record.id;
                  setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染
                  setDeliverVisible(true);
                  setIsSendProduct(true);
                  setOrderCheckType(CHECK_TYPE.NORMAL);
                }}
              >
                仓库发货
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('supplierSendOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  optRecord.mainOrderId = record.id;
                  setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染
                  setDeliverVisible(true);
                  setIsSendProduct(true);
                  setOrderCheckType(CHECK_TYPE.SUPPLIER);
                }}
              >
                供应商发货
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('procureSend') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  optRecord.mainOrderId = record.id;
                  setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染
                  setDeliverVisible(true);
                  setIsSendProduct(true);
                  setOrderCheckType(CHECK_TYPE.PROCURE);
                }}
              >
                采购发货
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('queryAnnex') &&
            optRecord.listAnnex?.length > 0 ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  optRecord.mainOrderId = record.id;
                  setAttachmentModalVisible(true);
                  setOrderRow(optRecord);
                }}
              >
                附件
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('modifySendInformation') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  optRecord.mainOrderId = record.id;
                  setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染
                  setDeliverVisible(true);
                  setIsSendProduct(false);
                }}
              >
                修改发货信息
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('printOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={async () => {
                  setOrderPrintVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderRow(record);
                  setOrderCheckType(CHECK_TYPE.NORMAL);
                }}
              >
                仓库打印
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('supplierPrint') ? (
              <Button
                className="p-0"
                type="link"
                onClick={async () => {
                  setOrderPrintVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderRow(record);
                  setOrderCheckType(CHECK_TYPE.SUPPLIER);
                }}
              >
                供应商打印
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('procurePrint') ? (
zhongnanhuang authored
851
              <ButtonConfirm
852
                className="p-0"
zhongnanhuang authored
853
854
855
856
857
858
859
860
861
862
863
864
865
                title="确认打印?"
                text="采购打印"
                onConfirm={async () => {
                  let res = await postServiceOrderProcurePrint({
                    data: {
                      ids: [optRecord.id],
                    },
                  });

                  if (res.result === RESPONSE_CODE.SUCCESS) {
                    message.success(res.message);
                    refreshTable();
                  }
866
                }}
zhongnanhuang authored
867
              />
868
            ) : (
zhongnanhuang authored
869
870
871
872
873
874
875
876
877
878
879
880
              // <Button
              //   className="p-0"
              //   type="link"
              //   onClick={async () => {
              //     setOrderPrintVisible(true);
              //     setSelectedRows([optRecord]);
              //     setOrderRow(record);
              //     setOrderCheckType(CHECK_TYPE.PROCURE);
              //   }}
              // >
              //   采购打印
              // </Button>
881
882
883
884
885
886
887
888
889
890
891
              ''
            )}

            {optRecord.subPath?.includes('editOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setFinancialVisible(true);
                  setOrderRow(record);
                  setSelectedRows([optRecord]);
zhongnanhuang authored
892
                  setIsEdit(true);
893
894
895
896
897
898
899
                }}
              >
                编辑
              </Button>
            ) : (
              ''
            )}
zhongnanhuang authored
900
901
            {false ? (
zhongnanhuang authored
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setFinancialReceiptsModalVisible(true);
                  setOrderRow(record);
                  setSelectedRows([optRecord]);
                  setIsEdit(true);
                }}
              >
                收款记录
              </Button>
            ) : (
              ''
            )}
918
919
920
921
922
923
            {optRecord.subPath?.includes('invoicing') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setFinancialVisible(true);
zhongnanhuang authored
924
                  setIsEdit(false);
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
                  setOrderRow(record);
                  setSelectedRows([optRecord]);
                  setIsMainOrder(false);
                }}
              >
                开票
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('applyInvoicing') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setApplyForInvoicingVisible(true);
                  setSelectedRows([optRecord]);
zhongnanhuang authored
943
                  setIsEdit(false);
944
                  setIsMainOrder(false);
945
946
947
948
949
950
951
952
953
954
955
956
957
                }}
              >
                申请开票
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('checkOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
958
                  setOrderRow(record);
959
960
961
962
963
964
965
966
967
968
969
                  setCheckVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.NORMAL);
                }}
              >
                审核
              </Button>
            ) : (
              ''
            )}
970
971
972
973
974
            {optRecord.subPath?.includes('afterSalesCheck') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
975
                  setOrderRow(record);
976
977
978
979
980
981
982
983
984
985
986
                  setCheckVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.AFTER_SALES);
                }}
              >
                售后审核
              </Button>
            ) : (
              ''
            )}
987
988
989
990
991
            {optRecord.subPath?.includes('financeCheckOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
992
                  setOrderRow(record);
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
                  setCheckVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.FINALCIAL);
                }}
              >
                财务审核
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('procureCheckOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
1009
                  setOrderRow(record);
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.PROCURE);
                  setProcureCheckModalVisible(true);
                }}
              >
                采购审核
              </Button>
            ) : (
              ''
            )}
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
            {optRecord.subPath?.includes('procureConvertProcure') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.PROCURE);
                  setProcureConvertModalVisible(true);
                }}
              >
                转发
              </Button>
            ) : (
              ''
            )}
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
            {optRecord.subPath?.includes('rePrintOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setOrderPrintVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderRow(record);
                  setIsRePrintOrder(true);
                }}
              >
                重新打印
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('confirmReceipt') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setConfirmReceiptVisible(true);
                  setOrderRow(optRecord);
                }}
              >
                确认收货
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('applyAfterSales') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setAfterSalesDrawerVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderRow(record);
                }}
              >
                申请售后
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('afterSalesCompletion') ? (
              <ButtonConfirm
                className="p-0"
                title="是否完成售后?"
                text="完成售后"
                onConfirm={async () => {
                  let res = await postServiceOrderAfterSalesCompletion({
                    data: { ids: [optRecord.id] },
                  });
                  if (res.result === RESPONSE_CODE.SUCCESS) {
                    message.success(res.message);
                    refreshTable();
                    return true;
                  }
                }}
zhongnanhuang authored
1100
              />
zhongnanhuang authored
1101
1102
1103
            ) : (
              ''
            )}
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
            {optRecord.subPath?.includes('procureOrder') ? (
              <ButtonConfirm
                className="p-0"
                title="是否已下单?"
                text="下单"
                onConfirm={async () => {
                  let res = await postServiceOrderProcureOrder({
                    data: { subIds: [optRecord.id] },
                  });
                  if (res.result === RESPONSE_CODE.SUCCESS) {
                    message.success(res.message);
                    refreshTable();
                    return true;
                  }
                }}
              />
            ) : (
              ''
            )}
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
            {optRecord.subPath?.includes('noNeedSend') ? (
              <ButtonConfirm
                className="p-0"
                title="此订单是否无需发货?"
                text="无需发货"
                onConfirm={async () => {
                  let res = await postServiceOrderNoNeedSend({
                    data: { ids: [optRecord.id] },
                  });
                  if (res.result === RESPONSE_CODE.SUCCESS) {
                    message.success(res.message);
                    refreshTable();
                    return true;
                  }
                }}
              />
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('viewImages') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setSubOrderConfirmReceiptImagesVisible(true);
                  setOrderRow(optRecord);
                }}
              >
                查看收货凭证
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('orderCancel') ? (
              <ButtonConfirm
                className="p-0"
                title="确认作废?"
                text="作废"
                onConfirm={async () => {
                  let body = { ids: [optRecord.id], checkIsMainOrderId: false };
                  const data = await postServiceOrderOrderCancel({
                    data: body,
                  });
                  if (data.result === RESPONSE_CODE.SUCCESS) {
                    message.success(data.message);
                    refreshTable();
                  }
                }}
              />
            ) : (
              ''
            )}
          </Flex>
zhongnanhuang authored
1180
        </Flex>
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194

        {userInfo?.roleSmallVO?.code === 'admin' ||
        userInfo?.roleSmallVO?.code === 'salesManager' ||
        userInfo?.roleSmallVO?.code === 'salesRepresentative' ||
        userInfo?.roleSmallVO?.code === 'finance' ? (
          <Flex title={optRecord.notes}>
            <div className="flex items-center">
              <div className="flex items-center max-w-[500px]">
                <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
                  <Tooltip
                    title={optRecord.applyInvoicingNotes}
                    placement="topLeft"
                  >
                    <span className="text-[#8C8C8C]">
zhongnanhuang authored
1195
                      申请开票备注:
1196
1197
1198
1199
1200
1201
1202
1203
1204
                      {optRecord.applyInvoicingNotes === undefined ||
                      optRecord.applyInvoicingNotes === null
                        ? '暂无备注'
                        : optRecord.applyInvoicingNotes}
                    </span>
                  </Tooltip>
                </div>

                {getAfterAnnexList()}
zhongnanhuang authored
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215

                <Tooltip title="编辑">
                  <EditTwoTone
                    className="pl-1 hover:curcor-pointer"
                    onClick={() => {
                      setApplyForInvoicingVisible(true);
                      setSelectedRows([optRecord]);
                      setIsEdit(true);
                    }}
                  />
                </Tooltip>
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
              </div>
              <Divider type="vertical" className="mx-5" />
              <div className="flex items-center max-w-[500px]">
                <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
                  <Tooltip title={optRecord.checkNotes} placement="topLeft">
                    <span className="text-[#8C8C8C] mr-3">
                      财务审核备注:
                      {optRecord.checkNotes === undefined ||
                      optRecord.checkNotes === null
                        ? '暂无备注'
                        : optRecord.checkNotes}
                    </span>
                  </Tooltip>
                </div>

                {getInvoicingCheckAnnexList()}
              </div>
            </div>
          </Flex>
        ) : (
          ''
        )}
      </>
zhongnanhuang authored
1239
    );
zhongnanhuang authored
1240
  };
zhongnanhuang authored
1241
1242
1243
1244
1245
1246
  const expandedRowRender = (record) => {
    let subOrders = record.subOrderInformationLists;

    return (
      <ProTable
        id="sub-table"
zhongnanhuang authored
1247
        className="w-full "
zhongnanhuang authored
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
        showHeader={false}
        columns={[
          {
            title: 'ID',
            dataIndex: 'id',
            key: 'id',
            render: (text: any, optRecord: any) => {
              return <SubOderRander record={record} optRecord={optRecord} />;
            },
          },
        ]}
        rowSelection={{
          onChange: (selectedRowKeys: any, selectedRows: any) => {
            setSelectedRowKeys(selectedRowKeys);
            setSelectedRowObj({
              ...setSelectedRowObj,
              [record.id]: selectedRows,
            });
            selectedRowObj[record.id] = selectedRows;
            setSelectedRows(selectedRows);
          },
          selectedRowKeys: selectedRowKeys,
          // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
          // 注释该行则默认不显示下拉选项
          // selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
          // defaultSelectedRowKeys: [],
        }}
        rowKey="id"
        headerTitle={false}
        search={false}
        options={false}
        dataSource={subOrders}
        pagination={false}
zhongnanhuang authored
1281
        tableAlertRender={false}
zhongnanhuang authored
1282
1283
1284
1285
      />
    );
  };
1286
  // 主订单内容渲染
sanmu authored
1287
  const MainOrderColumnRender = ({ record }: { record: OrderListItemType }) => {
sanmu authored
1288
1289
1290
    return (
      <Flex vertical={true}>
        {/* 编号、时间、销售信息 */}
zhongnanhuang authored
1291
        <Flex
zhongnanhuang authored
1292
          className="px-4 py-4 bg-white rounded-t-lg"
zhongnanhuang authored
1293
1294
1295
1296
1297
1298
          justify="space-between"
        >
          <Flex wrap="wrap" gap="middle" vertical>
            <Flex>
              <Flex>
                <Checkbox
zhongnanhuang authored
1299
                  onChange={() => onCheckboxChange(record)}
zhongnanhuang authored
1300
1301
                  checked={selectedItems.includes(record.id)}
                >
zhongnanhuang authored
1302
1303
                  <Space split={<Divider type="vertical" />}>
                    <div>
zhongnanhuang authored
1304
                      <span className="text-[#8C8C8C]">订单号:</span>
zhongnanhuang authored
1305
                      <span className="text-slate-700">{record.id}</span>
zhongnanhuang authored
1306
1307
1308
1309
1310
                    </div>
                    <span>{formatDateTime(record.createTime)}</span>
                  </Space>
                </Checkbox>
                <Space split={<Divider type="vertical" />}>
zhongnanhuang authored
1311
                  <div>
zhongnanhuang authored
1312
                    <span className="text-[#8C8C8C]">代表:</span>
zhongnanhuang authored
1313
                    <span className="text-slate-700">{record.salesCode}</span>
zhongnanhuang authored
1314
                  </div>
zhongnanhuang authored
1315
1316
                  <div
                    title={record.institution}
zhongnanhuang authored
1317
                    className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]"
zhongnanhuang authored
1318
                  >
zhongnanhuang authored
1319
                    <span className="text-[#8C8C8C]">单位:</span>
zhongnanhuang authored
1320
                    <span className="text-slate-700">{record.institution}</span>
zhongnanhuang authored
1321
                  </div>
zhongnanhuang authored
1322
                  <span>
zhongnanhuang authored
1323
                    <span className="text-[#8C8C8C]">联系人:</span>
zhongnanhuang authored
1324
                    <span className="text-slate-700">
zhongnanhuang authored
1325
                      {record.institutionContactName + ' '}
zhongnanhuang authored
1326
1327
1328
1329
1330
1331
                    </span>
                  </span>
                  <span>
                    <span className="text-[#8C8C8C]">收货人:</span>
                    <span className="text-slate-700">
                      {record.customerName + ' '}
zhongnanhuang authored
1332
1333
1334
1335
1336
1337
1338
1339
1340
                      <Tooltip className="order-tooltip" title="详情">
                        <ContainerTwoTone
                          className="hover:curcor-pointer"
                          onClick={() => {
                            setDeliverInfoDrawerVisible(true);
                            setOrderRow(record);
                          }}
                        />
                      </Tooltip>
zhongnanhuang authored
1341
                    </span>
zhongnanhuang authored
1342
1343
                  </span>
                </Space>
zhongnanhuang authored
1344
              </Flex>
1345
            </Flex>
zhongnanhuang authored
1346
            <Flex className="pl-6" align="center">
zhongnanhuang authored
1347
              <div title={record.notes}>
zhongnanhuang authored
1348
                <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
zhongnanhuang authored
1349
1350
1351
1352
                  <span className="text-[#8C8C8C]">备注:</span>
                  <span className="ml-2">
                    {record.notes === undefined ? '暂无备注' : record.notes}
                  </span>
zhongnanhuang authored
1353
                </div>
zhongnanhuang authored
1354
              </div>
zhongnanhuang authored
1355
1356
              <Tooltip title="编辑">
                <EditTwoTone
zhongnanhuang authored
1357
                  className="pl-1 hover:curcor-pointer"
zhongnanhuang authored
1358
1359
1360
1361
1362
1363
1364
                  onClick={() => {
                    setNotesEditVisible(true);
                    setOrderRow(record);
                    setIsMainOrder(true);
                  }}
                />
              </Tooltip>
zhongnanhuang authored
1365
1366
1367
1368
1369
1370
            </Flex>
          </Flex>
          <Flex wrap="wrap" gap="middle" vertical>
            <Flex justify="flex-end">
              <Flex wrap="wrap" gap="middle" align="center">
                <div>
zhongnanhuang authored
1371
                  <span className="text-[#8C8C8C]">总金额:¥</span>
zhongnanhuang authored
1372
1373
1374
                  <span className="text-lg font-medium">
                    {record.totalPayment}
                  </span>
zhongnanhuang authored
1375
1376
                </div>
                {rolePath?.includes('addOrder') ? (
zhongnanhuang authored
1377
1378
1379
1380
                  <Tooltip title="复制">
                    <CopyTwoTone
                      className="hover:cursor-pointer"
                      onClick={() => {
1381
                        copyOrderToClipboard(record);
zhongnanhuang authored
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
                        setOrderOptType('copy');
                        setOrderDrawerVisible(true);
                        let copy = cloneDeep(record);
                        copy.id = undefined;
                        copy.subOrderInformationLists?.forEach((item) => {
                          item.id = undefined;
                        });
                        setOrderRow(copy);
                      }}
                    />
                  </Tooltip>
zhongnanhuang authored
1393
                ) : (
1394
1395
1396
1397
1398
1399
1400
1401
                  <Tooltip title="复制文本">
                    <CopyTwoTone
                      className="hover:cursor-pointer"
                      onClick={() => {
                        copyOrderToClipboard(record);
                      }}
                    />
                  </Tooltip>
zhongnanhuang authored
1402
                )}
zhongnanhuang authored
1403
zhongnanhuang authored
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
                <Tooltip title="历史">
                  <ClockCircleTwoTone
                    className="hover:cursor-pointer"
                    onClick={() => {
                      setHistoryModalVisible(true);
                      if (selectedRowObj[record.id]?.length) {
                        setSelectedRows(selectedRowObj[record.id]);
                      } else {
                        setSelectedRows(record.subOrderInformationLists);
                      }
                    }}
                  />
                </Tooltip>
zhongnanhuang authored
1417
1418
1419
1420
1421
              </Flex>
            </Flex>
            <Flex justify="flex-end">
              <Space.Compact direction="vertical" align="end">
                <Space>
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
                  {record.mainPath?.includes('procureConvertProcure') ? (
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        if (selectedSubOrders === undefined) {
                          selectedSubOrders = record.subOrderInformationLists;
                        }

                        setSelectedRows(selectedSubOrders);
                        for (let i = 0; i < selectedSubOrders.length; i++) {
                          if (
                            !selectedSubOrders[i].subPath.includes(
                              'procureConvertProcure',
                            )
                          ) {
                            message.error('请选择允许转发的子订单进行转发');
                            return;
                          }
                        }
                        setSelectedRows(selectedSubOrders);
                        setOrderCheckType(CHECK_TYPE.PROCURE);
                        setProcureConvertModalVisible(true);
                      }}
                    >
                      转发
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1453
                  {record.mainPath?.includes('sendProduct') ? (
zhongnanhuang authored
1454
1455
1456
1457
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
zhongnanhuang authored
1458
1459
1460
1461
                        if (!selectedRowObj[record.id]?.length) {
                          return message.error('请选择选择子订单');
                        }
                        setSelectedRows(selectedRowObj[record.id]);
zhongnanhuang authored
1462
                        setDeliverVisible(true);
zhongnanhuang authored
1463
                        setIsSendProduct(true);
zhongnanhuang authored
1464
                        setOrderCheckType(CHECK_TYPE.NORMAL);
zhongnanhuang authored
1465
1466
                      }}
                    >
zhongnanhuang authored
1467
                      仓库发货
zhongnanhuang authored
1468
1469
1470
1471
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1472
1473

                  {/* 供应商发货 */}
zhongnanhuang authored
1474
                  {record.mainPath?.includes('supplierSendOrder') ? (
zhongnanhuang authored
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        if (!selectedRowObj[record.id]?.length) {
                          return message.error('请选择选择子订单');
                        }
                        setSelectedRows(selectedRowObj[record.id]);
                        setDeliverVisible(true);
                        setIsSendProduct(true);
                        setOrderCheckType(CHECK_TYPE.SUPPLIER);
                      }}
                    >
                      供应商发货
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1493
zhongnanhuang authored
1494
                  {record.mainPath?.includes('procureSend') ? (
zhongnanhuang authored
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        if (!selectedRowObj[record.id]?.length) {
                          return message.error('请选择选择子订单');
                        }
                        setSelectedRows(selectedRowObj[record.id]);
                        setDeliverVisible(true);
                        setIsSendProduct(true);
                        setOrderCheckType(CHECK_TYPE.PROCURE);
                      }}
                    >
                      采购发货
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1514
                  {record.mainPath?.includes('printOrder') ? (
zhongnanhuang authored
1515
1516
1517
1518
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
zhongnanhuang authored
1519
1520
                        const selectedSubOrders = selectedRowObj[record.id];
                        if (!selectedSubOrders?.length) {
zhongnanhuang authored
1521
1522
                          return message.error('请选择选择子订单');
                        }
zhongnanhuang authored
1523
1524
1525
1526
1527
1528
1529
1530

                        for (let subOrderRecord of selectedSubOrders) {
                          let subPath = subOrderRecord.subPath;
                          if (!checkePrintable(subPath)) {
                            return message.error('请选择可以打印的子订单');
                          }
                        }
                        setSelectedRows(selectedSubOrders);
zhongnanhuang authored
1531
1532
                        setOrderRow(record);
                        setOrderPrintVisible(true);
zhongnanhuang authored
1533
                        setOrderCheckType(CHECK_TYPE.NORMAL);
zhongnanhuang authored
1534
1535
                      }}
                    >
zhongnanhuang authored
1536
                      仓库打印
zhongnanhuang authored
1537
1538
1539
1540
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1541
zhongnanhuang authored
1542
                  {record.mainPath?.includes('supplierPrint') ? (
zhongnanhuang authored
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        if (!selectedRowObj[record.id]?.length) {
                          return message.error('请选择选择子订单');
                        }
                        setSelectedRows(selectedRowObj[record.id]);
                        setOrderRow(record);
                        setOrderPrintVisible(true);
                        setOrderCheckType(CHECK_TYPE.SUPPLIER);
                      }}
                    >
zhongnanhuang authored
1556
                      供应商打印
zhongnanhuang authored
1557
1558
1559
1560
1561
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1562
                  {record.mainPath?.includes('rePrintOrder') ? (
zhongnanhuang authored
1563
1564
1565
1566
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
zhongnanhuang authored
1567
1568
1569
1570
                        if (!selectedRowObj[record.id]?.length) {
                          return message.error('请选择选择子订单');
                        }
                        setSelectedRows(selectedRowObj[record.id]);
1571
                        setOrderRow(record);
zhongnanhuang authored
1572
1573
                        setOrderPrintVisible(true);
                        setIsRePrintOrder(true);
zhongnanhuang authored
1574
1575
                      }}
                    >
zhongnanhuang authored
1576
                      重新打印
zhongnanhuang authored
1577
1578
1579
1580
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1581
                  {record.mainPath?.includes('modifySendInformation') ? (
zhongnanhuang authored
1582
                    <Button
zhongnanhuang authored
1583
                      className="p-0"
zhongnanhuang authored
1584
1585
                      type="link"
                      onClick={() => {
zhongnanhuang authored
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
                        if (!selectedRowObj[record.id]?.length) {
                          return message.error(
                            '请选择已经发货或者已经确认收货的子订单',
                          );
                        }
                        for (let row of selectedRowObj[record.id]) {
                          if (
                            row.orderStatus !== 'CONFIRM_RECEIPT' &&
                            row.orderStatus !== 'SHIPPED'
                          ) {
                            return message.error(
                              '请选择已经发货或者已经确认收货的子订单',
                            );
                          }
                        }
                        setSelectedRows(selectedRowObj[record.id]);
                        setDeliverVisible(true);
                        setIsSendProduct(false);
zhongnanhuang authored
1604
1605
                      }}
                    >
zhongnanhuang authored
1606
                      修改发货信息
zhongnanhuang authored
1607
                    </Button>
zhongnanhuang authored
1608
1609
1610
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1611
                  {record.mainPath?.includes('invoicing') ? (
zhongnanhuang authored
1612
1613
                    <Button
                      type="link"
zhongnanhuang authored
1614
                      className="p-0"
zhongnanhuang authored
1615
                      onClick={() => {
zhongnanhuang authored
1616
1617
1618
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1619
                          setIsMainOrder(true);
zhongnanhuang authored
1620
                          setSelectedRows(record.subOrderInformationLists);
zhongnanhuang authored
1621
1622
                        } else {
                          setIsMainOrder(false);
zhongnanhuang authored
1623
                        }
zhongnanhuang authored
1624
                        setOrderRow(record);
zhongnanhuang authored
1625
                        setFinancialVisible(true);
zhongnanhuang authored
1626
                        setIsEdit(false);
zhongnanhuang authored
1627
1628
                      }}
                    >
zhongnanhuang authored
1629
                      开票
zhongnanhuang authored
1630
1631
1632
1633
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659

                  {record.mainPath?.includes('applyInvoicing') ? (
                    <Button
                      type="link"
                      className="p-0"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        if (selectedSubOrders === undefined) {
                          selectedSubOrders = record.subOrderInformationLists;
                        }

                        setSelectedRows(selectedSubOrders);
                        for (let i = 0; i < selectedSubOrders.length; i++) {
                          if (
                            selectedSubOrders[i].invoicingStatus ===
                              'UN_INVOICE' ||
                            selectedSubOrders[i].afterInvoicingStatus ===
                              'APPLY_FOR_INVOICING'
                          ) {
                            message.error(
                              '请选择需要开票且未申请开票的子订单进行申请',
                            );
                            return;
                          }
                        }
                        setApplyForInvoicingVisible(true);
zhongnanhuang authored
1660
                        setIsEdit(false);
zhongnanhuang authored
1661
                        setIsMainOrder(false);
zhongnanhuang authored
1662
1663
1664
1665
1666
1667
1668
1669
                      }}
                    >
                      申请开票
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1670
                  {record.mainPath?.includes('updateOrder') ? (
zhongnanhuang authored
1671
1672
1673
1674
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
zhongnanhuang authored
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
                        //勾选的子订单:如果有勾选,后面只校验有勾选的
                        let selectedSubOrders = selectedRowObj[record.id];
                        if (
                          selectedSubOrders === undefined ||
                          selectedSubOrders.length === 0
                        ) {
                          selectedSubOrders = record.subOrderInformationLists;
                        }
                        for (
                          let index = 0;
                          index < selectedSubOrders.length;
                          index++
                        ) {
                          let orderStatus =
                            selectedSubOrders[index].orderStatus;
                          //是审核通过及之后的订单
                          if (
                            orderStatus !== 'UNAUDITED' &&
                            orderStatus !== 'AUDIT_FAILED'
                          ) {
                            message.error(
                              '请选择未审核或者审核失败的订单进行编辑',
                            );
                            return;
                          }
                        }
                        setOrderDrawerVisible(true);
                        setOrderRow(record);
                        setSelectedRows(selectedSubOrders);
                        setOrderOptType('edit');
zhongnanhuang authored
1705
1706
                      }}
                    >
zhongnanhuang authored
1707
                      编辑
zhongnanhuang authored
1708
1709
1710
1711
                    </Button>
                  ) : (
                    ''
                  )}
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
                  {record.mainPath?.includes('noNeedInvoicingEdit') ? (
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = record.subOrderInformationLists;
                        setFinancialEditVisible(true);
                        setSelectedRows(selectedSubOrders);
                        setOrderRow(record);
                        setIsMainOrder(true);
                      }}
                    >
                      财务编辑
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1731
                  {record.mainPath?.includes('checkOrder') ? (
zhongnanhuang authored
1732
1733
1734
1735
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
zhongnanhuang authored
1736
1737
1738
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1739
                          selectedSubOrders = record.subOrderInformationLists;
zhongnanhuang authored
1740
                        }
zhongnanhuang authored
1741
                        for (let i = 0; i < selectedSubOrders.length; i++) {
zhongnanhuang authored
1742
                          if (
zhongnanhuang authored
1743
1744
1745
                            selectedSubOrders[i].orderStatus !== 'UNAUDITED' &&
                            selectedSubOrders[i].orderStatus !==
                              'FINANCE_PROCESS'
zhongnanhuang authored
1746
1747
1748
1749
1750
1751
1752
                          ) {
                            message.error('请选择未审核的子订单进行审核');
                            return;
                          }
                        }
                        setOrderRow(record);
                        setCheckVisible(true);
zhongnanhuang authored
1753
                        setSelectedRows(selectedSubOrders);
zhongnanhuang authored
1754
1755
1756
1757
1758
1759
1760
1761
1762
                        setOrderCheckType(CHECK_TYPE.NORMAL);
                      }}
                    >
                      审核
                    </Button>
                  ) : (
                    ''
                  )}
1763
                  {record.mainPath?.includes('afterSalesCheck') ? (
1764
1765
1766
1767
1768
1769
1770
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1771
                          selectedSubOrders = record.subOrderInformationLists;
1772
                        }
zhongnanhuang authored
1773
                        for (let i = 0; i < selectedSubOrders.length; i++) {
1774
                          if (
zhongnanhuang authored
1775
1776
                            selectedSubOrders[i].orderStatus !==
                            'IN_AFTER_SALES'
1777
1778
                          ) {
                            message.error('请选择售后中的子订单进行审核');
1779
1780
1781
1782
1783
                            return;
                          }
                        }
                        setOrderRow(record);
                        setCheckVisible(true);
zhongnanhuang authored
1784
                        setSelectedRows(selectedSubOrders);
1785
1786
1787
1788
1789
1790
1791
1792
1793
                        setOrderCheckType(CHECK_TYPE.AFTER_SALES);
                      }}
                    >
                      售后审核
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
                  {record.mainPath?.includes('noNeedSend') ? (
                    <ButtonConfirm
                      className="p-0"
                      title="此订单是否无需发货?"
                      text="无需发货"
                      onConfirm={async () => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        if (selectedSubOrders === undefined) {
                          selectedSubOrders = record.subOrderInformationLists;
                        }
                        setSelectedRows(selectedSubOrders);
                        for (let i = 0; i < selectedSubOrders.length; i++) {
                          if (
zhongnanhuang authored
1807
                            selectedSubOrders[i].orderStatus !== 'AUDITED' &&
zhongnanhuang authored
1808
                            selectedSubOrders[i].orderStatus !==
zhongnanhuang authored
1809
1810
1811
1812
1813
1814
1815
1816
                              'PROCURE_PROCESS' &&
                            selectedSubOrders[i].orderStatus !==
                              'PROCURE_PROCESS_FOR_MINE' &&
                            selectedSubOrders[i].orderStatus !==
                              'PROCURE_WAIT_SHIP' &&
                            selectedSubOrders[i].orderStatus !==
                              'SUPPLIER_WAIT_SHIP' &&
                            selectedSubOrders[i].orderStatus !== 'WAIT_SHIP'
zhongnanhuang authored
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
                          ) {
                            message.error(
                              '请选择未发货的子订单进行无需发货操作',
                            );
                            return;
                          }
                        }

                        const data = await postServiceOrderNoNeedSend({
                          data: {
                            ids: selectedSubOrders.map((item) => {
                              return item.id;
                            }),
                          },
                        });
                        if (data.result === RESPONSE_CODE.SUCCESS) {
                          message.success(data.message);
                          refreshTable();
                        }
                      }}
                    />
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1842
                  {/* 财务审核:主订单暂无 */}
zhongnanhuang authored
1843
                  {record.mainPath?.includes('financeCheckOrder') ? (
zhongnanhuang authored
1844
1845
1846
1847
1848
1849
1850
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1851
                          selectedSubOrders = record.subOrderInformationLists;
zhongnanhuang authored
1852
                        }
zhongnanhuang authored
1853
                        for (let i = 0; i < selectedSubOrders.length; i++) {
zhongnanhuang authored
1854
                          if (
zhongnanhuang authored
1855
1856
1857
                            selectedSubOrders[i].orderStatus !== 'UNAUDITED' &&
                            selectedSubOrders[i].orderStatus !==
                              'FINANCE_PROCESS'
zhongnanhuang authored
1858
                          ) {
zhongnanhuang authored
1859
                            message.error('请选择未审核的子订单进行审核');
zhongnanhuang authored
1860
1861
1862
                            return;
                          }
                        }
zhongnanhuang authored
1863
                        setOrderRow(record);
zhongnanhuang authored
1864
                        setCheckVisible(true);
zhongnanhuang authored
1865
                        setSelectedRows(selectedSubOrders);
zhongnanhuang authored
1866
                        setOrderCheckType(CHECK_TYPE.FINALCIAL);
zhongnanhuang authored
1867
1868
                      }}
                    >
zhongnanhuang authored
1869
1870
1871
1872
1873
1874
1875
                      财务审核
                    </Button>
                  ) : (
                    ''
                  )}

                  {/* 采购审核 */}
zhongnanhuang authored
1876
                  {record.mainPath?.includes('procureCheckOrder') ? (
zhongnanhuang authored
1877
1878
1879
1880
1881
1882
1883
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1884
                          selectedSubOrders = record.subOrderInformationLists;
zhongnanhuang authored
1885
                        }
zhongnanhuang authored
1886
                        for (let i = 0; i < selectedSubOrders.length; i++) {
zhongnanhuang authored
1887
                          if (
zhongnanhuang authored
1888
1889
                            selectedSubOrders[i].orderStatus !==
                            'PROCURE_UN_PROCESS'
zhongnanhuang authored
1890
1891
1892
1893
1894
1895
1896
                          ) {
                            message.error('请选择未审核的子订单进行审核');
                            return;
                          }
                        }
                        setOrderRow(record);
                        setProcureCheckModalVisible(true);
zhongnanhuang authored
1897
                        setSelectedRows(selectedSubOrders);
zhongnanhuang authored
1898
1899
1900
1901
                        setOrderCheckType(CHECK_TYPE.PROCURE);
                      }}
                    >
                      采购审核
zhongnanhuang authored
1902
1903
1904
1905
1906
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1907
                  {record.mainPath?.includes('applyAfterSales') ? (
zhongnanhuang authored
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        if (selectedSubOrders === undefined) {
                          selectedSubOrders = record.subOrderInformationLists;
                        }
                        setSelectedRows(selectedSubOrders);
                        for (let i = 0; i < selectedSubOrders.length; i++) {
                          if (
                            selectedSubOrders[i].orderStatus !==
                            'CONFIRM_RECEIPT'
                          ) {
                            message.error('请选择确认收货状态的子订单进行售后');
                            return;
                          }
                        }
                        setAfterSalesDrawerVisible(true);
                        setOrderRow(record);
                      }}
                    >
                      申请售后
                    </Button>
                  ) : (
                    ''
                  )}
1936
                  {/* {record.mainPath?.includes('afterSalesCompletion') ? (
zhongnanhuang authored
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
                    <ButtonConfirm
                      className="p-0"
                      title="售后是否已完成?"
                      text="完成售后"
                      onConfirm={async () => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        if (selectedSubOrders === undefined) {
                          selectedSubOrders = record.subOrderInformationLists;
                        }
                        for (let i = 0; i < selectedSubOrders.length; i++) {
                          if (
                            selectedSubOrders[i].orderStatus !==
                            'IN_AFTER_SALES'
                          ) {
                            message.error(
                              '请选择售后中状态的子订单进行完成售后',
                            );
                            return false;
                          }
                        }

                        const ids = selectedSubOrders?.map((item) => {
                          return item.id;
                        });

                        let body = {
                          ids: ids,
                        };
                        const data = await postServiceOrderAfterSalesCompletion(
                          {
                            data: body,
                          },
                        );
                        if (data.result === RESPONSE_CODE.SUCCESS) {
                          message.success(data.message);
                          refreshTable();
                        }
                      }}
                    />
                  ) : (
                    ''
1978
                  )} */}
zhongnanhuang authored
1979
zhongnanhuang authored
1980
                  {record.mainPath?.includes('orderCancel') ? (
zhongnanhuang authored
1981
                    <ButtonConfirm
zhongnanhuang authored
1982
                      className="p-0"
zhongnanhuang authored
1983
1984
1985
                      title="确认作废?"
                      text="作废"
                      onConfirm={async () => {
zhongnanhuang authored
1986
1987
1988
1989
                        let body = {
                          ids: [record.id],
                          checkIsMainOrderId: true,
                        };
zhongnanhuang authored
1990
1991
1992
1993
1994
1995
1996
                        const data = await postServiceOrderOrderCancel({
                          data: body,
                        });
                        if (data.result === RESPONSE_CODE.SUCCESS) {
                          message.success(data.message);
                          refreshTable();
                        }
zhongnanhuang authored
1997
                      }}
zhongnanhuang authored
1998
                    />
zhongnanhuang authored
1999
2000
2001
                  ) : (
                    ''
                  )}
zhongnanhuang authored
2002
zhongnanhuang authored
2003
                  {record.mainPath?.includes('procurePrint') ? (
zhongnanhuang authored
2004
                    <ButtonConfirm
zhongnanhuang authored
2005
                      className="p-0"
zhongnanhuang authored
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
                      title="确认打印?"
                      text="采购打印"
                      onConfirm={async () => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        if (selectedSubOrders === undefined) {
                          selectedSubOrders = record.subOrderInformationLists;
                        }
                        for (let i = 0; i < selectedSubOrders.length; i++) {
                          if (
                            selectedSubOrders[i].orderStatus !==
                            'PROCURE_PROCESS_FOR_MINE'
                          ) {
                            message.error(
                              '请选择采购待打印状态的子订单进行打印',
                            );
                            return false;
                          }
                        }

                        const ids = selectedSubOrders?.map((item) => {
                          return item.id;
                        });
                        let res = await postServiceOrderProcurePrint({
                          data: {
                            ids: ids,
                          },
                        });

                        if (res.result === RESPONSE_CODE.SUCCESS) {
                          message.success(res.message);
                          refreshTable();
zhongnanhuang authored
2037
2038
                        }
                      }}
zhongnanhuang authored
2039
                    />
zhongnanhuang authored
2040
                  ) : (
zhongnanhuang authored
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
                    // <Button
                    //   className="p-0"
                    //   type="link"
                    //   onClick={() => {
                    //     if (!selectedRowObj[record.id]?.length) {
                    //       return message.error('请选择选择子订单');
                    //     }
                    //     setSelectedRows(selectedRowObj[record.id]);
                    //     setOrderRow(record);
                    //     setOrderPrintVisible(true);
                    //     setOrderCheckType(CHECK_TYPE.PROCURE);
                    //   }}
                    // >
                    //   采购打印
                    // </Button>
zhongnanhuang authored
2056
2057
                    ''
                  )}
zhongnanhuang authored
2058
2059
2060
2061
2062
2063
                </Space>
              </Space.Compact>
            </Flex>
          </Flex>
        </Flex>
zhongnanhuang authored
2064
        <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg">
zhongnanhuang authored
2065
2066
2067
          {expandedRowRender(record)}
        </Flex>
      </Flex>
2068
2069
2070
    );
  };
zhongnanhuang authored
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
  // 主订单列表
  const mainOrdersColumns: ProColumns<OrderType>[] = MAIN_ORDER_COLUMNS.map(
    (item) => {
      if (item.dataIndex === 'name') {
        return {
          ...item,
          title: <OrderTableHeader />,
          render: (text, record) => {
            return <MainOrderColumnRender record={record} />;
          },
        };
      }
      return item;
    },
  );
2087
  //判断是否是采购,是的话新增一个筛选条件
2088
2089
2090
2091
  if (
    userInfo?.roleSmallVO?.code === 'procure' ||
    userInfo?.roleSmallVO?.code === 'admin'
  ) {
2092
2093
2094
2095
2096
2097
2098
2099
2100
    mainOrdersColumns.push({
      title: '采购下单状态',
      dataIndex: 'procureOrderStatus',
      valueType: 'select',
      hideInTable: true,
      valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS),
    });
  }
zhongnanhuang authored
2101
  function toolBarRender() {
zhongnanhuang authored
2102
    let roleCode = userInfo?.roleSmallVO?.code;
zhongnanhuang authored
2103
2104
    let toolBtns = [];
zhongnanhuang authored
2105
2106
2107
2108
    toolBtns.push(
      <Checkbox onChange={changeCancelOrderShow}>只看作废</Checkbox>,
    );
zhongnanhuang authored
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
    //采购可以筛选出需要处理的订单
    if (roleCode === 'procure') {
      toolBtns.push(
        <Checkbox onChange={changeProcureToBeProcessed}>只看需处理</Checkbox>,
      );
    }

    //财务可以将需要处理的订单排序到前面
    if (roleCode === 'finance') {
      toolBtns.push(
        <Checkbox onChange={changeFinancialToBeProcessed}>排序</Checkbox>,
      );
    }

    if (roleCode === 'admin') {
      toolBtns.push(
        <Checkbox onChange={changeProcureToBeProcessed}>
          只看需处理(采购)
        </Checkbox>,
      );
      toolBtns.push(
        <Checkbox onChange={changeFinancialToBeProcessed}>排序</Checkbox>,
      );
    }
zhongnanhuang authored
2134
2135
2136
    //导出按钮配置
    const items: MenuProps['items'] = [
      {
zhongnanhuang authored
2137
2138
2139
2140
2141
2142
2143
2144
2145
        label: '导出查询结果订单',
        key: '2',
        onClick: async () => {
          let body = { flag: 50, ...searchParams };
          exportLoading();
          orderExport('/api/service/order/export', body, exportLoadingDestory);
        },
      },
      {
zhongnanhuang authored
2146
2147
2148
2149
2150
2151
2152
        label: '导出已选中订单',
        key: '1',
        onClick: async () => {
          if (selectedItems.length === 0) {
            message.error('请选择订单');
            return;
          }
zhongnanhuang authored
2153
          let body = { flag: 30, ids: selectedItems };
zhongnanhuang authored
2154
          exportLoading();
zhongnanhuang authored
2155
          orderExport('/api/service/order/export', body, exportLoadingDestory);
zhongnanhuang authored
2156
2157
        },
      },
zhongnanhuang authored
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
      // {
      //   label: '导出当前页订单',
      //   key: '2',
      //   onClick: async () => {
      //     if (mainOrderAllItemKeys.length === 0) {
      //       message.error('当前没有订单');
      //       return;
      //     }
      //     let body = { flag: 20, ids: mainOrderAllItemKeys };
      //     exportLoading();
      //     orderExport('/api/service/order/export', body, exportLoadingDestory);
      //   },
      // },
zhongnanhuang authored
2171
      {
zhongnanhuang authored
2172
2173
        label: '导出当天订单',
        key: '4',
zhongnanhuang authored
2174
        onClick: async () => {
zhongnanhuang authored
2175
          let body = { flag: 40, ids: [] };
zhongnanhuang authored
2176
          exportLoading();
zhongnanhuang authored
2177
          orderExport('/api/service/order/export', body, exportLoadingDestory);
zhongnanhuang authored
2178
2179
2180
2181
2182
2183
        },
      },
      {
        label: '导出所有订单',
        key: '3',
        onClick: async () => {
zhongnanhuang authored
2184
2185
2186
2187
2188
          let body = { flag: 10, ids: [] };
          exportLoading();
          orderExport('/api/service/order/export', body, exportLoadingDestory);
        },
      },
zhongnanhuang authored
2189
2190
2191
2192
2193
2194
2195
    ];

    const menuProps = {
      items,
      onClick: () => {},
    };
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
    if (rolePath?.includes('mergeApplyInvoicing')) {
      toolBtns.push(
        <Button
          type="primary"
          key="out"
          onClick={() => {
            setApplyForInvoicingVisible(true);
            //选中订单
            setIsEdit(false);
            setIsMainOrder(true);
          }}
          disabled={selectedItems?.length === 0}
        >
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
          {userInfo?.roleSmallVO?.code === 'admin' ? '合并(销售)' : '合并开票'}
        </Button>,
      );
    }

    if (rolePath?.includes('mergeInvoicing')) {
      toolBtns.push(
        <Button
          type="primary"
          key="out"
          onClick={() => {
            //检查订单状态是否正确
            // 遍历Map中的键值对
            let errorIds = [];
            let mainOrders = [];
            mainOrderSelectedMap.forEach((value) => {
              mainOrders.push(value);
              for (let subOrder of value.subOrderInformationLists) {
                if (subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING') {
                  errorIds.push(value.id);
                  return;
                }
              }
            });
            if (errorIds.length > 0) {
              message.error(
                '订单号为:' +
                  errorIds.join(',') +
                  '的订单存在不是[申请开票]状态的子订单,请检查!',
              );
              return;
            }

            setMainOrderSelectedRows(mainOrders);
            setFinancialMergeDrawerVisible(true);
          }}
          disabled={selectedItems?.length === 0}
        >
          {userInfo?.roleSmallVO?.code === 'admin' ? '合并(财务)' : '合并开票'}
2248
2249
2250
2251
        </Button>,
      );
    }
2252
    if (rolePath?.includes('addOrder')) {
zhongnanhuang authored
2253
2254
2255
2256
      toolBtns.push(
        <Button
          type="primary"
          key="out"
zhongnanhuang authored
2257
2258
          onClick={() => {
            setOrderDrawerVisible(true);
2259
            setOrderOptType('add');
zhongnanhuang authored
2260
          }}
zhongnanhuang authored
2261
2262
2263
2264
2265
        >
          新增
        </Button>,
      );
    }
2266
zhongnanhuang authored
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
    if (rolePath?.includes('importExcel')) {
      toolBtns.push(
        <Button
          type="primary"
          key="out"
          onClick={() => {
            setImportModalVisible(true);
          }}
        >
          导入
        </Button>,
      );
    }
zhongnanhuang authored
2280
zhongnanhuang authored
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
    if (rolePath?.includes('export')) {
      toolBtns.push(
        <Dropdown menu={menuProps}>
          <Button>
            <Space>
              导出
              <DownOutlined />
            </Space>
          </Button>
        </Dropdown>,
      );
    }
zhongnanhuang authored
2293
zhongnanhuang authored
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
    // toolBtns.push(
    //   <Button
    //     key="show"
    //     onClick={() => {
    //       handleAllExpand();
    //     }}
    //   >
    //     {mainOrderAllItemKeys?.length !== expandedRowKeys.length
    //       ? '一键展开'
    //       : '一键收起'}
    //   </Button>,
    // );
zhongnanhuang authored
2306
2307
2308
2309

    return toolBtns;
  }
calmound authored
2310
2311
  return (
    <PageContainer
zhongnanhuang authored
2312
      className="order-page-container"
calmound authored
2313
      header={{
sanmu authored
2314
        title: '订单管理',
zhongnanhuang authored
2315
2316
        extra: [
          <Avatar key="0" style={{ verticalAlign: 'middle' }} size="large">
zhongnanhuang authored
2317
            {userInfo?.username}
zhongnanhuang authored
2318
          </Avatar>,
zhongnanhuang authored
2319
          <Tag key="nickName">{userInfo?.nickName}</Tag>,
zhongnanhuang authored
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
          <Dropdown
            key="dropdown"
            trigger={['click']}
            menu={{
              items: [
                {
                  label: '退出登录',
                  key: '1',
                  onClick: () => {
                    localStorage.removeItem('token');
                    history.push('/login');
                  },
                },
2333
2334
2335
2336
                // {
                //   label: '修改密码',
                //   key: '2',
                // },
zhongnanhuang authored
2337
2338
2339
2340
2341
2342
2343
2344
              ],
            }}
          >
            <Button key="4" style={{ padding: '0 8px' }}>
              <EllipsisOutlined />
            </Button>
          </Dropdown>,
        ],
calmound authored
2345
2346
      }}
    >
2347
      <div id="resizeDiv"></div>
2348
      <ProTable
zhongnanhuang authored
2349
2350
2351
        id="main-table"
        // tableStyle={{backgroundColor:'red'}}
2352
        actionRef={mainTableRef}
2353
2354
2355
2356
2357
        expandIconColumnIndex={-1}
        columns={mainOrdersColumns}
        rowKey="id"
        pagination={{
          showQuickJumper: true,
zhongnanhuang authored
2358
2359
2360
2361
2362
2363
2364
          pageSize: pageSize,
          current: currentPage,
          showSizeChanger: true,
          onChange: (page, size) => {
            setPageSize(size);
            setCurrentPage(page);
          },
calmound authored
2365
        }}
zhongnanhuang authored
2366
        // showHeader={false}
2367
        expandedRowKeys={expandedRowKeys}
zhongnanhuang authored
2368
        // expandable={{ expandedRowRender }}
2369
2370
        dateFormatter="string"
        options={false}
zhongnanhuang authored
2371
        headerTitle=""
2372
2373
        search={{
          labelWidth: 'auto',
zhongnanhuang authored
2374
          // onCollapse: resize,
2375
2376
2377
2378
        }}
        request={async (
          // 第一个参数 params 查询表单和 params 参数的结合
          // 第一个参数中一定会有 pageSize 和  current ,这两个参数是 antd 的规范
zhongnanhuang authored
2379
          params,
2380
          sorter,
sanmu authored
2381
2382
          filter,
        ) => {
2383
2384
          //订单id处理
          if (params.id !== '') {
2385
            if (params.id?.indexOf(',')) {
2386
2387
2388
2389
2390
2391
              params.id = params.id.split(',');
              params.id = params.id.filter((id) => {
                return id !== '';
              });
            }
          }
zhongnanhuang authored
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
          //采购是否只查看需要自己处理的
          if (onlyShowProcureToBeProcessed) {
            params.condition = 10;
          }

          //财务是否只查看需要自己处理的
          if (onlyShowFinancialToBeProcessed) {
            params.condition = 20;
          }

          //是否只查看已作废
          params.isDeleteQueryOrder = onlyShowCancelOrder;
          //保存这个搜索条件
zhongnanhuang authored
2405
          setSearchParam(params);
2406
          const { data } = await postServiceOrderQueryServiceOrder({
2407
            // ...params,
calmound authored
2408
2409
2410
2411
            // FIXME: remove @ts-ignore
            // @ts-ignore
            sorter,
            filter,
zhongnanhuang authored
2412
            data: { ...params },
calmound authored
2413
          });
zhongnanhuang authored
2414
zhongnanhuang authored
2415
2416
2417
2418
2419
2420
2421
          let mainOrderIds = data?.data?.map((d) => d.id);
          if (mainOrderAllItemKeys === undefined) {
            setMainOrderAllItemKeys([]);
          } else {
            setMainOrderAllItemKeys(mainOrderIds);
          }
          setRolePath(data.specialPath);
zhongnanhuang authored
2422
          handleTableExpand(mainOrderIds);
2423
          setData(data?.data);
calmound authored
2424
          return {
2425
            data: data?.data || [],
zhongnanhuang authored
2426
            total: data?.total || 0,
calmound authored
2427
2428
          };
        }}
2429
2430
2431
        toolbar={{
          multipleLine: true,
        }}
zhongnanhuang authored
2432
2433
2434
        toolBarRender={() => {
          return toolBarRender();
        }}
2435
2436
      />
sanmu authored
2437
      {orderDrawerVisible && (
sanmu authored
2438
        <OrderDrawer
2439
          data={orderRow}
2440
          subOrders={selectedRows}
zhongnanhuang authored
2441
          onClose={(isSuccess: boolean) => {
sanmu authored
2442
            setOrderDrawerVisible(false);
2443
            setOrderRow({});
zhongnanhuang authored
2444
2445
2446
            if (isSuccess) {
              refreshTable();
            }
calmound authored
2447
          }}
2448
          orderOptType={orderOptType}
calmound authored
2449
        />
sanmu authored
2450
      )}
sanmu authored
2451
2452
2453
2454

      {checkVisible && (
        <CheckModal
          setCheckVisible={setCheckVisible}
2455
          data={orderRow}
2456
          subOrders={selectedRows}
zhongnanhuang authored
2457
          orderCheckType={orderCheckType}
sanmu authored
2458
2459
2460
          onClose={() => {
            setCheckVisible(false);
            setOrderRow({});
2461
            setSelectedRows({});
zhongnanhuang authored
2462
            refreshTable();
2463
2464
2465
2466
          }}
        />
      )}
zhongnanhuang authored
2467
2468
2469
      {applyForInvoicingVisible && (
        <ApplyForInvoicingModal
          setCheckVisible={setApplyForInvoicingVisible}
zhongnanhuang authored
2470
          data={selectedItems}
zhongnanhuang authored
2471
          subOrders={selectedRows}
2472
          isMainOrder={isMainOrder}
zhongnanhuang authored
2473
          isEdit={isEdit}
zhongnanhuang authored
2474
2475
2476
          onClose={() => {
            setApplyForInvoicingVisible(false);
            setSelectedRows({});
zhongnanhuang authored
2477
            setIsMainOrder(false);
zhongnanhuang authored
2478
2479
2480
2481
2482
            refreshTable();
          }}
        />
      )}
2483
      {notesEditVisible && (
zhongnanhuang authored
2484
        <OrderNotesEditModal
2485
2486
          setNotesEditVisible={setNotesEditVisible}
          data={orderRow}
zhongnanhuang authored
2487
          isMianOrder={isMainOrder}
2488
2489
2490
          onClose={() => {
            setNotesEditVisible(false);
            setOrderRow({});
zhongnanhuang authored
2491
            refreshTable();
sanmu authored
2492
2493
2494
2495
2496
2497
2498
          }}
        />
      )}

      {deliverVisible && (
        <DeliverModal
          data={selectedRows}
zhongnanhuang authored
2499
          isSendProduct={isSendProduct}
zhongnanhuang authored
2500
2501
2502
          setVisible={(b: boolean) => {
            setDeliverVisible(b);
          }}
zhongnanhuang authored
2503
          sendType={orderCheckType}
sanmu authored
2504
          onClose={() => {
zhongnanhuang authored
2505
            setDeliverVisible(false);
sanmu authored
2506
            setOrderRow({});
zhongnanhuang authored
2507
2508
            setIsSendProduct(false);
            refreshTable();
sanmu authored
2509
2510
2511
          }}
        />
      )}
zhongnanhuang authored
2512
2513
2514

      {financialVisible && (
        <FinancialDrawer
zhongnanhuang authored
2515
          isEdit={isEdit}
zhongnanhuang authored
2516
2517
          mainOrder={orderRow}
          subOrders={selectedRows}
zhongnanhuang authored
2518
          isMainOrder={isMainOrder}
zhongnanhuang authored
2519
2520
2521
2522
          cancel={() => {
            setFinancialVisible(false);
            setOrderRow({});
            setIsMainOrder(false);
zhongnanhuang authored
2523
            setIsEdit(false);
zhongnanhuang authored
2524
          }}
zhongnanhuang authored
2525
2526
2527
          onClose={() => {
            setFinancialVisible(false);
            setOrderRow({});
zhongnanhuang authored
2528
            refreshTable();
zhongnanhuang authored
2529
            setIsMainOrder(false);
zhongnanhuang authored
2530
            setIsEdit(false);
zhongnanhuang authored
2531
2532
2533
2534
          }}
        />
      )}
2535
2536
      {financialEditVisible && (
        <FinancialEditDrawer
2537
          mainOrder={orderRow}
2538
          subOrders={selectedRows}
2539
          isMainOrder={isMainOrder}
2540
2541
2542
2543
2544
2545
2546
2547
          setVisible={() => {
            setFinancialEditVisible(false);
            setIsMainOrder(false);
          }}
          onClose={() => {
            setFinancialEditVisible(false);
            refreshTable();
            setIsMainOrder(false);
2548
            setOrderRow({});
2549
2550
2551
2552
          }}
        />
      )}
zhongnanhuang authored
2553
2554
2555
2556
      {orderPrintVisible && (
        <OrderPrintModal
          mainOrder={orderRow}
          subOrders={selectedRows}
zhongnanhuang authored
2557
          isRePrint={isRePrintOrder}
zhongnanhuang authored
2558
2559
2560
          setVisible={(b: boolean) => {
            setOrderPrintVisible(b);
          }}
zhongnanhuang authored
2561
          printOptType={orderCheckType}
zhongnanhuang authored
2562
2563
2564
          onClose={() => {
            setOrderPrintVisible(false);
            setOrderRow({});
zhongnanhuang authored
2565
2566
            setIsRePrintOrder(false);
            refreshTable();
zhongnanhuang authored
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
          }}
        />
      )}

      {confirmReceiptVisible && (
        <ConfirmReceiptModal
          data={orderRow}
          onClose={() => {
            setConfirmReceiptVisible(false);
            setOrderRow({});
zhongnanhuang authored
2577
            refreshTable();
zhongnanhuang authored
2578
2579
2580
          }}
        />
      )}
zhongnanhuang authored
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591

      {subOrderConfirmReceiptImagesVisible && (
        <SubOrderComfirmReceiptImagesModal
          setVisible={setSubOrderConfirmReceiptImagesVisible}
          onClose={() => {
            setSubOrderConfirmReceiptImagesVisible(false);
          }}
          orderRow={orderRow}
        />
      )}
zhongnanhuang authored
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
      {importModalVisible && (
        <ImportModal
          onClose={() => {
            setImportModalVisible(false);
            refreshTable();
          }}
        />
      )}

      {attachmentModalVisible && (
        <AttachmentModal
          data={orderRow}
          onClose={() => {
            setAttachmentModalVisible(false);
            setOrderRow({});
          }}
        />
      )}
zhongnanhuang authored
2611
2612
2613
      {historyModalVisible && (
        <HistoryModal
          subOrders={selectedRows}
zhongnanhuang authored
2614
          isCancelledOrder={onlyShowCancelOrder}
zhongnanhuang authored
2615
2616
2617
2618
2619
2620
2621
          onClose={() => {
            setHistoryModalVisible(false);
            setSelectedRows({});
          }}
        />
      )}
zhongnanhuang authored
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
      {deliverInfoDrawerVisible && (
        <DeliverInfoDrawer
          data={orderRow}
          onClose={() => {
            setDeliverInfoDrawerVisible(false);
            setOrderRow({});
          }}
        />
      )}
zhongnanhuang authored
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
      {deliverInfoDrawerVisible && (
        <DeliverInfoDrawer
          data={orderRow}
          onClose={() => {
            setDeliverInfoDrawerVisible(false);
            setOrderRow({});
          }}
        />
      )}

      {procureCheckModalVisible && (
        <ProcureCheckModal
          setCheckVisible={setProcureCheckModalVisible}
          data={orderRow}
          subOrders={selectedRows}
          onClose={() => {
            setProcureCheckModalVisible(false);
            setOrderRow({});
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
      {afterSalesDrawerVisible && (
        <AfterSalesDrawer
          setVisible={setAfterSalesDrawerVisible}
          mainOrder={orderRow}
          subOrders={selectedRows}
          onClose={() => {
            setAfterSalesDrawerVisible(false);
            setSelectedRows({});
            setOrderRow({});
            refreshTable();
          }}
        />
      )}
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
      {procureConvertModalVisible && (
        <ProcureConvertModal
          setVisible={setProcureConvertModalVisible}
          subOrders={selectedRows}
          onClose={() => {
            setProcureConvertModalVisible(false);
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
      {financialMergeDrawerVisible && (
        <FinancialMergeDrawer
          setVisible={setFinancialMergeDrawerVisible}
          dataList={mainOrderSelectedRows}
          onClose={() => {
            setFinancialMergeDrawerVisible(false);
            setMainOrderSelectedRows([]);
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
      {financialReceiptsModalVisible && (
        <FinancialReceiptsModal
          setVisible={setFinancialReceiptsModalVisible}
          onClose={() => {
            setFinancialReceiptsModalVisible(false);
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2705
      {contextHolder}
calmound authored
2706
2707
2708
2709
    </PageContainer>
  );
};
sanmu authored
2710
export default OrderPage;