Blame view

src/pages/Order/index.tsx 91 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
  /**
   * 复制订单到剪贴板
   * @param record
   */
  function copyOrderToClipboard(record: any) {
    let text = '';
    text += record?.id;
zhongnanhuang authored
204
    text += ',' + record?.salesCode;
205
206
207
    text += ',' + record?.customerName;
    text += ',' + record?.customerContactNumber;
    text += ',' + record?.customerShippingAddress;
zhongnanhuang authored
208
209
    text += ',' + record?.institutionContactName;
    text += ',' + record?.institution;
210
211
212
213
214
215
216
217
218
219
220
221
222
223
    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
224
225
226
227
228
229
230
231
232
  // const resize = () => {
  //   // 计算元素底部到视口顶部的距离
  //   let bottomDistance = document
  //     .getElementById('mainTable')
  //     ?.getElementsByClassName('ant-table-thead')[0]
  //     .getBoundingClientRect().bottom;
  //   // 获取屏幕高度
  //   let screenHeight =
  //     window.innerHeight || document.documentElement.clientHeight;
233
zhongnanhuang authored
234
235
  //   // 计算元素底部到屏幕底部的距离
  //   let bottomToScreenBottomDistance = screenHeight - bottomDistance;
236
zhongnanhuang authored
237
238
  //   // //底部分页元素的高度
  //   // var pH = screenHeight - document.getElementById("main-table").getElementsByClassName('ant-table-body')[0].getBoundingClientRect().bottom;
239
zhongnanhuang authored
240
241
  //   setTableHeight(bottomToScreenBottomDistance - 88);
  // };
242
zhongnanhuang authored
243
244
245
246
247
  // useEffect(() => {
  //   resize();
  //   // 添加事件监听器,当窗口大小改变时调用resize方法
  //   window.addEventListener('resize', resize);
  // });
248
zhongnanhuang authored
249
250
251
252
253
254
255
256
257
258
259
260
  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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
  /**
   * 检查是否可以打印
   * @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
279
280
281
282
283
  const onCheckboxChange = (record: never) => {
    let newSelectedItems = [];
    if (selectedItems.includes(record.id)) {
      newSelectedItems = selectedItems.filter((key) => key !== record.id);
      setSelectedRowKeys([]);
284
      console.log(selectedRowObj);
zhongnanhuang authored
285
286
287
288
289
290
      setSelectedRowObj({
        ...setSelectedRowObj,
        [record.id]: [],
      });
      selectedRowObj[record.id] = [];
      setSelectedRows([]);
291
292
293

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

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

    mainOrderSelectedMap.clear();
323
324
    if (checked) {
      let mainOrderIds = data?.map((item) => {
325
        mainOrderSelectedMap.set(item.id, item);
326
327
328
        return item.id;
      });
zhongnanhuang authored
329
330
      let rowObj = {};
      data?.forEach((item) => {
331
332
333
334
335
336
337
338
339
        let id = item.id;
        rowObj[id] = item;
      });
      setSelectedItems(mainOrderIds);
    } else {
      setSelectedItems([]);
    }
  };
zhongnanhuang authored
340
341
342
343
  //表头渲染
  const OrderTableHeader = () => {
    return (
      <Flex className="w-full">
344
345
346
347
348
349
350
        <Flex className="w-[1%] ml-[7px]">
          <Checkbox
            onChange={allMainCheckBoxChange}
            checked={allMainChecked}
          ></Checkbox>
        </Flex>
        <Flex className="w-[30%] ml-[1%]">
zhongnanhuang authored
351
352
          <span className="font-medium">商品信息</span>
        </Flex>
353
        <Flex className="w-[13%]">
zhongnanhuang authored
354
355
356
357
358
          <span className="font-medium">交易金额</span>
        </Flex>
        <Flex className="w-[10%]">
          <span className="font-medium">支付</span>
        </Flex>
359
        <Flex className="w-[12%]">
zhongnanhuang authored
360
361
362
363
364
365
366
367
          <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
368
369
370
371
372
      </Flex>
    );
  };
  //子订单内容渲染
  const SubOderRander = ({ record, optRecord }) => {
zhongnanhuang authored
373
374
375
376
377
378
379
380
381
    /**
     * 获取订单状态标签
     * @param optRecord
     */
    function getOrderStatusTag(optRecord: any): import('react').ReactNode {
      const orderStatus = optRecord.orderStatus;
      if (orderStatus === 'AUDIT_FAILED') {
        return (
          <MyToolTip
382
            key="key"
zhongnanhuang authored
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
            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
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
435
436
437
          // <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
438
439
440
        );
      }
zhongnanhuang authored
441
442
443
      if (orderStatus === 'PROCURE_CONVERT_WAREHOUSE_KEEPER') {
        return (
          <MyToolTip
444
            key="key"
zhongnanhuang authored
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
            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
464
      return (
465
        <Tag key="key" color={TAGS_COLOR.get(optRecord.orderStatus)}>
zhongnanhuang authored
466
467
468
469
470
          {enumValueToLabel(optRecord.orderStatus, ORDER_STATUS_OPTIONS)}
        </Tag>
      );
    }
471
472
473
474
475
476
477
478
    //申请开票附件处理
    const getAfterAnnexList = () => {
      let links = [];
      let afterAnnexList = optRecord.afterAnnexList;
      let i = 1;
      if (afterAnnexList?.length > 0) {
        for (let url of afterAnnexList) {
          links.push(
479
            <a key={i} className="pl-2" href={url}>
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
              附件{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
500
          >
501
502
            {invoicingCheckAnnexList.map((url, index) => (
              <React.Fragment key={index}>
503
504
                <Image className="max-h-[50px] max-w-[70px]" src={url} />{' '}
                <Divider type="vertical" />
505
              </React.Fragment>
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
            ))}
          </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
529
              <span className="text-[#8C8C8C]">
530
                参数:{optRecord.parameters}
zhongnanhuang authored
531
              </span>
zhongnanhuang authored
532
            </div>
533
534
535
536
537
538
539
540
541
            <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
542
                className="pl-1 hover:curcor-pointer"
543
544
545
546
547
548
549
                onClick={() => {
                  setNotesEditVisible(true);
                  setOrderRow(optRecord);
                  setIsMainOrder(false);
                }}
              />
            </Flex>
550
551
552
            {/* {optRecord.applyInvoicingNotes !== undefined &&
            optRecord.applyInvoicingNotes !== null ? (
553
554
555
556
557
558
559
560
561
562
            <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>
          ) : (
            ''
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
          )} */}
          </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>
578
579
580
581
              <span className="text-slate-700">
                x{optRecord.quantity + ' '}
              </span>
              <span className="text-[#8C8C8C]">{optRecord.unit}</span>
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
615
616
617
            </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
618
619
620
                optRecord.productBelongBusiness,
                PRODUCT_BELONG_DEPARTMENT_OPTIONS,
              )}
621
622
623
624
625
626
627
628
            >
              <span className="text-slate-700">
                {enumValueToLabel(
                  optRecord.productBelongBusiness,
                  PRODUCT_BELONG_DEPARTMENT_OPTIONS,
                )}
              </span>
            </div>
zhongnanhuang authored
629
630
631
632
633
634
635
636
637
638
639
640
641
            {/* 开票类型 */}
            {getInvoicingType(optRecord) === undefined ? (
              <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
                <span className="text-slate-700">
                  {getInvoicingType(optRecord)}
                </span>
              </div>
            ) : (
              ''
            )}

            {/* 开票状态 */}
642
643
            <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
              <span className="text-slate-700">
644
645
646
647
                {enumValueToLabel(
                  optRecord.afterInvoicingStatus,
                  AFTER_INVOICING_STATUS,
                )}
648
649
              </span>
            </div>
650
          </Flex>
zhongnanhuang authored
651
652
653
654
655
656
657
658
659
660
          <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
661
                }
662
663
664
665
666
667
668
669
670
              >
                {getNeedInvoicing(optRecord)}
              </Tag>
            </div>
            {/* 订单状态 */}
            <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis">
              {getOrderStatusTag(optRecord)}
            </div>
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
            {/**采购是否已下单状态 */}
            {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>
            ) : (
              ''
            )}
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
712
713
714
            {/* 物流信息 */}
            <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">
715
716
717
718
719
720
721
            {optRecord.subPath?.includes('noNeedInvoicingEdit') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setFinancialEditVisible(true);
                  setSelectedRows([optRecord]);
722
                  setOrderRow(record);
723
724
725
                  setIsMainOrder(false);
                }}
              >
726
                编辑时间
727
728
729
730
              </Button>
            ) : (
              ''
            )}
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
851
852
853
            {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
854
              <ButtonConfirm
855
                className="p-0"
zhongnanhuang authored
856
857
858
859
860
861
862
863
864
865
866
867
868
                title="确认打印?"
                text="采购打印"
                onConfirm={async () => {
                  let res = await postServiceOrderProcurePrint({
                    data: {
                      ids: [optRecord.id],
                    },
                  });

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

            {optRecord.subPath?.includes('editOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setFinancialVisible(true);
                  setOrderRow(record);
                  setSelectedRows([optRecord]);
zhongnanhuang authored
895
                  setIsEdit(true);
896
897
898
899
900
901
902
                }}
              >
                编辑
              </Button>
            ) : (
              ''
            )}
zhongnanhuang authored
903
904
905
906
907
908
909
            {optRecord.subPath?.includes('invoicing') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setFinancialVisible(true);
zhongnanhuang authored
910
                  setIsEdit(false);
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
                  setOrderRow(record);
                  setSelectedRows([optRecord]);
                  setIsMainOrder(false);
                }}
              >
                开票
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('applyInvoicing') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setApplyForInvoicingVisible(true);
                  setSelectedRows([optRecord]);
zhongnanhuang authored
929
                  setIsEdit(false);
930
                  setIsMainOrder(false);
931
932
933
934
935
936
937
938
939
940
941
942
943
                }}
              >
                申请开票
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('checkOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
944
                  setOrderRow(record);
945
946
947
948
949
950
951
952
953
954
955
                  setCheckVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.NORMAL);
                }}
              >
                审核
              </Button>
            ) : (
              ''
            )}
