Commit c89daffdcb177f6131e3fccdb8780f44b1039ceb
Merge branch 'bugfix-invoicestatus' into dev
Showing
24 changed files
with
3107 additions
and
1846 deletions
src/pages/Invoice/InvoiceRecord/components/InvoiceRecordDetailModal.tsx
... | ... | @@ -3,7 +3,6 @@ import InvoiceDetailTable from '@/pages/Invoice/InvoiceRecord/components/Invoice |
3 | 3 | import { |
4 | 4 | postServiceConstGetPayeeEnum, |
5 | 5 | postServiceConstInvoiceType, |
6 | - postServiceConstInvoicingType, | |
7 | 6 | postServiceInvoiceGetInvoiceRecord, |
8 | 7 | postServiceInvoiceModifyRecord, |
9 | 8 | } from '@/services'; |
... | ... | @@ -230,7 +229,7 @@ export default ({ id, setVisible, reloadTable }) => { |
230 | 229 | { required: true, message: 'Please select your country!' }, |
231 | 230 | ]} |
232 | 231 | /> |
233 | - <ProFormSelect | |
232 | + {/* <ProFormSelect | |
234 | 233 | name="invoicingType" |
235 | 234 | readonly={readOnly} |
236 | 235 | label="开具类型" |
... | ... | @@ -246,7 +245,7 @@ export default ({ id, setVisible, reloadTable }) => { |
246 | 245 | rules={[ |
247 | 246 | { required: true, message: 'Please select your country!' }, |
248 | 247 | ]} |
249 | - /> | |
248 | + /> */} | |
250 | 249 | <ProFormList |
251 | 250 | label="订单号" |
252 | 251 | name="orderIdList" | ... | ... |
src/pages/Invoice/InvoiceVerification/components/InvoiceRecordDetailModal.tsx
... | ... | @@ -3,7 +3,6 @@ import InvoiceDetailTable from '@/pages/Invoice/InvoiceVerification/components/I |
3 | 3 | import { |
4 | 4 | postServiceConstGetPayeeEnum, |
5 | 5 | postServiceConstInvoiceType, |
6 | - postServiceConstInvoicingType, | |
7 | 6 | postServiceInvoiceGetInvoiceRecord, |
8 | 7 | postServiceInvoiceModifyRecord, |
9 | 8 | } from '@/services'; |
... | ... | @@ -229,7 +228,7 @@ export default ({ id, setVisible }) => { |
229 | 228 | { required: true, message: 'Please select your country!' }, |
230 | 229 | ]} |
231 | 230 | /> |
232 | - <ProFormSelect | |
231 | + {/* <ProFormSelect | |
233 | 232 | name="invoicingType" |
234 | 233 | readonly={readOnly} |
235 | 234 | label="开具类型" |
... | ... | @@ -245,7 +244,7 @@ export default ({ id, setVisible }) => { |
245 | 244 | rules={[ |
246 | 245 | { required: true, message: 'Please select your country!' }, |
247 | 246 | ]} |
248 | - /> | |
247 | + /> */} | |
249 | 248 | <ProFormList |
250 | 249 | label="订单号" |
251 | 250 | name="orderIdList" | ... | ... |
src/pages/Invoice/waitProcessRecord/components/ManualInvoiceModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { PAYEE_OPTIONS } from '@/pages/Order/constant'; | |
3 | +import { postServiceOrderInvoicing } from '@/services'; | |
4 | +import { | |
5 | + ModalForm, | |
6 | + ProFormDatePicker, | |
7 | + ProFormDigit, | |
8 | + ProFormSelect, | |
9 | + ProFormText, | |
10 | +} from '@ant-design/pro-components'; | |
11 | +import { Form, message } from 'antd'; | |
12 | +import { useState } from 'react'; | |
13 | + | |
14 | +interface ManualInvoiceModalProps { | |
15 | + record: any; | |
16 | + onSuccess?: () => void; | |
17 | +} | |
18 | + | |
19 | +const ManualInvoiceModal: React.FC<ManualInvoiceModalProps> = ({ | |
20 | + record, | |
21 | + onSuccess, | |
22 | +}) => { | |
23 | + const [form] = Form.useForm(); | |
24 | + const [visible, setVisible] = useState(false); | |
25 | + | |
26 | + // 转换PAYEE_OPTIONS为Select组件需要的格式 | |
27 | + const payeeOptions = Object.entries(PAYEE_OPTIONS).map(([value, label]) => ({ | |
28 | + value, | |
29 | + label, | |
30 | + })); | |
31 | + | |
32 | + return ( | |
33 | + <ModalForm | |
34 | + title="手动开票" | |
35 | + trigger={ | |
36 | + <a | |
37 | + key="invoice" | |
38 | + style={{ color: '#1890ff' }} | |
39 | + onClick={() => setVisible(true)} | |
40 | + > | |
41 | + 开票 | |
42 | + </a> | |
43 | + } | |
44 | + width={600} | |
45 | + layout={'horizontal'} | |
46 | + form={form} | |
47 | + open={visible} | |
48 | + onOpenChange={setVisible} | |
49 | + autoFocusFirstInput | |
50 | + modalProps={{ | |
51 | + destroyOnClose: true, | |
52 | + }} | |
53 | + initialValues={{ | |
54 | + purchaser: record.partyAName, | |
55 | + payee: record.partyB, | |
56 | + money: record.price, | |
57 | + }} | |
58 | + submitTimeout={2000} | |
59 | + onFinish={async (values) => { | |
60 | + try { | |
61 | + const body = { | |
62 | + invoiceIdentificationNumber: values.purchaser, | |
63 | + invoicingTime: values.invoicingTime, | |
64 | + purchaser: values.purchaser, | |
65 | + financialReceiptIssuanceTime: | |
66 | + values.financialReceiptIssuanceTime || values.invoicingTime, | |
67 | + collectMoneyTime: values.collectMoneyTime || values.invoicingTime, | |
68 | + invoiceNumber: values.invoiceNumber, | |
69 | + payee: values.payee, | |
70 | + money: values.money, | |
71 | + afterInvoicingStatus: [record.type], | |
72 | + mainOrderIds: record.mainOrderIds, | |
73 | + invoiceRecordIds: [record.id], | |
74 | + }; | |
75 | + | |
76 | + // 根据现有组件实现,使用data来传递参数 | |
77 | + const res = await postServiceOrderInvoicing({ | |
78 | + data: body, | |
79 | + }); | |
80 | + | |
81 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
82 | + message.success('开票成功'); | |
83 | + if (onSuccess) { | |
84 | + onSuccess(); | |
85 | + } | |
86 | + return true; | |
87 | + } else { | |
88 | + message.error('开票失败'); | |
89 | + return false; | |
90 | + } | |
91 | + } catch (error) { | |
92 | + message.error('操作失败'); | |
93 | + return false; | |
94 | + } | |
95 | + }} | |
96 | + > | |
97 | + <ProFormText | |
98 | + width="md" | |
99 | + name="purchaser" | |
100 | + label="抬头名称" | |
101 | + rules={[{ required: true, message: '请输入抬头名称' }]} | |
102 | + disabled | |
103 | + /> | |
104 | + | |
105 | + <ProFormText | |
106 | + width="md" | |
107 | + name="invoiceType" | |
108 | + label="发票类型" | |
109 | + initialValue="普票" | |
110 | + disabled | |
111 | + /> | |
112 | + | |
113 | + <ProFormDigit | |
114 | + width="md" | |
115 | + name="money" | |
116 | + label="发票金额" | |
117 | + fieldProps={{ | |
118 | + precision: 2, | |
119 | + prefix: '¥', | |
120 | + }} | |
121 | + rules={[{ required: true, message: '请输入发票金额' }]} | |
122 | + disabled | |
123 | + /> | |
124 | + | |
125 | + <ProFormSelect | |
126 | + width="md" | |
127 | + name="payee" | |
128 | + label="收款单位" | |
129 | + options={payeeOptions} | |
130 | + rules={[{ required: true, message: '请选择收款单位' }]} | |
131 | + disabled | |
132 | + /> | |
133 | + | |
134 | + <ProFormText | |
135 | + width="md" | |
136 | + name="invoiceNumber" | |
137 | + label="发票号码" | |
138 | + rules={[{ required: true, message: '请输入发票号码' }]} | |
139 | + /> | |
140 | + | |
141 | + <ProFormDatePicker | |
142 | + width="md" | |
143 | + name="invoicingTime" | |
144 | + label="开票时间" | |
145 | + rules={[{ required: true, message: '请选择开票时间' }]} | |
146 | + fieldProps={{ | |
147 | + format: 'YYYY-MM-DD', | |
148 | + }} | |
149 | + /> | |
150 | + </ModalForm> | |
151 | + ); | |
152 | +}; | |
153 | + | |
154 | +export default ManualInvoiceModal; | ... | ... |
src/pages/Invoice/waitProcessRecord/index.tsx
... | ... | @@ -2,6 +2,7 @@ import { RESPONSE_CODE } from '@/constants/enum'; |
2 | 2 | import InvoiceRecordDetailModal from '@/pages/Invoice/InvoiceRecord/components/InvoiceRecordDetailModal'; |
3 | 3 | import InvoiceModal from '@/pages/Invoice/waitProcessRecord/components/InvoiceModal'; |
4 | 4 | import InvoicingModal from '@/pages/Invoice/waitProcessRecord/components/InvoicingModal'; |
5 | +import ManualInvoiceModal from '@/pages/Invoice/waitProcessRecord/components/ManualInvoiceModal'; | |
5 | 6 | import ManualInvoicingModal from '@/pages/Invoice/waitProcessRecord/components/ManualInvoicingModal'; |
6 | 7 | import { PAYEE_OPTIONS } from '@/pages/Order/constant'; |
7 | 8 | import { |
... | ... | @@ -20,6 +21,7 @@ import { |
20 | 21 | Popconfirm, |
21 | 22 | Space, |
22 | 23 | Table, |
24 | + Tabs, | |
23 | 25 | Tooltip, |
24 | 26 | message, |
25 | 27 | } from 'antd'; |
... | ... | @@ -27,12 +29,15 @@ import { useEffect, useRef, useState } from 'react'; |
27 | 29 | |
28 | 30 | const InvoiceRecord = () => { |
29 | 31 | const waitDealrecordActionRef = useRef<ActionType>(); |
32 | + const manualInvoiceActionRef = useRef<ActionType>(); | |
30 | 33 | const [invoiceTypeValueEnum, setInvoiceTypeValueEnum] = useState({}); |
31 | 34 | const [invoicingTypeValueEnum, setInvoicingTypeValueEnum] = useState({}); |
32 | 35 | const [salesCodeValueEnum, setSalesCodeValueEnum] = useState({}); |
33 | 36 | const [invoiceRecordDetailVisible, setInvoiceRecordDetailVisible] = |
34 | 37 | useState(false); |
35 | 38 | const [invoiceRecord, setInvoiceRecord] = useState({}); |
39 | + const [activeTab, setActiveTab] = useState('auto'); | |
40 | + | |
36 | 41 | useEffect(() => { |
37 | 42 | async function extracted() { |
38 | 43 | let invoiceTypeRet = await postServiceConstInvoiceType(); |
... | ... | @@ -65,7 +70,11 @@ const InvoiceRecord = () => { |
65 | 70 | }, []); |
66 | 71 | |
67 | 72 | const reloadRecordTable = () => { |
68 | - waitDealrecordActionRef.current?.reload(); | |
73 | + if (activeTab === 'auto') { | |
74 | + waitDealrecordActionRef.current?.reload(); | |
75 | + } else { | |
76 | + manualInvoiceActionRef.current?.reload(); | |
77 | + } | |
69 | 78 | }; |
70 | 79 | |
71 | 80 | const waitDealRecordColumns = [ |
... | ... | @@ -287,11 +296,11 @@ const InvoiceRecord = () => { |
287 | 296 | valueEnum: { |
288 | 297 | true: { |
289 | 298 | text: '是', |
290 | - status: true, | |
299 | + status: 'true', | |
291 | 300 | }, |
292 | 301 | false: { |
293 | 302 | text: '否', |
294 | - status: false, | |
303 | + status: 'false', | |
295 | 304 | }, |
296 | 305 | }, |
297 | 306 | }, |
... | ... | @@ -319,15 +328,6 @@ const InvoiceRecord = () => { |
319 | 328 | width: 200, |
320 | 329 | render: (text, record) => { |
321 | 330 | return [ |
322 | - /*<InvoiceRecordDetailModal | |
323 | - key="detail" | |
324 | - id={record.id} | |
325 | - subOrderIds={record.subOrderIds} | |
326 | - onClose={()=>{ | |
327 | - waitDealrecordActionRef.current?.reload(); | |
328 | - } | |
329 | - } | |
330 | - />*/ | |
331 | 331 | <> |
332 | 332 | {record.paths.includes('DETAIL') && ( |
333 | 333 | <a |
... | ... | @@ -368,7 +368,7 @@ const InvoiceRecord = () => { |
368 | 368 | if (res.result === RESPONSE_CODE.SUCCESS) { |
369 | 369 | message.success('取消成功'); |
370 | 370 | } |
371 | - waitDealrecordActionRef?.current?.reload(); | |
371 | + reloadRecordTable(); | |
372 | 372 | }} |
373 | 373 | okText="确定" |
374 | 374 | cancelText="取消" |
... | ... | @@ -383,74 +383,327 @@ const InvoiceRecord = () => { |
383 | 383 | }, |
384 | 384 | }, |
385 | 385 | ]; |
386 | - return ( | |
387 | - <div className="invoice-index"> | |
388 | - <ProTable | |
389 | - columns={waitDealRecordColumns} | |
390 | - actionRef={waitDealrecordActionRef} | |
391 | - cardBordered | |
392 | - pagination={{ | |
393 | - showSizeChanger: true, // 显示可以选择每页显示条数的下拉菜单 | |
394 | - pageSizeOptions: ['10', '20', '50', '100'], // 设置可以选择的每页显示条数选项 | |
395 | - }} | |
396 | - rowSelection={{ | |
397 | - selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT], | |
398 | - alwaysShowAlert: true, | |
399 | - }} | |
400 | - tableAlertOptionRender={({ selectedRowKeys, selectedRows }) => { | |
401 | - console.log(selectedRows); | |
402 | - console.log(selectedRowKeys); | |
403 | - return ( | |
404 | - <Space size={16}> | |
405 | - <InvoicingModal | |
406 | - reloadRecordTable={reloadRecordTable} | |
407 | - key="button" | |
408 | - selectedRowKeys={selectedRowKeys} | |
409 | - /> | |
410 | - </Space> | |
411 | - ); | |
412 | - }} | |
413 | - request={async (params) => { | |
414 | - let res = await postServiceInvoiceQueryInvoiceRecordList({ | |
415 | - data: { | |
416 | - ...params, | |
417 | - statusIn: [ | |
418 | - 'WAITING_FOR_INVOICING', | |
419 | - 'AUDITING', | |
420 | - 'AUDITING_NOT_PASSED', | |
421 | - ], | |
422 | - needBuildDetails: true, | |
423 | - needBuildSubOrders: true, | |
424 | - }, | |
386 | + | |
387 | + // 手动开票表格列配置 | |
388 | + const manualInvoiceColumns = [ | |
389 | + { | |
390 | + dataIndex: 'index', | |
391 | + valueType: 'indexBorder', | |
392 | + hideInSearch: true, | |
393 | + ellipsis: true, | |
394 | + width: 48, | |
395 | + }, | |
396 | + { | |
397 | + title: '开票编号', | |
398 | + valueType: 'text', | |
399 | + dataIndex: 'id', | |
400 | + copyable: true, | |
401 | + hideInSearch: true, | |
402 | + ellipsis: true, | |
403 | + width: 100, | |
404 | + }, | |
405 | + { | |
406 | + title: '订单号', | |
407 | + valueType: 'text', | |
408 | + dataIndex: 'mainOrderIds', | |
409 | + hideInSearch: true, | |
410 | + ellipsis: true, | |
411 | + width: 150, | |
412 | + }, | |
413 | + { | |
414 | + title: '开票金额', | |
415 | + valueType: 'money', | |
416 | + dataIndex: 'price', | |
417 | + width: 100, | |
418 | + hideInSearch: true, | |
419 | + ellipsis: true, | |
420 | + }, | |
421 | + { | |
422 | + title: '购方名称', | |
423 | + valueType: 'text', | |
424 | + dataIndex: 'partyAName', | |
425 | + width: 150, | |
426 | + hideInSearch: true, | |
427 | + ellipsis: true, | |
428 | + }, | |
429 | + { | |
430 | + title: '收款单位', | |
431 | + valueType: 'text', | |
432 | + hideInSearch: true, | |
433 | + width: 150, | |
434 | + dataIndex: 'partyBName', | |
435 | + ellipsis: true, | |
436 | + }, | |
437 | + { | |
438 | + title: '开票类型', | |
439 | + valueType: 'Text', | |
440 | + dataIndex: 'typeText', | |
441 | + width: 100, | |
442 | + hideInSearch: true, | |
443 | + ellipsis: true, | |
444 | + }, | |
445 | + { | |
446 | + title: '是否加急', | |
447 | + valueType: 'Text', | |
448 | + dataIndex: 'isUrgentText', | |
449 | + width: 80, | |
450 | + hideInSearch: true, | |
451 | + ellipsis: true, | |
452 | + }, | |
453 | + { | |
454 | + title: '附件', | |
455 | + key: 'filePaths', | |
456 | + ellipsis: true, | |
457 | + width: 100, | |
458 | + hideInSearch: true, | |
459 | + render: (_, record) => { | |
460 | + if (record.filePaths && record.filePaths.length > 0) { | |
461 | + return record.filePaths.map((item) => { | |
462 | + const url = item; | |
463 | + const filenameMatch = url.match(/\/([^/]+)\?/); | |
464 | + const filename = filenameMatch ? filenameMatch[1] : 'file'; | |
465 | + | |
466 | + const decodedFilename = decodeURIComponent(filename); | |
467 | + | |
468 | + const cleanFilename = decodedFilename.replace(/^\d+-\d+-/, ''); | |
469 | + | |
470 | + return ( | |
471 | + <div style={{ marginBottom: '5px' }} key={url}> | |
472 | + <a | |
473 | + href={url} | |
474 | + rel="noopener noreferrer" | |
475 | + download={cleanFilename} | |
476 | + > | |
477 | + {cleanFilename} | |
478 | + </a> | |
479 | + </div> | |
480 | + ); | |
425 | 481 | }); |
426 | - return { | |
427 | - data: res?.data?.data, | |
428 | - total: res?.data?.total || 0, | |
429 | - }; | |
430 | - }} | |
431 | - columnsState={{ | |
432 | - persistenceKey: 'pro-table-singe-demos', | |
433 | - persistenceType: 'localStorage', | |
434 | - defaultValue: { | |
435 | - option: { fixed: 'right', disable: true }, | |
482 | + } | |
483 | + return '-'; | |
484 | + }, | |
485 | + }, | |
486 | + { | |
487 | + title: '申请时间', | |
488 | + dataIndex: 'createTime', | |
489 | + valueType: 'dateTime', | |
490 | + width: 160, | |
491 | + hideInSearch: true, | |
492 | + ellipsis: true, | |
493 | + }, | |
494 | + { | |
495 | + title: '申请人', | |
496 | + valueType: 'text', | |
497 | + hideInSearch: false, | |
498 | + ellipsis: true, | |
499 | + width: 100, | |
500 | + dataIndex: 'createByName', | |
501 | + }, | |
502 | + { | |
503 | + title: '操作', | |
504 | + valueType: 'option', | |
505 | + key: 'option', | |
506 | + width: 120, | |
507 | + render: (_, record) => { | |
508 | + return [ | |
509 | + <ManualInvoiceModal | |
510 | + key="invoice" | |
511 | + record={record} | |
512 | + onSuccess={() => reloadRecordTable()} | |
513 | + />, | |
514 | + <Popconfirm | |
515 | + key="cancel" | |
516 | + title="取消开票" | |
517 | + description="确认取消开票?" | |
518 | + onConfirm={async () => { | |
519 | + let res = await postServiceInvoiceCancelInvoiceRecord({ | |
520 | + data: { | |
521 | + invoiceRecordIds: [record.id], | |
522 | + }, | |
523 | + }); | |
524 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
525 | + message.success('取消成功'); | |
526 | + } | |
527 | + reloadRecordTable(); | |
528 | + }} | |
529 | + okText="确定" | |
530 | + cancelText="取消" | |
531 | + > | |
532 | + <a key="cancel" style={{ color: '#ff4d4f' }}> | |
533 | + 取消 | |
534 | + </a> | |
535 | + </Popconfirm>, | |
536 | + ]; | |
537 | + }, | |
538 | + }, | |
539 | + // 搜索项 | |
540 | + { | |
541 | + title: '订单号', | |
542 | + valueType: 'Text', | |
543 | + dataIndex: 'mainOrderIds', | |
544 | + hideInTable: true, | |
545 | + }, | |
546 | + { | |
547 | + title: '购方名称', | |
548 | + valueType: 'Text', | |
549 | + dataIndex: 'partyANameLike', | |
550 | + hideInTable: true, | |
551 | + }, | |
552 | + { | |
553 | + title: '收款单位', | |
554 | + valueType: 'select', | |
555 | + dataIndex: 'partyB', | |
556 | + filters: true, | |
557 | + onFilter: true, | |
558 | + hideInTable: true, | |
559 | + valueEnum: enumToProTableEnumValue(PAYEE_OPTIONS), | |
560 | + }, | |
561 | + { | |
562 | + title: '发票类型', | |
563 | + valueType: 'select', | |
564 | + dataIndex: 'type', | |
565 | + filters: true, | |
566 | + onFilter: true, | |
567 | + hideInTable: true, | |
568 | + valueEnum: enumToProTableEnumValue(invoiceTypeValueEnum), | |
569 | + }, | |
570 | + { | |
571 | + title: '是否加急', | |
572 | + valueType: 'select', | |
573 | + dataIndex: 'isUrgent', | |
574 | + filters: true, | |
575 | + onFilter: true, | |
576 | + hideInTable: true, | |
577 | + valueEnum: { | |
578 | + true: { | |
579 | + text: '是', | |
580 | + status: 'true', | |
581 | + }, | |
582 | + false: { | |
583 | + text: '否', | |
584 | + status: 'false', | |
585 | + }, | |
586 | + }, | |
587 | + }, | |
588 | + { | |
589 | + title: '申请时间', | |
590 | + dataIndex: 'createTime', | |
591 | + valueType: 'dateTimeRange', | |
592 | + width: 200, | |
593 | + hideInTable: true, | |
594 | + search: { | |
595 | + transform: (value) => { | |
596 | + if (value) { | |
597 | + return { | |
598 | + createTimeGe: value[0], | |
599 | + createTimeLe: value[1], | |
600 | + }; | |
601 | + } | |
602 | + }, | |
603 | + }, | |
604 | + }, | |
605 | + ]; | |
606 | + | |
607 | + const renderProTable = (isManual) => { | |
608 | + const tableProps = { | |
609 | + columns: isManual ? manualInvoiceColumns : waitDealRecordColumns, | |
610 | + actionRef: isManual ? manualInvoiceActionRef : waitDealrecordActionRef, | |
611 | + cardBordered: true, | |
612 | + pagination: { | |
613 | + showSizeChanger: true, // 显示可以选择每页显示条数的下拉菜单 | |
614 | + pageSizeOptions: ['10', '20', '50', '100'], // 设置可以选择的每页显示条数选项 | |
615 | + }, | |
616 | + request: async (params) => { | |
617 | + let res = await postServiceInvoiceQueryInvoiceRecordList({ | |
618 | + data: { | |
619 | + ...params, | |
620 | + isManual: isManual, | |
621 | + statusIn: [ | |
622 | + 'WAITING_FOR_INVOICING', | |
623 | + 'AUDITING', | |
624 | + 'AUDITING_NOT_PASSED', | |
625 | + ], | |
626 | + needBuildDetails: true, | |
627 | + needBuildSubOrders: true, | |
436 | 628 | }, |
437 | - onChange(value) { | |
438 | - console.log('value: ', value); | |
629 | + }); | |
630 | + return { | |
631 | + data: res?.data?.data, | |
632 | + total: res?.data?.total || 0, | |
633 | + }; | |
634 | + }, | |
635 | + columnsState: { | |
636 | + persistenceKey: isManual | |
637 | + ? 'manual-invoice-table' | |
638 | + : 'auto-invoice-table', | |
639 | + persistenceType: 'localStorage', | |
640 | + defaultValue: { | |
641 | + option: { fixed: 'right', disable: true }, | |
642 | + }, | |
643 | + onChange(value) { | |
644 | + console.log('value: ', value); | |
645 | + }, | |
646 | + }, | |
647 | + rowKey: 'id', | |
648 | + search: { | |
649 | + labelWidth: 'auto', | |
650 | + }, | |
651 | + options: { | |
652 | + setting: { | |
653 | + listsHeight: 400, | |
654 | + }, | |
655 | + }, | |
656 | + form: {}, | |
657 | + dateFormatter: 'string', | |
658 | + headerTitle: isManual ? '手动开票列表' : '自动开票列表', | |
659 | + scroll: { x: 2000, y: 500 }, | |
660 | + }; | |
661 | + | |
662 | + // 如果不是手动开票,添加多选功能 | |
663 | + if (!isManual) { | |
664 | + tableProps.rowSelection = { | |
665 | + selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT], | |
666 | + alwaysShowAlert: true, | |
667 | + }; | |
668 | + | |
669 | + tableProps.tableAlertOptionRender = ({ | |
670 | + selectedRowKeys, | |
671 | + selectedRows, | |
672 | + }) => { | |
673 | + console.log(selectedRows); | |
674 | + console.log(selectedRowKeys); | |
675 | + return ( | |
676 | + <Space size={16}> | |
677 | + <InvoicingModal | |
678 | + reloadRecordTable={reloadRecordTable} | |
679 | + key="button" | |
680 | + selectedRowKeys={selectedRowKeys} | |
681 | + /> | |
682 | + </Space> | |
683 | + ); | |
684 | + }; | |
685 | + } | |
686 | + | |
687 | + return <ProTable {...tableProps} />; | |
688 | + }; | |
689 | + | |
690 | + return ( | |
691 | + <div className="invoice-index"> | |
692 | + <Tabs | |
693 | + activeKey={activeTab} | |
694 | + onChange={(key) => setActiveTab(key)} | |
695 | + items={[ | |
696 | + { | |
697 | + key: 'auto', | |
698 | + label: '自动开票', | |
699 | + children: renderProTable(false), | |
439 | 700 | }, |
440 | - }} | |
441 | - rowKey="id" | |
442 | - search={{ | |
443 | - labelWidth: 'auto', | |
444 | - }} | |
445 | - options={{ | |
446 | - setting: { | |
447 | - listsHeight: 400, | |
701 | + { | |
702 | + key: 'manual', | |
703 | + label: '手动开票', | |
704 | + children: renderProTable(true), | |
448 | 705 | }, |
449 | - }} | |
450 | - form={{}} | |
451 | - dateFormatter="string" | |
452 | - headerTitle="待开票列表" | |
453 | - scroll={{ x: 2000, y: 500 }} | |
706 | + ]} | |
454 | 707 | /> |
455 | 708 | {invoiceRecordDetailVisible ? ( |
456 | 709 | <InvoiceRecordDetailModal |
... | ... | @@ -458,7 +711,7 @@ const InvoiceRecord = () => { |
458 | 711 | id={invoiceRecord.id} |
459 | 712 | setVisible={setInvoiceRecordDetailVisible} |
460 | 713 | reloadTable={() => { |
461 | - waitDealrecordActionRef?.current?.reload(); | |
714 | + reloadRecordTable(); | |
462 | 715 | }} |
463 | 716 | /> |
464 | 717 | ) : ( | ... | ... |
src/pages/Order/FeedBack/InvoicingDrawerForm.tsx
... | ... | @@ -4,7 +4,6 @@ import { |
4 | 4 | postServiceConstGetPayeeEnum, |
5 | 5 | postServiceConstInitInvoiceDetailNames, |
6 | 6 | postServiceConstInvoiceType, |
7 | - postServiceConstInvoicingType, | |
8 | 7 | postServiceConstListInvoiceDetailNames, |
9 | 8 | postServiceInvoiceApplyInvoice, |
10 | 9 | postServiceInvoiceQueryCompanyInfo, |
... | ... | @@ -298,7 +297,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { |
298 | 297 | label="联系人" |
299 | 298 | rules={[{ required: true, message: '请选择银行联行号!' }]} |
300 | 299 | /> |
301 | - <ProFormSelect | |
300 | + {/* <ProFormSelect | |
302 | 301 | name="invoicingType" |
303 | 302 | label="开具类型" |
304 | 303 | request={async () => { |
... | ... | @@ -308,7 +307,7 @@ export default ({ dataList, setVisible, mainOrder, onClose }) => { |
308 | 307 | }} |
309 | 308 | placeholder="请选择开具类型" |
310 | 309 | rules={[{ required: true, message: '请选择开具类型!' }]} |
311 | - /> | |
310 | + /> */} | |
312 | 311 | <ProFormSelect |
313 | 312 | name="type" |
314 | 313 | label="开票类型" | ... | ... |
src/pages/Order/FeedBack/OrderDrawer.tsx
... | ... | @@ -1492,7 +1492,19 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
1492 | 1492 | onChange={(val: any) => { |
1493 | 1493 | setPaymentMethod(val); |
1494 | 1494 | }} |
1495 | - options={enumToSelect(PAYMENT_METHOD_OPTIONS)} | |
1495 | + options={(() => { | |
1496 | + // 使用Set记录已经处理过的选项值,避免重复 | |
1497 | + const processedValues = new Set(); | |
1498 | + const finalOptions = []; | |
1499 | + | |
1500 | + // 处理可选项 | |
1501 | + enumToSelect(PAYMENT_METHOD_OPTIONS).forEach((option) => { | |
1502 | + finalOptions.push(option); | |
1503 | + processedValues.add(option.value); | |
1504 | + }); | |
1505 | + | |
1506 | + return finalOptions; | |
1507 | + })()} | |
1496 | 1508 | rules={[{ required: true, message: '支付方式必填' }]} |
1497 | 1509 | disabled={optType('after-sales-check')} |
1498 | 1510 | /> | ... | ... |
src/pages/Order/FeedBack/constant.ts
... | ... | @@ -24,9 +24,10 @@ export const RECEIPTS_RECORD_TYPES = { |
24 | 24 | export const PAYMENT_METHOD_OPTIONS = { |
25 | 25 | UNPAID: '未付款', |
26 | 26 | TAOBAO_ORDER_HAS_BEEN_PAID: '淘宝订单已付款', |
27 | - OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID: '官网订单已付款', | |
28 | - PAYMENT_IN_ADVANCE: '预付款', | |
29 | - WITHHOLDING_ADVANCE_DEPOSIT: '扣预存', | |
27 | + OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID: '官网已付', | |
28 | + PAYMENT_IN_ADVANCE: '预付', | |
29 | + PAYMENT_IN_TAOBAO: '淘宝', | |
30 | + WITHHOLDING_ADVANCE_DEPOSIT: '预付', | |
30 | 31 | PLATFORM_SETTLEMENT: '平台结算', |
31 | 32 | CASH_ON_DELIVERY: '货到付款', |
32 | 33 | HIRE_PURCHASE: '分期付款', |
... | ... | @@ -250,12 +251,8 @@ export const FINANCIAL_STATUS_OPTIONS = { |
250 | 251 | export const AFTER_INVOICING_STATUS = { |
251 | 252 | NOT_YET_INVOICED: '尚未开票', |
252 | 253 | APPLY_FOR_INVOICING: '申请开票', |
253 | - URGENT_INVOICE_AUDITING: '加急待审核', | |
254 | - URGENT_INVOICE_AUDIT_NOTPASS: '加急审核失败', | |
255 | 254 | PARTIAL_INVOICING: '部分开票', |
256 | 255 | COMPLETE_INVOICING: '完全开票', |
257 | - INVOICING: '开票中', | |
258 | - REISSUE: '重新开票', | |
259 | 256 | }; |
260 | 257 | |
261 | 258 | export const TAGS_COLOR = new Map<string, string>([ | ... | ... |
src/pages/Order/Order/components/InvoicingDrawerForm.tsx
... | ... | @@ -4,7 +4,6 @@ import { |
4 | 4 | postServiceConstGetPayeeEnum, |
5 | 5 | postServiceConstInitInvoiceDetailNames, |
6 | 6 | postServiceConstInvoiceType, |
7 | - postServiceConstInvoicingType, | |
8 | 7 | postServiceConstListInvoiceDetailNames, |
9 | 8 | postServiceInvoiceApplyInvoice, |
10 | 9 | postServiceInvoiceQueryCompanyInfo, |
... | ... | @@ -326,7 +325,7 @@ export default ({ |
326 | 325 | label="联系人" |
327 | 326 | rules={[{ required: true, message: '请选择银行联行号!' }]} |
328 | 327 | /> |
329 | - <ProFormSelect | |
328 | + {/* <ProFormSelect | |
330 | 329 | name="invoicingType" |
331 | 330 | label="开具类型" |
332 | 331 | request={async () => { |
... | ... | @@ -336,7 +335,7 @@ export default ({ |
336 | 335 | }} |
337 | 336 | placeholder="请选择开具类型" |
338 | 337 | rules={[{ required: true, message: '请选择开具类型!' }]} |
339 | - /> | |
338 | + /> */} | |
340 | 339 | <ProFormSelect |
341 | 340 | name="type" |
342 | 341 | label="开票类型" | ... | ... |
src/pages/Order/Order/components/OrderDrawer.tsx
... | ... | @@ -1501,7 +1501,19 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
1501 | 1501 | onChange={(val: any) => { |
1502 | 1502 | setPaymentMethod(val); |
1503 | 1503 | }} |
1504 | - options={enumToSelect(PAYMENT_METHOD_OPTIONS)} | |
1504 | + options={(() => { | |
1505 | + // 使用Set记录已经处理过的选项值,避免重复 | |
1506 | + const processedValues = new Set(); | |
1507 | + const finalOptions = []; | |
1508 | + | |
1509 | + // 处理可选项 | |
1510 | + enumToSelect(PAYMENT_METHOD_OPTIONS).forEach((option) => { | |
1511 | + finalOptions.push(option); | |
1512 | + processedValues.add(option.value); | |
1513 | + }); | |
1514 | + | |
1515 | + return finalOptions; | |
1516 | + })()} | |
1505 | 1517 | rules={[{ required: true, message: '支付方式必填' }]} |
1506 | 1518 | disabled={optType('after-sales-check')} |
1507 | 1519 | /> | ... | ... |
src/pages/Order/Order/index.tsx
... | ... | @@ -120,7 +120,7 @@ const OrderPage = () => { |
120 | 120 | <div className="order-page-container"> |
121 | 121 | <div id="resizeDiv"></div> |
122 | 122 | <div id="resizeDiv"></div> |
123 | - {roleCode === 'SALES_MANAGER' && ( | |
123 | + {roleCode !== 'SALES_MANAGER' && ( | |
124 | 124 | <Modal |
125 | 125 | title="订单预警提醒" |
126 | 126 | open={open} |
... | ... | @@ -135,6 +135,11 @@ const OrderPage = () => { |
135 | 135 | > |
136 | 136 | 去处理 |
137 | 137 | </Button>, |
138 | + roleCode === 'ADMIN' && ( | |
139 | + <Button key="cancel" size="large" onClick={() => setOpen(false)}> | |
140 | + 取消 | |
141 | + </Button> | |
142 | + ), | |
138 | 143 | ]} |
139 | 144 | > |
140 | 145 | <ProCard | ... | ... |
src/pages/Order/OrderList/ApplyForInvoicingModal.tsx
1 | 1 | import { RESPONSE_CODE } from '@/constants/enum'; |
2 | -import { postServiceOrderApplyInvoicing } from '@/services'; | |
3 | -import { enumToSelect, getAliYunOSSFileNameFromUrl } from '@/utils'; | |
2 | +import { | |
3 | + postServiceOrderApplyInvoicing, | |
4 | + postServiceOrderQueryServiceOrder, | |
5 | +} from '@/services'; | |
6 | +import { FloatAdd, enumToSelect, getAliYunOSSFileNameFromUrl } from '@/utils'; | |
4 | 7 | import { |
5 | 8 | ModalForm, |
9 | + ProFormMoney, | |
6 | 10 | ProFormSelect, |
7 | 11 | ProFormText, |
8 | 12 | ProFormTextArea, |
... | ... | @@ -11,21 +15,140 @@ import { |
11 | 15 | import { Form, message } from 'antd'; |
12 | 16 | import { useEffect, useState } from 'react'; |
13 | 17 | import { PAYEE_OPTIONS } from '../constant'; |
18 | + | |
19 | +// 定义选项类型 | |
20 | +interface SelectOption { | |
21 | + label: string; | |
22 | + value: string; | |
23 | +} | |
24 | + | |
14 | 25 | export default ({ |
15 | 26 | setCheckVisible, |
16 | 27 | isEdit, |
17 | 28 | subOrders, |
18 | - isMainOrder, | |
19 | - totalPayment, | |
29 | + mainOrders, | |
20 | 30 | onClose, |
31 | +}: { | |
32 | + setCheckVisible: (val: boolean) => void; | |
33 | + isEdit?: boolean; | |
34 | + subOrders: any[]; | |
35 | + mainOrders: any[]; | |
36 | + onClose: () => void; | |
21 | 37 | }) => { |
22 | 38 | const [isUrgent, setIsUrgent] = useState(''); |
23 | - let sumPrice = totalPayment; | |
39 | + const [receivingCompanyOptions, setReceivingCompanyOptions] = useState< | |
40 | + SelectOption[] | |
41 | + >([]); | |
42 | + const [additionalMainOrders, setAdditionalMainOrders] = useState<any[]>([]); | |
24 | 43 | |
25 | 44 | let ids = subOrders?.map((item) => { |
26 | 45 | return item.id; |
27 | 46 | }); |
28 | 47 | |
48 | + // 定义返回类型接口 | |
49 | + interface MainOrderData { | |
50 | + value: string | number; | |
51 | + totalPayment: number; | |
52 | + invoiceIssuedAmount: number; | |
53 | + availableAmount: number; | |
54 | + } | |
55 | + | |
56 | + // 解析输入框内容,识别格式如 "23123,2507310003" | |
57 | + const parseInputContent = (content: string): string[] => { | |
58 | + if (!content) return []; | |
59 | + return content | |
60 | + .split(',') | |
61 | + .map((id) => id.trim()) | |
62 | + .filter((id) => id); | |
63 | + }; | |
64 | + | |
65 | + // 查询未选择的订单数据 | |
66 | + const queryMissingOrders = async (missingIds: string[]) => { | |
67 | + try { | |
68 | + const { data } = await postServiceOrderQueryServiceOrder({ | |
69 | + // @ts-ignore | |
70 | + data: { | |
71 | + current: 1, | |
72 | + pageSize: 10, | |
73 | + id: missingIds, | |
74 | + condition: 0, | |
75 | + sorted: false, | |
76 | + isDeleteQueryOrder: false, | |
77 | + }, | |
78 | + }); | |
79 | + | |
80 | + if (data?.data) { | |
81 | + setAdditionalMainOrders(data.data); | |
82 | + } | |
83 | + } catch (error) { | |
84 | + console.error('查询订单失败:', error); | |
85 | + message.error('查询订单数据失败'); | |
86 | + } | |
87 | + }; | |
88 | + | |
89 | + // 获取唯一的主订单ID及其相关金额信息 | |
90 | + const getUniqueMainOrderIds = (): MainOrderData[] => { | |
91 | + console.log(subOrders, mainOrders); | |
92 | + const mainOrderIds = subOrders?.map((item: any) => item.mainOrderId); | |
93 | + const uniqueIds = [...new Set(mainOrderIds)].filter(Boolean); | |
94 | + | |
95 | + const result = uniqueIds.map((id) => { | |
96 | + // 获取该主订单的数据 | |
97 | + const mainOrder = mainOrders | |
98 | + ? mainOrders.find((item: any) => item.id === id) | |
99 | + : null; | |
100 | + | |
101 | + // 获取该主订单下所有子订单 | |
102 | + const orderSubOrders = subOrders.filter( | |
103 | + (item: any) => item.mainOrderId === id, | |
104 | + ); | |
105 | + | |
106 | + // 计算该主订单的总金额 | |
107 | + let totalPayment = mainOrder ? mainOrder.totalPayment : 0; | |
108 | + if (!totalPayment) { | |
109 | + orderSubOrders.forEach((item: any) => { | |
110 | + totalPayment = FloatAdd(totalPayment, item.totalPayment || 0); | |
111 | + }); | |
112 | + } | |
113 | + | |
114 | + // 计算已开票金额(如果有的话) | |
115 | + let invoiceIssuedAmount = mainOrder | |
116 | + ? mainOrder.invoiceIssuedAmount || 0 | |
117 | + : 0; | |
118 | + if (!invoiceIssuedAmount) { | |
119 | + orderSubOrders.forEach((item: any) => { | |
120 | + invoiceIssuedAmount = FloatAdd( | |
121 | + invoiceIssuedAmount, | |
122 | + item.invoiceIssuedAmount || 0, | |
123 | + ); | |
124 | + }); | |
125 | + } | |
126 | + | |
127 | + // 计算可开票金额 | |
128 | + const availableAmount = Math.max(0, totalPayment - invoiceIssuedAmount); | |
129 | + | |
130 | + return { | |
131 | + value: String(id), | |
132 | + totalPayment, | |
133 | + invoiceIssuedAmount, | |
134 | + availableAmount, | |
135 | + }; | |
136 | + }); | |
137 | + | |
138 | + // 添加额外查询到的订单数据 | |
139 | + const additionalOrders = additionalMainOrders.map((order) => ({ | |
140 | + value: String(order.id), | |
141 | + totalPayment: order.totalPayment || 0, | |
142 | + invoiceIssuedAmount: order.invoiceIssuedAmount || 0, | |
143 | + availableAmount: Math.max( | |
144 | + 0, | |
145 | + (order.totalPayment || 0) - (order.invoiceIssuedAmount || 0), | |
146 | + ), | |
147 | + })); | |
148 | + | |
149 | + return [...result, ...additionalOrders]; | |
150 | + }; | |
151 | + | |
29 | 152 | let mainIdSet = new Set(); |
30 | 153 | subOrders?.forEach((item: { mainOrderId: unknown }) => { |
31 | 154 | mainIdSet.add(item.mainOrderId); |
... | ... | @@ -58,13 +181,58 @@ export default ({ |
58 | 181 | receivingCompany: string; |
59 | 182 | isUrgent: boolean; |
60 | 183 | deadline: string; |
184 | + invoiceType: string; // 新增发票类型字段 | |
61 | 185 | }>(); |
62 | 186 | |
187 | + // 处理备注内容变化 | |
188 | + const handleNotesChange = async (value: string) => { | |
189 | + const inputIds = parseInputContent(value); | |
190 | + const selectedMainOrderIds = Array.from(mainIdSet).map((id) => String(id)); | |
191 | + | |
192 | + console.log('输入的订单ID:', inputIds); | |
193 | + console.log('已选择的主订单ID:', selectedMainOrderIds); | |
194 | + | |
195 | + // 找出输入框中存在但未选择的订单ID | |
196 | + const missingIds = inputIds.filter( | |
197 | + (id) => !selectedMainOrderIds.includes(id), | |
198 | + ); | |
199 | + | |
200 | + console.log('缺失的订单ID:', missingIds); | |
201 | + | |
202 | + if (missingIds.length > 0) { | |
203 | + await queryMissingOrders(missingIds); | |
204 | + } else { | |
205 | + // 如果没有缺失的订单,清空额外的订单数据 | |
206 | + setAdditionalMainOrders([]); | |
207 | + } | |
208 | + }; | |
209 | + | |
63 | 210 | useEffect(() => { |
64 | 211 | //显示拼接的主订单id |
65 | 212 | form.setFieldValue('applyInvoicingNotes', mainIds); |
213 | + | |
214 | + // 转换收款单位选项并保存 | |
215 | + const options = enumToSelect(PAYEE_OPTIONS); | |
216 | + setReceivingCompanyOptions(options); | |
66 | 217 | }, []); |
67 | 218 | |
219 | + useEffect(() => { | |
220 | + // 当额外的主订单数据变化时,设置可开票金额初始值 | |
221 | + const mainOrders = getUniqueMainOrderIds(); | |
222 | + mainOrders.forEach((order) => { | |
223 | + // 只为新添加的订单设置初始值,避免覆盖用户已输入的值 | |
224 | + const currentValue = form.getFieldValue( | |
225 | + `invoiceAvailableAmount_${order.value}`, | |
226 | + ); | |
227 | + if (currentValue === undefined || currentValue === null) { | |
228 | + form.setFieldValue( | |
229 | + `invoiceAvailableAmount_${order.value}`, | |
230 | + order.availableAmount, | |
231 | + ); | |
232 | + } | |
233 | + }); | |
234 | + }, [additionalMainOrders]); | |
235 | + | |
68 | 236 | return ( |
69 | 237 | <ModalForm<{ |
70 | 238 | applyInvoicingNotes: string; |
... | ... | @@ -93,7 +261,26 @@ export default ({ |
93 | 261 | }} |
94 | 262 | submitTimeout={2000} |
95 | 263 | onFinish={async (values) => { |
96 | - values.subIds = ids; | |
264 | + // 收集所有相关的子订单ID,包括额外查询到的主订单下的子订单 | |
265 | + const allSubIds = [...ids]; // 原始选择的子订单ID | |
266 | + | |
267 | + console.log('原始子订单ID:', ids); | |
268 | + console.log('额外查询的主订单:', additionalMainOrders); | |
269 | + | |
270 | + // 添加额外查询到的主订单下的子订单ID | |
271 | + additionalMainOrders.forEach((mainOrder: any) => { | |
272 | + if (mainOrder.subOrderInformationLists) { | |
273 | + mainOrder.subOrderInformationLists.forEach((subOrder: any) => { | |
274 | + if (subOrder.id && !allSubIds.includes(subOrder.id)) { | |
275 | + console.log('添加子订单ID:', subOrder.id); | |
276 | + allSubIds.push(subOrder.id); | |
277 | + } | |
278 | + }); | |
279 | + } | |
280 | + }); | |
281 | + | |
282 | + console.log('最终子订单ID列表:', allSubIds); | |
283 | + values.subIds = allSubIds; | |
97 | 284 | //附件处理 |
98 | 285 | values.filePaths = values.filePaths?.map((item) => { |
99 | 286 | return { url: item.response.data[0] }; |
... | ... | @@ -105,7 +292,43 @@ export default ({ |
105 | 292 | values.afterInvoicingUpdate = false; |
106 | 293 | } |
107 | 294 | |
108 | - const res = await postServiceOrderApplyInvoicing({ data: values }); | |
295 | + // 收集主订单可开票金额 | |
296 | + const invoiceOrderAmounts = getUniqueMainOrderIds().map((item) => ({ | |
297 | + orderId: Number(item.value), // 确保为 number 类型 | |
298 | + availableAmount: values[`invoiceAvailableAmount_${item.value}`], | |
299 | + })); | |
300 | + // 校验所有主订单可开票金额之和等于price字段 | |
301 | + const price = values.price; | |
302 | + let sumAvailable = 0; | |
303 | + invoiceOrderAmounts.forEach((item) => { | |
304 | + sumAvailable = FloatAdd(sumAvailable, item.availableAmount || 0); | |
305 | + }); | |
306 | + if (Math.abs(sumAvailable - price) > 0.01) { | |
307 | + message.error( | |
308 | + `所有主订单可开票金额之和(${sumAvailable})必须等于开票金额(${price})`, | |
309 | + ); | |
310 | + return; | |
311 | + } | |
312 | + | |
313 | + // 获取receivingCompany对应的名称 | |
314 | + const selectedOption = receivingCompanyOptions.find( | |
315 | + (option) => option.value === values.receivingCompany, | |
316 | + ); | |
317 | + const receivingCompanyName = selectedOption ? selectedOption.label : ''; | |
318 | + | |
319 | + // 构建包含所有订单的mainOrderIds字符串 | |
320 | + const allMainOrderIds = getUniqueMainOrderIds() | |
321 | + .map((item) => item.value) | |
322 | + .join(','); | |
323 | + | |
324 | + // 添加到请求数据中 | |
325 | + const reqData = { | |
326 | + ...values, | |
327 | + receivingCompanyName, // 添加收款单位名称 | |
328 | + mainOrderIds: allMainOrderIds, // 使用包含所有订单的ID字符串 | |
329 | + invoiceOrderAmounts, | |
330 | + }; | |
331 | + const res = await postServiceOrderApplyInvoicing({ data: reqData }); | |
109 | 332 | |
110 | 333 | if (res.result === RESPONSE_CODE.SUCCESS) { |
111 | 334 | message.success(res.message); |
... | ... | @@ -114,14 +337,86 @@ export default ({ |
114 | 337 | }} |
115 | 338 | onOpenChange={setCheckVisible} |
116 | 339 | > |
117 | - {isMainOrder ? ( | |
118 | - <div className="mb-[24px]"> | |
119 | - <span>选中子订单金额之和:</span> | |
120 | - <span className="text-red-500">{sumPrice}¥</span> | |
340 | + {/* 主订单金额表格,任何情况都显示 */} | |
341 | + <div style={{ marginBottom: 24 }}> | |
342 | + <div | |
343 | + style={{ | |
344 | + display: 'flex', | |
345 | + fontWeight: 'bold', | |
346 | + marginBottom: 8, | |
347 | + padding: '8px 0', | |
348 | + borderBottom: '1px solid #f0f0f0', | |
349 | + }} | |
350 | + > | |
351 | + <div style={{ flex: 25 }}>订单号</div> | |
352 | + <div style={{ flex: 18, textAlign: 'right' }}>订单金额</div> | |
353 | + <div style={{ flex: 18, textAlign: 'right' }}>已开票金额</div> | |
354 | + <div style={{ flex: 39, textAlign: 'right' }}>可开票金额</div> | |
121 | 355 | </div> |
122 | - ) : ( | |
123 | - '' | |
124 | - )} | |
356 | + {getUniqueMainOrderIds().map((item, index) => { | |
357 | + const maxAvailable = Math.max( | |
358 | + 0, | |
359 | + item.totalPayment - item.invoiceIssuedAmount, | |
360 | + ); | |
361 | + | |
362 | + // 检查是否是额外查询到的订单 | |
363 | + const isAdditionalOrder = additionalMainOrders.some( | |
364 | + (order) => String(order.id) === String(item.value), | |
365 | + ); | |
366 | + | |
367 | + return ( | |
368 | + <div | |
369 | + key={index} | |
370 | + style={{ | |
371 | + display: 'flex', | |
372 | + marginBottom: 8, | |
373 | + padding: '8px 0', | |
374 | + borderBottom: '1px solid #f0f0f0', | |
375 | + backgroundColor: isAdditionalOrder ? '#f6ffed' : 'transparent', // 浅绿色背景表示新查询的订单 | |
376 | + border: isAdditionalOrder ? '1px solid #b7eb8f' : 'none', | |
377 | + borderRadius: isAdditionalOrder ? '4px' : '0', | |
378 | + }} | |
379 | + > | |
380 | + <div style={{ flex: 25 }}> | |
381 | + {item.value} | |
382 | + {isAdditionalOrder} | |
383 | + </div> | |
384 | + <div style={{ flex: 18, textAlign: 'right' }}> | |
385 | + ¥ {item.totalPayment.toFixed(2)} | |
386 | + </div> | |
387 | + <div style={{ flex: 18, textAlign: 'right' }}> | |
388 | + ¥ {item.invoiceIssuedAmount.toFixed(2)} | |
389 | + </div> | |
390 | + <div style={{ flex: 39, textAlign: 'right' }}> | |
391 | + <ProFormMoney | |
392 | + name={`invoiceAvailableAmount_${item.value}`} | |
393 | + locale="zh-CN" | |
394 | + fieldProps={{ | |
395 | + precision: 2, | |
396 | + style: { width: '70%' }, | |
397 | + }} | |
398 | + initialValue={item.availableAmount} | |
399 | + rules={[ | |
400 | + { required: true, message: '请填写可开票金额!' }, | |
401 | + { | |
402 | + validator: (_, value) => { | |
403 | + if (value > maxAvailable) { | |
404 | + return Promise.reject( | |
405 | + `可开票金额不能超过${maxAvailable.toFixed(2)}`, | |
406 | + ); | |
407 | + } else if (value === 0) { | |
408 | + return Promise.reject(`可开票金额不能为0`); | |
409 | + } | |
410 | + return Promise.resolve(); | |
411 | + }, | |
412 | + }, | |
413 | + ]} | |
414 | + /> | |
415 | + </div> | |
416 | + </div> | |
417 | + ); | |
418 | + })} | |
419 | + </div> | |
125 | 420 | |
126 | 421 | <div className="mb-1"> |
127 | 422 | 如果需要合并订单,请将需要合并的订单id写在备注中,id之间用英文逗号隔开。 |
... | ... | @@ -131,12 +426,9 @@ export default ({ |
131 | 426 | name="applyInvoicingNotes" |
132 | 427 | key="applyInvoicingNotes" |
133 | 428 | placeholder="请输入备注" |
134 | - onMetaChange={(val) => { | |
135 | - console.log(val); | |
136 | - }} | |
137 | - proFieldProps={{ | |
138 | - onchange: () => { | |
139 | - message.info('change'); | |
429 | + fieldProps={{ | |
430 | + onChange: (e) => { | |
431 | + handleNotesChange(e.target.value); | |
140 | 432 | }, |
141 | 433 | }} |
142 | 434 | /> |
... | ... | @@ -161,9 +453,24 @@ export default ({ |
161 | 453 | </span> |
162 | 454 | </div> |
163 | 455 | } |
164 | - options={enumToSelect(PAYEE_OPTIONS)} | |
456 | + options={receivingCompanyOptions} | |
165 | 457 | rules={[{ required: true, message: '开票收款单位必填' }]} |
166 | 458 | /> |
459 | + | |
460 | + {/* 新增发票类型选择 */} | |
461 | + <ProFormSelect | |
462 | + placeholder="选择发票类型" | |
463 | + name="invoiceType" | |
464 | + width="lg" | |
465 | + key="invoiceType" | |
466 | + label="发票类型" | |
467 | + options={[ | |
468 | + { label: '普票', value: 'ORDINARY_TICKET' }, | |
469 | + { label: '专票', value: 'SPECIAL_TICKET' }, | |
470 | + ]} | |
471 | + rules={[{ required: true, message: '发票类型必填' }]} | |
472 | + /> | |
473 | + | |
167 | 474 | <ProFormSelect |
168 | 475 | placeholder="选择是否加急" |
169 | 476 | name="isUrgent" | ... | ... |
src/pages/Order/OrderList/FinancialMergeDrawer.tsx
... | ... | @@ -142,7 +142,6 @@ export default ({ dataList, setVisible, onClose }) => { |
142 | 142 | { label: '完全开票', value: 'COMPLETE_INVOICING' }, |
143 | 143 | { label: '部分开票', value: 'PARTIAL_INVOICING' }, |
144 | 144 | ]} |
145 | - initialValue={'COMPLETE_INVOICING'} | |
146 | 145 | /> |
147 | 146 | <ProFormTextArea width="lg" name="invoicingNotes" label="备注" /> |
148 | 147 | </DrawerForm> | ... | ... |
src/pages/Order/OrderList/HirePurchaseUploadPayBillModal.tsx
... | ... | @@ -22,6 +22,14 @@ interface HirePurchaseUploadPayBillModalProps { |
22 | 22 | subOrders?: any[]; |
23 | 23 | } |
24 | 24 | |
25 | +// Helper function to display dash for empty values | |
26 | +// const displayValue = (value: any, formatter?: (val: any) => string): string => { | |
27 | +// if (value === null || value === undefined || value === '') { | |
28 | +// return '-'; | |
29 | +// } | |
30 | +// return formatter ? formatter(value) : String(value); | |
31 | +// }; | |
32 | + | |
25 | 33 | const HirePurchaseUploadPayBillModal: React.FC< |
26 | 34 | HirePurchaseUploadPayBillModalProps |
27 | 35 | > = ({ |
... | ... | @@ -309,7 +317,12 @@ const HirePurchaseUploadPayBillModal: React.FC< |
309 | 317 | }} |
310 | 318 | > |
311 | 319 | <span>订单总金额:</span> |
312 | - <span>{totalPayment.toFixed(2)}元</span> | |
320 | + <span> | |
321 | + {totalPayment !== null && totalPayment !== undefined | |
322 | + ? totalPayment.toFixed(2) | |
323 | + : '-'} | |
324 | + 元 | |
325 | + </span> | |
313 | 326 | </div> |
314 | 327 | <div |
315 | 328 | style={{ |
... | ... | @@ -319,7 +332,12 @@ const HirePurchaseUploadPayBillModal: React.FC< |
319 | 332 | }} |
320 | 333 | > |
321 | 334 | <span>已回款金额:</span> |
322 | - <span>{installedMoney.toFixed(2)}元</span> | |
335 | + <span> | |
336 | + {installedMoney !== null && installedMoney !== undefined | |
337 | + ? installedMoney.toFixed(2) | |
338 | + : '-'} | |
339 | + 元 | |
340 | + </span> | |
323 | 341 | </div> |
324 | 342 | <div |
325 | 343 | style={{ |
... | ... | @@ -329,7 +347,12 @@ const HirePurchaseUploadPayBillModal: React.FC< |
329 | 347 | }} |
330 | 348 | > |
331 | 349 | <span>待回款金额:</span> |
332 | - <span>{remainingMoney.toFixed(2)}元</span> | |
350 | + <span> | |
351 | + {remainingMoney !== null && remainingMoney !== undefined | |
352 | + ? remainingMoney.toFixed(2) | |
353 | + : '-'} | |
354 | + 元 | |
355 | + </span> | |
333 | 356 | </div> |
334 | 357 | </div> |
335 | 358 | <Form.Item | ... | ... |
src/pages/Order/OrderList/InvoicingDrawerForm.tsx
... | ... | @@ -4,7 +4,6 @@ import { |
4 | 4 | postServiceConstGetPayeeEnum, |
5 | 5 | postServiceConstInitInvoiceDetailNames, |
6 | 6 | postServiceConstInvoiceType, |
7 | - postServiceConstInvoicingType, | |
8 | 7 | postServiceConstListInvoiceDetailNames, |
9 | 8 | postServiceInvoiceApplyInvoice, |
10 | 9 | postServiceInvoiceQueryCompanyInfo, |
... | ... | @@ -16,7 +15,6 @@ import { |
16 | 15 | FormListActionType, |
17 | 16 | ProCard, |
18 | 17 | ProFormDigit, |
19 | - ProFormGroup, | |
20 | 18 | ProFormInstance, |
21 | 19 | ProFormList, |
22 | 20 | ProFormMoney, |
... | ... | @@ -31,8 +29,16 @@ export default ({ |
31 | 29 | dataList, |
32 | 30 | setVisible, |
33 | 31 | mainOrder, |
32 | + mainOrders, | |
34 | 33 | onClose, |
35 | 34 | type = 'applyInvoicing', |
35 | +}: { | |
36 | + dataList: any[]; | |
37 | + setVisible: (val: boolean) => void; | |
38 | + mainOrder: any; | |
39 | + mainOrders?: any[]; | |
40 | + onClose: () => void; | |
41 | + type?: string; | |
36 | 42 | }) => { |
37 | 43 | // let subOrderIds = dataList?.map((item) => { |
38 | 44 | // return item.id; |
... | ... | @@ -82,6 +88,60 @@ export default ({ |
82 | 88 | }); |
83 | 89 | types.set('reissue', { title: '重新申请', subOrderIdsName: '重开订单' }); |
84 | 90 | |
91 | + // Get unique main order IDs from the dataList | |
92 | + // 定义返回类型接口 | |
93 | + interface MainOrderData { | |
94 | + value: string | number; | |
95 | + totalPayment: number; | |
96 | + invoiceIssuedAmount: number; | |
97 | + availableAmount: number; | |
98 | + } | |
99 | + | |
100 | + const getUniqueMainOrderIds = (): MainOrderData[] => { | |
101 | + // Extract main order IDs from dataList | |
102 | + const mainOrderIds = dataListCopy.map( | |
103 | + (item: any) => item.mainOrderId || item.orderId, | |
104 | + ); | |
105 | + // Get unique IDs | |
106 | + const uniqueIds = [...new Set(mainOrderIds)].filter(Boolean); | |
107 | + return uniqueIds.map((id) => { | |
108 | + // 确保id是string或number类型 | |
109 | + const orderId = String(id); | |
110 | + | |
111 | + // 优先从传入的mainOrders中获取数据 | |
112 | + const mainOrderData = mainOrders | |
113 | + ? mainOrders.find((item: any) => item.id === id) | |
114 | + : null; | |
115 | + | |
116 | + // 如果没有找到主订单数据,则从dataList中查找 | |
117 | + const orderData = | |
118 | + mainOrderData || | |
119 | + dataListCopy.find((d: any) => d.mainOrderId === id || d.orderId === id); | |
120 | + | |
121 | + const totalPayment = orderData?.totalPayment || 0; | |
122 | + const invoiceIssuedAmount = orderData?.invoiceIssuedAmount || 0; | |
123 | + const availableAmount = Math.max(0, totalPayment - invoiceIssuedAmount); | |
124 | + | |
125 | + return { | |
126 | + value: orderId, | |
127 | + totalPayment, | |
128 | + invoiceIssuedAmount, | |
129 | + availableAmount, | |
130 | + }; | |
131 | + }); | |
132 | + }; | |
133 | + | |
134 | + // Set initial values for invoice available amounts | |
135 | + useEffect(() => { | |
136 | + const mainOrders = getUniqueMainOrderIds(); | |
137 | + mainOrders.forEach((order) => { | |
138 | + form.setFieldValue( | |
139 | + `invoiceAvailableAmount_${order.value}`, | |
140 | + order.availableAmount, | |
141 | + ); | |
142 | + }); | |
143 | + }, []); | |
144 | + | |
85 | 145 | function copyToClipboard(text: string) { |
86 | 146 | // 创建一个临时的textarea元素 |
87 | 147 | const textarea = document.createElement('textarea'); |
... | ... | @@ -135,6 +195,8 @@ export default ({ |
135 | 195 | autoFocusFirstInput |
136 | 196 | drawerProps={{ |
137 | 197 | destroyOnClose: true, |
198 | + maskClosable: false, | |
199 | + onClose: () => setVisible(false), | |
138 | 200 | }} |
139 | 201 | submitter={{ |
140 | 202 | render: (props, defaultDoms) => { |
... | ... | @@ -177,9 +239,31 @@ export default ({ |
177 | 239 | }} |
178 | 240 | submitTimeout={2000} |
179 | 241 | onFinish={async (values) => { |
242 | + // Collect invoice available amounts in the recommended format | |
243 | + const invoiceOrderAmounts = getUniqueMainOrderIds().map((item) => ({ | |
244 | + orderId: item.value, | |
245 | + availableAmount: values[`invoiceAvailableAmount_${item.value}`], | |
246 | + })); | |
247 | + | |
248 | + // 获取开票金额(price 字段) | |
249 | + const price = values.price; | |
250 | + // 计算所有主订单可开票金额之和 | |
251 | + let sumAvailable = 0; | |
252 | + invoiceOrderAmounts.forEach((item) => { | |
253 | + sumAvailable = FloatAdd(sumAvailable, item.availableAmount || 0); | |
254 | + }); | |
255 | + // 允许0.01误差 | |
256 | + if (Math.abs(sumAvailable - price) > 0.01) { | |
257 | + message.error( | |
258 | + `所有主订单可开票金额之和(${sumAvailable})必须等于开票金额(${price})`, | |
259 | + ); | |
260 | + return; | |
261 | + } | |
262 | + | |
180 | 263 | postServiceInvoiceApplyInvoice({ |
181 | 264 | data: { |
182 | 265 | ...values, |
266 | + invoiceOrderAmounts, // 使用数组对象格式 | |
183 | 267 | subOrderIds: dataListCopy.map((item) => { |
184 | 268 | return item.id; |
185 | 269 | }), |
... | ... | @@ -192,22 +276,73 @@ export default ({ |
192 | 276 | return !val && setVisible(); |
193 | 277 | }} |
194 | 278 | > |
195 | - <ProFormList | |
196 | - name="subOrderIdObjs" | |
197 | - readonly={true} | |
198 | - label={types.get(type).subOrderIdsName} | |
199 | - initialValue={dataListCopy.map((item) => { | |
200 | - return { | |
201 | - value: item.id, | |
202 | - }; | |
279 | + <div style={{ marginBottom: 24 }}> | |
280 | + <div | |
281 | + style={{ | |
282 | + display: 'flex', | |
283 | + fontWeight: 'bold', | |
284 | + marginBottom: 8, | |
285 | + padding: '8px 0', | |
286 | + borderBottom: '1px solid #f0f0f0', | |
287 | + }} | |
288 | + > | |
289 | + <div style={{ flex: 25 }}>订单号</div> | |
290 | + <div style={{ flex: 18, textAlign: 'right' }}>订单金额</div> | |
291 | + <div style={{ flex: 18, textAlign: 'right' }}>已开票金额</div> | |
292 | + <div style={{ flex: 39, textAlign: 'right' }}>可开票金额</div> | |
293 | + </div> | |
294 | + {getUniqueMainOrderIds().map((item, index) => { | |
295 | + const maxAvailable = Math.max( | |
296 | + 0, | |
297 | + item.totalPayment - item.invoiceIssuedAmount, | |
298 | + ); | |
299 | + return ( | |
300 | + <div | |
301 | + key={index} | |
302 | + style={{ | |
303 | + display: 'flex', | |
304 | + marginBottom: 8, | |
305 | + padding: '8px 0', | |
306 | + borderBottom: '1px solid #f0f0f0', | |
307 | + }} | |
308 | + > | |
309 | + <div style={{ flex: 25 }}>{item.value}</div> | |
310 | + <div style={{ flex: 18, textAlign: 'right' }}> | |
311 | + ¥ {item.totalPayment.toFixed(2)} | |
312 | + </div> | |
313 | + <div style={{ flex: 18, textAlign: 'right' }}> | |
314 | + ¥ {item.invoiceIssuedAmount.toFixed(2)} | |
315 | + </div> | |
316 | + <div style={{ flex: 39, textAlign: 'right' }}> | |
317 | + <ProFormMoney | |
318 | + name={`invoiceAvailableAmount_${item.value}`} | |
319 | + locale="zh-CN" | |
320 | + fieldProps={{ | |
321 | + precision: 2, | |
322 | + style: { width: '70%' }, | |
323 | + }} | |
324 | + initialValue={item.availableAmount} | |
325 | + rules={[ | |
326 | + { required: true, message: '请填写可开票金额!' }, | |
327 | + { | |
328 | + validator: (_, value) => { | |
329 | + if (value > maxAvailable) { | |
330 | + return Promise.reject( | |
331 | + `可开票金额不能超过${maxAvailable.toFixed(2)}`, | |
332 | + ); | |
333 | + } else if (value === 0) { | |
334 | + return Promise.reject(`可开票金额不能为0`); | |
335 | + } | |
336 | + return Promise.resolve(); | |
337 | + }, | |
338 | + }, | |
339 | + ]} | |
340 | + /> | |
341 | + </div> | |
342 | + </div> | |
343 | + ); | |
203 | 344 | })} |
204 | - deleteIconProps={false} | |
205 | - copyIconProps={false} | |
206 | - > | |
207 | - <ProFormGroup key="group"> | |
208 | - <ProFormText readonly={true} name="value" label="" /> | |
209 | - </ProFormGroup> | |
210 | - </ProFormList> | |
345 | + </div> | |
211 | 346 | {/*<ProFormSelect |
212 | 347 | name="ReissueInvoiceRecordIds" |
213 | 348 | label="重开的发票" |
... | ... | @@ -320,17 +455,6 @@ export default ({ |
320 | 455 | rules={[{ required: true, message: '请选择银行联行号!' }]} |
321 | 456 | /> |
322 | 457 | <ProFormSelect |
323 | - name="invoicingType" | |
324 | - label="开具类型" | |
325 | - request={async () => { | |
326 | - let invoicingTypeRet = await postServiceConstInvoicingType(); | |
327 | - let options = enumToSelect(invoicingTypeRet.data); | |
328 | - return options; | |
329 | - }} | |
330 | - placeholder="请选择开具类型" | |
331 | - rules={[{ required: true, message: '请选择开具类型!' }]} | |
332 | - /> | |
333 | - <ProFormSelect | |
334 | 458 | name="type" |
335 | 459 | label="开票类型" |
336 | 460 | placeholder="请选择开票类型" | ... | ... |
src/pages/Order/OrderList/OrderDrawer.tsx
... | ... | @@ -156,7 +156,7 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
156 | 156 | let entity_number = await getTeacherCustomFieldNumber(); |
157 | 157 | |
158 | 158 | //在单位详细信息中拿到自定义字段的值 |
159 | - let customField = res?.custom_field; | |
159 | + let customField = res?.customField; | |
160 | 160 | if (customField) { |
161 | 161 | let teacherName = customField[entity_number]; |
162 | 162 | //填充到课题组老师表单字段中 |
... | ... | @@ -309,22 +309,22 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
309 | 309 | |
310 | 310 | copyData.customerNameString = copyData.customerName; |
311 | 311 | |
312 | - // 清空支付方式和支付渠道 | |
313 | - if ( | |
314 | - copyData.paymentChannel === 'TAOBAO' || | |
315 | - [ | |
316 | - 'UNPAID', | |
317 | - 'TAOBAO_ORDER_HAS_BEEN_PAID', | |
318 | - 'OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID', | |
319 | - 'WITHHOLDING_ADVANCE_DEPOSIT', | |
320 | - 'PLATFORM_SETTLEMENT', | |
321 | - 'PAYMENT_RECEIPT', | |
322 | - 'PREPAID_NO_NEED_SEND', | |
323 | - ].includes(copyData.paymentMethod) | |
324 | - ) { | |
325 | - copyData.paymentMethod = ''; | |
326 | - copyData.paymentChannel = ''; | |
327 | - } | |
312 | + // // 清空支付方式和支付渠道 | |
313 | + // if ( | |
314 | + // copyData.paymentChannel === 'TAOBAO' || | |
315 | + // [ | |
316 | + // 'UNPAID', | |
317 | + // 'TAOBAO_ORDER_HAS_BEEN_PAID', | |
318 | + // 'OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID', | |
319 | + // 'WITHHOLDING_ADVANCE_DEPOSIT', | |
320 | + // 'PLATFORM_SETTLEMENT', | |
321 | + // 'PAYMENT_RECEIPT', | |
322 | + // 'PREPAID_NO_NEED_SEND', | |
323 | + // ].includes(copyData.paymentMethod) | |
324 | + // ) { | |
325 | + // copyData.paymentMethod = ''; | |
326 | + // copyData.paymentChannel = ''; | |
327 | + // } | |
328 | 328 | |
329 | 329 | setPaymentMethod(copyData.paymentMethod); |
330 | 330 | |
... | ... | @@ -396,7 +396,18 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
396 | 396 | */ |
397 | 397 | function getInvoicingSelect() { |
398 | 398 | if (optType('edit') || optType('after-sales-check')) { |
399 | - return enumToSelect(INVOCING_STATUS_OPTIONS_OLD); | |
399 | + const options = enumToSelect(INVOCING_STATUS_OPTIONS_OLD); | |
400 | + | |
401 | + // 永远禁止选择专票和普票,但保留这些选项用于显示历史数据 | |
402 | + return options.map((option: any) => { | |
403 | + if ( | |
404 | + option.value === 'SPECIALLY_INVOICED' || | |
405 | + option.value === 'COMMON_INVOICED' | |
406 | + ) { | |
407 | + return { ...option, disabled: true }; | |
408 | + } | |
409 | + return option; | |
410 | + }); | |
400 | 411 | } |
401 | 412 | return enumToSelect(INVOCING_STATUS_OPTIONS); |
402 | 413 | } |
... | ... | @@ -437,6 +448,34 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
437 | 448 | if (optType('add')) { |
438 | 449 | form.resetFields(['list']); |
439 | 450 | } |
451 | + | |
452 | + // 如果是复制操作,检查销售代码是否为淘宝相关代码 | |
453 | + if (optType('copy')) { | |
454 | + const salesCode = data?.salesCode; | |
455 | + const isTaobaoSalesCode = [ | |
456 | + 'TB', | |
457 | + 'TBC', | |
458 | + 'HCTB', | |
459 | + '淘宝', | |
460 | + 'TAOBAO', | |
461 | + '新能源材料网', | |
462 | + 'scilab固态电解质商城', | |
463 | + 'T-ACG', | |
464 | + 'ALBB', | |
465 | + ].includes(salesCode); | |
466 | + | |
467 | + if (isTaobaoSalesCode) { | |
468 | + // 锁定支付渠道和支付方式,但保留原有值 | |
469 | + setPaymentChannelDisabled(true); | |
470 | + setPaymentMethodDisabled(true); | |
471 | + | |
472 | + // 确保控制台日志 | |
473 | + console.log('复制淘宝订单,锁定支付渠道和支付方式:', { | |
474 | + paymentChannel: data?.paymentChannel, | |
475 | + paymentMethod: data?.paymentMethod, | |
476 | + }); | |
477 | + } | |
478 | + } | |
440 | 479 | }, [data]); |
441 | 480 | |
442 | 481 | /** |
... | ... | @@ -1152,35 +1191,65 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
1152 | 1191 | autoFillSalesInfo(option); |
1153 | 1192 | |
1154 | 1193 | // 检查是否是特殊的淘宝销售代码 |
1155 | - const isTaobaoSalesCode = ['TB', 'TBC', 'HCTB'].includes(value); | |
1156 | - | |
1157 | - // 清空支付渠道和支付方式 | |
1158 | - form.setFieldsValue({ | |
1159 | - paymentChannel: undefined, | |
1160 | - paymentMethod: undefined, | |
1161 | - }); | |
1162 | - | |
1163 | - // 重置支付渠道和支付方式的禁用状态 | |
1164 | - setPaymentChannelDisabled(false); | |
1165 | - setPaymentMethodDisabled(false); | |
1166 | - | |
1167 | - if (isTaobaoSalesCode) { | |
1168 | - // 设置支付渠道为淘宝并锁定 | |
1169 | - form.setFieldsValue({ paymentChannel: 'TAOBAO' }); | |
1194 | + const isTaobaoSalesCode = [ | |
1195 | + 'TB', | |
1196 | + 'TBC', | |
1197 | + 'HCTB', | |
1198 | + '淘宝', | |
1199 | + 'TAOBAO', | |
1200 | + '新能源材料网', | |
1201 | + 'scilab固态电解质商城', | |
1202 | + 'T-ACG', | |
1203 | + 'ALBB', | |
1204 | + ].includes(value); | |
1205 | + | |
1206 | + // 如果是复制操作且是淘宝销售代码,锁定支付方式和支付渠道,不清空值 | |
1207 | + if (optType('copy') && isTaobaoSalesCode) { | |
1208 | + // 保留当前的支付渠道和支付方式值,只锁定选择器 | |
1170 | 1209 | setPaymentChannelDisabled(true); |
1171 | - | |
1172 | - // 支付方式默认锁定为预付 | |
1173 | - form.setFieldsValue({ paymentMethod: 'PAYMENT_IN_ADVANCE' }); | |
1174 | - setPaymentMethod('PAYMENT_IN_ADVANCE'); | |
1175 | 1210 | setPaymentMethodDisabled(true); |
1176 | - } else { | |
1177 | - // 如果不是淘宝销售代码,解除锁定 | |
1178 | - setPaymentChannelDisabled(false); | |
1179 | - // 只有当前支付渠道不是扣预存时才解除付款方式的锁定 | |
1211 | + | |
1212 | + // 如果当前没有值,则设置默认值 | |
1180 | 1213 | const currentPaymentChannel = |
1181 | 1214 | form.getFieldValue('paymentChannel'); |
1182 | - if (currentPaymentChannel !== 'BALANCE') { | |
1183 | - setPaymentMethodDisabled(false); | |
1215 | + if (!currentPaymentChannel) { | |
1216 | + form.setFieldsValue({ paymentChannel: 'TAOBAO' }); | |
1217 | + } | |
1218 | + | |
1219 | + const currentPaymentMethod = form.getFieldValue('paymentMethod'); | |
1220 | + if (!currentPaymentMethod) { | |
1221 | + form.setFieldsValue({ paymentMethod: 'PAYMENT_IN_TAOBAO' }); | |
1222 | + setPaymentMethod('PAYMENT_IN_TAOBAO'); | |
1223 | + } | |
1224 | + } else if (!optType('copy')) { | |
1225 | + // 非复制操作时,清空支付渠道和支付方式 | |
1226 | + form.setFieldsValue({ | |
1227 | + paymentChannel: undefined, | |
1228 | + paymentMethod: undefined, | |
1229 | + }); | |
1230 | + | |
1231 | + // 重置支付渠道和支付方式的禁用状态 | |
1232 | + setPaymentChannelDisabled(false); | |
1233 | + setPaymentMethodDisabled(false); | |
1234 | + | |
1235 | + if (isTaobaoSalesCode) { | |
1236 | + // 设置支付渠道为淘宝并锁定 | |
1237 | + form.setFieldsValue({ paymentChannel: 'TAOBAO' }); | |
1238 | + setPaymentChannelDisabled(true); | |
1239 | + | |
1240 | + // 支付方式默认锁定为淘宝 | |
1241 | + form.setFieldsValue({ paymentMethod: 'PAYMENT_IN_TAOBAO' }); | |
1242 | + setPaymentMethod('PAYMENT_IN_TAOBAO'); | |
1243 | + setPaymentMethodDisabled(true); | |
1244 | + } else { | |
1245 | + // 如果不是淘宝销售代码,解除锁定 | |
1246 | + setPaymentChannelDisabled(false); | |
1247 | + // 只有当前支付渠道不是扣预存时才解除付款方式的锁定 | |
1248 | + const currentPaymentChannel = | |
1249 | + form.getFieldValue('paymentChannel'); | |
1250 | + if (currentPaymentChannel !== 'BALANCE') { | |
1251 | + setPaymentMethodDisabled(false); | |
1252 | + } | |
1184 | 1253 | } |
1185 | 1254 | } |
1186 | 1255 | }} |
... | ... | @@ -1845,22 +1914,112 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
1845 | 1914 | disabled={optType('after-sales-check')} |
1846 | 1915 | /> |
1847 | 1916 | </div> |
1917 | + <ProFormSelect | |
1918 | + placeholder="请输入支付方式" | |
1919 | + name="paymentMethod" | |
1920 | + width="lg" | |
1921 | + key="paymentMethod" | |
1922 | + label="支付方式" | |
1923 | + onChange={(val: any) => { | |
1924 | + setPaymentMethod(val); | |
1925 | + }} | |
1926 | + options={(() => { | |
1927 | + // 使用Set记录已经处理过的选项值,避免重复 | |
1928 | + const processedValues = new Set(); | |
1929 | + const finalOptions = []; | |
1930 | + | |
1931 | + // 先处理默认可选项 | |
1932 | + enumToSelect(PAYMENT_METHOD_OPTIONS_4_ADD).forEach((option) => { | |
1933 | + // 将淘宝选项设置为禁用状态,使其无法手动选择 | |
1934 | + if (option.value === 'PAYMENT_IN_TAOBAO') { | |
1935 | + finalOptions.push({ ...option, disabled: true }); | |
1936 | + } else { | |
1937 | + finalOptions.push(option); | |
1938 | + } | |
1939 | + processedValues.add(option.value); | |
1940 | + }); | |
1941 | + | |
1942 | + // 添加强制禁用项,但只添加尚未存在的选项 | |
1943 | + const disabledOptions = [ | |
1944 | + { | |
1945 | + label: '淘宝订单已付款', | |
1946 | + value: 'TAOBAO_ORDER_HAS_BEEN_PAID', | |
1947 | + disabled: true, | |
1948 | + }, | |
1949 | + { | |
1950 | + label: '官网已付', | |
1951 | + value: 'OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID', | |
1952 | + disabled: true, | |
1953 | + }, | |
1954 | + { label: '淘宝', value: 'PAYMENT_IN_TAOBAO', disabled: true }, | |
1955 | + { | |
1956 | + label: '预付', | |
1957 | + value: 'WITHHOLDING_ADVANCE_DEPOSIT', | |
1958 | + disabled: true, | |
1959 | + }, | |
1960 | + { | |
1961 | + label: '平台结算', | |
1962 | + value: 'PLATFORM_SETTLEMENT', | |
1963 | + disabled: true, | |
1964 | + }, | |
1965 | + { | |
1966 | + label: '预存款无需发货', | |
1967 | + value: 'PREPAID_NO_NEED_SEND', | |
1968 | + disabled: true, | |
1969 | + }, | |
1970 | + ]; | |
1971 | + | |
1972 | + disabledOptions.forEach((option) => { | |
1973 | + if (!processedValues.has(option.value)) { | |
1974 | + finalOptions.push(option); | |
1975 | + processedValues.add(option.value); | |
1976 | + } | |
1977 | + }); | |
1848 | 1978 | |
1979 | + return finalOptions; | |
1980 | + })()} | |
1981 | + rules={[{ required: true, message: '支付方式必填' }]} | |
1982 | + disabled={optType('after-sales-check') || paymentMethodDisabled} | |
1983 | + fieldProps={{ | |
1984 | + style: paymentMethodDisabled ? { backgroundColor: '#f5f5f5' } : {}, | |
1985 | + }} | |
1986 | + /> | |
1849 | 1987 | <ProFormSelect |
1850 | 1988 | placeholder="请输入支付渠道" |
1851 | 1989 | name="paymentChannel" |
1852 | 1990 | width="lg" |
1853 | 1991 | key="paymentChannel" |
1854 | 1992 | label="支付渠道" |
1855 | - options={enumToSelect(PAYMENT_CHANNEL_OPTIONS).map((option) => { | |
1856 | - // 将淘宝选项设置为禁用状态,使其无法手动选择 | |
1857 | - if (option.value === 'TAOBAO') { | |
1858 | - return { ...option, disabled: true }; | |
1859 | - } | |
1860 | - return option; | |
1861 | - })} | |
1993 | + options={(() => { | |
1994 | + // 获取当前支付方式 | |
1995 | + const currentPaymentMethod = | |
1996 | + paymentMethod || form.getFieldValue('paymentMethod'); | |
1997 | + | |
1998 | + return enumToSelect(PAYMENT_CHANNEL_OPTIONS).map((option) => { | |
1999 | + // 将淘宝选项设置为禁用状态,使其无法手动选择 | |
2000 | + if (option.value === 'TAOBAO') { | |
2001 | + return { ...option, disabled: true }; | |
2002 | + } | |
2003 | + | |
2004 | + // 如果选择了"预存款无需发货",禁用"平台结算"和"官网已付"选项 | |
2005 | + if (currentPaymentMethod === 'PREPAID_NO_NEED_SEND') { | |
2006 | + if ( | |
2007 | + option.value === 'PLATFORM' || | |
2008 | + option.value === 'OFFICIAL_WEBSITE' || | |
2009 | + option.value === 'BALANCE' | |
2010 | + ) { | |
2011 | + return { ...option, disabled: true }; | |
2012 | + } | |
2013 | + } | |
2014 | + | |
2015 | + return option; | |
2016 | + }); | |
2017 | + })()} | |
1862 | 2018 | rules={[{ required: true, message: '支付渠道必填' }]} |
1863 | 2019 | disabled={optType('after-sales-check') || paymentChannelDisabled} |
2020 | + fieldProps={{ | |
2021 | + style: paymentChannelDisabled ? { backgroundColor: '#f5f5f5' } : {}, | |
2022 | + }} | |
1864 | 2023 | onChange={(val: any) => { |
1865 | 2024 | // 根据支付渠道设置不同的支付方式 |
1866 | 2025 | if (val === 'BALANCE') { |
... | ... | @@ -1871,56 +2030,16 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
1871 | 2030 | }); |
1872 | 2031 | setPaymentMethod('WITHHOLDING_ADVANCE_DEPOSIT'); |
1873 | 2032 | } else if (val === 'TAOBAO') { |
1874 | - // 支付渠道为淘宝时,支付方式设置为预付 | |
2033 | + // 支付渠道为淘宝时,支付方式设置为淘宝 | |
1875 | 2034 | setPaymentMethodDisabled(true); |
1876 | - form.setFieldsValue({ paymentMethod: 'PAYMENT_IN_ADVANCE' }); | |
1877 | - setPaymentMethod('PAYMENT_IN_ADVANCE'); | |
2035 | + form.setFieldsValue({ paymentMethod: 'PAYMENT_IN_TAOBAO' }); | |
2036 | + setPaymentMethod('PAYMENT_IN_TAOBAO'); | |
1878 | 2037 | } else { |
1879 | 2038 | // 支付渠道修改为其他的去除锁定状态 |
1880 | 2039 | setPaymentMethodDisabled(false); |
1881 | 2040 | } |
1882 | 2041 | }} |
1883 | 2042 | /> |
1884 | - <ProFormSelect | |
1885 | - placeholder="请输入支付方式" | |
1886 | - name="paymentMethod" | |
1887 | - width="lg" | |
1888 | - key="paymentMethod" | |
1889 | - label="支付方式" | |
1890 | - onChange={(val: any) => { | |
1891 | - setPaymentMethod(val); | |
1892 | - }} | |
1893 | - options={[ | |
1894 | - // 默认可选项 | |
1895 | - ...enumToSelect(PAYMENT_METHOD_OPTIONS_4_ADD), | |
1896 | - // 强制禁用项 | |
1897 | - { label: '未付款', value: 'UNPAID', disabled: true }, | |
1898 | - { | |
1899 | - label: '淘宝订单已付款', | |
1900 | - value: 'TAOBAO_ORDER_HAS_BEEN_PAID', | |
1901 | - disabled: true, | |
1902 | - }, | |
1903 | - { | |
1904 | - label: '官网订单已付款', | |
1905 | - value: 'OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID', | |
1906 | - disabled: true, | |
1907 | - }, | |
1908 | - { | |
1909 | - label: '预付', | |
1910 | - value: 'WITHHOLDING_ADVANCE_DEPOSIT', | |
1911 | - disabled: true, | |
1912 | - }, | |
1913 | - { label: '平台结算', value: 'PLATFORM_SETTLEMENT', disabled: true }, | |
1914 | - { label: '已回款', value: 'PAYMENT_RECEIPT', disabled: true }, | |
1915 | - { | |
1916 | - label: '预存款无需发货', | |
1917 | - value: 'PREPAID_NO_NEED_SEND', | |
1918 | - disabled: true, | |
1919 | - }, | |
1920 | - ]} | |
1921 | - rules={[{ required: true, message: '支付方式必填' }]} | |
1922 | - disabled={optType('after-sales-check') || paymentMethodDisabled} | |
1923 | - /> | |
1924 | 2043 | {/* 隐藏字段用于存储真实UID和privatePocket标志 */} |
1925 | 2044 | <ProFormText name="realPrepaidUid" hidden /> |
1926 | 2045 | <ProFormText name="privatePocket" hidden /> |
... | ... | @@ -2050,7 +2169,7 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
2050 | 2169 | placeholder="选择是否需要开票" |
2051 | 2170 | name="invoicingStatus" |
2052 | 2171 | width="lg" |
2053 | - key="invoicingStatus" | |
2172 | + key={`invoicingStatus-${invoicingStatus}`} | |
2054 | 2173 | label="是否需要开票" |
2055 | 2174 | options={getInvoicingSelect()} |
2056 | 2175 | disabled={optType('after-sales-check')} | ... | ... |
src/pages/Order/OrderList/OrderList.tsx
... | ... | @@ -1084,14 +1084,14 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
1084 | 1084 | </span> |
1085 | 1085 | </div> |
1086 | 1086 | {/* 回款状态 */} |
1087 | - <div className="overflow-hidden overflow-ellipsis whitespace-no-wrap"> | |
1087 | + {/* <div className="overflow-hidden overflow-ellipsis whitespace-no-wrap"> | |
1088 | 1088 | <span className="text-slate-700"> |
1089 | 1089 | {enumValueToLabel( |
1090 | 1090 | optRecord.paymentReceiptStatus, |
1091 | 1091 | PAYMENT_RECEIPTS_STATUS_OPTIONS, |
1092 | 1092 | )} |
1093 | 1093 | </span> |
1094 | - </div> | |
1094 | + </div> */} | |
1095 | 1095 | {/* 回款审核状态 */} |
1096 | 1096 | {optRecord.paymentReceiptStatus !== null ? ( |
1097 | 1097 | <div className="overflow-hidden overflow-ellipsis whitespace-no-wrap"> |
... | ... | @@ -1159,7 +1159,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
1159 | 1159 | )} |
1160 | 1160 | |
1161 | 1161 | {/* 开票状态 */} |
1162 | - {optRecord.afterInvoicingStatus !== null ? ( | |
1162 | + {/* {optRecord.afterInvoicingStatus !== null ? ( | |
1163 | 1163 | <div className="overflow-hidden overflow-ellipsis whitespace-no-wrap"> |
1164 | 1164 | <Tooltip |
1165 | 1165 | title={ |
... | ... | @@ -1185,7 +1185,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
1185 | 1185 | </div> |
1186 | 1186 | ) : ( |
1187 | 1187 | '' |
1188 | - )} | |
1188 | + )} */} | |
1189 | 1189 | |
1190 | 1190 | {/* 是否加急图标显示 */} |
1191 | 1191 | {optRecord.isUrgent ? ( |
... | ... | @@ -1844,7 +1844,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
1844 | 1844 | '' |
1845 | 1845 | )} |
1846 | 1846 | |
1847 | - {optRecord.paths?.includes('invoicing') ? ( | |
1847 | + {/* {optRecord.paths?.includes('invoicing') ? ( | |
1848 | 1848 | <Button |
1849 | 1849 | className="p-0" |
1850 | 1850 | type="link" |
... | ... | @@ -1859,7 +1859,7 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
1859 | 1859 | </Button> |
1860 | 1860 | ) : ( |
1861 | 1861 | '' |
1862 | - )} | |
1862 | + )} */} | |
1863 | 1863 | |
1864 | 1864 | {/* {optRecord.paths?.includes('applyInvoicing') ? ( |
1865 | 1865 | <Button |
... | ... | @@ -2556,1490 +2556,1565 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
2556 | 2556 | ); |
2557 | 2557 | }; |
2558 | 2558 | |
2559 | + // 检查主订单是否包含待冲红的子订单 | |
2560 | + const hasWaitFlushSubOrder = (record: OrderListItemType): boolean => { | |
2561 | + return ( | |
2562 | + record.subOrderInformationLists?.some( | |
2563 | + (subOrder: any) => subOrder.afterInvoicingStatus === 'WAIT_FLUSH', | |
2564 | + ) || false | |
2565 | + ); | |
2566 | + }; | |
2567 | + | |
2559 | 2568 | // 主订单内容渲染 |
2560 | 2569 | const MainOrderColumnRender = ({ record }: { record: OrderListItemType }) => { |
2570 | + const showWaitFlushBadge = hasWaitFlushSubOrder(record); | |
2571 | + | |
2561 | 2572 | return ( |
2562 | - <Flex vertical={true}> | |
2563 | - {/* 编号、时间、销售信息 */} | |
2564 | - <Flex | |
2565 | - className="px-4 py-4 bg-white rounded-t-lg" | |
2566 | - justify="space-between" | |
2567 | - > | |
2568 | - <Flex wrap="wrap" gap="middle" vertical> | |
2569 | - <Flex> | |
2573 | + <div style={{ position: 'relative', overflow: 'visible' }}> | |
2574 | + {showWaitFlushBadge && ( | |
2575 | + <div | |
2576 | + style={{ | |
2577 | + position: 'absolute', | |
2578 | + top: 4, | |
2579 | + left: 4, | |
2580 | + zIndex: 10, | |
2581 | + backgroundColor: 'rgba(255, 255, 255, 0.85)', | |
2582 | + color: '#ff4d4f', | |
2583 | + border: '1px solid #ff4d4f', | |
2584 | + borderRadius: '20px', | |
2585 | + fontSize: '24px', | |
2586 | + fontWeight: 'normal', | |
2587 | + padding: '8px 16px', | |
2588 | + height: 'auto', | |
2589 | + minWidth: 'auto', | |
2590 | + lineHeight: '32px', | |
2591 | + whiteSpace: 'nowrap', | |
2592 | + pointerEvents: 'none', | |
2593 | + boxShadow: '0 2px 8px rgba(255, 77, 79, 0.15)', | |
2594 | + }} | |
2595 | + > | |
2596 | + 待冲红 | |
2597 | + </div> | |
2598 | + )} | |
2599 | + <Flex vertical={true}> | |
2600 | + {/* 编号、时间、销售信息 */} | |
2601 | + <Flex | |
2602 | + className="px-4 py-4 bg-white rounded-t-lg" | |
2603 | + justify="space-between" | |
2604 | + > | |
2605 | + <Flex wrap="wrap" gap="middle" vertical> | |
2570 | 2606 | <Flex> |
2571 | - <Checkbox | |
2572 | - onChange={() => onCheckboxChange(record)} | |
2573 | - checked={selectedMainOrderKeys.includes(record.id)} | |
2574 | - > | |
2575 | - <Space split={<Divider type="vertical" />}> | |
2576 | - <div> | |
2577 | - <span className="text-[#8C8C8C]">订单号:</span> | |
2578 | - <span className="text-slate-700">{record.id}</span> | |
2579 | - {record.modified ? ( | |
2580 | - <Tooltip title="点击查看详情"> | |
2581 | - <span | |
2582 | - className="text-[#f44e4e] cursor-pointer" | |
2583 | - onClick={async () => { | |
2584 | - createOptObject(null, record.id); | |
2585 | - setModifiedDiffModalVisible(true); | |
2586 | - }} | |
2587 | - > | |
2588 | - (修改过) | |
2589 | - </span> | |
2590 | - </Tooltip> | |
2591 | - ) : ( | |
2592 | - '' | |
2593 | - )} | |
2594 | - </div> | |
2595 | - </Space> | |
2596 | - </Checkbox> | |
2597 | - <Tooltip title="点击复制订单号"> | |
2598 | - <CopyOutlined | |
2599 | - className="hover:cursor-pointer" | |
2600 | - style={{ color: '#8C8C8C' }} | |
2601 | - onClick={() => { | |
2602 | - copyToClipboard(record.id); | |
2603 | - message.info('订单号复制成功!'); | |
2604 | - }} | |
2605 | - /> | |
2606 | - </Tooltip> | |
2607 | - <Divider type="vertical" /> | |
2608 | - <span>{formatDateTime(record.createTime)}</span> | |
2609 | - <Divider type="vertical" /> | |
2610 | - <Space split={<Divider type="vertical" />}> | |
2611 | - <div | |
2612 | - className="hover:cursor-pointer" | |
2613 | - onClick={() => { | |
2614 | - copyToClipboard(record.salesCode); | |
2615 | - message.info('代表复制成功:' + record.salesCode); | |
2616 | - }} | |
2607 | + <Flex> | |
2608 | + <Checkbox | |
2609 | + onChange={() => onCheckboxChange(record)} | |
2610 | + checked={selectedMainOrderKeys.includes(record.id)} | |
2617 | 2611 | > |
2618 | - <span className="text-[#8C8C8C]">代表:</span> | |
2619 | - <span className="text-slate-700">{record.salesCode}</span> | |
2620 | - </div> | |
2621 | - {!isSupplier() ? ( | |
2622 | - <> | |
2623 | - <div | |
2624 | - title={record.institution} | |
2625 | - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" | |
2626 | - > | |
2627 | - <span className="text-[#8C8C8C]">单位:</span> | |
2628 | - <span className="text-slate-700"> | |
2629 | - {record.institution} | |
2630 | - </span> | |
2612 | + <Space split={<Divider type="vertical" />}> | |
2613 | + <div> | |
2614 | + <span className="text-[#8C8C8C]">订单号:</span> | |
2615 | + <span className="text-slate-700">{record.id}</span> | |
2616 | + {record.modified ? ( | |
2617 | + <Tooltip title="点击查看详情"> | |
2618 | + <span | |
2619 | + className="text-[#f44e4e] cursor-pointer" | |
2620 | + onClick={async () => { | |
2621 | + createOptObject(null, record.id); | |
2622 | + setModifiedDiffModalVisible(true); | |
2623 | + }} | |
2624 | + > | |
2625 | + (修改过) | |
2626 | + </span> | |
2627 | + </Tooltip> | |
2628 | + ) : ( | |
2629 | + '' | |
2630 | + )} | |
2631 | 2631 | </div> |
2632 | - <span> | |
2633 | - <span className="text-[#8C8C8C]">课题组:</span> | |
2634 | - <span className="text-slate-700"> | |
2635 | - {record.institutionContactName | |
2636 | - ? record.institutionContactName + ' ' | |
2637 | - : '企业'} | |
2638 | - </span> | |
2639 | - </span> | |
2640 | - </> | |
2641 | - ) : ( | |
2642 | - '' | |
2643 | - )} | |
2644 | - <div | |
2645 | - title={record.institution} | |
2646 | - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" | |
2647 | - > | |
2648 | - <span | |
2632 | + </Space> | |
2633 | + </Checkbox> | |
2634 | + <Tooltip title="点击复制订单号"> | |
2635 | + <CopyOutlined | |
2649 | 2636 | className="hover:cursor-pointer" |
2637 | + style={{ color: '#8C8C8C' }} | |
2650 | 2638 | onClick={() => { |
2651 | - copyToClipboard(record.customerName); | |
2652 | - message.info('收货人复制成功:' + record.customerName); | |
2639 | + copyToClipboard(record.id); | |
2640 | + message.info('订单号复制成功!'); | |
2653 | 2641 | }} |
2654 | - > | |
2655 | - <span className="text-[#8C8C8C]">收货人:</span> | |
2656 | - {!isSupplier() && ( | |
2657 | - <Tooltip className="order-tooltip" title="详情"> | |
2658 | - <ContainerTwoTone | |
2659 | - className="px-1 hover:curcor-pointer" | |
2660 | - onClick={() => { | |
2661 | - createOptObject(null, record.id); | |
2662 | - setDeliverInfoDrawerVisible(true); | |
2663 | - }} | |
2664 | - /> | |
2665 | - </Tooltip> | |
2666 | - )} | |
2667 | - <span className="text-slate-700"> | |
2668 | - {record.customerName + ' '} | |
2669 | - </span> | |
2670 | - </span> | |
2671 | - </div> | |
2672 | - | |
2673 | - {isSupplier() ? ( | |
2642 | + /> | |
2643 | + </Tooltip> | |
2644 | + <Divider type="vertical" /> | |
2645 | + <span>{formatDateTime(record.createTime)}</span> | |
2646 | + <Divider type="vertical" /> | |
2647 | + <Space split={<Divider type="vertical" />}> | |
2674 | 2648 | <div |
2675 | - title={record.customerShippingAddress} | |
2676 | - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px] hover:cursor-pointer" | |
2649 | + className="hover:cursor-pointer" | |
2677 | 2650 | onClick={() => { |
2678 | - copyToClipboard(record.customerShippingAddress); | |
2679 | - message.info( | |
2680 | - '收货地址复制成功:' + record.customerShippingAddress, | |
2681 | - ); | |
2651 | + copyToClipboard(record.salesCode); | |
2652 | + message.info('代表复制成功:' + record.salesCode); | |
2682 | 2653 | }} |
2683 | 2654 | > |
2684 | - <span className="text-[#8C8C8C]">收货地址:</span> | |
2685 | - <span className="text-slate-700"> | |
2686 | - {record.customerShippingAddress} | |
2655 | + <span className="text-[#8C8C8C]">代表:</span> | |
2656 | + <span className="text-slate-700">{record.salesCode}</span> | |
2657 | + </div> | |
2658 | + {!isSupplier() ? ( | |
2659 | + <> | |
2660 | + <div | |
2661 | + title={record.institution} | |
2662 | + className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" | |
2663 | + > | |
2664 | + <span className="text-[#8C8C8C]">单位:</span> | |
2665 | + <span className="text-slate-700"> | |
2666 | + {record.institution} | |
2667 | + </span> | |
2668 | + </div> | |
2669 | + <span> | |
2670 | + <span className="text-[#8C8C8C]">课题组:</span> | |
2671 | + <span className="text-slate-700"> | |
2672 | + {record.institutionContactName | |
2673 | + ? record.institutionContactName + ' ' | |
2674 | + : '企业'} | |
2675 | + </span> | |
2676 | + </span> | |
2677 | + </> | |
2678 | + ) : ( | |
2679 | + '' | |
2680 | + )} | |
2681 | + <div | |
2682 | + title={record.institution} | |
2683 | + className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" | |
2684 | + > | |
2685 | + <span | |
2686 | + className="hover:cursor-pointer" | |
2687 | + onClick={() => { | |
2688 | + copyToClipboard(record.customerName); | |
2689 | + message.info( | |
2690 | + '收货人复制成功:' + record.customerName, | |
2691 | + ); | |
2692 | + }} | |
2693 | + > | |
2694 | + <span className="text-[#8C8C8C]">收货人:</span> | |
2695 | + {!isSupplier() && ( | |
2696 | + <Tooltip className="order-tooltip" title="详情"> | |
2697 | + <ContainerTwoTone | |
2698 | + className="px-1 hover:curcor-pointer" | |
2699 | + onClick={() => { | |
2700 | + createOptObject(null, record.id); | |
2701 | + setDeliverInfoDrawerVisible(true); | |
2702 | + }} | |
2703 | + /> | |
2704 | + </Tooltip> | |
2705 | + )} | |
2706 | + <span className="text-slate-700"> | |
2707 | + {record.customerName + ' '} | |
2708 | + </span> | |
2687 | 2709 | </span> |
2688 | 2710 | </div> |
2689 | - ) : ( | |
2690 | - '' | |
2691 | - )} | |
2692 | - </Space> | |
2693 | - </Flex> | |
2694 | - </Flex> | |
2695 | 2711 | |
2696 | - {isSupplier() ? ( | |
2697 | - <Flex className="pl-6" align="center"> | |
2698 | - <Flex | |
2699 | - className="hover:cursor-pointer" | |
2700 | - onClick={() => { | |
2701 | - copyToClipboard(record.customerContactNumber); | |
2702 | - message.info( | |
2703 | - '联系电话复制成功:' + record.customerContactNumber, | |
2704 | - ); | |
2705 | - }} | |
2706 | - > | |
2707 | - <span className="text-[#8C8C8C]">联系电话:</span> | |
2708 | - <span className="text-slate-700"> | |
2709 | - {record.customerContactNumber + ' '} | |
2710 | - </span> | |
2712 | + {isSupplier() ? ( | |
2713 | + <div | |
2714 | + title={record.customerShippingAddress} | |
2715 | + className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px] hover:cursor-pointer" | |
2716 | + onClick={() => { | |
2717 | + copyToClipboard(record.customerShippingAddress); | |
2718 | + message.info( | |
2719 | + '收货地址复制成功:' + | |
2720 | + record.customerShippingAddress, | |
2721 | + ); | |
2722 | + }} | |
2723 | + > | |
2724 | + <span className="text-[#8C8C8C]">收货地址:</span> | |
2725 | + <span className="text-slate-700"> | |
2726 | + {record.customerShippingAddress} | |
2727 | + </span> | |
2728 | + </div> | |
2729 | + ) : ( | |
2730 | + '' | |
2731 | + )} | |
2732 | + </Space> | |
2711 | 2733 | </Flex> |
2712 | 2734 | </Flex> |
2713 | - ) : ( | |
2714 | - '' | |
2715 | - )} | |
2716 | 2735 | |
2717 | - <Flex className="pl-6" align="center"> | |
2718 | - {roleCode === 'finance' ? ( | |
2719 | - <div | |
2720 | - title={enumValueToLabel( | |
2721 | - record.receivingCompany, | |
2722 | - getReceivingCompanyOptions(PAYEE_OPTIONS), | |
2723 | - )} | |
2724 | - className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px]" | |
2725 | - > | |
2726 | - <span className="text-[#8C8C8C]">开票收款单位:</span> | |
2727 | - <span className="text-slate-700"> | |
2728 | - {record.receivingCompany !== null | |
2729 | - ? enumValueToLabel( | |
2730 | - record.receivingCompany, | |
2731 | - getReceivingCompanyOptions(PAYEE_OPTIONS), | |
2732 | - ) | |
2733 | - : '暂无'} | |
2734 | - </span> | |
2735 | - </div> | |
2736 | + {isSupplier() ? ( | |
2737 | + <Flex className="pl-6" align="center"> | |
2738 | + <Flex | |
2739 | + className="hover:cursor-pointer" | |
2740 | + onClick={() => { | |
2741 | + copyToClipboard(record.customerContactNumber); | |
2742 | + message.info( | |
2743 | + '联系电话复制成功:' + record.customerContactNumber, | |
2744 | + ); | |
2745 | + }} | |
2746 | + > | |
2747 | + <span className="text-[#8C8C8C]">联系电话:</span> | |
2748 | + <span className="text-slate-700"> | |
2749 | + {record.customerContactNumber + ' '} | |
2750 | + </span> | |
2751 | + </Flex> | |
2752 | + </Flex> | |
2736 | 2753 | ) : ( |
2737 | 2754 | '' |
2738 | 2755 | )} |
2739 | 2756 | |
2740 | - {roleCode === 'finance' ? <Divider type="vertical" /> : ''} | |
2741 | - | |
2742 | - {/* 添加付款审核状态 */} | |
2743 | - <div> | |
2744 | - <span className="text-[#8C8C8C]">付款状态:</span> | |
2745 | - <span className="text-slate-700"> | |
2746 | - {getPaymentStatusText(record.paymentAuditStatus)} | |
2747 | - </span> | |
2748 | - </div> | |
2749 | - <Divider type="vertical" /> | |
2750 | - | |
2751 | - {/* 添加已回款金额 */} | |
2752 | - <div> | |
2753 | - <span className="text-[#8C8C8C]">已回款金额:¥</span> | |
2754 | - <span className="text-slate-700"> | |
2755 | - {record.payedMoney || '0.00'} | |
2756 | - </span> | |
2757 | - </div> | |
2758 | - <Divider type="vertical" /> | |
2759 | - | |
2760 | - {/* 添加未回款金额 */} | |
2761 | - <div> | |
2762 | - <span className="text-[#8C8C8C]">未回款金额:¥</span> | |
2763 | - <span className="text-slate-700"> | |
2764 | - {record.unPayedMoney || '0.00'} | |
2765 | - </span> | |
2766 | - </div> | |
2767 | - <Divider type="vertical" /> | |
2757 | + <Flex className="pl-6" align="center"> | |
2758 | + {roleCode === 'finance' ? ( | |
2759 | + <div | |
2760 | + title={enumValueToLabel( | |
2761 | + record.receivingCompany, | |
2762 | + getReceivingCompanyOptions(PAYEE_OPTIONS), | |
2763 | + )} | |
2764 | + className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px]" | |
2765 | + > | |
2766 | + <span className="text-[#8C8C8C]">开票收款单位:</span> | |
2767 | + <span className="text-slate-700"> | |
2768 | + {record.receivingCompany !== null | |
2769 | + ? enumValueToLabel( | |
2770 | + record.receivingCompany, | |
2771 | + getReceivingCompanyOptions(PAYEE_OPTIONS), | |
2772 | + ) | |
2773 | + : '暂无'} | |
2774 | + </span> | |
2775 | + </div> | |
2776 | + ) : ( | |
2777 | + '' | |
2778 | + )} | |
2768 | 2779 | |
2769 | - {/* 添加发票核销金额 */} | |
2770 | - <div> | |
2771 | - <span className="text-[#8C8C8C]">发票核销金额:¥</span> | |
2772 | - <span className="text-slate-700"> | |
2773 | - {record.invoiceMoney || '0.00'} | |
2774 | - </span> | |
2775 | - </div> | |
2776 | - <Divider type="vertical" /> | |
2780 | + {roleCode === 'finance' ? <Divider type="vertical" /> : ''} | |
2777 | 2781 | |
2778 | - <div title={record.notes}> | |
2779 | - <div | |
2780 | - className="max-w-[850px] whitespace-normal overflow-hidden overflow-ellipsis hover:cursor-pointer" | |
2781 | - onClick={() => { | |
2782 | - copyToClipboard(record.notes); | |
2783 | - message.info('备注复制成功:' + record.notes); | |
2784 | - }} | |
2785 | - > | |
2786 | - <span className="text-[#8C8C8C]">备注:</span> | |
2787 | - <span className="ml-2"> | |
2788 | - {record.notes === null ? '暂无备注' : record.notes} | |
2782 | + {/* 添加付款审核状态 */} | |
2783 | + <div> | |
2784 | + <span className="text-[#8C8C8C]">付款状态:</span> | |
2785 | + <span className="text-slate-700"> | |
2786 | + {getPaymentStatusText(record.paymentAuditStatus)} | |
2789 | 2787 | </span> |
2790 | 2788 | </div> |
2791 | - </div> | |
2789 | + <Divider type="vertical" /> | |
2792 | 2790 | |
2793 | - {!isSupplier() ? ( | |
2794 | - <Tooltip title="编辑"> | |
2795 | - <EditTwoTone | |
2796 | - className="pl-1 hover:curcor-pointer" | |
2797 | - onClick={() => { | |
2798 | - setNotesEditVisible(true); | |
2799 | - setSelectedRows([record.id]); | |
2800 | - setNotes(record.notes); | |
2801 | - setNotesType(0); | |
2802 | - }} | |
2803 | - /> | |
2804 | - </Tooltip> | |
2805 | - ) : ( | |
2806 | - '' | |
2807 | - )} | |
2791 | + {/* 开票状态 */} | |
2792 | + <div> | |
2793 | + <span className="text-[#8C8C8C]">开票状态:</span> | |
2794 | + <span className="text-slate-700"> | |
2795 | + {enumValueToLabel( | |
2796 | + record.afterInvoicingStatus, | |
2797 | + AFTER_INVOICING_STATUS, | |
2798 | + ) || '尚未开票'} | |
2799 | + </span> | |
2800 | + </div> | |
2801 | + <Divider type="vertical" /> | |
2808 | 2802 | |
2809 | - {record.goodsWeight !== null ? ( | |
2810 | - <div title={record.goodsWeight + 'kg'} className="pl-3"> | |
2811 | - <div | |
2812 | - className="overflow-hidden max-w-md overflow-ellipsis whitespace-no-wrap hover:cursor-pointer" | |
2813 | - onClick={() => { | |
2814 | - copyToClipboard(record.goodsWeight + 'kg'); | |
2815 | - message.info( | |
2816 | - '包裹重量复制成功:' + record.goodsWeight + 'kg', | |
2817 | - ); | |
2818 | - }} | |
2819 | - > | |
2820 | - <span className="text-[#8C8C8C]">包裹重量:</span> | |
2821 | - <span className="ml-2">{record.goodsWeight + 'kg'}</span> | |
2822 | - </div> | |
2803 | + {/* 添加已回款金额 */} | |
2804 | + <div> | |
2805 | + <span className="text-[#8C8C8C]">已回款金额:¥</span> | |
2806 | + <span className="text-slate-700"> | |
2807 | + {record.payedMoney || '0'} | |
2808 | + </span> | |
2823 | 2809 | </div> |
2824 | - ) : ( | |
2825 | - '' | |
2826 | - )} | |
2810 | + <Divider type="vertical" /> | |
2827 | 2811 | |
2828 | - {record.goodsVolume !== null ? ( | |
2829 | - <div title={record.goodsVolume + 'm³'} className="pl-3"> | |
2812 | + {/* 添加未回款金额 */} | |
2813 | + <div> | |
2814 | + <span className="text-[#8C8C8C]">未回款金额:¥</span> | |
2815 | + <span className="text-slate-700"> | |
2816 | + {record.unPayedMoney || '0'} | |
2817 | + </span> | |
2818 | + </div> | |
2819 | + <Divider type="vertical" /> | |
2820 | + </Flex> | |
2821 | + <Flex className="pl-6" align="center"> | |
2822 | + <div> | |
2823 | + <span className="text-[#8C8C8C]">开票中金额:¥</span> | |
2824 | + <span className="text-slate-700"> | |
2825 | + {record.invoicePendingAmount || '-'} | |
2826 | + </span> | |
2827 | + </div> | |
2828 | + <Divider type="vertical" /> | |
2829 | + <div> | |
2830 | + <span className="text-[#8C8C8C]">已开票金额:¥</span> | |
2831 | + <span className="text-slate-700"> | |
2832 | + {record.invoiceIssuedAmount || '-'} | |
2833 | + </span> | |
2834 | + </div> | |
2835 | + <Divider type="vertical" /> | |
2836 | + {/* 添加发票核销金额 */} | |
2837 | + <div> | |
2838 | + <span className="text-[#8C8C8C]">发票核销金额:¥</span> | |
2839 | + <span className="text-slate-700"> | |
2840 | + {record.invoiceMoney || '-'} | |
2841 | + </span> | |
2842 | + </div> | |
2843 | + <Divider type="vertical" /> | |
2844 | + </Flex> | |
2845 | + <Flex className="pl-6" align="center"> | |
2846 | + <div title={record.notes}> | |
2830 | 2847 | <div |
2831 | - className="overflow-hidden max-w-md overflow-ellipsis whitespace-no-wrap hover:cursor-pointer" | |
2848 | + className="max-w-[850px] whitespace-normal overflow-hidden overflow-ellipsis hover:cursor-pointer" | |
2832 | 2849 | onClick={() => { |
2833 | - copyToClipboard(record.goodsVolume + 'm³'); | |
2834 | - message.info( | |
2835 | - '包裹体积复制成功:' + record.goodsVolume + 'm³', | |
2836 | - ); | |
2850 | + copyToClipboard(record.notes); | |
2851 | + message.info('备注复制成功:' + record.notes); | |
2837 | 2852 | }} |
2838 | 2853 | > |
2839 | - <span className="text-[#8C8C8C]">包裹体积:</span> | |
2840 | - <span className="ml-2">{record.goodsVolume + 'm³'}</span> | |
2841 | - </div> | |
2842 | - </div> | |
2843 | - ) : ( | |
2844 | - '' | |
2845 | - )} | |
2846 | - </Flex> | |
2847 | - </Flex> | |
2848 | - <Flex wrap="wrap" gap="middle" vertical> | |
2849 | - <Flex justify="flex-end"> | |
2850 | - <Flex wrap="wrap" gap="middle" align="center"> | |
2851 | - {!isSupplier() ? ( | |
2852 | - <div> | |
2853 | - <span className="text-[#8C8C8C]">总金额:¥</span> | |
2854 | - <span className="text-lg font-medium"> | |
2855 | - {record.totalPayment} | |
2854 | + <span className="text-[#8C8C8C]">备注:</span> | |
2855 | + <span className="ml-2"> | |
2856 | + {record.notes === null ? '暂无备注' : record.notes} | |
2856 | 2857 | </span> |
2857 | 2858 | </div> |
2858 | - ) : ( | |
2859 | - '' | |
2860 | - )} | |
2859 | + </div> | |
2861 | 2860 | |
2862 | - {rolePath?.includes('addOrder') ? ( | |
2863 | - <Tooltip title="复制"> | |
2864 | - <CopyTwoTone | |
2865 | - className="hover:cursor-pointer" | |
2861 | + {!isSupplier() ? ( | |
2862 | + <Tooltip title="编辑"> | |
2863 | + <EditTwoTone | |
2864 | + className="pl-1 hover:curcor-pointer" | |
2866 | 2865 | onClick={() => { |
2867 | - createOptObject(null, record.id); | |
2868 | - copyOrderToClipboard(record); | |
2869 | - setOrderOptType('copy'); | |
2870 | - setOrderDrawerVisible(true); | |
2866 | + setNotesEditVisible(true); | |
2867 | + setSelectedRows([record.id]); | |
2868 | + setNotes(record.notes); | |
2869 | + setNotesType(0); | |
2871 | 2870 | }} |
2872 | 2871 | /> |
2873 | 2872 | </Tooltip> |
2874 | 2873 | ) : ( |
2875 | - <Tooltip title="复制文本"> | |
2876 | - <CopyTwoTone | |
2877 | - className="hover:cursor-pointer" | |
2874 | + '' | |
2875 | + )} | |
2876 | + | |
2877 | + {record.goodsWeight !== null ? ( | |
2878 | + <div title={record.goodsWeight + 'kg'} className="pl-3"> | |
2879 | + <div | |
2880 | + className="overflow-hidden max-w-md overflow-ellipsis whitespace-no-wrap hover:cursor-pointer" | |
2878 | 2881 | onClick={() => { |
2879 | - copyOrderToClipboard(record); | |
2882 | + copyToClipboard(record.goodsWeight + 'kg'); | |
2883 | + message.info( | |
2884 | + '包裹重量复制成功:' + record.goodsWeight + 'kg', | |
2885 | + ); | |
2880 | 2886 | }} |
2881 | - /> | |
2882 | - </Tooltip> | |
2887 | + > | |
2888 | + <span className="text-[#8C8C8C]">包裹重量:</span> | |
2889 | + <span className="ml-2">{record.goodsWeight + 'kg'}</span> | |
2890 | + </div> | |
2891 | + </div> | |
2892 | + ) : ( | |
2893 | + '' | |
2883 | 2894 | )} |
2884 | - {!isSupplier() ? ( | |
2885 | - <Tooltip title="历史"> | |
2886 | - <ClockCircleTwoTone | |
2887 | - className="hover:cursor-pointer" | |
2895 | + | |
2896 | + {record.goodsVolume !== null ? ( | |
2897 | + <div title={record.goodsVolume + 'm³'} className="pl-3"> | |
2898 | + <div | |
2899 | + className="overflow-hidden max-w-md overflow-ellipsis whitespace-no-wrap hover:cursor-pointer" | |
2888 | 2900 | onClick={() => { |
2889 | - setHistoryModalVisible(true); | |
2890 | - if (subOrderSelectedMap.get(record.id)?.length) { | |
2891 | - setSelectedRows(subOrderSelectedMap.get(record.id)); | |
2892 | - } else { | |
2893 | - setSelectedRows(record.subOrderInformationLists); | |
2894 | - } | |
2901 | + copyToClipboard(record.goodsVolume + 'm³'); | |
2902 | + message.info( | |
2903 | + '包裹体积复制成功:' + record.goodsVolume + 'm³', | |
2904 | + ); | |
2895 | 2905 | }} |
2896 | - /> | |
2897 | - </Tooltip> | |
2906 | + > | |
2907 | + <span className="text-[#8C8C8C]">包裹体积:</span> | |
2908 | + <span className="ml-2">{record.goodsVolume + 'm³'}</span> | |
2909 | + </div> | |
2910 | + </div> | |
2898 | 2911 | ) : ( |
2899 | 2912 | '' |
2900 | 2913 | )} |
2901 | 2914 | </Flex> |
2902 | 2915 | </Flex> |
2903 | - <Flex justify="flex-end"> | |
2904 | - <Space.Compact direction="vertical" align="end"> | |
2905 | - <Space wrap> | |
2906 | - {record.paths?.includes('postAudit') ? ( | |
2907 | - <Button | |
2908 | - className="p-0" | |
2909 | - type="link" | |
2910 | - onClick={() => { | |
2911 | - setCurrentMainId(record.id); | |
2912 | - setCurretnOptSubId(null); | |
2913 | - setCheckVisible(true); | |
2914 | - setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT); | |
2915 | - }} | |
2916 | - > | |
2917 | - 后置审核 | |
2918 | - </Button> | |
2919 | - ) : ( | |
2920 | - '' | |
2921 | - )} | |
2922 | - {record.paths?.includes('URGENT_INVOICE_AUDITING') ? ( | |
2923 | - <Button | |
2924 | - className="p-0" | |
2925 | - type="link" | |
2926 | - onClick={() => { | |
2927 | - createOptObject(null, record.id); | |
2928 | - setCheckVisible(true); | |
2929 | - setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING); | |
2930 | - }} | |
2931 | - > | |
2932 | - 加急审核(新) | |
2933 | - </Button> | |
2934 | - ) : ( | |
2935 | - '' | |
2936 | - )} | |
2937 | - {record.paths?.includes('URGENT_INVOICE_AUDITING_old') ? ( | |
2938 | - <Button | |
2939 | - className="p-0" | |
2940 | - type="link" | |
2941 | - onClick={() => { | |
2942 | - createOptObject(null, record.id); | |
2943 | - setCheckVisible(true); | |
2944 | - setOrderCheckType( | |
2945 | - CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD, | |
2946 | - ); | |
2947 | - }} | |
2948 | - > | |
2949 | - 加急审核(旧) | |
2950 | - </Button> | |
2916 | + <Flex wrap="wrap" gap="middle" vertical> | |
2917 | + <Flex justify="flex-end"> | |
2918 | + <Flex wrap="wrap" gap="middle" align="center"> | |
2919 | + {!isSupplier() ? ( | |
2920 | + <div> | |
2921 | + <span className="text-[#8C8C8C]">总金额:¥</span> | |
2922 | + <span className="text-lg font-medium"> | |
2923 | + {record.totalPayment || '0'} | |
2924 | + </span> | |
2925 | + </div> | |
2951 | 2926 | ) : ( |
2952 | 2927 | '' |
2953 | 2928 | )} |
2954 | - {record.paths?.includes('salesConfirm') && ( | |
2955 | - <ButtonConfirm | |
2956 | - className="p-0" | |
2957 | - title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。" | |
2958 | - text="订单确认" | |
2959 | - onConfirm={async () => { | |
2960 | - let subIds = subOrderSelectedMap | |
2961 | - .get(record.id) | |
2962 | - ?.map((item) => { | |
2963 | - return item.id; | |
2964 | - }); | |
2965 | - if (subIds === null || subIds === undefined) { | |
2966 | - subIds = record.subOrderInformationLists.map( | |
2967 | - (item) => { | |
2968 | - return item.id; | |
2969 | - }, | |
2970 | - ); | |
2971 | - } | |
2972 | - let res = await postServiceOrderSalesConfirm({ | |
2973 | - data: { | |
2974 | - subOrderIds: subIds, | |
2975 | - }, | |
2976 | - }); | |
2977 | 2929 | |
2978 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
2979 | - message.success(res.message); | |
2980 | - refreshTable(); | |
2981 | - } | |
2982 | - }} | |
2983 | - /> | |
2984 | - )} | |
2985 | - {record.paths?.includes('uploadPaymentReceiptBill') ? ( | |
2986 | - <Button | |
2987 | - className="p-0" | |
2988 | - type="link" | |
2989 | - onClick={() => { | |
2990 | - createOptObject(null, record.id); | |
2991 | - setUploadPayBillModalVisible(true); | |
2992 | - }} | |
2993 | - > | |
2994 | - 回款 | |
2995 | - </Button> | |
2930 | + {rolePath?.includes('addOrder') ? ( | |
2931 | + <Tooltip title="复制"> | |
2932 | + <CopyTwoTone | |
2933 | + className="hover:cursor-pointer" | |
2934 | + onClick={() => { | |
2935 | + createOptObject(null, record.id); | |
2936 | + copyOrderToClipboard(record); | |
2937 | + setOrderOptType('copy'); | |
2938 | + setOrderDrawerVisible(true); | |
2939 | + }} | |
2940 | + /> | |
2941 | + </Tooltip> | |
2996 | 2942 | ) : ( |
2997 | - '' | |
2943 | + <Tooltip title="复制文本"> | |
2944 | + <CopyTwoTone | |
2945 | + className="hover:cursor-pointer" | |
2946 | + onClick={() => { | |
2947 | + copyOrderToClipboard(record); | |
2948 | + }} | |
2949 | + /> | |
2950 | + </Tooltip> | |
2998 | 2951 | )} |
2999 | - {record.paths?.includes('updateHirePurchase') ? ( | |
3000 | - <Button | |
3001 | - className="p-0" | |
3002 | - type="link" | |
3003 | - onClick={() => { | |
3004 | - createOptObject(record.id, record.id); | |
3005 | - setHirePurchaseUploadPayBillModalVisible(true); | |
3006 | - }} | |
3007 | - > | |
3008 | - 回款 | |
3009 | - </Button> | |
2952 | + {!isSupplier() ? ( | |
2953 | + <Tooltip title="历史"> | |
2954 | + <ClockCircleTwoTone | |
2955 | + className="hover:cursor-pointer" | |
2956 | + onClick={() => { | |
2957 | + setHistoryModalVisible(true); | |
2958 | + if (subOrderSelectedMap.get(record.id)?.length) { | |
2959 | + setSelectedRows(subOrderSelectedMap.get(record.id)); | |
2960 | + } else { | |
2961 | + setSelectedRows(record.subOrderInformationLists); | |
2962 | + } | |
2963 | + }} | |
2964 | + /> | |
2965 | + </Tooltip> | |
3010 | 2966 | ) : ( |
3011 | 2967 | '' |
3012 | 2968 | )} |
2969 | + </Flex> | |
2970 | + </Flex> | |
2971 | + <Flex justify="flex-end"> | |
2972 | + <Space.Compact direction="vertical" align="end"> | |
2973 | + <Space wrap> | |
2974 | + {record.paths?.includes('postAudit') ? ( | |
2975 | + <Button | |
2976 | + className="p-0" | |
2977 | + type="link" | |
2978 | + onClick={() => { | |
2979 | + setCurrentMainId(record.id); | |
2980 | + setCurretnOptSubId(null); | |
2981 | + setCheckVisible(true); | |
2982 | + setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT); | |
2983 | + }} | |
2984 | + > | |
2985 | + 后置审核 | |
2986 | + </Button> | |
2987 | + ) : ( | |
2988 | + '' | |
2989 | + )} | |
2990 | + {record.paths?.includes('URGENT_INVOICE_AUDITING') ? ( | |
2991 | + <Button | |
2992 | + className="p-0" | |
2993 | + type="link" | |
2994 | + onClick={() => { | |
2995 | + createOptObject(null, record.id); | |
2996 | + setCheckVisible(true); | |
2997 | + setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING); | |
2998 | + }} | |
2999 | + > | |
3000 | + 加急审核(新) | |
3001 | + </Button> | |
3002 | + ) : ( | |
3003 | + '' | |
3004 | + )} | |
3005 | + {record.paths?.includes('URGENT_INVOICE_AUDITING_old') ? ( | |
3006 | + <Button | |
3007 | + className="p-0" | |
3008 | + type="link" | |
3009 | + onClick={() => { | |
3010 | + createOptObject(null, record.id); | |
3011 | + setCheckVisible(true); | |
3012 | + setOrderCheckType( | |
3013 | + CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD, | |
3014 | + ); | |
3015 | + }} | |
3016 | + > | |
3017 | + 加急审核(旧) | |
3018 | + </Button> | |
3019 | + ) : ( | |
3020 | + '' | |
3021 | + )} | |
3022 | + {record.paths?.includes('salesConfirm') && ( | |
3023 | + <ButtonConfirm | |
3024 | + className="p-0" | |
3025 | + title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。" | |
3026 | + text="订单确认" | |
3027 | + onConfirm={async () => { | |
3028 | + let subIds = subOrderSelectedMap | |
3029 | + .get(record.id) | |
3030 | + ?.map((item) => { | |
3031 | + return item.id; | |
3032 | + }); | |
3033 | + if (subIds === null || subIds === undefined) { | |
3034 | + subIds = record.subOrderInformationLists.map( | |
3035 | + (item) => { | |
3036 | + return item.id; | |
3037 | + }, | |
3038 | + ); | |
3039 | + } | |
3040 | + let res = await postServiceOrderSalesConfirm({ | |
3041 | + data: { | |
3042 | + subOrderIds: subIds, | |
3043 | + }, | |
3044 | + }); | |
3013 | 3045 | |
3014 | - {record.paths?.includes('refundHistory') ? ( | |
3015 | - <Button | |
3016 | - className="p-0" | |
3017 | - type="link" | |
3018 | - onClick={() => { | |
3019 | - createOptObject(record.id, record.id); | |
3020 | - setPaymentRecordModalVisible(true); | |
3021 | - }} | |
3022 | - > | |
3023 | - 付款记录 | |
3024 | - </Button> | |
3025 | - ) : ( | |
3026 | - '' | |
3027 | - )} | |
3046 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
3047 | + message.success(res.message); | |
3048 | + refreshTable(); | |
3049 | + } | |
3050 | + }} | |
3051 | + /> | |
3052 | + )} | |
3053 | + {record.paths?.includes('uploadPaymentReceiptBill') ? ( | |
3054 | + <Button | |
3055 | + className="p-0" | |
3056 | + type="link" | |
3057 | + onClick={() => { | |
3058 | + createOptObject(null, record.id); | |
3059 | + setUploadPayBillModalVisible(true); | |
3060 | + }} | |
3061 | + > | |
3062 | + 回款 | |
3063 | + </Button> | |
3064 | + ) : ( | |
3065 | + '' | |
3066 | + )} | |
3067 | + {record.paths?.includes('updateHirePurchase') ? ( | |
3068 | + <Button | |
3069 | + className="p-0" | |
3070 | + type="link" | |
3071 | + onClick={() => { | |
3072 | + createOptObject(record.id, record.id); | |
3073 | + setHirePurchaseUploadPayBillModalVisible(true); | |
3074 | + }} | |
3075 | + > | |
3076 | + 回款 | |
3077 | + </Button> | |
3078 | + ) : ( | |
3079 | + '' | |
3080 | + )} | |
3028 | 3081 | |
3029 | - {/* 输出日志以检查权限和支付方式 */} | |
3030 | - {console.log('Order info:', record.id, record.paths)} | |
3031 | - {record.paths?.includes('auditPartialPaymentReceipt') ? ( | |
3032 | - <Button | |
3033 | - className="p-0" | |
3034 | - type="link" | |
3035 | - onClick={() => { | |
3036 | - createOptObject(null, record.id); | |
3037 | - setCheckVisible(true); | |
3038 | - setOrderCheckType( | |
3039 | - CHECK_TYPE.PARTIAL_PAYMENT_RECEIPTS_AUDIT, | |
3040 | - ); | |
3041 | - }} | |
3042 | - > | |
3043 | - 回款审核 | |
3044 | - </Button> | |
3045 | - ) : ( | |
3046 | - '' | |
3047 | - )} | |
3082 | + {record.paths?.includes('refundHistory') ? ( | |
3083 | + <Button | |
3084 | + className="p-0" | |
3085 | + type="link" | |
3086 | + onClick={() => { | |
3087 | + createOptObject(record.id, record.id); | |
3088 | + setPaymentRecordModalVisible(true); | |
3089 | + }} | |
3090 | + > | |
3091 | + 付款记录 | |
3092 | + </Button> | |
3093 | + ) : ( | |
3094 | + '' | |
3095 | + )} | |
3048 | 3096 | |
3049 | - {record.paths?.includes('modifiedAuditRequest') ? ( | |
3050 | - <Button | |
3051 | - className="p-0" | |
3052 | - type="link" | |
3053 | - onClick={() => { | |
3054 | - createOptObject(null, record.id); | |
3055 | - setCheckVisible(true); | |
3056 | - setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT); | |
3057 | - }} | |
3058 | - > | |
3059 | - 节点修改审核 | |
3060 | - </Button> | |
3061 | - ) : ( | |
3062 | - '' | |
3063 | - )} | |
3097 | + {/* 输出日志以检查权限和支付方式 */} | |
3098 | + {console.log('Order info:', record.id, record.paths)} | |
3099 | + {record.paths?.includes('auditPartialPaymentReceipt') ? ( | |
3100 | + <Button | |
3101 | + className="p-0" | |
3102 | + type="link" | |
3103 | + onClick={() => { | |
3104 | + createOptObject(null, record.id); | |
3105 | + setCheckVisible(true); | |
3106 | + setOrderCheckType( | |
3107 | + CHECK_TYPE.PARTIAL_PAYMENT_RECEIPTS_AUDIT, | |
3108 | + ); | |
3109 | + }} | |
3110 | + > | |
3111 | + 回款审核 | |
3112 | + </Button> | |
3113 | + ) : ( | |
3114 | + '' | |
3115 | + )} | |
3064 | 3116 | |
3065 | - {record.paths?.includes('auditPaymentReceipt') ? ( | |
3066 | - <Button | |
3067 | - className="p-0" | |
3068 | - type="link" | |
3069 | - onClick={() => { | |
3070 | - createOptObject(null, record.id); | |
3071 | - setCheckVisible(true); | |
3072 | - setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT); | |
3073 | - }} | |
3074 | - > | |
3075 | - 回款审核 | |
3076 | - </Button> | |
3077 | - ) : ( | |
3078 | - '' | |
3079 | - )} | |
3117 | + {record.paths?.includes('modifiedAuditRequest') ? ( | |
3118 | + <Button | |
3119 | + className="p-0" | |
3120 | + type="link" | |
3121 | + onClick={() => { | |
3122 | + createOptObject(null, record.id); | |
3123 | + setCheckVisible(true); | |
3124 | + setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT); | |
3125 | + }} | |
3126 | + > | |
3127 | + 节点修改审核 | |
3128 | + </Button> | |
3129 | + ) : ( | |
3130 | + '' | |
3131 | + )} | |
3080 | 3132 | |
3081 | - {/* 第二个回款审核(分期)按钮已被移除,使用上面的带权限检查的按钮 */} | |
3133 | + {record.paths?.includes('auditPaymentReceipt') ? ( | |
3134 | + <Button | |
3135 | + className="p-0" | |
3136 | + type="link" | |
3137 | + onClick={() => { | |
3138 | + createOptObject(null, record.id); | |
3139 | + setCheckVisible(true); | |
3140 | + setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT); | |
3141 | + }} | |
3142 | + > | |
3143 | + 回款审核 | |
3144 | + </Button> | |
3145 | + ) : ( | |
3146 | + '' | |
3147 | + )} | |
3082 | 3148 | |
3083 | - {record.paths?.includes('modifiedLeaderAuditRequest') ? ( | |
3084 | - <Button | |
3085 | - className="p-0" | |
3086 | - type="link" | |
3087 | - onClick={() => { | |
3088 | - createOptObject(null, record.id); | |
3089 | - setCheckVisible(true); | |
3090 | - setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT); | |
3091 | - }} | |
3092 | - > | |
3093 | - 领导修改审核 | |
3094 | - </Button> | |
3095 | - ) : ( | |
3096 | - '' | |
3097 | - )} | |
3149 | + {/* 第二个回款审核(分期)按钮已被移除,使用上面的带权限检查的按钮 */} | |
3150 | + | |
3151 | + {record.paths?.includes('modifiedLeaderAuditRequest') ? ( | |
3152 | + <Button | |
3153 | + className="p-0" | |
3154 | + type="link" | |
3155 | + onClick={() => { | |
3156 | + createOptObject(null, record.id); | |
3157 | + setCheckVisible(true); | |
3158 | + setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT); | |
3159 | + }} | |
3160 | + > | |
3161 | + 领导修改审核 | |
3162 | + </Button> | |
3163 | + ) : ( | |
3164 | + '' | |
3165 | + )} | |
3098 | 3166 | |
3099 | - {false ? ( | |
3100 | - <Button | |
3101 | - className="p-0" | |
3102 | - type="link" | |
3103 | - onClick={() => { | |
3104 | - createOptObject(null, record.id); | |
3105 | - setFinancialReceiptsModalVisible(true); | |
3106 | - setIsEdit(true); | |
3107 | - }} | |
3108 | - > | |
3109 | - 收款记录 | |
3110 | - </Button> | |
3111 | - ) : ( | |
3112 | - '' | |
3113 | - )} | |
3167 | + {false ? ( | |
3168 | + <Button | |
3169 | + className="p-0" | |
3170 | + type="link" | |
3171 | + onClick={() => { | |
3172 | + createOptObject(null, record.id); | |
3173 | + setFinancialReceiptsModalVisible(true); | |
3174 | + setIsEdit(true); | |
3175 | + }} | |
3176 | + > | |
3177 | + 收款记录 | |
3178 | + </Button> | |
3179 | + ) : ( | |
3180 | + '' | |
3181 | + )} | |
3114 | 3182 | |
3115 | - {record.paths?.includes('confirmReissue_old') ? ( | |
3116 | - <Button | |
3117 | - className="p-0" | |
3118 | - type="link" | |
3119 | - onClick={() => { | |
3120 | - setCurrentMainId(record.id); | |
3121 | - setCurretnOptSubId(null); | |
3122 | - setCheckVisible(true); | |
3123 | - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD); | |
3124 | - }} | |
3125 | - > | |
3126 | - 重新开票审核(旧) | |
3127 | - </Button> | |
3128 | - ) : ( | |
3129 | - '' | |
3130 | - )} | |
3183 | + {record.paths?.includes('confirmReissue_old') ? ( | |
3184 | + <Button | |
3185 | + className="p-0" | |
3186 | + type="link" | |
3187 | + onClick={() => { | |
3188 | + setCurrentMainId(record.id); | |
3189 | + setCurretnOptSubId(null); | |
3190 | + setCheckVisible(true); | |
3191 | + setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD); | |
3192 | + }} | |
3193 | + > | |
3194 | + 重新开票审核(旧) | |
3195 | + </Button> | |
3196 | + ) : ( | |
3197 | + '' | |
3198 | + )} | |
3131 | 3199 | |
3132 | - {record.paths?.includes('confirmReissue') ? ( | |
3133 | - <Button | |
3134 | - className="p-0" | |
3135 | - type="link" | |
3136 | - onClick={() => { | |
3137 | - setCurrentMainId(record.id); | |
3138 | - setCurretnOptSubId(null); | |
3139 | - setCheckVisible(true); | |
3140 | - setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE); | |
3141 | - }} | |
3142 | - > | |
3143 | - 重新开票审核(新) | |
3144 | - </Button> | |
3145 | - ) : ( | |
3146 | - '' | |
3147 | - )} | |
3200 | + {record.paths?.includes('confirmReissue') ? ( | |
3201 | + <Button | |
3202 | + className="p-0" | |
3203 | + type="link" | |
3204 | + onClick={() => { | |
3205 | + setCurrentMainId(record.id); | |
3206 | + setCurretnOptSubId(null); | |
3207 | + setCheckVisible(true); | |
3208 | + setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE); | |
3209 | + }} | |
3210 | + > | |
3211 | + 重新开票审核(新) | |
3212 | + </Button> | |
3213 | + ) : ( | |
3214 | + '' | |
3215 | + )} | |
3148 | 3216 | |
3149 | - {record.paths?.includes('procureOrder') ? ( | |
3150 | - <ButtonConfirm | |
3151 | - className="p-0" | |
3152 | - title="是否下单?" | |
3153 | - text="下单" | |
3154 | - onConfirm={async () => { | |
3155 | - let subIds = subOrderSelectedMap | |
3156 | - .get(record.id) | |
3157 | - ?.map((item) => { | |
3158 | - return item.id; | |
3159 | - }); | |
3160 | - if (subIds === null || subIds === undefined) { | |
3161 | - subIds = record.subOrderInformationLists.map( | |
3162 | - (item) => { | |
3217 | + {record.paths?.includes('procureOrder') ? ( | |
3218 | + <ButtonConfirm | |
3219 | + className="p-0" | |
3220 | + title="是否下单?" | |
3221 | + text="下单" | |
3222 | + onConfirm={async () => { | |
3223 | + let subIds = subOrderSelectedMap | |
3224 | + .get(record.id) | |
3225 | + ?.map((item) => { | |
3163 | 3226 | return item.id; |
3164 | - }, | |
3165 | - ); | |
3166 | - } | |
3167 | - let res = await postServiceOrderProcureOrder({ | |
3168 | - data: { subIds: subIds }, | |
3169 | - }); | |
3170 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
3171 | - message.success(res.message); | |
3172 | - refreshTable(); | |
3173 | - return true; | |
3174 | - } | |
3175 | - }} | |
3176 | - /> | |
3177 | - ) : ( | |
3178 | - '' | |
3179 | - )} | |
3180 | - | |
3181 | - {record.paths?.includes('cancelSend') ? ( | |
3182 | - <ButtonConfirm | |
3183 | - className="p-0" | |
3184 | - title="是否取消发货?" | |
3185 | - text="取消发货" | |
3186 | - onConfirm={async () => { | |
3187 | - let subIds = subOrderSelectedMap | |
3188 | - .get(record.id) | |
3189 | - ?.map((item) => { | |
3190 | - return item.id; | |
3227 | + }); | |
3228 | + if (subIds === null || subIds === undefined) { | |
3229 | + subIds = record.subOrderInformationLists.map( | |
3230 | + (item) => { | |
3231 | + return item.id; | |
3232 | + }, | |
3233 | + ); | |
3234 | + } | |
3235 | + let res = await postServiceOrderProcureOrder({ | |
3236 | + data: { subIds: subIds }, | |
3191 | 3237 | }); |
3192 | - if (subIds === null || subIds === undefined) { | |
3193 | - subIds = record.subOrderInformationLists.map( | |
3194 | - (item) => { | |
3195 | - return item.id; | |
3196 | - }, | |
3197 | - ); | |
3198 | - } | |
3199 | - let res = await postServiceOrderCancelSend({ | |
3200 | - data: { subIds: subIds }, | |
3201 | - }); | |
3202 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
3203 | - message.success(res.message); | |
3204 | - refreshTable(); | |
3205 | - return true; | |
3206 | - } | |
3207 | - }} | |
3208 | - /> | |
3209 | - ) : ( | |
3210 | - '' | |
3211 | - )} | |
3238 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
3239 | + message.success(res.message); | |
3240 | + refreshTable(); | |
3241 | + return true; | |
3242 | + } | |
3243 | + }} | |
3244 | + /> | |
3245 | + ) : ( | |
3246 | + '' | |
3247 | + )} | |
3212 | 3248 | |
3213 | - {record.paths?.includes('applyModify') ? ( | |
3214 | - <Button | |
3215 | - className="p-0" | |
3216 | - type="link" | |
3217 | - onClick={() => { | |
3218 | - createOptObject(null, record.id); | |
3219 | - setOrderDrawerVisible(true); | |
3220 | - setOrderOptType('order-change-normal'); | |
3221 | - }} | |
3222 | - > | |
3223 | - 申请修改 | |
3224 | - </Button> | |
3225 | - ) : ( | |
3226 | - '' | |
3227 | - )} | |
3228 | - {record.paths?.includes('saleCancelInvoicing') ? ( | |
3229 | - <ButtonConfirm | |
3230 | - className="p-0" | |
3231 | - title="确认取消申请开票?" | |
3232 | - text="取消申请(新)" | |
3233 | - onConfirm={async () => { | |
3234 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3235 | - record.id, | |
3236 | - ); | |
3237 | - if (selectedSubOrders === undefined) { | |
3238 | - selectedSubOrders = record.subOrderInformationLists; | |
3239 | - } | |
3240 | - let subOrderIds = selectedSubOrders.map( | |
3241 | - (item) => item.id, | |
3242 | - ); | |
3243 | - let res = await postServiceInvoiceCancelApply({ | |
3244 | - data: { | |
3245 | - subOrderIds: subOrderIds, | |
3246 | - }, | |
3247 | - }); | |
3249 | + {record.paths?.includes('cancelSend') ? ( | |
3250 | + <ButtonConfirm | |
3251 | + className="p-0" | |
3252 | + title="是否取消发货?" | |
3253 | + text="取消发货" | |
3254 | + onConfirm={async () => { | |
3255 | + let subIds = subOrderSelectedMap | |
3256 | + .get(record.id) | |
3257 | + ?.map((item) => { | |
3258 | + return item.id; | |
3259 | + }); | |
3260 | + if (subIds === null || subIds === undefined) { | |
3261 | + subIds = record.subOrderInformationLists.map( | |
3262 | + (item) => { | |
3263 | + return item.id; | |
3264 | + }, | |
3265 | + ); | |
3266 | + } | |
3267 | + let res = await postServiceOrderCancelSend({ | |
3268 | + data: { subIds: subIds }, | |
3269 | + }); | |
3270 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
3271 | + message.success(res.message); | |
3272 | + refreshTable(); | |
3273 | + return true; | |
3274 | + } | |
3275 | + }} | |
3276 | + /> | |
3277 | + ) : ( | |
3278 | + '' | |
3279 | + )} | |
3248 | 3280 | |
3249 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
3250 | - message.success(res.message); | |
3251 | - refreshTable(); | |
3252 | - } | |
3253 | - }} | |
3254 | - /> | |
3255 | - ) : ( | |
3256 | - '' | |
3257 | - )} | |
3281 | + {record.paths?.includes('applyModify') ? ( | |
3282 | + <Button | |
3283 | + className="p-0" | |
3284 | + type="link" | |
3285 | + onClick={() => { | |
3286 | + createOptObject(null, record.id); | |
3287 | + setOrderDrawerVisible(true); | |
3288 | + setOrderOptType('order-change-normal'); | |
3289 | + }} | |
3290 | + > | |
3291 | + 申请修改 | |
3292 | + </Button> | |
3293 | + ) : ( | |
3294 | + '' | |
3295 | + )} | |
3296 | + {record.paths?.includes('saleCancelInvoicing') ? ( | |
3297 | + <ButtonConfirm | |
3298 | + className="p-0" | |
3299 | + title="确认取消申请开票?" | |
3300 | + text="取消申请(新)" | |
3301 | + onConfirm={async () => { | |
3302 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3303 | + record.id, | |
3304 | + ); | |
3305 | + if (selectedSubOrders === undefined) { | |
3306 | + selectedSubOrders = record.subOrderInformationLists; | |
3307 | + } | |
3308 | + let subOrderIds = selectedSubOrders.map( | |
3309 | + (item) => item.id, | |
3310 | + ); | |
3311 | + let res = await postServiceInvoiceCancelApply({ | |
3312 | + data: { | |
3313 | + subOrderIds: subOrderIds, | |
3314 | + }, | |
3315 | + }); | |
3258 | 3316 | |
3259 | - {record.paths?.includes('leaderAudit') ? ( | |
3260 | - <Button | |
3261 | - className="p-0" | |
3262 | - type="link" | |
3263 | - onClick={() => { | |
3264 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3265 | - record.id, | |
3266 | - ); | |
3267 | - setSelectedRows(selectedSubOrders); | |
3268 | - if (selectedSubOrders === undefined) { | |
3269 | - selectedSubOrders = record.subOrderInformationLists; | |
3270 | - } | |
3271 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3272 | - if ( | |
3273 | - selectedSubOrders[i].orderStatus !== | |
3274 | - 'LEADER_PROCESS' | |
3275 | - ) { | |
3276 | - message.error('请选择领导待审核的子订单进行审核'); | |
3277 | - return; | |
3317 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
3318 | + message.success(res.message); | |
3319 | + refreshTable(); | |
3278 | 3320 | } |
3279 | - } | |
3280 | - createOptObject(null, record.id); | |
3281 | - setCheckVisible(true); | |
3282 | - setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); | |
3283 | - }} | |
3284 | - > | |
3285 | - 审核 | |
3286 | - </Button> | |
3287 | - ) : ( | |
3288 | - '' | |
3289 | - )} | |
3321 | + }} | |
3322 | + /> | |
3323 | + ) : ( | |
3324 | + '' | |
3325 | + )} | |
3290 | 3326 | |
3291 | - {record.paths?.includes('changeOrderAudit') ? ( | |
3292 | - <Button | |
3293 | - className="p-0" | |
3294 | - type="link" | |
3295 | - onClick={() => { | |
3296 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3297 | - record.id, | |
3298 | - ); | |
3299 | - setSelectedRows(selectedSubOrders); | |
3300 | - if (selectedSubOrders === undefined) { | |
3301 | - selectedSubOrders = record.subOrderInformationLists; | |
3302 | - } | |
3303 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3304 | - if ( | |
3305 | - selectedSubOrders[i].orderStatus !== | |
3306 | - 'MODIFY_APPLY_WAIT_FOR_AUDIT' | |
3307 | - ) { | |
3308 | - message.error('请选择[修改待审核]的子订单进行审核'); | |
3309 | - return; | |
3327 | + {record.paths?.includes('leaderAudit') ? ( | |
3328 | + <Button | |
3329 | + className="p-0" | |
3330 | + type="link" | |
3331 | + onClick={() => { | |
3332 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3333 | + record.id, | |
3334 | + ); | |
3335 | + setSelectedRows(selectedSubOrders); | |
3336 | + if (selectedSubOrders === undefined) { | |
3337 | + selectedSubOrders = record.subOrderInformationLists; | |
3310 | 3338 | } |
3311 | - } | |
3312 | - createOptObject(null, record.id); | |
3313 | - setCheckVisible(true); | |
3314 | - setOrderCheckType( | |
3315 | - CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT, | |
3316 | - ); | |
3317 | - }} | |
3318 | - > | |
3319 | - 审核 | |
3320 | - </Button> | |
3321 | - ) : ( | |
3322 | - '' | |
3323 | - )} | |
3339 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3340 | + if ( | |
3341 | + selectedSubOrders[i].orderStatus !== | |
3342 | + 'LEADER_PROCESS' | |
3343 | + ) { | |
3344 | + message.error('请选择领导待审核的子订单进行审核'); | |
3345 | + return; | |
3346 | + } | |
3347 | + } | |
3348 | + createOptObject(null, record.id); | |
3349 | + setCheckVisible(true); | |
3350 | + setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); | |
3351 | + }} | |
3352 | + > | |
3353 | + 审核 | |
3354 | + </Button> | |
3355 | + ) : ( | |
3356 | + '' | |
3357 | + )} | |
3324 | 3358 | |
3325 | - {record.paths?.includes('creditAudit') ? ( | |
3326 | - <Button | |
3327 | - className="p-0" | |
3328 | - type="link" | |
3329 | - onClick={() => { | |
3330 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3331 | - record.id, | |
3332 | - ); | |
3333 | - setSelectedRows(selectedSubOrders); | |
3334 | - if (selectedSubOrders === undefined) { | |
3335 | - selectedSubOrders = record.subOrderInformationLists; | |
3336 | - } | |
3337 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3338 | - if ( | |
3339 | - selectedSubOrders[i].orderStatus !== | |
3340 | - 'CREDIT_CONFIRM' | |
3341 | - ) { | |
3342 | - message.error('请选择[赊账待审核]的子订单进行审核'); | |
3343 | - return; | |
3359 | + {record.paths?.includes('changeOrderAudit') ? ( | |
3360 | + <Button | |
3361 | + className="p-0" | |
3362 | + type="link" | |
3363 | + onClick={() => { | |
3364 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3365 | + record.id, | |
3366 | + ); | |
3367 | + setSelectedRows(selectedSubOrders); | |
3368 | + if (selectedSubOrders === undefined) { | |
3369 | + selectedSubOrders = record.subOrderInformationLists; | |
3344 | 3370 | } |
3345 | - } | |
3346 | - createOptObject(null, record.id); | |
3347 | - setCheckVisible(true); | |
3348 | - setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT); | |
3349 | - }} | |
3350 | - > | |
3351 | - 赊账审核 | |
3352 | - </Button> | |
3353 | - ) : ( | |
3354 | - '' | |
3355 | - )} | |
3371 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3372 | + if ( | |
3373 | + selectedSubOrders[i].orderStatus !== | |
3374 | + 'MODIFY_APPLY_WAIT_FOR_AUDIT' | |
3375 | + ) { | |
3376 | + message.error( | |
3377 | + '请选择[修改待审核]的子订单进行审核', | |
3378 | + ); | |
3379 | + return; | |
3380 | + } | |
3381 | + } | |
3382 | + createOptObject(null, record.id); | |
3383 | + setCheckVisible(true); | |
3384 | + setOrderCheckType( | |
3385 | + CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT, | |
3386 | + ); | |
3387 | + }} | |
3388 | + > | |
3389 | + 审核 | |
3390 | + </Button> | |
3391 | + ) : ( | |
3392 | + '' | |
3393 | + )} | |
3356 | 3394 | |
3357 | - {record.paths?.includes('editProductionTime') ? ( | |
3358 | - <Button | |
3359 | - className="p-0" | |
3360 | - type="link" | |
3361 | - onClick={() => { | |
3362 | - createOptObject(null, record.id); | |
3363 | - setProductionTimeModalVisible(true); | |
3364 | - }} | |
3365 | - > | |
3366 | - 生产时间 | |
3367 | - </Button> | |
3368 | - ) : ( | |
3369 | - '' | |
3370 | - )} | |
3395 | + {record.paths?.includes('creditAudit') ? ( | |
3396 | + <Button | |
3397 | + className="p-0" | |
3398 | + type="link" | |
3399 | + onClick={() => { | |
3400 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3401 | + record.id, | |
3402 | + ); | |
3403 | + setSelectedRows(selectedSubOrders); | |
3404 | + if (selectedSubOrders === undefined) { | |
3405 | + selectedSubOrders = record.subOrderInformationLists; | |
3406 | + } | |
3407 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3408 | + if ( | |
3409 | + selectedSubOrders[i].orderStatus !== | |
3410 | + 'CREDIT_CONFIRM' | |
3411 | + ) { | |
3412 | + message.error( | |
3413 | + '请选择[赊账待审核]的子订单进行审核', | |
3414 | + ); | |
3415 | + return; | |
3416 | + } | |
3417 | + } | |
3418 | + createOptObject(null, record.id); | |
3419 | + setCheckVisible(true); | |
3420 | + setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT); | |
3421 | + }} | |
3422 | + > | |
3423 | + 赊账审核 | |
3424 | + </Button> | |
3425 | + ) : ( | |
3426 | + '' | |
3427 | + )} | |
3371 | 3428 | |
3372 | - {record.paths?.includes('procureConvertProcure') ? ( | |
3373 | - <Button | |
3374 | - className="p-0" | |
3375 | - type="link" | |
3376 | - onClick={() => { | |
3377 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3378 | - record.id, | |
3379 | - ); | |
3380 | - if (selectedSubOrders === undefined) { | |
3381 | - selectedSubOrders = record.subOrderInformationLists; | |
3382 | - } | |
3429 | + {record.paths?.includes('editProductionTime') ? ( | |
3430 | + <Button | |
3431 | + className="p-0" | |
3432 | + type="link" | |
3433 | + onClick={() => { | |
3434 | + createOptObject(null, record.id); | |
3435 | + setProductionTimeModalVisible(true); | |
3436 | + }} | |
3437 | + > | |
3438 | + 生产时间 | |
3439 | + </Button> | |
3440 | + ) : ( | |
3441 | + '' | |
3442 | + )} | |
3383 | 3443 | |
3384 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3385 | - if ( | |
3386 | - !selectedSubOrders[i].paths.includes( | |
3387 | - 'procureConvertProcure', | |
3388 | - ) | |
3389 | - ) { | |
3390 | - message.error('请选择允许转发的子订单进行转发'); | |
3391 | - return; | |
3444 | + {record.paths?.includes('procureConvertProcure') ? ( | |
3445 | + <Button | |
3446 | + className="p-0" | |
3447 | + type="link" | |
3448 | + onClick={() => { | |
3449 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3450 | + record.id, | |
3451 | + ); | |
3452 | + if (selectedSubOrders === undefined) { | |
3453 | + selectedSubOrders = record.subOrderInformationLists; | |
3392 | 3454 | } |
3393 | - } | |
3394 | - createOptObject(null, record.id); | |
3395 | - setOrderCheckType(CHECK_TYPE.PROCURE); | |
3396 | - setProcureConvertModalVisible(true); | |
3397 | - }} | |
3398 | - > | |
3399 | - 转发 | |
3400 | - </Button> | |
3401 | - ) : ( | |
3402 | - '' | |
3403 | - )} | |
3404 | - {record.paths?.includes('sendProduct') ? ( | |
3405 | - <Button | |
3406 | - className="p-0" | |
3407 | - type="link" | |
3408 | - onClick={() => { | |
3409 | - if (!subOrderSelectedMap.get(record.id)?.length) { | |
3410 | - return message.error('请选择选择子订单'); | |
3411 | - } | |
3412 | - createOptObject(null, record.id); | |
3413 | - setDeliverVisible(true); | |
3414 | - setIsSendProduct(true); | |
3415 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3416 | - }} | |
3417 | - > | |
3418 | - 仓库发货 | |
3419 | - </Button> | |
3420 | - ) : ( | |
3421 | - '' | |
3422 | - )} | |
3423 | 3455 | |
3424 | - {/* 供应商发货 */} | |
3425 | - {record.paths?.includes('supplierSendOrder') ? ( | |
3426 | - <Button | |
3427 | - className="p-0" | |
3428 | - type="link" | |
3429 | - onClick={() => { | |
3430 | - if (!subOrderSelectedMap.get(record.id)?.length) { | |
3431 | - return message.error('请选择选择子订单'); | |
3432 | - } | |
3433 | - createOptObject(null, record.id); | |
3434 | - setDeliverVisible(true); | |
3435 | - setIsSendProduct(true); | |
3436 | - setOrderCheckType(CHECK_TYPE.SUPPLIER); | |
3437 | - }} | |
3438 | - > | |
3439 | - 供应商发货 | |
3440 | - </Button> | |
3441 | - ) : ( | |
3442 | - '' | |
3443 | - )} | |
3456 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3457 | + if ( | |
3458 | + !selectedSubOrders[i].paths.includes( | |
3459 | + 'procureConvertProcure', | |
3460 | + ) | |
3461 | + ) { | |
3462 | + message.error('请选择允许转发的子订单进行转发'); | |
3463 | + return; | |
3464 | + } | |
3465 | + } | |
3466 | + createOptObject(null, record.id); | |
3467 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
3468 | + setProcureConvertModalVisible(true); | |
3469 | + }} | |
3470 | + > | |
3471 | + 转发 | |
3472 | + </Button> | |
3473 | + ) : ( | |
3474 | + '' | |
3475 | + )} | |
3476 | + {record.paths?.includes('sendProduct') ? ( | |
3477 | + <Button | |
3478 | + className="p-0" | |
3479 | + type="link" | |
3480 | + onClick={() => { | |
3481 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3482 | + return message.error('请选择选择子订单'); | |
3483 | + } | |
3484 | + createOptObject(null, record.id); | |
3485 | + setDeliverVisible(true); | |
3486 | + setIsSendProduct(true); | |
3487 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3488 | + }} | |
3489 | + > | |
3490 | + 仓库发货 | |
3491 | + </Button> | |
3492 | + ) : ( | |
3493 | + '' | |
3494 | + )} | |
3444 | 3495 | |
3445 | - {record.paths?.includes('procureSend') ? ( | |
3446 | - <Button | |
3447 | - className="p-0" | |
3448 | - type="link" | |
3449 | - onClick={() => { | |
3450 | - if (!subOrderSelectedMap.get(record.id)?.length) { | |
3451 | - return message.error('请选择选择子订单'); | |
3452 | - } | |
3453 | - createOptObject(null, record.id); | |
3454 | - setDeliverVisible(true); | |
3455 | - setIsSendProduct(true); | |
3456 | - setOrderCheckType(CHECK_TYPE.PROCURE); | |
3457 | - }} | |
3458 | - > | |
3459 | - {isSupplier() ? '发货' : '采购发货'} | |
3460 | - </Button> | |
3461 | - ) : ( | |
3462 | - '' | |
3463 | - )} | |
3496 | + {/* 供应商发货 */} | |
3497 | + {record.paths?.includes('supplierSendOrder') ? ( | |
3498 | + <Button | |
3499 | + className="p-0" | |
3500 | + type="link" | |
3501 | + onClick={() => { | |
3502 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3503 | + return message.error('请选择选择子订单'); | |
3504 | + } | |
3505 | + createOptObject(null, record.id); | |
3506 | + setDeliverVisible(true); | |
3507 | + setIsSendProduct(true); | |
3508 | + setOrderCheckType(CHECK_TYPE.SUPPLIER); | |
3509 | + }} | |
3510 | + > | |
3511 | + 供应商发货 | |
3512 | + </Button> | |
3513 | + ) : ( | |
3514 | + '' | |
3515 | + )} | |
3464 | 3516 | |
3465 | - {record.paths?.includes('printOrder') ? ( | |
3466 | - <Button | |
3467 | - className="p-0" | |
3468 | - type="link" | |
3469 | - onClick={() => { | |
3470 | - const selectedSubOrders = subOrderSelectedMap.get( | |
3471 | - record.id, | |
3472 | - ); | |
3473 | - if (!selectedSubOrders?.length) { | |
3474 | - return message.error('请选择选择子订单'); | |
3475 | - } | |
3517 | + {record.paths?.includes('procureSend') ? ( | |
3518 | + <Button | |
3519 | + className="p-0" | |
3520 | + type="link" | |
3521 | + onClick={() => { | |
3522 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3523 | + return message.error('请选择选择子订单'); | |
3524 | + } | |
3525 | + createOptObject(null, record.id); | |
3526 | + setDeliverVisible(true); | |
3527 | + setIsSendProduct(true); | |
3528 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
3529 | + }} | |
3530 | + > | |
3531 | + {isSupplier() ? '发货' : '采购发货'} | |
3532 | + </Button> | |
3533 | + ) : ( | |
3534 | + '' | |
3535 | + )} | |
3476 | 3536 | |
3477 | - for (let subOrderRecord of selectedSubOrders) { | |
3478 | - let paths = subOrderRecord.paths; | |
3479 | - if (!checkePrintable(paths)) { | |
3480 | - return message.error('请选择可以打印的子订单'); | |
3537 | + {record.paths?.includes('printOrder') ? ( | |
3538 | + <Button | |
3539 | + className="p-0" | |
3540 | + type="link" | |
3541 | + onClick={() => { | |
3542 | + const selectedSubOrders = subOrderSelectedMap.get( | |
3543 | + record.id, | |
3544 | + ); | |
3545 | + if (!selectedSubOrders?.length) { | |
3546 | + return message.error('请选择选择子订单'); | |
3481 | 3547 | } |
3482 | - } | |
3483 | - createOptObject(null, record.id); | |
3484 | - setOrderPrintVisible(true); | |
3485 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3486 | - }} | |
3487 | - > | |
3488 | - 仓库打印 | |
3489 | - </Button> | |
3490 | - ) : ( | |
3491 | - '' | |
3492 | - )} | |
3493 | 3548 | |
3494 | - {record.paths?.includes('supplierPrint') ? ( | |
3495 | - <Button | |
3496 | - className="p-0" | |
3497 | - type="link" | |
3498 | - onClick={() => { | |
3499 | - if (!subOrderSelectedMap.get(record.id)?.length) { | |
3500 | - return message.error('请选择选择子订单'); | |
3501 | - } | |
3549 | + for (let subOrderRecord of selectedSubOrders) { | |
3550 | + let paths = subOrderRecord.paths; | |
3551 | + if (!checkePrintable(paths)) { | |
3552 | + return message.error('请选择可以打印的子订单'); | |
3553 | + } | |
3554 | + } | |
3555 | + createOptObject(null, record.id); | |
3556 | + setOrderPrintVisible(true); | |
3557 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3558 | + }} | |
3559 | + > | |
3560 | + 仓库打印 | |
3561 | + </Button> | |
3562 | + ) : ( | |
3563 | + '' | |
3564 | + )} | |
3502 | 3565 | |
3503 | - createOptObject(null, record.id); | |
3504 | - setOrderPrintVisible(true); | |
3505 | - setOrderCheckType(CHECK_TYPE.SUPPLIER); | |
3506 | - }} | |
3507 | - > | |
3508 | - 供应商打印 | |
3509 | - </Button> | |
3510 | - ) : ( | |
3511 | - '' | |
3512 | - )} | |
3566 | + {record.paths?.includes('supplierPrint') ? ( | |
3567 | + <Button | |
3568 | + className="p-0" | |
3569 | + type="link" | |
3570 | + onClick={() => { | |
3571 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3572 | + return message.error('请选择选择子订单'); | |
3573 | + } | |
3513 | 3574 | |
3514 | - {record.paths?.includes('rePrintOrder') ? ( | |
3515 | - <Button | |
3516 | - className="p-0" | |
3517 | - type="link" | |
3518 | - onClick={() => { | |
3519 | - if (!subOrderSelectedMap.get(record.id)?.length) { | |
3520 | - return message.error('请选择选择子订单'); | |
3521 | - } | |
3522 | - createOptObject(null, record.id); | |
3523 | - setOrderPrintVisible(true); | |
3524 | - setIsRePrintOrder(true); | |
3525 | - }} | |
3526 | - > | |
3527 | - 重新打印 | |
3528 | - </Button> | |
3529 | - ) : ( | |
3530 | - '' | |
3531 | - )} | |
3532 | - {record.paths?.includes('confirmReceipt') ? ( | |
3533 | - <Button | |
3534 | - className="p-0" | |
3535 | - type="link" | |
3536 | - onClick={() => { | |
3537 | - createOptObject(null, record.id); | |
3538 | - setConfirmReceiptVisible(true); | |
3539 | - }} | |
3540 | - > | |
3541 | - 确认收货 | |
3542 | - </Button> | |
3543 | - ) : ( | |
3544 | - '' | |
3545 | - )} | |
3546 | - {record.paths?.includes('modifySendInformation') ? ( | |
3547 | - <Button | |
3548 | - className="p-0" | |
3549 | - type="link" | |
3550 | - onClick={() => { | |
3551 | - if (!subOrderSelectedMap.get(record.id)?.length) { | |
3552 | - return message.error( | |
3553 | - '请选择已经发货或者已经确认收货的子订单', | |
3554 | - ); | |
3555 | - } | |
3556 | - for (let row of subOrderSelectedMap.get(record.id)) { | |
3557 | - if ( | |
3558 | - row.orderStatus !== 'CONFIRM_RECEIPT' && | |
3559 | - row.orderStatus !== 'SHIPPED' | |
3560 | - ) { | |
3575 | + createOptObject(null, record.id); | |
3576 | + setOrderPrintVisible(true); | |
3577 | + setOrderCheckType(CHECK_TYPE.SUPPLIER); | |
3578 | + }} | |
3579 | + > | |
3580 | + 供应商打印 | |
3581 | + </Button> | |
3582 | + ) : ( | |
3583 | + '' | |
3584 | + )} | |
3585 | + | |
3586 | + {record.paths?.includes('rePrintOrder') ? ( | |
3587 | + <Button | |
3588 | + className="p-0" | |
3589 | + type="link" | |
3590 | + onClick={() => { | |
3591 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3592 | + return message.error('请选择选择子订单'); | |
3593 | + } | |
3594 | + createOptObject(null, record.id); | |
3595 | + setOrderPrintVisible(true); | |
3596 | + setIsRePrintOrder(true); | |
3597 | + }} | |
3598 | + > | |
3599 | + 重新打印 | |
3600 | + </Button> | |
3601 | + ) : ( | |
3602 | + '' | |
3603 | + )} | |
3604 | + {record.paths?.includes('confirmReceipt') ? ( | |
3605 | + <Button | |
3606 | + className="p-0" | |
3607 | + type="link" | |
3608 | + onClick={() => { | |
3609 | + createOptObject(null, record.id); | |
3610 | + setConfirmReceiptVisible(true); | |
3611 | + }} | |
3612 | + > | |
3613 | + 确认收货 | |
3614 | + </Button> | |
3615 | + ) : ( | |
3616 | + '' | |
3617 | + )} | |
3618 | + {record.paths?.includes('modifySendInformation') ? ( | |
3619 | + <Button | |
3620 | + className="p-0" | |
3621 | + type="link" | |
3622 | + onClick={() => { | |
3623 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3561 | 3624 | return message.error( |
3562 | 3625 | '请选择已经发货或者已经确认收货的子订单', |
3563 | 3626 | ); |
3564 | 3627 | } |
3565 | - } | |
3566 | - createOptObject(null, record.id); | |
3567 | - setDeliverVisible(true); | |
3568 | - setIsSendProduct(false); | |
3569 | - }} | |
3570 | - > | |
3571 | - 修改发货信息 | |
3572 | - </Button> | |
3573 | - ) : ( | |
3574 | - '' | |
3575 | - )} | |
3576 | - {record.paths?.includes('invoicing') ? ( | |
3577 | - <Button | |
3578 | - type="link" | |
3579 | - className="p-0" | |
3580 | - onClick={() => { | |
3581 | - createOptObject(null, record.id); | |
3582 | - setFinancialVisible(true); | |
3583 | - setIsEdit(false); | |
3584 | - }} | |
3585 | - > | |
3586 | - 开票 | |
3587 | - </Button> | |
3588 | - ) : ( | |
3589 | - '' | |
3590 | - )} | |
3628 | + for (let row of subOrderSelectedMap.get(record.id)) { | |
3629 | + if ( | |
3630 | + row.orderStatus !== 'CONFIRM_RECEIPT' && | |
3631 | + row.orderStatus !== 'SHIPPED' | |
3632 | + ) { | |
3633 | + return message.error( | |
3634 | + '请选择已经发货或者已经确认收货的子订单', | |
3635 | + ); | |
3636 | + } | |
3637 | + } | |
3638 | + createOptObject(null, record.id); | |
3639 | + setDeliverVisible(true); | |
3640 | + setIsSendProduct(false); | |
3641 | + }} | |
3642 | + > | |
3643 | + 修改发货信息 | |
3644 | + </Button> | |
3645 | + ) : ( | |
3646 | + '' | |
3647 | + )} | |
3648 | + {record.paths?.includes('invoicing') ? ( | |
3649 | + <Button | |
3650 | + type="link" | |
3651 | + className="p-0" | |
3652 | + onClick={() => { | |
3653 | + createOptObject(null, record.id); | |
3654 | + setFinancialVisible(true); | |
3655 | + setIsEdit(false); | |
3656 | + }} | |
3657 | + > | |
3658 | + 开票 | |
3659 | + </Button> | |
3660 | + ) : ( | |
3661 | + '' | |
3662 | + )} | |
3591 | 3663 | |
3592 | - {record.paths?.includes('applyInvoicing_old') ? ( | |
3593 | - <Button | |
3594 | - type="link" | |
3595 | - className="p-0" | |
3596 | - onClick={() => { | |
3597 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3598 | - record.id, | |
3599 | - ); | |
3600 | - if (selectedSubOrders === undefined) { | |
3601 | - selectedSubOrders = record.subOrderInformationLists; | |
3602 | - } | |
3603 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3604 | - if ( | |
3605 | - selectedSubOrders[i].invoicingStatus === | |
3606 | - 'UN_INVOICE' || | |
3607 | - selectedSubOrders[i].afterInvoicingStatus === | |
3608 | - 'APPLY_FOR_INVOICING' | |
3609 | - ) { | |
3610 | - message.error( | |
3611 | - '请选择需要开票且未申请开票的子订单进行申请', | |
3612 | - ); | |
3613 | - return; | |
3664 | + {record.paths?.includes('applyInvoicing_old') ? ( | |
3665 | + <Button | |
3666 | + type="link" | |
3667 | + className="p-0" | |
3668 | + onClick={() => { | |
3669 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3670 | + record.id, | |
3671 | + ); | |
3672 | + if (selectedSubOrders === undefined) { | |
3673 | + selectedSubOrders = record.subOrderInformationLists; | |
3674 | + } | |
3675 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3676 | + if ( | |
3677 | + selectedSubOrders[i].invoicingStatus === | |
3678 | + 'UN_INVOICE' || | |
3679 | + selectedSubOrders[i].afterInvoicingStatus === | |
3680 | + 'APPLY_FOR_INVOICING' | |
3681 | + ) { | |
3682 | + message.error( | |
3683 | + '请选择需要开票且未申请开票的子订单进行申请', | |
3684 | + ); | |
3685 | + return; | |
3686 | + } | |
3614 | 3687 | } |
3615 | - } | |
3616 | 3688 | |
3617 | - createOptObject(null, record.id); | |
3618 | - setApplyForInvoicingVisible(true); | |
3619 | - setIsEdit(false); | |
3620 | - setIsMainOrder(false); | |
3621 | - }} | |
3622 | - > | |
3623 | - 申请开票(旧) | |
3624 | - </Button> | |
3625 | - ) : ( | |
3626 | - '' | |
3627 | - )} | |
3689 | + createOptObject(null, record.id); | |
3690 | + setApplyForInvoicingVisible(true); | |
3691 | + setIsEdit(false); | |
3692 | + setIsMainOrder(false); | |
3693 | + }} | |
3694 | + > | |
3695 | + 申请开票(旧) | |
3696 | + </Button> | |
3697 | + ) : ( | |
3698 | + '' | |
3699 | + )} | |
3628 | 3700 | |
3629 | - {record.paths?.includes('applyInvoicing') ? ( | |
3630 | - <Button | |
3631 | - type="link" | |
3632 | - className="p-0" | |
3633 | - onClick={() => { | |
3634 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3635 | - record.id, | |
3636 | - ); | |
3637 | - if (selectedSubOrders === undefined) { | |
3638 | - selectedSubOrders = record.subOrderInformationLists; | |
3639 | - } | |
3640 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3641 | - if ( | |
3642 | - selectedSubOrders[i].invoicingStatus === | |
3643 | - 'UN_INVOICE' || | |
3644 | - selectedSubOrders[i].afterInvoicingStatus === | |
3645 | - 'APPLY_FOR_INVOICING' | |
3646 | - ) { | |
3647 | - message.error( | |
3648 | - '请选择需要开票且未申请开票的子订单进行申请', | |
3649 | - ); | |
3650 | - return; | |
3701 | + {record.paths?.includes('applyInvoicing') ? ( | |
3702 | + <Button | |
3703 | + type="link" | |
3704 | + className="p-0" | |
3705 | + onClick={() => { | |
3706 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3707 | + record.id, | |
3708 | + ); | |
3709 | + if (selectedSubOrders === undefined) { | |
3710 | + selectedSubOrders = record.subOrderInformationLists; | |
3711 | + } | |
3712 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3713 | + if ( | |
3714 | + selectedSubOrders[i].invoicingStatus === | |
3715 | + 'UN_INVOICE' || | |
3716 | + selectedSubOrders[i].afterInvoicingStatus === | |
3717 | + 'APPLY_FOR_INVOICING' | |
3718 | + ) { | |
3719 | + message.error( | |
3720 | + '请选择需要开票且未申请开票的子订单进行申请', | |
3721 | + ); | |
3722 | + return; | |
3723 | + } | |
3651 | 3724 | } |
3652 | - } | |
3653 | 3725 | |
3654 | - createOptObject(null, record.id); | |
3655 | - setInvoicingDrawerFormVisible(true); | |
3656 | - setIsEdit(false); | |
3657 | - setIsMainOrder(false); | |
3658 | - }} | |
3659 | - > | |
3660 | - 申请开票(新) | |
3661 | - </Button> | |
3662 | - ) : ( | |
3663 | - '' | |
3664 | - )} | |
3726 | + createOptObject(null, record.id); | |
3727 | + setInvoicingDrawerFormVisible(true); | |
3728 | + setIsEdit(false); | |
3729 | + setIsMainOrder(false); | |
3730 | + }} | |
3731 | + > | |
3732 | + 申请开票(新) | |
3733 | + </Button> | |
3734 | + ) : ( | |
3735 | + '' | |
3736 | + )} | |
3665 | 3737 | |
3666 | - {record.paths?.includes('updateOrder') ? ( | |
3667 | - <Button | |
3668 | - className="p-0" | |
3669 | - type="link" | |
3670 | - onClick={() => { | |
3671 | - //勾选的子订单:如果有勾选,后面只校验有勾选的 | |
3738 | + {record.paths?.includes('updateOrder') ? ( | |
3739 | + <Button | |
3740 | + className="p-0" | |
3741 | + type="link" | |
3742 | + onClick={() => { | |
3743 | + //勾选的子订单:如果有勾选,后面只校验有勾选的 | |
3672 | 3744 | |
3673 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3674 | - record.id, | |
3675 | - ); | |
3676 | - if ( | |
3677 | - selectedSubOrders === undefined || | |
3678 | - selectedSubOrders.length === 0 | |
3679 | - ) { | |
3680 | - selectedSubOrders = record.subOrderInformationLists; | |
3681 | - } | |
3682 | - for ( | |
3683 | - let index = 0; | |
3684 | - index < selectedSubOrders.length; | |
3685 | - index++ | |
3686 | - ) { | |
3687 | - let orderStatus = | |
3688 | - selectedSubOrders[index].orderStatus; | |
3689 | - //仓库管理员在审核之后的任何时候都可以编辑 | |
3745 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3746 | + record.id, | |
3747 | + ); | |
3690 | 3748 | if ( |
3691 | - roleCode !== 'warehouseKeeper' && | |
3692 | - roleCode !== 'admin' | |
3749 | + selectedSubOrders === undefined || | |
3750 | + selectedSubOrders.length === 0 | |
3751 | + ) { | |
3752 | + selectedSubOrders = record.subOrderInformationLists; | |
3753 | + } | |
3754 | + for ( | |
3755 | + let index = 0; | |
3756 | + index < selectedSubOrders.length; | |
3757 | + index++ | |
3693 | 3758 | ) { |
3694 | - //是审核通过及之后的订单 | |
3759 | + let orderStatus = | |
3760 | + selectedSubOrders[index].orderStatus; | |
3761 | + //仓库管理员在审核之后的任何时候都可以编辑 | |
3762 | + if ( | |
3763 | + roleCode !== 'warehouseKeeper' && | |
3764 | + roleCode !== 'admin' | |
3765 | + ) { | |
3766 | + //是审核通过及之后的订单 | |
3767 | + if ( | |
3768 | + orderStatus !== 'UNAUDITED' && | |
3769 | + orderStatus !== 'PROCURE_REJECT' && | |
3770 | + orderStatus !== 'AUDIT_FAILED' && | |
3771 | + orderStatus !== 'LEADER_PROCESS' && | |
3772 | + orderStatus !== 'SALES_CONFIRM' && | |
3773 | + orderStatus !== 'CREDIT_CONFIRM' | |
3774 | + ) { | |
3775 | + message.error( | |
3776 | + '请选择【未审核、审核失败、销售待确认、赊账待审核】的订单进行编辑', | |
3777 | + ); | |
3778 | + return; | |
3779 | + } | |
3780 | + } else { | |
3781 | + //仓库管理员只能编辑是还未审核的订单 | |
3782 | + if ( | |
3783 | + roleCode !== 'admin' && | |
3784 | + (orderStatus === 'UNAUDITED' || | |
3785 | + orderStatus === 'PROCURE_REJECT' || | |
3786 | + orderStatus === 'AUDIT_FAILED') | |
3787 | + ) { | |
3788 | + message.error('请选择已审核的订单进行编辑'); | |
3789 | + return; | |
3790 | + } | |
3791 | + } | |
3792 | + } | |
3793 | + | |
3794 | + createOptObject(null, record.id); | |
3795 | + setOrderDrawerVisible(true); | |
3796 | + setOrderOptType('edit'); | |
3797 | + }} | |
3798 | + > | |
3799 | + 编辑 | |
3800 | + </Button> | |
3801 | + ) : ( | |
3802 | + '' | |
3803 | + )} | |
3804 | + | |
3805 | + {record?.subOrderInformationLists[0].paths?.includes( | |
3806 | + 'noNeedInvoicingEdit', | |
3807 | + ) ? ( | |
3808 | + <Button | |
3809 | + className="p-0" | |
3810 | + type="link" | |
3811 | + onClick={() => { | |
3812 | + createOptObject(null, record.id); | |
3813 | + setFinancialEditVisible(true); | |
3814 | + setIsMainOrder(true); | |
3815 | + }} | |
3816 | + > | |
3817 | + 财务编辑 | |
3818 | + </Button> | |
3819 | + ) : ( | |
3820 | + '' | |
3821 | + )} | |
3822 | + | |
3823 | + {record.paths?.includes('checkOrder') ? ( | |
3824 | + <Button | |
3825 | + className="p-0" | |
3826 | + type="link" | |
3827 | + onClick={() => { | |
3828 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3829 | + record.id, | |
3830 | + ); | |
3831 | + setSelectedRows(selectedSubOrders); | |
3832 | + if (selectedSubOrders === undefined) { | |
3833 | + selectedSubOrders = record.subOrderInformationLists; | |
3834 | + } | |
3835 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3836 | + let orderStatus = selectedSubOrders[i].orderStatus; | |
3695 | 3837 | if ( |
3696 | 3838 | orderStatus !== 'UNAUDITED' && |
3697 | 3839 | orderStatus !== 'PROCURE_REJECT' && |
3698 | - orderStatus !== 'AUDIT_FAILED' && | |
3699 | - orderStatus !== 'LEADER_PROCESS' && | |
3700 | - orderStatus !== 'SALES_CONFIRM' && | |
3701 | - orderStatus !== 'CREDIT_CONFIRM' | |
3840 | + orderStatus !== 'FINANCE_PROCESS' && | |
3841 | + orderStatus !== 'LEADER_AUDITED' | |
3702 | 3842 | ) { |
3703 | 3843 | message.error( |
3704 | - '请选择【未审核、审核失败、销售待确认、赊账待审核】的订单进行编辑', | |
3844 | + '请选择未审核或者领导已审核的子订单进行审核', | |
3705 | 3845 | ); |
3706 | 3846 | return; |
3707 | 3847 | } |
3708 | - } else { | |
3709 | - //仓库管理员只能编辑是还未审核的订单 | |
3848 | + } | |
3849 | + | |
3850 | + createOptObject(null, record.id); | |
3851 | + setCheckVisible(true); | |
3852 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3853 | + }} | |
3854 | + > | |
3855 | + 审核 | |
3856 | + </Button> | |
3857 | + ) : ( | |
3858 | + '' | |
3859 | + )} | |
3860 | + | |
3861 | + {record.paths?.includes('afterSalesCheck') ? ( | |
3862 | + <Button | |
3863 | + className="p-0" | |
3864 | + type="link" | |
3865 | + onClick={() => { | |
3866 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3867 | + record.id, | |
3868 | + ); | |
3869 | + setSelectedRows(selectedSubOrders); | |
3870 | + if (selectedSubOrders === undefined) { | |
3871 | + selectedSubOrders = record.subOrderInformationLists; | |
3872 | + } | |
3873 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3710 | 3874 | if ( |
3711 | - roleCode !== 'admin' && | |
3712 | - (orderStatus === 'UNAUDITED' || | |
3713 | - orderStatus === 'PROCURE_REJECT' || | |
3714 | - orderStatus === 'AUDIT_FAILED') | |
3875 | + selectedSubOrders[i].orderStatus !== | |
3876 | + 'IN_AFTER_SALES' | |
3715 | 3877 | ) { |
3716 | - message.error('请选择已审核的订单进行编辑'); | |
3878 | + message.error('请选择售后中的子订单进行审核'); | |
3717 | 3879 | return; |
3718 | 3880 | } |
3719 | 3881 | } |
3720 | - } | |
3721 | - | |
3722 | - createOptObject(null, record.id); | |
3723 | - setOrderDrawerVisible(true); | |
3724 | - setOrderOptType('edit'); | |
3725 | - }} | |
3726 | - > | |
3727 | - 编辑 | |
3728 | - </Button> | |
3729 | - ) : ( | |
3730 | - '' | |
3731 | - )} | |
3732 | - | |
3733 | - {record?.subOrderInformationLists[0].paths?.includes( | |
3734 | - 'noNeedInvoicingEdit', | |
3735 | - ) ? ( | |
3736 | - <Button | |
3737 | - className="p-0" | |
3738 | - type="link" | |
3739 | - onClick={() => { | |
3740 | - createOptObject(null, record.id); | |
3741 | - setFinancialEditVisible(true); | |
3742 | - setIsMainOrder(true); | |
3743 | - }} | |
3744 | - > | |
3745 | - 财务编辑 | |
3746 | - </Button> | |
3747 | - ) : ( | |
3748 | - '' | |
3749 | - )} | |
3750 | 3882 | |
3751 | - {record.paths?.includes('checkOrder') ? ( | |
3752 | - <Button | |
3753 | - className="p-0" | |
3754 | - type="link" | |
3755 | - onClick={() => { | |
3756 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3757 | - record.id, | |
3758 | - ); | |
3759 | - setSelectedRows(selectedSubOrders); | |
3760 | - if (selectedSubOrders === undefined) { | |
3761 | - selectedSubOrders = record.subOrderInformationLists; | |
3762 | - } | |
3763 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3764 | - let orderStatus = selectedSubOrders[i].orderStatus; | |
3765 | - if ( | |
3766 | - orderStatus !== 'UNAUDITED' && | |
3767 | - orderStatus !== 'PROCURE_REJECT' && | |
3768 | - orderStatus !== 'FINANCE_PROCESS' && | |
3769 | - orderStatus !== 'LEADER_AUDITED' | |
3770 | - ) { | |
3771 | - message.error( | |
3772 | - '请选择未审核或者领导已审核的子订单进行审核', | |
3773 | - ); | |
3774 | - return; | |
3775 | - } | |
3776 | - } | |
3883 | + createOptObject(null, record.id); | |
3884 | + setCheckVisible(true); | |
3885 | + setOrderCheckType(CHECK_TYPE.AFTER_SALES); | |
3886 | + }} | |
3887 | + > | |
3888 | + 售后审核 | |
3889 | + </Button> | |
3890 | + ) : ( | |
3891 | + '' | |
3892 | + )} | |
3777 | 3893 | |
3778 | - createOptObject(null, record.id); | |
3779 | - setCheckVisible(true); | |
3780 | - setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3781 | - }} | |
3782 | - > | |
3783 | - 审核 | |
3784 | - </Button> | |
3785 | - ) : ( | |
3786 | - '' | |
3787 | - )} | |
3894 | + {record.paths?.includes('afterSalesConfirm') ? ( | |
3895 | + <Button | |
3896 | + className="p-0" | |
3897 | + type="link" | |
3898 | + onClick={() => { | |
3899 | + setCurrentMainId(record.id); | |
3900 | + createOptObject(null, record.id); | |
3901 | + setStoreCheckModalVisible(true); | |
3902 | + setOrderCheckType(CHECK_TYPE.AFTER_SALES); | |
3903 | + }} | |
3904 | + > | |
3905 | + 仓库确认 | |
3906 | + </Button> | |
3907 | + ) : ( | |
3908 | + '' | |
3909 | + )} | |
3788 | 3910 | |
3789 | - {record.paths?.includes('afterSalesCheck') ? ( | |
3790 | - <Button | |
3791 | - className="p-0" | |
3792 | - type="link" | |
3793 | - onClick={() => { | |
3794 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3795 | - record.id, | |
3796 | - ); | |
3797 | - setSelectedRows(selectedSubOrders); | |
3798 | - if (selectedSubOrders === undefined) { | |
3799 | - selectedSubOrders = record.subOrderInformationLists; | |
3800 | - } | |
3801 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3802 | - if ( | |
3803 | - selectedSubOrders[i].orderStatus !== | |
3804 | - 'IN_AFTER_SALES' | |
3805 | - ) { | |
3806 | - message.error('请选择售后中的子订单进行审核'); | |
3807 | - return; | |
3911 | + {record.paths?.includes('noNeedSend') ? ( | |
3912 | + <ButtonConfirm | |
3913 | + className="p-0" | |
3914 | + title="此订单是否无需发货?" | |
3915 | + text="无需发货" | |
3916 | + onConfirm={async () => { | |
3917 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3918 | + record.id, | |
3919 | + ); | |
3920 | + if (selectedSubOrders === undefined) { | |
3921 | + selectedSubOrders = record.subOrderInformationLists; | |
3808 | 3922 | } |
3809 | - } | |
3810 | - | |
3811 | - createOptObject(null, record.id); | |
3812 | - setCheckVisible(true); | |
3813 | - setOrderCheckType(CHECK_TYPE.AFTER_SALES); | |
3814 | - }} | |
3815 | - > | |
3816 | - 售后审核 | |
3817 | - </Button> | |
3818 | - ) : ( | |
3819 | - '' | |
3820 | - )} | |
3821 | - | |
3822 | - {record.paths?.includes('afterSalesConfirm') ? ( | |
3823 | - <Button | |
3824 | - className="p-0" | |
3825 | - type="link" | |
3826 | - onClick={() => { | |
3827 | - setCurrentMainId(record.id); | |
3828 | - createOptObject(null, record.id); | |
3829 | - setStoreCheckModalVisible(true); | |
3830 | - setOrderCheckType(CHECK_TYPE.AFTER_SALES); | |
3831 | - }} | |
3832 | - > | |
3833 | - 仓库确认 | |
3834 | - </Button> | |
3835 | - ) : ( | |
3836 | - '' | |
3837 | - )} | |
3838 | - | |
3839 | - {record.paths?.includes('noNeedSend') ? ( | |
3840 | - <ButtonConfirm | |
3841 | - className="p-0" | |
3842 | - title="此订单是否无需发货?" | |
3843 | - text="无需发货" | |
3844 | - onConfirm={async () => { | |
3845 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3846 | - record.id, | |
3847 | - ); | |
3848 | - if (selectedSubOrders === undefined) { | |
3849 | - selectedSubOrders = record.subOrderInformationLists; | |
3850 | - } | |
3851 | - setSelectedRows(selectedSubOrders); | |
3852 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3853 | - if ( | |
3854 | - selectedSubOrders[i].orderStatus !== 'AUDITED' && | |
3855 | - selectedSubOrders[i].orderStatus !== | |
3856 | - 'PROCURE_PROCESS' && | |
3857 | - selectedSubOrders[i].orderStatus !== | |
3858 | - 'PROCURE_PROCESS_FOR_MINE' && | |
3859 | - selectedSubOrders[i].orderStatus !== | |
3860 | - 'PROCURE_WAIT_SHIP' && | |
3861 | - selectedSubOrders[i].orderStatus !== | |
3862 | - 'SUPPLIER_WAIT_SHIP' && | |
3863 | - selectedSubOrders[i].orderStatus !== 'WAIT_SHIP' | |
3864 | - ) { | |
3865 | - message.error( | |
3866 | - '请选择未发货的子订单进行无需发货操作', | |
3867 | - ); | |
3868 | - return; | |
3923 | + setSelectedRows(selectedSubOrders); | |
3924 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3925 | + if ( | |
3926 | + selectedSubOrders[i].orderStatus !== 'AUDITED' && | |
3927 | + selectedSubOrders[i].orderStatus !== | |
3928 | + 'PROCURE_PROCESS' && | |
3929 | + selectedSubOrders[i].orderStatus !== | |
3930 | + 'PROCURE_PROCESS_FOR_MINE' && | |
3931 | + selectedSubOrders[i].orderStatus !== | |
3932 | + 'PROCURE_WAIT_SHIP' && | |
3933 | + selectedSubOrders[i].orderStatus !== | |
3934 | + 'SUPPLIER_WAIT_SHIP' && | |
3935 | + selectedSubOrders[i].orderStatus !== 'WAIT_SHIP' | |
3936 | + ) { | |
3937 | + message.error( | |
3938 | + '请选择未发货的子订单进行无需发货操作', | |
3939 | + ); | |
3940 | + return; | |
3941 | + } | |
3869 | 3942 | } |
3870 | - } | |
3871 | 3943 | |
3872 | - const data = await postServiceOrderNoNeedSend({ | |
3873 | - data: { | |
3874 | - ids: selectedSubOrders.map((item) => { | |
3875 | - return item.id; | |
3876 | - }), | |
3877 | - }, | |
3878 | - }); | |
3879 | - if (data.result === RESPONSE_CODE.SUCCESS) { | |
3880 | - message.success(data.message); | |
3881 | - refreshTable(); | |
3882 | - } | |
3883 | - }} | |
3884 | - /> | |
3885 | - ) : ( | |
3886 | - '' | |
3887 | - )} | |
3944 | + const data = await postServiceOrderNoNeedSend({ | |
3945 | + data: { | |
3946 | + ids: selectedSubOrders.map((item) => { | |
3947 | + return item.id; | |
3948 | + }), | |
3949 | + }, | |
3950 | + }); | |
3951 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
3952 | + message.success(data.message); | |
3953 | + refreshTable(); | |
3954 | + } | |
3955 | + }} | |
3956 | + /> | |
3957 | + ) : ( | |
3958 | + '' | |
3959 | + )} | |
3888 | 3960 | |
3889 | - {record.paths?.includes('saleCancelInvoicing_old') ? ( | |
3890 | - <ButtonConfirm | |
3891 | - className="p-0" | |
3892 | - title="确认取消申请开票?" | |
3893 | - text="取消申请(旧)" | |
3894 | - onConfirm={async () => { | |
3895 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3896 | - record.id, | |
3897 | - ); | |
3898 | - if (selectedSubOrders === undefined) { | |
3899 | - selectedSubOrders = record.subOrderInformationLists; | |
3900 | - } | |
3961 | + {record.paths?.includes('saleCancelInvoicing_old') ? ( | |
3962 | + <ButtonConfirm | |
3963 | + className="p-0" | |
3964 | + title="确认取消申请开票?" | |
3965 | + text="取消申请(旧)" | |
3966 | + onConfirm={async () => { | |
3967 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3968 | + record.id, | |
3969 | + ); | |
3970 | + if (selectedSubOrders === undefined) { | |
3971 | + selectedSubOrders = record.subOrderInformationLists; | |
3972 | + } | |
3901 | 3973 | |
3902 | - console.log(selectedSubOrders); | |
3903 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3904 | - if ( | |
3905 | - selectedSubOrders[i].afterInvoicingStatus !== | |
3906 | - 'APPLY_FOR_INVOICING' | |
3907 | - ) { | |
3908 | - message.error( | |
3909 | - '请选择已[申请开票]的子订单进行取消申请', | |
3910 | - ); | |
3911 | - return; | |
3974 | + console.log(selectedSubOrders); | |
3975 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3976 | + if ( | |
3977 | + selectedSubOrders[i].afterInvoicingStatus !== | |
3978 | + 'APPLY_FOR_INVOICING' | |
3979 | + ) { | |
3980 | + message.error( | |
3981 | + '请选择已[申请开票]的子订单进行取消申请', | |
3982 | + ); | |
3983 | + return; | |
3984 | + } | |
3912 | 3985 | } |
3913 | - } | |
3914 | - let res = await postServiceOrderSaleCancelInvoicing({ | |
3915 | - data: { | |
3916 | - subOrderIds: selectedSubOrders.map((item) => { | |
3917 | - return item.id; | |
3918 | - }), | |
3919 | - }, | |
3920 | - }); | |
3986 | + let res = await postServiceOrderSaleCancelInvoicing({ | |
3987 | + data: { | |
3988 | + subOrderIds: selectedSubOrders.map((item) => { | |
3989 | + return item.id; | |
3990 | + }), | |
3991 | + }, | |
3992 | + }); | |
3921 | 3993 | |
3922 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
3923 | - message.success(res.message); | |
3924 | - refreshTable(); | |
3925 | - } | |
3926 | - }} | |
3927 | - /> | |
3928 | - ) : ( | |
3929 | - '' | |
3930 | - )} | |
3931 | - {/* 财务审核:主订单暂无 */} | |
3932 | - {record.paths?.includes('financeCheckOrder') ? ( | |
3933 | - <Button | |
3934 | - className="p-0" | |
3935 | - type="link" | |
3936 | - onClick={() => { | |
3937 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3938 | - record.id, | |
3939 | - ); | |
3940 | - setSelectedRows(selectedSubOrders); | |
3941 | - if (selectedSubOrders === undefined) { | |
3942 | - selectedSubOrders = record.subOrderInformationLists; | |
3943 | - } | |
3944 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3945 | - if ( | |
3946 | - selectedSubOrders[i].orderStatus !== 'UNAUDITED' && | |
3947 | - selectedSubOrders[i].orderStatus !== | |
3948 | - 'PROCURE_REJECT' && | |
3949 | - selectedSubOrders[i].orderStatus !== | |
3950 | - 'FINANCE_PROCESS' && | |
3951 | - selectedSubOrders[i].orderStatus !== | |
3952 | - 'LEADER_AUDITED' | |
3953 | - ) { | |
3954 | - message.error( | |
3955 | - '请选择[未审核]、[财务待审核]、[领导已审核]的子订单进行审核', | |
3956 | - ); | |
3957 | - return; | |
3994 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
3995 | + message.success(res.message); | |
3996 | + refreshTable(); | |
3958 | 3997 | } |
3959 | - } | |
3960 | - createOptObject(null, record.id); | |
3961 | - setCheckVisible(true); | |
3962 | - setOrderCheckType(CHECK_TYPE.FINALCIAL); | |
3963 | - }} | |
3964 | - > | |
3965 | - 财务审核 | |
3966 | - </Button> | |
3967 | - ) : ( | |
3968 | - '' | |
3969 | - )} | |
3998 | + }} | |
3999 | + /> | |
4000 | + ) : ( | |
4001 | + '' | |
4002 | + )} | |
4003 | + {/* 财务审核:主订单暂无 */} | |
4004 | + {record.paths?.includes('financeCheckOrder') ? ( | |
4005 | + <Button | |
4006 | + className="p-0" | |
4007 | + type="link" | |
4008 | + onClick={() => { | |
4009 | + let selectedSubOrders = subOrderSelectedMap.get( | |
4010 | + record.id, | |
4011 | + ); | |
4012 | + setSelectedRows(selectedSubOrders); | |
4013 | + if (selectedSubOrders === undefined) { | |
4014 | + selectedSubOrders = record.subOrderInformationLists; | |
4015 | + } | |
4016 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
4017 | + if ( | |
4018 | + selectedSubOrders[i].orderStatus !== | |
4019 | + 'UNAUDITED' && | |
4020 | + selectedSubOrders[i].orderStatus !== | |
4021 | + 'PROCURE_REJECT' && | |
4022 | + selectedSubOrders[i].orderStatus !== | |
4023 | + 'FINANCE_PROCESS' && | |
4024 | + selectedSubOrders[i].orderStatus !== | |
4025 | + 'LEADER_AUDITED' | |
4026 | + ) { | |
4027 | + message.error( | |
4028 | + '请选择[未审核]、[财务待审核]、[领导已审核]的子订单进行审核', | |
4029 | + ); | |
4030 | + return; | |
4031 | + } | |
4032 | + } | |
4033 | + createOptObject(null, record.id); | |
4034 | + setCheckVisible(true); | |
4035 | + setOrderCheckType(CHECK_TYPE.FINALCIAL); | |
4036 | + }} | |
4037 | + > | |
4038 | + 财务审核 | |
4039 | + </Button> | |
4040 | + ) : ( | |
4041 | + '' | |
4042 | + )} | |
3970 | 4043 | |
3971 | - {/* 采购审核 */} | |
3972 | - {record.paths?.includes('procureCheckOrder') ? ( | |
3973 | - <Button | |
3974 | - className="p-0" | |
3975 | - type="link" | |
3976 | - onClick={() => { | |
3977 | - let selectedSubOrders = subOrderSelectedMap.get( | |
3978 | - record.id, | |
3979 | - ); | |
3980 | - setSelectedRows(selectedSubOrders); | |
3981 | - if (selectedSubOrders === undefined) { | |
3982 | - selectedSubOrders = record.subOrderInformationLists; | |
3983 | - } | |
3984 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
3985 | - if ( | |
3986 | - selectedSubOrders[i].orderStatus !== | |
3987 | - 'PROCURE_UN_PROCESS' | |
3988 | - ) { | |
3989 | - message.error('请选择未审核的子订单进行审核'); | |
3990 | - return; | |
4044 | + {/* 采购审核 */} | |
4045 | + {record.paths?.includes('procureCheckOrder') ? ( | |
4046 | + <Button | |
4047 | + className="p-0" | |
4048 | + type="link" | |
4049 | + onClick={() => { | |
4050 | + let selectedSubOrders = subOrderSelectedMap.get( | |
4051 | + record.id, | |
4052 | + ); | |
4053 | + setSelectedRows(selectedSubOrders); | |
4054 | + if (selectedSubOrders === undefined) { | |
4055 | + selectedSubOrders = record.subOrderInformationLists; | |
4056 | + } | |
4057 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
4058 | + if ( | |
4059 | + selectedSubOrders[i].orderStatus !== | |
4060 | + 'PROCURE_UN_PROCESS' | |
4061 | + ) { | |
4062 | + message.error('请选择未审核的子订单进行审核'); | |
4063 | + return; | |
4064 | + } | |
3991 | 4065 | } |
3992 | - } | |
3993 | 4066 | |
3994 | - createOptObject(null, record.id); | |
3995 | - setProcureCheckModalVisible(true); | |
3996 | - setOrderCheckType(CHECK_TYPE.PROCURE); | |
3997 | - }} | |
3998 | - > | |
3999 | - 采购审核 | |
4000 | - </Button> | |
4001 | - ) : ( | |
4002 | - '' | |
4003 | - )} | |
4067 | + createOptObject(null, record.id); | |
4068 | + setProcureCheckModalVisible(true); | |
4069 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
4070 | + }} | |
4071 | + > | |
4072 | + 采购审核 | |
4073 | + </Button> | |
4074 | + ) : ( | |
4075 | + '' | |
4076 | + )} | |
4004 | 4077 | |
4005 | - {record.paths?.includes('applyAfterSales') ? ( | |
4006 | - <Button | |
4007 | - className="p-0" | |
4008 | - type="link" | |
4009 | - onClick={() => { | |
4010 | - let selectedSubOrders = subOrderSelectedMap.get( | |
4011 | - record.id, | |
4012 | - ); | |
4013 | - if (selectedSubOrders === undefined) { | |
4014 | - selectedSubOrders = record.subOrderInformationLists; | |
4015 | - } | |
4016 | - setSelectedRows(selectedSubOrders); | |
4017 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
4018 | - if ( | |
4019 | - selectedSubOrders[i].orderStatus !== | |
4020 | - 'CONFIRM_RECEIPT' && | |
4021 | - selectedSubOrders[i].orderStatus !== | |
4022 | - 'AFTER_SALES_FAILURE' && | |
4023 | - selectedSubOrders[i].orderStatus !== | |
4024 | - 'AFTER_SALES_COMPLETION' | |
4025 | - ) { | |
4026 | - message.error('请选择确认收货状态的子订单进行售后'); | |
4027 | - return; | |
4078 | + {record.paths?.includes('applyAfterSales') ? ( | |
4079 | + <Button | |
4080 | + className="p-0" | |
4081 | + type="link" | |
4082 | + onClick={() => { | |
4083 | + let selectedSubOrders = subOrderSelectedMap.get( | |
4084 | + record.id, | |
4085 | + ); | |
4086 | + if (selectedSubOrders === undefined) { | |
4087 | + selectedSubOrders = record.subOrderInformationLists; | |
4088 | + } | |
4089 | + setSelectedRows(selectedSubOrders); | |
4090 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
4091 | + if ( | |
4092 | + selectedSubOrders[i].orderStatus !== | |
4093 | + 'CONFIRM_RECEIPT' && | |
4094 | + selectedSubOrders[i].orderStatus !== | |
4095 | + 'AFTER_SALES_FAILURE' && | |
4096 | + selectedSubOrders[i].orderStatus !== | |
4097 | + 'AFTER_SALES_COMPLETION' | |
4098 | + ) { | |
4099 | + message.error( | |
4100 | + '请选择确认收货状态的子订单进行售后', | |
4101 | + ); | |
4102 | + return; | |
4103 | + } | |
4028 | 4104 | } |
4029 | - } | |
4030 | 4105 | |
4031 | - createOptObject(null, record.id); | |
4032 | - setOrderDrawerVisible(true); | |
4033 | - setOrderOptType('after-sales'); | |
4034 | - }} | |
4035 | - > | |
4036 | - 申请售后 | |
4037 | - </Button> | |
4038 | - ) : ( | |
4039 | - '' | |
4040 | - )} | |
4106 | + createOptObject(null, record.id); | |
4107 | + setOrderDrawerVisible(true); | |
4108 | + setOrderOptType('after-sales'); | |
4109 | + }} | |
4110 | + > | |
4111 | + 申请售后 | |
4112 | + </Button> | |
4113 | + ) : ( | |
4114 | + '' | |
4115 | + )} | |
4041 | 4116 | |
4042 | - {/* {record.paths?.includes('afterSalesCompletion') ? ( | |
4117 | + {/* {record.paths?.includes('afterSalesCompletion') ? ( | |
4043 | 4118 | <ButtonConfirm |
4044 | 4119 | className="p-0" |
4045 | 4120 | title="售后是否已完成?" |
... | ... | @@ -4083,164 +4158,165 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
4083 | 4158 | '' |
4084 | 4159 | )} */} |
4085 | 4160 | |
4086 | - {record.paths?.includes('salOrderSave') ? ( | |
4087 | - <ButtonConfirm | |
4088 | - className="p-0" | |
4089 | - title="是否推送至金蝶ERP?" | |
4090 | - text="推送ERP" | |
4091 | - onConfirm={async () => { | |
4092 | - let res = await postKingdeeRepSalOrderSave({ | |
4093 | - data: { | |
4094 | - id: record.id, | |
4095 | - }, | |
4096 | - }); | |
4161 | + {record.paths?.includes('salOrderSave') ? ( | |
4162 | + <ButtonConfirm | |
4163 | + className="p-0" | |
4164 | + title="是否推送至金蝶ERP?" | |
4165 | + text="推送ERP" | |
4166 | + onConfirm={async () => { | |
4167 | + let res = await postKingdeeRepSalOrderSave({ | |
4168 | + data: { | |
4169 | + id: record.id, | |
4170 | + }, | |
4171 | + }); | |
4097 | 4172 | |
4098 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
4099 | - message.success('推送成功'); | |
4100 | - mainTableRef.current.reload(); | |
4101 | - } | |
4102 | - }} | |
4103 | - /> | |
4104 | - ) : ( | |
4105 | - '' | |
4106 | - )} | |
4173 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
4174 | + message.success('推送成功'); | |
4175 | + mainTableRef.current.reload(); | |
4176 | + } | |
4177 | + }} | |
4178 | + /> | |
4179 | + ) : ( | |
4180 | + '' | |
4181 | + )} | |
4107 | 4182 | |
4108 | - {record.paths?.includes('salBillOutbound') ? ( | |
4109 | - <ButtonConfirm | |
4110 | - className="p-0" | |
4111 | - title="是否下推金蝶ERP出库单?" | |
4112 | - text="下推出库" | |
4113 | - onConfirm={async () => { | |
4114 | - let res = await postKingdeeRepSalBillOutbound({ | |
4115 | - data: { | |
4116 | - id: record.id, | |
4117 | - }, | |
4118 | - }); | |
4183 | + {record.paths?.includes('salBillOutbound') ? ( | |
4184 | + <ButtonConfirm | |
4185 | + className="p-0" | |
4186 | + title="是否下推金蝶ERP出库单?" | |
4187 | + text="下推出库" | |
4188 | + onConfirm={async () => { | |
4189 | + let res = await postKingdeeRepSalBillOutbound({ | |
4190 | + data: { | |
4191 | + id: record.id, | |
4192 | + }, | |
4193 | + }); | |
4119 | 4194 | |
4120 | - if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
4121 | - message.success('下推成功'); | |
4122 | - mainTableRef.current.reload(); | |
4123 | - } | |
4124 | - }} | |
4125 | - /> | |
4126 | - ) : ( | |
4127 | - '' | |
4128 | - )} | |
4195 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
4196 | + message.success('下推成功'); | |
4197 | + mainTableRef.current.reload(); | |
4198 | + } | |
4199 | + }} | |
4200 | + /> | |
4201 | + ) : ( | |
4202 | + '' | |
4203 | + )} | |
4129 | 4204 | |
4130 | - {record.paths?.includes('confirmInvoice') ? ( | |
4131 | - <ButtonConfirm | |
4132 | - className="p-0" | |
4133 | - title="已和客户确认发票?" | |
4134 | - text="确认发票" | |
4135 | - onConfirm={async () => { | |
4136 | - let body = [ | |
4137 | - ...record.subOrderInformationLists.map( | |
4138 | - (subOrder) => subOrder.id, | |
4139 | - ), | |
4140 | - ]; | |
4141 | - const data = await postServiceOrderConfirmInvoice({ | |
4142 | - data: body, | |
4143 | - }); | |
4144 | - if (data.result === RESPONSE_CODE.SUCCESS) { | |
4145 | - message.success(data.message); | |
4146 | - refreshTable(); | |
4147 | - } | |
4148 | - }} | |
4149 | - /> | |
4150 | - ) : ( | |
4151 | - '' | |
4152 | - )} | |
4205 | + {record.paths?.includes('confirmInvoice') ? ( | |
4206 | + <ButtonConfirm | |
4207 | + className="p-0" | |
4208 | + title="已和客户确认发票?" | |
4209 | + text="确认发票" | |
4210 | + onConfirm={async () => { | |
4211 | + let body = [ | |
4212 | + ...record.subOrderInformationLists.map( | |
4213 | + (subOrder) => subOrder.id, | |
4214 | + ), | |
4215 | + ]; | |
4216 | + const data = await postServiceOrderConfirmInvoice({ | |
4217 | + data: body, | |
4218 | + }); | |
4219 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
4220 | + message.success(data.message); | |
4221 | + refreshTable(); | |
4222 | + } | |
4223 | + }} | |
4224 | + /> | |
4225 | + ) : ( | |
4226 | + '' | |
4227 | + )} | |
4153 | 4228 | |
4154 | - {record.paths?.includes('orderCancel') ? ( | |
4155 | - <ButtonConfirm | |
4156 | - className="p-0" | |
4157 | - title="确认作废?" | |
4158 | - text="作废" | |
4159 | - onConfirm={async () => { | |
4160 | - let body = { | |
4161 | - ids: [record.id], | |
4162 | - checkIsMainOrderId: true, | |
4163 | - }; | |
4164 | - const data = await postServiceOrderOrderCancel({ | |
4165 | - data: body, | |
4166 | - }); | |
4167 | - if (data.result === RESPONSE_CODE.SUCCESS) { | |
4168 | - message.success(data.message); | |
4169 | - refreshTable(); | |
4170 | - } | |
4171 | - }} | |
4172 | - /> | |
4173 | - ) : ( | |
4174 | - '' | |
4175 | - )} | |
4229 | + {record.paths?.includes('orderCancel') ? ( | |
4230 | + <ButtonConfirm | |
4231 | + className="p-0" | |
4232 | + title="确认作废?" | |
4233 | + text="作废" | |
4234 | + onConfirm={async () => { | |
4235 | + let body = { | |
4236 | + ids: [record.id], | |
4237 | + checkIsMainOrderId: true, | |
4238 | + }; | |
4239 | + const data = await postServiceOrderOrderCancel({ | |
4240 | + data: body, | |
4241 | + }); | |
4242 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
4243 | + message.success(data.message); | |
4244 | + refreshTable(); | |
4245 | + } | |
4246 | + }} | |
4247 | + /> | |
4248 | + ) : ( | |
4249 | + '' | |
4250 | + )} | |
4176 | 4251 | |
4177 | - {record.paths?.includes('procurePrint') ? ( | |
4178 | - <ButtonConfirm | |
4179 | - className="p-0" | |
4180 | - title="确认打印?" | |
4181 | - text="采购打印" | |
4182 | - onConfirm={async () => { | |
4183 | - let selectedSubOrders = subOrderSelectedMap.get( | |
4184 | - record.id, | |
4185 | - ); | |
4186 | - if (selectedSubOrders === undefined) { | |
4187 | - selectedSubOrders = record.subOrderInformationLists; | |
4188 | - } | |
4189 | - for (let i = 0; i < selectedSubOrders.length; i++) { | |
4190 | - if ( | |
4191 | - selectedSubOrders[i].orderStatus !== | |
4192 | - 'PROCURE_PROCESS_FOR_MINE' | |
4193 | - ) { | |
4194 | - message.error( | |
4195 | - '请选择采购待打印状态的子订单进行打印', | |
4196 | - ); | |
4197 | - return false; | |
4252 | + {record.paths?.includes('procurePrint') ? ( | |
4253 | + <ButtonConfirm | |
4254 | + className="p-0" | |
4255 | + title="确认打印?" | |
4256 | + text="采购打印" | |
4257 | + onConfirm={async () => { | |
4258 | + let selectedSubOrders = subOrderSelectedMap.get( | |
4259 | + record.id, | |
4260 | + ); | |
4261 | + if (selectedSubOrders === undefined) { | |
4262 | + selectedSubOrders = record.subOrderInformationLists; | |
4263 | + } | |
4264 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
4265 | + if ( | |
4266 | + selectedSubOrders[i].orderStatus !== | |
4267 | + 'PROCURE_PROCESS_FOR_MINE' | |
4268 | + ) { | |
4269 | + message.error( | |
4270 | + '请选择采购待打印状态的子订单进行打印', | |
4271 | + ); | |
4272 | + return false; | |
4273 | + } | |
4198 | 4274 | } |
4199 | - } | |
4200 | 4275 | |
4201 | - const ids = selectedSubOrders?.map((item) => { | |
4202 | - return item.id; | |
4203 | - }); | |
4204 | - let res = await postServiceOrderProcurePrint({ | |
4205 | - data: { | |
4206 | - ids: ids, | |
4207 | - }, | |
4208 | - }); | |
4276 | + const ids = selectedSubOrders?.map((item) => { | |
4277 | + return item.id; | |
4278 | + }); | |
4279 | + let res = await postServiceOrderProcurePrint({ | |
4280 | + data: { | |
4281 | + ids: ids, | |
4282 | + }, | |
4283 | + }); | |
4209 | 4284 | |
4210 | - if (res.result === RESPONSE_CODE.SUCCESS) { | |
4211 | - message.success(res.message); | |
4212 | - refreshTable(); | |
4213 | - } | |
4214 | - }} | |
4215 | - /> | |
4216 | - ) : ( | |
4217 | - // <Button | |
4218 | - // className="p-0" | |
4219 | - // type="link" | |
4220 | - // onClick={() => { | |
4221 | - // if (!subOrderSelectedMap.get(record.id)?.length) { | |
4222 | - // return message.error('请选择选择子订单'); | |
4223 | - // } | |
4224 | - // setSelectedRows(subOrderSelectedMap.get(record.id)); | |
4225 | - // setOrderRow(record); | |
4226 | - // setOrderPrintVisible(true); | |
4227 | - // setOrderCheckType(CHECK_TYPE.PROCURE); | |
4228 | - // }} | |
4229 | - // > | |
4230 | - // 采购打印 | |
4231 | - // </Button> | |
4232 | - '' | |
4233 | - )} | |
4234 | - </Space> | |
4235 | - </Space.Compact> | |
4285 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
4286 | + message.success(res.message); | |
4287 | + refreshTable(); | |
4288 | + } | |
4289 | + }} | |
4290 | + /> | |
4291 | + ) : ( | |
4292 | + // <Button | |
4293 | + // className="p-0" | |
4294 | + // type="link" | |
4295 | + // onClick={() => { | |
4296 | + // if (!subOrderSelectedMap.get(record.id)?.length) { | |
4297 | + // return message.error('请选择选择子订单'); | |
4298 | + // } | |
4299 | + // setSelectedRows(subOrderSelectedMap.get(record.id)); | |
4300 | + // setOrderRow(record); | |
4301 | + // setOrderPrintVisible(true); | |
4302 | + // setOrderCheckType(CHECK_TYPE.PROCURE); | |
4303 | + // }} | |
4304 | + // > | |
4305 | + // 采购打印 | |
4306 | + // </Button> | |
4307 | + '' | |
4308 | + )} | |
4309 | + </Space> | |
4310 | + </Space.Compact> | |
4311 | + </Flex> | |
4236 | 4312 | </Flex> |
4237 | 4313 | </Flex> |
4238 | - </Flex> | |
4239 | 4314 | |
4240 | - <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg"> | |
4241 | - {expandedRowRender(record)} | |
4315 | + <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg"> | |
4316 | + {expandedRowRender(record)} | |
4317 | + </Flex> | |
4242 | 4318 | </Flex> |
4243 | - </Flex> | |
4319 | + </div> | |
4244 | 4320 | ); |
4245 | 4321 | }; |
4246 | 4322 | |
... | ... | @@ -4796,8 +4872,8 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
4796 | 4872 | if (paramsNew) { |
4797 | 4873 | setNewParams(paramsNew); |
4798 | 4874 | console.log(newParams); |
4875 | + refreshTable(); | |
4799 | 4876 | } |
4800 | - refreshTable(); | |
4801 | 4877 | }, [paramsNew]); |
4802 | 4878 | return ( |
4803 | 4879 | <div className="order-page-container"> |
... | ... | @@ -5022,6 +5098,11 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
5022 | 5098 | ? [...subOrderSelectedMap.values()].flat() |
5023 | 5099 | : buildSubOrders() |
5024 | 5100 | } |
5101 | + mainOrders={ | |
5102 | + isMainOrder | |
5103 | + ? [...mainOrderSelectedMap.values()] | |
5104 | + : [buildMainOrder()] | |
5105 | + } | |
5025 | 5106 | totalPayment={getApplyInvoicingTotalPayment()} |
5026 | 5107 | isMainOrder={isMainOrder} |
5027 | 5108 | isEdit={isEdit} |
... | ... | @@ -5486,6 +5567,11 @@ const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { |
5486 | 5567 | } |
5487 | 5568 | }} |
5488 | 5569 | mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()} |
5570 | + mainOrders={ | |
5571 | + isMainOrder | |
5572 | + ? [...mainOrderSelectedMap.values()] | |
5573 | + : [buildMainOrder()] | |
5574 | + } | |
5489 | 5575 | onClose={() => { |
5490 | 5576 | setInvoicingDrawerFormVisible(false); |
5491 | 5577 | setIsMainOrder(true); | ... | ... |
src/pages/Order/OrderList/PaymentRecordModal.tsx
... | ... | @@ -20,6 +20,14 @@ interface PaymentRecord { |
20 | 20 | paymentReceiptAnnexPartial: string | null; |
21 | 21 | } |
22 | 22 | |
23 | +// Helper function to display dash for empty values | |
24 | +const displayValue = (value: any, formatter?: (val: any) => string): string => { | |
25 | + if (value === null || value === undefined || value === '') { | |
26 | + return '-'; | |
27 | + } | |
28 | + return formatter ? formatter(value) : String(value); | |
29 | +}; | |
30 | + | |
23 | 31 | const PaymentRecordModal: React.FC<PaymentRecordModalProps> = ({ |
24 | 32 | visible, |
25 | 33 | mainOrderId, |
... | ... | @@ -90,11 +98,14 @@ const PaymentRecordModal: React.FC<PaymentRecordModalProps> = ({ |
90 | 98 | <div className="payment-record-content"> |
91 | 99 | <div className="payment-record-info"> |
92 | 100 | <p> |
93 | - <strong>提交时间:</strong> {record.createTime} | |
101 | + <strong>提交时间:</strong>{' '} | |
102 | + {displayValue(record.createTime)} | |
94 | 103 | </p> |
95 | 104 | <p> |
96 | 105 | <strong>付款金额:</strong>{' '} |
97 | - {record.refundMoney.toFixed(2)} | |
106 | + {displayValue(record.refundMoney, (val) => | |
107 | + val.toFixed(2), | |
108 | + )} | |
98 | 109 | </p> |
99 | 110 | {imageUrls.length > 0 && ( |
100 | 111 | <p> | ... | ... |
src/pages/Order/OrderList/UploadPayBillModal.tsx
... | ... | @@ -217,7 +217,10 @@ export default ({ setVisible, subOrders, mainOrder, onClose }) => { |
217 | 217 | onOpenChange={setVisible} |
218 | 218 | > |
219 | 219 | <div className="pb-4 text-base font-medium"> |
220 | - 付款金额:¥{mainOrder?.totalPayment?.toLocaleString() || '0.00'} | |
220 | + 付款金额:¥ | |
221 | + {mainOrder?.totalPayment | |
222 | + ? mainOrder.totalPayment.toLocaleString() | |
223 | + : '-'} | |
221 | 224 | </div> |
222 | 225 | <div className="flex items-start pb-4 text-base font-medium"> |
223 | 226 | <div>付款凭证:</div> | ... | ... |
src/pages/Order/OrderList/type.d.ts
... | ... | @@ -48,6 +48,8 @@ export interface OrderListItemType { |
48 | 48 | unit: string; |
49 | 49 | parameters: any; |
50 | 50 | totalPayment: number; |
51 | + invoicePendingAmount?: number | string; | |
52 | + invoiceIssuedAmount?: number | string; | |
51 | 53 | subOrderPayment: number; |
52 | 54 | isCancel: number; |
53 | 55 | logisticsStatus: string; | ... | ... |
src/pages/Order/OrderWarning/components/OrderDrawer.tsx
... | ... | @@ -1611,7 +1611,24 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
1611 | 1611 | onChange={(val: any) => { |
1612 | 1612 | setPaymentMethod(val); |
1613 | 1613 | }} |
1614 | - options={enumToSelect(PAYMENT_METHOD_OPTIONS_4_ADD)} | |
1614 | + options={(() => { | |
1615 | + // 使用Set记录已经处理过的选项值,避免重复 | |
1616 | + const processedValues = new Set(); | |
1617 | + const finalOptions = []; | |
1618 | + | |
1619 | + // 先处理默认可选项 | |
1620 | + enumToSelect(PAYMENT_METHOD_OPTIONS_4_ADD).forEach((option) => { | |
1621 | + // 将淘宝选项设置为禁用状态,使其无法手动选择 | |
1622 | + if (option.value === 'PAYMENT_IN_TAOBAO') { | |
1623 | + finalOptions.push({ ...option, disabled: true }); | |
1624 | + } else { | |
1625 | + finalOptions.push(option); | |
1626 | + } | |
1627 | + processedValues.add(option.value); | |
1628 | + }); | |
1629 | + | |
1630 | + return finalOptions; | |
1631 | + })()} | |
1615 | 1632 | rules={[{ required: true, message: '支付方式必填' }]} |
1616 | 1633 | disabled={optType('after-sales-check')} |
1617 | 1634 | /> | ... | ... |
src/pages/Order/OrderWarning/index.tsx
... | ... | @@ -5,26 +5,26 @@ import { |
5 | 5 | import { downloadFile } from '@/services/order'; |
6 | 6 | import { getSalesCodeOptions } from '@/utils/order'; |
7 | 7 | import { getUserInfo } from '@/utils/user'; |
8 | -import { | |
9 | - ActionType, | |
10 | - ProFormInstance, | |
11 | - ProFormSelect, | |
12 | -} from '@ant-design/pro-components'; | |
8 | +import { ActionType, ProFormSelect } from '@ant-design/pro-components'; | |
13 | 9 | import { Badge, Button, Radio, message } from 'antd'; |
14 | 10 | import { format } from 'date-fns'; |
15 | -import React, { useEffect, useRef, useState } from 'react'; | |
11 | +import { useEffect, useMemo, useRef, useState } from 'react'; | |
16 | 12 | import OrderList from '../OrderList/OrderList'; |
17 | 13 | import './index.less'; |
18 | 14 | // import { useParams } from '@umijs/max'; |
19 | 15 | |
16 | +// 定义参数类型 | |
17 | +interface ParamsType { | |
18 | + [key: string]: any; | |
19 | +} | |
20 | + | |
20 | 21 | const OrderPage = () => { |
21 | - const [salesCodeOptions, setSalesCodeOptions] = useState([]); | |
22 | - const [salesCodeSelect, setSalesCodeSelect] = useState(); | |
22 | + const [salesCodeOptions, setSalesCodeOptions] = useState<any[]>([]); | |
23 | + const [salesCodeSelect, setSalesCodeSelect] = useState<string>(); | |
23 | 24 | const userInfo = getUserInfo(); |
24 | 25 | |
25 | 26 | const mainTableRef = useRef<ActionType>(); |
26 | - const mainTableFormRef = useRef<ProFormInstance>(); | |
27 | - let [searchParams] = useState(Object); //表格的查询条件存储 | |
27 | + let [searchParams] = useState<ParamsType>({}); //表格的查询条件存储 | |
28 | 28 | console.log(searchParams); |
29 | 29 | const [messageApi] = message.useMessage(); |
30 | 30 | console.log(messageApi); |
... | ... | @@ -92,7 +92,8 @@ const OrderPage = () => { |
92 | 92 | //选择天数 |
93 | 93 | const [calDate, setCalDate] = useState<string | null>(null); |
94 | 94 | const [value1, setValue1] = useState(0); |
95 | - const radioOnChange1 = ({ target: { value } }) => { | |
95 | + const radioOnChange1 = (e: any) => { | |
96 | + const { value } = e.target; | |
96 | 97 | const currentDate = new Date(); |
97 | 98 | // 创建一个新的日期对象,并在当前日期的基础上加上 daysToAdd 天 |
98 | 99 | const newDate = new Date(currentDate); |
... | ... | @@ -101,7 +102,7 @@ const OrderPage = () => { |
101 | 102 | setCalDate(formattedDate); |
102 | 103 | setValue1(value); |
103 | 104 | }; |
104 | - function setOriginTime(value) { | |
105 | + function setOriginTime(value: number) { | |
105 | 106 | const currentDate = new Date(); |
106 | 107 | // 创建一个新的日期对象,并在当前日期的基础上加上 daysToAdd 天 |
107 | 108 | const newDate = new Date(currentDate); |
... | ... | @@ -214,12 +215,70 @@ const OrderPage = () => { |
214 | 215 | const formattedDate = format(newDate, 'yyyy-MM-dd HH:mm:ss'); |
215 | 216 | setCalDate(formattedDate); |
216 | 217 | }, [activeTabKey]); |
218 | + | |
219 | + // 使用 useMemo 让参数能够响应状态变化 | |
220 | + const paramsNew = useMemo(() => { | |
221 | + // 初始化参数 | |
222 | + let initialParams: ParamsType = {}; | |
223 | + initialParams.isDeleteQueryOrderNow = false; | |
224 | + initialParams.salesCode = userInfo.username; | |
225 | + if (salesCodePermission) { | |
226 | + if (salesCodeSelect !== undefined && salesCodeSelect !== null) { | |
227 | + initialParams.salesCode = salesCodeSelect; | |
228 | + } else { | |
229 | + initialParams.salesCode = userInfo.username; | |
230 | + } | |
231 | + } | |
232 | + // 根据activeTabKey动态扩展参数 | |
233 | + if (activeTabKey === 1) { | |
234 | + initialParams = { | |
235 | + ...initialParams, | |
236 | + orderStatus: 'SHIPPED', | |
237 | + warningStatus: 'waitConfirmReicept', | |
238 | + statusDatetimeLe: calDate, | |
239 | + }; | |
240 | + } else if (activeTabKey === 2) { | |
241 | + initialParams = { | |
242 | + ...initialParams, | |
243 | + warningStatus: 'invoicingWarning', | |
244 | + confirmReceiptDatetimeLe: calDate, | |
245 | + }; | |
246 | + } else if (activeTabKey === 3) { | |
247 | + initialParams = { | |
248 | + ...initialParams, | |
249 | + warningStatus: 'waitFeedbackWarning', | |
250 | + confirmReceiptDatetimeLe: calDate, | |
251 | + }; | |
252 | + } else if (activeTabKey === 4) { | |
253 | + initialParams = { | |
254 | + ...initialParams, | |
255 | + warningStatus: 'invoiceConfirmWarning', | |
256 | + invoicingEndTime: calDate, | |
257 | + }; | |
258 | + } else if (activeTabKey === 5) { | |
259 | + initialParams = { | |
260 | + ...initialParams, | |
261 | + warningStatus: 'paymentReceiptStatusWarning', | |
262 | + paymentNotReceipt: true, | |
263 | + applyTimeLe: calDate, | |
264 | + }; | |
265 | + } | |
266 | + // 返回完整的参数对象 | |
267 | + return initialParams; | |
268 | + }, [ | |
269 | + activeTabKey, | |
270 | + calDate, | |
271 | + salesCodeSelect, | |
272 | + salesCodePermission, | |
273 | + userInfo.username, | |
274 | + ]); | |
275 | + | |
217 | 276 | //biaojidown2 |
218 | 277 | //取消单选,将时间设为null |
219 | 278 | const handleSetNull = () => { |
220 | 279 | setCalDate(null); // 这应该会触发 useEffect |
221 | 280 | }; |
222 | - const selectSalesCode = (value) => { | |
281 | + const selectSalesCode = (value: string) => { | |
223 | 282 | setSalesCodeSelect(value); // 这应该会触发 useEffect |
224 | 283 | }; |
225 | 284 | const warningOptions = [ |
... | ... | @@ -310,10 +369,8 @@ const OrderPage = () => { |
310 | 369 | <Radio |
311 | 370 | key={option.value} |
312 | 371 | value={option.value} |
313 | - onClick={(e) => { | |
314 | - radioOnChange1( | |
315 | - e as unknown as React.ChangeEvent<HTMLInputElement>, | |
316 | - ); | |
372 | + onClick={(e: any) => { | |
373 | + radioOnChange1(e); | |
317 | 374 | handleSetNull(); |
318 | 375 | }} |
319 | 376 | > |
... | ... | @@ -331,15 +388,13 @@ const OrderPage = () => { |
331 | 388 | <ProFormSelect |
332 | 389 | name="salesCode" |
333 | 390 | key="salesCode" |
334 | - width="200px" | |
335 | - actionRef={mainTableRef} | |
336 | - formRef={mainTableFormRef} | |
391 | + width={200} | |
337 | 392 | initialValue={userInfo.username} |
338 | 393 | showSearch |
339 | 394 | label="销售代表" |
340 | 395 | placeholder="请输入销售代表" |
341 | 396 | options={salesCodeOptions} |
342 | - onChange={(_, option) => { | |
397 | + onChange={(_, option: any) => { | |
343 | 398 | if (option === undefined) { |
344 | 399 | selectSalesCode(userInfo.username); |
345 | 400 | } |
... | ... | @@ -365,7 +420,7 @@ const OrderPage = () => { |
365 | 420 | <Button |
366 | 421 | key="out" |
367 | 422 | onClick={() => { |
368 | - let initialParams = {}; | |
423 | + let initialParams: ParamsType = {}; | |
369 | 424 | initialParams.isDeleteQueryOrder = false; |
370 | 425 | initialParams.flag = 50; |
371 | 426 | initialParams.current = 1; |
... | ... | @@ -454,59 +509,7 @@ const OrderPage = () => { |
454 | 509 | }} |
455 | 510 | searchShow={false} |
456 | 511 | toolbarShow={false} /> */} |
457 | - <OrderList | |
458 | - paramsNew={(function () { | |
459 | - // 初始化参数 | |
460 | - let initialParams = {}; | |
461 | - initialParams.isDeleteQueryOrderNow = false; | |
462 | - initialParams.salesCode = userInfo.username; | |
463 | - if (salesCodePermission) { | |
464 | - if (salesCodeSelect !== undefined && salesCodeSelect !== null) { | |
465 | - initialParams.salesCode = salesCodeSelect; | |
466 | - } else { | |
467 | - initialParams.salesCode = userInfo.username; | |
468 | - } | |
469 | - } | |
470 | - // 根据activeTabKey动态扩展参数 | |
471 | - if (activeTabKey === 1) { | |
472 | - initialParams = { | |
473 | - ...initialParams, | |
474 | - orderStatus: 'SHIPPED', | |
475 | - warningStatus: 'waitConfirmReicept', | |
476 | - statusDatetimeLe: calDate, | |
477 | - }; | |
478 | - } else if (activeTabKey === 2) { | |
479 | - initialParams = { | |
480 | - ...initialParams, | |
481 | - warningStatus: 'invoicingWarning', | |
482 | - confirmReceiptDatetimeLe: calDate, | |
483 | - }; | |
484 | - } else if (activeTabKey === 3) { | |
485 | - initialParams = { | |
486 | - ...initialParams, | |
487 | - warningStatus: 'waitFeedbackWarning', | |
488 | - confirmReceiptDatetimeLe: calDate, | |
489 | - }; | |
490 | - } else if (activeTabKey === 4) { | |
491 | - initialParams = { | |
492 | - ...initialParams, | |
493 | - warningStatus: 'invoiceConfirmWarning', | |
494 | - invoicingEndTime: calDate, | |
495 | - }; | |
496 | - } else if (activeTabKey === 5) { | |
497 | - initialParams = { | |
498 | - ...initialParams, | |
499 | - warningStatus: 'paymentReceiptStatusWarning', | |
500 | - paymentNotReceipt: true, | |
501 | - applyTimeLe: calDate, | |
502 | - }; | |
503 | - } | |
504 | - // 返回完整的参数对象 | |
505 | - return initialParams; | |
506 | - })()} | |
507 | - searchShow={false} | |
508 | - toolbarShow={false} | |
509 | - /> | |
512 | + <OrderList paramsNew={paramsNew} searchShow={false} toolbarShow={false} /> | |
510 | 513 | </div> |
511 | 514 | ); |
512 | 515 | }; | ... | ... |
src/pages/Order/constant.ts
... | ... | @@ -13,7 +13,7 @@ export const PAYMENT_CHANNEL_OPTIONS = { |
13 | 13 | BALANCE: '扣预存', |
14 | 14 | PLATFORM: '平台结算', |
15 | 15 | OFFLINE: '线下支付', |
16 | - TAOBAO: '淘宝', | |
16 | + TAOBAO: '淘宝已付', | |
17 | 17 | }; |
18 | 18 | |
19 | 19 | export const RECEIPTS_RECORD_TYPES = { |
... | ... | @@ -24,22 +24,24 @@ export const RECEIPTS_RECORD_TYPES = { |
24 | 24 | }; |
25 | 25 | |
26 | 26 | export const PAYMENT_METHOD_OPTIONS = { |
27 | - UNPAID: '未付款', | |
28 | - TAOBAO_ORDER_HAS_BEEN_PAID: '淘宝订单已付款', | |
29 | - OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID: '官网订单已付款', | |
30 | - PAYMENT_IN_ADVANCE: '预付款', | |
31 | - WITHHOLDING_ADVANCE_DEPOSIT: '预付', | |
32 | - PLATFORM_SETTLEMENT: '平台结算', | |
27 | + // UNPAID: '未付款', | |
28 | + // TAOBAO_ORDER_HAS_BEEN_PAID: '淘宝订单已付款', | |
29 | + OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID: '官网已付', | |
30 | + PAYMENT_IN_ADVANCE: '预付', | |
31 | + PAYMENT_IN_TAOBAO: '淘宝', | |
32 | + // WITHHOLDING_ADVANCE_DEPOSIT: '预付(扣预存)', | |
33 | 33 | CASH_ON_DELIVERY: '货到付款', |
34 | 34 | HIRE_PURCHASE: '分期付款', |
35 | - PAYMENT_RECEIPT: '已回款', | |
35 | + // PAYMENT_RECEIPT: '已回款', | |
36 | 36 | PREPAID_NO_NEED_SEND: '预存款无需发货', |
37 | 37 | }; |
38 | 38 | |
39 | 39 | export const PAYMENT_METHOD_OPTIONS_4_ADD = { |
40 | 40 | PAYMENT_IN_ADVANCE: '预付', |
41 | + PAYMENT_IN_TAOBAO: '淘宝', | |
41 | 42 | CASH_ON_DELIVERY: '货到付款', |
42 | 43 | HIRE_PURCHASE: '分期付款', |
44 | + PREPAID_NO_NEED_SEND: '预存款无需发货', | |
43 | 45 | }; |
44 | 46 | |
45 | 47 | export const PRODUCT_BELONG_DEPARTMENT_OPTIONS = { |
... | ... | @@ -90,8 +92,7 @@ export const PROCURE_ORDER_STATUS = { |
90 | 92 | |
91 | 93 | export const INVOCING_STATUS_OPTIONS = { |
92 | 94 | UN_INVOICE: '不需开票', |
93 | - SPECIALLY_INVOICED: '专票', | |
94 | - COMMON_INVOICED: '普票', | |
95 | + INVOICED: '需要开票', | |
95 | 96 | }; |
96 | 97 | |
97 | 98 | export const INVOCING_STATUS = { |
... | ... | @@ -197,6 +198,12 @@ export const PAYMENT_RECEIPTS_STATUS_OPTIONS = { |
197 | 198 | PARTIAL_RECEIVED: '待提交', |
198 | 199 | }; |
199 | 200 | |
201 | +export const PAYMENT_AUDIT_STATUS_OPTIONS = { | |
202 | + WAIT_PAYMENT: '待付款', | |
203 | + PARTIAL_PAYMENT: '部分付款', | |
204 | + COMPLETE_PAYMENT: '已付款', | |
205 | +}; | |
206 | + | |
200 | 207 | export const ORDER_STATUS_OPTIONS = { |
201 | 208 | WAIT_CONFIRM_DELIVER_AFTER_INVOICE: '待开票后确认发货', |
202 | 209 | SALES_CONFIRM: '销售待确认', |
... | ... | @@ -257,15 +264,14 @@ export const FINANCIAL_STATUS_OPTIONS = { |
257 | 264 | |
258 | 265 | export const AFTER_INVOICING_STATUS = { |
259 | 266 | NOT_YET_INVOICED: '尚未开票', |
260 | - APPLY_FOR_INVOICING: '申请开票', | |
261 | - URGENT_INVOICE_AUDITING: '加急待审核', | |
262 | - URGENT_INVOICE_AUDIT_NOTPASS: '加急审核失败', | |
267 | + UN_INVOICE: '不需开票', | |
263 | 268 | PARTIAL_INVOICING: '部分开票', |
264 | 269 | COMPLETE_INVOICING: '完全开票', |
265 | - INVOICING: '开票中', | |
266 | - REISSUE: '重新开票', | |
267 | - WAIT_FLUSH: '待冲红', | |
268 | - FLUSHED: '已冲红', | |
270 | +}; | |
271 | + | |
272 | +export const IS_WAIT_FLUSHED_OPTIONS = { | |
273 | + true: '是', | |
274 | + false: '否', | |
269 | 275 | }; |
270 | 276 | |
271 | 277 | export const TAGS_COLOR = new Map<string, string>([ |
... | ... | @@ -596,6 +602,13 @@ export const MAIN_ORDER_COLUMNS = [ |
596 | 602 | valueEnum: enumToProTableEnumValue(ORDER_STATUS_OPTIONS), |
597 | 603 | }, |
598 | 604 | { |
605 | + title: '付款状态', | |
606 | + dataIndex: 'paymentAuditStatus', | |
607 | + valueType: 'select', | |
608 | + hideInTable: true, | |
609 | + valueEnum: enumToProTableEnumValue(PAYMENT_AUDIT_STATUS_OPTIONS), | |
610 | + }, | |
611 | + { | |
599 | 612 | title: '修改审核状态', |
600 | 613 | dataIndex: 'modifiedAuditStatus', |
601 | 614 | valueType: 'select', |
... | ... | @@ -697,6 +710,20 @@ export const MAIN_ORDER_COLUMNS = [ |
697 | 710 | valueEnum: enumToProTableEnumValue(AFTER_INVOICING_STATUS), |
698 | 711 | }, |
699 | 712 | { |
713 | + title: '是否待冲红', | |
714 | + dataIndex: 'isWaitFlushed', | |
715 | + valueType: 'select', | |
716 | + hideInTable: true, | |
717 | + valueEnum: enumToProTableEnumValue(IS_WAIT_FLUSHED_OPTIONS), | |
718 | + search: { | |
719 | + transform: (value) => { | |
720 | + return { | |
721 | + isWaitFlushed: value === 'true', | |
722 | + }; | |
723 | + }, | |
724 | + }, | |
725 | + }, | |
726 | + { | |
700 | 727 | title: '发票号码', |
701 | 728 | dataIndex: 'invoiceNumberLike', |
702 | 729 | valueType: 'text', | ... | ... |
src/pages/ResearchGroup/ResearchGroup/index.tsx
... | ... | @@ -531,17 +531,29 @@ const ResearchGroupListPage = () => { |
531 | 531 | columns={researchGroupColumnsInit()} |
532 | 532 | actionRef={researchGroupActionRef} |
533 | 533 | cardBordered |
534 | + manualRequest={false} | |
535 | + dataSource={undefined} // Use undefined to force server fetch | |
534 | 536 | pagination={{ |
535 | - pageSize: 10, | |
537 | + showSizeChanger: true, | |
538 | + pageSizeOptions: ['10', '20', '50', '100'], | |
539 | + defaultCurrent: 1, | |
540 | + defaultPageSize: 10, | |
536 | 541 | }} |
542 | + scroll={{ x: 1400 }} | |
537 | 543 | request={async (params) => { |
544 | + const { current, pageSize, ...rest } = params; | |
538 | 545 | const res = await postResearchGroupsList({ |
539 | - data: { ...params }, | |
546 | + data: { | |
547 | + current: current, | |
548 | + pageSize: pageSize, | |
549 | + ...rest, | |
550 | + }, | |
540 | 551 | }); |
541 | 552 | setPerms(res.data.specialPath); |
542 | 553 | return { |
543 | 554 | data: res?.data?.data || [], |
544 | 555 | total: res?.data?.total || 0, |
556 | + success: res && res.result === RESPONSE_CODE.SUCCESS, | |
545 | 557 | }; |
546 | 558 | }} |
547 | 559 | columnsState={{ |
... | ... | @@ -566,7 +578,6 @@ const ResearchGroupListPage = () => { |
566 | 578 | form={{}} |
567 | 579 | dateFormatter="string" |
568 | 580 | headerTitle="课题组列表" |
569 | - scroll={{ x: 1400 }} | |
570 | 581 | toolBarRender={() => { |
571 | 582 | let btns = []; |
572 | 583 | if (perms?.includes('add')) { |
... | ... | @@ -640,17 +651,29 @@ const ResearchGroupListPage = () => { |
640 | 651 | columns={memberApplyColumnsInit()} |
641 | 652 | actionRef={memberApplyActionRef} |
642 | 653 | cardBordered |
654 | + manualRequest={false} | |
655 | + dataSource={undefined} // Use undefined to force server fetch | |
643 | 656 | pagination={{ |
644 | - pageSize: 10, | |
657 | + showSizeChanger: true, | |
658 | + pageSizeOptions: ['10', '20', '50', '100'], | |
659 | + defaultCurrent: 1, | |
660 | + defaultPageSize: 10, | |
645 | 661 | }} |
662 | + scroll={{ x: 1400 }} | |
646 | 663 | request={async (params) => { |
664 | + const { current, pageSize, ...rest } = params; | |
647 | 665 | const res = await postResearchGroupMemberRequestsList({ |
648 | - data: { ...params }, | |
666 | + data: { | |
667 | + current: current, | |
668 | + pageSize: pageSize, | |
669 | + ...rest, | |
670 | + }, | |
649 | 671 | }); |
650 | 672 | setPerms(res.data.specialPath); |
651 | 673 | return { |
652 | 674 | data: res?.data?.data || [], |
653 | 675 | total: res?.data?.total || 0, |
676 | + success: res && res.result === RESPONSE_CODE.SUCCESS, | |
654 | 677 | }; |
655 | 678 | }} |
656 | 679 | columnsState={{ |
... | ... | @@ -666,6 +689,7 @@ const ResearchGroupListPage = () => { |
666 | 689 | rowKey="id" |
667 | 690 | search={{ |
668 | 691 | labelWidth: 'auto', |
692 | + defaultCollapsed: false, | |
669 | 693 | }} |
670 | 694 | options={{ |
671 | 695 | setting: { |
... | ... | @@ -675,7 +699,6 @@ const ResearchGroupListPage = () => { |
675 | 699 | form={{}} |
676 | 700 | dateFormatter="string" |
677 | 701 | headerTitle="申请列表" |
678 | - scroll={{ x: 1400 }} | |
679 | 702 | toolBarRender={() => { |
680 | 703 | let btns = []; |
681 | 704 | btns.push( | ... | ... |
src/utils/hooks.ts
0 → 100644
1 | +import { useRef } from 'react'; | |
2 | + | |
3 | +/** | |
4 | + * Custom hook to track and manage API requests with debouncing and manual refresh capabilities | |
5 | + * @param cooldownMs - Cooldown time in milliseconds between automatic requests | |
6 | + * @returns Object with tracking state and utility functions | |
7 | + */ | |
8 | +export const useRequestTracker = (cooldownMs = 5000) => { | |
9 | + // Use a ref to persist the state between renders | |
10 | + const trackerRef = useRef({ | |
11 | + initialRequestMade: false, | |
12 | + pendingRequest: false, | |
13 | + lastRequestTime: 0, | |
14 | + manualRefresh: false, | |
15 | + }); | |
16 | + | |
17 | + /** | |
18 | + * Checks if a request should be executed based on tracking state | |
19 | + * @returns boolean - Whether the request should proceed | |
20 | + */ | |
21 | + const shouldExecuteRequest = () => { | |
22 | + const now = Date.now(); | |
23 | + const tracker = trackerRef.current; | |
24 | + | |
25 | + // Always execute if it's a manual refresh | |
26 | + if (tracker.manualRefresh) { | |
27 | + console.log( | |
28 | + '[Request Tracker] Manual refresh triggered, executing request', | |
29 | + ); | |
30 | + tracker.manualRefresh = false; | |
31 | + tracker.lastRequestTime = now; | |
32 | + return true; | |
33 | + } | |
34 | + | |
35 | + // If there's a pending request, don't execute another | |
36 | + if (tracker.pendingRequest) { | |
37 | + console.log('[Request Tracker] Request already in progress, skipping'); | |
38 | + return false; | |
39 | + } | |
40 | + | |
41 | + // For automatic requests (not manually triggered), apply cooldown | |
42 | + if ( | |
43 | + tracker.initialRequestMade && | |
44 | + now - tracker.lastRequestTime < cooldownMs | |
45 | + ) { | |
46 | + console.log( | |
47 | + `[Request Tracker] Cooldown active (${cooldownMs}ms), skipping automatic request`, | |
48 | + ); | |
49 | + return false; | |
50 | + } | |
51 | + | |
52 | + // Otherwise, allow the request | |
53 | + console.log('[Request Tracker] Executing request'); | |
54 | + tracker.lastRequestTime = now; | |
55 | + return true; | |
56 | + }; | |
57 | + | |
58 | + /** | |
59 | + * Marks the beginning of a request | |
60 | + */ | |
61 | + const startRequest = () => { | |
62 | + trackerRef.current.pendingRequest = true; | |
63 | + }; | |
64 | + | |
65 | + /** | |
66 | + * Marks the completion of a request | |
67 | + */ | |
68 | + const finishRequest = () => { | |
69 | + const tracker = trackerRef.current; | |
70 | + tracker.pendingRequest = false; | |
71 | + tracker.initialRequestMade = true; | |
72 | + }; | |
73 | + | |
74 | + /** | |
75 | + * Marks a request as manually triggered (will bypass cooldown) | |
76 | + */ | |
77 | + const markAsManualRefresh = () => { | |
78 | + trackerRef.current.manualRefresh = true; | |
79 | + }; | |
80 | + | |
81 | + return { | |
82 | + tracker: trackerRef.current, | |
83 | + shouldExecuteRequest, | |
84 | + startRequest, | |
85 | + finishRequest, | |
86 | + markAsManualRefresh, | |
87 | + }; | |
88 | +}; | ... | ... |