Blame view

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

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

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

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

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

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

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

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

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

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

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

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

            {optRecord.subPath?.includes('procureCheckOrder') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
zhongnanhuang authored
998
                  setOrderRow(record);
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.PROCURE);
                  setProcureCheckModalVisible(true);
                }}
              >
                采购审核
              </Button>
            ) : (
              ''
            )}
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
            {optRecord.subPath?.includes('procureConvertProcure') ? (
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setSelectedRows([optRecord]);
                  setOrderCheckType(CHECK_TYPE.PROCURE);
                  setProcureConvertModalVisible(true);
                }}
              >
                转发
              </Button>
            ) : (
              ''
            )}
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
1055
1056
1057
            {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
1058
            {optRecord.subPath?.includes('applyAfterSales') ? (
1059
1060
1061
1062
1063
              <Button
                className="p-0"
                type="link"
                onClick={() => {
                  setSelectedRows([optRecord]);
1064
1065
                  // setOrderDrawerVisible(true);
                  setAfterSalesDrawerVisible(true);
1066
                  setOrderRow(record);
zhongnanhuang authored
1067
                  setOrderOptType('after-sales');
1068
1069
1070
1071
1072
1073
                }}
              >
                申请售后
              </Button>
            ) : (
              ''
zhongnanhuang authored
1074
            )}
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090

            {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
1091
              />
zhongnanhuang authored
1092
1093
1094
            ) : (
              ''
            )}
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
            {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;
                  }
                }}
              />
            ) : (
              ''
            )}
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
1168
1169
1170
            {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
1171
        </Flex>
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185

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

                {getAfterAnnexList()}
zhongnanhuang authored
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206

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

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

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

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

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

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

    const menuProps = {
      items,
      onClick: () => {},
    };
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
    if (rolePath?.includes('mergeApplyInvoicing')) {
      toolBtns.push(
        <Button
          type="primary"
          key="out"
          onClick={() => {
            setApplyForInvoicingVisible(true);
            //选中订单
            setIsEdit(false);
            setIsMainOrder(true);
2219
2220
2221
2222
2223
            let mainOrderList = [];
            for (let order of mainOrderSelectedMap.values()) {
              mainOrderList.push(order);
            }
            setSelectedRows(mainOrderList);
2224
2225
2226
          }}
          disabled={selectedItems?.length === 0}
        >
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
          {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) {
zhongnanhuang authored
2245
2246
2247
2248
                if (
                  subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING' &&
                  subOrder.afterInvoicingStatus !== 'PARTIAL_INVOICING'
                ) {
2249
2250
2251
2252
2253
2254
2255
2256
2257
                  errorIds.push(value.id);
                  return;
                }
              }
            });
            if (errorIds.length > 0) {
              message.error(
                '订单号为:' +
                  errorIds.join(',') +
zhongnanhuang authored
2258
                  '的订单存在不是[申请开票]或者[部分开票]状态的子订单,请检查!',
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
              );
              return;
            }

            setMainOrderSelectedRows(mainOrders);
            setFinancialMergeDrawerVisible(true);
          }}
          disabled={selectedItems?.length === 0}
        >
          {userInfo?.roleSmallVO?.code === 'admin' ? '合并(财务)' : '合并开票'}
2269
2270
2271
2272
        </Button>,
      );
    }
2273
    if (rolePath?.includes('addOrder')) {
zhongnanhuang authored
2274
2275
2276
2277
      toolBtns.push(
        <Button
          type="primary"
          key="out"
zhongnanhuang authored
2278
2279
          onClick={() => {
            setOrderDrawerVisible(true);
2280
            setOrderOptType('add');
zhongnanhuang authored
2281
          }}
zhongnanhuang authored
2282
2283
2284
2285
2286
        >
          新增
        </Button>,
      );
    }
2287
zhongnanhuang authored
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
    if (rolePath?.includes('importExcel')) {
      toolBtns.push(
        <Button
          type="primary"
          key="out"
          onClick={() => {
            setImportModalVisible(true);
          }}
        >
          导入
        </Button>,
      );
    }