956
957
958
959
960
            {optRecord.subPath?.includes('afterSalesCheck') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
961
                  setOrderRow(record);
962
963
964
965
966
967
968
969
970
971
972
                  setCheckVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.AFTER_SALES);
                }}
              >
                售后审核
              </Button>
            ) : (
              ''
            )}
973
974
975
976
977
            {optRecord.subPath?.includes('financeCheckOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
978
                  setOrderRow(record);
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
                  setCheckVisible(true);
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.FINALCIAL);
                }}
              >
                财务审核
              </Button>
            ) : (
              ''
            )}

            {optRecord.subPath?.includes('procureCheckOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
995
                  setOrderRow(record);
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.PROCURE);
                  setProcureCheckModalVisible(true);
                }}
              >
                采购审核
              </Button>
            ) : (
              ''
            )}
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
            {optRecord.subPath?.includes('procureConvertProcure') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.PROCURE);
                  setProcureConvertModalVisible(true);
                }}
              >
                转发
              </Button>
            ) : (
              ''
            )}
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
            {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>
            ) : (
              ''
            )}
zhongnanhuang authored
1055
            {optRecord.subPath?.includes('applyAfterSales') ? (
1056
1057
1058
1059
1060
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setSelectedRows([optRecord]);
1061
1062
                  // setOrderDrawerVisible(true);
                  setAfterSalesDrawerVisible(true);
1063
                  setOrderRow(record);
zhongnanhuang authored
1064
                  setOrderOptType('after-sales');
1065
1066
1067
1068
1069
1070
                }}
              >
                申请售后
              </Button>
            ) : (
              ''
zhongnanhuang authored
1071
            )}
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087

            {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
1088
              />
zhongnanhuang authored
1089
1090
1091
            ) : (
              ''
            )}
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
            {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;
                  }
                }}
              />
            ) : (
              ''
            )}
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
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
            {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
1168
        </Flex>
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182

        {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
1183
                      申请开票备注:
1184
1185
1186
1187
1188
1189
1190
1191
1192
                      {optRecord.applyInvoicingNotes === undefined ||
                      optRecord.applyInvoicingNotes === null
                        ? '暂无备注'
                        : optRecord.applyInvoicingNotes}
                    </span>
                  </Tooltip>
                </div>

                {getAfterAnnexList()}
zhongnanhuang authored
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203

                <Tooltip title="编辑">
                  <EditTwoTone
                    className="pl-1 hover:curcor-pointer"
                    onClick={() => {
                      setApplyForInvoicingVisible(true);
                      setSelectedRows([optRecord]);
                      setIsEdit(true);
                    }}
                  />
                </Tooltip>
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
              </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
1227
    );
zhongnanhuang authored
1228
  };
zhongnanhuang authored
1229
1230
1231
1232
1233
1234
  const expandedRowRender = (record) => {
    let subOrders = record.subOrderInformationLists;

    return (
      <ProTable
        id="sub-table"
zhongnanhuang authored
1235
        className="w-full "
zhongnanhuang authored
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
        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
1269
        tableAlertRender={false}
zhongnanhuang authored
1270
1271
1272
1273
      />
    );
  };
1274
  // 主订单内容渲染
sanmu authored
1275
  const MainOrderColumnRender = ({ record }: { record: OrderListItemType }) => {
sanmu authored
1276
1277
1278
    return (
      <Flex vertical={true}>
        {/* 编号、时间、销售信息 */}
zhongnanhuang authored
1279
        <Flex
zhongnanhuang authored
1280
          className="px-4 py-4 bg-white rounded-t-lg"
zhongnanhuang authored
1281
1282
1283
1284
1285
1286
          justify="space-between"
        >
          <Flex wrap="wrap" gap="middle" vertical>
            <Flex>
              <Flex>
                <Checkbox
zhongnanhuang authored
1287
                  onChange={() => onCheckboxChange(record)}
zhongnanhuang authored
1288
1289
                  checked={selectedItems.includes(record.id)}
                >
zhongnanhuang authored
1290
1291
                  <Space split={<Divider type="vertical" />}>
                    <div>
zhongnanhuang authored
1292
                      <span className="text-[#8C8C8C]">订单号:</span>
zhongnanhuang authored
1293
                      <span className="text-slate-700">{record.id}</span>
zhongnanhuang authored
1294
1295
1296
1297
1298
                    </div>
                    <span>{formatDateTime(record.createTime)}</span>
                  </Space>
                </Checkbox>
                <Space split={<Divider type="vertical" />}>
zhongnanhuang authored
1299
                  <div>
zhongnanhuang authored
1300
                    <span className="text-[#8C8C8C]">代表:</span>
zhongnanhuang authored
1301
                    <span className="text-slate-700">{record.salesCode}</span>
zhongnanhuang authored
1302
                  </div>
zhongnanhuang authored
1303
1304
                  <div
                    title={record.institution}
zhongnanhuang authored
1305
                    className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]"
zhongnanhuang authored
1306
                  >
zhongnanhuang authored
1307
                    <span className="text-[#8C8C8C]">单位:</span>
zhongnanhuang authored
1308
                    <span className="text-slate-700">{record.institution}</span>
zhongnanhuang authored
1309
                  </div>
zhongnanhuang authored
1310
                  <span>
zhongnanhuang authored
1311
                    <span className="text-[#8C8C8C]">联系人:</span>
zhongnanhuang authored
1312
                    <span className="text-slate-700">
zhongnanhuang authored
1313
                      {record.institutionContactName + ' '}
zhongnanhuang authored
1314
1315
1316
1317
1318
1319
                    </span>
                  </span>
                  <span>
                    <span className="text-[#8C8C8C]">收货人:</span>
                    <span className="text-slate-700">
                      {record.customerName + ' '}
zhongnanhuang authored
1320
1321
1322
1323
1324
1325
1326
1327
1328
                      <Tooltip className="order-tooltip" title="详情">
                        <ContainerTwoTone
                          className="hover:curcor-pointer"
                          onClick={() => {
                            setDeliverInfoDrawerVisible(true);
                            setOrderRow(record);
                          }}
                        />
                      </Tooltip>
zhongnanhuang authored
1329
                    </span>
zhongnanhuang authored
1330
1331
                  </span>
                </Space>
zhongnanhuang authored
1332
              </Flex>
1333
            </Flex>
zhongnanhuang authored
1334
            <Flex className="pl-6" align="center">
zhongnanhuang authored
1335
              <div title={record.notes}>
zhongnanhuang authored
1336
                <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis">
zhongnanhuang authored
1337
1338
1339
1340
                  <span className="text-[#8C8C8C]">备注:</span>
                  <span className="ml-2">
                    {record.notes === undefined ? '暂无备注' : record.notes}
                  </span>
zhongnanhuang authored
1341
                </div>
zhongnanhuang authored
1342
              </div>
zhongnanhuang authored
1343
1344
              <Tooltip title="编辑">
                <EditTwoTone
zhongnanhuang authored
1345
                  className="pl-1 hover:curcor-pointer"
zhongnanhuang authored
1346
1347
1348
1349
1350
1351
1352
                  onClick={() => {
                    setNotesEditVisible(true);
                    setOrderRow(record);
                    setIsMainOrder(true);
                  }}
                />
              </Tooltip>
zhongnanhuang authored
1353
1354
1355
1356
1357
1358
            </Flex>
          </Flex>
          <Flex wrap="wrap" gap="middle" vertical>
            <Flex justify="flex-end">
              <Flex wrap="wrap" gap="middle" align="center">
                <div>
zhongnanhuang authored
1359
                  <span className="text-[#8C8C8C]">总金额:¥</span>
zhongnanhuang authored
1360
1361
1362
                  <span className="text-lg font-medium">
                    {record.totalPayment}
                  </span>
zhongnanhuang authored
1363
1364
                </div>
                {rolePath?.includes('addOrder') ? (
zhongnanhuang authored
1365
1366
1367
1368
                  <Tooltip title="复制">
                    <CopyTwoTone
                      className="hover:cursor-pointer"
                      onClick={() => {
1369
                        copyOrderToClipboard(record);
zhongnanhuang authored
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
                        setOrderOptType('copy');
                        setOrderDrawerVisible(true);
                        let copy = cloneDeep(record);
                        copy.id = undefined;
                        copy.subOrderInformationLists?.forEach((item) => {
                          item.id = undefined;
                        });
                        setOrderRow(copy);
                      }}
                    />
                  </Tooltip>
zhongnanhuang authored
1381
                ) : (
1382
1383
1384
1385
1386
1387
1388
1389
                  <Tooltip title="复制文本">
                    <CopyTwoTone
                      className="hover:cursor-pointer"
                      onClick={() => {
                        copyOrderToClipboard(record);
                      }}
                    />
                  </Tooltip>
zhongnanhuang authored
1390
                )}
zhongnanhuang authored
1391
zhongnanhuang authored
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
                <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
1405
1406
1407
1408
1409
              </Flex>
            </Flex>
            <Flex justify="flex-end">
              <Space.Compact direction="vertical" align="end">
                <Space>
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
                  {record.mainPath?.includes('updateHirePurchase') ? (
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        setFinancialReceiptsModalVisible(true);
                        setOrderRow(record);
                        setSelectedRows([record]);
                        setIsEdit(true);
                      }}
                    >
                      收款记录
                    </Button>
                  ) : (
                    ''
                  )}
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
1453
1454
1455
1456
                  {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
1457
                  {record.mainPath?.includes('sendProduct') ? (
zhongnanhuang authored
1458
1459
1460
1461
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
zhongnanhuang authored
1462
1463
1464
1465
                        if (!selectedRowObj[record.id]?.length) {
                          return message.error('请选择选择子订单');
                        }
                        setSelectedRows(selectedRowObj[record.id]);
zhongnanhuang authored
1466
                        setDeliverVisible(true);
zhongnanhuang authored
1467
                        setIsSendProduct(true);
zhongnanhuang authored
1468
                        setOrderCheckType(CHECK_TYPE.NORMAL);
zhongnanhuang authored
1469
1470
                      }}
                    >
zhongnanhuang authored
1471
                      仓库发货
zhongnanhuang authored
1472
1473
1474
1475
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1476
1477

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

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

                  {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
1664
                        setIsEdit(false);
zhongnanhuang authored
1665
                        setIsMainOrder(false);
zhongnanhuang authored
1666
1667
1668
1669
1670
1671
1672
1673
                      }}
                    >
                      申请开票
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1674
                  {record.mainPath?.includes('updateOrder') ? (
zhongnanhuang authored
1675
1676
1677
1678
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
zhongnanhuang authored
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
1705
1706
1707
1708
                        //勾选的子订单:如果有勾选,后面只校验有勾选的
                        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
1709
1710
                      }}
                    >