zhongnanhuang authored
2301
zhongnanhuang authored
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
    if (rolePath?.includes('export')) {
      toolBtns.push(
        <Dropdown menu={menuProps}>
          <Button>
            <Space>
              导出
              <DownOutlined />
            </Space>
          </Button>
        </Dropdown>,
      );
    }
zhongnanhuang authored
2314
zhongnanhuang authored
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
    // toolBtns.push(
    //   <Button
    //     key="show"
    //     onClick={() => {
    //       handleAllExpand();
    //     }}
    //   >
    //     {mainOrderAllItemKeys?.length !== expandedRowKeys.length
    //       ? '一键展开'
    //       : '一键收起'}
    //   </Button>,
    // );
zhongnanhuang authored
2327
2328
2329
2330

    return toolBtns;
  }
zhongnanhuang authored
2331
2332
2333
2334
2335
2336
2337
2338
2339
  useEffect(() => {
    // 使用URLSearchParams来解析查询参数
    const params = new URLSearchParams(location.search);
    const id = params.get('id');
    if (id) {
      mainTableFormRef.current?.setFieldValue('id', id);
    }
  }, []);
calmound authored
2340
2341
  return (
    <PageContainer
zhongnanhuang authored
2342
      className="order-page-container"
calmound authored
2343
      header={{
sanmu authored
2344
        title: '订单管理',
zhongnanhuang authored
2345
2346
        extra: [
          <Avatar key="0" style={{ verticalAlign: 'middle' }} size="large">
zhongnanhuang authored
2347
            {userInfo?.username}
zhongnanhuang authored
2348
          </Avatar>,
zhongnanhuang authored
2349
          <Tag key="nickName">{userInfo?.nickName}</Tag>,
zhongnanhuang authored
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
          <Dropdown
            key="dropdown"
            trigger={['click']}
            menu={{
              items: [
                {
                  label: '退出登录',
                  key: '1',
                  onClick: () => {
                    localStorage.removeItem('token');
                    history.push('/login');
                  },
                },
2363
2364
2365
2366
                // {
                //   label: '修改密码',
                //   key: '2',
                // },
zhongnanhuang authored
2367
2368
2369
2370
2371
2372
2373
2374
              ],
            }}
          >
            <Button key="4" style={{ padding: '0 8px' }}>
              <EllipsisOutlined />
            </Button>
          </Dropdown>,
        ],
calmound authored
2375
2376
      }}
    >
2377
      <div id="resizeDiv"></div>
2378
      <ProTable
zhongnanhuang authored
2379
2380
2381
        id="main-table"
        // tableStyle={{backgroundColor:'red'}}
2382
        actionRef={mainTableRef}
zhongnanhuang authored
2383
        formRef={mainTableFormRef}
2384
2385
2386
2387
2388
        expandIconColumnIndex={-1}
        columns={mainOrdersColumns}
        rowKey="id"
        pagination={{
          showQuickJumper: true,
zhongnanhuang authored
2389
2390
2391
2392
2393
2394
2395
          pageSize: pageSize,
          current: currentPage,
          showSizeChanger: true,
          onChange: (page, size) => {
            setPageSize(size);
            setCurrentPage(page);
          },
calmound authored
2396
        }}
zhongnanhuang authored
2397
        // showHeader={false}
2398
        expandedRowKeys={expandedRowKeys}
zhongnanhuang authored
2399
        // expandable={{ expandedRowRender }}
2400
2401
        dateFormatter="string"
        options={false}
zhongnanhuang authored
2402
        headerTitle=""
2403
2404
        search={{
          labelWidth: 'auto',
zhongnanhuang authored
2405
          // onCollapse: resize,
2406
2407
2408
2409
        }}
        request={async (
          // 第一个参数 params 查询表单和 params 参数的结合
          // 第一个参数中一定会有 pageSize 和  current ,这两个参数是 antd 的规范
zhongnanhuang authored
2410
          params,
2411
          sorter,
sanmu authored
2412
2413
          filter,
        ) => {
2414
          //订单id处理
zhongnanhuang authored
2415
2416
2417
2418
2419
2420
          /**
           * 以params中的id为主,如果params没id,则取url中的id
           * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来
           */
          let orderIds = mainTableFormRef.current?.getFieldValue('id');
          params.id = params.id || orderIds;
2421
          if (params.id !== '') {
2422
            if (params.id?.indexOf(',')) {
2423
2424
2425
2426
2427
2428
              params.id = params.id.split(',');
              params.id = params.id.filter((id) => {
                return id !== '';
              });
            }
          }
zhongnanhuang authored
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
          //采购是否只查看需要自己处理的
          if (onlyShowProcureToBeProcessed) {
            params.condition = 10;
          }

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

          //是否只查看已作废
          params.isDeleteQueryOrder = onlyShowCancelOrder;
          //保存这个搜索条件
zhongnanhuang authored
2442
          setSearchParam(params);
2443
          const { data } = await postServiceOrderQueryServiceOrder({
2444
            // ...params,
calmound authored
2445
2446
2447
2448
            // FIXME: remove @ts-ignore
            // @ts-ignore
            sorter,
            filter,
zhongnanhuang authored
2449
            data: { ...params },
calmound authored
2450
          });
zhongnanhuang authored
2451
zhongnanhuang authored
2452
2453
2454
2455
2456
2457
2458
          let mainOrderIds = data?.data?.map((d) => d.id);
          if (mainOrderAllItemKeys === undefined) {
            setMainOrderAllItemKeys([]);
          } else {
            setMainOrderAllItemKeys(mainOrderIds);
          }
          setRolePath(data.specialPath);
zhongnanhuang authored
2459
          handleTableExpand(mainOrderIds);
2460
          setData(data?.data);
calmound authored
2461
          return {
2462
            data: data?.data || [],
zhongnanhuang authored
2463
            total: data?.total || 0,
calmound authored
2464
2465
          };
        }}
2466
2467
2468
        toolbar={{
          multipleLine: true,
        }}
zhongnanhuang authored
2469
2470
2471
        toolBarRender={() => {
          return toolBarRender();
        }}
2472
2473
      />
sanmu authored
2474
      {orderDrawerVisible && (
sanmu authored
2475
        <OrderDrawer
2476
          data={orderRow}
2477
          subOrders={selectedRows}
zhongnanhuang authored
2478
          onClose={(isSuccess: boolean) => {
sanmu authored
2479
            setOrderDrawerVisible(false);
2480
            setOrderRow({});
zhongnanhuang authored
2481
2482
2483
            if (isSuccess) {
              refreshTable();
            }
calmound authored
2484
          }}
2485
          orderOptType={orderOptType}
calmound authored
2486
        />
sanmu authored
2487
      )}
sanmu authored
2488
2489
2490
2491

      {checkVisible && (
        <CheckModal
          setCheckVisible={setCheckVisible}
2492
          data={orderRow}
2493
          subOrders={selectedRows}
zhongnanhuang authored
2494
          orderCheckType={orderCheckType}
zhongnanhuang authored
2495
2496
2497
2498
2499
          openOrderDrawer={(type: any, id: any) => {
            setOrderRow({ id: id });
            setOrderOptType(type);
            setOrderDrawerVisible(true);
          }}
sanmu authored
2500
2501
2502
          onClose={() => {
            setCheckVisible(false);
            setOrderRow({});
2503
            setSelectedRows({});
zhongnanhuang authored
2504
            refreshTable();
2505
2506
2507
2508
          }}
        />
      )}
zhongnanhuang authored
2509
2510
2511
      {applyForInvoicingVisible && (
        <ApplyForInvoicingModal
          setCheckVisible={setApplyForInvoicingVisible}
zhongnanhuang authored
2512
          data={selectedItems}
zhongnanhuang authored
2513
          subOrders={selectedRows}
2514
          isMainOrder={isMainOrder}
zhongnanhuang authored
2515
          isEdit={isEdit}
zhongnanhuang authored
2516
2517
2518
          onClose={() => {
            setApplyForInvoicingVisible(false);
            setSelectedRows({});
zhongnanhuang authored
2519
            setIsMainOrder(false);
zhongnanhuang authored
2520
2521
2522
2523
2524
            refreshTable();
          }}
        />
      )}
2525
      {notesEditVisible && (
zhongnanhuang authored
2526
        <OrderNotesEditModal
2527
2528
          setNotesEditVisible={setNotesEditVisible}
          data={orderRow}
zhongnanhuang authored
2529
          isMianOrder={isMainOrder}
2530
2531
2532
          onClose={() => {
            setNotesEditVisible(false);
            setOrderRow({});
zhongnanhuang authored
2533
            refreshTable();
sanmu authored
2534
2535
2536
2537
2538
2539
2540
          }}
        />
      )}

      {deliverVisible && (
        <DeliverModal
          data={selectedRows}
zhongnanhuang authored
2541
          isSendProduct={isSendProduct}
zhongnanhuang authored
2542
2543
2544
          setVisible={(b: boolean) => {
            setDeliverVisible(b);
          }}
zhongnanhuang authored
2545
          sendType={orderCheckType}
sanmu authored
2546
          onClose={() => {
zhongnanhuang authored
2547
            setDeliverVisible(false);
sanmu authored
2548
            setOrderRow({});
zhongnanhuang authored
2549
2550
            setIsSendProduct(false);
            refreshTable();
sanmu authored
2551
2552
2553
          }}
        />
      )}
zhongnanhuang authored
2554
2555
2556

      {financialVisible && (
        <FinancialDrawer
zhongnanhuang authored
2557
          isEdit={isEdit}
zhongnanhuang authored
2558
2559
          mainOrder={orderRow}
          subOrders={selectedRows}
zhongnanhuang authored
2560
          isMainOrder={isMainOrder}
zhongnanhuang authored
2561
2562
2563
2564
          cancel={() => {
            setFinancialVisible(false);
            setOrderRow({});
            setIsMainOrder(false);
zhongnanhuang authored
2565
            setIsEdit(false);
zhongnanhuang authored
2566
          }}
zhongnanhuang authored
2567
2568
2569
          onClose={() => {
            setFinancialVisible(false);
            setOrderRow({});
zhongnanhuang authored
2570
            refreshTable();
zhongnanhuang authored
2571
            setIsMainOrder(false);
zhongnanhuang authored
2572
            setIsEdit(false);
zhongnanhuang authored
2573
2574
2575
2576
          }}
        />
      )}
2577
2578
      {financialEditVisible && (
        <FinancialEditDrawer
2579
          mainOrder={orderRow}
2580
          subOrders={selectedRows}
2581
          isMainOrder={isMainOrder}
2582
2583
2584
2585
2586
2587
2588
2589
          setVisible={() => {
            setFinancialEditVisible(false);
            setIsMainOrder(false);
          }}
          onClose={() => {
            setFinancialEditVisible(false);
            refreshTable();
            setIsMainOrder(false);
2590
            setOrderRow({});
2591
2592
2593
2594
          }}
        />
      )}
zhongnanhuang authored
2595
2596
2597
2598
      {orderPrintVisible && (
        <OrderPrintModal
          mainOrder={orderRow}
          subOrders={selectedRows}
zhongnanhuang authored
2599
          isRePrint={isRePrintOrder}
zhongnanhuang authored
2600
2601
2602
          setVisible={(b: boolean) => {
            setOrderPrintVisible(b);
          }}
zhongnanhuang authored
2603
          printOptType={orderCheckType}
zhongnanhuang authored
2604
2605
2606
          onClose={() => {
            setOrderPrintVisible(false);
            setOrderRow({});
zhongnanhuang authored
2607
2608
            setIsRePrintOrder(false);
            refreshTable();
zhongnanhuang authored
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
          }}
        />
      )}

      {confirmReceiptVisible && (
        <ConfirmReceiptModal
          data={orderRow}
          onClose={() => {
            setConfirmReceiptVisible(false);
            setOrderRow({});
zhongnanhuang authored
2619
            refreshTable();
zhongnanhuang authored
2620
2621
2622
          }}
        />
      )}
zhongnanhuang authored
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633

      {subOrderConfirmReceiptImagesVisible && (
        <SubOrderComfirmReceiptImagesModal
          setVisible={setSubOrderConfirmReceiptImagesVisible}
          onClose={() => {
            setSubOrderConfirmReceiptImagesVisible(false);
          }}
          orderRow={orderRow}
        />
      )}
zhongnanhuang authored
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
      {importModalVisible && (
        <ImportModal
          onClose={() => {
            setImportModalVisible(false);
            refreshTable();
          }}
        />
      )}

      {attachmentModalVisible && (
        <AttachmentModal
          data={orderRow}
          onClose={() => {
            setAttachmentModalVisible(false);
            setOrderRow({});
          }}
        />
      )}
zhongnanhuang authored
2653
2654
2655
      {historyModalVisible && (
        <HistoryModal
          subOrders={selectedRows}
zhongnanhuang authored
2656
          isCancelledOrder={onlyShowCancelOrder}
zhongnanhuang authored
2657
2658
2659
2660
2661
2662
2663
          onClose={() => {
            setHistoryModalVisible(false);
            setSelectedRows({});
          }}
        />
      )}
zhongnanhuang authored
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
      {deliverInfoDrawerVisible && (
        <DeliverInfoDrawer
          data={orderRow}
          onClose={() => {
            setDeliverInfoDrawerVisible(false);
            setOrderRow({});
          }}
        />
      )}
zhongnanhuang authored
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
      {deliverInfoDrawerVisible && (
        <DeliverInfoDrawer
          data={orderRow}
          onClose={() => {
            setDeliverInfoDrawerVisible(false);
            setOrderRow({});
          }}
        />
      )}

      {procureCheckModalVisible && (
        <ProcureCheckModal
          setCheckVisible={setProcureCheckModalVisible}
          data={orderRow}
          subOrders={selectedRows}
          onClose={() => {
            setProcureCheckModalVisible(false);
            setOrderRow({});
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
      {afterSalesDrawerVisible && (
        <AfterSalesDrawer
          setVisible={setAfterSalesDrawerVisible}
          mainOrder={orderRow}
          subOrders={selectedRows}
          onClose={() => {
            setAfterSalesDrawerVisible(false);
            setSelectedRows({});
            setOrderRow({});
            refreshTable();
          }}
        />
      )}
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
      {procureConvertModalVisible && (
        <ProcureConvertModal
          setVisible={setProcureConvertModalVisible}
          subOrders={selectedRows}
          onClose={() => {
            setProcureConvertModalVisible(false);
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
      {financialMergeDrawerVisible && (
        <FinancialMergeDrawer
          setVisible={setFinancialMergeDrawerVisible}
          dataList={mainOrderSelectedRows}
          onClose={() => {
            setFinancialMergeDrawerVisible(false);
            setMainOrderSelectedRows([]);
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2736
2737
2738
      {financialReceiptsModalVisible && (
        <FinancialReceiptsModal
          setVisible={setFinancialReceiptsModalVisible}
2739
          datas={selectedRows}
zhongnanhuang authored
2740
2741
2742
2743
2744
2745
2746
2747
          onClose={() => {
            setFinancialReceiptsModalVisible(false);
            setSelectedRows({});
            refreshTable();
          }}
        />
      )}
zhongnanhuang authored
2748
      {contextHolder}
calmound authored
2749
2750
2751
2752
    </PageContainer>
  );
};
sanmu authored
2753
export default OrderPage;