zhongnanhuang authored
1711
                      编辑
zhongnanhuang authored
1712
1713
1714
1715
                    </Button>
                  ) : (
                    ''
                  )}
1716
zhongnanhuang authored
1717
1718
1719
                  {record?.subOrderInformationLists[0].subPath?.includes(
                    'noNeedInvoicingEdit',
                  ) ? (
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = record.subOrderInformationLists;
                        setFinancialEditVisible(true);
                        setSelectedRows(selectedSubOrders);
                        setOrderRow(record);
                        setIsMainOrder(true);
                      }}
                    >
                      财务编辑
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1737
                  {record.mainPath?.includes('checkOrder') ? (
zhongnanhuang authored
1738
1739
1740
1741
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
zhongnanhuang authored
1742
1743
1744
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1745
                          selectedSubOrders = record.subOrderInformationLists;
zhongnanhuang authored
1746
                        }
zhongnanhuang authored
1747
                        for (let i = 0; i < selectedSubOrders.length; i++) {
zhongnanhuang authored
1748
                          if (
zhongnanhuang authored
1749
1750
1751
                            selectedSubOrders[i].orderStatus !== 'UNAUDITED' &&
                            selectedSubOrders[i].orderStatus !==
                              'FINANCE_PROCESS'
zhongnanhuang authored
1752
1753
1754
1755
1756
1757
1758
                          ) {
                            message.error('请选择未审核的子订单进行审核');
                            return;
                          }
                        }
                        setOrderRow(record);
                        setCheckVisible(true);
zhongnanhuang authored
1759
                        setSelectedRows(selectedSubOrders);
zhongnanhuang authored
1760
1761
1762
1763
1764
1765
1766
1767
1768
                        setOrderCheckType(CHECK_TYPE.NORMAL);
                      }}
                    >
                      审核
                    </Button>
                  ) : (
                    ''
                  )}
1769
                  {record.mainPath?.includes('afterSalesCheck') ? (
1770
1771
1772
1773
1774
1775
1776
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1777
                          selectedSubOrders = record.subOrderInformationLists;
1778
                        }
zhongnanhuang authored
1779
                        for (let i = 0; i < selectedSubOrders.length; i++) {
1780
                          if (
zhongnanhuang authored
1781
1782
                            selectedSubOrders[i].orderStatus !==
                            'IN_AFTER_SALES'
1783
1784
                          ) {
                            message.error('请选择售后中的子订单进行审核');
1785
1786
1787
1788
1789
                            return;
                          }
                        }
                        setOrderRow(record);
                        setCheckVisible(true);
zhongnanhuang authored
1790
                        setSelectedRows(selectedSubOrders);
1791
1792
1793
1794
1795
1796
1797
1798
1799
                        setOrderCheckType(CHECK_TYPE.AFTER_SALES);
                      }}
                    >
                      售后审核
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
                  {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
1813
                            selectedSubOrders[i].orderStatus !== 'AUDITED' &&
zhongnanhuang authored
1814
                            selectedSubOrders[i].orderStatus !==
zhongnanhuang authored
1815
1816
1817
1818
1819
1820
1821
1822
                              '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
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
                          ) {
                            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
1848
                  {/* 财务审核:主订单暂无 */}
zhongnanhuang authored
1849
                  {record.mainPath?.includes('financeCheckOrder') ? (
zhongnanhuang authored
1850
1851
1852
1853
1854
1855
1856
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1857
                          selectedSubOrders = record.subOrderInformationLists;
zhongnanhuang authored
1858
                        }
zhongnanhuang authored
1859
                        for (let i = 0; i < selectedSubOrders.length; i++) {
zhongnanhuang authored
1860
                          if (
zhongnanhuang authored
1861
1862
1863
                            selectedSubOrders[i].orderStatus !== 'UNAUDITED' &&
                            selectedSubOrders[i].orderStatus !==
                              'FINANCE_PROCESS'
zhongnanhuang authored
1864
                          ) {
zhongnanhuang authored
1865
                            message.error('请选择未审核的子订单进行审核');
zhongnanhuang authored
1866
1867
1868
                            return;
                          }
                        }
zhongnanhuang authored
1869
                        setOrderRow(record);
zhongnanhuang authored
1870
                        setCheckVisible(true);
zhongnanhuang authored
1871
                        setSelectedRows(selectedSubOrders);
zhongnanhuang authored
1872
                        setOrderCheckType(CHECK_TYPE.FINALCIAL);
zhongnanhuang authored
1873
1874
                      }}
                    >
zhongnanhuang authored
1875
1876
1877
1878
1879
1880
1881
                      财务审核
                    </Button>
                  ) : (
                    ''
                  )}

                  {/* 采购审核 */}
zhongnanhuang authored
1882
                  {record.mainPath?.includes('procureCheckOrder') ? (
zhongnanhuang authored
1883
1884
1885
1886
1887
1888
1889
                    <Button
                      className="p-0"
                      type="link"
                      onClick={() => {
                        let selectedSubOrders = selectedRowObj[record.id];
                        setSelectedRows(selectedSubOrders);
                        if (selectedSubOrders === undefined) {
zhongnanhuang authored
1890
                          selectedSubOrders = record.subOrderInformationLists;
zhongnanhuang authored
1891
                        }
zhongnanhuang authored
1892
                        for (let i = 0; i < selectedSubOrders.length; i++) {
zhongnanhuang authored
1893
                          if (
zhongnanhuang authored
1894
1895
                            selectedSubOrders[i].orderStatus !==
                            'PROCURE_UN_PROCESS'
zhongnanhuang authored
1896
1897
1898
1899
1900
1901
1902
                          ) {
                            message.error('请选择未审核的子订单进行审核');
                            return;
                          }
                        }
                        setOrderRow(record);
                        setProcureCheckModalVisible(true);
zhongnanhuang authored
1903
                        setSelectedRows(selectedSubOrders);
zhongnanhuang authored
1904
1905
1906
1907
                        setOrderCheckType(CHECK_TYPE.PROCURE);
                      }}
                    >
                      采购审核
zhongnanhuang authored
1908
1909
1910
1911
1912
                    </Button>
                  ) : (
                    ''
                  )}
zhongnanhuang authored
1913
                  {record.mainPath?.includes('applyAfterSales') ? (
zhongnanhuang authored
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
                    <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 !==
zhongnanhuang authored
1926
1927
1928
                              'CONFIRM_RECEIPT' &&
                            selectedSubOrders[i].orderStatus !==
                              'AFTER_SALES_FAILURE'
zhongnanhuang authored
1929
1930
1931
1932
1933
                          ) {
                            message.error('请选择确认收货状态的子订单进行售后');
                            return;
                          }
                        }
1934
1935
                        // setOrderDrawerVisible(true);
                        setAfterSalesDrawerVisible(true);
zhongnanhuang authored
1936
                        setOrderRow(record);
1937
                        setOrderOptType('after-sales');
zhongnanhuang authored
1938
1939
1940
1941
1942
1943
1944
1945
                      }}
                    >
                      申请售后
                    </Button>
                  ) : (
                    ''
                  )}
1946
                  {/* {record.mainPath?.includes('afterSalesCompletion') ? (
zhongnanhuang authored
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
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
                    <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();
                        }
                      }}
                    />
                  ) : (
                    ''
1988
                  )} */}
zhongnanhuang authored
1989
zhongnanhuang authored
1990
                  {record.mainPath?.includes('orderCancel') ? (
zhongnanhuang authored
1991
                    <ButtonConfirm
zhongnanhuang authored
1992
                      className="p-0"
zhongnanhuang authored
1993
1994
1995
                      title="确认作废?"
                      text="作废"
                      onConfirm={async () => {
zhongnanhuang authored
1996
1997
1998
1999
                        let body = {
                          ids: [record.id],
                          checkIsMainOrderId: true,
                        };
zhongnanhuang authored
2000
2001
2002
2003
2004
2005
2006
                        const data = await postServiceOrderOrderCancel({
                          data: body,
                        });
                        if (data.result === RESPONSE_CODE.SUCCESS) {
                          message.success(data.message);
                          refreshTable();
                        }
zhongnanhuang authored
2007
                      }}
zhongnanhuang authored
2008
                    />
zhongnanhuang authored
2009
2010
2011
                  ) : (
                    ''
                  )}
zhongnanhuang authored
2012
zhongnanhuang authored
2013
                  {record.mainPath?.includes('procurePrint') ? (
zhongnanhuang authored
2014
                    <ButtonConfirm
zhongnanhuang authored
2015
                      className="p-0"
zhongnanhuang authored
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
                      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
2047
2048
                        }
                      }}
zhongnanhuang authored
2049
                    />
zhongnanhuang authored
2050
                  ) : (
zhongnanhuang authored
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
                    // <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
2066
2067
                    ''
                  )}
zhongnanhuang authored
2068
2069
2070
2071
2072
2073
                </Space>
              </Space.Compact>
            </Flex>
          </Flex>
        </Flex>
zhongnanhuang authored
2074
        <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg">
zhongnanhuang authored
2075
2076
2077
          {expandedRowRender(record)}
        </Flex>
      </Flex>
2078
2079
2080
    );
  };
zhongnanhuang authored
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
  // 主订单列表
  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;
    },
  );
2097
  //判断是否是采购,是的话新增一个筛选条件
2098
2099
2100
2101
  if (
    userInfo?.roleSmallVO?.code === 'procure' ||
    userInfo?.roleSmallVO?.code === 'admin'
  ) {
2102
2103
2104
2105
2106
2107
2108
2109
2110
    mainOrdersColumns.push({
      title: '采购下单状态',
      dataIndex: 'procureOrderStatus',
      valueType: 'select',
      hideInTable: true,
      valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS),
    });
  }
zhongnanhuang authored
2111
  function toolBarRender() {
zhongnanhuang authored
2112
    let roleCode = userInfo?.roleSmallVO?.code;
zhongnanhuang authored
2113
2114
    let toolBtns = [];
zhongnanhuang authored
2115
2116
2117
2118
    toolBtns.push(
      <Checkbox onChange={changeCancelOrderShow}>只看作废</Checkbox>,
    );
zhongnanhuang authored
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
    //采购可以筛选出需要处理的订单
    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
2144
2145
2146
    //导出按钮配置
    const items: MenuProps['items'] = [
      {
zhongnanhuang authored
2147
2148
2149
2150
2151
2152
2153
2154
2155
        label: '导出查询结果订单',
        key: '2',
        onClick: async () => {
          let body = { flag: 50, ...searchParams };
          exportLoading();
          orderExport('/api/service/order/export', body, exportLoadingDestory);
        },
      },
      {
zhongnanhuang authored
2156
2157
2158
2159
2160
2161
2162
        label: '导出已选中订单',
        key: '1',
        onClick: async () => {
          if (selectedItems.length === 0) {
            message.error('请选择订单');
            return;
          }
zhongnanhuang authored
2163
          let body = { flag: 30, ids: selectedItems };
zhongnanhuang authored
2164
          exportLoading();
zhongnanhuang authored
2165
          orderExport('/api/service/order/export', body, exportLoadingDestory);
zhongnanhuang authored
2166
2167
        },
      },
zhongnanhuang authored
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
      // {
      //   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
2181
      {
zhongnanhuang authored
2182
2183
        label: '导出当天订单',
        key: '4',
zhongnanhuang authored
2184
        onClick: async () => {
zhongnanhuang authored
2185
          let body = { flag: 40, ids: [] };
zhongnanhuang authored
2186
          exportLoading();
zhongnanhuang authored
2187
          orderExport('/api/service/order/export', body, exportLoadingDestory);
zhongnanhuang authored
2188
2189
2190
2191
2192
2193
        },
      },
      {
        label: '导出所有订单',
        key: '3',
        onClick: async () => {
zhongnanhuang authored
2194
2195
2196
2197
2198
          let body = { flag: 10, ids: [] };
          exportLoading();
          orderExport('/api/service/order/export', body, exportLoadingDestory);
        },
      },
zhongnanhuang authored
2199
2200
2201
2202
2203
2204
2205
    ];

    const menuProps = {
      items,
      onClick: () => {},
    };
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
    if (rolePath?.includes('mergeApplyInvoicing')) {
      toolBtns.push(
        <Button
          type="primary"
          key="out"
          onClick={() => {
            setApplyForInvoicingVisible(true);
            //选中订单
            setIsEdit(false);
            setIsMainOrder(true);
2216
2217
2218
2219
2220
            let mainOrderList = [];
            for (let order of mainOrderSelectedMap.values()) {
              mainOrderList.push(order);
            }
            setSelectedRows(mainOrderList);
2221
2222
2223
          }}
          disabled={selectedItems?.length === 0}
        >
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
          {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' ? '合并(财务)' : '合并开票'}
2263
2264
2265
2266
        </Button>,
      );
    }
2267
    if (rolePath?.includes('addOrder')) {
zhongnanhuang authored
2268
2269
2270
2271
      toolBtns.push(
        <Button
          type="primary"
          key="out"
zhongnanhuang authored
2272
2273
          onClick={() => {
            setOrderDrawerVisible(true);
2274
            setOrderOptType('add');
zhongnanhuang authored
2275
          }}
zhongnanhuang authored
2276
2277
2278
2279
2280
        >
          新增
        </Button>,
      );
    }
2281
zhongnanhuang authored
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
    if (rolePath?.includes('importExcel')) {
      toolBtns.push(
        <Button
          type="primary"
          key="out"
          onClick={() => {
            setImportModalVisible(true);
          }}
        >
          导入
        </Button>,
      );
    }
zhongnanhuang authored
2295
zhongnanhuang authored
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
    if (rolePath?.includes('export')) {
      toolBtns.push(
        <Dropdown menu={menuProps}>
          <Button>
            <Space>
              导出
              <DownOutlined />
            </Space>
          </Button>
        </Dropdown>,
      );
    }
zhongnanhuang authored
2308
zhongnanhuang authored
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
    // toolBtns.push(
    //   <Button
    //     key="show"
    //     onClick={() => {
    //       handleAllExpand();
    //     }}
    //   >
    //     {mainOrderAllItemKeys?.length !== expandedRowKeys.length
    //       ? '一键展开'
    //       : '一键收起'}
    //   </Button>,
    // );
zhongnanhuang authored
2321
2322
2323
2324

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

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

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

      {checkVisible && (
        <CheckModal
          setCheckVisible={setCheckVisible}
2470
          data={orderRow}
2471
          subOrders={selectedRows}
zhongnanhuang authored
2472
          orderCheckType={orderCheckType}
zhongnanhuang authored
2473
2474
2475
2476
2477
          openOrderDrawer={(type: any, id: any) => {
            setOrderRow({ id: id });
            setOrderOptType(type);
            setOrderDrawerVisible(true);
          }}
sanmu authored
2478
2479
2480
          onClose={() => {
            setCheckVisible(false);
            setOrderRow({});
2481
            setSelectedRows({});
zhongnanhuang authored
2482
            refreshTable();
2483
2484
2485
2486
          }}
        />
      )}
zhongnanhuang authored
2487
2488
2489
      {applyForInvoicingVisible && (
        <ApplyForInvoicingModal
          setCheckVisible={setApplyForInvoicingVisible}
zhongnanhuang authored
2490
          data={selectedItems}
zhongnanhuang authored
2491
          subOrders={selectedRows}
2492
          isMainOrder={isMainOrder}
zhongnanhuang authored
2493
          isEdit={isEdit}
zhongnanhuang authored
2494
2495
2496
          onClose={() => {
            setApplyForInvoicingVisible(false);
            setSelectedRows({});
zhongnanhuang authored
2497
            setIsMainOrder(false);
zhongnanhuang authored
2498
2499
2500
2501
2502
            refreshTable();
          }}
        />
      )}
2503
      {notesEditVisible && (
zhongnanhuang authored
2504
        <OrderNotesEditModal
2505
2506
          setNotesEditVisible={setNotesEditVisible}
          data={orderRow}
zhongnanhuang authored
2507
          isMianOrder={isMainOrder}
2508
2509
2510
          onClose={() => {
            setNotesEditVisible(false);
            setOrderRow({});
zhongnanhuang authored
2511
            refreshTable();
sanmu authored
2512
2513
2514
2515
2516
2517
2518
          }}
        />
      )}

      {deliverVisible && (
        <DeliverModal
          data={selectedRows}
zhongnanhuang authored
2519
          isSendProduct={isSendProduct}
zhongnanhuang authored
2520
2521
2522
          setVisible={(b: boolean) => {
            setDeliverVisible(b);
          }}
zhongnanhuang authored
2523
          sendType={orderCheckType}
sanmu authored
2524
          onClose={() => {
zhongnanhuang authored
2525
            setDeliverVisible(false);
sanmu authored
2526
            setOrderRow({});
zhongnanhuang authored
2527
2528
            setIsSendProduct(false);
            refreshTable();
sanmu authored
2529
2530
2531
          }}
        />
      )}
zhongnanhuang authored
2532
2533
2534

      {financialVisible && (
        <FinancialDrawer
zhongnanhuang authored
2535
          isEdit={isEdit}
zhongnanhuang authored
2536
2537
          mainOrder={orderRow}
          subOrders={selectedRows}
zhongnanhuang authored
2538
          isMainOrder={isMainOrder}
zhongnanhuang authored
2539
2540
2541
2542
          cancel={() => {
            setFinancialVisible(false);
            setOrderRow({});
            setIsMainOrder(false);
zhongnanhuang authored
2543
            setIsEdit(false);
zhongnanhuang authored
2544
          }}
zhongnanhuang authored
2545
2546
2547
          onClose={() => {
            setFinancialVisible(false);
            setOrderRow({});
zhongnanhuang authored
2548
            refreshTable();
zhongnanhuang authored
2549
            setIsMainOrder(false);
zhongnanhuang authored
2550
            setIsEdit(false);
zhongnanhuang authored
2551
2552
2553
2554
          }}
        />
      )}
2555
2556
      {financialEditVisible && (
        <FinancialEditDrawer
2557
          mainOrder={orderRow}
2558
          subOrders={selectedRows}
2559
          isMainOrder={isMainOrder}
2560
2561
2562
2563
2564
2565
2566
2567
          setVisible={() => {
            setFinancialEditVisible(false);
            setIsMainOrder(false);
          }}
          onClose={() => {
            setFinancialEditVisible(false);
            refreshTable();
            setIsMainOrder(false);
2568
            setOrderRow({});
2569
2570
2571
2572
          }}
        />
      )}
zhongnanhuang authored
2573
2574
2575
2576
      {orderPrintVisible && (
        <OrderPrintModal
          mainOrder={orderRow}
          subOrders={selectedRows}
zhongnanhuang authored
2577
          isRePrint={isRePrintOrder}
zhongnanhuang authored
2578
2579
2580
          setVisible={(b: boolean) => {
            setOrderPrintVisible(b);
          }}
zhongnanhuang authored
2581
          printOptType={orderCheckType}
zhongnanhuang authored
2582
2583
2584
          onClose={() => {
            setOrderPrintVisible(false);
            setOrderRow({});
zhongnanhuang authored
2585
2586
            setIsRePrintOrder(false);
            refreshTable();
zhongnanhuang authored
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
          }}
        />
      )}

      {confirmReceiptVisible && (
        <ConfirmReceiptModal
          data={orderRow}
          onClose={() => {
            setConfirmReceiptVisible(false);
            setOrderRow({});
zhongnanhuang authored
2597
            refreshTable();
zhongnanhuang authored
2598
2599
2600
          }}
        />
      )}
zhongnanhuang authored
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611

      {subOrderConfirmReceiptImagesVisible && (
        <SubOrderComfirmReceiptImagesModal
          setVisible={setSubOrderConfirmReceiptImagesVisible}
          onClose={() => {
            setSubOrderConfirmReceiptImagesVisible(false);
          }}
          orderRow={orderRow}
        />
      )}
zhongnanhuang authored
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
      {importModalVisible && (
        <ImportModal
          onClose={() => {
            setImportModalVisible(false);
            refreshTable();
          }}
        />
      )}

      {attachmentModalVisible && (
        <AttachmentModal
          data={orderRow}
          onClose={() => {
            setAttachmentModalVisible(false);
            setOrderRow({});
          }}
        />
      )}
zhongnanhuang authored
2631
2632
2633
      {historyModalVisible && (
        <HistoryModal
          subOrders={selectedRows}
zhongnanhuang authored
2634
          isCancelledOrder={onlyShowCancelOrder}
zhongnanhuang authored
2635
2636
2637
2638
2639
2640
2641
          onClose={() => {
            setHistoryModalVisible(false);
            setSelectedRows({});
          }}
        />
      )}
zhongnanhuang authored
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
      {deliverInfoDrawerVisible && (
        <DeliverInfoDrawer
          data={orderRow}
          onClose={() => {
            setDeliverInfoDrawerVisible(false);
            setOrderRow({});
          }}
        />
      )}
zhongnanhuang authored
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
      {deliverInfoDrawerVisible && (
        <DeliverInfoDrawer
          data={orderRow}
          onClose={() => {
            setDeliverInfoDrawerVisible(false);
            setOrderRow({});
          }}
        />
      )}

      {procureCheckModalVisible && (
        <ProcureCheckModal
          setCheckVisible={setProcureCheckModalVisible}
          data={orderRow}
          subOrders={selectedRows}
          onClose={() => {
            setProcureCheckModalVisible(false);
            setOrderRow({});
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
      {afterSalesDrawerVisible && (
        <AfterSalesDrawer
          setVisible={setAfterSalesDrawerVisible}
          mainOrder={orderRow}
          subOrders={selectedRows}
          onClose={() => {
            setAfterSalesDrawerVisible(false);
            setSelectedRows({});
            setOrderRow({});
            refreshTable();
          }}
        />
      )}
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
      {procureConvertModalVisible && (
        <ProcureConvertModal
          setVisible={setProcureConvertModalVisible}
          subOrders={selectedRows}
          onClose={() => {
            setProcureConvertModalVisible(false);
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
      {financialMergeDrawerVisible && (
        <FinancialMergeDrawer
          setVisible={setFinancialMergeDrawerVisible}
          dataList={mainOrderSelectedRows}
          onClose={() => {
            setFinancialMergeDrawerVisible(false);
            setMainOrderSelectedRows([]);
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2714
2715
2716
      {financialReceiptsModalVisible && (
        <FinancialReceiptsModal
          setVisible={setFinancialReceiptsModalVisible}
2717
          datas={selectedRows}
zhongnanhuang authored
2718
2719
2720
2721
2722
2723
2724
2725
          onClose={() => {
            setFinancialReceiptsModalVisible(false);
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2726
      {contextHolder}
calmound authored
2727
2728
2729
2730
    </PageContainer>
  );
};
sanmu authored
2731
export default OrderPage;