Commit 9501262e22f29cfb95f06a646a1f74cad4c51c58
1 parent
0cbf10f0
feat: 售后
Showing
45 changed files
with
15503 additions
and
2 deletions
.umirc.ts
... | ... | @@ -14,9 +14,9 @@ export default defineConfig({ |
14 | 14 | }, |
15 | 15 | proxy: { |
16 | 16 | '/api/': { |
17 | - target: 'http://localhost:8085/', | |
17 | + // target: 'http://localhost:8085/', | |
18 | 18 | // target: 'http://192.168.1.6:8085/', |
19 | - // target: 'http://39.108.227.113:8085/', | |
19 | + target: 'http://39.108.227.113:8085/', | |
20 | 20 | changeOrigin: true, |
21 | 21 | pathRewrite: { '^/api': '' }, |
22 | 22 | }, |
... | ... | @@ -59,6 +59,11 @@ export default defineConfig({ |
59 | 59 | access: 'canReadAdminAndSalesManager', |
60 | 60 | component: './Order/WarningWhitelist', |
61 | 61 | }, |
62 | + { | |
63 | + name: '订单售后', | |
64 | + path: 'FeedBack', | |
65 | + component: './Order/FeedBack', | |
66 | + }, | |
62 | 67 | ], |
63 | 68 | }, |
64 | 69 | { | ... | ... |
src/pages/Order/FeedBack/AfterSalesDrawer.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderApplyAfterSales } from '@/services'; | |
3 | +import { enumToSelect } from '@/utils'; | |
4 | +import { | |
5 | + DrawerForm, | |
6 | + ProFormDigit, | |
7 | + ProFormSelect, | |
8 | + ProFormTextArea, | |
9 | + ProFormUploadDragger, | |
10 | +} from '@ant-design/pro-components'; | |
11 | +import { Form, message } from 'antd'; | |
12 | +import { AFTE_SALES_PLAN_OPTIONS } from '../constant'; | |
13 | +export default ({ setVisible, mainOrder, subOrders, onClose }) => { | |
14 | + let subOrderIds = subOrders?.map((item: { id: any }) => { | |
15 | + return item.id; | |
16 | + }); | |
17 | + | |
18 | + let mainOrderId = mainOrder.id; | |
19 | + const [form] = Form.useForm<{ | |
20 | + afterSalesNotes: string; | |
21 | + afterSalesPlan: string; | |
22 | + ids: []; | |
23 | + totalPayment: number; | |
24 | + filePaths: any[]; | |
25 | + }>(); | |
26 | + | |
27 | + return ( | |
28 | + <DrawerForm<{ | |
29 | + afterSalesNotes: string; | |
30 | + afterSalesPlan: string; | |
31 | + subOrderIds: []; | |
32 | + totalPayment: number; | |
33 | + mainId: number; | |
34 | + filePaths: any[]; | |
35 | + }> | |
36 | + title="申请售后" | |
37 | + open | |
38 | + resize={{ | |
39 | + onResize() { | |
40 | + console.log('resize!'); | |
41 | + }, | |
42 | + maxWidth: window.innerWidth * 0.8, | |
43 | + minWidth: 500, | |
44 | + }} | |
45 | + form={form} | |
46 | + autoFocusFirstInput | |
47 | + drawerProps={{ | |
48 | + destroyOnClose: true, | |
49 | + onClose: () => { | |
50 | + setVisible(false); | |
51 | + }, | |
52 | + }} | |
53 | + onFinish={async (values) => { | |
54 | + values.subOrderIds = subOrderIds; | |
55 | + values.mainId = mainOrderId; | |
56 | + values.filePaths = values.filePaths?.map((file) => { | |
57 | + return { url: file.response.data[0] }; | |
58 | + }); | |
59 | + let res = await postServiceOrderApplyAfterSales({ data: values }); | |
60 | + if (res?.result === RESPONSE_CODE.SUCCESS) { | |
61 | + message.success(res.message); | |
62 | + onClose(); | |
63 | + } | |
64 | + }} | |
65 | + > | |
66 | + <ProFormSelect | |
67 | + key="key" | |
68 | + label="售后方案" | |
69 | + width="lg" | |
70 | + showSearch | |
71 | + name="afterSalesPlan" | |
72 | + options={enumToSelect(AFTE_SALES_PLAN_OPTIONS)} | |
73 | + placeholder="请搜索" | |
74 | + rules={[{ required: true, message: '售后方案必填' }]} | |
75 | + ></ProFormSelect> | |
76 | + <ProFormDigit | |
77 | + width="lg" | |
78 | + name="totalPayment" | |
79 | + label="总金额调整" | |
80 | + min={0} | |
81 | + initialValue={mainOrder.totalPayment} | |
82 | + rules={[{ required: true, message: '总金额必填' }]} | |
83 | + /> | |
84 | + <ProFormTextArea | |
85 | + width="lg" | |
86 | + label="售后原因" | |
87 | + name="afterSalesNotes" | |
88 | + rules={[{ required: true, message: '售后原因必填' }]} | |
89 | + /> | |
90 | + <ProFormUploadDragger | |
91 | + key="filePaths" | |
92 | + label="附件" | |
93 | + name="filePaths" | |
94 | + action="/api/service/order/fileProcess" | |
95 | + fieldProps={{ | |
96 | + headers: { Authorization: localStorage.getItem('token') }, | |
97 | + }} | |
98 | + /> | |
99 | + </DrawerForm> | |
100 | + ); | |
101 | +}; | ... | ... |
src/pages/Order/FeedBack/ApplyForInvoicingModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderApplyInvoicing } from '@/services'; | |
3 | +import { enumToSelect, getAliYunOSSFileNameFromUrl } from '@/utils'; | |
4 | +import { | |
5 | + ModalForm, | |
6 | + ProFormSelect, | |
7 | + ProFormText, | |
8 | + ProFormTextArea, | |
9 | + ProFormUploadDragger, | |
10 | +} from '@ant-design/pro-components'; | |
11 | +import { Form, message } from 'antd'; | |
12 | +import { useEffect, useState } from 'react'; | |
13 | +import { PAYEE_OPTIONS } from '../constant'; | |
14 | +export default ({ | |
15 | + setCheckVisible, | |
16 | + isEdit, | |
17 | + subOrders, | |
18 | + isMainOrder, | |
19 | + totalPayment, | |
20 | + onClose, | |
21 | +}) => { | |
22 | + const [isUrgent, setIsUrgent] = useState(''); | |
23 | + let sumPrice = totalPayment; | |
24 | + | |
25 | + let ids = subOrders?.map((item) => { | |
26 | + return item.id; | |
27 | + }); | |
28 | + | |
29 | + let mainIdSet = new Set(); | |
30 | + subOrders?.forEach((item: { mainOrderId: unknown }) => { | |
31 | + mainIdSet.add(item.mainOrderId); | |
32 | + }); | |
33 | + | |
34 | + let mainIds = Array.from(mainIdSet).join(','); | |
35 | + | |
36 | + let newListAnnex = []; | |
37 | + | |
38 | + //回显,子订单可以编辑备注跟附件 | |
39 | + if (isEdit) { | |
40 | + newListAnnex = subOrders.afterAnnexList?.map((path) => { | |
41 | + let i = 0; | |
42 | + return { | |
43 | + uid: i++, | |
44 | + name: getAliYunOSSFileNameFromUrl(path), | |
45 | + status: 'uploaded', | |
46 | + url: path, | |
47 | + response: { data: [path] }, | |
48 | + }; | |
49 | + }); | |
50 | + subOrders.filePaths = newListAnnex; | |
51 | + } | |
52 | + | |
53 | + const [form] = Form.useForm<{ | |
54 | + applyInvoicingNotes: string; | |
55 | + filePaths: any; | |
56 | + subIds: any[]; | |
57 | + afterInvoicingUpdate: boolean; | |
58 | + receivingCompany: string; | |
59 | + isUrgent: boolean; | |
60 | + deadline: string; | |
61 | + }>(); | |
62 | + | |
63 | + useEffect(() => { | |
64 | + //显示拼接的主订单id | |
65 | + form.setFieldValue('applyInvoicingNotes', mainIds); | |
66 | + }, []); | |
67 | + | |
68 | + return ( | |
69 | + <ModalForm<{ | |
70 | + applyInvoicingNotes: string; | |
71 | + filePaths: any; | |
72 | + subIds: any[]; | |
73 | + afterInvoicingUpdate: boolean; | |
74 | + }> | |
75 | + width={500} | |
76 | + open | |
77 | + title={isEdit ? '修改信息' : '申请开票'} | |
78 | + initialValues={subOrders} | |
79 | + form={form} | |
80 | + autoFocusFirstInput | |
81 | + modalProps={{ | |
82 | + okText: '确认', | |
83 | + cancelText: '取消', | |
84 | + destroyOnClose: true, | |
85 | + onCancel: () => { | |
86 | + setCheckVisible(false); | |
87 | + }, | |
88 | + }} | |
89 | + submitter={{ | |
90 | + render: (props, defaultDoms) => { | |
91 | + return defaultDoms; | |
92 | + }, | |
93 | + }} | |
94 | + submitTimeout={2000} | |
95 | + onFinish={async (values) => { | |
96 | + values.subIds = ids; | |
97 | + //附件处理 | |
98 | + values.filePaths = values.filePaths?.map((item) => { | |
99 | + return { url: item.response.data[0] }; | |
100 | + }); | |
101 | + | |
102 | + if (isEdit) { | |
103 | + values.afterInvoicingUpdate = true; | |
104 | + } else { | |
105 | + values.afterInvoicingUpdate = false; | |
106 | + } | |
107 | + | |
108 | + const res = await postServiceOrderApplyInvoicing({ data: values }); | |
109 | + | |
110 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
111 | + message.success(res.message); | |
112 | + onClose(); | |
113 | + } | |
114 | + }} | |
115 | + onOpenChange={setCheckVisible} | |
116 | + > | |
117 | + {isMainOrder ? ( | |
118 | + <div className="mb-[24px]"> | |
119 | + <span>选中子订单金额之和:</span> | |
120 | + <span className="text-red-500">{sumPrice}¥</span> | |
121 | + </div> | |
122 | + ) : ( | |
123 | + '' | |
124 | + )} | |
125 | + | |
126 | + <div className="mb-1"> | |
127 | + 如果需要合并订单,请将需要合并的订单id写在备注中,id之间用英文逗号隔开。 | |
128 | + </div> | |
129 | + <ProFormTextArea | |
130 | + width="lg" | |
131 | + name="applyInvoicingNotes" | |
132 | + key="applyInvoicingNotes" | |
133 | + placeholder="请输入备注" | |
134 | + onMetaChange={(val) => { | |
135 | + console.log(val); | |
136 | + }} | |
137 | + proFieldProps={{ | |
138 | + onchange: () => { | |
139 | + message.info('change'); | |
140 | + }, | |
141 | + }} | |
142 | + /> | |
143 | + <ProFormText | |
144 | + width="lg" | |
145 | + name="purchaser" | |
146 | + label="抬头名称" | |
147 | + key="purchaser" | |
148 | + placeholder="请输入抬头名称" | |
149 | + rules={[{ required: true, message: '抬头名称必填' }]} | |
150 | + /> | |
151 | + <ProFormSelect | |
152 | + placeholder="选择收款单位" | |
153 | + name="receivingCompany" | |
154 | + width="lg" | |
155 | + key="receivingCompany" | |
156 | + label={ | |
157 | + <div> | |
158 | + <span>开票收款单位</span> | |
159 | + <span className="pl-2 text-xs text-gray-400"> | |
160 | + 财务开票将依据这个字段,选择对应的公司开票(若对[收款单位]没有要求,请任意选择一个) | |
161 | + </span> | |
162 | + </div> | |
163 | + } | |
164 | + options={enumToSelect(PAYEE_OPTIONS)} | |
165 | + rules={[{ required: true, message: '开票收款单位必填' }]} | |
166 | + /> | |
167 | + <ProFormSelect | |
168 | + placeholder="选择是否加急" | |
169 | + name="isUrgent" | |
170 | + width="lg" | |
171 | + key="isUrgent" | |
172 | + label="是否加急" | |
173 | + options={[ | |
174 | + { label: '是', value: 'true' }, | |
175 | + { label: '否', value: 'false' }, | |
176 | + ]} | |
177 | + rules={[{ required: true, message: '是否加急必填' }]} | |
178 | + onChange={(val: any) => { | |
179 | + setIsUrgent(val); | |
180 | + }} | |
181 | + /> | |
182 | + | |
183 | + {/* <ProFormDatePicker | |
184 | + key="deadline" | |
185 | + label="期望开票时间" | |
186 | + name="deadline" | |
187 | + rules={[{ required: isUrgent === 'true', message: '期望开票时间必填' }]} | |
188 | + hidden={isUrgent !== 'true'} | |
189 | + /> */} | |
190 | + | |
191 | + <ProFormTextArea | |
192 | + key="invoicingUrgentCause" | |
193 | + label="加急开票原因" | |
194 | + name="invoicingUrgentCause" | |
195 | + rules={[{ required: isUrgent === 'true', message: '加急开票原因' }]} | |
196 | + hidden={isUrgent !== 'true'} | |
197 | + /> | |
198 | + | |
199 | + <ProFormUploadDragger | |
200 | + key="2" | |
201 | + label={ | |
202 | + <div> | |
203 | + <span>开票明细确认表</span> | |
204 | + <span className="pl-2 text-xs text-gray-400"> | |
205 | + 如果开票信息有变更,如开票内容跟下单内容不一致、下单抬头和付款抬头不一致,请上传开票明细确认表。 | |
206 | + </span> | |
207 | + </div> | |
208 | + } | |
209 | + name="filePaths" | |
210 | + action="/api/service/order/fileProcess" | |
211 | + fieldProps={{ | |
212 | + headers: { Authorization: localStorage.getItem('token') }, | |
213 | + }} | |
214 | + /> | |
215 | + </ModalForm> | |
216 | + ); | |
217 | +}; | ... | ... |
src/pages/Order/FeedBack/AttachmentModal.tsx
0 → 100644
1 | +import { getAliYunOSSFileNameFromUrl, isImageName } from '@/utils'; | |
2 | +import { ModalForm } from '@ant-design/pro-components'; | |
3 | +import { Button, Card, Divider, Empty, Form, Image, List, message } from 'antd'; | |
4 | +import Base64 from 'base-64'; | |
5 | +import { cloneDeep } from 'lodash'; | |
6 | +import React, { useEffect, useState } from 'react'; | |
7 | + | |
8 | +export default ({ data, onClose }) => { | |
9 | + let newData = cloneDeep(data); | |
10 | + const [fileList, setFileList] = useState<[]>([]); | |
11 | + console.log(fileList); | |
12 | + const [form] = Form.useForm<{ | |
13 | + subOrderId: ''; | |
14 | + listAnnex: []; | |
15 | + }>(); | |
16 | + | |
17 | + let newListAnnex = newData.listAnnex?.map((path) => { | |
18 | + let i = 0; | |
19 | + return { | |
20 | + uid: i++, | |
21 | + name: getAliYunOSSFileNameFromUrl(path), | |
22 | + status: 'uploaded', | |
23 | + url: path, | |
24 | + response: { data: [path] }, | |
25 | + }; | |
26 | + }); | |
27 | + newData.listAnnex = newListAnnex; | |
28 | + | |
29 | + //将图片和其他文件区分开 | |
30 | + let images: any[] = []; | |
31 | + let otherAnnex: any[] = []; | |
32 | + newListAnnex.forEach((item: any) => { | |
33 | + if (isImageName(item.name)) { | |
34 | + images.push(item); | |
35 | + } else { | |
36 | + otherAnnex.push(item); | |
37 | + } | |
38 | + }); | |
39 | + | |
40 | + useEffect(() => { | |
41 | + setFileList(newData.listAnnex); | |
42 | + }, []); | |
43 | + | |
44 | + return ( | |
45 | + <ModalForm | |
46 | + width={800} | |
47 | + open | |
48 | + title="查看附件" | |
49 | + initialValues={newData} | |
50 | + form={form} | |
51 | + modalProps={{ | |
52 | + onCancel: onClose, | |
53 | + }} | |
54 | + submitter={{ | |
55 | + render: () => { | |
56 | + return [ | |
57 | + <Button | |
58 | + key="back" | |
59 | + onClick={() => { | |
60 | + onClose(); | |
61 | + }} | |
62 | + > | |
63 | + 返回 | |
64 | + </Button>, | |
65 | + ]; | |
66 | + }, | |
67 | + }} | |
68 | + > | |
69 | + {newListAnnex?.length <= 0 ? ( | |
70 | + <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> | |
71 | + ) : ( | |
72 | + // <ProFormUploadDragger | |
73 | + // name="listAnnex" | |
74 | + // action="/api/service/order/fileProcess" | |
75 | + // disabled | |
76 | + // fieldProps={{ | |
77 | + // headers: { Authorization: localStorage.getItem('token') }, | |
78 | + // // onRemove: (file) => { | |
79 | + // // const index = fileList[listMeta.index].indexOf(file); | |
80 | + // // console.log(index); | |
81 | + // // const newFileList = fileList.slice(); | |
82 | + // // newFileList.splice(index, 1); | |
83 | + // // setFileList(newFileList); | |
84 | + // // }, | |
85 | + // // beforeUpload: (file) => { | |
86 | + // // fileList[listMeta.index] = [...fileList[listMeta.index], file as RcFile]; | |
87 | + // // setFileList(fileList); | |
88 | + // // return true; | |
89 | + // // }, | |
90 | + // fileList, | |
91 | + // // defaultFileList: itemFileList | |
92 | + // }} | |
93 | + // /> | |
94 | + <> | |
95 | + <Card> | |
96 | + <Image.PreviewGroup | |
97 | + className="mr-10" | |
98 | + preview={{ | |
99 | + onChange: (current, prev) => | |
100 | + console.log(`current index: ${current}, prev index: ${prev}`), | |
101 | + }} | |
102 | + > | |
103 | + {images.map((item, index) => ( | |
104 | + <React.Fragment key={index}> | |
105 | + <Image | |
106 | + className="max-h-[200px] max-w-[200px]" | |
107 | + src={item.url} | |
108 | + title={item.name} | |
109 | + />{' '} | |
110 | + <Divider type="vertical" /> | |
111 | + </React.Fragment> | |
112 | + ))} | |
113 | + </Image.PreviewGroup> | |
114 | + </Card> | |
115 | + <Divider /> | |
116 | + | |
117 | + <div> | |
118 | + <List | |
119 | + size="small" | |
120 | + header={<div>其他类型文件</div>} | |
121 | + bordered | |
122 | + dataSource={otherAnnex} | |
123 | + renderItem={(item) => ( | |
124 | + <List.Item | |
125 | + actions={[ | |
126 | + <Button | |
127 | + type="link" | |
128 | + key="key" | |
129 | + href={item.url} | |
130 | + target="blank" | |
131 | + className="py-1" | |
132 | + > | |
133 | + 下载 | |
134 | + </Button>, | |
135 | + <Button | |
136 | + type="link" | |
137 | + key="key" | |
138 | + className="py-1" | |
139 | + onClick={() => { | |
140 | + message.info(item.url); | |
141 | + window.open( | |
142 | + '/previewApi/onlinePreview?url=' + | |
143 | + encodeURIComponent(Base64.encode(item.url)), | |
144 | + ); | |
145 | + }} | |
146 | + > | |
147 | + 预览 | |
148 | + </Button>, | |
149 | + ]} | |
150 | + > | |
151 | + <div> | |
152 | + <span>{item.name}</span> | |
153 | + </div> | |
154 | + </List.Item> | |
155 | + )} | |
156 | + /> | |
157 | + </div> | |
158 | + </> | |
159 | + )} | |
160 | + </ModalForm> | |
161 | + ); | |
162 | +}; | ... | ... |
src/pages/Order/FeedBack/BaseModal.tsx
0 → 100644
1 | +import { ModalForm } from '@ant-design/pro-components'; | |
2 | +import { Form } from 'antd'; | |
3 | + | |
4 | +// import { cloneDeep } from 'lodash'; | |
5 | +export default ({ setVisible, onClose }) => { | |
6 | + const [form] = Form.useForm<{ name: string; company: string }>(); | |
7 | + | |
8 | + return ( | |
9 | + <> | |
10 | + <ModalForm<{ | |
11 | + name: string; | |
12 | + company: string; | |
13 | + }> | |
14 | + width={500} | |
15 | + open | |
16 | + title="标题" | |
17 | + form={form} | |
18 | + autoFocusFirstInput | |
19 | + modalProps={{ | |
20 | + okText: '通过', | |
21 | + cancelText: '取消', | |
22 | + destroyOnClose: true, | |
23 | + onCancel: () => { | |
24 | + setVisible(false); | |
25 | + }, | |
26 | + }} | |
27 | + onFinish={async (values) => { | |
28 | + console.log(values); | |
29 | + onClose(); | |
30 | + }} | |
31 | + onOpenChange={setVisible} | |
32 | + ></ModalForm> | |
33 | + </> | |
34 | + ); | |
35 | +}; | ... | ... |
src/pages/Order/FeedBack/CheckModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postPrepaidAudit, | |
4 | + postServiceOrderAfterSalesCheck, | |
5 | + postServiceOrderAudit, | |
6 | + postServiceOrderFileProcess, | |
7 | + postServiceOrderFinanceCheckOrder, | |
8 | + postServiceOrderLeaderAudit, | |
9 | + postServiceOrderToProcureAudit, | |
10 | +} from '@/services'; | |
11 | +import { | |
12 | + ModalForm, | |
13 | + ProFormText, | |
14 | + ProFormTextArea, | |
15 | + ProList, | |
16 | +} from '@ant-design/pro-components'; | |
17 | +import { | |
18 | + Button, | |
19 | + Col, | |
20 | + Divider, | |
21 | + Form, | |
22 | + Image, | |
23 | + Modal, | |
24 | + Row, | |
25 | + Space, | |
26 | + Tag, | |
27 | + UploadFile, | |
28 | + message, | |
29 | +} from 'antd'; | |
30 | +import Upload, { RcFile, UploadProps } from 'antd/es/upload'; | |
31 | +import { useEffect, useRef, useState } from 'react'; | |
32 | +import { | |
33 | + AFTE_SALES_PLAN_OPTIONS, | |
34 | + CHECK_TYPE, | |
35 | + COMFIR_RECEIPT_IMAGES_NUMBER, | |
36 | +} from './constant'; | |
37 | +// import { cloneDeep } from 'lodash'; | |
38 | +import InvoiceSubOrderInfoTable from '@/pages/Order/Order/components/InvoiceSubOrderInfoTable'; | |
39 | +import { enumValueToLabel, transImageFile } from '@/utils'; | |
40 | +import { PlusOutlined } from '@ant-design/icons'; | |
41 | +import { cloneDeep } from 'lodash'; | |
42 | + | |
43 | +export default ({ | |
44 | + setCheckVisible, | |
45 | + data, | |
46 | + subOrders, | |
47 | + orderCheckType, | |
48 | + openOrderDrawer, | |
49 | + onClose, | |
50 | +}) => { | |
51 | + const [previewOpen, setPreviewOpen] = useState(false); | |
52 | + const [aPopoverTitle, setAPopoverTitle] = useState('审核'); | |
53 | + const [previewImage, setPreviewImage] = useState(''); | |
54 | + const [previewTitle, setPreviewTitle] = useState(''); | |
55 | + const [paymentReceiptsImages, setPymentReceiptsImages] = useState<any[]>([]); | |
56 | + const fileListObj = useRef<UploadFile[]>([]); //使用引用类型,使得在useEffect里面设置监听事件后,不用更新监听事件也能保持obj与外界一致 | |
57 | + const getBase64 = (file: RcFile): Promise<string> => | |
58 | + new Promise((resolve, reject) => { | |
59 | + const reader = new FileReader(); | |
60 | + reader.readAsDataURL(file); | |
61 | + reader.onload = () => resolve(reader.result as string); | |
62 | + reader.onerror = (error) => reject(error); | |
63 | + }); | |
64 | + const [fileList, setFileList] = useState<UploadFile[]>([]); | |
65 | + const handleCancel = () => setPreviewOpen(false); | |
66 | + const [messageApi, contextHolder] = message.useMessage(); | |
67 | + const [form] = Form.useForm<{ name: string; company: string }>(); | |
68 | + let subOrderIds: any[] = subOrders?.map((subOrder) => subOrder.id); | |
69 | + const [mainOrderId] = useState(data.id); | |
70 | + | |
71 | + const [afterSalesInfo, setAfterSalesInfo] = useState<any>(); | |
72 | + const [prepaidProofImages, setPrepaidProofImages] = useState<any[]>([]); | |
73 | + /** | |
74 | + * 审核类型 | |
75 | + */ | |
76 | + function checkType(check: string) { | |
77 | + if (orderCheckType === check) { | |
78 | + return true; | |
79 | + } | |
80 | + return false; | |
81 | + } | |
82 | + | |
83 | + const getOrderAfterSalesInfo = async () => { | |
84 | + // let res = await postServiceOrderQueryAfterSalesInfoSnapshot({ | |
85 | + // data: { subOrderIds: subOrderIds }, | |
86 | + // }); | |
87 | + | |
88 | + //附件 | |
89 | + let annex = subOrders[0].afterSalesAnnexList; | |
90 | + let index = 1; | |
91 | + let annexLinks = annex?.map((f) => { | |
92 | + return ( | |
93 | + <Button className="p-0 pr-1" type="link" key="key" href={f}> | |
94 | + {'附件' + index++} | |
95 | + </Button> | |
96 | + ); | |
97 | + }); | |
98 | + | |
99 | + console.log(annexLinks); | |
100 | + | |
101 | + setAfterSalesInfo( | |
102 | + <div className="my-5"> | |
103 | + <Row gutter={[16, 24]}> | |
104 | + <Col span={6}> | |
105 | + <span className="text-[#333333]">售后方案</span> | |
106 | + </Col> | |
107 | + <Col span={18}> | |
108 | + {enumValueToLabel( | |
109 | + subOrders[0]?.afterSalesPlan, | |
110 | + AFTE_SALES_PLAN_OPTIONS, | |
111 | + )} | |
112 | + </Col> | |
113 | + <Col span={6}> | |
114 | + <span className="className='text-[#333333]'">售后原因</span> | |
115 | + </Col> | |
116 | + <Col span={18}>{subOrders[0]?.afterSalesNotes}</Col> | |
117 | + <Col span={6}> | |
118 | + <span className="className='text-[#333333]'">附件</span> | |
119 | + </Col> | |
120 | + <Col span={18}>{annexLinks}</Col> | |
121 | + </Row> | |
122 | + </div>, | |
123 | + ); | |
124 | + }; | |
125 | + | |
126 | + useEffect(() => { | |
127 | + if (checkType(CHECK_TYPE.CONFIRM_DELIVER)) { | |
128 | + setAPopoverTitle('确认发货'); | |
129 | + } | |
130 | + getOrderAfterSalesInfo(); | |
131 | + | |
132 | + let paymentReceiptsImagesList: any[] = []; | |
133 | + subOrders?.forEach((item: any) => { | |
134 | + if (item.paymentReceiptAnnexList) { | |
135 | + paymentReceiptsImagesList.push(...item.paymentReceiptAnnexList); | |
136 | + } | |
137 | + }); | |
138 | + //去重 | |
139 | + paymentReceiptsImagesList = [...new Set(paymentReceiptsImagesList)]; | |
140 | + setPymentReceiptsImages(paymentReceiptsImagesList); | |
141 | + | |
142 | + //预存审核的凭证 | |
143 | + let proofImages: any[] = []; | |
144 | + subOrders?.forEach((item) => { | |
145 | + let images = item.proofImages; | |
146 | + if (images !== null && images !== undefined) { | |
147 | + proofImages.push(...images); | |
148 | + } | |
149 | + }); | |
150 | + setPrepaidProofImages(proofImages); | |
151 | + }, []); | |
152 | + | |
153 | + const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => { | |
154 | + //fileListObj得在change里变化,change的参数是已经处理过的file数组 | |
155 | + //beforeUpload中的参数file是未处理过,还需要Base64拿到文件数据处理 | |
156 | + fileListObj.current = newFileList; | |
157 | + setFileList(newFileList); | |
158 | + }; | |
159 | + | |
160 | + /** 粘贴快捷键的回调 */ | |
161 | + const onPaste = async (e: any) => { | |
162 | + /** 获取剪切板的数据clipboardData */ | |
163 | + let clipboardData = e.clipboardData, | |
164 | + i = 0, | |
165 | + items, | |
166 | + item, | |
167 | + types; | |
168 | + | |
169 | + /** 为空判断 */ | |
170 | + if (clipboardData) { | |
171 | + items = clipboardData.items; | |
172 | + if (!items) { | |
173 | + message.info('您的剪贴板中没有照片'); | |
174 | + return; | |
175 | + } | |
176 | + | |
177 | + item = items[0]; | |
178 | + types = clipboardData.types || []; | |
179 | + /** 遍历剪切板的数据 */ | |
180 | + for (; i < types.length; i++) { | |
181 | + if (types[i] === 'Files') { | |
182 | + item = items[i]; | |
183 | + break; | |
184 | + } | |
185 | + } | |
186 | + | |
187 | + /** 判断文件是否为图片 */ | |
188 | + if (item && item.kind === 'file' && item.type.match(/^image\//i)) { | |
189 | + const imgItem = item.getAsFile(); | |
190 | + const newFileList = cloneDeep(fileListObj.current); | |
191 | + let filteredArray = newFileList.filter( | |
192 | + (obj) => obj.status !== 'removed', | |
193 | + ); //过滤掉状态为已删除的照片 | |
194 | + const listItem = { | |
195 | + ...imgItem, | |
196 | + status: 'done', | |
197 | + url: await getBase64(imgItem), | |
198 | + originFileObj: imgItem, | |
199 | + }; | |
200 | + | |
201 | + if (filteredArray.length >= COMFIR_RECEIPT_IMAGES_NUMBER) { | |
202 | + message.info('发货照片数量不能超过3'); | |
203 | + return; | |
204 | + } | |
205 | + fileListObj.current = filteredArray; | |
206 | + filteredArray.push(listItem); | |
207 | + setFileList(filteredArray); | |
208 | + return; | |
209 | + } | |
210 | + } | |
211 | + | |
212 | + message.info('您的剪贴板中没有照片'); | |
213 | + }; | |
214 | + useEffect(() => { | |
215 | + //回显售后信息 | |
216 | + // if (checkType(CHECK_TYPE.AFTER_SALES)) { | |
217 | + // getOrderAfterSalesInfo(); | |
218 | + // } | |
219 | + | |
220 | + document.addEventListener('paste', onPaste); | |
221 | + return () => { | |
222 | + document.removeEventListener('paste', onPaste); | |
223 | + }; | |
224 | + }, []); | |
225 | + const uploadButton = ( | |
226 | + <div> | |
227 | + <PlusOutlined /> | |
228 | + <div style={{ marginTop: 8 }}>上传凭证</div> | |
229 | + </div> | |
230 | + ); | |
231 | + const handlePreview = async (file: UploadFile) => { | |
232 | + if (!file.url && !file.preview) { | |
233 | + file.preview = await getBase64(file.originFileObj as RcFile); | |
234 | + } | |
235 | + setPreviewImage(file.url || (file.preview as string)); | |
236 | + setPreviewOpen(true); | |
237 | + setPreviewTitle( | |
238 | + file.name || | |
239 | + file.originFileObj?.name || | |
240 | + file.url!.substring(file.url!.lastIndexOf('/') + 1), | |
241 | + ); | |
242 | + }; | |
243 | + | |
244 | + const handleBeforeUpload = (file: any) => { | |
245 | + setFileList([...fileList, file]); | |
246 | + return false; | |
247 | + }; | |
248 | + | |
249 | + const props: UploadProps = { | |
250 | + onRemove: (file) => { | |
251 | + const index = fileList.indexOf(file); | |
252 | + const newFileList = fileList.slice(); | |
253 | + newFileList.splice(index, 1); | |
254 | + setFileList(newFileList); | |
255 | + }, | |
256 | + beforeUpload: handleBeforeUpload, | |
257 | + listType: 'picture-card', | |
258 | + onPreview: handlePreview, | |
259 | + fileList, | |
260 | + onChange: handleChange, | |
261 | + accept: 'image/png, image/jpeg, image/png', | |
262 | + // action: '/api/service/order/fileProcess', | |
263 | + name: 'files', | |
264 | + headers: { Authorization: localStorage.getItem('token') }, | |
265 | + }; | |
266 | + | |
267 | + //仓库审核 | |
268 | + async function doCheck(body: object) { | |
269 | + const data = await postServiceOrderAudit({ | |
270 | + data: body, | |
271 | + }); | |
272 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
273 | + message.success(data.message); | |
274 | + onClose(); | |
275 | + } | |
276 | + } | |
277 | + | |
278 | + /** | |
279 | + * | |
280 | + * @param body 财务审核 | |
281 | + */ | |
282 | + async function doFinancailCheck(values: any, isAgree: boolean) { | |
283 | + if (fileList.length <= 0) { | |
284 | + message.error('凭证不能为空'); | |
285 | + return; | |
286 | + } | |
287 | + messageApi.open({ | |
288 | + type: 'loading', | |
289 | + content: '正在上传图片...', | |
290 | + duration: 0, | |
291 | + }); | |
292 | + //附件处理 | |
293 | + let formData = new FormData(); | |
294 | + //附件处理 | |
295 | + for (let file of fileList) { | |
296 | + if (file.originFileObj) { | |
297 | + formData.append('files', file.originFileObj as RcFile); | |
298 | + } else { | |
299 | + //有url的话取url(源文件),没url取thumbUrl。有url的时候thumbUrl是略缩图 | |
300 | + if (file?.url === undefined || file?.url === null) { | |
301 | + formData.append( | |
302 | + 'files', | |
303 | + transImageFile(file?.thumbUrl), | |
304 | + file?.originFileObj?.name, | |
305 | + ); | |
306 | + } else { | |
307 | + formData.append( | |
308 | + 'files', | |
309 | + transImageFile(file?.url), | |
310 | + file?.originFileObj?.name, | |
311 | + ); | |
312 | + } | |
313 | + } | |
314 | + } | |
315 | + let res = await postServiceOrderFileProcess({ | |
316 | + data: formData, | |
317 | + }); | |
318 | + messageApi.destroy(); | |
319 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
320 | + message.success('上传成功!'); | |
321 | + | |
322 | + let fileUrls = res?.data?.map((item) => { | |
323 | + return { url: item }; | |
324 | + }); | |
325 | + //财务审核 | |
326 | + const data = await postServiceOrderFinanceCheckOrder({ | |
327 | + data: { | |
328 | + ...values, | |
329 | + checkNotes: values.name, | |
330 | + ids: subOrderIds, | |
331 | + checkPassOrReject: isAgree, | |
332 | + invoicingCheckAnnex: fileUrls, | |
333 | + }, | |
334 | + }); | |
335 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
336 | + message.success(data.message); | |
337 | + onClose(); | |
338 | + } | |
339 | + } else { | |
340 | + message.success('上传失败'); | |
341 | + } | |
342 | + } | |
343 | + | |
344 | + /** | |
345 | + * | |
346 | + * @param body 售后审核 | |
347 | + */ | |
348 | + async function doAfterSalesCheck(body: object) { | |
349 | + const data = await postServiceOrderAfterSalesCheck({ | |
350 | + data: body, | |
351 | + }); | |
352 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
353 | + message.success(data.message); | |
354 | + onClose(); | |
355 | + } | |
356 | + } | |
357 | + | |
358 | + /** | |
359 | + * | |
360 | + * @param body 领导审核 | |
361 | + */ | |
362 | + async function doLeaderCheck(body: object) { | |
363 | + const data = await postServiceOrderLeaderAudit({ | |
364 | + data: body, | |
365 | + }); | |
366 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
367 | + message.success(data.message); | |
368 | + onClose(); | |
369 | + } | |
370 | + } | |
371 | + | |
372 | + /** | |
373 | + * 预存审核 | |
374 | + * @param body | |
375 | + */ | |
376 | + async function doPrepaidAudit(body: any) { | |
377 | + const data = await postPrepaidAudit({ | |
378 | + data: body, | |
379 | + }); | |
380 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
381 | + message.success(data.message); | |
382 | + onClose(); | |
383 | + } | |
384 | + } | |
385 | + | |
386 | + function computeType() { | |
387 | + let type: string = ''; | |
388 | + if (checkType(CHECK_TYPE.CONFIRM_DELIVER)) { | |
389 | + type = 'confirm_deliver'; | |
390 | + } | |
391 | + if (checkType(CHECK_TYPE.WEARHOUSE_KEEPER)) { | |
392 | + type = 'warehouse_audit'; | |
393 | + } | |
394 | + if (checkType(CHECK_TYPE.WAITING_FOR_POST_AUDIT)) { | |
395 | + type = 'post_audit'; | |
396 | + } | |
397 | + if (checkType(CHECK_TYPE.NODE_OPERATING_AUDIT)) { | |
398 | + type = 'node_operating_audit'; | |
399 | + } | |
400 | + if (checkType(CHECK_TYPE.MODIFY_LEADER_AUDIT)) { | |
401 | + type = 'modify_leader_audit'; | |
402 | + } | |
403 | + if (checkType(CHECK_TYPE.URGENT_INVOICE_AUDITING)) { | |
404 | + type = 'urgent_invoice_audit'; | |
405 | + } | |
406 | + if (checkType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT)) { | |
407 | + type = 'payment_receipt_audit'; | |
408 | + } | |
409 | + if (checkType(CHECK_TYPE.CONFIRM_REISSUE)) { | |
410 | + type = 'confirm_reissue'; | |
411 | + } | |
412 | + if (checkType(CHECK_TYPE.CREDIT_AUDIT)) { | |
413 | + type = 'credit_audit'; | |
414 | + } | |
415 | + if (checkType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD)) { | |
416 | + type = 'urgent_invoice_audit_old'; | |
417 | + } | |
418 | + if (checkType(CHECK_TYPE.CONFIRM_REISSUE_OLD)) { | |
419 | + type = 'confirm_reissue_old'; | |
420 | + } | |
421 | + return type; | |
422 | + } | |
423 | + | |
424 | + return ( | |
425 | + <> | |
426 | + <ModalForm<{ | |
427 | + name: string; | |
428 | + company: string; | |
429 | + }> | |
430 | + width={500} | |
431 | + open | |
432 | + title={aPopoverTitle} | |
433 | + form={form} | |
434 | + autoFocusFirstInput | |
435 | + modalProps={{ | |
436 | + okText: '通过', | |
437 | + cancelText: '驳回', | |
438 | + destroyOnClose: true, | |
439 | + onCancel: () => { | |
440 | + setCheckVisible(false); | |
441 | + }, | |
442 | + }} | |
443 | + submitter={{ | |
444 | + render: (props, defaultDoms) => { | |
445 | + let myDoms = []; | |
446 | + if (!checkType(CHECK_TYPE.CONFIRM_DELIVER)) { | |
447 | + myDoms.push( | |
448 | + <Button | |
449 | + key="驳回" | |
450 | + onClick={async () => { | |
451 | + if (checkType(CHECK_TYPE.AFTER_SALES)) { | |
452 | + doAfterSalesCheck({ | |
453 | + applyType: 'after-sales', | |
454 | + isAfterSalesSuccess: false, | |
455 | + subOrderIds: subOrderIds, | |
456 | + mainId: mainOrderId, | |
457 | + afterSalesRejectionNotes: form.getFieldValue('name'), | |
458 | + }); | |
459 | + return; | |
460 | + } | |
461 | + | |
462 | + if (checkType(CHECK_TYPE.FINALCIAL)) { | |
463 | + let values = { name: form.getFieldValue('name') }; | |
464 | + doFinancailCheck(values, false); | |
465 | + return; | |
466 | + } | |
467 | + | |
468 | + if (checkType(CHECK_TYPE.LEADER_AUDIT)) { | |
469 | + doLeaderCheck({ | |
470 | + pass: false, | |
471 | + subOrderIds: subOrderIds, | |
472 | + reason: form.getFieldValue('name'), | |
473 | + }); | |
474 | + return; | |
475 | + } | |
476 | + | |
477 | + if (checkType(CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT)) { | |
478 | + doAfterSalesCheck({ | |
479 | + applyType: 'order-change-normal', | |
480 | + isAfterSalesSuccess: false, | |
481 | + subOrderIds: subOrderIds, | |
482 | + mainId: mainOrderId, | |
483 | + afterSalesRejectionNotes: form.getFieldValue('name'), | |
484 | + }); | |
485 | + return; | |
486 | + } | |
487 | + | |
488 | + //预存审核,先暂时共用同一个审核弹窗 | |
489 | + if (checkType(CHECK_TYPE.PREPAID_AUDIT)) { | |
490 | + return doPrepaidAudit({ | |
491 | + pass: false, | |
492 | + ids: subOrderIds, | |
493 | + auditNotes: form.getFieldValue('name'), | |
494 | + }); | |
495 | + } | |
496 | + | |
497 | + let type = ''; | |
498 | + type = computeType(); | |
499 | + console.log('type:' + type); | |
500 | + doCheck({ | |
501 | + pass: false, | |
502 | + subOrderIds: subOrderIds, | |
503 | + type: type, | |
504 | + notes: form.getFieldValue('name'), | |
505 | + }); | |
506 | + }} | |
507 | + > | |
508 | + 驳回 | |
509 | + </Button>, | |
510 | + ); | |
511 | + } | |
512 | + | |
513 | + //如果是仓库审核,那么显示这个外部采购 | |
514 | + if (checkType(CHECK_TYPE.WEARHOUSE_KEEPER)) { | |
515 | + myDoms.push( | |
516 | + <Button | |
517 | + key="外部采购" | |
518 | + onClick={async () => { | |
519 | + let res = await postServiceOrderToProcureAudit({ | |
520 | + data: { | |
521 | + subOrderIds: subOrderIds, | |
522 | + }, | |
523 | + }); | |
524 | + | |
525 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
526 | + message.success(res.message); | |
527 | + onClose(); | |
528 | + } | |
529 | + }} | |
530 | + > | |
531 | + 外部采购 | |
532 | + </Button>, | |
533 | + ); | |
534 | + } | |
535 | + | |
536 | + //确认 | |
537 | + myDoms.push(defaultDoms[1]); | |
538 | + return myDoms; | |
539 | + }, | |
540 | + }} | |
541 | + submitTimeout={2000} | |
542 | + onFinish={async (values) => { | |
543 | + if (checkType(CHECK_TYPE.AFTER_SALES)) { | |
544 | + //审核通过 | |
545 | + return doAfterSalesCheck({ | |
546 | + applyType: 'after-sales', | |
547 | + isAfterSalesSuccess: true, | |
548 | + subOrderIds: subOrderIds, | |
549 | + mainId: mainOrderId, | |
550 | + afterSalesRejectionNotes: values.name, | |
551 | + }); | |
552 | + } | |
553 | + console.log('h'); | |
554 | + if (checkType(CHECK_TYPE.FINALCIAL)) { | |
555 | + doFinancailCheck(values, true); | |
556 | + return; | |
557 | + } | |
558 | + | |
559 | + if (checkType(CHECK_TYPE.LEADER_AUDIT)) { | |
560 | + doLeaderCheck({ | |
561 | + pass: true, | |
562 | + subOrderIds: subOrderIds, | |
563 | + reason: values.name, | |
564 | + }); | |
565 | + return; | |
566 | + } | |
567 | + | |
568 | + if (checkType(CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT)) { | |
569 | + //审核通过 | |
570 | + return doAfterSalesCheck({ | |
571 | + applyType: 'order-change-normal', | |
572 | + isAfterSalesSuccess: true, | |
573 | + subOrderIds: subOrderIds, | |
574 | + mainId: mainOrderId, | |
575 | + afterSalesRejectionNotes: values.name, | |
576 | + }); | |
577 | + } | |
578 | + | |
579 | + //预存审核,先暂时共用同一个审核弹窗 | |
580 | + if (checkType(CHECK_TYPE.PREPAID_AUDIT)) { | |
581 | + return doPrepaidAudit({ | |
582 | + pass: true, | |
583 | + ids: subOrderIds, | |
584 | + auditNotes: form.getFieldValue('name'), | |
585 | + }); | |
586 | + } | |
587 | + | |
588 | + let type = ''; | |
589 | + type = computeType(); | |
590 | + doCheck({ | |
591 | + ...values, | |
592 | + pass: true, | |
593 | + subOrderIds: subOrderIds, | |
594 | + type: type, | |
595 | + notes: form.getFieldValue('name'), | |
596 | + }); | |
597 | + }} | |
598 | + onOpenChange={setCheckVisible} | |
599 | + > | |
600 | + {checkType(CHECK_TYPE.AFTER_SALES) ? ( | |
601 | + <> | |
602 | + {afterSalesInfo} | |
603 | + <Button | |
604 | + className="px-0" | |
605 | + type="link" | |
606 | + onClick={() => { | |
607 | + console.log(data); | |
608 | + openOrderDrawer('after-sales-check', mainOrderId); | |
609 | + }} | |
610 | + > | |
611 | + 查看旧订单 | |
612 | + </Button> | |
613 | + </> | |
614 | + ) : ( | |
615 | + '' | |
616 | + )} | |
617 | + | |
618 | + {checkType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT) ? ( | |
619 | + <> | |
620 | + <Divider orientation="center"> | |
621 | + <span className="text-sm">回款凭证</span> | |
622 | + </Divider> | |
623 | + <Image.PreviewGroup | |
624 | + className="mr-10" | |
625 | + preview={{ | |
626 | + onChange: (current, prev) => | |
627 | + console.log(`current index: ${current}, prev index: ${prev}`), | |
628 | + }} | |
629 | + > | |
630 | + {paymentReceiptsImages.map((url) => ( | |
631 | + <> | |
632 | + <Image width={120} src={url} /> <Divider type="vertical" /> | |
633 | + </> | |
634 | + ))} | |
635 | + </Image.PreviewGroup> | |
636 | + <Divider></Divider> | |
637 | + </> | |
638 | + ) : ( | |
639 | + '' | |
640 | + )} | |
641 | + | |
642 | + {checkType(CHECK_TYPE.PREPAID_AUDIT) && ( | |
643 | + <> | |
644 | + <Divider orientation="center"> | |
645 | + <span className="text-sm">凭证</span> | |
646 | + </Divider> | |
647 | + <Image.PreviewGroup | |
648 | + className="mr-10" | |
649 | + preview={{ | |
650 | + onChange: (current, prev) => | |
651 | + console.log(`current index: ${current}, prev index: ${prev}`), | |
652 | + }} | |
653 | + > | |
654 | + {prepaidProofImages.map((url) => ( | |
655 | + <> | |
656 | + <Image width={120} src={url} /> <Divider type="vertical" /> | |
657 | + </> | |
658 | + ))} | |
659 | + </Image.PreviewGroup> | |
660 | + <Divider></Divider> | |
661 | + </> | |
662 | + )} | |
663 | + | |
664 | + {checkType('prepaidAudit') ? ( | |
665 | + <div>请特别注意手机号码和充值金额。</div> | |
666 | + ) : ( | |
667 | + <div>请特别注意订单总金额与订单金额。</div> | |
668 | + )} | |
669 | + {!checkType(CHECK_TYPE.CONFIRM_DELIVER) ? ( | |
670 | + <ProFormTextArea | |
671 | + width="lg" | |
672 | + name="name" | |
673 | + placeholder="若驳回,请填写驳回理由" | |
674 | + /> | |
675 | + ) : ( | |
676 | + <></> | |
677 | + )} | |
678 | + {checkType(CHECK_TYPE.FINALCIAL) ? ( | |
679 | + <> | |
680 | + <ProFormText | |
681 | + width="md" | |
682 | + name="bankStatementSerialNumbersText" | |
683 | + label="流水号" | |
684 | + rules={[ | |
685 | + { | |
686 | + required: true, | |
687 | + message: '请输入流水号!', | |
688 | + }, | |
689 | + ]} | |
690 | + placeholder={'多个流水号用逗号隔开'} | |
691 | + /> | |
692 | + <div className="pb-4 text-xs decoration-gray-50"> | |
693 | + 可复制照片粘贴 | |
694 | + </div> | |
695 | + <Upload {...props}> | |
696 | + {fileList.length < COMFIR_RECEIPT_IMAGES_NUMBER | |
697 | + ? uploadButton | |
698 | + : ''} | |
699 | + </Upload> | |
700 | + </> | |
701 | + ) : ( | |
702 | + '' | |
703 | + )} | |
704 | + {checkType(CHECK_TYPE.CONFIRM_REISSUE) && ( | |
705 | + <> | |
706 | + <InvoiceSubOrderInfoTable | |
707 | + subOrderIds={subOrderIds} | |
708 | + ></InvoiceSubOrderInfoTable> | |
709 | + </> | |
710 | + )} | |
711 | + {checkType(CHECK_TYPE.URGENT_INVOICE_AUDITING) ? ( | |
712 | + <> | |
713 | + <ProList | |
714 | + rowKey="id" | |
715 | + headerTitle="发票信息" | |
716 | + metas={{ | |
717 | + title: { | |
718 | + dataIndex: 'name', | |
719 | + }, | |
720 | + avatar: { | |
721 | + dataIndex: 'image', | |
722 | + editable: false, | |
723 | + }, | |
724 | + description: { | |
725 | + dataIndex: 'desc', | |
726 | + }, | |
727 | + subTitle: { | |
728 | + render: () => { | |
729 | + return ( | |
730 | + <Space size={0}> | |
731 | + <Tag color="blue">Ant Design</Tag> | |
732 | + <Tag color="#5BD8A6">TechUI</Tag> | |
733 | + </Space> | |
734 | + ); | |
735 | + }, | |
736 | + }, | |
737 | + actions: { | |
738 | + render: (text, row, index, action) => [ | |
739 | + <a | |
740 | + onClick={() => { | |
741 | + action?.startEditable(row.id); | |
742 | + }} | |
743 | + key="link" | |
744 | + > | |
745 | + 编辑 | |
746 | + </a>, | |
747 | + ], | |
748 | + }, | |
749 | + }} | |
750 | + ></ProList> | |
751 | + </> | |
752 | + ) : ( | |
753 | + '' | |
754 | + )} | |
755 | + </ModalForm> | |
756 | + | |
757 | + <Modal | |
758 | + open={previewOpen} | |
759 | + title={previewTitle} | |
760 | + footer={null} | |
761 | + onCancel={handleCancel} | |
762 | + > | |
763 | + <img alt="图片预览" style={{ width: '100%' }} src={previewImage} /> | |
764 | + </Modal> | |
765 | + {contextHolder} | |
766 | + </> | |
767 | + ); | |
768 | +}; | ... | ... |
src/pages/Order/FeedBack/ConfirmReceiptModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderConfirmReceipt } from '@/services'; | |
3 | +import { PlusOutlined } from '@ant-design/icons'; | |
4 | +import { Button, Modal, Upload, message } from 'antd'; | |
5 | +import { RcFile, UploadFile, UploadProps } from 'antd/es/upload'; | |
6 | +import { cloneDeep } from 'lodash'; | |
7 | +import { useEffect, useRef, useState } from 'react'; | |
8 | +import { COMFIR_RECEIPT_IMAGES_NUMBER } from './constant'; | |
9 | +export default ({ data, onClose }) => { | |
10 | + const subIds = data?.map((item) => { | |
11 | + return item.id; | |
12 | + }); | |
13 | + // const [form] = Form.useForm<{ name: string; company: string }>(); | |
14 | + const [previewOpen, setPreviewOpen] = useState(false); | |
15 | + const [previewImage, setPreviewImage] = useState(''); | |
16 | + const [previewTitle, setPreviewTitle] = useState(''); | |
17 | + const fileListObj = useRef<UploadFile[]>([]); //使用引用类型,使得在useEffect里面设置监听事件后,不用更新监听事件也能保持obj与外界一致 | |
18 | + const getBase64 = (file: RcFile): Promise<string> => | |
19 | + new Promise((resolve, reject) => { | |
20 | + const reader = new FileReader(); | |
21 | + reader.readAsDataURL(file); | |
22 | + reader.onload = () => resolve(reader.result as string); | |
23 | + reader.onerror = (error) => reject(error); | |
24 | + }); | |
25 | + const [fileList, setFileList] = useState<UploadFile[]>([]); | |
26 | + const [uploading, setUploading] = useState(false); | |
27 | + const handleCancel = () => setPreviewOpen(false); | |
28 | + | |
29 | + const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => { | |
30 | + //fileListObj得在change里变化,change的参数是已经处理过的file数组 | |
31 | + //beforeUpload中的参数file是未处理过,还需要Base64拿到文件数据处理 | |
32 | + fileListObj.current = newFileList; | |
33 | + setFileList(newFileList); | |
34 | + }; | |
35 | + | |
36 | + /** 粘贴快捷键的回调 */ | |
37 | + const onPaste = async (e: any) => { | |
38 | + /** 获取剪切板的数据clipboardData */ | |
39 | + let clipboardData = e.clipboardData, | |
40 | + i = 0, | |
41 | + items, | |
42 | + item, | |
43 | + types; | |
44 | + | |
45 | + /** 为空判断 */ | |
46 | + if (clipboardData) { | |
47 | + items = clipboardData.items; | |
48 | + if (!items) { | |
49 | + message.info('您的剪贴板中没有照片'); | |
50 | + return; | |
51 | + } | |
52 | + | |
53 | + item = items[0]; | |
54 | + types = clipboardData.types || []; | |
55 | + /** 遍历剪切板的数据 */ | |
56 | + for (; i < types.length; i++) { | |
57 | + if (types[i] === 'Files') { | |
58 | + item = items[i]; | |
59 | + break; | |
60 | + } | |
61 | + } | |
62 | + | |
63 | + /** 判断文件是否为图片 */ | |
64 | + if (item && item.kind === 'file' && item.type.match(/^image\//i)) { | |
65 | + const imgItem = item.getAsFile(); | |
66 | + const newFileList = cloneDeep(fileListObj.current); | |
67 | + let filteredArray = newFileList.filter( | |
68 | + (obj) => obj.status !== 'removed', | |
69 | + ); //过滤掉状态为已删除的照片 | |
70 | + const listItem = { | |
71 | + ...imgItem, | |
72 | + status: 'done', | |
73 | + url: await getBase64(imgItem), | |
74 | + originFileObj: imgItem, | |
75 | + }; | |
76 | + | |
77 | + if (filteredArray.length >= COMFIR_RECEIPT_IMAGES_NUMBER) { | |
78 | + message.info('发货凭证照片数量不能超过3'); | |
79 | + return; | |
80 | + } | |
81 | + fileListObj.current = filteredArray; | |
82 | + filteredArray.push(listItem); | |
83 | + setFileList(filteredArray); | |
84 | + return; | |
85 | + } | |
86 | + } | |
87 | + | |
88 | + message.info('您的剪贴板中没有照片'); | |
89 | + }; | |
90 | + useEffect(() => { | |
91 | + document.addEventListener('paste', onPaste); | |
92 | + return () => { | |
93 | + document.removeEventListener('paste', onPaste); | |
94 | + }; | |
95 | + }, []); | |
96 | + const uploadButton = ( | |
97 | + <div> | |
98 | + <PlusOutlined /> | |
99 | + <div style={{ marginTop: 8 }}>上传凭证</div> | |
100 | + </div> | |
101 | + ); | |
102 | + const handlePreview = async (file: UploadFile) => { | |
103 | + if (!file.url && !file.preview) { | |
104 | + file.preview = await getBase64(file.originFileObj as RcFile); | |
105 | + } | |
106 | + setPreviewImage(file.url || (file.preview as string)); | |
107 | + setPreviewOpen(true); | |
108 | + setPreviewTitle( | |
109 | + file.name || | |
110 | + file.originFileObj?.name || | |
111 | + file.url!.substring(file.url!.lastIndexOf('/') + 1), | |
112 | + ); | |
113 | + }; | |
114 | + | |
115 | + const handleUpload = async () => { | |
116 | + const formData = new FormData(); | |
117 | + fileList.forEach((file) => { | |
118 | + //originFileObj二进制文件 | |
119 | + formData.append('files', file.originFileObj as RcFile); | |
120 | + }); | |
121 | + // console.log(fileList[0] as RcFile) | |
122 | + // formData.append('file', fileList[0] as RcFile); | |
123 | + formData.append('subIds', subIds); | |
124 | + setUploading(true); | |
125 | + // You can use any AJAX library you like | |
126 | + const res = await postServiceOrderConfirmReceipt({ | |
127 | + data: formData, | |
128 | + headers: { | |
129 | + 'Content-Type': | |
130 | + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | |
131 | + }, | |
132 | + }); | |
133 | + | |
134 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
135 | + message.success(res.message); | |
136 | + onClose(); | |
137 | + } | |
138 | + | |
139 | + setUploading(false); | |
140 | + }; | |
141 | + | |
142 | + const props: UploadProps = { | |
143 | + onRemove: (file) => { | |
144 | + const index = fileList.indexOf(file); | |
145 | + const newFileList = fileList.slice(); | |
146 | + newFileList.splice(index, 1); | |
147 | + setFileList(newFileList); | |
148 | + }, | |
149 | + beforeUpload: (file) => { | |
150 | + setFileList([...fileList, file]); | |
151 | + return false; | |
152 | + }, | |
153 | + listType: 'picture-card', | |
154 | + onPreview: handlePreview, | |
155 | + fileList, | |
156 | + onChange: handleChange, | |
157 | + accept: 'image/png, image/jpeg, image/png', | |
158 | + }; | |
159 | + | |
160 | + return ( | |
161 | + <> | |
162 | + <Modal | |
163 | + width={500} | |
164 | + open | |
165 | + title="确认收货" | |
166 | + footer={[ | |
167 | + <Button key="cancel" onClick={onClose}> | |
168 | + 取消 | |
169 | + </Button>, | |
170 | + <Button | |
171 | + type="primary" | |
172 | + key="ok" | |
173 | + onClick={handleUpload} | |
174 | + disabled={fileList.length === 0} | |
175 | + loading={uploading} | |
176 | + > | |
177 | + {uploading ? '上传中' : '提交'} | |
178 | + </Button>, | |
179 | + ]} | |
180 | + onCancel={async () => { | |
181 | + onClose(); | |
182 | + }} | |
183 | + > | |
184 | + <div className="pt-4 font-semibold">请将买家确认收货的凭证照片上传</div> | |
185 | + <div className="pb-4 text-xs decoration-gray-50">可复制照片粘贴</div> | |
186 | + <Upload {...props}> | |
187 | + {fileList.length < COMFIR_RECEIPT_IMAGES_NUMBER ? uploadButton : ''} | |
188 | + </Upload> | |
189 | + </Modal> | |
190 | + <Modal | |
191 | + open={previewOpen} | |
192 | + title={previewTitle} | |
193 | + footer={null} | |
194 | + onCancel={handleCancel} | |
195 | + > | |
196 | + <img alt="图片预览" style={{ width: '100%' }} src={previewImage} /> | |
197 | + </Modal> | |
198 | + </> | |
199 | + ); | |
200 | +}; | ... | ... |
src/pages/Order/FeedBack/DeliverInfoDrawer.tsx
0 → 100644
1 | +import { postDistrictSelOrderProvince } from '@/services'; | |
2 | +import { enumValueToLabel } from '@/utils'; | |
3 | +import { getReceivingCompanyOptions } from '@/utils/order'; | |
4 | +import { Col, Drawer, Row } from 'antd'; | |
5 | +import { useEffect, useState } from 'react'; | |
6 | +import { PAYEE_OPTIONS } from './constant'; | |
7 | + | |
8 | +export default ({ data, onClose }) => { | |
9 | + const [province, setProvince] = useState(''); | |
10 | + const [city, setCity] = useState(''); | |
11 | + const [district, setDistrict] = useState(''); | |
12 | + | |
13 | + useEffect(() => { | |
14 | + const fetchData = async () => { | |
15 | + if (data.id !== undefined) { | |
16 | + const resp = await postDistrictSelOrderProvince({ | |
17 | + data: data.id, | |
18 | + }); | |
19 | + if (resp && resp.data) { | |
20 | + if (resp.data.province) { | |
21 | + setProvince(resp.data.province); | |
22 | + } | |
23 | + if (resp.data.city) { | |
24 | + setCity(resp.data.city); | |
25 | + } | |
26 | + if (resp.data.district) { | |
27 | + setDistrict(resp.data.district); | |
28 | + } | |
29 | + } | |
30 | + } | |
31 | + }; | |
32 | + | |
33 | + fetchData(); | |
34 | + }, [data.id]); | |
35 | + return ( | |
36 | + <> | |
37 | + <Drawer | |
38 | + width={500} | |
39 | + title="基本信息" | |
40 | + placement="right" | |
41 | + onClose={onClose} | |
42 | + open | |
43 | + > | |
44 | + <Row gutter={[16, 24]}> | |
45 | + <Col span={6}> | |
46 | + <span className="text-[#333333]">收货人</span> | |
47 | + </Col> | |
48 | + <Col span={18}>{data.customerName}</Col> | |
49 | + <Col span={6}> | |
50 | + <span className="className='text-[#333333]'">联系方式</span> | |
51 | + </Col> | |
52 | + <Col span={18}>{data.customerContactNumber}</Col> | |
53 | + <Col span={6}> | |
54 | + <span className="className='text-[#333333]'">省市区</span> | |
55 | + </Col> | |
56 | + <Col span={18}> | |
57 | + {province} {city} {district} | |
58 | + </Col> | |
59 | + <Col span={6}> | |
60 | + <span className="className='text-[#333333]'">收货地址</span> | |
61 | + </Col> | |
62 | + <Col span={18}>{data.customerShippingAddress}</Col> | |
63 | + <Col span={6}> | |
64 | + <span className="className='text-[#333333]'">课题组老师</span> | |
65 | + </Col> | |
66 | + <Col span={18}>{data.institutionContactName}</Col> | |
67 | + <Col span={6}> | |
68 | + <span className="className='text-[#333333]'">单位名称</span> | |
69 | + </Col> | |
70 | + <Col span={18}>{data.institution}</Col> | |
71 | + <Col span={6}> | |
72 | + <span className="className='text-[#333333]'">开户银行</span> | |
73 | + </Col> | |
74 | + <Col span={18}>{data.bank}</Col> | |
75 | + | |
76 | + <Col span={6}> | |
77 | + <span className="className='text-[#333333]'">开票收款单位</span> | |
78 | + </Col> | |
79 | + <Col span={18}> | |
80 | + {enumValueToLabel( | |
81 | + data.receivingCompany, | |
82 | + getReceivingCompanyOptions(PAYEE_OPTIONS), | |
83 | + )} | |
84 | + </Col> | |
85 | + | |
86 | + <Col span={6}> | |
87 | + <span className="className='text-[#333333]'">银行账号</span> | |
88 | + </Col> | |
89 | + <Col span={18}>{data.bankAccountNumber}</Col> | |
90 | + <Col span={6}> | |
91 | + <span className="className='text-[#333333]'">开票识别号</span> | |
92 | + </Col> | |
93 | + <Col span={18}>{data.invoiceIdentificationNumber}</Col> | |
94 | + </Row> | |
95 | + </Drawer> | |
96 | + </> | |
97 | + ); | |
98 | +}; | ... | ... |
src/pages/Order/FeedBack/DeliverModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postServiceOrderProcureSend, | |
4 | + postServiceOrderSendProduct, | |
5 | + postServiceOrderSupplierSendOrder, | |
6 | +} from '@/services'; | |
7 | +import { enumToSelect } from '@/utils'; | |
8 | +import { | |
9 | + ProColumns, | |
10 | + ProForm, | |
11 | + ProFormSelect, | |
12 | + ProFormText, | |
13 | + ProTable, | |
14 | +} from '@ant-design/pro-components'; | |
15 | +import { | |
16 | + Button, | |
17 | + Col, | |
18 | + Flex, | |
19 | + Input, | |
20 | + InputNumber, | |
21 | + Modal, | |
22 | + Row, | |
23 | + Select, | |
24 | + message, | |
25 | +} from 'antd'; | |
26 | +import { cloneDeep } from 'lodash'; | |
27 | +import { useEffect, useRef, useState } from 'react'; | |
28 | +import { CHECK_TYPE, LOGISTICS_STATUS_OPTIONS } from '../constant'; | |
29 | + | |
30 | +const DeliverModal = ({ | |
31 | + data: propsData, | |
32 | + isSendProduct, | |
33 | + setVisible, | |
34 | + sendType, | |
35 | + onClose, | |
36 | +}) => { | |
37 | + const [data, setData] = useState(propsData || {}); | |
38 | + const form = useRef(); | |
39 | + | |
40 | + /** | |
41 | + * 是供应商发货还是普通发货 | |
42 | + * @param typeString | |
43 | + * @returns | |
44 | + */ | |
45 | + function optType(typeString: string) { | |
46 | + if (sendType === typeString) { | |
47 | + return true; | |
48 | + } | |
49 | + | |
50 | + return false; | |
51 | + } | |
52 | + | |
53 | + useEffect(() => { | |
54 | + setData(propsData); | |
55 | + }, [propsData]); | |
56 | + | |
57 | + const handleChange = (key: string, index: number, obj: any) => { | |
58 | + const newData = cloneDeep(data); | |
59 | + if (typeof obj !== 'object') { | |
60 | + newData[index][key] = obj; | |
61 | + } else { | |
62 | + newData[index][key] = obj.target?.value; | |
63 | + } | |
64 | + setData(newData); | |
65 | + }; | |
66 | + const columns: ProColumns<any>[] = [ | |
67 | + { | |
68 | + title: 'ID', | |
69 | + dataIndex: 'id', | |
70 | + width: 120, | |
71 | + render: (_, record) => <Input value={record.id} disabled />, | |
72 | + }, | |
73 | + { | |
74 | + title: '商品编号', | |
75 | + dataIndex: 'productCode', | |
76 | + width: 120, | |
77 | + render: (_, record) => <Input value={record.productCode} disabled />, | |
78 | + }, | |
79 | + { | |
80 | + title: '商品名称', | |
81 | + dataIndex: 'productName', | |
82 | + width: 120, | |
83 | + render: (_, record) => <Input value={record.productName} disabled />, | |
84 | + }, | |
85 | + { | |
86 | + title: '商品参数', | |
87 | + dataIndex: 'parameters', | |
88 | + width: 80, | |
89 | + render: (_, record) => <Input value={record.parameters} disabled />, | |
90 | + }, | |
91 | + { | |
92 | + title: '商品数量', | |
93 | + dataIndex: 'status', | |
94 | + render: (_, record) => <InputNumber value={record.quantity} disabled />, | |
95 | + }, | |
96 | + { | |
97 | + title: '包裹数量', | |
98 | + dataIndex: 'packageNumber', | |
99 | + render: (_, record, index) => ( | |
100 | + <InputNumber | |
101 | + min={1} | |
102 | + value={record.packageNumber} | |
103 | + defaultValue={1} | |
104 | + onChange={(value) => handleChange('packageNumber', index, value)} | |
105 | + /> | |
106 | + ), | |
107 | + }, | |
108 | + { | |
109 | + title: '物流方式', | |
110 | + key: 'logisticsMethod', | |
111 | + render: (_, record, index) => ( | |
112 | + <Select | |
113 | + style={{ minWidth: 150 }} | |
114 | + placeholder="请输入物流方式" | |
115 | + value={record.logisticsMethod} | |
116 | + options={enumToSelect(LOGISTICS_STATUS_OPTIONS)} | |
117 | + onChange={(value) => { | |
118 | + handleChange('logisticsMethod', index, value); //修改时更改record数据 | |
119 | + if (value === 'OTHER_LOGISTICS') { | |
120 | + message.info( | |
121 | + '您选择的是[其他物流方式],请将该物流方式写在备注中', | |
122 | + ); | |
123 | + } | |
124 | + }} | |
125 | + /> | |
126 | + ), | |
127 | + }, | |
128 | + { | |
129 | + title: '物流单号', | |
130 | + key: 'serialNumber', | |
131 | + render: (_, record, index) => ( | |
132 | + <Input | |
133 | + placeholder="请输入物流单号" | |
134 | + value={record.serialNumber} | |
135 | + onChange={(value) => { | |
136 | + handleChange('serialNumber', index, value); | |
137 | + }} | |
138 | + /> | |
139 | + ), | |
140 | + }, | |
141 | + { | |
142 | + title: '物流备注', | |
143 | + dataIndex: 'packageNumber', | |
144 | + render: (_, record, index) => ( | |
145 | + <Input.TextArea | |
146 | + value={record.logisticsNotes} | |
147 | + onChange={(value) => handleChange('logisticsNotes', index, value)} | |
148 | + /> | |
149 | + ), | |
150 | + }, | |
151 | + ]; | |
152 | + | |
153 | + return ( | |
154 | + <Modal | |
155 | + open | |
156 | + width={1000} | |
157 | + title={isSendProduct ? '发货' : '修改发货信息'} | |
158 | + onOk={async () => { | |
159 | + //请求体封装 | |
160 | + let list = data.map((item) => { | |
161 | + return { | |
162 | + id: item.id, | |
163 | + logisticsMethod: item.logisticsMethod, | |
164 | + serialNumber: item.serialNumber, | |
165 | + packageNumber: | |
166 | + item.packageNumber === null || item.packageNumber === undefined | |
167 | + ? 1 | |
168 | + : item.packageNumber, | |
169 | + logisticsNotes: item.logisticsNotes, | |
170 | + }; | |
171 | + }); | |
172 | + | |
173 | + for (let item of list) { | |
174 | + let method = item.logisticsMethod; | |
175 | + let notes = item.logisticsNotes; | |
176 | + if ( | |
177 | + method === 'OTHER_LOGISTICS' && | |
178 | + (notes === '' || notes === undefined) | |
179 | + ) { | |
180 | + message.error( | |
181 | + '请检查:物流方式为[其他物流方式]的记录中,物流备注不能为空!请将实际的物流方式填写在备注中!', | |
182 | + ); | |
183 | + return; | |
184 | + } | |
185 | + } | |
186 | + let body = { id: data[0].mainOrderId, list: list, flag: false }; | |
187 | + if (isSendProduct) { | |
188 | + body.flag = true; | |
189 | + } | |
190 | + //发货请求 | |
191 | + let res; | |
192 | + if (optType(CHECK_TYPE.SUPPLIER)) { | |
193 | + res = await postServiceOrderSupplierSendOrder({ data: body }); | |
194 | + } else if (optType(CHECK_TYPE.PROCURE)) { | |
195 | + res = await postServiceOrderProcureSend({ data: body }); | |
196 | + } else { | |
197 | + res = await postServiceOrderSendProduct({ data: body }); | |
198 | + } | |
199 | + | |
200 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
201 | + message.success(res.message); | |
202 | + onClose(); | |
203 | + } | |
204 | + }} | |
205 | + onCancel={() => { | |
206 | + setVisible(false); | |
207 | + }} | |
208 | + footer={[ | |
209 | + <Button | |
210 | + key="back" | |
211 | + onClick={() => { | |
212 | + setVisible(false); | |
213 | + }} | |
214 | + > | |
215 | + 取消 | |
216 | + </Button>, | |
217 | + <Button | |
218 | + key="selfDeliver" | |
219 | + type="primary" | |
220 | + onClick={async () => { | |
221 | + //请求体封装 | |
222 | + let list = data.map((item) => { | |
223 | + return { | |
224 | + id: item.id, | |
225 | + deliverType: 'SELF_DELIVER', | |
226 | + }; | |
227 | + }); | |
228 | + | |
229 | + let body = { id: data[0].mainOrderId, list: list, flag: false }; | |
230 | + if (isSendProduct) { | |
231 | + body.flag = true; | |
232 | + } | |
233 | + //发货请求 | |
234 | + let res; | |
235 | + if (optType(CHECK_TYPE.SUPPLIER)) { | |
236 | + res = await postServiceOrderSupplierSendOrder({ data: body }); | |
237 | + } else if (optType(CHECK_TYPE.PROCURE)) { | |
238 | + res = await postServiceOrderProcureSend({ data: body }); | |
239 | + } else { | |
240 | + res = await postServiceOrderSendProduct({ data: body }); | |
241 | + } | |
242 | + | |
243 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
244 | + message.success(res.message); | |
245 | + onClose(); | |
246 | + } | |
247 | + }} | |
248 | + > | |
249 | + 自行派送 | |
250 | + </Button>, | |
251 | + <Button | |
252 | + key="submit" | |
253 | + type="primary" | |
254 | + onClick={async () => { | |
255 | + //请求体封装 | |
256 | + let list = data.map((item) => { | |
257 | + return { | |
258 | + id: item.id, | |
259 | + logisticsMethod: item.logisticsMethod, | |
260 | + serialNumber: item.serialNumber, | |
261 | + packageNumber: | |
262 | + item.packageNumber === null || | |
263 | + item.packageNumber === undefined | |
264 | + ? 1 | |
265 | + : item.packageNumber, | |
266 | + logisticsNotes: item.logisticsNotes, | |
267 | + }; | |
268 | + }); | |
269 | + | |
270 | + for (let item of list) { | |
271 | + let method = item.logisticsMethod; | |
272 | + let notes = item.logisticsNotes; | |
273 | + if ( | |
274 | + method === 'OTHER_LOGISTICS' && | |
275 | + (notes === '' || notes === undefined) | |
276 | + ) { | |
277 | + message.error( | |
278 | + '请检查:物流方式为[其他物流方式]的记录中,物流备注不能为空!请将实际的物流方式填写在备注中!', | |
279 | + ); | |
280 | + return; | |
281 | + } | |
282 | + } | |
283 | + let body = { id: data[0].mainOrderId, list: list, flag: false }; | |
284 | + if (isSendProduct) { | |
285 | + body.flag = true; | |
286 | + } | |
287 | + //发货请求 | |
288 | + let res; | |
289 | + if (optType(CHECK_TYPE.SUPPLIER)) { | |
290 | + res = await postServiceOrderSupplierSendOrder({ data: body }); | |
291 | + } else if (optType(CHECK_TYPE.PROCURE)) { | |
292 | + res = await postServiceOrderProcureSend({ data: body }); | |
293 | + } else { | |
294 | + res = await postServiceOrderSendProduct({ data: body }); | |
295 | + } | |
296 | + | |
297 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
298 | + message.success(res.message); | |
299 | + onClose(); | |
300 | + } | |
301 | + }} | |
302 | + > | |
303 | + 确认 | |
304 | + </Button>, | |
305 | + ]} | |
306 | + > | |
307 | + <Flex vertical> | |
308 | + <strong>将物流方式和物流单号更新到下方所有订单</strong> | |
309 | + <span className="text-[red] py-1"> | |
310 | + 选择【其他物流方式】时,需要将对应的物流方式填写在备注中。例如:如果发圆通快递,系统上没有这个选项,就需要选【其他物流方式】,然后把“圆通快递”填在备注上。 | |
311 | + </span> | |
312 | + </Flex> | |
313 | + | |
314 | + <ProForm | |
315 | + layout="inline" | |
316 | + submitter={false} | |
317 | + className="mb-8" | |
318 | + formRef={form} | |
319 | + > | |
320 | + <Row gutter={[0, 6]}> | |
321 | + <Col> | |
322 | + <ProFormSelect | |
323 | + placeholder="请输入物流方式" | |
324 | + name="logisticsMethod" | |
325 | + width="sm" | |
326 | + label="物流方式" | |
327 | + options={enumToSelect(LOGISTICS_STATUS_OPTIONS)} | |
328 | + /> | |
329 | + <ProFormText name="logisticsNotes" label="物流备注"></ProFormText> | |
330 | + </Col> | |
331 | + <Col> | |
332 | + <ProFormText name="serialNumber" label="物流单号"></ProFormText> | |
333 | + </Col> | |
334 | + </Row> | |
335 | + | |
336 | + <Button | |
337 | + type="primary" | |
338 | + onClick={() => { | |
339 | + const values = form.current.getFieldsValue(); | |
340 | + if (values.logisticsMethod === 'OTHER_LOGISTICS') { | |
341 | + message.info( | |
342 | + '自动填充成功!您选择的是其他物流方式,请将物流方式写在物流备注中!', | |
343 | + ); | |
344 | + } | |
345 | + let newData = cloneDeep(data); | |
346 | + newData = newData.map((item) => ({ | |
347 | + ...item, | |
348 | + logisticsMethod: values.logisticsMethod, | |
349 | + serialNumber: values.serialNumber, | |
350 | + logisticsNotes: values.logisticsNotes, | |
351 | + })); | |
352 | + setData(newData); | |
353 | + }} | |
354 | + > | |
355 | + 批量更新 | |
356 | + </Button> | |
357 | + </ProForm> | |
358 | + <ProTable<any> | |
359 | + className="px-0" | |
360 | + dataSource={data} | |
361 | + rowKey="id" | |
362 | + pagination={false} | |
363 | + columns={columns} | |
364 | + search={false} | |
365 | + dateFormatter="string" | |
366 | + options={false} | |
367 | + scroll={{ x: 1400 }} | |
368 | + /> | |
369 | + </Modal> | |
370 | + ); | |
371 | +}; | |
372 | + | |
373 | +export default DeliverModal; | ... | ... |
src/pages/Order/FeedBack/FeedbackRegistrationModal.tsx
0 → 100644
1 | +import { postServiceOrderFeedbackRegistration } from '@/services/request'; | |
2 | +import { Input, Modal } from 'antd'; | |
3 | +import { useState } from 'react'; | |
4 | + | |
5 | +// import { cloneDeep } from 'lodash'; | |
6 | +export default ({ setVisible, subOrders, mainOrder, onClose }) => { | |
7 | + const [isModalOpen] = useState(true); | |
8 | + const { TextArea } = Input; | |
9 | + const [textValue, setTextValue] = useState(''); | |
10 | + | |
11 | + const handleOk = async () => { | |
12 | + console.log(subOrders, '5656subOrders', mainOrder); | |
13 | + await postServiceOrderFeedbackRegistration({ | |
14 | + data: { | |
15 | + id: subOrders[0].id, | |
16 | + feedbackRegistrationContent: textValue, | |
17 | + }, | |
18 | + }); | |
19 | + onClose(); | |
20 | + // setIsModalOpen(false); | |
21 | + // onClose(); | |
22 | + }; | |
23 | + const handleCancel = () => { | |
24 | + setVisible(false); | |
25 | + onClose(); | |
26 | + // setIsModalOpen(false); | |
27 | + // onClose(); | |
28 | + }; | |
29 | + const handleChange = (e) => { | |
30 | + setTextValue(e.target.value); | |
31 | + }; | |
32 | + return ( | |
33 | + <> | |
34 | + {/* <ModalForm<{ | |
35 | + filePaths: any; | |
36 | + }> | |
37 | + width={500} | |
38 | + open | |
39 | + title="回访登记" | |
40 | + form={form} | |
41 | + autoFocusFirstInput | |
42 | + modalProps={{ | |
43 | + okText: '提交', | |
44 | + cancelText: '取消', | |
45 | + destroyOnClose: true, | |
46 | + onCancel: () => { | |
47 | + setVisible(false); | |
48 | + }, | |
49 | + }} | |
50 | + onFinish={async () => { | |
51 | + onClose(); | |
52 | + }} | |
53 | + onOpenChange={setVisible} | |
54 | + > | |
55 | + <TextArea rows={6} placeholder="请输入" /> | |
56 | + </ModalForm> */} | |
57 | + <Modal | |
58 | + title="回访登记" | |
59 | + open={isModalOpen} | |
60 | + onOk={handleOk} | |
61 | + onCancel={handleCancel} | |
62 | + > | |
63 | + <TextArea | |
64 | + rows={6} | |
65 | + placeholder="请输入" | |
66 | + onChange={handleChange} | |
67 | + value={textValue} | |
68 | + /> | |
69 | + </Modal> | |
70 | + </> | |
71 | + ); | |
72 | +}; | ... | ... |
src/pages/Order/FeedBack/FinancialDrawer.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postServiceOrderEditOrder, | |
4 | + postServiceOrderInvoicing, | |
5 | +} from '@/services'; | |
6 | +import { FloatAdd, enumToSelect, enumValueToLabel } from '@/utils'; | |
7 | +import { getReceivingCompanyOptions } from '@/utils/order'; | |
8 | +import { | |
9 | + DrawerForm, | |
10 | + ProFormDatePicker, | |
11 | + ProFormDigit, | |
12 | + ProFormSelect, | |
13 | + ProFormText, | |
14 | + ProFormTextArea, | |
15 | +} from '@ant-design/pro-components'; | |
16 | +import { Button, Form, message } from 'antd'; | |
17 | +import { useEffect, useState } from 'react'; | |
18 | +import { INVOCING_STATUS_OPTIONS_OLD, PAYEE_OPTIONS } from './constant'; | |
19 | + | |
20 | +export default ({ | |
21 | + mainOrder, | |
22 | + subOrders, | |
23 | + isEdit, | |
24 | + isMainOrder, | |
25 | + cancel, | |
26 | + onClose, | |
27 | +}) => { | |
28 | + const [invoicingStatus, setInvoicingStatus] = useState(''); | |
29 | + const subIds = subOrders.map((item) => item.id); | |
30 | + useEffect(() => { | |
31 | + // 在组件挂载或数据变化时,更新组件状态 | |
32 | + if (mainOrder) { | |
33 | + setInvoicingStatus(subOrders[0]?.invoicingStatus); | |
34 | + } | |
35 | + }, [mainOrder]); | |
36 | + useEffect(() => { | |
37 | + console.log(JSON.stringify(subOrders)); | |
38 | + }, []); | |
39 | + | |
40 | + const [form] = Form.useForm<{ name: string; company: string }>(); | |
41 | + | |
42 | + /** | |
43 | + * 自动选择收款公司 | |
44 | + * @param receivingCompany | |
45 | + */ | |
46 | + function chooseReceivingCompany(receivingCompany: any) { | |
47 | + form.setFieldValue('payee', receivingCompany); | |
48 | + } | |
49 | + | |
50 | + /** | |
51 | + * 计算选中子订单的主订单金额之和 | |
52 | + */ | |
53 | + function computeTotalPayment() { | |
54 | + let distinctMap = new Map(); | |
55 | + | |
56 | + subOrders?.forEach((item: any) => { | |
57 | + distinctMap.set(item.mainOrderId, item.totalPayment); | |
58 | + }); | |
59 | + | |
60 | + let sum = 0; | |
61 | + for (let p of distinctMap.values()) { | |
62 | + sum = FloatAdd(p, sum); | |
63 | + } | |
64 | + | |
65 | + form.setFieldValue('money', sum); | |
66 | + } | |
67 | + | |
68 | + return ( | |
69 | + <DrawerForm<{ | |
70 | + name: string; | |
71 | + company: string; | |
72 | + }> | |
73 | + open | |
74 | + title="财务信息" | |
75 | + resize={{ | |
76 | + onResize() { | |
77 | + console.log('resize!'); | |
78 | + }, | |
79 | + maxWidth: window.innerWidth * 0.8, | |
80 | + minWidth: 400, | |
81 | + }} | |
82 | + initialValues={mainOrder} | |
83 | + form={form} | |
84 | + autoFocusFirstInput | |
85 | + drawerProps={{ | |
86 | + destroyOnClose: true, | |
87 | + }} | |
88 | + submitTimeout={2000} | |
89 | + onFinish={async (values) => { | |
90 | + let res; | |
91 | + let body = values; | |
92 | + body.subIds = subIds; | |
93 | + if (isEdit) { | |
94 | + res = await postServiceOrderEditOrder({ data: body }); | |
95 | + } else { | |
96 | + res = await postServiceOrderInvoicing({ data: body }); | |
97 | + } | |
98 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
99 | + message.success(res.message); | |
100 | + onClose(); | |
101 | + } | |
102 | + }} | |
103 | + onOpenChange={(val) => { | |
104 | + return !val && cancel(); | |
105 | + }} | |
106 | + > | |
107 | + {isMainOrder ? ( | |
108 | + <ProFormSelect | |
109 | + placeholder="选择是否需要开票" | |
110 | + name="invoicingStatus" | |
111 | + width="lg" | |
112 | + label="是否需要开票" | |
113 | + options={enumToSelect(INVOCING_STATUS_OPTIONS_OLD)} | |
114 | + onChange={setInvoicingStatus} | |
115 | + initialValue={subOrders[0]?.invoicingStatus} | |
116 | + // disabled={mainInfoDisbled} | |
117 | + rules={[{ required: true, message: '是否需要开票必填' }]} | |
118 | + /> | |
119 | + ) : ( | |
120 | + '' | |
121 | + )} | |
122 | + | |
123 | + <ProFormTextArea | |
124 | + width="lg" | |
125 | + name="invoiceIdentificationNumber" | |
126 | + label="开票信息" | |
127 | + placeholder="请输入开票信息" | |
128 | + disabled | |
129 | + /> | |
130 | + <ProFormText | |
131 | + width="lg" | |
132 | + name="bank" | |
133 | + label="开户银行" | |
134 | + placeholder="请输入开户银行" | |
135 | + disabled | |
136 | + /> | |
137 | + <ProFormText | |
138 | + width="lg" | |
139 | + name="bankAccountNumber" | |
140 | + label="开户银行账号" | |
141 | + placeholder="请输入开户银行账号" | |
142 | + disabled | |
143 | + /> | |
144 | + | |
145 | + {invoicingStatus !== 'UN_INVOICE' | |
146 | + ? [ | |
147 | + <ProFormDatePicker | |
148 | + key="invoicingTime" | |
149 | + width="lg" | |
150 | + name="invoicingTime" | |
151 | + label="开票时间" | |
152 | + disabled={isEdit} | |
153 | + rules={[ | |
154 | + { required: !isEdit ? true : false, message: '这是必填项' }, | |
155 | + ]} | |
156 | + initialValue={subOrders[0]?.invoicingTime} | |
157 | + />, | |
158 | + <ProFormText | |
159 | + key="purchaser" | |
160 | + width="lg" | |
161 | + name="purchaser" | |
162 | + label="抬头名称" | |
163 | + disabled={isEdit} | |
164 | + rules={[ | |
165 | + { required: !isEdit ? true : false, message: '这是必填项' }, | |
166 | + ]} | |
167 | + initialValue={subOrders[0]?.purchaser} | |
168 | + />, | |
169 | + <ProFormDatePicker | |
170 | + key="financialReceiptIssuanceTime" | |
171 | + width="lg" | |
172 | + name="financialReceiptIssuanceTime" | |
173 | + label="开收据时间" | |
174 | + initialValue={subOrders[0]?.financialReceiptIssuanceTime} | |
175 | + />, | |
176 | + <ProFormDatePicker | |
177 | + key="collectMoneyTime" | |
178 | + width="lg" | |
179 | + name="collectMoneyTime" | |
180 | + label="收款时间" | |
181 | + initialValue={subOrders[0]?.collectMoneyTime} | |
182 | + />, | |
183 | + <ProFormText | |
184 | + width="lg" | |
185 | + key="invoiceNumber" | |
186 | + name="invoiceNumber" | |
187 | + label="发票号码" | |
188 | + initialValue={subOrders[0]?.invoiceNumber} | |
189 | + rules={[{ required: true, message: '发票号码必填' }]} | |
190 | + />, | |
191 | + <div | |
192 | + key="salesChooseReceivingCompany" | |
193 | + hidden={subOrders[0].receivingCompany === null} | |
194 | + > | |
195 | + <span className={'pl-2 text-xs text-gray-400'}> | |
196 | + 销售申请开票时选择了: | |
197 | + {enumValueToLabel( | |
198 | + subOrders[0].receivingCompany, | |
199 | + getReceivingCompanyOptions(PAYEE_OPTIONS), | |
200 | + )} | |
201 | + </span> | |
202 | + <span | |
203 | + hidden={subOrders[0].receivingCompany === 'ANY'} | |
204 | + className={ | |
205 | + 'pl-2 text-xs text-[#1677ff] cursor-pointer hover:text-[#64abf7]' | |
206 | + } | |
207 | + onClick={() => { | |
208 | + chooseReceivingCompany(subOrders[0].receivingCompany); | |
209 | + }} | |
210 | + > | |
211 | + 选择 | |
212 | + </span> | |
213 | + </div>, | |
214 | + <ProFormSelect | |
215 | + key="payee" | |
216 | + placeholder="选择收款单位" | |
217 | + name="payee" | |
218 | + width="lg" | |
219 | + showSearch | |
220 | + label="收款单位" | |
221 | + options={enumToSelect(PAYEE_OPTIONS)} | |
222 | + initialValue={subOrders[0]?.payee} | |
223 | + rules={[{ required: true, message: '收款单位必填' }]} | |
224 | + />, | |
225 | + | |
226 | + <div id="total-payment" key="money"> | |
227 | + <ProFormDigit | |
228 | + key="money" | |
229 | + name="money" | |
230 | + width="lg" | |
231 | + label="金额" | |
232 | + rules={[{ required: true, message: '金额必填' }]} | |
233 | + tooltip="点击计算,合计所有子订单对应主订单总额" | |
234 | + fieldProps={{ | |
235 | + addonAfter: ( | |
236 | + <Button | |
237 | + className="rounded-l-none" | |
238 | + type="primary" | |
239 | + onClick={computeTotalPayment} | |
240 | + > | |
241 | + 计算 | |
242 | + </Button> | |
243 | + ), | |
244 | + }} | |
245 | + /> | |
246 | + </div>, | |
247 | + ] | |
248 | + : ''} | |
249 | + | |
250 | + <ProFormSelect | |
251 | + placeholder="是否完全开票" | |
252 | + name="afterInvoicingStatus" | |
253 | + width="lg" | |
254 | + label="是否完全开票" | |
255 | + options={[ | |
256 | + { label: '完全开票', value: 'COMPLETE_INVOICING' }, | |
257 | + { label: '部分开票', value: 'PARTIAL_INVOICING' }, | |
258 | + ]} | |
259 | + // disabled={mainInfoDisbled} | |
260 | + initialValue={ | |
261 | + subOrders[0]?.afterInvoicingStatus === 'APPLY_FOR_INVOICING' | |
262 | + ? 'COMPLETE_INVOICING' | |
263 | + : subOrders[0]?.afterInvoicingStatus | |
264 | + } | |
265 | + rules={[{ required: true, message: '是否完全开票必填' }]} | |
266 | + /> | |
267 | + <ProFormTextArea | |
268 | + width="lg" | |
269 | + name="invoicingNotes" | |
270 | + label="备注" | |
271 | + initialValue={subOrders[0]?.invoicingNotes} | |
272 | + /> | |
273 | + </DrawerForm> | |
274 | + ); | |
275 | +}; | ... | ... |
src/pages/Order/FeedBack/FinancialEditDrawer.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderNoNeedInvoicingEdit } from '@/services'; | |
3 | +import { enumToSelect } from '@/utils'; | |
4 | +import { | |
5 | + DrawerForm, | |
6 | + ProFormDatePicker, | |
7 | + ProFormSelect, | |
8 | + ProFormText, | |
9 | +} from '@ant-design/pro-components'; | |
10 | +import { Form, message } from 'antd'; | |
11 | +import { useEffect, useState } from 'react'; | |
12 | +import { INVOCING_STATUS_OPTIONS_OLD } from './constant'; | |
13 | + | |
14 | +export default ({ mainOrder, subOrders, setVisible, isMainOrder, onClose }) => { | |
15 | + const [invoicingStatus, setInvoicingStatus] = useState(''); | |
16 | + useEffect(() => { | |
17 | + setInvoicingStatus(subOrders[0]?.invoicingStatus); | |
18 | + }, []); | |
19 | + const subOrderIds = subOrders?.map((subOrder) => { | |
20 | + return subOrder?.id; | |
21 | + }); | |
22 | + const mainOrderId = mainOrder.id; | |
23 | + const [form] = Form.useForm<{ | |
24 | + collectMoneyTime: string; | |
25 | + subIds: []; | |
26 | + financialReceiptIssuanceTime: string; | |
27 | + }>(); | |
28 | + | |
29 | + //回显开收据时间和收款时间 | |
30 | + if (!isMainOrder) { | |
31 | + form.setFieldValue('collectMoneyTime', subOrders[0].collectMoneyTime); | |
32 | + form.setFieldValue( | |
33 | + 'financialReceiptIssuanceTime', | |
34 | + subOrders[0].financialReceiptIssuanceTime, | |
35 | + ); | |
36 | + } | |
37 | + | |
38 | + return ( | |
39 | + <DrawerForm<{ | |
40 | + collectMoneyTime: string; | |
41 | + financialReceiptIssuanceTime: string; | |
42 | + subIds: []; | |
43 | + }> | |
44 | + open | |
45 | + title={isMainOrder ? '编辑开票信息' : '编辑收款时间'} | |
46 | + resize={{ | |
47 | + onResize() { | |
48 | + console.log('resize!'); | |
49 | + }, | |
50 | + maxWidth: window.innerWidth * 0.8, | |
51 | + minWidth: 400, | |
52 | + }} | |
53 | + initialValues={mainOrder} | |
54 | + form={form} | |
55 | + autoFocusFirstInput | |
56 | + drawerProps={{ | |
57 | + destroyOnClose: true, | |
58 | + }} | |
59 | + submitTimeout={2000} | |
60 | + onFinish={async (values) => { | |
61 | + let body = { | |
62 | + ...values, | |
63 | + mainOrderId: mainOrderId, | |
64 | + subIds: subOrderIds, | |
65 | + }; | |
66 | + | |
67 | + if (!isMainOrder) { | |
68 | + body.invoicingStatus = 'UN_INVOICE'; | |
69 | + } | |
70 | + | |
71 | + let res = await postServiceOrderNoNeedInvoicingEdit({ | |
72 | + data: body, | |
73 | + }); | |
74 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
75 | + message.success(res.message); | |
76 | + onClose(); | |
77 | + } | |
78 | + }} | |
79 | + onOpenChange={(val) => { | |
80 | + return !val && setVisible(val); | |
81 | + }} | |
82 | + > | |
83 | + {isMainOrder ? ( | |
84 | + <ProFormSelect | |
85 | + placeholder="选择是否需要开票" | |
86 | + name="invoicingStatus" | |
87 | + width="lg" | |
88 | + label="是否需要开票" | |
89 | + options={enumToSelect(INVOCING_STATUS_OPTIONS_OLD)} | |
90 | + onChange={setInvoicingStatus} | |
91 | + initialValue={subOrders[0]?.invoicingStatus} | |
92 | + // disabled={mainInfoDisbled} | |
93 | + rules={[{ required: true, message: '是否需要开票必填' }]} | |
94 | + /> | |
95 | + ) : ( | |
96 | + '' | |
97 | + )} | |
98 | + | |
99 | + {invoicingStatus !== 'UN_INVOICE' ? ( | |
100 | + <> | |
101 | + <ProFormText | |
102 | + key="invoiceIdentificationNumber" | |
103 | + width="lg" | |
104 | + name="invoiceIdentificationNumber" | |
105 | + label="开票信息" | |
106 | + placeholder="请输入开票信息" | |
107 | + rules={[{ required: true, message: '开票信息必填' }]} | |
108 | + /> | |
109 | + <ProFormText | |
110 | + key="bank" | |
111 | + width="lg" | |
112 | + name="bank" | |
113 | + label="开户银行" | |
114 | + placeholder="请输入开户银行" | |
115 | + /> | |
116 | + <ProFormText | |
117 | + key="bankAccountNumber" | |
118 | + width="lg" | |
119 | + name="bankAccountNumber" | |
120 | + label="开户银行账号" | |
121 | + placeholder="请输入开户银行账号" | |
122 | + /> | |
123 | + </> | |
124 | + ) : ( | |
125 | + '' | |
126 | + )} | |
127 | + | |
128 | + <ProFormDatePicker | |
129 | + key="financialReceiptIssuanceTime" | |
130 | + width="lg" | |
131 | + name="financialReceiptIssuanceTime" | |
132 | + label="开收据时间" | |
133 | + // rules={[ | |
134 | + // { | |
135 | + // required: !isMainOrder && invoicingStatus === 'UN_INVOICE', | |
136 | + // message: '开收据时间必填', | |
137 | + // }, | |
138 | + // ]} | |
139 | + /> | |
140 | + <ProFormDatePicker | |
141 | + key="collectMoneyTime" | |
142 | + width="lg" | |
143 | + name="collectMoneyTime" | |
144 | + label="收款时间" | |
145 | + // rules={[ | |
146 | + // { | |
147 | + // required: !isMainOrder && invoicingStatus === 'UN_INVOICE', | |
148 | + // message: '收款时间必填', | |
149 | + // }, | |
150 | + // ]} | |
151 | + /> | |
152 | + </DrawerForm> | |
153 | + ); | |
154 | +}; | ... | ... |
src/pages/Order/FeedBack/FinancialMergeDrawer.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { enumToSelect } from '@/utils'; | |
3 | +import { | |
4 | + DrawerForm, | |
5 | + ProFormDatePicker, | |
6 | + ProFormDigit, | |
7 | + ProFormSelect, | |
8 | + ProFormText, | |
9 | + ProFormTextArea, | |
10 | +} from '@ant-design/pro-components'; | |
11 | +import { Form, message } from 'antd'; | |
12 | +import { PAYEE_OPTIONS } from './constant'; | |
13 | + | |
14 | +export default ({ dataList, setVisible, onClose }) => { | |
15 | + // let subOrderIds = dataList?.map((item) => { | |
16 | + // return item.id; | |
17 | + // }); | |
18 | + let firstMainOrder = dataList[0]; | |
19 | + let bank = firstMainOrder?.bank; | |
20 | + let bankAccountNumber = firstMainOrder?.bankAccountNumber; | |
21 | + let invoiceIdentificationNumber = firstMainOrder?.invoiceIdentificationNumber; | |
22 | + | |
23 | + const [form] = Form.useForm<{ | |
24 | + invoicingTime: string; | |
25 | + financialReceiptIssuanceTime: string; | |
26 | + invoicingNotes: string; | |
27 | + afterInvoicingStatus: string; | |
28 | + collectMoneyTime: string; | |
29 | + }>(); | |
30 | + return ( | |
31 | + <DrawerForm | |
32 | + open | |
33 | + title="合并开票" | |
34 | + resize={{ | |
35 | + onResize() { | |
36 | + console.log('resize!'); | |
37 | + }, | |
38 | + maxWidth: window.innerWidth * 0.8, | |
39 | + minWidth: 400, | |
40 | + }} | |
41 | + form={form} | |
42 | + autoFocusFirstInput | |
43 | + drawerProps={{ | |
44 | + destroyOnClose: true, | |
45 | + }} | |
46 | + submitTimeout={2000} | |
47 | + onFinish={async (values) => { | |
48 | + console.log(values); | |
49 | + let res; | |
50 | + let body = values; | |
51 | + body.subIds = subIds; | |
52 | + body.mainOrderId = mainOrder.id; | |
53 | + body.mainorderOrSubOrderInvoicing = isMainOrder; | |
54 | + if (isEdit) { | |
55 | + res = await postServiceOrderEditOrder({ data: body }); | |
56 | + } else { | |
57 | + res = await postServiceOrderInvoicing({ data: body }); | |
58 | + } | |
59 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
60 | + message.success(res.message); | |
61 | + onClose(); | |
62 | + } | |
63 | + }} | |
64 | + onOpenChange={(val) => { | |
65 | + return !val && setVisible(); | |
66 | + }} | |
67 | + > | |
68 | + <ProFormText | |
69 | + width="lg" | |
70 | + name="invoiceIdentificationNumber" | |
71 | + label="开票信息" | |
72 | + placeholder="请输入开票信息" | |
73 | + initialValue={invoiceIdentificationNumber} | |
74 | + disabled | |
75 | + /> | |
76 | + <ProFormText | |
77 | + width="lg" | |
78 | + name="bank" | |
79 | + label="开户银行" | |
80 | + placeholder="请输入开户银行" | |
81 | + initialValue={bank} | |
82 | + disabled | |
83 | + /> | |
84 | + <ProFormText | |
85 | + width="lg" | |
86 | + name="bankAccountNumber" | |
87 | + label="开户银行账号" | |
88 | + placeholder="请输入开户银行账号" | |
89 | + initialValue={bankAccountNumber} | |
90 | + disabled | |
91 | + /> | |
92 | + | |
93 | + <ProFormDatePicker | |
94 | + key="invoicingTime" | |
95 | + width="lg" | |
96 | + name="invoicingTime" | |
97 | + label="开票时间" | |
98 | + rules={[{ required: true, message: '这是必填项' }]} | |
99 | + /> | |
100 | + <ProFormDatePicker | |
101 | + key="financialReceiptIssuanceTime" | |
102 | + width="lg" | |
103 | + name="financialReceiptIssuanceTime" | |
104 | + label="开收据时间" | |
105 | + /> | |
106 | + <ProFormDatePicker | |
107 | + key="collectMoneyTime" | |
108 | + width="lg" | |
109 | + name="collectMoneyTime" | |
110 | + label="收款时间" | |
111 | + /> | |
112 | + <ProFormText | |
113 | + width="lg" | |
114 | + key="invoiceNumber" | |
115 | + name="invoiceNumber" | |
116 | + label="发票号码" | |
117 | + rules={[{ required: true, message: '发票号码必填' }]} | |
118 | + /> | |
119 | + <ProFormSelect | |
120 | + key="payee" | |
121 | + placeholder="选择收款单位" | |
122 | + name="payee" | |
123 | + width="lg" | |
124 | + label="收款单位" | |
125 | + options={enumToSelect(PAYEE_OPTIONS)} | |
126 | + rules={[{ required: true, message: '收款单位必填' }]} | |
127 | + /> | |
128 | + | |
129 | + <ProFormDigit | |
130 | + key="money" | |
131 | + name="money" | |
132 | + width="lg" | |
133 | + label="金额" | |
134 | + rules={[{ required: true, message: '金额必填' }]} | |
135 | + /> | |
136 | + <ProFormSelect | |
137 | + placeholder="是否完全开票" | |
138 | + name="afterInvoicingStatus" | |
139 | + width="lg" | |
140 | + label="是否完全开票" | |
141 | + options={[ | |
142 | + { label: '完全开票', value: 'COMPLETE_INVOICING' }, | |
143 | + { label: '部分开票', value: 'PARTIAL_INVOICING' }, | |
144 | + ]} | |
145 | + initialValue={'COMPLETE_INVOICING'} | |
146 | + /> | |
147 | + <ProFormTextArea width="lg" name="invoicingNotes" label="备注" /> | |
148 | + </DrawerForm> | |
149 | + ); | |
150 | +}; | ... | ... |
src/pages/Order/FeedBack/FinancialReceiptsModal.tsx
0 → 100644
1 | +import { postServiceOrderUpdateHirePurchase } from '@/services'; | |
2 | +import { | |
3 | + EditableProTable, | |
4 | + ModalForm, | |
5 | + ProColumns, | |
6 | + ProForm, | |
7 | +} from '@ant-design/pro-components'; | |
8 | +import { Form } from 'antd'; | |
9 | +import { useState } from 'react'; | |
10 | + | |
11 | +// import { cloneDeep } from 'lodash'; | |
12 | +export default ({ setVisible, datas, onClose }) => { | |
13 | + const [form] = Form.useForm<{ name: string; company: string }>(); | |
14 | + type DataSourceType = { | |
15 | + id: React.Key; | |
16 | + hirePurchaseMethod?: string; | |
17 | + hirePurchaseMethodName?: string; | |
18 | + money?: number; | |
19 | + updateTime?: string; | |
20 | + notes?: string; | |
21 | + }; | |
22 | + const defaultData: DataSourceType[] = [ | |
23 | + { | |
24 | + id: 1, | |
25 | + hirePurchaseMethod: 'ADVANCE_CHARGE', | |
26 | + hirePurchaseMethodName: '预付款', | |
27 | + money: undefined, | |
28 | + updateTime: undefined, | |
29 | + notes: undefined, | |
30 | + }, | |
31 | + { | |
32 | + id: 2, | |
33 | + hirePurchaseMethod: 'PAYMENT_FOR_SHIPMENT', | |
34 | + hirePurchaseMethodName: '发货款', | |
35 | + money: undefined, | |
36 | + updateTime: undefined, | |
37 | + notes: undefined, | |
38 | + }, | |
39 | + { | |
40 | + id: 3, | |
41 | + hirePurchaseMethod: 'ACCEPTANCE_PAYMENT', | |
42 | + hirePurchaseMethodName: '验收款', | |
43 | + money: undefined, | |
44 | + updateTime: undefined, | |
45 | + notes: undefined, | |
46 | + }, | |
47 | + { | |
48 | + id: 4, | |
49 | + hirePurchaseMethod: 'BALANCE_PAYMENT', | |
50 | + hirePurchaseMethodName: '尾款', | |
51 | + money: undefined, | |
52 | + updateTime: undefined, | |
53 | + notes: undefined, | |
54 | + }, | |
55 | + ]; | |
56 | + const [editableKeys, setEditableRowKeys] = useState<React.Key[]>(() => | |
57 | + // defaultData.map((item) => item.id), | |
58 | + [1, 2, 3, 4], | |
59 | + ); | |
60 | + const columns: ProColumns<DataSourceType>[] = [ | |
61 | + { | |
62 | + title: '款项', | |
63 | + dataIndex: 'hirePurchaseMethodName', | |
64 | + editable: false, | |
65 | + width: '10%', | |
66 | + }, | |
67 | + { | |
68 | + title: '已收金额', | |
69 | + dataIndex: 'money', | |
70 | + valueType: 'digit', | |
71 | + width: '15%', | |
72 | + }, | |
73 | + { | |
74 | + title: '收款时间', | |
75 | + dataIndex: 'updateTime', | |
76 | + valueType: 'dateTime', | |
77 | + width: '25%', | |
78 | + }, | |
79 | + { | |
80 | + title: '备注', | |
81 | + dataIndex: 'receiptsNotes', | |
82 | + }, | |
83 | + ]; | |
84 | + return ( | |
85 | + <> | |
86 | + <ModalForm<{ | |
87 | + name: string; | |
88 | + company: string; | |
89 | + }> | |
90 | + width={1100} | |
91 | + open | |
92 | + title="收款记录" | |
93 | + form={form} | |
94 | + autoFocusFirstInput | |
95 | + modalProps={{ | |
96 | + okText: '保存', | |
97 | + cancelText: '取消', | |
98 | + destroyOnClose: true, | |
99 | + onCancel: () => { | |
100 | + setVisible(false); | |
101 | + }, | |
102 | + }} | |
103 | + onFinish={async (values) => { | |
104 | + let res = await postServiceOrderUpdateHirePurchase({ | |
105 | + data: { | |
106 | + mainOrderId: datas[0].id, | |
107 | + list: values.dataSource, | |
108 | + }, | |
109 | + }); | |
110 | + console.log(res); | |
111 | + onClose(); | |
112 | + }} | |
113 | + onOpenChange={setVisible} | |
114 | + > | |
115 | + <ProForm.Item | |
116 | + label="" | |
117 | + name="dataSource" | |
118 | + initialValue={defaultData} | |
119 | + trigger="onValuesChange" | |
120 | + > | |
121 | + <EditableProTable<DataSourceType> | |
122 | + rowKey="id" | |
123 | + toolBarRender={false} | |
124 | + columns={columns} | |
125 | + recordCreatorProps={{ | |
126 | + newRecordType: 'dataSource', | |
127 | + position: 'top', | |
128 | + record: () => ({ | |
129 | + id: Date.now(), | |
130 | + addonBefore: 'ccccccc', | |
131 | + decs: 'testdesc', | |
132 | + }), | |
133 | + style: { | |
134 | + display: 'none', | |
135 | + }, | |
136 | + }} | |
137 | + editable={{ | |
138 | + type: 'multiple', | |
139 | + editableKeys, | |
140 | + onChange: setEditableRowKeys, | |
141 | + actionRender: (row, _, dom) => { | |
142 | + return [dom.delete]; | |
143 | + }, | |
144 | + }} | |
145 | + /> | |
146 | + </ProForm.Item> | |
147 | + | |
148 | + {/* <ProForm.Group> | |
149 | + <ProFormText | |
150 | + width="sm" | |
151 | + name="name1" | |
152 | + label="款项" | |
153 | + tooltip="最长为 24 位" | |
154 | + initialValue={"预付款"} | |
155 | + disabled | |
156 | + placeholder="请输入名称" | |
157 | + /> | |
158 | + | |
159 | + <ProFormText | |
160 | + width="sm" | |
161 | + name="company" | |
162 | + label="收款时间" | |
163 | + placeholder="请输入名称" | |
164 | + /> | |
165 | + | |
166 | + <ProFormText | |
167 | + width="sm" | |
168 | + name="price" | |
169 | + label="收款金额" | |
170 | + placeholder="请输入名称" | |
171 | + /> | |
172 | + | |
173 | + <ProFormText | |
174 | + width="sm" | |
175 | + name="notes" | |
176 | + label="备注" | |
177 | + placeholder="请输入名称" | |
178 | + /> | |
179 | + </ProForm.Group> | |
180 | + | |
181 | + <ProForm.Group> | |
182 | + <ProFormText | |
183 | + width="sm" | |
184 | + name="name2" | |
185 | + initialValue={"发货款"} | |
186 | + disabled | |
187 | + tooltip="最长为 24 位" | |
188 | + placeholder="请输入名称" | |
189 | + /> | |
190 | + | |
191 | + <ProFormText | |
192 | + width="sm" | |
193 | + name="company" | |
194 | + placeholder="请输入名称" | |
195 | + /> | |
196 | + | |
197 | + <ProFormText | |
198 | + width="sm" | |
199 | + name="price" | |
200 | + placeholder="请输入名称" | |
201 | + /> | |
202 | + | |
203 | + <ProFormText | |
204 | + width="sm" | |
205 | + name="notes" | |
206 | + placeholder="请输入名称" | |
207 | + /> | |
208 | + </ProForm.Group> | |
209 | + | |
210 | + <ProForm.Group> | |
211 | + <ProFormText | |
212 | + width="sm" | |
213 | + name="name3" | |
214 | + initialValue={"验收款"} | |
215 | + disabled | |
216 | + tooltip="最长为 24 位" | |
217 | + placeholder="请输入名称" | |
218 | + /> | |
219 | + | |
220 | + <ProFormText | |
221 | + width="sm" | |
222 | + name="company" | |
223 | + placeholder="请输入名称" | |
224 | + /> | |
225 | + | |
226 | + <ProFormText | |
227 | + width="sm" | |
228 | + name="price" | |
229 | + placeholder="请输入名称" | |
230 | + /> | |
231 | + | |
232 | + <ProFormText | |
233 | + width="sm" | |
234 | + name="notes" | |
235 | + placeholder="请输入名称" | |
236 | + /> | |
237 | + </ProForm.Group> | |
238 | + | |
239 | + <ProForm.Group> | |
240 | + <ProFormText | |
241 | + width="sm" | |
242 | + name="name4" | |
243 | + disabled | |
244 | + initialValue={"尾款"} | |
245 | + tooltip="最长为 24 位" | |
246 | + placeholder="请输入名称" | |
247 | + /> | |
248 | + | |
249 | + <ProFormText | |
250 | + width="sm" | |
251 | + name="company" | |
252 | + placeholder="请输入名称" | |
253 | + /> | |
254 | + | |
255 | + <ProFormText | |
256 | + width="sm" | |
257 | + name="price" | |
258 | + placeholder="请输入名称" | |
259 | + /> | |
260 | + | |
261 | + <ProFormText | |
262 | + width="sm" | |
263 | + name="notes" | |
264 | + placeholder="请输入名称" | |
265 | + /> | |
266 | + </ProForm.Group> */} | |
267 | + </ModalForm> | |
268 | + </> | |
269 | + ); | |
270 | +}; | ... | ... |
src/pages/Order/FeedBack/HistoryModal.tsx
0 → 100644
1 | +import { postServiceOrderQueryHistoryOrderRecord } from '@/services'; | |
2 | +import { formatDateTime } from '@/utils'; | |
3 | +import { Button, Col, Empty, Flex, Modal, Row, Spin } from 'antd'; | |
4 | +import { useEffect, useState } from 'react'; | |
5 | + | |
6 | +export default ({ subOrders, isCancelledOrder, onClose }) => { | |
7 | + let subOrderIds = subOrders?.map((subOrder: any) => { | |
8 | + return subOrder.id; | |
9 | + }); | |
10 | + | |
11 | + const [data, setData] = useState([]); | |
12 | + const [loading, setLoading] = useState(true); | |
13 | + let i = 0; | |
14 | + | |
15 | + const handleOk = () => { | |
16 | + onClose(); | |
17 | + }; | |
18 | + | |
19 | + /** | |
20 | + * 获取历史记录 | |
21 | + */ | |
22 | + const getHistory = async () => { | |
23 | + let res = await postServiceOrderQueryHistoryOrderRecord({ | |
24 | + data: { ids: subOrderIds, isDeleteQueryOrder: isCancelledOrder }, | |
25 | + }); | |
26 | + setData(res.data); | |
27 | + setLoading(false); | |
28 | + }; | |
29 | + | |
30 | + const getRecord = (history: any) => { | |
31 | + let record = []; | |
32 | + record.push( | |
33 | + <span className="pr-2 text-[#5E5E5E]"> | |
34 | + {formatDateTime(history.createTime)} | |
35 | + </span>, | |
36 | + ); | |
37 | + | |
38 | + record.push(<span className="text-[#3b83e5]">{history.createByName}</span>); | |
39 | + | |
40 | + record.push(<span>进行了</span>); | |
41 | + | |
42 | + // let label = enumValueToLabel(history.status, ORDER_STATUS_OPTIONS); | |
43 | + | |
44 | + // if ( | |
45 | + // history.record !== 'INVOICING' && history.record !== 'order-change-normal' && history.record !== 'order-change-normal-CHECK' && | |
46 | + // history.record?.indexOf(':') === -1 && | |
47 | + // label !== undefined && | |
48 | + // label !== '' | |
49 | + // ) { | |
50 | + // record.push( | |
51 | + // <> | |
52 | + // <span>,订单状态为:</span> | |
53 | + // <span className="text-[#3b83e5]">{label}</span> | |
54 | + // </>, | |
55 | + // ); | |
56 | + // } | |
57 | + | |
58 | + if (history.record?.indexOf(':') !== -1) { | |
59 | + let values = history.record?.split(':'); | |
60 | + let type = values[0]; | |
61 | + let target = values[1]; | |
62 | + if (target === 'null') { | |
63 | + target = '未指定'; | |
64 | + } | |
65 | + //采购转发 | |
66 | + if (type === 'PROCURE_CONVERT_PROCURE') { | |
67 | + record.push( | |
68 | + <> | |
69 | + <span>采购转发,{history.createByName}将订单转发给了</span> | |
70 | + <span className="text-[#3b83e5]">{target}</span> | |
71 | + </>, | |
72 | + ); | |
73 | + } | |
74 | + } else { | |
75 | + record.push( | |
76 | + <span className="text-[#3b83e5]"> | |
77 | + {history.recordText + | |
78 | + (history.record === 'INVOICING' | |
79 | + ? '(开票号码:' + history.invoiceNumber + ')' | |
80 | + : '')} | |
81 | + </span>, | |
82 | + ); | |
83 | + } | |
84 | + | |
85 | + if (history.notes !== null) { | |
86 | + record.push(<span className="pl-1">{'备注:' + history.notes}</span>); | |
87 | + } | |
88 | + | |
89 | + if (history.description !== null) { | |
90 | + record.push( | |
91 | + <span className="pl-1">{'描述:' + history.description}</span>, | |
92 | + ); | |
93 | + } | |
94 | + | |
95 | + return record; | |
96 | + }; | |
97 | + | |
98 | + useEffect(() => { | |
99 | + getHistory(); | |
100 | + }, []); | |
101 | + | |
102 | + const handleCancel = () => { | |
103 | + onClose(); | |
104 | + }; | |
105 | + | |
106 | + return ( | |
107 | + <> | |
108 | + <Modal | |
109 | + title="订单历史记录" | |
110 | + open | |
111 | + width={650} | |
112 | + onOk={handleOk} | |
113 | + onCancel={handleCancel} | |
114 | + footer={() => ( | |
115 | + <> | |
116 | + <Button onClick={handleCancel}>返回</Button> | |
117 | + </> | |
118 | + )} | |
119 | + > | |
120 | + <Spin tip="加载中" spinning={loading}> | |
121 | + <Row className="max-h-[500px] overflow-auto" gutter={[0, 14]}> | |
122 | + {data.map((item) => { | |
123 | + return ( | |
124 | + <Col span={24} key={i}> | |
125 | + <Flex vertical> | |
126 | + <div> | |
127 | + <span className="py-2 text-[#5E5E5E]"> | |
128 | + {'商品' + ++i} | |
129 | + </span> | |
130 | + <span className="text-[#8C8C8C]"> | |
131 | + -【{item.productName}】 | |
132 | + </span> | |
133 | + </div> | |
134 | + | |
135 | + <Flex vertical> | |
136 | + {item.historySubOrderRecordDto?.map((history) => { | |
137 | + return ( | |
138 | + <div className="py-1" key={history.id}> | |
139 | + {getRecord(history)} | |
140 | + </div> | |
141 | + ); | |
142 | + })} | |
143 | + </Flex> | |
144 | + </Flex> | |
145 | + </Col> | |
146 | + ); | |
147 | + })} | |
148 | + </Row> | |
149 | + {data?.length <= 0 ? ( | |
150 | + <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> | |
151 | + ) : ( | |
152 | + '' | |
153 | + )} | |
154 | + </Spin> | |
155 | + </Modal> | |
156 | + </> | |
157 | + ); | |
158 | +}; | ... | ... |
src/pages/Order/FeedBack/ImagesViewerModal.tsx
0 → 100644
1 | +import { postServiceOrderViewImages } from '@/services'; | |
2 | +import { Button, Divider, Image, Modal } from 'antd'; | |
3 | +import { useEffect, useState } from 'react'; | |
4 | +export default ({ setVisible, optType, onClose, orderRow }) => { | |
5 | + const [images, setImages] = useState<any[]>([]); | |
6 | + const [title, setTitle] = useState('收货凭证'); | |
7 | + const handleOk = () => { | |
8 | + onClose(); | |
9 | + setVisible(false); | |
10 | + }; | |
11 | + | |
12 | + const handleCancel = () => { | |
13 | + onClose(); | |
14 | + setVisible(false); | |
15 | + }; | |
16 | + | |
17 | + async function getImages() { | |
18 | + const res = await postServiceOrderViewImages({ | |
19 | + data: { subId: orderRow.id }, | |
20 | + }); | |
21 | + const images = res.data; | |
22 | + setImages(images); | |
23 | + } | |
24 | + useEffect(() => { | |
25 | + if (optType === 'shippingReceipt') { | |
26 | + setTitle('收货凭证'); | |
27 | + getImages(); | |
28 | + } else if (optType === 'paymentReceipt') { | |
29 | + let paymentReceiptsImagesList: any[] = []; | |
30 | + if (orderRow.paymentReceiptAnnexList) { | |
31 | + paymentReceiptsImagesList.push(...orderRow.paymentReceiptAnnexList); | |
32 | + } | |
33 | + //去重 | |
34 | + paymentReceiptsImagesList = [...new Set(paymentReceiptsImagesList)]; | |
35 | + setImages(paymentReceiptsImagesList); | |
36 | + } | |
37 | + }, []); | |
38 | + | |
39 | + return ( | |
40 | + <> | |
41 | + <Modal | |
42 | + title={title} | |
43 | + open | |
44 | + onOk={handleOk} | |
45 | + onCancel={handleCancel} | |
46 | + footer={[ | |
47 | + <Button key="back" onClick={handleCancel}> | |
48 | + 返回 | |
49 | + </Button>, | |
50 | + ]} | |
51 | + > | |
52 | + <Image.PreviewGroup | |
53 | + className="mr-10" | |
54 | + preview={{ | |
55 | + onChange: (current, prev) => | |
56 | + console.log(`current index: ${current}, prev index: ${prev}`), | |
57 | + }} | |
58 | + > | |
59 | + {images.map((url) => ( | |
60 | + <> | |
61 | + <Image width={120} src={url} /> <Divider type="vertical" /> | |
62 | + </> | |
63 | + ))} | |
64 | + </Image.PreviewGroup> | |
65 | + </Modal> | |
66 | + </> | |
67 | + ); | |
68 | +}; | ... | ... |
src/pages/Order/FeedBack/ImportExpressBillModal copy.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postOrderImportImportWeightAndVolume } from '@/services'; | |
3 | +import { ModalForm, ProFormUploadDragger } from '@ant-design/pro-components'; | |
4 | +import { Button, Form, message } from 'antd'; | |
5 | + | |
6 | +export default () => { | |
7 | + const [form] = Form.useForm(); | |
8 | + const [messageApi, contextHolder] = message.useMessage(); | |
9 | + return ( | |
10 | + <> | |
11 | + <ModalForm | |
12 | + title="导入重量、体积" | |
13 | + trigger={<Button type="primary">导入重量、体积</Button>} | |
14 | + form={form} | |
15 | + autoFocusFirstInput | |
16 | + modalProps={{ | |
17 | + destroyOnClose: true, | |
18 | + }} | |
19 | + submitTimeout={2000} | |
20 | + onFinish={async (values) => { | |
21 | + console.log(values); | |
22 | + const formData = new FormData(); | |
23 | + formData.append('file', values.express[0].originFileObj); | |
24 | + messageApi.open({ | |
25 | + type: 'loading', | |
26 | + content: '正在导入...', | |
27 | + duration: 0, | |
28 | + }); | |
29 | + const res = await postOrderImportImportWeightAndVolume({ | |
30 | + data: formData, | |
31 | + headers: { | |
32 | + 'Content-Type': | |
33 | + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | |
34 | + }, | |
35 | + }); | |
36 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
37 | + message.error('导入成功'); | |
38 | + } else { | |
39 | + message.error('导入失败'); | |
40 | + } | |
41 | + messageApi.destroy(); | |
42 | + return true; | |
43 | + }} | |
44 | + > | |
45 | + <ProFormUploadDragger max={1} label="上传快递单" name="express" /> | |
46 | + </ModalForm> | |
47 | + {contextHolder} | |
48 | + </> | |
49 | + ); | |
50 | +}; | ... | ... |
src/pages/Order/FeedBack/ImportExpressBillModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postOrderImportImportWeightAndVolume } from '@/services'; | |
3 | +import { ModalForm, ProFormUploadDragger } from '@ant-design/pro-components'; | |
4 | +import { Button, Form, message } from 'antd'; | |
5 | + | |
6 | +export default () => { | |
7 | + const [form] = Form.useForm(); | |
8 | + const [messageApi, contextHolder] = message.useMessage(); | |
9 | + return ( | |
10 | + <> | |
11 | + <ModalForm | |
12 | + title="导入重量、体积" | |
13 | + trigger={<Button type="primary">导入重量、体积</Button>} | |
14 | + form={form} | |
15 | + autoFocusFirstInput | |
16 | + modalProps={{ | |
17 | + destroyOnClose: true, | |
18 | + }} | |
19 | + submitTimeout={2000} | |
20 | + onFinish={async (values) => { | |
21 | + console.log(values); | |
22 | + const formData = new FormData(); | |
23 | + formData.append('file', values.express[0].originFileObj); | |
24 | + messageApi.open({ | |
25 | + type: 'loading', | |
26 | + content: '正在导入...', | |
27 | + duration: 0, | |
28 | + }); | |
29 | + const res = await postOrderImportImportWeightAndVolume({ | |
30 | + data: formData, | |
31 | + headers: { | |
32 | + 'Content-Type': | |
33 | + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | |
34 | + }, | |
35 | + }); | |
36 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
37 | + message.error('导入成功'); | |
38 | + } else { | |
39 | + message.error('导入失败'); | |
40 | + } | |
41 | + messageApi.destroy(); | |
42 | + return true; | |
43 | + }} | |
44 | + > | |
45 | + <ProFormUploadDragger max={1} label="上传快递单" name="express" /> | |
46 | + </ModalForm> | |
47 | + {contextHolder} | |
48 | + </> | |
49 | + ); | |
50 | +}; | ... | ... |
src/pages/Order/FeedBack/ImportModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderImportExcel } from '@/services'; | |
3 | +import { downloadFile } from '@/services/order'; | |
4 | +import { UploadOutlined } from '@ant-design/icons'; | |
5 | +import { Button, Modal, Upload, message } from 'antd'; | |
6 | +import { RcFile, UploadFile, UploadProps } from 'antd/es/upload'; | |
7 | +import { useState } from 'react'; | |
8 | +export default ({ onClose }) => { | |
9 | + // const [form] = Form.useForm<{ name: string; company: string }>(); | |
10 | + const [messageApi, contextHolder] = message.useMessage(); | |
11 | + const [fileList, setFileList] = useState<UploadFile[]>([]); | |
12 | + const [uploading, setUploading] = useState(false); | |
13 | + const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => | |
14 | + setFileList(newFileList); | |
15 | + | |
16 | + const exportLoading = (content: string) => { | |
17 | + messageApi.open({ | |
18 | + type: 'loading', | |
19 | + content: content, | |
20 | + duration: 0, | |
21 | + }); | |
22 | + }; | |
23 | + | |
24 | + const exportLoadingDestory = () => { | |
25 | + messageApi.destroy(); | |
26 | + }; | |
27 | + const downloadTemplate = async () => { | |
28 | + exportLoading('正在下载模板...'); | |
29 | + downloadFile( | |
30 | + '/api/service/order/exportTemplate', | |
31 | + '订单.xlsx', | |
32 | + 'post', | |
33 | + {}, | |
34 | + exportLoadingDestory, | |
35 | + ); | |
36 | + }; | |
37 | + | |
38 | + const handleUpload = async () => { | |
39 | + const formData = new FormData(); | |
40 | + fileList.forEach((file) => { | |
41 | + //originFileObj二进制文件 | |
42 | + formData.append('file', file.originFileObj as RcFile); | |
43 | + }); | |
44 | + // console.log(fileList[0] as RcFile) | |
45 | + // formData.append('file', fileList[0] as RcFile); | |
46 | + setUploading(true); | |
47 | + // You can use any AJAX library you like | |
48 | + const res = await postServiceOrderImportExcel({ | |
49 | + data: formData, | |
50 | + headers: { | |
51 | + 'Content-Type': | |
52 | + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | |
53 | + }, | |
54 | + }); | |
55 | + | |
56 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
57 | + message.success(res.message); | |
58 | + onClose(); | |
59 | + } else { | |
60 | + if (res.message === '表格中没有数据') { | |
61 | + setUploading(false); | |
62 | + return; | |
63 | + } | |
64 | + //存在错误信息,下载错误信息模板 | |
65 | + exportLoading('正在下载错误信息...'); | |
66 | + downloadFile( | |
67 | + '/api/service/order/errorExcelInformation', | |
68 | + '订单.xlsx', | |
69 | + 'post', | |
70 | + formData, | |
71 | + exportLoadingDestory, | |
72 | + ); | |
73 | + } | |
74 | + | |
75 | + setUploading(false); | |
76 | + }; | |
77 | + | |
78 | + const props: UploadProps = { | |
79 | + onRemove: (file) => { | |
80 | + const index = fileList.indexOf(file); | |
81 | + const newFileList = fileList.slice(); | |
82 | + newFileList.splice(index, 1); | |
83 | + setFileList(newFileList); | |
84 | + }, | |
85 | + beforeUpload: (file) => { | |
86 | + setFileList([...fileList, file]); | |
87 | + | |
88 | + return false; | |
89 | + }, | |
90 | + fileList, | |
91 | + onChange: handleChange, | |
92 | + accept: '.xlsx', | |
93 | + }; | |
94 | + | |
95 | + return ( | |
96 | + <> | |
97 | + <Modal | |
98 | + width={500} | |
99 | + open | |
100 | + title="批量发货" | |
101 | + footer={[ | |
102 | + <Button key="cancel" onClick={onClose}> | |
103 | + 取消 | |
104 | + </Button>, | |
105 | + <Button | |
106 | + type="primary" | |
107 | + key="ok" | |
108 | + onClick={handleUpload} | |
109 | + disabled={fileList.length === 0} | |
110 | + loading={uploading} | |
111 | + > | |
112 | + {uploading ? '上传中' : '提交'} | |
113 | + </Button>, | |
114 | + ]} | |
115 | + onCancel={async () => { | |
116 | + onClose(); | |
117 | + }} | |
118 | + > | |
119 | + <div className="py-4 font-semibold"> | |
120 | + 导入发货信息 | |
121 | + <Button type="link" onClick={downloadTemplate}> | |
122 | + 下载模板 | |
123 | + </Button> | |
124 | + </div> | |
125 | + <Upload {...props}> | |
126 | + <Button icon={<UploadOutlined />} disabled={fileList.length > 0}> | |
127 | + 点击选择文件 | |
128 | + </Button> | |
129 | + </Upload> | |
130 | + </Modal> | |
131 | + {contextHolder} | |
132 | + </> | |
133 | + ); | |
134 | +}; | ... | ... |
src/pages/Order/FeedBack/InvoiceSubOrderInfoTable.tsx
0 → 100644
1 | +import { postServiceOrderGetReissueInfo } from '@/services'; | |
2 | +import type { ProColumns } from '@ant-design/pro-components'; | |
3 | +import { ProTable } from '@ant-design/pro-components'; | |
4 | +import { Button, Divider } from 'antd'; | |
5 | +import { useEffect, useState } from 'react'; | |
6 | + | |
7 | +const columns: ProColumns[] = [ | |
8 | + { | |
9 | + title: '发票号码', | |
10 | + width: 80, | |
11 | + dataIndex: 'invoiceNumber', | |
12 | + render: (_) => _, | |
13 | + }, | |
14 | + { | |
15 | + title: '关联订单', | |
16 | + dataIndex: 'subOrderIds', | |
17 | + render: (_, { subOrderIds }) => { | |
18 | + console.log(JSON.stringify(_)); | |
19 | + console.log(JSON.stringify(subOrderIds)); | |
20 | + return ( | |
21 | + <> | |
22 | + {subOrderIds.map((subOrderId, index) => { | |
23 | + return ( | |
24 | + <> | |
25 | + <Button | |
26 | + key={index} | |
27 | + className="pl-1 pr-0" | |
28 | + type="link" | |
29 | + target="_blank" | |
30 | + href={'/order/order?id=' + subOrderId} | |
31 | + > | |
32 | + {subOrderId} | |
33 | + </Button> | |
34 | + <Divider type="vertical" /> | |
35 | + </> | |
36 | + ); | |
37 | + })} | |
38 | + </> | |
39 | + ); | |
40 | + }, | |
41 | + }, | |
42 | +]; | |
43 | + | |
44 | +export default ({ subOrderIds }) => { | |
45 | + const [reissueInfos, setReissueInfos] = useState([]); | |
46 | + useEffect(() => { | |
47 | + console.log('info'); | |
48 | + const getReissueInfo = async () => { | |
49 | + let res = await postServiceOrderGetReissueInfo({ | |
50 | + data: subOrderIds, | |
51 | + }); | |
52 | + setReissueInfos(res.data); | |
53 | + }; | |
54 | + getReissueInfo(); | |
55 | + }, []); | |
56 | + return ( | |
57 | + <ProTable | |
58 | + dataSource={reissueInfos} | |
59 | + rowKey="key" | |
60 | + pagination={false} | |
61 | + size={'small'} | |
62 | + //设置左右下边距为0 | |
63 | + options={false} | |
64 | + columns={columns} | |
65 | + search={false} | |
66 | + dateFormatter="string" | |
67 | + headerTitle="发票信息" | |
68 | + /> | |
69 | + ); | |
70 | +}; | ... | ... |
src/pages/Order/FeedBack/InvoicingDrawerForm.tsx
0 → 100644
1 | +// import { PlusOutlined } from '@ant-design/icons'; | |
2 | +import InvoiceModal from '@/pages/Invoice/waitProcessRecord/components/InvoiceModal'; | |
3 | +import { | |
4 | + postServiceConstGetPayeeEnum, | |
5 | + postServiceConstInitInvoiceDetailNames, | |
6 | + postServiceConstInvoiceType, | |
7 | + postServiceConstInvoicingType, | |
8 | + postServiceConstListInvoiceDetailNames, | |
9 | + postServiceInvoiceApplyInvoice, | |
10 | + postServiceInvoiceQueryCompanyInfo, | |
11 | + postServiceInvoiceWaitReissueInvoices, | |
12 | +} from '@/services'; | |
13 | +import { | |
14 | + FloatAdd, | |
15 | + FloatMul, | |
16 | + FloatSub, | |
17 | + enum2ReverseSelect, | |
18 | + enumToSelect, | |
19 | +} from '@/utils'; | |
20 | +import { convertCurrency } from '@/utils/numberUtil'; | |
21 | +import { | |
22 | + DrawerForm, | |
23 | + FormListActionType, | |
24 | + ProCard, | |
25 | + ProFormDigit, | |
26 | + ProFormGroup, | |
27 | + ProFormInstance, | |
28 | + ProFormList, | |
29 | + ProFormMoney, | |
30 | + ProFormSelect, | |
31 | + ProFormText, | |
32 | + ProFormTextArea, | |
33 | +} from '@ant-design/pro-components'; | |
34 | +import { Button, Divider, Form, Space, Tooltip, message } from 'antd'; | |
35 | +import { useEffect, useRef, useState } from 'react'; | |
36 | + | |
37 | +export default ({ dataList, setVisible, mainOrder, onClose }) => { | |
38 | + // let subOrderIds = dataList?.map((item) => { | |
39 | + // return item.id; | |
40 | + // }) | |
41 | + const [form] = Form.useForm(); | |
42 | + const [projectOptions] = useState(); | |
43 | + const [dataListCopy] = useState(dataList); | |
44 | + const listActionRef = useRef<FormListActionType>(); | |
45 | + const formRef = useRef<ProFormInstance>(); | |
46 | + useEffect(() => { | |
47 | + const initOptions = async () => { | |
48 | + const res = await postServiceConstInitInvoiceDetailNames({ | |
49 | + data: dataListCopy.map((item) => { | |
50 | + return item.productName; | |
51 | + }), | |
52 | + }); | |
53 | + const options = res.data; | |
54 | + const datas = dataListCopy.map((item) => { | |
55 | + return { | |
56 | + ...item, | |
57 | + projectName: options[item.productName], | |
58 | + }; | |
59 | + }); | |
60 | + const initialValue = datas.map((item) => { | |
61 | + return { | |
62 | + productName: item.productName, | |
63 | + projectName: item.projectName, | |
64 | + subOrderId: item.id, | |
65 | + specification: item.parameters, | |
66 | + unit: item.unit, | |
67 | + quantity: item.quantity, | |
68 | + price: item.productPrice, | |
69 | + totalPrice: item.quantity * item.productPrice, | |
70 | + }; | |
71 | + }); | |
72 | + form.setFieldValue('invoiceDetails', initialValue); | |
73 | + form.setFieldValue('contacts', mainOrder.customerName); | |
74 | + }; | |
75 | + initOptions(); | |
76 | + }, []); | |
77 | + | |
78 | + useEffect(() => {}, [projectOptions]); | |
79 | + | |
80 | + function copyToClipboard(text: string) { | |
81 | + // 创建一个临时的textarea元素 | |
82 | + const textarea = document.createElement('textarea'); | |
83 | + textarea.value = text; | |
84 | + | |
85 | + // 将textarea元素添加到DOM中 | |
86 | + document.body.appendChild(textarea); | |
87 | + | |
88 | + // 选中textarea中的文本 | |
89 | + textarea.select(); | |
90 | + | |
91 | + try { | |
92 | + // 尝试执行复制命令 | |
93 | + document.execCommand('copy'); | |
94 | + return true; | |
95 | + } catch (err) { | |
96 | + return false; | |
97 | + } finally { | |
98 | + // 移除临时的textarea元素 | |
99 | + document.body.removeChild(textarea); | |
100 | + } | |
101 | + } | |
102 | + // 定义一个计算总金额的函数 | |
103 | + const calculateTotalPrice = (index: number) => { | |
104 | + const invoiceDetails = form.getFieldValue('invoiceDetails'); | |
105 | + if (invoiceDetails && invoiceDetails[index]) { | |
106 | + const quantity = invoiceDetails[index].quantity || 0; | |
107 | + const price = invoiceDetails[index].price || 0; | |
108 | + const totalPrice = FloatMul(quantity, price); | |
109 | + const newInvoiceDetails = [...invoiceDetails]; | |
110 | + newInvoiceDetails[index] = { ...newInvoiceDetails[index], totalPrice }; | |
111 | + form.setFieldsValue({ invoiceDetails: newInvoiceDetails }); | |
112 | + } | |
113 | + const totalPrice = invoiceDetails.reduce((accumulator, currentValue) => { | |
114 | + return FloatAdd(accumulator, currentValue.quantity * currentValue.price); | |
115 | + }, 0); | |
116 | + form.setFieldValue('price', totalPrice); | |
117 | + }; | |
118 | + useEffect(() => {}, []); | |
119 | + return ( | |
120 | + <DrawerForm | |
121 | + open | |
122 | + title="申请开票" | |
123 | + resize={{ | |
124 | + maxWidth: window.innerWidth * 0.8, | |
125 | + minWidth: 500, | |
126 | + }} | |
127 | + form={form} | |
128 | + formRef={formRef} | |
129 | + autoFocusFirstInput | |
130 | + drawerProps={{ | |
131 | + destroyOnClose: true, | |
132 | + }} | |
133 | + submitter={{ | |
134 | + render: (props, defaultDoms) => { | |
135 | + return [ | |
136 | + <InvoiceModal | |
137 | + key={'invoicePreview'} | |
138 | + button={<Button type="primary"> 发票预览 </Button>} | |
139 | + getRecord={() => { | |
140 | + const totalPrice = form | |
141 | + .getFieldValue('invoiceDetails') | |
142 | + .reduce((accumulator, currentValue) => { | |
143 | + return FloatAdd(accumulator, currentValue.totalPrice); | |
144 | + }, 0); | |
145 | + const partyBName = form.getFieldValue('partyBName'); | |
146 | + const openBank = form.getFieldValue('openBank'); | |
147 | + const bankAccount = form.getFieldValue('bankAccount'); | |
148 | + const bankCode = form.getFieldValue('bankCode'); | |
149 | + return { | |
150 | + ...form.getFieldsValue(), | |
151 | + totalPrice: totalPrice, | |
152 | + totalPriceText: convertCurrency(totalPrice), | |
153 | + comment: | |
154 | + '开户名称: ' + | |
155 | + partyBName + | |
156 | + '\n' + | |
157 | + '开户行: ' + | |
158 | + openBank + | |
159 | + '\n' + | |
160 | + '账号: ' + | |
161 | + bankAccount + | |
162 | + '\n' + | |
163 | + '银行联行号: ' + | |
164 | + bankCode, | |
165 | + }; | |
166 | + }} | |
167 | + />, | |
168 | + ...defaultDoms, | |
169 | + ]; | |
170 | + }, | |
171 | + }} | |
172 | + submitTimeout={2000} | |
173 | + onFinish={async (values) => { | |
174 | + postServiceInvoiceApplyInvoice({ | |
175 | + data: { | |
176 | + ...values, | |
177 | + subOrderIds: dataListCopy.map((item) => { | |
178 | + return item.id; | |
179 | + }), | |
180 | + }, | |
181 | + }); | |
182 | + onClose(); | |
183 | + }} | |
184 | + onOpenChange={(val) => { | |
185 | + return !val && setVisible(); | |
186 | + }} | |
187 | + > | |
188 | + <ProFormList | |
189 | + name="subOrderIdObjs" | |
190 | + readonly={true} | |
191 | + label="开票订单" | |
192 | + initialValue={dataListCopy.map((item) => { | |
193 | + return { | |
194 | + value: item.id, | |
195 | + }; | |
196 | + })} | |
197 | + deleteIconProps={false} | |
198 | + copyIconProps={false} | |
199 | + > | |
200 | + <ProFormGroup key="group"> | |
201 | + <ProFormText readonly={true} name="value" label="" /> | |
202 | + </ProFormGroup> | |
203 | + </ProFormList> | |
204 | + <ProFormSelect | |
205 | + name="ReissueInvoiceRecordIds" | |
206 | + label="重开的发票" | |
207 | + fieldProps={{ | |
208 | + mode: 'multiple', | |
209 | + }} | |
210 | + placeholder="请选择重开发票" | |
211 | + request={async () => { | |
212 | + let reissueIds = dataListCopy.map((item) => { | |
213 | + return item.id; | |
214 | + }); | |
215 | + let res = await postServiceInvoiceWaitReissueInvoices({ | |
216 | + data: reissueIds, | |
217 | + }); | |
218 | + return enum2ReverseSelect(res.data); | |
219 | + }} | |
220 | + /> | |
221 | + <ProFormSelect | |
222 | + key="key" | |
223 | + label="购方名称" | |
224 | + width="lg" | |
225 | + showSearch | |
226 | + name="partyAName" | |
227 | + placeholder="请搜索购方" | |
228 | + rules={[{ required: true, message: '购方名称必填' }]} | |
229 | + onChange={(_, option) => { | |
230 | + form.setFieldValue('partyATaxid', option.taxId); | |
231 | + }} | |
232 | + fieldProps={{ | |
233 | + optionItemRender(item) { | |
234 | + if (item.type === 'add') { | |
235 | + return <>{item.name}</>; | |
236 | + } | |
237 | + return ( | |
238 | + <> | |
239 | + {item.name} | |
240 | + <Divider type="vertical" /> | |
241 | + {item.taxId} | |
242 | + </> | |
243 | + ); | |
244 | + }, | |
245 | + }} | |
246 | + debounceTime={1000} | |
247 | + request={async (value) => { | |
248 | + const keywords = value.keyWords; | |
249 | + const res = await postServiceInvoiceQueryCompanyInfo({ | |
250 | + data: { | |
251 | + nameLike: keywords, | |
252 | + taxIdIsNotNull: true, | |
253 | + }, | |
254 | + }); | |
255 | + let options = res?.data?.map((company) => { | |
256 | + return { | |
257 | + ...company, | |
258 | + label: company.name, | |
259 | + value: company.name, | |
260 | + key: company.id, | |
261 | + }; | |
262 | + }); | |
263 | + | |
264 | + //第一个商品默认为要新增的商品 | |
265 | + if (keywords.trim() !== '') { | |
266 | + options.unshift({ | |
267 | + name: keywords, | |
268 | + type: 'add', | |
269 | + label: keywords, | |
270 | + value: keywords, | |
271 | + key: keywords, | |
272 | + }); | |
273 | + } | |
274 | + return options; | |
275 | + }} | |
276 | + /> | |
277 | + <ProFormText | |
278 | + width="md" | |
279 | + name="partyATaxid" | |
280 | + label="购方税号" | |
281 | + rules={[{ required: true, message: '购方税号必填' }]} | |
282 | + placeholder="请输入名称" | |
283 | + /> | |
284 | + <ProFormText | |
285 | + width="md" | |
286 | + name="partyAOpenBank" | |
287 | + label="开户银行" | |
288 | + placeholder="请输入名称" | |
289 | + /> | |
290 | + <ProFormText | |
291 | + width="md" | |
292 | + name="partyABankAccount" | |
293 | + label="开户行账号" | |
294 | + placeholder="请输入名称" | |
295 | + /> | |
296 | + <ProFormText | |
297 | + name="contacts" | |
298 | + label="联系人" | |
299 | + rules={[{ required: true, message: '请选择银行联行号!' }]} | |
300 | + /> | |
301 | + <ProFormSelect | |
302 | + name="invoicingType" | |
303 | + label="开具类型" | |
304 | + request={async () => { | |
305 | + let invoicingTypeRet = await postServiceConstInvoicingType(); | |
306 | + let options = enumToSelect(invoicingTypeRet.data); | |
307 | + return options; | |
308 | + }} | |
309 | + placeholder="请选择开具类型" | |
310 | + rules={[{ required: true, message: '请选择开具类型!' }]} | |
311 | + /> | |
312 | + <ProFormSelect | |
313 | + name="type" | |
314 | + label="开票类型" | |
315 | + placeholder="请选择开票类型" | |
316 | + rules={[{ required: true, message: '请选择开票类型!' }]} | |
317 | + request={async () => { | |
318 | + let invoiceTypeRet = await postServiceConstInvoiceType(); | |
319 | + let options = enumToSelect(invoiceTypeRet.data); | |
320 | + return options; | |
321 | + }} | |
322 | + /> | |
323 | + <ProFormSelect | |
324 | + name="partyB" | |
325 | + label="开票收款单位" | |
326 | + request={async () => { | |
327 | + const res = await postServiceConstGetPayeeEnum(); | |
328 | + let options = res?.data?.map((payee: any) => { | |
329 | + return { | |
330 | + ...payee, | |
331 | + label: payee.payeeName, | |
332 | + value: payee.name, | |
333 | + }; | |
334 | + }); | |
335 | + return options; | |
336 | + }} | |
337 | + onChange={(_, option) => { | |
338 | + if (option) { | |
339 | + form.setFieldsValue({ | |
340 | + partyBName: option.payeeName, | |
341 | + partyBTaxid: option.taxId, | |
342 | + bankAccount: option.bankAccount, | |
343 | + openBank: option.openBank, | |
344 | + bankCode: option.bankCode, | |
345 | + }); | |
346 | + } | |
347 | + }} | |
348 | + placeholder="请选择收款单位" | |
349 | + rules={[{ required: true, message: '请选择收款单位!' }]} | |
350 | + /> | |
351 | + <ProFormText | |
352 | + name="partyBName" | |
353 | + label="开票收款单位名称" | |
354 | + hidden | |
355 | + rules={[{ required: true, message: '请选择收款单位!' }]} | |
356 | + /> | |
357 | + <ProFormText | |
358 | + name="partyBTaxid" | |
359 | + label="开票收款单位税号" | |
360 | + hidden | |
361 | + rules={[{ required: true, message: '请选择收款单位!' }]} | |
362 | + /> | |
363 | + <ProFormText | |
364 | + name="bankAccount" | |
365 | + label="账号" | |
366 | + hidden | |
367 | + rules={[{ required: true, message: '请选择账号!' }]} | |
368 | + /> | |
369 | + <ProFormText | |
370 | + name="openBank" | |
371 | + label="开户行" | |
372 | + hidden | |
373 | + rules={[{ required: true, message: '请选择开户行!' }]} | |
374 | + /> | |
375 | + <ProFormText | |
376 | + name="bankCode" | |
377 | + label="银行联行号" | |
378 | + hidden | |
379 | + rules={[{ required: true, message: '请选择银行联行号!' }]} | |
380 | + /> | |
381 | + <ProFormSelect | |
382 | + name="isUrgent" | |
383 | + label="是否加急" | |
384 | + valueEnum={{ | |
385 | + true: '是', | |
386 | + false: '否', | |
387 | + }} | |
388 | + placeholder="请选择是否加急" | |
389 | + rules={[{ required: true, message: '请选择是否加急!' }]} | |
390 | + /> | |
391 | + <ProFormMoney | |
392 | + label="开票金额" | |
393 | + name="price" | |
394 | + locale="zh-CN" | |
395 | + disabled={true} | |
396 | + rules={[{ required: true, message: '请填写开票金额!' }]} | |
397 | + initialValue={dataListCopy.reduce((accumulator, currentValue) => { | |
398 | + return accumulator + currentValue.subOrderPayment; | |
399 | + }, 0)} | |
400 | + /> | |
401 | + <ProFormList | |
402 | + name="invoiceDetails" | |
403 | + label="开票明细" | |
404 | + actionRef={listActionRef} | |
405 | + actionGuard={{ | |
406 | + beforeRemoveRow: async (index) => { | |
407 | + const list = listActionRef.current?.getList(); | |
408 | + const totalPrice = list[index].totalPrice; | |
409 | + form.setFieldValue( | |
410 | + 'price', | |
411 | + FloatSub(form.getFieldValue('price'), totalPrice), | |
412 | + ); | |
413 | + return true; | |
414 | + }, | |
415 | + }} | |
416 | + rules={[ | |
417 | + { | |
418 | + required: true, | |
419 | + validator: async (_, value) => { | |
420 | + if (value && value.length > 0) { | |
421 | + return; | |
422 | + } | |
423 | + throw new Error('至少要有一项!'); | |
424 | + }, | |
425 | + }, | |
426 | + ]} | |
427 | + itemRender={(doms, listMeta) => { | |
428 | + return ( | |
429 | + <ProCard | |
430 | + bordered | |
431 | + extra={doms.action} | |
432 | + title={'明细' + (listMeta.index + 1)} | |
433 | + style={{ | |
434 | + marginBlockEnd: 8, | |
435 | + }} | |
436 | + > | |
437 | + <Tooltip title="点击复制商品名称"> | |
438 | + <Space | |
439 | + className="hover:cursor-pointer" | |
440 | + style={{ | |
441 | + margin: 16, | |
442 | + marginTop: 4, | |
443 | + marginLeft: 0, | |
444 | + fontSize: 15, | |
445 | + }} | |
446 | + onClick={() => { | |
447 | + copyToClipboard(listMeta.record.productName); | |
448 | + message.info('商品名称复制成功!'); | |
449 | + }} | |
450 | + > | |
451 | + 商品名称:{listMeta.record.productName} | |
452 | + </Space> | |
453 | + </Tooltip> | |
454 | + <ProFormSelect | |
455 | + key={'projectName' + listMeta.index} | |
456 | + width="md" | |
457 | + showSearch | |
458 | + name="projectName" | |
459 | + rules={[{ required: true, message: '请输入开票项目名称!' }]} | |
460 | + request={async (value) => { | |
461 | + const keywords = value.keyWords; | |
462 | + const res = await postServiceConstListInvoiceDetailNames({ | |
463 | + data: { | |
464 | + nameLike: keywords, | |
465 | + }, | |
466 | + }); | |
467 | + let options = res?.data?.map((c: any) => { | |
468 | + return { | |
469 | + ...c, | |
470 | + label: | |
471 | + '*' + | |
472 | + c.productAndServiceCatagoryAbbreviation + | |
473 | + '*' + | |
474 | + c.name, | |
475 | + value: | |
476 | + '*' + | |
477 | + c.productAndServiceCatagoryAbbreviation + | |
478 | + '*' + | |
479 | + c?.name, | |
480 | + key: c.id, | |
481 | + }; | |
482 | + }); | |
483 | + return options; | |
484 | + }} | |
485 | + fieldProps={{ | |
486 | + filterOption() { | |
487 | + return true; | |
488 | + }, | |
489 | + }} | |
490 | + onChange={(_, option) => { | |
491 | + let index = listMeta.index; | |
492 | + let copyList = form.getFieldValue('invoiceDetails'); | |
493 | + let currentData = copyList[index]; | |
494 | + currentData.projectName = | |
495 | + '*' + | |
496 | + option.productAndServiceCatagoryAbbreviation + | |
497 | + '*' + | |
498 | + option.name; | |
499 | + form.setFieldValue('invoiceDetails', copyList); | |
500 | + }} | |
501 | + debounceTime={1000} | |
502 | + label="项目名称" | |
503 | + initialValue={listMeta.record.projectName} | |
504 | + placeholder="请输入名称" | |
505 | + /> | |
506 | + <ProFormText | |
507 | + key={'specification' + listMeta.index} | |
508 | + name="specification" | |
509 | + label="规格型号" | |
510 | + rules={[ | |
511 | + { | |
512 | + message: '规格型号不能为空!', | |
513 | + required: true, | |
514 | + }, | |
515 | + { | |
516 | + validator: (_, value) => { | |
517 | + let len = 0; | |
518 | + // 判断是否为全角字符 | |
519 | + for (let i = 0; i < value.length; i++) { | |
520 | + // 获取字符的Unicode值 | |
521 | + const code = value.charCodeAt(i); | |
522 | + // 判断是否为全角字符 | |
523 | + if ( | |
524 | + (code >= 0xff01 && code <= 0xff5e) || | |
525 | + (code >= 0x4e00 && code <= 0x9fff) | |
526 | + ) { | |
527 | + len += 2; // 全角字符 | |
528 | + } else { | |
529 | + len += 1; // 半角字符 | |
530 | + } | |
531 | + } | |
532 | + if (len <= 40) { | |
533 | + return Promise.resolve(); | |
534 | + } | |
535 | + return Promise.reject( | |
536 | + new Error('规格型号不能超过40个字符!'), | |
537 | + ); | |
538 | + }, | |
539 | + }, | |
540 | + ]} | |
541 | + placeholder="请输入名称" | |
542 | + /> | |
543 | + <ProFormText | |
544 | + key={'unit' + listMeta.index} | |
545 | + name="unit" | |
546 | + label="单位" | |
547 | + placeholder="请输入名称" | |
548 | + /> | |
549 | + <ProFormDigit | |
550 | + key={'quantity' + listMeta.index} | |
551 | + label="数量" | |
552 | + name="quantity" | |
553 | + rules={[ | |
554 | + { | |
555 | + validator: (_, value) => { | |
556 | + if (value === undefined || value > 0) { | |
557 | + return Promise.resolve(); | |
558 | + } | |
559 | + return Promise.reject(new Error('数量必须大于0')); | |
560 | + }, | |
561 | + }, | |
562 | + ]} | |
563 | + onChange={() => calculateTotalPrice(listMeta.index)} | |
564 | + /> | |
565 | + | |
566 | + <ProFormDigit | |
567 | + key={'price' + listMeta.index} | |
568 | + label="单价" | |
569 | + name="price" | |
570 | + rules={[ | |
571 | + { | |
572 | + validator: (_, value) => { | |
573 | + if (value === undefined || value > 0) { | |
574 | + return Promise.resolve(); | |
575 | + } | |
576 | + return Promise.reject(new Error('单价必须大于0')); | |
577 | + }, | |
578 | + }, | |
579 | + ]} | |
580 | + onChange={() => calculateTotalPrice(listMeta.index)} | |
581 | + /> | |
582 | + | |
583 | + <ProFormMoney | |
584 | + key={'totalPrice' + listMeta.index} | |
585 | + label="金额" | |
586 | + name="totalPrice" | |
587 | + rules={[ | |
588 | + { | |
589 | + validator: (_, value) => { | |
590 | + if (value === undefined || value > 0) { | |
591 | + return Promise.resolve(); | |
592 | + } | |
593 | + return Promise.reject(new Error('金额必须大于0')); | |
594 | + }, | |
595 | + }, | |
596 | + ]} | |
597 | + readonly={true} | |
598 | + locale="zh-CN" | |
599 | + /> | |
600 | + </ProCard> | |
601 | + ); | |
602 | + }} | |
603 | + ></ProFormList> | |
604 | + <ProFormTextArea | |
605 | + name="applyInvoicingNotes" | |
606 | + label="备注" | |
607 | + placeholder="请输入名称" | |
608 | + /> | |
609 | + </DrawerForm> | |
610 | + ); | |
611 | +}; | ... | ... |
src/pages/Order/FeedBack/KingdeeCustomerModal.tsx
0 → 100644
1 | +import { | |
2 | + postKingdeeRepCustomerDetail, | |
3 | + postKingdeeRepCustomerSave, | |
4 | +} from '@/services'; | |
5 | +import { getTeacherCustomFieldNumber } from '@/utils/kingdee'; | |
6 | +import { CloseCircleOutlined } from '@ant-design/icons'; | |
7 | +import { | |
8 | + ModalForm, | |
9 | + ProFormGroup, | |
10 | + ProFormList, | |
11 | + ProFormText, | |
12 | +} from '@ant-design/pro-components'; | |
13 | +import { Form, message } from 'antd'; | |
14 | + | |
15 | +// import { cloneDeep } from 'lodash'; | |
16 | +export default ({ setVisible, data, onClose }) => { | |
17 | + const [form] = Form.useForm(); | |
18 | + | |
19 | + /** | |
20 | + * 回显客户信息 | |
21 | + * @param id | |
22 | + */ | |
23 | + async function queryAndShowCustomer(id: any) { | |
24 | + //查询客户信息 | |
25 | + let res = await postKingdeeRepCustomerDetail({ | |
26 | + data: { | |
27 | + id: id, | |
28 | + }, | |
29 | + }); | |
30 | + | |
31 | + if (res) { | |
32 | + form.setFieldValue('name', res.name); | |
33 | + form.setFieldValue('id', res.id); | |
34 | + form.setFieldValue('contact_persons', res.bomentity); | |
35 | + let customFiledNumber = await getTeacherCustomFieldNumber(); | |
36 | + form.setFieldValue('teacherName', res.custom_field[customFiledNumber]); | |
37 | + } | |
38 | + } | |
39 | + | |
40 | + if (data) { | |
41 | + //修改 | |
42 | + if (data.id) { | |
43 | + queryAndShowCustomer(data.id); | |
44 | + } else { | |
45 | + //新增 | |
46 | + form.setFieldValue('name', data.name); | |
47 | + form.setFieldValue('contact_persons', [{}]); | |
48 | + } | |
49 | + } | |
50 | + return ( | |
51 | + <> | |
52 | + <ModalForm | |
53 | + width={900} | |
54 | + open | |
55 | + title="客户信息" | |
56 | + form={form} | |
57 | + autoFocusFirstInput | |
58 | + modalProps={{ | |
59 | + okText: '保存', | |
60 | + cancelText: '取消', | |
61 | + destroyOnClose: true, | |
62 | + onCancel: () => { | |
63 | + setVisible(false); | |
64 | + }, | |
65 | + }} | |
66 | + onFinish={async (values) => { | |
67 | + //查询客户自定义字段,课题组 | |
68 | + let custom_field_umber = await getTeacherCustomFieldNumber(); | |
69 | + | |
70 | + if (custom_field_umber) { | |
71 | + let customFieldObj = {}; | |
72 | + customFieldObj[custom_field_umber] = values.teacherName; | |
73 | + values.custom_field = customFieldObj; | |
74 | + } | |
75 | + let customSaveRes = await postKingdeeRepCustomerSave({ | |
76 | + data: values, | |
77 | + }); | |
78 | + if (customSaveRes) { | |
79 | + let id_number_map = customSaveRes.id_number_map; | |
80 | + let ids = customSaveRes.ids; | |
81 | + if (id_number_map && ids) { | |
82 | + message.success('保存成功'); | |
83 | + let id = ids[0]; | |
84 | + onClose(id); | |
85 | + } | |
86 | + } | |
87 | + }} | |
88 | + onOpenChange={setVisible} | |
89 | + > | |
90 | + <ProFormText key="key" name="id" label="id" placeholder="id" hidden /> | |
91 | + <ProFormGroup key="group"> | |
92 | + <ProFormText | |
93 | + name="name" | |
94 | + width="md" | |
95 | + label={ | |
96 | + <> | |
97 | + <span>客户名称</span> | |
98 | + <span className="pl-2 text-xs text-gray-400"> | |
99 | + 请按照[单位]-[姓名][手机号]命名,例如:清华大学-张三12345678919 | |
100 | + </span> | |
101 | + </> | |
102 | + } | |
103 | + initialValue={data} | |
104 | + placeholder="请输入客户名称" | |
105 | + rules={[ | |
106 | + { | |
107 | + required: true, | |
108 | + pattern: new RegExp('^.+-.+$'), | |
109 | + message: | |
110 | + '格式错误,若无单位可写:“无-姓名手机号”,例如:无-张三12345678919', | |
111 | + }, | |
112 | + { required: true, message: '客户名称必填' }, | |
113 | + ]} | |
114 | + /> | |
115 | + <ProFormText | |
116 | + name="teacherName" | |
117 | + width="md" | |
118 | + label="课题组老师" | |
119 | + placeholder="请输入课题组老师" | |
120 | + rules={[ | |
121 | + { required: true, message: '课题组老师必填,若没有请填“无”' }, | |
122 | + ]} | |
123 | + /> | |
124 | + </ProFormGroup> | |
125 | + | |
126 | + <ProFormList | |
127 | + creatorButtonProps={{ disabled: false }} | |
128 | + name="contact_persons" | |
129 | + label="联系人信息" | |
130 | + actionGuard={{ | |
131 | + beforeRemoveRow: async () => { | |
132 | + return new Promise((resolve) => { | |
133 | + let contactPersons = form.getFieldValue('contact_persons'); | |
134 | + if (contactPersons.length === 1) { | |
135 | + message.error('至少要有一个联系人'); | |
136 | + resolve(false); | |
137 | + return; | |
138 | + } | |
139 | + resolve(true); | |
140 | + }); | |
141 | + }, | |
142 | + beforeAddRow: (defaultValue) => { | |
143 | + defaultValue.id = undefined; //复制的时候要把id去掉 | |
144 | + return defaultValue; | |
145 | + }, | |
146 | + }} | |
147 | + deleteIconProps={{ | |
148 | + Icon: CloseCircleOutlined, | |
149 | + tooltipText: '不需要这行了', | |
150 | + }} | |
151 | + > | |
152 | + <ProFormGroup key="group"> | |
153 | + {[ | |
154 | + <ProFormText | |
155 | + key="key" | |
156 | + name="id" | |
157 | + label="id" | |
158 | + placeholder="id" | |
159 | + hidden | |
160 | + />, | |
161 | + <ProFormText | |
162 | + key="key" | |
163 | + name="contact_person" | |
164 | + label="收货人姓名" | |
165 | + placeholder="联系人姓名" | |
166 | + rules={[{ required: true, message: '收货人姓名必填' }]} | |
167 | + />, | |
168 | + <ProFormText | |
169 | + key="key" | |
170 | + name="mobile" | |
171 | + label="联系方式" | |
172 | + placeholder="联系方式" | |
173 | + rules={[{ required: true, message: '联系方式必填' }]} | |
174 | + />, | |
175 | + <ProFormText | |
176 | + key="key" | |
177 | + name="contact_address" | |
178 | + label="收货地址" | |
179 | + width="md" | |
180 | + placeholder="请输入收货地址" | |
181 | + rules={[{ required: true, message: '收货地址必填' }]} | |
182 | + />, | |
183 | + ]} | |
184 | + </ProFormGroup> | |
185 | + </ProFormList> | |
186 | + </ModalForm> | |
187 | + </> | |
188 | + ); | |
189 | +}; | ... | ... |
src/pages/Order/FeedBack/LazySelect.tsx
0 → 100644
1 | +import { Select, Spin } from 'antd'; | |
2 | +import debounce from 'lodash/debounce'; | |
3 | +import difference from 'lodash/difference'; | |
4 | +import { useEffect, useState } from 'react'; | |
5 | + | |
6 | +/** | |
7 | + * 懒加载 Select ,适用于数据超大的下拉框 | |
8 | + * @param {Select 官方属性} props | |
9 | + */ | |
10 | +const LazySelect = (props) => { | |
11 | + const { value, onChange, query, pageSize } = props; | |
12 | + // 清除 porps 中 query,避免控制台警告 | |
13 | + const selectProps = { ...props, query: undefined }; | |
14 | + | |
15 | + const [selected, setSelected] = useState(value); | |
16 | + const [data, setData] = useState([]); | |
17 | + const [loading, setLoading] = useState(false); | |
18 | + const [current, setCurrent] = useState(1); | |
19 | + const [total, setTotal] = useState(0); | |
20 | + const [searchText] = useState(''); | |
21 | + | |
22 | + const getSelectedArray = (obj) => { | |
23 | + let selectedValues = obj; | |
24 | + // 如果是单选,将值封装为数组 | |
25 | + if (obj && obj instanceof Array === false) { | |
26 | + selectedValues = [obj]; | |
27 | + } | |
28 | + return selectedValues; | |
29 | + }; | |
30 | + | |
31 | + // 添加 300 毫秒防抖 | |
32 | + const handleQuery = debounce(async (param) => { | |
33 | + setLoading(true); | |
34 | + const resp = await query(param); | |
35 | + const resData = resp.data; | |
36 | + let options = resData?.data?.map((p: any) => { | |
37 | + return { | |
38 | + ...p, | |
39 | + label: p.productName, | |
40 | + value: p.productName, | |
41 | + key: p.id, | |
42 | + }; | |
43 | + }); | |
44 | + // 搜索服务端异步加载 | |
45 | + // const handleSearch = (filter) => { | |
46 | + // setSearchText(filter); | |
47 | + // handleQuery({ | |
48 | + // filter, | |
49 | + // selectedValues: getSelectedArray(selected), | |
50 | + // pageSize, | |
51 | + // current | |
52 | + // }); | |
53 | + // }; | |
54 | + | |
55 | + //第一个商品默认为要新增的商品 | |
56 | + // if (searchValue?.trim() !== "") { | |
57 | + // options.unshift({ productName: searchValue, type: "add", label: searchValue, value: searchValue }) | |
58 | + // } | |
59 | + // return options; | |
60 | + setTotal(resData.total); | |
61 | + setData(data.concat(options)); | |
62 | + setLoading(false); | |
63 | + }, 300); | |
64 | + | |
65 | + // 组件初始化时加载一次数据 | |
66 | + useEffect(() => { | |
67 | + handleQuery({ | |
68 | + filter: '', | |
69 | + selectedValues: getSelectedArray(value), | |
70 | + }); | |
71 | + }, []); | |
72 | + | |
73 | + // 外部注入的 value 变化后,如果 value 在 data 中不存在,则加载数据 | |
74 | + useEffect(() => { | |
75 | + setSelected(value); | |
76 | + const dataKeys = data.map((item) => item.value); | |
77 | + const diff = difference(getSelectedArray(value), dataKeys); | |
78 | + if (diff && diff.length > 0) { | |
79 | + handleQuery({ | |
80 | + filter: '', | |
81 | + selectedValues: getSelectedArray(value), | |
82 | + }); | |
83 | + } | |
84 | + }, [value]); | |
85 | + | |
86 | + const keywordChange = (newWord: string) => { | |
87 | + setData([]); | |
88 | + setTotal(0); | |
89 | + setCurrent(1); | |
90 | + handleSearch(newWord); | |
91 | + }; | |
92 | + | |
93 | + const handleChange = (newValue, option) => { | |
94 | + setSelected(newValue); | |
95 | + if (onChange) { | |
96 | + // 将值通过 onChange 传递到外部 | |
97 | + onChange(newValue, option); | |
98 | + } | |
99 | + }; | |
100 | + | |
101 | + const scrollEnd = (e) => { | |
102 | + e.persist(); | |
103 | + const { target } = e; | |
104 | + // 滚动 触底 看接口是否还有剩余的值没传过来 | |
105 | + if (target.scrollTop + target.offsetHeight === target.scrollHeight) { | |
106 | + if (current * pageSize < total) { | |
107 | + setCurrent(current + 1); | |
108 | + handleSearch(searchText); | |
109 | + } | |
110 | + } | |
111 | + }; | |
112 | + | |
113 | + return ( | |
114 | + <Select | |
115 | + {...selectProps} | |
116 | + value={selected} | |
117 | + loading={loading} | |
118 | + onSearch={keywordChange} | |
119 | + onChange={handleChange} | |
120 | + onPopupScroll={scrollEnd} | |
121 | + filterOption={false} | |
122 | + options={data} | |
123 | + showSearch | |
124 | + showArrow | |
125 | + notFoundContent={loading ? <Spin size="small" /> : null} | |
126 | + > | |
127 | + {/* {data.map(d => ( | |
128 | + <Option key={d.value} title={d.label}> | |
129 | + {d.label} | |
130 | + </Option> | |
131 | + ))} */} | |
132 | + </Select> | |
133 | + ); | |
134 | +}; | |
135 | + | |
136 | +export default LazySelect; | ... | ... |
src/pages/Order/FeedBack/MessageListDrawer.tsx
0 → 100644
1 | +import ButtonConfirm from '@/components/ButtomConfirm'; | |
2 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
3 | +import { | |
4 | + postOrderErpMessageQueryMyMessage, | |
5 | + postOrderErpMessageRead, | |
6 | + postOrderErpMessageReadAll, | |
7 | +} from '@/services'; | |
8 | +import { formatDateTime, getUserInfo } from '@/utils'; | |
9 | +import { UserOutlined } from '@ant-design/icons'; | |
10 | +import { | |
11 | + Avatar, | |
12 | + Badge, | |
13 | + Button, | |
14 | + Checkbox, | |
15 | + Drawer, | |
16 | + Flex, | |
17 | + List, | |
18 | + message, | |
19 | +} from 'antd'; | |
20 | +import { useEffect, useState } from 'react'; | |
21 | + | |
22 | +export default ({ setVisible }) => { | |
23 | + const userInfo = getUserInfo(); | |
24 | + const [current, setCurrent] = useState<number>(1); //当前页码 | |
25 | + const [total, setTotal] = useState(0); | |
26 | + const [messageListData, setMessageListData] = useState<any[]>([]); //列表数据 | |
27 | + const [loading, setLoading] = useState(false); | |
28 | + const [initLoading, setInitLoading] = useState(true); | |
29 | + const [onlyUnread, setOnlyUnread] = useState(false); | |
30 | + const [readFlagList, setReadFlagList] = useState<any[]>([]); //消息未读标识 | |
31 | + | |
32 | + /** | |
33 | + * 获取消息列表 | |
34 | + */ | |
35 | + async function getMessageListData() { | |
36 | + setLoading(true); | |
37 | + let res = await postOrderErpMessageQueryMyMessage({ | |
38 | + data: { | |
39 | + username: userInfo.username, | |
40 | + current: current, | |
41 | + isReaded: onlyUnread ? onlyUnread : null, | |
42 | + }, | |
43 | + }).finally(() => { | |
44 | + setLoading(false); | |
45 | + }); | |
46 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
47 | + setMessageListData([...messageListData, ...res?.data?.data]); | |
48 | + let reqReadNumList = res?.data?.data?.map((item: any) => { | |
49 | + return item.isReaded; | |
50 | + }); | |
51 | + | |
52 | + setReadFlagList([...readFlagList, ...reqReadNumList]); | |
53 | + setTotal(res?.data?.total); | |
54 | + } | |
55 | + } | |
56 | + | |
57 | + /** | |
58 | + * 跳转到订单列表 | |
59 | + */ | |
60 | + function toOrderList(mainOrderIds: any) { | |
61 | + window.open('/order/order?id=' + mainOrderIds.join(','), '_blank'); | |
62 | + } | |
63 | + | |
64 | + /** | |
65 | + * 仅展示未读 | |
66 | + */ | |
67 | + function onlyUnreadChange() { | |
68 | + setOnlyUnread(!onlyUnread); | |
69 | + setCurrent(1); | |
70 | + setMessageListData([]); | |
71 | + setReadFlagList([]); | |
72 | + } | |
73 | + | |
74 | + /** | |
75 | + * 仅展示未读 | |
76 | + */ | |
77 | + async function read(ids: any[]) { | |
78 | + let res = await postOrderErpMessageRead({ | |
79 | + data: ids, | |
80 | + }); | |
81 | + | |
82 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
83 | + message.success('已读'); | |
84 | + return true; | |
85 | + } | |
86 | + | |
87 | + return false; | |
88 | + } | |
89 | + | |
90 | + /** | |
91 | + * 全部标记为已读 | |
92 | + */ | |
93 | + async function readAll() { | |
94 | + let res = await postOrderErpMessageReadAll(); | |
95 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
96 | + message.success(res.message); | |
97 | + let newReadFlagList = readFlagList.map(() => true); | |
98 | + setReadFlagList(newReadFlagList); | |
99 | + } | |
100 | + } | |
101 | + | |
102 | + const loadMore = | |
103 | + !initLoading && !loading && messageListData.length < total ? ( | |
104 | + <div | |
105 | + style={{ | |
106 | + textAlign: 'center', | |
107 | + marginTop: 12, | |
108 | + height: 32, | |
109 | + lineHeight: '32px', | |
110 | + }} | |
111 | + > | |
112 | + <Button | |
113 | + onClick={() => { | |
114 | + setCurrent(current + 1); | |
115 | + }} | |
116 | + > | |
117 | + 加载更多 | |
118 | + </Button> | |
119 | + </div> | |
120 | + ) : messageListData.length > 0 && messageListData.length >= total ? ( | |
121 | + <span>没有更多消息了</span> | |
122 | + ) : null; | |
123 | + | |
124 | + useEffect(() => { | |
125 | + getMessageListData().finally(() => { | |
126 | + setInitLoading(false); | |
127 | + }); | |
128 | + }, [onlyUnread, current]); | |
129 | + | |
130 | + return ( | |
131 | + <> | |
132 | + <Drawer | |
133 | + title="消息列表" | |
134 | + onClose={() => { | |
135 | + setVisible(false); | |
136 | + }} | |
137 | + open={true} | |
138 | + width={450} | |
139 | + styles={{ body: { paddingTop: 0 } }} | |
140 | + > | |
141 | + <Flex align="center" justify="space-between"> | |
142 | + <div> | |
143 | + <Checkbox onChange={onlyUnreadChange} checked={onlyUnread}> | |
144 | + 仅展示未读 | |
145 | + </Checkbox> | |
146 | + </div> | |
147 | + | |
148 | + <ButtonConfirm | |
149 | + title={'是否全部标记为已读?'} | |
150 | + text={'全部标记为已读'} | |
151 | + className="p-0" | |
152 | + onConfirm={readAll} | |
153 | + placement="bottomLeft" | |
154 | + /> | |
155 | + </Flex> | |
156 | + | |
157 | + <List | |
158 | + className="demo-loadmore-list" | |
159 | + loading={initLoading} | |
160 | + itemLayout="horizontal" | |
161 | + loadMore={loadMore} | |
162 | + dataSource={messageListData} | |
163 | + renderItem={(item: any, index: any) => ( | |
164 | + <List.Item key={item.id}> | |
165 | + <List.Item.Meta | |
166 | + avatar={ | |
167 | + <Badge dot={!readFlagList[index]}> | |
168 | + <Avatar shape="square" icon={<UserOutlined />} /> | |
169 | + </Badge> | |
170 | + } | |
171 | + /> | |
172 | + <Flex | |
173 | + vertical | |
174 | + className="w-full hover:cursor-pointer" | |
175 | + onClick={async () => { | |
176 | + toOrderList(item.mainOrderIds); | |
177 | + | |
178 | + let readSuccess = await read([item.mesUsrRelId]); | |
179 | + if (readSuccess) { | |
180 | + let newUnreadNumList = [...readFlagList]; | |
181 | + newUnreadNumList[index] = true; | |
182 | + setReadFlagList([...newUnreadNumList]); | |
183 | + } | |
184 | + }} | |
185 | + > | |
186 | + <Flex> | |
187 | + <div> | |
188 | + {item.content} | |
189 | + {/* <span className="text-[#8C8C8C]"> | |
190 | + (点击跳转到对应主订单) | |
191 | + </span> */} | |
192 | + </div> | |
193 | + </Flex> | |
194 | + <Flex> | |
195 | + <span className="text-xs text-[#8C8C8C] pt-1"> | |
196 | + {formatDateTime(item.createTime)} | |
197 | + </span> | |
198 | + </Flex> | |
199 | + </Flex> | |
200 | + </List.Item> | |
201 | + )} | |
202 | + /> | |
203 | + </Drawer> | |
204 | + </> | |
205 | + ); | |
206 | +}; | ... | ... |
src/pages/Order/FeedBack/ModifiedDiffModal.tsx
0 → 100644
1 | +import { postServiceOrderModifiedDiff } from '@/services'; | |
2 | +import { enumValueToLabel, getAliYunOSSFileNameFromUrl } from '@/utils'; | |
3 | +import { getReceivingCompanyOptions, isSupplier } from '@/utils/order'; | |
4 | +import { Button, Divider, Modal, Space, Table, TableProps } from 'antd'; | |
5 | +import { useEffect, useState } from 'react'; | |
6 | +import { | |
7 | + PAYEE_OPTIONS, | |
8 | + PAYMENT_CHANNEL_OPTIONS, | |
9 | + PAYMENT_METHOD_OPTIONS, | |
10 | + PRODUCT_BELONG_DEPARTMENT_OPTIONS, | |
11 | + SHIPPING_WAREHOUSE_OPTIONS, | |
12 | +} from './constant'; | |
13 | +import './table.less'; | |
14 | + | |
15 | +export default ({ setVisible, subOrders, mainOrder, onClose }) => { | |
16 | + let subIds = subOrders?.map((item: any) => { | |
17 | + return item.id; | |
18 | + }); | |
19 | + | |
20 | + let mainId = mainOrder?.id; | |
21 | + | |
22 | + const [subOrderDiffs, setSubOrderDiffs] = useState([]); | |
23 | + const [mainOrderDiffs, setMainOrderDiffs] = useState([]); | |
24 | + | |
25 | + function isSupplierUnvisibleField(field: any) { | |
26 | + //主订单字段 | |
27 | + let unvisibleFields = [ | |
28 | + 'receivingCompany', | |
29 | + 'invoiceIdentificationNumber', | |
30 | + 'bankAccountNumber', | |
31 | + 'bank', | |
32 | + 'totalPayment', | |
33 | + 'institution', | |
34 | + 'institutionContactName', | |
35 | + ]; | |
36 | + //子订单字段 | |
37 | + unvisibleFields.push( | |
38 | + ...[ | |
39 | + 'listAnnex', | |
40 | + 'shippingWarehouse', | |
41 | + 'productBelongBusiness', | |
42 | + 'subOrderPayment', | |
43 | + 'productPrice', | |
44 | + ], | |
45 | + ); | |
46 | + | |
47 | + return isSupplier() && unvisibleFields.includes(field); | |
48 | + } | |
49 | + | |
50 | + async function loadData() { | |
51 | + let res = await postServiceOrderModifiedDiff({ | |
52 | + data: { | |
53 | + subOrderIds: subIds, | |
54 | + mainOrderId: mainId, | |
55 | + }, | |
56 | + }); | |
57 | + let subOrderDiffs = res?.data?.subOrderDiffs; | |
58 | + let mainOrderDiffs = res?.data?.mainOrderDiffs; | |
59 | + | |
60 | + setSubOrderDiffs(subOrderDiffs); | |
61 | + setMainOrderDiffs(mainOrderDiffs); | |
62 | + } | |
63 | + | |
64 | + useEffect(() => { | |
65 | + loadData(); | |
66 | + }, []); | |
67 | + | |
68 | + function toChineseName(key: any, text: any) { | |
69 | + let newText = text; | |
70 | + if (key === '所属事业部') { | |
71 | + newText = enumValueToLabel(text, PRODUCT_BELONG_DEPARTMENT_OPTIONS); | |
72 | + } | |
73 | + if (key === '发货仓库') { | |
74 | + newText = enumValueToLabel(text, SHIPPING_WAREHOUSE_OPTIONS); | |
75 | + } | |
76 | + if (key === '支付渠道') { | |
77 | + newText = enumValueToLabel(text, PAYMENT_CHANNEL_OPTIONS); | |
78 | + } | |
79 | + if (key === '支付方式') { | |
80 | + newText = enumValueToLabel(text, PAYMENT_METHOD_OPTIONS); | |
81 | + } | |
82 | + if (key === '单价' || key === '合计') { | |
83 | + newText = '¥' + newText; | |
84 | + } | |
85 | + if (key === '开票收款单位') { | |
86 | + newText = enumValueToLabel( | |
87 | + text, | |
88 | + getReceivingCompanyOptions(PAYEE_OPTIONS), | |
89 | + ); | |
90 | + } | |
91 | + return newText; | |
92 | + } | |
93 | + | |
94 | + function cellRender(value: any, record: any) { | |
95 | + if (record.fieldName === '附件') { | |
96 | + return ( | |
97 | + <Space className="max-w-[300px]" wrap> | |
98 | + {value?.map((item: any, index: any) => { | |
99 | + let fileName = getAliYunOSSFileNameFromUrl(item); | |
100 | + return ( | |
101 | + <Button | |
102 | + className="p-0 pr-2" | |
103 | + key={index} | |
104 | + danger={record.isDiff} | |
105 | + type="link" | |
106 | + onClick={() => { | |
107 | + window.open( | |
108 | + '/previewApi/onlinePreview?url=' + | |
109 | + encodeURIComponent(Base64.encode(item)), | |
110 | + ); | |
111 | + }} | |
112 | + > | |
113 | + {fileName} | |
114 | + </Button> | |
115 | + ); | |
116 | + })} | |
117 | + </Space> | |
118 | + ); | |
119 | + } | |
120 | + return ( | |
121 | + <div | |
122 | + title={toChineseName(record.fieldName, value)} | |
123 | + className="max-w-[250px] whitespace-no-wrap overflow-hidden overflow-ellipsis" | |
124 | + > | |
125 | + <span className={record.isDiff ? 'text-[red]' : ''}> | |
126 | + {toChineseName(record.fieldName, value)} | |
127 | + </span> | |
128 | + </div> | |
129 | + ); | |
130 | + } | |
131 | + | |
132 | + interface DataType { | |
133 | + fieldName: string; | |
134 | + oldValue: string; | |
135 | + newValue: string; | |
136 | + isDiff: boolean; | |
137 | + } | |
138 | + | |
139 | + const columns: TableProps<DataType>['columns'] = [ | |
140 | + { | |
141 | + title: '字段名', | |
142 | + dataIndex: 'fieldName', | |
143 | + key: 'fieldName', | |
144 | + render(value) { | |
145 | + return ( | |
146 | + <div | |
147 | + title={value} | |
148 | + className="max-w-[80px] whitespace-no-wrap overflow-hidden overflow-ellipsis" | |
149 | + > | |
150 | + {value} | |
151 | + </div> | |
152 | + ); | |
153 | + }, | |
154 | + }, | |
155 | + { | |
156 | + title: '修改前字段值', | |
157 | + dataIndex: 'oldValue', | |
158 | + key: 'oldValue', | |
159 | + render(value, record) { | |
160 | + return cellRender(value, record); | |
161 | + }, | |
162 | + }, | |
163 | + { | |
164 | + title: '修改后(当前)字段值', | |
165 | + dataIndex: 'newValue', | |
166 | + key: 'newValue', | |
167 | + render(value, record) { | |
168 | + return cellRender(value, record); | |
169 | + }, | |
170 | + }, | |
171 | + ]; | |
172 | + | |
173 | + function loadSubOrderDiffTable(item: any, index: any) { | |
174 | + //转换为表格数据 | |
175 | + let oldDatas = item[0]; | |
176 | + let curDatas = item[1]; | |
177 | + let diffFiledNames = oldDatas?.diffFieldsName; | |
178 | + | |
179 | + let tableData = []; | |
180 | + let visibleFields = [ | |
181 | + ['productName', '商品名称'], | |
182 | + ['productCode', '商品编码'], | |
183 | + ['parameters', '商品参数'], | |
184 | + ['quantity', '数量'], | |
185 | + ['productPrice', '单价'], | |
186 | + ['unit', '单位'], | |
187 | + ['subOrderPayment', '合计'], | |
188 | + ['productBelongBusiness', '所属事业部'], | |
189 | + ['shippingWarehouse', '发货仓库'], | |
190 | + ['notes', '备注'], | |
191 | + ['paymentChannel', '支付渠道'], | |
192 | + ['paymentMethod', '支付方式'], | |
193 | + ['listAnnex', '附件'], | |
194 | + ]; | |
195 | + for (let field of visibleFields) { | |
196 | + let filedKey = field[0]; | |
197 | + let filedName = field[1]; | |
198 | + | |
199 | + if (!isSupplierUnvisibleField(filedKey)) { | |
200 | + tableData.push({ | |
201 | + fieldName: filedName, | |
202 | + oldValue: oldDatas[filedKey], | |
203 | + newValue: curDatas[filedKey], | |
204 | + isDiff: diffFiledNames?.includes(filedKey), | |
205 | + }); | |
206 | + } | |
207 | + } | |
208 | + return ( | |
209 | + <> | |
210 | + <Divider orientation="left">商品{index + 1}:</Divider> | |
211 | + <Table | |
212 | + className="myTable" | |
213 | + size="small" | |
214 | + pagination={false} | |
215 | + key={index} | |
216 | + columns={columns} | |
217 | + dataSource={tableData} | |
218 | + /> | |
219 | + </> | |
220 | + ); | |
221 | + } | |
222 | + | |
223 | + function loadMainOrderDiffTable(item: any, index: any) { | |
224 | + if (!item || item.length <= 0) { | |
225 | + return; | |
226 | + } | |
227 | + //转换为表格数据 | |
228 | + let oldDatas = item[0]; | |
229 | + let curDatas = item[1]; | |
230 | + let diffFiledNames = oldDatas?.diffFieldsName; | |
231 | + | |
232 | + let tableData = []; | |
233 | + let visibleFields = [ | |
234 | + ['salesCode', '销售代号'], | |
235 | + ['customerName', '收货人姓名'], | |
236 | + ['customerContactNumber', '收货人联系手机号'], | |
237 | + ['customerShippingAddress', '收货人地址信息'], | |
238 | + ['institutionContactName', '单位联系人'], | |
239 | + ['institution', '单位'], | |
240 | + ['totalPayment', '支付总金额'], | |
241 | + ['notes', '备注'], | |
242 | + ['bank', '开户银行'], | |
243 | + ['bankAccountNumber', '银行账号'], | |
244 | + ['invoiceIdentificationNumber', '开票识别号'], | |
245 | + ['receivingCompany', '开票收款单位'], | |
246 | + ]; | |
247 | + for (let field of visibleFields) { | |
248 | + let filedKey = field[0]; | |
249 | + let filedName = field[1]; | |
250 | + | |
251 | + if (!isSupplierUnvisibleField(filedKey)) { | |
252 | + tableData.push({ | |
253 | + fieldName: filedName, | |
254 | + oldValue: oldDatas[filedKey], | |
255 | + newValue: curDatas[filedKey], | |
256 | + isDiff: diffFiledNames?.includes(filedKey), | |
257 | + }); | |
258 | + } | |
259 | + } | |
260 | + return ( | |
261 | + <Table | |
262 | + className="myTable" | |
263 | + size="small" | |
264 | + pagination={false} | |
265 | + key={index} | |
266 | + columns={columns} | |
267 | + dataSource={tableData} | |
268 | + /> | |
269 | + ); | |
270 | + } | |
271 | + | |
272 | + return ( | |
273 | + <> | |
274 | + <Modal | |
275 | + width={700} | |
276 | + open | |
277 | + title="信息对比" | |
278 | + okText="返回" | |
279 | + cancelText={false} | |
280 | + onOk={() => { | |
281 | + setVisible(false); | |
282 | + onClose(); | |
283 | + }} | |
284 | + onCancel={() => { | |
285 | + setVisible(false); | |
286 | + }} | |
287 | + cancelButtonProps={{ | |
288 | + hidden: true, | |
289 | + }} | |
290 | + destroyOnClose={true} | |
291 | + > | |
292 | + <Divider>主订单信息:</Divider> | |
293 | + {loadMainOrderDiffTable(mainOrderDiffs, 0)} | |
294 | + | |
295 | + <Divider>子订单信息:</Divider> | |
296 | + {subOrderDiffs?.map((item: any, index) => { | |
297 | + return loadSubOrderDiffTable(item, index); | |
298 | + })} | |
299 | + </Modal> | |
300 | + </> | |
301 | + ); | |
302 | +}; | ... | ... |
src/pages/Order/FeedBack/OrderDrawer copy.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postKingdeeRepCustomer, | |
4 | + postKingdeeRepCustomerDetail, | |
5 | + postKingdeeRepMaterial, | |
6 | + postKingdeeRepMaterialUnit, | |
7 | + postKingdeeRepMeasureUnit, | |
8 | + postServiceOrderAddOrder, | |
9 | + postServiceOrderQuerySalesCode, | |
10 | + postServiceOrderUpdateOrder, | |
11 | +} from '@/services'; | |
12 | +import { | |
13 | + enumToSelect, | |
14 | + getAliYunOSSFileNameFromUrl, | |
15 | + getUserInfo, | |
16 | +} from '@/utils'; | |
17 | +import { getTeacherCustomFieldNumber } from '@/utils/kingdee'; | |
18 | +import { | |
19 | + DrawerForm, | |
20 | + FormListActionType, | |
21 | + ProCard, | |
22 | + ProFormDateTimePicker, | |
23 | + ProFormDigit, | |
24 | + ProFormList, | |
25 | + ProFormSelect, | |
26 | + ProFormText, | |
27 | + ProFormTextArea, | |
28 | + ProFormUploadDragger, | |
29 | +} from '@ant-design/pro-components'; | |
30 | +import { Button, Form, message } from 'antd'; | |
31 | +import { cloneDeep } from 'lodash'; | |
32 | +import { useEffect, useRef, useState } from 'react'; | |
33 | +import KingdeeCustomerModal from './KingdeeCustomerModal'; | |
34 | +import { | |
35 | + INVOCING_STATUS_OPTIONS, | |
36 | + INVOCING_STATUS_OPTIONS_OLD, | |
37 | + PAYMENT_CHANNEL_OPTIONS, | |
38 | + PAYMENT_METHOD_OPTIONS, | |
39 | + PRODUCT_BELONG_DEPARTMENT_OPTIONS, | |
40 | +} from './constant'; | |
41 | + | |
42 | +export default ({ onClose, data, subOrders, orderOptType }) => { | |
43 | + const [invoicingStatus, setInvoicingStatus] = useState(''); | |
44 | + const [salesCodeOptions, setSalesCodeOptions] = useState([]); | |
45 | + const [customer, setCustomer] = useState({}); | |
46 | + const [kingdeeCstomerModalVisible, setKingdeeCstomerModalVisible] = | |
47 | + useState(false); | |
48 | + const [ | |
49 | + productParametersDisabledFlagList, | |
50 | + setProductParametersDisabledFlagList, | |
51 | + ] = useState([]); | |
52 | + // const [productInvStockOptionsList, setProductInvStockOptionsList] = useState( | |
53 | + // [], | |
54 | + // ); //商品的仓库选项 | |
55 | + const [productUnitOptionsList, setProductUnitOptionsList] = useState([]); //商品的单位选项 | |
56 | + const [productCustomerContactOptions, setProductCustomerContactOptions] = | |
57 | + useState([]); //客户的收货人选项 | |
58 | + const [form] = Form.useForm<{ | |
59 | + salesCode: ''; | |
60 | + customerName: ''; | |
61 | + customerContactNumber: ''; | |
62 | + institution: ''; | |
63 | + institutionContactName: ''; | |
64 | + customerShippingAddress: ''; | |
65 | + totalPayment: ''; | |
66 | + paymentChannel: ''; | |
67 | + paymentMethod: ''; | |
68 | + productBelongBusiness: ''; | |
69 | + invoicingStatus: ''; | |
70 | + invoiceIdentificationNumber: ''; | |
71 | + invoicingTime: ''; | |
72 | + bank: ''; | |
73 | + bankAccountNumber: ''; | |
74 | + deleteSubOrderLists: []; | |
75 | + notes: ''; | |
76 | + list: [ | |
77 | + { | |
78 | + productCode: ''; | |
79 | + productName: ''; | |
80 | + quantity: ''; | |
81 | + productPrice: ''; | |
82 | + parameters: ''; | |
83 | + subOrderPayment: ''; | |
84 | + unit: ''; | |
85 | + serialNumber: ''; | |
86 | + notes: ''; | |
87 | + }, | |
88 | + ]; | |
89 | + }>(); | |
90 | + | |
91 | + let originSubOrders = cloneDeep(subOrders); | |
92 | + /** | |
93 | + * 获取当前的操作类型boolean值 | |
94 | + * @param type 操作类型,如果与当前匹配返回true | |
95 | + */ | |
96 | + function optType(type: string) { | |
97 | + return orderOptType === type; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * | |
102 | + * @returns 获取开票选项 | |
103 | + */ | |
104 | + function getInvoicingSelect() { | |
105 | + if (optType('edit')) { | |
106 | + return enumToSelect(INVOCING_STATUS_OPTIONS_OLD); | |
107 | + } | |
108 | + return enumToSelect(INVOCING_STATUS_OPTIONS); | |
109 | + } | |
110 | + | |
111 | + const fileList: any = []; | |
112 | + | |
113 | + const getSalesCodeOptions = async () => { | |
114 | + const res = await postServiceOrderQuerySalesCode(); | |
115 | + let options = res.data?.map((item) => { | |
116 | + return { | |
117 | + label: item.userName, | |
118 | + value: item.userName, | |
119 | + number: item.number, | |
120 | + }; | |
121 | + }); | |
122 | + setSalesCodeOptions(options); | |
123 | + | |
124 | + if (optType('copy') || optType('edit')) { | |
125 | + let includeFlag = false; | |
126 | + //销售代码校验,如果是旧的销售代码,则提示并清空 | |
127 | + for (let option of options) { | |
128 | + if (option.value === data.salesCode) { | |
129 | + includeFlag = true; | |
130 | + } | |
131 | + } | |
132 | + if (!includeFlag) { | |
133 | + form.resetFields(['salesCode']); | |
134 | + message.warning('检测到销售代码为旧的,已清空,请重新选择'); | |
135 | + } | |
136 | + } | |
137 | + }; | |
138 | + | |
139 | + //复制的时候,如果是不需要开票,要把开票信息清空 | |
140 | + if (optType('copy') && data.invoicingStatus === 'UN_INVOICE') { | |
141 | + data.invoiceIdentificationNumber = undefined; | |
142 | + } | |
143 | + | |
144 | + if (subOrders !== undefined && subOrders.length > 0) { | |
145 | + data.list = subOrders; | |
146 | + } | |
147 | + | |
148 | + const actionRef = useRef< | |
149 | + FormListActionType<{ | |
150 | + name: string; | |
151 | + }> | |
152 | + >(); | |
153 | + | |
154 | + useEffect(() => { | |
155 | + form.setFieldsValue({ ...data }); | |
156 | + //如果是新建,需要清空list | |
157 | + if (optType('add')) { | |
158 | + form.resetFields(['list']); | |
159 | + } | |
160 | + }, [data]); | |
161 | + | |
162 | + /** | |
163 | + * 选择客户后自动为收货人Select添加选项,填充课题组和单位信息 | |
164 | + * @param option 客户选项 | |
165 | + */ | |
166 | + async function autoFillCustomerContactSelectOptions(customerId: any) { | |
167 | + //查询单位详细信息 | |
168 | + let res = await postKingdeeRepCustomerDetail({ | |
169 | + data: { | |
170 | + id: customerId, | |
171 | + }, | |
172 | + }); | |
173 | + | |
174 | + //erp客户名称 | |
175 | + form.setFieldValue('erpCustomerName', res?.name); | |
176 | + | |
177 | + //重新设置当前option | |
178 | + form.setFieldValue('erpCustomerId', { | |
179 | + label: res?.name, | |
180 | + value: res?.id, | |
181 | + id: res?.id, | |
182 | + }); | |
183 | + | |
184 | + //查询客户自定义字段,课题组 | |
185 | + let entity_number = await getTeacherCustomFieldNumber(); | |
186 | + | |
187 | + //在单位详细信息中拿到自定义字段的值 | |
188 | + let customField = res?.custom_field; | |
189 | + if (customField) { | |
190 | + let teacherName = customField[entity_number]; | |
191 | + //填充到课题组老师表单字段中 | |
192 | + form.setFieldValue('institutionContactName', teacherName); | |
193 | + } | |
194 | + | |
195 | + //单位名称,从客户名称中获取,客户名称规则<单位名称>-<联系人名称和电话> | |
196 | + let namePortions = res?.name?.split('-'); | |
197 | + if (namePortions && namePortions.length >= 2) { | |
198 | + form.setFieldValue('institution', namePortions[0]); | |
199 | + } | |
200 | + | |
201 | + //如果原来的收货信息没有包含在这次查询出来的收货人选项中,那么清除原来的收货人信息 | |
202 | + let existFlag = false; | |
203 | + | |
204 | + //填充收货人选项 | |
205 | + let newProductCustomerContactOptions = res?.bomentity?.map((item) => { | |
206 | + let address = | |
207 | + item.contact_person + ',' + item.mobile + ',' + item.contact_address; | |
208 | + if (address === data.contactAddress) { | |
209 | + existFlag = true; | |
210 | + } | |
211 | + return { ...item, label: address, value: address }; | |
212 | + }); | |
213 | + | |
214 | + setProductCustomerContactOptions(newProductCustomerContactOptions); | |
215 | + | |
216 | + if (!existFlag) { | |
217 | + //清空原来的收货人信息 | |
218 | + form.setFieldValue('customerShippingAddress', undefined); | |
219 | + form.setFieldValue('customerContactNumber', undefined); | |
220 | + form.setFieldValue('customerName', undefined); | |
221 | + form.setFieldValue('erpCustomerAddress', undefined); | |
222 | + } | |
223 | + } | |
224 | + | |
225 | + /** | |
226 | + * 回显金蝶信息 | |
227 | + */ | |
228 | + async function showKindeeInfo() { | |
229 | + //客户信息 | |
230 | + if (data.customerId) { | |
231 | + //客户回显 | |
232 | + autoFillCustomerContactSelectOptions(data.customerId); | |
233 | + } | |
234 | + | |
235 | + //商品单位回显 | |
236 | + let list = data?.subOrderInformationLists; | |
237 | + if (list) { | |
238 | + let newProductUnitOptionsList = [...productUnitOptionsList]; | |
239 | + for (let i = 0; i < list.length; i++) { | |
240 | + newProductUnitOptionsList[i] = [ | |
241 | + { label: list[i].unit, value: list[i].unitId }, | |
242 | + ]; | |
243 | + } | |
244 | + setProductUnitOptionsList(newProductUnitOptionsList); | |
245 | + } | |
246 | + } | |
247 | + | |
248 | + /** | |
249 | + * | |
250 | + * @param option 商品名称所对应的商品数据 | |
251 | + * @param currentRowData list中当前行的数据 | |
252 | + */ | |
253 | + async function autoFillProductInfo( | |
254 | + option: any, | |
255 | + currentRowData: any, | |
256 | + index: any, | |
257 | + ) { | |
258 | + let newProductParametersDisabledFlagList = [ | |
259 | + ...productParametersDisabledFlagList, | |
260 | + ]; | |
261 | + let newProductUnitOptionsList = [...productUnitOptionsList]; | |
262 | + newProductUnitOptionsList[index] = []; | |
263 | + | |
264 | + //是新增商品 | |
265 | + if (option.type === 'add') { | |
266 | + //商品参数开放权限可以编辑 | |
267 | + newProductParametersDisabledFlagList[index] = false; | |
268 | + | |
269 | + //清空商品信息 | |
270 | + let copyList = form.getFieldValue('list'); | |
271 | + let currentData = copyList[index]; | |
272 | + currentData.productCode = undefined; | |
273 | + currentData.parameters = undefined; | |
274 | + currentData.unit = undefined; | |
275 | + currentData.subOrderPayment = undefined; | |
276 | + currentData.quantity = undefined; | |
277 | + currentData.notes = undefined; | |
278 | + currentData.productPrice = undefined; | |
279 | + form.setFieldValue('list', copyList); | |
280 | + | |
281 | + //查询计量单价列表 | |
282 | + let res = await postKingdeeRepMeasureUnit({ data: {} }); | |
283 | + if (res && res?.rows) { | |
284 | + for (let row of res?.rows) { | |
285 | + newProductUnitOptionsList[index].push({ | |
286 | + label: row.name, | |
287 | + value: row.id, | |
288 | + }); | |
289 | + } | |
290 | + } | |
291 | + } else { | |
292 | + //选择的是已有的商品,进行内容自动填充 | |
293 | + let copyList = form.getFieldValue('list'); | |
294 | + let currentData = copyList[index]; | |
295 | + currentData.productCode = option?.number; | |
296 | + currentData.parameters = option?.model; | |
297 | + currentData.unit = option?.base_unit_name; | |
298 | + | |
299 | + //商品id | |
300 | + currentData.materialId = option?.id; | |
301 | + | |
302 | + //单位 | |
303 | + currentData.unit = option.base_unit_name; | |
304 | + currentData.unitId = option.base_unit_id; | |
305 | + | |
306 | + form.setFieldValue('list', copyList); | |
307 | + | |
308 | + //商品所在的仓库选项填充 | |
309 | + // let res = await postKingdeeRepMaterialStock({ | |
310 | + // data: { | |
311 | + // material_id: option.id, | |
312 | + // }, | |
313 | + // }); | |
314 | + // let newProductInvStockOptionsList = [...productInvStockOptionsList]; | |
315 | + // newProductInvStockOptionsList[index] = res?.rows?.map((item) => { | |
316 | + // return { label: item.inv_stock, value: item.inv_stock_id }; | |
317 | + // }); | |
318 | + // setProductInvStockOptionsList(newProductInvStockOptionsList); | |
319 | + | |
320 | + //商品单位填充,查询商品单位列表 | |
321 | + let res = await postKingdeeRepMaterialUnit({ | |
322 | + data: { material_id: option.id }, | |
323 | + }); | |
324 | + if (res && res.rows) { | |
325 | + for (let row of res.rows) { | |
326 | + newProductUnitOptionsList[index].push({ | |
327 | + label: row.unit_name, | |
328 | + value: row.unit_id, | |
329 | + }); | |
330 | + } | |
331 | + } | |
332 | + //商品参数不允许编辑 | |
333 | + newProductParametersDisabledFlagList[index] = true; | |
334 | + } | |
335 | + | |
336 | + setProductParametersDisabledFlagList(newProductParametersDisabledFlagList); | |
337 | + setProductUnitOptionsList(newProductUnitOptionsList); | |
338 | + } | |
339 | + | |
340 | + /** | |
341 | + * 选择收货人后自动填充信息 | |
342 | + * @param option 收货人信息 | |
343 | + */ | |
344 | + async function autoFillCustomerInfo(option: any) { | |
345 | + form.setFieldValue('customerShippingAddress', option.contact_address); | |
346 | + form.setFieldValue('customerContactNumber', option.mobile); | |
347 | + form.setFieldValue('customerName', option.contact_person); | |
348 | + | |
349 | + //erp收货地址:需要与客户联系人中的地址一样:姓名,手机号,地址 | |
350 | + form.setFieldValue('contactAddress', option.value); | |
351 | + } | |
352 | + | |
353 | + /** | |
354 | + * 填充销售代表的信息 | |
355 | + * @param option | |
356 | + */ | |
357 | + function autoFillSalesInfo(option: any) { | |
358 | + console.log(option); | |
359 | + //销售代表对应职员编码填充 | |
360 | + form.setFieldValue('empNumber', option.number); | |
361 | + } | |
362 | + | |
363 | + /** | |
364 | + * 选择商品单位后自动填充 | |
365 | + * @param option | |
366 | + * @param index | |
367 | + */ | |
368 | + function autoFillUnit(option: any, index: any) { | |
369 | + let copyList = form.getFieldValue('list'); | |
370 | + let currentData = copyList[index]; | |
371 | + currentData.unit = option?.label; | |
372 | + form.setFieldValue('list', copyList); | |
373 | + } | |
374 | + | |
375 | + /** | |
376 | + * 计算子订单金额 | |
377 | + * @param listMeta 当前商品信息 | |
378 | + */ | |
379 | + function computeSubOrderPayment(listMeta: any) { | |
380 | + let quantity = listMeta?.record?.quantity; | |
381 | + let productPrice = listMeta?.record?.productPrice; | |
382 | + quantity = quantity === '' || quantity === undefined ? 0 : quantity; | |
383 | + productPrice = | |
384 | + productPrice === '' || productPrice === undefined ? 0 : productPrice; | |
385 | + | |
386 | + listMeta.subOrderPayment = quantity * productPrice; | |
387 | + let list = form.getFieldValue('list'); | |
388 | + list[listMeta?.index].subOrderPayment = quantity * productPrice; | |
389 | + form.setFieldValue('list', list); | |
390 | + } | |
391 | + | |
392 | + /** | |
393 | + * 计算支付总额 | |
394 | + */ | |
395 | + function computeTotalPayment() { | |
396 | + let list = form.getFieldValue('list'); | |
397 | + let totalPayment = 0; | |
398 | + list?.forEach((subOrder: any) => { | |
399 | + let subOrderPayment = subOrder?.subOrderPayment; | |
400 | + if (subOrderPayment === '' || subOrderPayment === undefined) { | |
401 | + totalPayment += 0; | |
402 | + } else { | |
403 | + totalPayment += subOrderPayment; | |
404 | + } | |
405 | + }); | |
406 | + form.setFieldValue('totalPayment', totalPayment); | |
407 | + } | |
408 | + | |
409 | + useEffect(() => { | |
410 | + getSalesCodeOptions(); | |
411 | + showKindeeInfo(); | |
412 | + }, []); | |
413 | + | |
414 | + useEffect(() => { | |
415 | + // 在组件挂载或数据变化时,更新组件状态 | |
416 | + if (data) { | |
417 | + setInvoicingStatus(data.invoicingStatus); | |
418 | + } | |
419 | + }, [data]); | |
420 | + | |
421 | + // let mainInfoDisbled = optType('edit'); | |
422 | + if (optType('edit') || optType('copy')) { | |
423 | + //如果是复制,需要开票,不回显是否需要开票字段 | |
424 | + if (optType('copy')) { | |
425 | + if (data.invoicingStatus === 'INVOICED') { | |
426 | + data.invoicingStatus = undefined; | |
427 | + } | |
428 | + } | |
429 | + //订单修改和新增的子订单列表命名是list | |
430 | + data.list = data.subOrderInformationLists; | |
431 | + //主订单事业部默认显示子订单第一条的事业部 | |
432 | + data.productBelongBusiness = data.list[0].productBelongBusiness; | |
433 | + data.paymentMethod = data.list[0].paymentMethod; | |
434 | + data.paymentChannel = data.list[0].paymentChannel; | |
435 | + data.invoicingStatus = data.list[0].invoicingStatus; | |
436 | + | |
437 | + data.list = data.list?.map((item) => { | |
438 | + item.filePaths = item.listAnnex?.map((path) => { | |
439 | + let i = 0; | |
440 | + return { | |
441 | + uid: i++, | |
442 | + name: getAliYunOSSFileNameFromUrl(path), | |
443 | + status: 'uploaded', | |
444 | + url: path, | |
445 | + response: { data: [path] }, | |
446 | + }; | |
447 | + }); | |
448 | + return item; | |
449 | + }); | |
450 | + } | |
451 | + | |
452 | + return ( | |
453 | + <> | |
454 | + <DrawerForm<{ | |
455 | + deleteSubOrderLists: any; | |
456 | + name: string; | |
457 | + company: string; | |
458 | + }> | |
459 | + open | |
460 | + width="35%" | |
461 | + title={optType('add') || optType('copy') ? '新建订单' : '修改订单'} | |
462 | + resize={{ | |
463 | + onResize() { | |
464 | + console.log('resize!'); | |
465 | + }, | |
466 | + maxWidth: window.innerWidth * 0.8, | |
467 | + minWidth: 400, | |
468 | + }} | |
469 | + // layout="horizontal" | |
470 | + // labelCol={{ span: 8 }} | |
471 | + form={form} | |
472 | + autoFocusFirstInput | |
473 | + drawerProps={{ | |
474 | + destroyOnClose: true, | |
475 | + maskClosable: false, | |
476 | + }} | |
477 | + submitTimeout={2000} | |
478 | + onFinish={async (values) => { | |
479 | + let res = {}; | |
480 | + //附件处理 | |
481 | + let list = values.list; | |
482 | + // console.log(list); | |
483 | + list = list.map((item) => { | |
484 | + item.filePaths = item.filePaths?.map((file) => { | |
485 | + console.log(file); | |
486 | + return { url: file.response.data[0] }; | |
487 | + }); | |
488 | + return item; | |
489 | + }); | |
490 | + | |
491 | + values.list = list; | |
492 | + values.institution = values.institution?.trim(); | |
493 | + values.institutionContactName = values.institutionContactName?.trim(); | |
494 | + | |
495 | + if (typeof values.erpCustomerId !== 'string') { | |
496 | + values.erpCustomerId = values.erpCustomerId?.id; | |
497 | + } | |
498 | + | |
499 | + if (optType('add') || optType('copy')) { | |
500 | + res = await postServiceOrderAddOrder({ data: values }); | |
501 | + } else { | |
502 | + //计算已删除的子订单id | |
503 | + const originIds = originSubOrders.map((item) => { | |
504 | + return item.id; | |
505 | + }); | |
506 | + const curIds = form.getFieldValue('list')?.map((item) => { | |
507 | + return item.id; | |
508 | + }); | |
509 | + let diff = originIds.filter((item) => !curIds.includes(item)); | |
510 | + values.deleteSubOrderLists = diff; | |
511 | + res = await postServiceOrderUpdateOrder({ data: values }); | |
512 | + } | |
513 | + | |
514 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
515 | + message.success(res.message); | |
516 | + // 不返回不会关闭弹框 | |
517 | + onClose(true); | |
518 | + return true; | |
519 | + } | |
520 | + }} | |
521 | + onOpenChange={(val) => { | |
522 | + return !val && onClose(); | |
523 | + }} | |
524 | + > | |
525 | + <h2>订单基本信息</h2> | |
526 | + <ProFormText | |
527 | + key="id" | |
528 | + name="id" | |
529 | + width="lg" | |
530 | + disabled | |
531 | + label="id" | |
532 | + placeholder="id" | |
533 | + hidden | |
534 | + /> | |
535 | + | |
536 | + <ProFormText | |
537 | + key="empNumber" | |
538 | + name="empNumber" | |
539 | + width="lg" | |
540 | + label="销售职员编码" | |
541 | + placeholder="销售职员编码" | |
542 | + hidden | |
543 | + /> | |
544 | + | |
545 | + <ProFormSelect | |
546 | + name="salesCode" | |
547 | + key="salesCode" | |
548 | + width="lg" | |
549 | + showSearch | |
550 | + label="销售代表" | |
551 | + placeholder="请输入销售代表" | |
552 | + rules={[{ required: true, message: '销售代表必填' }]} | |
553 | + options={salesCodeOptions} | |
554 | + onChange={(_, option) => { | |
555 | + autoFillSalesInfo(option); | |
556 | + }} | |
557 | + // disabled={mainInfoDisbled} | |
558 | + /> | |
559 | + | |
560 | + <ProFormText | |
561 | + key="erpCustomerName" | |
562 | + name="erpCustomerName" | |
563 | + hidden | |
564 | + ></ProFormText> | |
565 | + | |
566 | + <ProFormText | |
567 | + key="contactAddress" | |
568 | + name="contactAddress" | |
569 | + hidden | |
570 | + ></ProFormText> | |
571 | + | |
572 | + <ProFormSelect | |
573 | + name="erpCustomerId" | |
574 | + key="erpCustomerId" | |
575 | + width="lg" | |
576 | + showSearch | |
577 | + label={ | |
578 | + <> | |
579 | + <span>客户</span> | |
580 | + <span | |
581 | + className="pl-2 text-xs text-[#1677ff] cursor-pointer" | |
582 | + onClick={() => { | |
583 | + let customerId = form.getFieldValue('erpCustomerId'); | |
584 | + if (typeof customerId === 'string') { | |
585 | + setCustomer({ ...customer, id: customerId }); | |
586 | + } else { | |
587 | + setCustomer({ ...customer, id: customerId.id }); | |
588 | + } | |
589 | + setKingdeeCstomerModalVisible(true); | |
590 | + }} | |
591 | + > | |
592 | + 编辑客户信息 | |
593 | + </span> | |
594 | + </> | |
595 | + } | |
596 | + placeholder="请选择客户" | |
597 | + rules={[{ required: true, message: '客户必填' }]} | |
598 | + onChange={(_, option) => { | |
599 | + //新增客户 | |
600 | + if (option.type === 'add') { | |
601 | + setCustomer({ name: option.name }); | |
602 | + setKingdeeCstomerModalVisible(true); | |
603 | + return; | |
604 | + } | |
605 | + autoFillCustomerContactSelectOptions(option.id); | |
606 | + }} | |
607 | + initialValue={{ | |
608 | + label: data?.erpCustomerName, | |
609 | + value: data?.customerId, | |
610 | + id: data?.customerId, | |
611 | + }} | |
612 | + fieldProps={{ | |
613 | + optionItemRender(item) { | |
614 | + if (item.type === 'add') { | |
615 | + return ( | |
616 | + <div title={item.name + '(新增客户)'}> | |
617 | + <span style={{ color: '#333333' }}>{item.name}</span> | |
618 | + {' | '} | |
619 | + <span style={{ color: 'orange' }}>自定义</span> | |
620 | + </div> | |
621 | + ); | |
622 | + } | |
623 | + return ( | |
624 | + <div | |
625 | + title={ | |
626 | + item.name + | |
627 | + ' | ' + | |
628 | + item.customerContactNumber + | |
629 | + ' | ' + | |
630 | + (item.customerShippingAddress === undefined | |
631 | + ? '无地址' | |
632 | + : item.customerShippingAddress) + | |
633 | + ' | ' + | |
634 | + item.institutionContactName + | |
635 | + ' | ' + | |
636 | + item.institution | |
637 | + } | |
638 | + > | |
639 | + <span style={{ color: '#333333' }}>{item.name}</span> | |
640 | + </div> | |
641 | + ); | |
642 | + }, | |
643 | + }} | |
644 | + debounceTime={1000} | |
645 | + request={async (value, {}) => { | |
646 | + const keywords = value.keyWords; | |
647 | + const res = await postKingdeeRepCustomer({ | |
648 | + data: { search: keywords }, | |
649 | + }); | |
650 | + console.log(res); | |
651 | + | |
652 | + let options = res?.rows?.map((c: any) => { | |
653 | + return { | |
654 | + ...c, | |
655 | + label: c.name, | |
656 | + value: c.id, | |
657 | + key: c.id, | |
658 | + }; | |
659 | + }); | |
660 | + | |
661 | + //第一个商品默认为要新增客户 | |
662 | + if (keywords.trim() !== '') { | |
663 | + options.unshift({ | |
664 | + name: keywords, | |
665 | + type: 'add', | |
666 | + label: keywords, | |
667 | + value: 3.1415926, | |
668 | + key: keywords, | |
669 | + }); | |
670 | + } | |
671 | + return options; | |
672 | + }} | |
673 | + /> | |
674 | + <ProFormSelect | |
675 | + key="customerName" | |
676 | + label="收货人" | |
677 | + width="lg" | |
678 | + showSearch | |
679 | + name="customerName" | |
680 | + placeholder="请选择收货人" | |
681 | + rules={[{ required: true, message: '收货人必填' }]} | |
682 | + onChange={(_, option) => { | |
683 | + autoFillCustomerInfo(option); | |
684 | + }} | |
685 | + initialValue={data.contactAddress} | |
686 | + options={productCustomerContactOptions} | |
687 | + /> | |
688 | + <ProFormText | |
689 | + width="lg" | |
690 | + key="customerContactNumber" | |
691 | + name="customerContactNumber" | |
692 | + label="联系方式" | |
693 | + placeholder="请输入联系方式" | |
694 | + rules={[{ required: true, message: '联系方式必填' }]} | |
695 | + disabled | |
696 | + /> | |
697 | + <ProFormText | |
698 | + width="lg" | |
699 | + key="institution" | |
700 | + name="institution" | |
701 | + label="单位" | |
702 | + placeholder="请输入单位" | |
703 | + rules={[{ required: true, message: '单位必填' }]} | |
704 | + disabled | |
705 | + /> | |
706 | + <ProFormText | |
707 | + width="lg" | |
708 | + key="institutionContactName" | |
709 | + name="institutionContactName" | |
710 | + label="课题组" | |
711 | + placeholder="请输入课题组" | |
712 | + rules={[{ required: true, message: '课题组必填' }]} | |
713 | + disabled | |
714 | + /> | |
715 | + <ProFormTextArea | |
716 | + width="lg" | |
717 | + key="customerShippingAddress" | |
718 | + name="customerShippingAddress" | |
719 | + label="收货地址" | |
720 | + placeholder="请输入收货地址" | |
721 | + rules={[{ required: true, message: '收货地址必填' }]} | |
722 | + disabled | |
723 | + /> | |
724 | + <div id="total-payment"> | |
725 | + <ProFormDigit | |
726 | + name="totalPayment" | |
727 | + width="lg" | |
728 | + key="totalPayment" | |
729 | + label="支付总额(¥)" | |
730 | + rules={[{ required: true, message: '支付总额必填' }]} | |
731 | + tooltip="点击计算,合计所有子订单金额" | |
732 | + fieldProps={{ | |
733 | + addonAfter: ( | |
734 | + <Button | |
735 | + className="rounded-l-none" | |
736 | + type="primary" | |
737 | + onClick={computeTotalPayment} | |
738 | + > | |
739 | + 计算 | |
740 | + </Button> | |
741 | + ), | |
742 | + }} | |
743 | + // disabled={mainInfoDisbled} | |
744 | + /> | |
745 | + </div> | |
746 | + | |
747 | + <ProFormSelect | |
748 | + placeholder="请输入支付渠道" | |
749 | + name="paymentChannel" | |
750 | + width="lg" | |
751 | + key="paymentChannel" | |
752 | + label="支付渠道" | |
753 | + options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)} | |
754 | + rules={[{ required: true, message: '支付渠道必填' }]} | |
755 | + // disabled={mainInfoDisbled} | |
756 | + /> | |
757 | + <ProFormSelect | |
758 | + placeholder="请输入支付方式" | |
759 | + name="paymentMethod" | |
760 | + width="lg" | |
761 | + key="paymentMethod" | |
762 | + label="支付方式" | |
763 | + options={enumToSelect(PAYMENT_METHOD_OPTIONS)} | |
764 | + rules={[{ required: true, message: '支付方式必填' }]} | |
765 | + // disabled={mainInfoDisbled} | |
766 | + /> | |
767 | + <ProFormSelect | |
768 | + placeholder="选择是否需要开票" | |
769 | + name="invoicingStatus" | |
770 | + width="lg" | |
771 | + key="invoicingStatus" | |
772 | + label="是否需要开票" | |
773 | + options={getInvoicingSelect()} | |
774 | + // disabled={mainInfoDisbled} | |
775 | + onChange={(_, option) => { | |
776 | + setInvoicingStatus(option.value); | |
777 | + if (option.value === 'UN_INVOICE') { | |
778 | + form.setFieldValue('invoiceIdentificationNumber', undefined); | |
779 | + form.setFieldValue('bank', undefined); | |
780 | + form.setFieldValue('bankAccountNumber', undefined); | |
781 | + } | |
782 | + }} | |
783 | + rules={[{ required: true, message: '是否需要开票必填' }]} | |
784 | + /> | |
785 | + <ProFormText | |
786 | + width="lg" | |
787 | + name="invoiceIdentificationNumber" | |
788 | + label="开票信息" | |
789 | + key="invoiceIdentificationNumber" | |
790 | + // disabled={mainInfoDisbled} | |
791 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
792 | + placeholder="请输入开票信息" | |
793 | + rules={[ | |
794 | + { | |
795 | + required: invoicingStatus === 'UN_INVOICE' ? false : true, | |
796 | + message: '开票信息必填', | |
797 | + }, | |
798 | + ]} | |
799 | + /> | |
800 | + | |
801 | + {getUserInfo().roleSmallVO?.code === 'admin' ? ( | |
802 | + <ProFormDateTimePicker | |
803 | + width="lg" | |
804 | + key="invoicingTime" | |
805 | + name="invoicingTime" | |
806 | + // disabled={mainInfoDisbled} | |
807 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
808 | + label="开票时间" | |
809 | + placeholder="请输入开票时间" | |
810 | + /> | |
811 | + ) : ( | |
812 | + '' | |
813 | + )} | |
814 | + <ProFormText | |
815 | + width="lg" | |
816 | + name="bank" | |
817 | + key="bank" | |
818 | + label="开户银行" | |
819 | + // disabled={mainInfoDisbled} | |
820 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
821 | + placeholder="请输入开户银行" | |
822 | + /> | |
823 | + <ProFormText | |
824 | + width="lg" | |
825 | + key="bankAccountNumber" | |
826 | + name="bankAccountNumber" | |
827 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
828 | + label="银行账号" | |
829 | + // disabled={mainInfoDisbled} | |
830 | + placeholder="请输入银行账号" | |
831 | + /> | |
832 | + <ProFormTextArea | |
833 | + width="lg" | |
834 | + name="notes" | |
835 | + label="备注" | |
836 | + key="notes" | |
837 | + // disabled={mainInfoDisbled} | |
838 | + placeholder="请输入备注" | |
839 | + rules={[ | |
840 | + { | |
841 | + max: 120, // 最大长度为120个字符 | |
842 | + message: '备注不能超过120个字符', | |
843 | + }, | |
844 | + ]} | |
845 | + /> | |
846 | + | |
847 | + <h2>商品信息</h2> | |
848 | + <ProFormList | |
849 | + creatorButtonProps={{ disabled: false }} | |
850 | + name="list" | |
851 | + label="" | |
852 | + copyIconProps={false} //复制按钮不显示 | |
853 | + initialValue={[ | |
854 | + { | |
855 | + productCode: '', | |
856 | + productName: '', | |
857 | + quantity: '', | |
858 | + productPrice: '', | |
859 | + parameters: '', | |
860 | + subOrderPayment: '', | |
861 | + }, | |
862 | + ]} | |
863 | + actionGuard={{ | |
864 | + beforeRemoveRow: async (index) => { | |
865 | + return new Promise((resolve) => { | |
866 | + if (index === 0) { | |
867 | + message.error('第一行数据不能删除'); | |
868 | + resolve(false); | |
869 | + return; | |
870 | + } | |
871 | + resolve(true); | |
872 | + }); | |
873 | + }, | |
874 | + }} | |
875 | + itemRender={(doms, listMeta) => { | |
876 | + if (optType('edit')) { | |
877 | + let i = 0; | |
878 | + let defaultFileList = listMeta.record?.listAnnex?.map((annex) => { | |
879 | + return { | |
880 | + uid: i++, | |
881 | + name: annex, | |
882 | + status: 'uploaded', | |
883 | + url: annex, | |
884 | + response: { data: [annex] }, | |
885 | + }; | |
886 | + }); | |
887 | + fileList[listMeta.index] = defaultFileList; | |
888 | + } | |
889 | + let itemFileList = fileList[listMeta.index]; | |
890 | + return ( | |
891 | + <ProCard | |
892 | + bordered | |
893 | + extra={doms.action} | |
894 | + title={'商品' + (listMeta.index + 1)} | |
895 | + style={{ | |
896 | + marginBlockEnd: 8, | |
897 | + }} | |
898 | + > | |
899 | + {[ | |
900 | + <ProFormText | |
901 | + key={'material' + listMeta.index} | |
902 | + name="materialId" | |
903 | + hidden | |
904 | + ></ProFormText>, | |
905 | + <ProFormSelect | |
906 | + key="key" | |
907 | + label="商品名称" | |
908 | + width="lg" | |
909 | + showSearch | |
910 | + name="productName" | |
911 | + // options={options} | |
912 | + placeholder="请搜索商品" | |
913 | + rules={[{ required: true, message: '商品名称必填' }]} | |
914 | + onChange={(_, option) => { | |
915 | + autoFillProductInfo(option, listMeta, listMeta.index); | |
916 | + }} | |
917 | + initialValue={{ | |
918 | + label: listMeta?.record?.productName, | |
919 | + value: listMeta?.record?.materialId, | |
920 | + }} | |
921 | + fieldProps={{ | |
922 | + optionItemRender(item) { | |
923 | + if (item.type === 'add') { | |
924 | + return ( | |
925 | + <div title={item.name + '(新增商品信息)'}> | |
926 | + <span style={{ color: '#333333' }}> | |
927 | + {item.label} | |
928 | + </span> | |
929 | + {' | '} | |
930 | + <span style={{ color: 'orange' }}>新增商品</span> | |
931 | + </div> | |
932 | + ); | |
933 | + } | |
934 | + return ( | |
935 | + <div | |
936 | + title={ | |
937 | + item.label + | |
938 | + ' | ' + | |
939 | + (item.model === undefined | |
940 | + ? '无参数' | |
941 | + : item.model) + | |
942 | + ' | ' + | |
943 | + item.base_unit_name | |
944 | + } | |
945 | + > | |
946 | + <span style={{ color: '#333333' }}> | |
947 | + {item.label} | |
948 | + </span> | |
949 | + {' | '} | |
950 | + <span style={{ color: '#339999' }}> | |
951 | + {item.model === undefined ? '无参数' : item.model} | |
952 | + </span> | |
953 | + {' | '} | |
954 | + <span style={{ color: '#666666' }}> | |
955 | + {item.base_unit_name === undefined | |
956 | + ? '无单位' | |
957 | + : item.base_unit_name} | |
958 | + </span> | |
959 | + </div> | |
960 | + ); | |
961 | + }, | |
962 | + }} | |
963 | + debounceTime={1000} | |
964 | + request={async (value) => { | |
965 | + const keywords = value.keyWords; | |
966 | + const res = await postKingdeeRepMaterial({ | |
967 | + data: { search: keywords }, | |
968 | + }); | |
969 | + let options = res?.rows?.map((p: any) => { | |
970 | + return { | |
971 | + ...p, | |
972 | + label: p.name, | |
973 | + value: p.id + '|' + p.name, | |
974 | + key: p.id, | |
975 | + }; | |
976 | + }); | |
977 | + | |
978 | + //第一个商品默认为要新增的商品 | |
979 | + if (keywords.trim() !== '') { | |
980 | + options.unshift({ | |
981 | + productName: keywords, | |
982 | + type: 'add', | |
983 | + label: keywords, | |
984 | + value: 13 + '|' + keywords, | |
985 | + key: keywords, | |
986 | + }); | |
987 | + } | |
988 | + return options; | |
989 | + }} | |
990 | + />, | |
991 | + <ProFormText | |
992 | + key={'productCode' + listMeta.index} | |
993 | + width="lg" | |
994 | + name="productCode" | |
995 | + disabled | |
996 | + label={ | |
997 | + <> | |
998 | + <span>商品编码</span> | |
999 | + <span className="pl-2 text-xs text-gray-400"> | |
1000 | + 新增商品时,商品编码由系统自动生成 | |
1001 | + </span> | |
1002 | + </> | |
1003 | + } | |
1004 | + placeholder="商品编码" | |
1005 | + />, | |
1006 | + // <ProFormSelect | |
1007 | + // key="inv_stock" | |
1008 | + // placeholder="请选择仓库" | |
1009 | + // name="invStockId" | |
1010 | + // width="lg" | |
1011 | + // label="仓库" | |
1012 | + // options={productInvStockOptionsList[listMeta.index]} | |
1013 | + // />, | |
1014 | + <ProFormText | |
1015 | + key={'parameters' + listMeta.index} | |
1016 | + width="lg" | |
1017 | + name="parameters" | |
1018 | + label="商品参数" | |
1019 | + placeholder="请输入商品参数" | |
1020 | + rules={[{ required: true, message: '商品参数必填' }]} | |
1021 | + disabled={ | |
1022 | + productParametersDisabledFlagList[listMeta.index] !== | |
1023 | + false | |
1024 | + } | |
1025 | + />, | |
1026 | + <ProFormDigit | |
1027 | + key={'quantity' + listMeta.index} | |
1028 | + width="lg" | |
1029 | + name="quantity" | |
1030 | + label="商品数量" | |
1031 | + fieldProps={{ | |
1032 | + onChange: (value) => { | |
1033 | + listMeta.record.quantity = value; | |
1034 | + computeSubOrderPayment(listMeta); | |
1035 | + }, | |
1036 | + }} | |
1037 | + placeholder="请输入商品数量" | |
1038 | + rules={[{ required: true, message: '商品数量必填' }]} | |
1039 | + />, | |
1040 | + | |
1041 | + <ProFormDigit | |
1042 | + key={'productPrice' + listMeta.index} | |
1043 | + width="lg" | |
1044 | + name="productPrice" | |
1045 | + label="商品单价" | |
1046 | + fieldProps={{ | |
1047 | + onChange: (value) => { | |
1048 | + listMeta.record.productPrice = value; | |
1049 | + computeSubOrderPayment(listMeta); | |
1050 | + }, | |
1051 | + }} | |
1052 | + placeholder="请输入商品单价" | |
1053 | + rules={[{ required: true, message: '商品单价必填' }]} | |
1054 | + />, | |
1055 | + | |
1056 | + <ProFormSelect | |
1057 | + key="unitId" | |
1058 | + placeholder="请选择单位" | |
1059 | + name="unitId" | |
1060 | + width="lg" | |
1061 | + label="单位" | |
1062 | + showSearch | |
1063 | + onChange={(_, option) => { | |
1064 | + autoFillUnit(option, listMeta.index); | |
1065 | + }} | |
1066 | + options={productUnitOptionsList[listMeta.index]} | |
1067 | + rules={[{ required: true, message: '商品单位必填' }]} | |
1068 | + />, | |
1069 | + <ProFormText | |
1070 | + key={'unit' + listMeta.index} | |
1071 | + width="lg" | |
1072 | + name="unit" | |
1073 | + label="商品单位" | |
1074 | + placeholder="请输入商品单位" | |
1075 | + rules={[{ required: true, message: '商品单位必填' }]} | |
1076 | + hidden | |
1077 | + />, | |
1078 | + | |
1079 | + <ProFormDigit | |
1080 | + width="lg" | |
1081 | + key={'subOrderPayment' + listMeta.index} | |
1082 | + name="subOrderPayment" | |
1083 | + label="子订单金额" | |
1084 | + placeholder="请输入子订单金额" | |
1085 | + tooltip="商品数量和单价变化后会自动计算子订单金额" | |
1086 | + rules={[{ required: true, message: '子订单金额必填' }]} | |
1087 | + />, | |
1088 | + <ProFormSelect | |
1089 | + key={'productBelongBusiness' + listMeta.index} | |
1090 | + placeholder="请输入所属事业部" | |
1091 | + name="productBelongBusiness" | |
1092 | + width="lg" | |
1093 | + label="所属事业部" | |
1094 | + options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)} | |
1095 | + initialValue={'EXPERIMENTAL_CONSUMABLES'} | |
1096 | + rules={[{ required: true, message: '所属事业部必填' }]} | |
1097 | + // disabled={mainInfoDisbled} | |
1098 | + />, | |
1099 | + <ProFormTextArea | |
1100 | + key={'notes' + listMeta.index} | |
1101 | + width="lg" | |
1102 | + name="notes" | |
1103 | + label={ | |
1104 | + <div> | |
1105 | + <span>备注</span> | |
1106 | + <span className="pl-2 text-xs text-gray-400"> | |
1107 | + 备注将体现在出货单上,请将需要仓管看见的信息写在备注上,例如需要开收据等信息。 | |
1108 | + </span> | |
1109 | + </div> | |
1110 | + } | |
1111 | + placeholder="请输入备注" | |
1112 | + rules={[ | |
1113 | + { | |
1114 | + max: 120, // 最大长度为120个字符 | |
1115 | + message: '备注不能超过120个字符', | |
1116 | + }, | |
1117 | + ]} | |
1118 | + />, | |
1119 | + <> | |
1120 | + <ProFormUploadDragger | |
1121 | + key={'filePaths' + listMeta.index} | |
1122 | + label="附件" | |
1123 | + name="filePaths" | |
1124 | + action="/api/service/order/fileProcess" | |
1125 | + fieldProps={{ | |
1126 | + headers: { | |
1127 | + Authorization: localStorage.getItem('token'), | |
1128 | + }, | |
1129 | + itemFileList, | |
1130 | + }} | |
1131 | + /> | |
1132 | + </>, | |
1133 | + ]} | |
1134 | + </ProCard> | |
1135 | + ); | |
1136 | + }} | |
1137 | + actionRef={actionRef} | |
1138 | + ></ProFormList> | |
1139 | + </DrawerForm> | |
1140 | + | |
1141 | + {kingdeeCstomerModalVisible && ( | |
1142 | + <KingdeeCustomerModal | |
1143 | + setVisible={setKingdeeCstomerModalVisible} | |
1144 | + data={customer} | |
1145 | + onClose={(customerId: any) => { | |
1146 | + setKingdeeCstomerModalVisible(false); | |
1147 | + //回显已经新建好的客户 | |
1148 | + autoFillCustomerContactSelectOptions(customerId); | |
1149 | + }} | |
1150 | + /> | |
1151 | + )} | |
1152 | + </> | |
1153 | + ); | |
1154 | +}; | ... | ... |
src/pages/Order/FeedBack/OrderDrawer.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postCanrdApiUserAddressList, | |
4 | + postCanrdApiUserDetail, | |
5 | + postCanrdApiUserNowMoneyCheck, | |
6 | + postDistrictSelectByLevel, | |
7 | + postDistrictSelectByNameAndLevel, | |
8 | + postDistrictSelOrderProvince, | |
9 | + postKingdeeRepCustomerDetail, | |
10 | + postKingdeeRepMaterial, | |
11 | + postKingdeeRepMaterialUnit, | |
12 | + postKingdeeRepMeasureUnit, | |
13 | + postPrepaidPhoneAvailableList, | |
14 | + postResearchGroupsNameSet, | |
15 | + postServiceOrderAddOrder, | |
16 | + postServiceOrderAfterSalesQuerySnapshotOrder, | |
17 | + postServiceOrderApplyAfterSales, | |
18 | + postServiceOrderApplyModify, | |
19 | + postServiceOrderUpdateOrder, | |
20 | +} from '@/services'; | |
21 | +import { | |
22 | + enumToSelect, | |
23 | + FloatAdd, | |
24 | + FloatMul, | |
25 | + getAliYunOSSFileNameFromUrl, | |
26 | + getUserInfo, | |
27 | +} from '@/utils'; | |
28 | +import { getTeacherCustomFieldNumber } from '@/utils/kingdee'; | |
29 | +import { getSalesCodeOptions } from '@/utils/order'; | |
30 | +import { getDefaultString } from '@/utils/StringUtil'; | |
31 | +import { | |
32 | + DrawerForm, | |
33 | + FormListActionType, | |
34 | + ProCard, | |
35 | + ProFormDateTimePicker, | |
36 | + ProFormDigit, | |
37 | + ProFormList, | |
38 | + ProFormSelect, | |
39 | + ProFormText, | |
40 | + ProFormTextArea, | |
41 | + ProFormUploadDragger, | |
42 | +} from '@ant-design/pro-components'; | |
43 | +import { Button, Form, message, Modal } from 'antd'; | |
44 | +import { cloneDeep } from 'lodash'; | |
45 | +import { useEffect, useRef, useState } from 'react'; | |
46 | +import { | |
47 | + AFTE_SALES_PLAN_OPTIONS, | |
48 | + INVOCING_STATUS_OPTIONS, | |
49 | + INVOCING_STATUS_OPTIONS_OLD, | |
50 | + PAYEE_OPTIONS, | |
51 | + PAYMENT_CHANNEL_OPTIONS, | |
52 | + PAYMENT_METHOD_OPTIONS, | |
53 | + PRODUCT_BELONG_DEPARTMENT_OPTIONS, | |
54 | + SHIPPING_WAREHOUSE_OPTIONS, | |
55 | +} from './constant'; | |
56 | +import KingdeeCustomerModal from './KingdeeCustomerModal'; | |
57 | + | |
58 | +export default ({ onClose, data, subOrders, orderOptType }) => { | |
59 | + const [invoicingStatus, setInvoicingStatus] = useState(''); | |
60 | + const [salesCodeOptions, setSalesCodeOptions] = useState([]); | |
61 | + const [submitBtnLoading, setSubmitBtnLoading] = useState(false); | |
62 | + const [drawerTitle, setDrawerTitle] = useState(''); | |
63 | + const [hasLocalData, setHasLocalData] = useState(false); | |
64 | + // const [customer, setCustomer] = useState({}); | |
65 | + const [localSaveLoading, setLocalSaveLoading] = useState(false); | |
66 | + const [kingdeeCstomerModalVisible, setKingdeeCstomerModalVisible] = | |
67 | + useState(false); | |
68 | + const [paymentMethod, setPaymentMethod] = useState(''); | |
69 | + const [customerRequestCount, setCustomerRequestCount] = useState(0); | |
70 | + const [ | |
71 | + productParametersDisabledFlagList, | |
72 | + setProductParametersDisabledFlagList, | |
73 | + ] = useState([]); | |
74 | + // const [productInvStockOptionsList, setProductInvStockOptionsList] = useState( | |
75 | + // [], | |
76 | + // ); //商品的仓库选项 | |
77 | + const [productUnitOptionsList, setProductUnitOptionsList] = useState([]); //商品的单位选项 | |
78 | + //省市区 | |
79 | + const [province, setProvince] = useState(''); | |
80 | + const [city, setCity] = useState(''); | |
81 | + const [district, setDistrict] = useState(''); | |
82 | + // const [productCustomerContactOptions, setProductCustomerContactOptions] = | |
83 | + // useState([]); //客户的收货人选项 | |
84 | + const [form] = Form.useForm<{ | |
85 | + isLocalData: boolean; | |
86 | + salesCode: ''; | |
87 | + customerName: ''; | |
88 | + customerContactNumber: ''; | |
89 | + institution: ''; | |
90 | + institutionContactName: ''; | |
91 | + customerShippingAddress: ''; | |
92 | + totalPayment: ''; | |
93 | + paymentChannel: ''; | |
94 | + paymentMethod: ''; | |
95 | + productBelongBusiness: ''; | |
96 | + invoicingStatus: ''; | |
97 | + invoiceIdentificationNumber: ''; | |
98 | + invoicingTime: ''; | |
99 | + bank: ''; | |
100 | + bankAccountNumber: ''; | |
101 | + deleteSubOrderLists: []; | |
102 | + filePaths: []; | |
103 | + notes: ''; | |
104 | + invoiceFirst: boolean; | |
105 | + list: [ | |
106 | + { | |
107 | + productCode: ''; | |
108 | + productName: ''; | |
109 | + quantity: ''; | |
110 | + productPrice: ''; | |
111 | + parameters: ''; | |
112 | + subOrderPayment: ''; | |
113 | + unit: ''; | |
114 | + serialNumber: ''; | |
115 | + notes: ''; | |
116 | + }, | |
117 | + ]; | |
118 | + }>(); | |
119 | + const [accountOptions, setAccountOptions] = useState<any>([]); | |
120 | + | |
121 | + let copyData = cloneDeep(data); | |
122 | + | |
123 | + let originSubOrders = cloneDeep(subOrders); | |
124 | + | |
125 | + /** | |
126 | + * 获取当前的操作类型boolean值 | |
127 | + * @param type 操作类型,如果与当前匹配返回true | |
128 | + */ | |
129 | + function optType(type: string) { | |
130 | + return orderOptType === type; | |
131 | + } | |
132 | + | |
133 | + /** | |
134 | + * 获取销售代码枚举,在复制和编辑的时候判断是否为旧的代码 | |
135 | + */ | |
136 | + const loadSalesCodeOptions = async () => { | |
137 | + let options = await getSalesCodeOptions(); | |
138 | + setSalesCodeOptions(options); | |
139 | + | |
140 | + if (optType('copy') || optType('edit')) { | |
141 | + let includeFlag = false; | |
142 | + //销售代码校验,如果是旧的销售代码,则提示并清空 | |
143 | + for (let option of options) { | |
144 | + if (option.value === copyData.salesCode) { | |
145 | + includeFlag = true; | |
146 | + } | |
147 | + } | |
148 | + | |
149 | + if (!includeFlag) { | |
150 | + form.resetFields(['salesCode']); | |
151 | + message.warning('检测到销售代码为旧的,已清空,请重新选择'); | |
152 | + } | |
153 | + } | |
154 | + }; | |
155 | + | |
156 | + /** | |
157 | + * 选择客户后自动为收货人Select添加选项,填充课题组和单位信息 | |
158 | + * @param option 客户选项 | |
159 | + */ | |
160 | + async function autoFillCustomerContactSelectOptions(customerId: any) { | |
161 | + //查询单位详细信息 | |
162 | + let res = await postKingdeeRepCustomerDetail({ | |
163 | + data: { | |
164 | + id: customerId, | |
165 | + }, | |
166 | + }); | |
167 | + | |
168 | + //erp客户名称 | |
169 | + form.setFieldValue('erpCustomerName', res?.name); | |
170 | + | |
171 | + //重新设置当前option | |
172 | + form.setFieldValue('erpCustomerId', { | |
173 | + label: res?.name, | |
174 | + value: res?.id, | |
175 | + id: res?.id, | |
176 | + }); | |
177 | + | |
178 | + //查询客户自定义字段,课题组 | |
179 | + let entity_number = await getTeacherCustomFieldNumber(); | |
180 | + | |
181 | + //在单位详细信息中拿到自定义字段的值 | |
182 | + let customField = res?.custom_field; | |
183 | + if (customField) { | |
184 | + let teacherName = customField[entity_number]; | |
185 | + //填充到课题组老师表单字段中 | |
186 | + form.setFieldValue('institutionContactName', teacherName); | |
187 | + } | |
188 | + | |
189 | + //单位名称,从客户名称中获取,客户名称规则<单位名称>-<联系人名称和电话> | |
190 | + let namePortions = res?.name?.split('-'); | |
191 | + if (namePortions && namePortions.length >= 2) { | |
192 | + form.setFieldValue('institution', namePortions[0]); | |
193 | + } | |
194 | + | |
195 | + //如果原来的收货信息没有包含在这次查询出来的收货人选项中,那么清除原来的收货人信息 | |
196 | + let existFlag = false; | |
197 | + | |
198 | + //填充收货人选项 | |
199 | + // let newProductCustomerContactOptions = res?.bomentity?.map((item) => { | |
200 | + // let address = | |
201 | + // item.contact_person + ',' + item.mobile + ',' + item.contact_address; | |
202 | + // if (address === data.contactAddress) { | |
203 | + // existFlag = true; | |
204 | + // } | |
205 | + // return { ...item, label: address, value: address }; | |
206 | + // }); | |
207 | + | |
208 | + // setProductCustomerContactOptions(newProductCustomerContactOptions); | |
209 | + | |
210 | + if (!existFlag) { | |
211 | + //清空原来的收货人信息 | |
212 | + form.setFieldValue('customerShippingAddress', undefined); | |
213 | + form.setFieldValue('customerContactNumber', undefined); | |
214 | + form.setFieldValue('customerName', undefined); | |
215 | + form.setFieldValue('erpCustomerAddress', undefined); | |
216 | + } | |
217 | + } | |
218 | + | |
219 | + /** | |
220 | + * 回显金蝶信息 | |
221 | + */ | |
222 | + // async function showKindeeInfo() { | |
223 | + // //客户信息 | |
224 | + // if (copyData.customerId) { | |
225 | + // //客户回显 | |
226 | + // autoFillCustomerContactSelectOptions(copyData.customerId); | |
227 | + // } | |
228 | + | |
229 | + // //商品单位回显 | |
230 | + // let list = copyData?.subOrderInformationLists; | |
231 | + // if (list) { | |
232 | + // let newProductUnitOptionsList = [...productUnitOptionsList]; | |
233 | + // for (let i = 0; i < list.length; i++) { | |
234 | + // newProductUnitOptionsList[i] = [ | |
235 | + // { label: list[i].unit, value: list[i].unitId }, | |
236 | + // ]; | |
237 | + // } | |
238 | + // setProductUnitOptionsList(newProductUnitOptionsList); | |
239 | + // } | |
240 | + // } | |
241 | + | |
242 | + /** | |
243 | + * 加载预存账号的options | |
244 | + */ | |
245 | + async function loadAccountOptions(phone: any) { | |
246 | + let newAccountOptions = []; | |
247 | + //预存账号id | |
248 | + let uid = copyData.prepaidUid; | |
249 | + let res = await postCanrdApiUserDetail({ data: { uid: uid } }); | |
250 | + if (res && res.result === RESPONSE_CODE.SUCCESS && res.data !== null) { | |
251 | + let uidDetail = res.data; | |
252 | + uidDetail.value = uid; | |
253 | + uidDetail.label = uidDetail.realName; | |
254 | + newAccountOptions.push(uidDetail); | |
255 | + } | |
256 | + | |
257 | + // 查询当前手机号允许使用的预存账号 | |
258 | + if (phone) { | |
259 | + let res = await postPrepaidPhoneAvailableList({ data: { phone: phone } }); | |
260 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
261 | + let uidDetails = res.data; | |
262 | + for (let detail of uidDetails) { | |
263 | + detail.value = detail.uid; | |
264 | + detail.label = detail.realName; | |
265 | + newAccountOptions.push(detail); | |
266 | + } | |
267 | + } | |
268 | + } | |
269 | + | |
270 | + console.log(newAccountOptions); | |
271 | + setAccountOptions(newAccountOptions); | |
272 | + } | |
273 | + | |
274 | + /** | |
275 | + * 构建回显数据 | |
276 | + */ | |
277 | + function buildOrderData() { | |
278 | + // let mainInfoDisbled = optType('edit'); | |
279 | + if (!optType('add')) { | |
280 | + if (subOrders !== undefined && subOrders.length > 0) { | |
281 | + copyData.subOrderInformationLists = subOrders; | |
282 | + } | |
283 | + | |
284 | + //如果是复制,需要开票,不回显是否需要开票字段 | |
285 | + if (optType('copy')) { | |
286 | + if (copyData.invoicingStatus === 'INVOICED') { | |
287 | + copyData.invoicingStatus = undefined; | |
288 | + | |
289 | + //复制的时候,如果是不需要开票,要把开票信息清空 | |
290 | + if (copyData.invoicingStatus === 'UN_INVOICE') { | |
291 | + copyData.invoiceIdentificationNumber = undefined; | |
292 | + } | |
293 | + } | |
294 | + } | |
295 | + //主订单事业部默认显示子订单第一条的事业部 | |
296 | + copyData.productBelongBusiness = | |
297 | + copyData.subOrderInformationLists[0].productBelongBusiness; | |
298 | + copyData.paymentMethod = | |
299 | + copyData.subOrderInformationLists[0].paymentMethod; | |
300 | + copyData.paymentChannel = | |
301 | + copyData.subOrderInformationLists[0].paymentChannel; | |
302 | + copyData.invoicingStatus = | |
303 | + copyData.subOrderInformationLists[0].invoicingStatus; | |
304 | + | |
305 | + copyData.customerNameString = copyData.customerName; | |
306 | + | |
307 | + setPaymentMethod(copyData.paymentMethod); | |
308 | + | |
309 | + //子订单数据处理:子订单在表单中的命名为list | |
310 | + let i = 0; | |
311 | + let newList = copyData.subOrderInformationLists?.map((item) => { | |
312 | + item.filePaths = item.listAnnex?.map((path) => { | |
313 | + return { | |
314 | + uid: i++, | |
315 | + name: getAliYunOSSFileNameFromUrl(path), | |
316 | + status: 'uploaded', | |
317 | + url: path, | |
318 | + response: { data: [path] }, | |
319 | + }; | |
320 | + }); | |
321 | + return item; | |
322 | + }); | |
323 | + | |
324 | + copyData['list'] = newList; | |
325 | + | |
326 | + //发货仓库处理 | |
327 | + for (let listItem of copyData.list) { | |
328 | + if (listItem.shippingWarehouse === null) { | |
329 | + listItem.shippingWarehouse = 'DALANG_WAREHOUSE'; | |
330 | + } | |
331 | + } | |
332 | + setInvoicingStatus(copyData.invoicingStatus); | |
333 | + form.setFieldsValue({ ...copyData }); | |
334 | + //如果是新建,需要清空list | |
335 | + if (optType('add')) { | |
336 | + form.resetFields(['list']); | |
337 | + } | |
338 | + | |
339 | + if (!optType('after-sales-check')) { | |
340 | + // showKindeeInfo(); | |
341 | + } | |
342 | + | |
343 | + loadAccountOptions(form.getFieldValue('customerContactNumber')); | |
344 | + } | |
345 | + } | |
346 | + | |
347 | + /** | |
348 | + * 获取旧订单信息 | |
349 | + * @param id | |
350 | + */ | |
351 | + async function getOldOrderData(id: any) { | |
352 | + let res = await postServiceOrderAfterSalesQuerySnapshotOrder({ | |
353 | + data: { | |
354 | + mainOrderId: id, | |
355 | + }, | |
356 | + }); | |
357 | + | |
358 | + copyData = res.data.mainOrder; | |
359 | + copyData.subOrderInformationLists = res.data.subOrders; | |
360 | + originSubOrders = res.data.subOrders; | |
361 | + | |
362 | + //客户显示 | |
363 | + form.setFieldValue('erpCustomerId', { | |
364 | + label: copyData.erpCustomerName, | |
365 | + value: copyData.customerId, | |
366 | + }); | |
367 | + | |
368 | + buildOrderData(); | |
369 | + } | |
370 | + | |
371 | + /** | |
372 | + * | |
373 | + * @returns 获取开票选项 | |
374 | + */ | |
375 | + function getInvoicingSelect() { | |
376 | + if (optType('edit') || optType('after-sales-check')) { | |
377 | + return enumToSelect(INVOCING_STATUS_OPTIONS_OLD); | |
378 | + } | |
379 | + return enumToSelect(INVOCING_STATUS_OPTIONS); | |
380 | + } | |
381 | + | |
382 | + const fileList: any = []; | |
383 | + | |
384 | + useEffect(() => { | |
385 | + //弹窗标题 | |
386 | + if (optType('add')) { | |
387 | + setDrawerTitle('新增订单'); | |
388 | + } | |
389 | + if (optType('copy')) { | |
390 | + setDrawerTitle('复制订单'); | |
391 | + } | |
392 | + if (optType('edit')) { | |
393 | + setDrawerTitle('修改订单'); | |
394 | + } | |
395 | + if (optType('after-sales')) { | |
396 | + setDrawerTitle('申请售后'); | |
397 | + } | |
398 | + if (optType('after-sales-check')) { | |
399 | + setDrawerTitle('订单信息'); | |
400 | + } | |
401 | + if (optType('order-change-normal')) { | |
402 | + setDrawerTitle('申请修改'); | |
403 | + } | |
404 | + }, []); | |
405 | + | |
406 | + const actionRef = useRef< | |
407 | + FormListActionType<{ | |
408 | + name: string; | |
409 | + }> | |
410 | + >(); | |
411 | + | |
412 | + useEffect(() => { | |
413 | + form.setFieldsValue({ ...data }); | |
414 | + //如果是新建,需要清空list | |
415 | + if (optType('add')) { | |
416 | + form.resetFields(['list']); | |
417 | + } | |
418 | + }, [data]); | |
419 | + | |
420 | + /** | |
421 | + * 所属部门修改事件 | |
422 | + * 如果选择实验耗材事业部,那么发货仓库默认是大朗仓库 | |
423 | + * @param val | |
424 | + */ | |
425 | + function productBelongBusinessChange(val: any, index: any) { | |
426 | + if (val === 'EXPERIMENTAL_CONSUMABLES') { | |
427 | + let list = form.getFieldValue('list'); | |
428 | + let currentData = list[index]; | |
429 | + if (currentData) { | |
430 | + currentData.shippingWarehouse = 'DALANG_WAREHOUSE'; | |
431 | + form.setFieldValue('list', list); | |
432 | + message.info('已默认选择大朗仓库'); | |
433 | + } | |
434 | + } | |
435 | + } | |
436 | + | |
437 | + /** | |
438 | + * | |
439 | + * @param option 商品名称所对应的商品数据 | |
440 | + * @param currentRowData list中当前行的数据 | |
441 | + */ | |
442 | + async function autoFillProductInfo( | |
443 | + option: any, | |
444 | + currentRowData: any, | |
445 | + index: any, | |
446 | + ) { | |
447 | + let newProductParametersDisabledFlagList = [ | |
448 | + ...productParametersDisabledFlagList, | |
449 | + ]; | |
450 | + let newProductUnitOptionsList = [...productUnitOptionsList]; | |
451 | + newProductUnitOptionsList[index] = []; | |
452 | + | |
453 | + //是新增商品 | |
454 | + if (option.type === 'add') { | |
455 | + //商品参数开放权限可以编辑 | |
456 | + newProductParametersDisabledFlagList[index] = false; | |
457 | + | |
458 | + //清空商品信息 | |
459 | + let copyList = form.getFieldValue('list'); | |
460 | + let currentData = copyList[index]; | |
461 | + currentData.productCode = undefined; | |
462 | + currentData.parameters = undefined; | |
463 | + currentData.unit = undefined; | |
464 | + currentData.subOrderPayment = undefined; | |
465 | + currentData.quantity = undefined; | |
466 | + currentData.notes = undefined; | |
467 | + currentData.productPrice = undefined; | |
468 | + | |
469 | + currentData.unitId = undefined; | |
470 | + currentData.materialId = undefined; | |
471 | + form.setFieldValue('list', copyList); | |
472 | + | |
473 | + //todo 查询计量单价列表 | |
474 | + if (false) { | |
475 | + let res = await postKingdeeRepMeasureUnit({ data: {} }); | |
476 | + if (res && res?.rows) { | |
477 | + for (let row of res?.rows) { | |
478 | + newProductUnitOptionsList[index].push({ | |
479 | + label: row.name, | |
480 | + value: row.id, | |
481 | + }); | |
482 | + } | |
483 | + } | |
484 | + } | |
485 | + } else { | |
486 | + //选择的是已有的商品,进行内容自动填充 | |
487 | + let copyList = form.getFieldValue('list'); | |
488 | + let currentData = copyList[index]; | |
489 | + currentData.productCode = option?.number; | |
490 | + currentData.parameters = option?.model; | |
491 | + currentData.unit = option?.base_unit_name; | |
492 | + | |
493 | + //商品id | |
494 | + currentData.materialId = option?.id; | |
495 | + | |
496 | + //单位 | |
497 | + currentData.unit = option.base_unit_name; | |
498 | + currentData.unitId = option.base_unit_id; | |
499 | + | |
500 | + form.setFieldValue('list', copyList); | |
501 | + | |
502 | + //商品所在的仓库选项填充 | |
503 | + // let res = await postKingdeeRepMaterialStock({ | |
504 | + // data: { | |
505 | + // material_id: option.id, | |
506 | + // }, | |
507 | + // }); | |
508 | + // let newProductInvStockOptionsList = [...productInvStockOptionsList]; | |
509 | + // newProductInvStockOptionsList[index] = res?.rows?.map((item) => { | |
510 | + // return { label: item.inv_stock, value: item.inv_stock_id }; | |
511 | + // }); | |
512 | + // setProductInvStockOptionsList(newProductInvStockOptionsList); | |
513 | + | |
514 | + //商品单位填充,查询商品单位列表 | |
515 | + let res = await postKingdeeRepMaterialUnit({ | |
516 | + data: { material_id: option.id }, | |
517 | + }); | |
518 | + if (res && res.rows) { | |
519 | + for (let row of res.rows) { | |
520 | + newProductUnitOptionsList[index].push({ | |
521 | + label: row.unit_name, | |
522 | + value: row.unit_id, | |
523 | + }); | |
524 | + } | |
525 | + } | |
526 | + //商品参数不允许编辑 | |
527 | + newProductParametersDisabledFlagList[index] = true; | |
528 | + } | |
529 | + | |
530 | + setProductParametersDisabledFlagList(newProductParametersDisabledFlagList); | |
531 | + setProductUnitOptionsList(newProductUnitOptionsList); | |
532 | + } | |
533 | + | |
534 | + /** | |
535 | + * 选择收货人后自动填充信息 | |
536 | + * @param option 收货人信息 | |
537 | + */ | |
538 | + async function autoFillCustomerInfo(option: any) { | |
539 | + if (option === undefined || option === null || option.type === 'add') { | |
540 | + form.setFieldValue('customerShippingAddress', undefined); | |
541 | + form.setFieldValue('customerContactNumber', undefined); | |
542 | + form.setFieldValue('institution', undefined); | |
543 | + form.setFieldValue('institutionContactName', undefined); | |
544 | + form.setFieldValue('customerShippingAddress', undefined); | |
545 | + | |
546 | + if (option !== undefined && option !== null) { | |
547 | + form.setFieldValue('customerNameString', option.name); | |
548 | + } | |
549 | + } else { | |
550 | + form.setFieldValue('customerShippingAddress', option.fullAddress); | |
551 | + form.setFieldValue('customerContactNumber', option.phone); | |
552 | + form.setFieldValue('institution', option.institution); | |
553 | + form.setFieldValue( | |
554 | + 'institutionContactName', | |
555 | + option.institutionContactName, | |
556 | + ); | |
557 | + form.setFieldValue( | |
558 | + 'customerShippingAddress', | |
559 | + getDefaultString(option.province) + | |
560 | + getDefaultString(option.city) + | |
561 | + getDefaultString(option.district) + | |
562 | + getDefaultString(option.detail), | |
563 | + ); | |
564 | + form.setFieldValue('customerNameString', option.realName); | |
565 | + | |
566 | + loadAccountOptions(option.phone); | |
567 | + } | |
568 | + | |
569 | + //erp收货地址:需要与客户联系人中的地址一样:姓名,手机号,地址 | |
570 | + // form.setFieldValue('contactAddress', option.value); | |
571 | + } | |
572 | + | |
573 | + /** | |
574 | + * 填充销售代表的信息 | |
575 | + * @param option | |
576 | + */ | |
577 | + function autoFillSalesInfo(option: any) { | |
578 | + //销售代表对应职员编码填充 | |
579 | + form.setFieldValue('empNumber', option.number); | |
580 | + } | |
581 | + | |
582 | + /** | |
583 | + * todo 选择商品单位后自动填充 | |
584 | + * @param option | |
585 | + * @param index | |
586 | + */ | |
587 | + // function autoFillUnit(option: any, index: any) { | |
588 | + // let copyList = form.getFieldValue('list'); | |
589 | + // let currentData = copyList[index]; | |
590 | + // currentData.unit = option?.label; | |
591 | + // form.setFieldValue('list', copyList); | |
592 | + // } | |
593 | + | |
594 | + /** | |
595 | + * 计算子订单金额 | |
596 | + * @param listMeta 当前商品信息 | |
597 | + */ | |
598 | + function computeSubOrderPayment(listMeta: any) { | |
599 | + let quantity = listMeta?.record?.quantity; | |
600 | + let productPrice = listMeta?.record?.productPrice; | |
601 | + quantity = quantity === '' || quantity === undefined ? 0 : quantity; | |
602 | + productPrice = | |
603 | + productPrice === '' || productPrice === undefined ? 0 : productPrice; | |
604 | + quantity = parseInt(quantity); | |
605 | + productPrice = parseFloat(productPrice); | |
606 | + | |
607 | + listMeta.subOrderPayment = FloatMul(quantity, productPrice); | |
608 | + let list = form.getFieldValue('list'); | |
609 | + list[listMeta?.index].subOrderPayment = FloatMul(quantity, productPrice); | |
610 | + form.setFieldValue('list', list); | |
611 | + } | |
612 | + | |
613 | + /** | |
614 | + * 计算支付总额 | |
615 | + */ | |
616 | + function computeTotalPayment() { | |
617 | + let list = form.getFieldValue('list'); | |
618 | + let totalPayment = 0; | |
619 | + list?.forEach((subOrder: any) => { | |
620 | + let subOrderPayment = subOrder?.subOrderPayment; | |
621 | + if (subOrderPayment !== '' && subOrderPayment !== undefined) { | |
622 | + totalPayment = FloatAdd(subOrderPayment, totalPayment); | |
623 | + } | |
624 | + }); | |
625 | + form.setFieldValue('totalPayment', totalPayment); | |
626 | + } | |
627 | + | |
628 | + /** | |
629 | + * 检查用户额度 | |
630 | + * @param option | |
631 | + */ | |
632 | + const checkAccountMoney = async (uid: any, subPrice: any) => { | |
633 | + let res = await postCanrdApiUserNowMoneyCheck({ | |
634 | + data: { uid: uid, subPrice: subPrice }, | |
635 | + }); | |
636 | + if (res && res.result === RESPONSE_CODE.SUCCESS && res.data) { | |
637 | + let data = res.data; | |
638 | + let isCredit = data.isCredit; | |
639 | + if (isCredit) { | |
640 | + return true; | |
641 | + } | |
642 | + | |
643 | + message.error( | |
644 | + '用户余额不足,当前预减的金额为:' + | |
645 | + data.subPrice + | |
646 | + ',当前账号余额为:' + | |
647 | + data.nowMoney + | |
648 | + ',当前账号可赊账额度为:' + | |
649 | + data.creditLimit, | |
650 | + ); | |
651 | + return false; | |
652 | + } | |
653 | + | |
654 | + return false; | |
655 | + }; | |
656 | + | |
657 | + /** | |
658 | + * 总金额改变触发事件 | |
659 | + * 如果是预存单,需要检查余额 | |
660 | + * @param value | |
661 | + */ | |
662 | + const totalPaymentChange = (value: any) => { | |
663 | + let paymentMethod = form.getFieldValue('paymentMethod'); | |
664 | + let prepaidUid = form.getFieldValue('prepaidUid'); | |
665 | + if ( | |
666 | + value && | |
667 | + paymentMethod && | |
668 | + paymentMethod === 'WITHHOLDING_ADVANCE_DEPOSIT' && | |
669 | + prepaidUid | |
670 | + ) { | |
671 | + let valid = checkAccountMoney(prepaidUid, value); | |
672 | + if (!valid) { | |
673 | + form.setFieldValue('prepaidUid', undefined); | |
674 | + } | |
675 | + } | |
676 | + }; | |
677 | + | |
678 | + /** | |
679 | + * 检查客户是否可以编辑 | |
680 | + * @returns | |
681 | + */ | |
682 | + // const customerEditable = () => { | |
683 | + // let erpCustomerId = form.getFieldValue('erpCustomerId'); | |
684 | + // if ( | |
685 | + // optType('after-sales-check') || | |
686 | + // erpCustomerId === null || | |
687 | + // erpCustomerId === undefined | |
688 | + // ) { | |
689 | + // return false; | |
690 | + // } | |
691 | + | |
692 | + // return true; | |
693 | + // }; | |
694 | + | |
695 | + /** | |
696 | + * 是否有草稿 | |
697 | + */ | |
698 | + function checkHasLocalData() { | |
699 | + let preOrderData = localStorage.getItem('preOrderData'); | |
700 | + let hasLocalData = | |
701 | + preOrderData !== null && | |
702 | + preOrderData !== undefined && | |
703 | + preOrderData !== ''; | |
704 | + setHasLocalData(hasLocalData); | |
705 | + return hasLocalData; | |
706 | + } | |
707 | + | |
708 | + /** | |
709 | + * 保存表单数据到本地 | |
710 | + */ | |
711 | + function saveFormDataToLocal() { | |
712 | + let preOrderData = localStorage.getItem('preOrderData'); | |
713 | + let values = form.getFieldsValue(); | |
714 | + values.isLocalData = true; //标识为本地草稿数据 | |
715 | + let formData = JSON.stringify(values); | |
716 | + | |
717 | + //检查本地是否已有数据 | |
718 | + if (preOrderData) { | |
719 | + Modal.confirm({ | |
720 | + title: '提示', | |
721 | + content: '检测到本地有订单数据,是否覆盖?', | |
722 | + onOk: () => { | |
723 | + localStorage.setItem('preOrderData', formData); | |
724 | + message.success('本地保存成功'); | |
725 | + }, | |
726 | + onCancel: () => { | |
727 | + message.info('取消保存'); | |
728 | + }, | |
729 | + }); | |
730 | + } else { | |
731 | + localStorage.setItem('preOrderData', formData); | |
732 | + message.success('本地保存成功'); | |
733 | + } | |
734 | + | |
735 | + checkHasLocalData(); | |
736 | + setLocalSaveLoading(false); | |
737 | + } | |
738 | + | |
739 | + /** | |
740 | + * 使用草稿数据 | |
741 | + */ | |
742 | + function useLocalFormData() { | |
743 | + let preOrderData = localStorage.getItem('preOrderData'); | |
744 | + if (preOrderData) { | |
745 | + let formData = JSON.parse(preOrderData); | |
746 | + formData.customerName = { | |
747 | + label: formData.customerNameString, | |
748 | + value: formData.customerName, | |
749 | + }; | |
750 | + console.log(formData); | |
751 | + form.setFieldsValue(formData); | |
752 | + setPaymentMethod(formData.paymentMethod); | |
753 | + } | |
754 | + } | |
755 | + | |
756 | + const validateContactNumber = (_: any, value: any) => { | |
757 | + const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; | |
758 | + const phoneRegex = /^\d{1,11}(-\d{1,11})?$/; | |
759 | + | |
760 | + if (emailRegex.test(value) || phoneRegex.test(value)) { | |
761 | + return Promise.resolve(); | |
762 | + } | |
763 | + return Promise.reject( | |
764 | + new Error('联系方式必须是邮箱或手机号格式(不能包含空格等特殊符号)'), | |
765 | + ); | |
766 | + }; | |
767 | + | |
768 | + /** | |
769 | + * 刪除草稿数据 | |
770 | + */ | |
771 | + function removeLocalFormData() { | |
772 | + localStorage.removeItem('preOrderData'); | |
773 | + } | |
774 | + | |
775 | + useEffect(() => { | |
776 | + checkHasLocalData(); | |
777 | + loadSalesCodeOptions(); | |
778 | + if (optType('after-sales-check')) { | |
779 | + getOldOrderData(data.id); | |
780 | + } else { | |
781 | + buildOrderData(); | |
782 | + } | |
783 | + }, []); | |
784 | + | |
785 | + return ( | |
786 | + <> | |
787 | + <DrawerForm<{ | |
788 | + isLocalData: any; | |
789 | + deleteSubOrderLists: any; | |
790 | + name: string; | |
791 | + company: string; | |
792 | + }> | |
793 | + open | |
794 | + width="35%" | |
795 | + title={drawerTitle} | |
796 | + resize={{ | |
797 | + onResize() { | |
798 | + console.log('resize!'); | |
799 | + }, | |
800 | + maxWidth: window.innerWidth * 0.8, | |
801 | + minWidth: 400, | |
802 | + }} | |
803 | + onFinishFailed={() => { | |
804 | + message.error('表单项存在错误,请检查'); | |
805 | + setSubmitBtnLoading(false); | |
806 | + }} | |
807 | + submitter={{ | |
808 | + render: (props) => { | |
809 | + return [ | |
810 | + <Button | |
811 | + key="cancel" | |
812 | + onClick={() => { | |
813 | + onClose(); | |
814 | + }} | |
815 | + > | |
816 | + 取消 | |
817 | + </Button>, | |
818 | + <Button | |
819 | + key="localSave" | |
820 | + loading={localSaveLoading} | |
821 | + hidden={!optType('add') && !optType('copy')} | |
822 | + onClick={() => { | |
823 | + setLocalSaveLoading(true); | |
824 | + saveFormDataToLocal(); | |
825 | + }} | |
826 | + > | |
827 | + 本地保存 | |
828 | + </Button>, | |
829 | + <Button | |
830 | + key="ok" | |
831 | + type="primary" | |
832 | + loading={submitBtnLoading} | |
833 | + disabled={optType('after-sales-check')} | |
834 | + onClick={() => { | |
835 | + setSubmitBtnLoading(true); | |
836 | + props.submit(); | |
837 | + }} | |
838 | + > | |
839 | + 提交 | |
840 | + </Button>, | |
841 | + ]; | |
842 | + }, | |
843 | + }} | |
844 | + form={form} | |
845 | + autoFocusFirstInput | |
846 | + drawerProps={{ | |
847 | + destroyOnClose: true, | |
848 | + maskClosable: false, | |
849 | + extra: [ | |
850 | + <Button | |
851 | + key="useLocalData" | |
852 | + hidden={!hasLocalData} | |
853 | + type="link" | |
854 | + onClick={() => { | |
855 | + useLocalFormData(); | |
856 | + }} | |
857 | + > | |
858 | + 使用草稿 | |
859 | + </Button>, | |
860 | + ], | |
861 | + }} | |
862 | + submitTimeout={2000} | |
863 | + onFinish={async (values) => { | |
864 | + let res = {}; | |
865 | + //附件处理 | |
866 | + let list = values.list; | |
867 | + // console.log(list); | |
868 | + list = list.map((item) => { | |
869 | + item.filePaths = item.filePaths?.map((file) => { | |
870 | + return { url: file.response.data[0] }; | |
871 | + }); | |
872 | + return item; | |
873 | + }); | |
874 | + | |
875 | + values.list = list; | |
876 | + values.institution = values.institution?.trim(); | |
877 | + values.institutionContactName = values.institutionContactName?.trim(); | |
878 | + values.customerName = values.customerNameString.trim(); | |
879 | + // values.customerShippingAddress = | |
880 | + // province + city + district + values.customerShippingAddress; | |
881 | + | |
882 | + if (typeof values.erpCustomerId !== 'string') { | |
883 | + values.erpCustomerId = values.erpCustomerId?.id; | |
884 | + } | |
885 | + values.province = province; | |
886 | + values.city = city; | |
887 | + values.district = district; | |
888 | + //新增 | |
889 | + if (optType('add') || optType('copy')) { | |
890 | + res = await postServiceOrderAddOrder({ data: values }); | |
891 | + } | |
892 | + //修改或者申请售后或者申请修改 | |
893 | + if ( | |
894 | + optType('edit') || | |
895 | + optType('after-sales') || | |
896 | + optType('order-change-normal') | |
897 | + ) { | |
898 | + //计算已删除的子订单id | |
899 | + | |
900 | + let originIds = []; | |
901 | + if (originSubOrders !== undefined && originSubOrders.length > 0) { | |
902 | + originIds = originSubOrders?.map((item) => { | |
903 | + return item.id; | |
904 | + }); | |
905 | + } | |
906 | + | |
907 | + const curIds = form.getFieldValue('list')?.map((item) => { | |
908 | + return item.id; | |
909 | + }); | |
910 | + let diff = originIds.filter((item) => !curIds.includes(item)); | |
911 | + values.deleteSubOrderLists = diff; | |
912 | + | |
913 | + if (optType('edit')) { | |
914 | + values.province = province; | |
915 | + values.city = city; | |
916 | + values.district = district; | |
917 | + res = await postServiceOrderUpdateOrder({ data: values }); | |
918 | + } | |
919 | + | |
920 | + values.applyType = orderOptType; | |
921 | + if (optType('after-sales')) { | |
922 | + values.filePaths = values.filePaths?.map((file) => { | |
923 | + return { url: file.response.data[0] }; | |
924 | + }); | |
925 | + res = await postServiceOrderApplyAfterSales({ data: values }); | |
926 | + } | |
927 | + | |
928 | + if (optType('order-change-normal')) { | |
929 | + values.filePaths = values.filePaths?.map((file) => { | |
930 | + return { url: file.response.data[0] }; | |
931 | + }); | |
932 | + res = await postServiceOrderApplyModify({ data: values }); | |
933 | + } | |
934 | + } | |
935 | + | |
936 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
937 | + message.success(res.message); | |
938 | + // 不返回不会关闭弹框 | |
939 | + onClose(true); | |
940 | + | |
941 | + //判断保存的数据是否是本地草稿,是的话将草稿删除 | |
942 | + let isLocalData = form.getFieldValue('isLocalData'); | |
943 | + if (isLocalData) { | |
944 | + removeLocalFormData(); | |
945 | + checkHasLocalData(); | |
946 | + } | |
947 | + | |
948 | + return true; | |
949 | + } | |
950 | + | |
951 | + setSubmitBtnLoading(false); | |
952 | + }} | |
953 | + onOpenChange={(val) => { | |
954 | + return !val && onClose(); | |
955 | + }} | |
956 | + > | |
957 | + {optType('after-sales') ? ( | |
958 | + <> | |
959 | + <h2>售后信息</h2> | |
960 | + <ProFormSelect | |
961 | + key="key" | |
962 | + label="售后方案" | |
963 | + width="lg" | |
964 | + showSearch | |
965 | + name="afterSalesPlan" | |
966 | + options={enumToSelect(AFTE_SALES_PLAN_OPTIONS)} | |
967 | + placeholder="请搜索" | |
968 | + rules={[{ required: true, message: '售后方案必填' }]} | |
969 | + ></ProFormSelect> | |
970 | + <ProFormTextArea | |
971 | + width="lg" | |
972 | + label="售后原因" | |
973 | + name="afterSalesNotes" | |
974 | + rules={[{ required: true, message: '售后原因必填' }]} | |
975 | + /> | |
976 | + <ProFormUploadDragger | |
977 | + key="filePaths" | |
978 | + label="售后附件" | |
979 | + name="filePaths" | |
980 | + action="/api/service/order/fileProcess" | |
981 | + fieldProps={{ | |
982 | + headers: { Authorization: localStorage.getItem('token') }, | |
983 | + }} | |
984 | + /> | |
985 | + </> | |
986 | + ) : ( | |
987 | + '' | |
988 | + )} | |
989 | + | |
990 | + <h2>订单基本信息</h2> | |
991 | + <ProFormText | |
992 | + key="id" | |
993 | + name="id" | |
994 | + width="lg" | |
995 | + disabled | |
996 | + label="id" | |
997 | + placeholder="id" | |
998 | + hidden | |
999 | + /> | |
1000 | + <ProFormText | |
1001 | + key="empNumber" | |
1002 | + name="empNumber" | |
1003 | + width="lg" | |
1004 | + label="销售职员编码" | |
1005 | + placeholder="销售职员编码" | |
1006 | + hidden | |
1007 | + /> | |
1008 | + <ProFormSelect | |
1009 | + name="salesCode" | |
1010 | + key="salesCode" | |
1011 | + width="lg" | |
1012 | + showSearch | |
1013 | + label="销售代表" | |
1014 | + placeholder="请输入销售代表" | |
1015 | + rules={[{ required: true, message: '销售代表必填' }]} | |
1016 | + options={salesCodeOptions} | |
1017 | + onChange={(_, option) => { | |
1018 | + autoFillSalesInfo(option); | |
1019 | + }} | |
1020 | + disabled={optType('after-sales-check')} | |
1021 | + /> | |
1022 | + <ProFormText | |
1023 | + key="erpCustomerName" | |
1024 | + name="erpCustomerName" | |
1025 | + hidden | |
1026 | + ></ProFormText> | |
1027 | + <ProFormText | |
1028 | + key="customerNameString" | |
1029 | + name="customerNameString" | |
1030 | + hidden | |
1031 | + ></ProFormText> | |
1032 | + | |
1033 | + <ProFormText | |
1034 | + key="contactAddress" | |
1035 | + name="contactAddress" | |
1036 | + hidden | |
1037 | + ></ProFormText> | |
1038 | + <ProFormSelect | |
1039 | + key="customerName" | |
1040 | + label="收货人" | |
1041 | + width="lg" | |
1042 | + showSearch | |
1043 | + name="customerName" | |
1044 | + placeholder="请选择收货人" | |
1045 | + rules={[{ required: true, message: '收货人必填' }]} | |
1046 | + onChange={(_, option) => { | |
1047 | + autoFillCustomerInfo(option); | |
1048 | + }} | |
1049 | + fieldProps={{ | |
1050 | + filterOption() { | |
1051 | + return true; | |
1052 | + }, | |
1053 | + optionItemRender(item: any) { | |
1054 | + if (item.type === 'add') { | |
1055 | + return ( | |
1056 | + <div title={item.name + '(新增客户)'}> | |
1057 | + <span style={{ color: '#333333' }}>{item.name}</span> | |
1058 | + {' | '} | |
1059 | + <span style={{ color: 'orange' }}>自定义</span> | |
1060 | + </div> | |
1061 | + ); | |
1062 | + } | |
1063 | + | |
1064 | + let title = ''; | |
1065 | + let realName = item.realName; | |
1066 | + let phone = item.phone; | |
1067 | + let province = item.province; | |
1068 | + let city = item.city; | |
1069 | + let district = item.district; | |
1070 | + let detail = item.detail; | |
1071 | + let institution = item.institution; | |
1072 | + let institutionContactName = item.institutionContactName; | |
1073 | + | |
1074 | + let address = | |
1075 | + getDefaultString(province) + | |
1076 | + getDefaultString(city) + | |
1077 | + getDefaultString(district) + | |
1078 | + getDefaultString(detail); | |
1079 | + | |
1080 | + title = | |
1081 | + getDefaultString(realName) + | |
1082 | + '|' + | |
1083 | + getDefaultString(phone) + | |
1084 | + '|' + | |
1085 | + getDefaultString(institution) + | |
1086 | + '|' + | |
1087 | + getDefaultString(institutionContactName) + | |
1088 | + '|' + | |
1089 | + address; | |
1090 | + | |
1091 | + return ( | |
1092 | + <div title={title} className="whitespace-normal"> | |
1093 | + <span style={{ color: '#333333' }}> | |
1094 | + {getDefaultString(realName)} | |
1095 | + </span> | |
1096 | + | | |
1097 | + <span className="text-sky-600"> | |
1098 | + {getDefaultString(phone)} | |
1099 | + </span> | |
1100 | + | | |
1101 | + <span style={{ color: '#333333' }}> | |
1102 | + {getDefaultString(institution)} | |
1103 | + </span> | |
1104 | + | | |
1105 | + <span style={{ color: '#333333' }}> | |
1106 | + {getDefaultString(institutionContactName)} | |
1107 | + </span> | |
1108 | + |<span className="text-orange-400">{address}</span> | |
1109 | + </div> | |
1110 | + ); | |
1111 | + }, | |
1112 | + }} | |
1113 | + debounceTime={1000} | |
1114 | + request={async (value, {}) => { | |
1115 | + const keywords = value.keyWords; | |
1116 | + if (keywords === '') { | |
1117 | + return []; | |
1118 | + } | |
1119 | + const res = await postCanrdApiUserAddressList({ | |
1120 | + data: { keywords: keywords }, | |
1121 | + }); | |
1122 | + let options = res?.data?.map((c: any) => { | |
1123 | + return { | |
1124 | + ...c, | |
1125 | + label: c.name, | |
1126 | + value: c.id, | |
1127 | + key: c.id, | |
1128 | + }; | |
1129 | + }); | |
1130 | + console.log(form.getFieldValue('customerShippingAddress')); | |
1131 | + console.log(form.getFieldValue('id')); | |
1132 | + if (form.getFieldValue('id') !== undefined) { | |
1133 | + const resp = await postDistrictSelOrderProvince({ | |
1134 | + data: form.getFieldValue('id'), | |
1135 | + }); | |
1136 | + if (resp && resp.data) { | |
1137 | + if (resp.data.province) { | |
1138 | + setProvince(resp.data.province); | |
1139 | + form.setFieldValue('province', resp.data.province); | |
1140 | + } | |
1141 | + if (resp.data.city) { | |
1142 | + setCity(resp.data.city); | |
1143 | + form.setFieldValue('city', resp.data.city); | |
1144 | + } | |
1145 | + if (resp.data.district) { | |
1146 | + setDistrict(resp.data.district); | |
1147 | + form.setFieldValue('district', resp.data.district); | |
1148 | + } | |
1149 | + } | |
1150 | + console.log(form.getFieldsValue()); | |
1151 | + } | |
1152 | + //判断如果是在修改或者复制,那么第一次请求的时候,默认生成当前收货人信息的option | |
1153 | + | |
1154 | + let realName = form.getFieldValue('customerName'); | |
1155 | + let detail = form.getFieldValue('customerShippingAddress'); | |
1156 | + let institution = form.getFieldValue('institution'); | |
1157 | + let institutionContactName = form.getFieldValue( | |
1158 | + 'institutionContactNam', | |
1159 | + ); | |
1160 | + if (customerRequestCount === 0) { | |
1161 | + setCustomerRequestCount(1); | |
1162 | + options.push({ | |
1163 | + label: realName, | |
1164 | + value: realName, | |
1165 | + key: realName, | |
1166 | + realName: realName, | |
1167 | + detail: detail, | |
1168 | + institution: institution, | |
1169 | + institutionContactName: institutionContactName, | |
1170 | + }); | |
1171 | + } | |
1172 | + //第一个商品默认为要新增客户 | |
1173 | + if (keywords.trim() !== '') { | |
1174 | + options.unshift({ | |
1175 | + name: keywords, | |
1176 | + type: 'add', | |
1177 | + label: keywords, | |
1178 | + value: 3.1415926, | |
1179 | + key: keywords, | |
1180 | + }); | |
1181 | + } | |
1182 | + | |
1183 | + return options; | |
1184 | + }} | |
1185 | + /> | |
1186 | + | |
1187 | + <ProFormText | |
1188 | + width="lg" | |
1189 | + key="customerContactNumber" | |
1190 | + name="customerContactNumber" | |
1191 | + label="联系方式" | |
1192 | + placeholder="请输入联系方式" | |
1193 | + fieldProps={{ | |
1194 | + onBlur: (v) => { | |
1195 | + loadAccountOptions(v.target.value); | |
1196 | + }, | |
1197 | + }} | |
1198 | + rules={[ | |
1199 | + { required: true, message: '联系方式必填' }, | |
1200 | + { validator: validateContactNumber }, | |
1201 | + ]} | |
1202 | + /> | |
1203 | + <ProFormText | |
1204 | + width="lg" | |
1205 | + key="institution" | |
1206 | + name="institution" | |
1207 | + label="单位" | |
1208 | + placeholder="请输入单位" | |
1209 | + rules={[{ required: true, message: '单位必填' }]} | |
1210 | + /> | |
1211 | + {/*<ProFormText | |
1212 | + width="lg" | |
1213 | + key="institutionContactName" | |
1214 | + name="institutionContactName" | |
1215 | + label="课题组" | |
1216 | + placeholder="请输入课题组" | |
1217 | + rules={[{ required: true, message: '课题组必填' }]} | |
1218 | + />*/} | |
1219 | + <ProFormSelect | |
1220 | + key={'institutionContactName'} | |
1221 | + width="md" | |
1222 | + showSearch | |
1223 | + name="institutionContactName" | |
1224 | + rules={[{ required: true, message: '请输入课题组名称!' }]} | |
1225 | + request={async (value) => { | |
1226 | + const keywords = value.keyWords; | |
1227 | + const res = await postResearchGroupsNameSet({ | |
1228 | + data: { | |
1229 | + status: 'ADD_AUDIT_PASS', | |
1230 | + groupName: keywords, | |
1231 | + }, | |
1232 | + }); | |
1233 | + let options = res?.data?.map((c: any) => { | |
1234 | + return { | |
1235 | + label: c, | |
1236 | + value: c, | |
1237 | + key: c, | |
1238 | + }; | |
1239 | + }); | |
1240 | + return options; | |
1241 | + }} | |
1242 | + fieldProps={{ | |
1243 | + filterOption() { | |
1244 | + return true; | |
1245 | + }, | |
1246 | + }} | |
1247 | + debounceTime={1000} | |
1248 | + label="课题组名称" | |
1249 | + placeholder="请输入名称" | |
1250 | + /> | |
1251 | + <div | |
1252 | + style={{ | |
1253 | + display: 'flex', | |
1254 | + justifyContent: 'space-between', | |
1255 | + width: 340, | |
1256 | + }} | |
1257 | + > | |
1258 | + <ProFormSelect | |
1259 | + name="province" | |
1260 | + key="province" | |
1261 | + width={100} | |
1262 | + label="省" | |
1263 | + allowClear={false} | |
1264 | + fieldProps={{ | |
1265 | + labelInValue: true, | |
1266 | + }} | |
1267 | + onChange={(value) => { | |
1268 | + console.log(value); | |
1269 | + | |
1270 | + if (value !== undefined || value !== null) { | |
1271 | + console.log('setProvince'); | |
1272 | + | |
1273 | + setProvince(value?.value); | |
1274 | + } | |
1275 | + }} | |
1276 | + placeholder="请选择" | |
1277 | + rules={[ | |
1278 | + { | |
1279 | + required: true, | |
1280 | + message: '请选择!', | |
1281 | + }, | |
1282 | + ]} | |
1283 | + request={async () => { | |
1284 | + let province = []; | |
1285 | + let res = await postDistrictSelectByLevel({ data: 1 }); | |
1286 | + if (res) { | |
1287 | + res.data.forEach((item) => { | |
1288 | + province.push({ value: item.district, label: item.district }); | |
1289 | + }); | |
1290 | + } | |
1291 | + return province; | |
1292 | + }} | |
1293 | + /> | |
1294 | + <ProFormSelect | |
1295 | + key={province} | |
1296 | + name="city" | |
1297 | + width={100} | |
1298 | + label="市" | |
1299 | + allowClear={false} | |
1300 | + disabled={province === ''} | |
1301 | + fieldProps={{ | |
1302 | + labelInValue: true, | |
1303 | + }} | |
1304 | + placeholder="请选择" | |
1305 | + onChange={(value) => { | |
1306 | + if (value !== undefined || value !== null) { | |
1307 | + setCity(value?.value); | |
1308 | + } | |
1309 | + }} | |
1310 | + rules={[ | |
1311 | + { | |
1312 | + required: true, | |
1313 | + message: '请选择!', | |
1314 | + }, | |
1315 | + ]} | |
1316 | + request={async () => { | |
1317 | + let cityOptions = []; | |
1318 | + console.log(form.getFieldValue('id')); | |
1319 | + if (form.getFieldValue('id')) { | |
1320 | + const resp = await postDistrictSelOrderProvince({ | |
1321 | + data: form.getFieldValue('id'), | |
1322 | + }); | |
1323 | + if ( | |
1324 | + resp.data.province !== null && | |
1325 | + resp.data.province !== undefined | |
1326 | + ) { | |
1327 | + console.log('province is ok'); | |
1328 | + let res = await postDistrictSelectByNameAndLevel({ | |
1329 | + data: { district: resp.data.province, level: 1 }, | |
1330 | + }); | |
1331 | + if (res && res.data) { | |
1332 | + cityOptions = res.data.map((item) => ({ | |
1333 | + value: item.district, | |
1334 | + label: item.district, | |
1335 | + })); | |
1336 | + } | |
1337 | + } | |
1338 | + } | |
1339 | + if (province !== '') { | |
1340 | + console.log(province); | |
1341 | + console.log('province is okk'); | |
1342 | + let res = await postDistrictSelectByNameAndLevel({ | |
1343 | + data: { district: province, level: 1 }, | |
1344 | + }); | |
1345 | + if (res && res.data) { | |
1346 | + cityOptions = res.data.map((item) => ({ | |
1347 | + value: item.district, | |
1348 | + label: item.district, | |
1349 | + })); | |
1350 | + } | |
1351 | + } | |
1352 | + return cityOptions; | |
1353 | + }} | |
1354 | + /> | |
1355 | + <ProFormSelect | |
1356 | + key={city ? city.toString() : 'district'} | |
1357 | + name="district" | |
1358 | + width={100} | |
1359 | + label="区" | |
1360 | + allowClear={false} | |
1361 | + onChange={(value) => { | |
1362 | + if (value !== undefined || value !== null) { | |
1363 | + setDistrict(value?.value); | |
1364 | + } | |
1365 | + }} | |
1366 | + disabled={city === ''} | |
1367 | + fieldProps={{ | |
1368 | + labelInValue: true, | |
1369 | + }} | |
1370 | + placeholder="请选择" | |
1371 | + rules={[ | |
1372 | + { | |
1373 | + required: true, | |
1374 | + message: '请选择!', | |
1375 | + }, | |
1376 | + ]} | |
1377 | + request={async () => { | |
1378 | + let districtOptions = []; | |
1379 | + if (form.getFieldValue('id')) { | |
1380 | + const resp = await postDistrictSelOrderProvince({ | |
1381 | + data: form.getFieldValue('id'), | |
1382 | + }); | |
1383 | + if (resp.data.city !== null && resp.data.city !== undefined) { | |
1384 | + let res = await postDistrictSelectByNameAndLevel({ | |
1385 | + data: { district: resp.data.city, level: 2 }, | |
1386 | + }); | |
1387 | + if (res && res.data) { | |
1388 | + districtOptions = res.data.map((item) => ({ | |
1389 | + value: item.district, | |
1390 | + label: item.district, | |
1391 | + })); | |
1392 | + } | |
1393 | + } | |
1394 | + } | |
1395 | + if (city !== '') { | |
1396 | + let res = await postDistrictSelectByNameAndLevel({ | |
1397 | + data: { district: city, level: 2 }, | |
1398 | + }); | |
1399 | + if (res && res.data) { | |
1400 | + districtOptions = res.data.map((item) => ({ | |
1401 | + value: item.district, | |
1402 | + label: item.district, | |
1403 | + })); | |
1404 | + } | |
1405 | + } | |
1406 | + return districtOptions; | |
1407 | + }} | |
1408 | + /> | |
1409 | + </div> | |
1410 | + <ProFormTextArea | |
1411 | + width="lg" | |
1412 | + key="customerShippingAddress" | |
1413 | + name="customerShippingAddress" | |
1414 | + label="收货地址" | |
1415 | + placeholder="请输入收货地址" | |
1416 | + rules={[{ required: true, message: '收货地址必填' }]} | |
1417 | + /> | |
1418 | + <div id="total-payment"> | |
1419 | + <ProFormDigit | |
1420 | + name="totalPayment" | |
1421 | + width="lg" | |
1422 | + key="totalPayment" | |
1423 | + label="支付总额(¥)" | |
1424 | + rules={[ | |
1425 | + { required: true, message: '支付总额必填' }, | |
1426 | + { | |
1427 | + validator: (_, value) => { | |
1428 | + let paymentMethod = form.getFieldValue('paymentMethod'); | |
1429 | + if ( | |
1430 | + value <= 0 && | |
1431 | + paymentMethod && | |
1432 | + paymentMethod === 'WITHHOLDING_ADVANCE_DEPOSIT' | |
1433 | + ) { | |
1434 | + return Promise.reject( | |
1435 | + new Error( | |
1436 | + '支付总额必须大于0 (扣预存的订单现在也必须填写实际金额)', | |
1437 | + ), | |
1438 | + ); | |
1439 | + } | |
1440 | + return Promise.resolve(); | |
1441 | + }, | |
1442 | + }, | |
1443 | + ]} | |
1444 | + tooltip="点击计算,合计所有子订单金额" | |
1445 | + fieldProps={{ | |
1446 | + addonAfter: ( | |
1447 | + <Button | |
1448 | + className="rounded-l-none" | |
1449 | + type="primary" | |
1450 | + disabled={optType('after-sales-check')} | |
1451 | + onClick={computeTotalPayment} | |
1452 | + > | |
1453 | + 计算 | |
1454 | + </Button> | |
1455 | + ), | |
1456 | + onChange: (value: any) => { | |
1457 | + totalPaymentChange(value); | |
1458 | + }, | |
1459 | + }} | |
1460 | + disabled={optType('after-sales-check')} | |
1461 | + /> | |
1462 | + </div> | |
1463 | + | |
1464 | + <ProFormSelect | |
1465 | + placeholder="请输入支付渠道" | |
1466 | + name="paymentChannel" | |
1467 | + width="lg" | |
1468 | + key="paymentChannel" | |
1469 | + label="支付渠道" | |
1470 | + options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)} | |
1471 | + rules={[{ required: true, message: '支付渠道必填' }]} | |
1472 | + disabled={optType('after-sales-check')} | |
1473 | + /> | |
1474 | + <ProFormSelect | |
1475 | + placeholder="请输入支付方式" | |
1476 | + name="paymentMethod" | |
1477 | + width="lg" | |
1478 | + key="paymentMethod" | |
1479 | + label="支付方式" | |
1480 | + onChange={(val: any) => { | |
1481 | + setPaymentMethod(val); | |
1482 | + }} | |
1483 | + options={enumToSelect(PAYMENT_METHOD_OPTIONS)} | |
1484 | + rules={[{ required: true, message: '支付方式必填' }]} | |
1485 | + disabled={optType('after-sales-check')} | |
1486 | + /> | |
1487 | + <ProFormSelect | |
1488 | + name="prepaidUid" | |
1489 | + key="prepaidUid" | |
1490 | + width="lg" | |
1491 | + hidden={paymentMethod !== 'WITHHOLDING_ADVANCE_DEPOSIT'} | |
1492 | + showSearch | |
1493 | + label="预存账号" | |
1494 | + onChange={(value: any) => { | |
1495 | + //检查用户额度 | |
1496 | + let valid = checkAccountMoney( | |
1497 | + value, | |
1498 | + form.getFieldValue('totalPayment'), | |
1499 | + ); | |
1500 | + if (!valid) { | |
1501 | + form.setFieldValue('prepaidUid', undefined); | |
1502 | + } | |
1503 | + }} | |
1504 | + placeholder="请选择预存账号" | |
1505 | + rules={[ | |
1506 | + { | |
1507 | + required: paymentMethod === 'WITHHOLDING_ADVANCE_DEPOSIT', | |
1508 | + message: '支付方式为扣预存时,预存账号必填', | |
1509 | + }, | |
1510 | + ]} | |
1511 | + fieldProps={{ | |
1512 | + filterOption() { | |
1513 | + return true; | |
1514 | + }, | |
1515 | + optionItemRender(item) { | |
1516 | + let name = | |
1517 | + item.label + | |
1518 | + ' | ' + | |
1519 | + item.institution + | |
1520 | + ' | ' + | |
1521 | + item.nowMoney + | |
1522 | + '¥' + | |
1523 | + ' | ' + | |
1524 | + item.phone; | |
1525 | + return ( | |
1526 | + <div title={name}> | |
1527 | + <span style={{ color: '#333333' }}>{name}</span> | |
1528 | + </div> | |
1529 | + ); | |
1530 | + }, | |
1531 | + }} | |
1532 | + debounceTime={1000} | |
1533 | + // request={async (value, {}) => { | |
1534 | + // const keywords = value.keyWords; | |
1535 | + // const res = await postCanrdApiUserList({ | |
1536 | + // data: { keywords: keywords, pageSize: 50 }, | |
1537 | + // }); | |
1538 | + // let options = res?.data?.data?.map((c: any) => { | |
1539 | + // return { | |
1540 | + // ...c, | |
1541 | + // label: c.realName, | |
1542 | + // value: c.uid, | |
1543 | + // key: c.uid, | |
1544 | + // }; | |
1545 | + // }); | |
1546 | + // return options; | |
1547 | + // }} | |
1548 | + options={accountOptions} | |
1549 | + /> | |
1550 | + <ProFormSelect | |
1551 | + placeholder="选择是否需要开票" | |
1552 | + name="invoicingStatus" | |
1553 | + width="lg" | |
1554 | + key="invoicingStatus" | |
1555 | + label="是否需要开票" | |
1556 | + options={getInvoicingSelect()} | |
1557 | + disabled={optType('after-sales-check')} | |
1558 | + onChange={(_, option) => { | |
1559 | + setInvoicingStatus(option.value); | |
1560 | + if (option.value === 'UN_INVOICE') { | |
1561 | + form.setFieldValue('invoiceIdentificationNumber', undefined); | |
1562 | + form.setFieldValue('bank', undefined); | |
1563 | + form.setFieldValue('bankAccountNumber', undefined); | |
1564 | + form.setFieldValue('invoiceFirst', false); | |
1565 | + } | |
1566 | + }} | |
1567 | + rules={[{ required: true, message: '是否需要开票必填' }]} | |
1568 | + /> | |
1569 | + <ProFormSelect | |
1570 | + placeholder="是否开票后发货" | |
1571 | + name="invoiceFirst" | |
1572 | + width="lg" | |
1573 | + key="invoiceFirst" | |
1574 | + label="是否开票后发货" | |
1575 | + disabled={optType('after-sales-check')} | |
1576 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
1577 | + options={[ | |
1578 | + { | |
1579 | + value: true, | |
1580 | + label: '是', | |
1581 | + }, | |
1582 | + { | |
1583 | + value: false, | |
1584 | + label: '否', | |
1585 | + }, | |
1586 | + ]} | |
1587 | + /> | |
1588 | + | |
1589 | + <ProFormSelect | |
1590 | + placeholder="收款单位" | |
1591 | + name="receivingCompany" | |
1592 | + width="lg" | |
1593 | + key="receivingCompany" | |
1594 | + showSearch | |
1595 | + label="开票收款单位" | |
1596 | + tooltip="财务开票将依据这个字段,选择对应的公司开票" | |
1597 | + options={enumToSelect(PAYEE_OPTIONS)} | |
1598 | + disabled={optType('after-sales-check')} | |
1599 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
1600 | + /> | |
1601 | + | |
1602 | + <ProFormTextArea | |
1603 | + width="lg" | |
1604 | + name="invoiceIdentificationNumber" | |
1605 | + label="开票信息" | |
1606 | + key="invoiceIdentificationNumber" | |
1607 | + disabled={optType('after-sales-check')} | |
1608 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
1609 | + placeholder="请输入开票信息" | |
1610 | + rules={[ | |
1611 | + { | |
1612 | + required: invoicingStatus === 'UN_INVOICE' ? false : true, | |
1613 | + message: '开票信息必填', | |
1614 | + }, | |
1615 | + ]} | |
1616 | + /> | |
1617 | + | |
1618 | + {getUserInfo().roleSmallVO?.code === 'admin' ? ( | |
1619 | + <ProFormDateTimePicker | |
1620 | + width="lg" | |
1621 | + key="invoicingTime" | |
1622 | + name="invoicingTime" | |
1623 | + disabled={optType('after-sales-check')} | |
1624 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
1625 | + label="开票时间" | |
1626 | + placeholder="请输入开票时间" | |
1627 | + /> | |
1628 | + ) : ( | |
1629 | + '' | |
1630 | + )} | |
1631 | + <ProFormText | |
1632 | + width="lg" | |
1633 | + name="bank" | |
1634 | + key="bank" | |
1635 | + label="开户银行" | |
1636 | + disabled={optType('after-sales-check')} | |
1637 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
1638 | + placeholder="请输入开户银行" | |
1639 | + /> | |
1640 | + <ProFormText | |
1641 | + width="lg" | |
1642 | + key="bankAccountNumber" | |
1643 | + name="bankAccountNumber" | |
1644 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
1645 | + label="银行账号" | |
1646 | + disabled={optType('after-sales-check')} | |
1647 | + placeholder="请输入银行账号" | |
1648 | + /> | |
1649 | + <ProFormTextArea | |
1650 | + width="lg" | |
1651 | + name="notes" | |
1652 | + label="备注" | |
1653 | + key="notes" | |
1654 | + disabled={optType('after-sales-check')} | |
1655 | + placeholder="请输入备注" | |
1656 | + rules={[ | |
1657 | + { | |
1658 | + max: 1000, // 最大长度为1000个字符 | |
1659 | + message: '备注不能超过1000个字符', | |
1660 | + }, | |
1661 | + { | |
1662 | + validator: (rule, value) => { | |
1663 | + let totalPayment = form.getFieldValue('totalPayment'); | |
1664 | + let list = form.getFieldValue('list'); | |
1665 | + let reduce = list.reduce( | |
1666 | + (sum, item) => FloatAdd(sum, item.subOrderPayment), | |
1667 | + 0, | |
1668 | + ); | |
1669 | + if (reduce === totalPayment || value) { | |
1670 | + return Promise.resolve(); | |
1671 | + } | |
1672 | + return Promise.reject(new Error('请填写订单金额不一致的原因')); | |
1673 | + }, | |
1674 | + }, | |
1675 | + ]} | |
1676 | + /> | |
1677 | + | |
1678 | + <h2>商品信息</h2> | |
1679 | + <ProFormList | |
1680 | + creatorButtonProps={{ disabled: optType('after-sales-check') }} | |
1681 | + deleteIconProps={!optType('after-sales-check')} | |
1682 | + name="list" | |
1683 | + label="" | |
1684 | + copyIconProps={false} //复制按钮不显示 | |
1685 | + initialValue={[ | |
1686 | + { | |
1687 | + productCode: '', | |
1688 | + productName: '', | |
1689 | + quantity: '', | |
1690 | + productPrice: '', | |
1691 | + parameters: '', | |
1692 | + subOrderPayment: '', | |
1693 | + }, | |
1694 | + ]} | |
1695 | + actionGuard={{ | |
1696 | + beforeRemoveRow: async () => { | |
1697 | + return new Promise((resolve) => { | |
1698 | + let list = form.getFieldValue('list'); | |
1699 | + if (list && list.length === 1) { | |
1700 | + message.error('至少需要保留一个商品'); | |
1701 | + resolve(false); | |
1702 | + return; | |
1703 | + } | |
1704 | + resolve(true); | |
1705 | + }); | |
1706 | + }, | |
1707 | + }} | |
1708 | + itemRender={(doms, listMeta) => { | |
1709 | + if (optType('edit')) { | |
1710 | + let i = 0; | |
1711 | + let defaultFileList = listMeta.record?.listAnnex?.map((annex) => { | |
1712 | + return { | |
1713 | + uid: i++, | |
1714 | + name: annex, | |
1715 | + status: 'uploaded', | |
1716 | + url: annex, | |
1717 | + response: { data: [annex] }, | |
1718 | + }; | |
1719 | + }); | |
1720 | + fileList[listMeta.index] = defaultFileList; | |
1721 | + } | |
1722 | + let itemFileList = fileList[listMeta.index]; | |
1723 | + return ( | |
1724 | + <ProCard | |
1725 | + bordered | |
1726 | + extra={doms.action} | |
1727 | + title={'商品' + (listMeta.index + 1)} | |
1728 | + style={{ | |
1729 | + marginBlockEnd: 8, | |
1730 | + }} | |
1731 | + > | |
1732 | + {[ | |
1733 | + <ProFormText | |
1734 | + key={'material' + listMeta.index} | |
1735 | + name="materialId" | |
1736 | + hidden | |
1737 | + ></ProFormText>, | |
1738 | + <ProFormSelect | |
1739 | + key="key" | |
1740 | + label="商品名称" | |
1741 | + width="lg" | |
1742 | + showSearch | |
1743 | + name="productName" | |
1744 | + disabled={optType('after-sales-check')} | |
1745 | + placeholder="请搜索商品" | |
1746 | + tooltip="空格将作为或条件。例如输入[极片 电池],那么查找出来的将是包含[极片]或者包含[电池]的搜索结果" | |
1747 | + rules={[{ required: true, message: '商品名称必填' }]} | |
1748 | + onChange={(_, option) => { | |
1749 | + autoFillProductInfo(option, listMeta, listMeta.index); | |
1750 | + }} | |
1751 | + initialValue={{ | |
1752 | + label: listMeta?.record?.productName, | |
1753 | + value: listMeta?.record?.materialId, | |
1754 | + }} | |
1755 | + fieldProps={{ | |
1756 | + filterOption() { | |
1757 | + return true; | |
1758 | + }, | |
1759 | + optionItemRender(item) { | |
1760 | + if (item.type === 'add') { | |
1761 | + return ( | |
1762 | + <div title={item.name + '(新增商品信息)'}> | |
1763 | + <span style={{ color: '#333333' }}> | |
1764 | + {item.label} | |
1765 | + </span> | |
1766 | + {' | '} | |
1767 | + <span style={{ color: 'orange' }}>新增商品</span> | |
1768 | + </div> | |
1769 | + ); | |
1770 | + } | |
1771 | + return ( | |
1772 | + <div | |
1773 | + title={ | |
1774 | + item.label + | |
1775 | + ' | ' + | |
1776 | + (item.model === undefined | |
1777 | + ? '无参数' | |
1778 | + : item.model) + | |
1779 | + ' | ' + | |
1780 | + item.base_unit_name | |
1781 | + } | |
1782 | + > | |
1783 | + <span style={{ color: '#333333' }}> | |
1784 | + {item.label} | |
1785 | + </span> | |
1786 | + {' | '} | |
1787 | + <span style={{ color: '#339999' }}> | |
1788 | + {item.model === undefined ? '无参数' : item.model} | |
1789 | + </span> | |
1790 | + {' | '} | |
1791 | + <span style={{ color: '#666666' }}> | |
1792 | + {item.base_unit_name === undefined | |
1793 | + ? '无单位' | |
1794 | + : item.base_unit_name} | |
1795 | + </span> | |
1796 | + </div> | |
1797 | + ); | |
1798 | + }, | |
1799 | + }} | |
1800 | + debounceTime={1000} | |
1801 | + request={async (value) => { | |
1802 | + const keywords = value.keyWords; | |
1803 | + const res = await postKingdeeRepMaterial({ | |
1804 | + data: { search: keywords }, | |
1805 | + }); | |
1806 | + console.log(res.customerShippingAddress); | |
1807 | + | |
1808 | + let options = res?.rows?.map((p: any) => { | |
1809 | + return { | |
1810 | + ...p, | |
1811 | + label: p.name, | |
1812 | + value: p.id + '|' + p.name, | |
1813 | + key: p.id, | |
1814 | + }; | |
1815 | + }); | |
1816 | + | |
1817 | + //第一个商品默认为要新增的商品 | |
1818 | + if (keywords.trim() !== '') { | |
1819 | + options.unshift({ | |
1820 | + productName: keywords, | |
1821 | + type: 'add', | |
1822 | + label: keywords, | |
1823 | + value: 13 + '|' + keywords, | |
1824 | + key: keywords, | |
1825 | + }); | |
1826 | + } | |
1827 | + return options; | |
1828 | + }} | |
1829 | + />, | |
1830 | + <ProFormText | |
1831 | + key="orderStatus" | |
1832 | + name="orderStatus" | |
1833 | + width="lg" | |
1834 | + disabled | |
1835 | + label="orderStatus" | |
1836 | + placeholder="orderStatus" | |
1837 | + hidden | |
1838 | + />, | |
1839 | + <ProFormText | |
1840 | + key={'productCode' + listMeta.index} | |
1841 | + width="lg" | |
1842 | + name="productCode" | |
1843 | + disabled | |
1844 | + label={ | |
1845 | + <> | |
1846 | + <span>商品编码</span> | |
1847 | + <span className="pl-2 text-xs text-gray-400"> | |
1848 | + 新增商品时,商品编码由系统自动生成 | |
1849 | + </span> | |
1850 | + </> | |
1851 | + } | |
1852 | + placeholder="未输入商品名称" | |
1853 | + />, | |
1854 | + // <ProFormSelect | |
1855 | + // key="inv_stock" | |
1856 | + // placeholder="请选择仓库" | |
1857 | + // name="invStockId" | |
1858 | + // width="lg" | |
1859 | + // label="仓库" | |
1860 | + // options={productInvStockOptionsList[listMeta.index]} | |
1861 | + // />, | |
1862 | + <ProFormText | |
1863 | + key={'parameters' + listMeta.index} | |
1864 | + width="lg" | |
1865 | + name="parameters" | |
1866 | + label="商品参数" | |
1867 | + placeholder="请输入商品参数" | |
1868 | + disabled={ | |
1869 | + productParametersDisabledFlagList[listMeta.index] !== | |
1870 | + false || optType('after-sales-check') | |
1871 | + } | |
1872 | + />, | |
1873 | + <ProFormDigit | |
1874 | + key={'quantity' + listMeta.index} | |
1875 | + width="lg" | |
1876 | + name="quantity" | |
1877 | + label="商品数量" | |
1878 | + fieldProps={{ | |
1879 | + onChange: (value) => { | |
1880 | + // 确保变更后的值为整数 | |
1881 | + const intValue = parseInt(value, 10); | |
1882 | + if (!isNaN(intValue)) { | |
1883 | + listMeta.record.quantity = intValue; | |
1884 | + computeSubOrderPayment(listMeta); | |
1885 | + } | |
1886 | + }, | |
1887 | + parser: (value) => { | |
1888 | + // 将输入的值转换为整数,如果不是合法数字则返回空字符串触发校验错误 | |
1889 | + return value ? parseInt(value, 10) : ''; | |
1890 | + }, | |
1891 | + formatter: (value) => { | |
1892 | + // 在显示时始终将其格式化为不带小数部分的整数字符串 | |
1893 | + return value ? value.toString() : ''; | |
1894 | + }, | |
1895 | + }} | |
1896 | + placeholder="请输入商品数量" | |
1897 | + disabled={optType('after-sales-check')} | |
1898 | + rules={[{ required: true, message: '商品数量必填' }]} | |
1899 | + />, | |
1900 | + <ProFormDigit | |
1901 | + key={'productPrice' + listMeta.index} | |
1902 | + width="lg" | |
1903 | + name="productPrice" | |
1904 | + label="商品单价" | |
1905 | + fieldProps={{ | |
1906 | + onChange: (value) => { | |
1907 | + listMeta.record.productPrice = value; | |
1908 | + computeSubOrderPayment(listMeta); | |
1909 | + }, | |
1910 | + }} | |
1911 | + placeholder="请输入商品单价" | |
1912 | + disabled={optType('after-sales-check')} | |
1913 | + rules={[{ required: true, message: '商品单价必填' }]} | |
1914 | + />, | |
1915 | + <ProFormText | |
1916 | + key={'unit' + listMeta.index} | |
1917 | + width="lg" | |
1918 | + name="unit" | |
1919 | + label="商品单位" | |
1920 | + placeholder="请输入商品单位" | |
1921 | + disabled={ | |
1922 | + productParametersDisabledFlagList[listMeta.index] !== | |
1923 | + false || optType('after-sales-check') | |
1924 | + } | |
1925 | + rules={[{ required: true, message: '商品单位必填' }]} | |
1926 | + />, | |
1927 | + | |
1928 | + <ProFormDigit | |
1929 | + width="lg" | |
1930 | + key={'subOrderPayment' + listMeta.index} | |
1931 | + name="subOrderPayment" | |
1932 | + label="子订单金额" | |
1933 | + placeholder="请输入子订单金额" | |
1934 | + tooltip="商品数量和单价变化后会自动计算子订单金额" | |
1935 | + disabled={optType('after-sales-check')} | |
1936 | + rules={[{ required: true, message: '子订单金额必填' }]} | |
1937 | + />, | |
1938 | + <ProFormSelect | |
1939 | + key={'productBelongBusiness' + listMeta.index} | |
1940 | + placeholder="请输入所属事业部" | |
1941 | + name="productBelongBusiness" | |
1942 | + width="lg" | |
1943 | + label="所属事业部" | |
1944 | + options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)} | |
1945 | + onChange={(val: any) => { | |
1946 | + productBelongBusinessChange(val, listMeta.index); | |
1947 | + }} | |
1948 | + initialValue={'EXPERIMENTAL_CONSUMABLES'} | |
1949 | + rules={[{ required: true, message: '所属事业部必填' }]} | |
1950 | + disabled={optType('after-sales-check')} | |
1951 | + />, | |
1952 | + <ProFormSelect | |
1953 | + key={'shippingWarehouse' + listMeta.index} | |
1954 | + placeholder="请选择发货仓库" | |
1955 | + name="shippingWarehouse" | |
1956 | + width="lg" | |
1957 | + label="发货仓库" | |
1958 | + options={enumToSelect(SHIPPING_WAREHOUSE_OPTIONS)} | |
1959 | + disabled={optType('after-sales-check')} | |
1960 | + />, | |
1961 | + <ProFormTextArea | |
1962 | + key={'notes' + listMeta.index} | |
1963 | + width="lg" | |
1964 | + name="notes" | |
1965 | + disabled={optType('after-sales-check')} | |
1966 | + label={ | |
1967 | + <div> | |
1968 | + <span>备注</span> | |
1969 | + <span className="pl-2 text-xs text-gray-400"> | |
1970 | + 备注将体现在出货单上,请将需要仓管看见的信息写在备注上,例如需要开收据等信息。 | |
1971 | + </span> | |
1972 | + </div> | |
1973 | + } | |
1974 | + placeholder="请输入备注" | |
1975 | + rules={[ | |
1976 | + { | |
1977 | + max: 1000, // 最大长度为1000个字符 | |
1978 | + message: '备注不能超过1000个字符', | |
1979 | + }, | |
1980 | + ]} | |
1981 | + />, | |
1982 | + <> | |
1983 | + <ProFormUploadDragger | |
1984 | + key={'filePaths' + listMeta.index} | |
1985 | + label="附件" | |
1986 | + name="filePaths" | |
1987 | + action="/api/service/order/fileProcess" | |
1988 | + disabled={optType('after-sales-check')} | |
1989 | + fieldProps={{ | |
1990 | + headers: { | |
1991 | + Authorization: localStorage.getItem('token'), | |
1992 | + }, | |
1993 | + itemFileList, | |
1994 | + }} | |
1995 | + /> | |
1996 | + </>, | |
1997 | + ]} | |
1998 | + </ProCard> | |
1999 | + ); | |
2000 | + }} | |
2001 | + actionRef={actionRef} | |
2002 | + ></ProFormList> | |
2003 | + </DrawerForm> | |
2004 | + {kingdeeCstomerModalVisible && ( | |
2005 | + <KingdeeCustomerModal | |
2006 | + setVisible={setKingdeeCstomerModalVisible} | |
2007 | + data={customer} | |
2008 | + onClose={(customerId: any) => { | |
2009 | + setKingdeeCstomerModalVisible(false); | |
2010 | + //回显已经新建好的客户 | |
2011 | + autoFillCustomerContactSelectOptions(customerId); | |
2012 | + }} | |
2013 | + /> | |
2014 | + )} | |
2015 | + </> | |
2016 | + ); | |
2017 | +}; | ... | ... |
src/pages/Order/FeedBack/OrderList.tsx
0 → 100644
1 | +import ButtonConfirm from '@/components/ButtomConfirm'; | |
2 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
3 | +import InvoicingDrawerForm from '@/pages/Order/OrderList/InvoicingDrawerForm'; | |
4 | +import ReissueModal from '@/pages/Order/OrderList/ReissueModal'; | |
5 | +import ReissueModal_old from '@/pages/Order/OrderList/ReissueModal_old'; | |
6 | +import { | |
7 | + postKingdeeRepSalBillOutbound, | |
8 | + postKingdeeRepSalOrderSave, | |
9 | + postServiceConstCanApplyAfterInvoicingStatus, | |
10 | + postServiceInvoiceCancelApply, | |
11 | + postServiceOrderCancelSend, | |
12 | + postServiceOrderConfirmInvoice, | |
13 | + postServiceOrderGetCurrentOptNode, | |
14 | + postServiceOrderNoNeedSend, | |
15 | + postServiceOrderOrderCancel, | |
16 | + postServiceOrderProcureOrder, | |
17 | + postServiceOrderProcurePrint, | |
18 | + postServiceOrderQueryServiceOrder, | |
19 | + postServiceOrderSaleCancelInvoicing, | |
20 | + postServiceOrderSalesConfirm, | |
21 | +} from '@/services'; | |
22 | +import { downloadFile } from '@/services/order'; | |
23 | +import { | |
24 | + FloatAdd, | |
25 | + copyToClipboard, | |
26 | + enumToProTableEnumValue, | |
27 | + enumValueToLabel, | |
28 | + formatDateTime, | |
29 | + formatdate, | |
30 | + getAliYunOSSFileNameFromUrl, | |
31 | + isImageName, | |
32 | +} from '@/utils'; | |
33 | +import { | |
34 | + getReceivingCompanyOptions, | |
35 | + isAdmin, | |
36 | + isExaminer, | |
37 | + isFinance, | |
38 | + isProcure, | |
39 | + isSales, | |
40 | + isSupplier, | |
41 | + isWarehousekeeper, | |
42 | +} from '@/utils/order'; | |
43 | +import { getUserInfo } from '@/utils/user'; | |
44 | +import { | |
45 | + ClockCircleTwoTone, | |
46 | + ContainerTwoTone, | |
47 | + CopyOutlined, | |
48 | + CopyTwoTone, | |
49 | + DownOutlined, | |
50 | + EditTwoTone, | |
51 | + QuestionCircleOutlined, | |
52 | +} from '@ant-design/icons'; | |
53 | +import { | |
54 | + ActionType, | |
55 | + ProColumns, | |
56 | + ProFormInstance, | |
57 | + ProTable, | |
58 | +} from '@ant-design/pro-components'; | |
59 | +import { | |
60 | + Button, | |
61 | + Checkbox, | |
62 | + Divider, | |
63 | + Dropdown, | |
64 | + Flex, | |
65 | + FloatButton, | |
66 | + Image, | |
67 | + MenuProps, | |
68 | + Popconfirm, | |
69 | + Radio, | |
70 | + Space, | |
71 | + Spin, | |
72 | + Tag, | |
73 | + Tooltip, | |
74 | + message, | |
75 | +} from 'antd'; | |
76 | +import Base64 from 'base-64'; | |
77 | +import { cloneDeep } from 'lodash'; | |
78 | +import React, { Key, useEffect, useRef, useState } from 'react'; | |
79 | +import OrderPrintModal from '../../OrderPrint/OrderPrintModal'; | |
80 | +import AfterSalesDrawer from './AfterSalesDrawer'; | |
81 | +import ApplyForInvoicingModal from './ApplyForInvoicingModal'; | |
82 | +import AttachmentModal from './AttachmentModal'; | |
83 | +import CheckModal from './CheckModal'; | |
84 | +import ConfirmReceiptModal from './ConfirmReceiptModal'; | |
85 | +import DeliverInfoDrawer from './DeliverInfoDrawer'; | |
86 | +import DeliverModal from './DeliverModal'; | |
87 | +import FeedbackRegistrationModal from './FeedbackRegistrationModal'; | |
88 | +import FinancialDrawer from './FinancialDrawer'; | |
89 | +import FinancialEditDrawer from './FinancialEditDrawer'; | |
90 | +import FinancialMergeDrawer from './FinancialMergeDrawer'; | |
91 | +import FinancialReceiptsModal from './FinancialReceiptsModal'; | |
92 | +import HistoryModal from './HistoryModal'; | |
93 | +import ImagesViewerModal from './ImagesViewerModal'; | |
94 | +import ImportModal from './ImportModal'; | |
95 | +import ModifiedDiffModal from './ModifiedDiffModal'; | |
96 | +import OrderDrawer from './OrderDrawer'; | |
97 | +import OrderNotesEditModal from './OrderNotesEditModal'; | |
98 | +import ProcureCheckModal from './ProcureCheckModal'; | |
99 | +import ProcureConvertModal from './ProcureConvertModal'; | |
100 | +import ProductionTimeModal from './ProductionTimeModal'; | |
101 | +import ShippingWarehouseChangeModal from './ShippingWarehouseChangeModal'; | |
102 | +import UploadPayBillModal from './UploadPayBillModal'; | |
103 | +import { | |
104 | + AFTER_INVOICING_STATUS, | |
105 | + CHECK_TYPE, | |
106 | + LOGISTICS_STATUS_OPTIONS, | |
107 | + MAIN_ORDER_COLUMNS, | |
108 | + MODIFIED_AUDIT_STATUS_OPTIONS, | |
109 | + ORDER_STATUS_OPTIONS, | |
110 | + PAYEE_OPTIONS, | |
111 | + PAYMENT_CHANNEL_OPTIONS, | |
112 | + PAYMENT_RECEIPTS_STATUS_OPTIONS, | |
113 | + POST_AUDIT_OPTIONS, | |
114 | + PROCURE_ORDER_STATUS, | |
115 | + PROCURE_PRIMARY_ORDER_STATUS_OPTIONS, | |
116 | + PRODUCT_BELONG_DEPARTMENT_OPTIONS, | |
117 | + SHIPPING_WAREHOUSE_OPTIONS, | |
118 | + TAGS_COLOR, | |
119 | + getInvoicingType, | |
120 | + getNeedInvoicing, | |
121 | +} from './constant'; | |
122 | +import './index.less'; | |
123 | +import { OrderListItemType, OrderType } from './type.d'; | |
124 | +// import { useNavigate } from 'react-router-dom'; | |
125 | +// import { format } from 'fecha'; | |
126 | + | |
127 | +const OrderList = ({ paramsNew, searchShow, toolbarShow }) => { | |
128 | + const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false); | |
129 | + const [checkVisible, setCheckVisible] = useState<boolean>(false); | |
130 | + const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false); | |
131 | + const [allMainChecked, setAllMainChecked] = useState(false); | |
132 | + const [imagesViewerModalVisible, setImagesViewerModalVisible] = | |
133 | + useState<boolean>(false); | |
134 | + const [data, setData] = useState([]); //列表数据 | |
135 | + const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false); | |
136 | + const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] = | |
137 | + useState<boolean>(false); | |
138 | + const [attachmentModalVisible, setAttachmentModalVisible] = | |
139 | + useState<boolean>(false); | |
140 | + const [uploadPayBillModalVisible, setUploadPayBillModalVisible] = | |
141 | + useState<boolean>(false); | |
142 | + const [ | |
143 | + feedbackRegistrationModalVisible, | |
144 | + setFeedbackRegistrationModalVisible, | |
145 | + ] = useState<boolean>(false); | |
146 | + const [modifiedDiffModalVisible, setModifiedDiffModalVisible] = | |
147 | + useState<boolean>(false); | |
148 | + const [financialReceiptsModalVisible, setFinancialReceiptsModalVisible] = | |
149 | + useState(false); | |
150 | + const [financialVisible, setFinancialVisible] = useState<boolean>(false); | |
151 | + const [financialEditVisible, setFinancialEditVisible] = | |
152 | + useState<boolean>(false); | |
153 | + const [afterSalesDrawerVisible, setAfterSalesDrawerVisible] = | |
154 | + useState<boolean>(false); | |
155 | + const [historyModalVisible, setHistoryModalVisible] = | |
156 | + useState<boolean>(false); | |
157 | + const [isRePrintOrder, setIsRePrintOrder] = useState<boolean>(false); | |
158 | + const [isSendProduct, setIsSendProduct] = useState<boolean>(false); | |
159 | + const [isMainOrder, setIsMainOrder] = useState<boolean>(false); | |
160 | + const [importModalVisible, setImportModalVisible] = useState<boolean>(false); | |
161 | + const [reissueVisible, setReissueVisible] = useState<boolean>(false); | |
162 | + const [reissueVisibleOld, setReissueVisibleOld] = useState<boolean>(false); | |
163 | + const [applyForInvoicingVisible, setApplyForInvoicingVisible] = | |
164 | + useState<boolean>(false); | |
165 | + const [procureCheckModalVisible, setProcureCheckModalVisible] = | |
166 | + useState<boolean>(false); | |
167 | + const [procureConvertModalVisible, setProcureConvertModalVisible] = | |
168 | + useState<boolean>(false); | |
169 | + const [invoicingDrawerFormVisible, setInvoicingDrawerFormVisible] = | |
170 | + useState<boolean>(false); | |
171 | + const [confirmReceiptVisible, setConfirmReceiptVisible] = | |
172 | + useState<boolean>(false); | |
173 | + const [productionTimeModalVisible, setProductionTimeModalVisible] = | |
174 | + useState<boolean>(false); | |
175 | + const [deliverVisible, setDeliverVisible] = useState<boolean>(false); | |
176 | + const [deliverInfoDrawerVisible, setDeliverInfoDrawerVisible] = | |
177 | + useState<boolean>(false); | |
178 | + const [orderOptType, setOrderOptType] = useState<string>(''); | |
179 | + const [isEdit, setIsEdit] = useState<boolean>(false); | |
180 | + const [expandedRowKeys] = useState<Key[]>([]); | |
181 | + const [notesType, setNotesType] = useState(1); | |
182 | + const [notes, setNotes] = useState(1); | |
183 | + const [rolePath, setRolePath] = useState([]); //当前角色权限(新增跟打印按钮) | |
184 | + const userInfo = getUserInfo(); | |
185 | + // const [tableHeight, setTableHeight] = useState(200); | |
186 | + const [selectedRows, setSelectedRows] = useState([]); | |
187 | + const [mainOrderIdSubOrderIdRelationsMap] = useState(new Map()); //主订单id与子订单id的对照关系,用于主订单子订单的勾选校验,子订单全选中对应的主订单自动勾选上 | |
188 | + const [selectedMainOrderKeys, setSelectedMainOrderKeys] = useState<any[]>([]); | |
189 | + const [selectedSubOrderKeys, setSelectedSubOrderKeys] = useState<any[]>([]); | |
190 | + const [pageSize, setPageSize] = useState(10); | |
191 | + const [currentPage, setCurrentPage] = useState(1); | |
192 | + const [orderCheckType, setOrderCheckType] = useState(''); | |
193 | + const [imagesViewerOptType, setImagesViewerOptType] = useState(''); | |
194 | + const [filterCondifion, setFilterCondition] = useState(0); | |
195 | + const [filterOrderStatus, setFilterOrderStatus] = useState(''); | |
196 | + const [mainOrderSelectedMap] = useState(new Map()); //选中的主订单Map key:主订单id value:主订单数据 | |
197 | + const [subOrderSelectedMap, setSubOrderSelectedMap] = useState(new Map()); //选中的子订单Map key:主订单id value:选中的子订单数据集合 | |
198 | + const [currentOptMainId, setCurrentMainId] = useState<any>(undefined); //当前操作对象的主订单id | |
199 | + const [curretnOptSubId, setCurretnOptSubId] = useState<any>(undefined); //当前操作对象的子订单id | |
200 | + const [subOrderCount, setSubOrderCount] = useState(0); | |
201 | + // const [sorted, setSorted] = useState(false); | |
202 | + const mainTableRef = useRef<ActionType>(); | |
203 | + const mainTableFormRef = useRef<ProFormInstance>(); | |
204 | + let [searchParams, setSearchParam] = useState(Object); //表格的查询条件存储 | |
205 | + const [messageApi, contextHolder] = message.useMessage(); | |
206 | + const [ | |
207 | + shippingWarehouseChangeModalVisible, | |
208 | + setShippingWarehouseChangeModalVisible, | |
209 | + ] = useState(false); | |
210 | + // const [canApplyAfterInvoicingStatus, setCanApplyAfterInvoicingStatus] = | |
211 | + // useState([]); | |
212 | + const [ids, setIds] = useState([]); | |
213 | + const [recordOptNode, setRecordOptNode] = useState(null); | |
214 | + const roleCode = userInfo?.roleSmallVO?.code; | |
215 | + const roles = userInfo?.roles; | |
216 | + const [newParams, setNewParams] = useState<any>(); | |
217 | + | |
218 | + console.log(JSON.stringify(userInfo)); | |
219 | + const triggerRecordOptNode = async (id) => { | |
220 | + const res = await postServiceOrderGetCurrentOptNode({ | |
221 | + query: { | |
222 | + id, | |
223 | + }, | |
224 | + }); | |
225 | + setRecordOptNode(res.data); | |
226 | + }; | |
227 | + | |
228 | + const exportLoading = () => { | |
229 | + messageApi.open({ | |
230 | + type: 'loading', | |
231 | + content: '正在导出文件...', | |
232 | + duration: 0, | |
233 | + }); | |
234 | + }; | |
235 | + | |
236 | + const exportLoadingDestory = () => { | |
237 | + messageApi.destroy(); | |
238 | + }; | |
239 | + | |
240 | + const refreshTable = () => { | |
241 | + mainTableRef.current?.reload(); | |
242 | + //刷新表格数据的时候,取消选中行 | |
243 | + setSelectedRows([]); | |
244 | + setSelectedSubOrderKeys([]); | |
245 | + }; | |
246 | + | |
247 | + /*useEffect(() => { | |
248 | + let initAfterInvoicingStatus = async () => { | |
249 | + const afteInvoicingStatus = await getAfterInvoicingStatus(); | |
250 | + setAfterInvoicingStatus(afteInvoicingStatus); | |
251 | + }; | |
252 | + initAfterInvoicingStatus(); | |
253 | + }, []);*/ | |
254 | + | |
255 | + useEffect(() => { | |
256 | + // 使用URLSearchParams来解析查询参数 | |
257 | + const params = new URLSearchParams(location.search); | |
258 | + const id = params.get('id'); | |
259 | + const subOrderId = params.get('subOrderId'); | |
260 | + if (id) { | |
261 | + mainTableFormRef.current?.setFieldValue('id', id); | |
262 | + } | |
263 | + if (subOrderId) { | |
264 | + mainTableFormRef.current?.setFieldValue('subOrderId', subOrderId); | |
265 | + } | |
266 | + }, []); | |
267 | + | |
268 | + useEffect(() => { | |
269 | + const initEnum = async () => { | |
270 | + let invoiceTypeRet = await postServiceConstCanApplyAfterInvoicingStatus(); | |
271 | + if (invoiceTypeRet.result === RESPONSE_CODE.SUCCESS) { | |
272 | + // setCanApplyAfterInvoicingStatus(invoiceTypeRet.data); | |
273 | + } | |
274 | + }; | |
275 | + initEnum(); | |
276 | + }, []); | |
277 | + | |
278 | + /** | |
279 | + * 复制订单到剪贴板 | |
280 | + * @param record | |
281 | + */ | |
282 | + function copyOrderToClipboard(record: any) { | |
283 | + let text = ''; | |
284 | + text += record?.id; | |
285 | + text += ',' + record?.salesCode; | |
286 | + text += ',' + record?.customerName; | |
287 | + | |
288 | + text += ',' + record?.customerContactNumber; | |
289 | + | |
290 | + text += ',' + record?.customerShippingAddress; | |
291 | + | |
292 | + if (!isSupplier()) { | |
293 | + text += ',' + record?.institutionContactName; | |
294 | + text += ',' + record?.institution; | |
295 | + } | |
296 | + record?.subOrderInformationLists?.forEach((item) => { | |
297 | + text += '\n'; | |
298 | + text += item?.productName; | |
299 | + text += ' ' + item?.parameters; | |
300 | + text += ' ' + item?.quantity; | |
301 | + text += ' ' + item?.unit; | |
302 | + if (!isSupplier()) { | |
303 | + text += ' ¥' + item?.subOrderPayment; | |
304 | + } | |
305 | + text += ' ' + item?.id; | |
306 | + }); | |
307 | + if (copyToClipboard(text)) { | |
308 | + message.info('已复制到剪贴板'); | |
309 | + } else { | |
310 | + message.info('无法复制到剪贴板'); | |
311 | + } | |
312 | + } | |
313 | + | |
314 | + const MyToolTip = ({ title, content }) => { | |
315 | + return ( | |
316 | + <Tooltip | |
317 | + color="#FFFFFF" | |
318 | + placement="bottom" | |
319 | + title={<div className="px-5 py-4 text-black">{title}</div>} | |
320 | + > | |
321 | + {content} | |
322 | + </Tooltip> | |
323 | + ); | |
324 | + }; | |
325 | + | |
326 | + /** | |
327 | + * 检查是否可以打印 | |
328 | + * @param paths 按钮集合 | |
329 | + * @returns | |
330 | + */ | |
331 | + function checkePrintable(paths: any) { | |
332 | + if ( | |
333 | + !paths?.includes('printOrder') && | |
334 | + !paths?.includes('supplierPrint') && | |
335 | + !paths?.includes('procurePrint') && | |
336 | + !paths?.includes('rePrintOrder') | |
337 | + ) { | |
338 | + return false; | |
339 | + } | |
340 | + | |
341 | + return true; | |
342 | + } | |
343 | + | |
344 | + /** | |
345 | + * 财务是否选中排序 | |
346 | + * @param e | |
347 | + */ | |
348 | + // function financeSorted(e: any) { | |
349 | + // let checked = e?.target.checked; | |
350 | + // setSorted(checked); | |
351 | + // refreshTable(); | |
352 | + // } | |
353 | + | |
354 | + /** | |
355 | + * 重置当前的操作对象 | |
356 | + */ | |
357 | + function clearOptObject() { | |
358 | + setCurrentMainId(undefined); | |
359 | + setCurretnOptSubId(undefined); | |
360 | + setIsMainOrder(false); | |
361 | + } | |
362 | + | |
363 | + /** | |
364 | + * 初始化当前的操作对象 | |
365 | + * @param subId | |
366 | + * @param mainId | |
367 | + */ | |
368 | + function createOptObject(subId: any, mainId: any) { | |
369 | + setCurrentMainId(mainId); | |
370 | + setCurretnOptSubId(subId); | |
371 | + } | |
372 | + | |
373 | + /** | |
374 | + * 检查当前操作是否异常 | |
375 | + */ | |
376 | + // function checkOptValid() { | |
377 | + // if ((currentOptMainId === undefined || currentOptMainId === null) && (curretnOptSubId === undefined || curretnOptSubId === null)) { | |
378 | + // message.error("页面错误:当前操作对象为空,请联系系统管理员"); | |
379 | + // return false; | |
380 | + // } | |
381 | + | |
382 | + // //检查数据是否存在 | |
383 | + // //主订单数据 | |
384 | + // if (!Array.from(mainOrderIdSubOrderIdRelationsMap.keys()).includes(currentOptMainId)) { | |
385 | + // message.error("页面错误:当前操作主订单对象为空,请联系系统管理员"); | |
386 | + // } | |
387 | + | |
388 | + // //子订单 | |
389 | + // let allSubIds = []; | |
390 | + // for (const idList of mainOrderIdSubOrderIdRelationsMap.values()) { | |
391 | + // allSubIds.push(...idList); | |
392 | + // } | |
393 | + // if (!allSubIds.includes(curretnOptSubId)) { | |
394 | + // message.error("页面错误:当前操作子订单对象为空,请联系系统管理员"); | |
395 | + // return false | |
396 | + // } | |
397 | + | |
398 | + // return true; | |
399 | + // } | |
400 | + | |
401 | + /** | |
402 | + * 获取当前选中子订单的其中一个主订单 | |
403 | + */ | |
404 | + function getFirstMainOrder() { | |
405 | + let mainId = [...subOrderSelectedMap.values()].flat()[0].mainOrderId; | |
406 | + for (let item of data) { | |
407 | + if (item.id === mainId) { | |
408 | + return item; | |
409 | + } | |
410 | + } | |
411 | + | |
412 | + return null; | |
413 | + } | |
414 | + | |
415 | + /** | |
416 | + * 返回当前操作的主订单数据 | |
417 | + */ | |
418 | + function buildMainOrder() { | |
419 | + if (currentOptMainId === undefined || currentOptMainId === null) { | |
420 | + message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员'); | |
421 | + return; | |
422 | + } | |
423 | + | |
424 | + let mainOrderClone = null; | |
425 | + let matchedData = data.filter((item) => { | |
426 | + return item.id === currentOptMainId; | |
427 | + }); | |
428 | + if (matchedData.length > 0) { | |
429 | + mainOrderClone = cloneDeep(matchedData[0]); | |
430 | + } | |
431 | + | |
432 | + if (mainOrderClone === null) { | |
433 | + message.error('页面错误:当前操作的主订单数据不存在,请联系系统管理员'); | |
434 | + } | |
435 | + | |
436 | + return mainOrderClone; | |
437 | + } | |
438 | + | |
439 | + /** | |
440 | + * 返回当前操作的子订单集合 | |
441 | + */ | |
442 | + function buildSubOrders() { | |
443 | + if (currentOptMainId === undefined || currentOptMainId === null) { | |
444 | + message.error('页面错误:当前操作的主订单id不存在,请联系系统管理员'); | |
445 | + return; | |
446 | + } | |
447 | + | |
448 | + let cloneSubOrders = []; | |
449 | + | |
450 | + //如果没有传当前操作的子订单id,说明是操作主订单 | |
451 | + if (curretnOptSubId === undefined || curretnOptSubId === null) { | |
452 | + //如果有选中子订单,那么取选中的子订单为操作对象,否则取当前主订单的全部子订单为操作对象 | |
453 | + let currentOptSubOrders = subOrderSelectedMap.get(currentOptMainId); | |
454 | + if ( | |
455 | + currentOptSubOrders === null || | |
456 | + currentOptSubOrders === undefined || | |
457 | + currentOptSubOrders.length === 0 | |
458 | + ) { | |
459 | + for (let item of data) { | |
460 | + if (item.id === currentOptMainId) { | |
461 | + for (let subOrder of item?.subOrderInformationLists) { | |
462 | + cloneSubOrders.push(cloneDeep(subOrder)); | |
463 | + } | |
464 | + } | |
465 | + } | |
466 | + } else { | |
467 | + cloneSubOrders = currentOptSubOrders.map((item) => { | |
468 | + return cloneDeep(item); | |
469 | + }); | |
470 | + } | |
471 | + } else { | |
472 | + //操作的是子订单 | |
473 | + for (let item of data) { | |
474 | + if (item.id === currentOptMainId) { | |
475 | + for (let subOrder of item?.subOrderInformationLists) { | |
476 | + if (subOrder.id === curretnOptSubId) { | |
477 | + cloneSubOrders.push(cloneDeep(subOrder)); | |
478 | + break; | |
479 | + } | |
480 | + } | |
481 | + } | |
482 | + } | |
483 | + } | |
484 | + | |
485 | + if (cloneSubOrders.length === 0) { | |
486 | + message.error('页面错误:当前操作的订单数据不存在,请联系系统管理员'); | |
487 | + return; | |
488 | + } | |
489 | + | |
490 | + return cloneSubOrders; | |
491 | + } | |
492 | + | |
493 | + /** | |
494 | + * 获取当前操作申请开票的订单总金额 | |
495 | + */ | |
496 | + function getApplyInvoicingTotalPayment() { | |
497 | + let subOrders = isMainOrder | |
498 | + ? [...subOrderSelectedMap.values()].flat() | |
499 | + : buildSubOrders(); | |
500 | + | |
501 | + let totalPayment = 0; | |
502 | + if (subOrders && subOrders.length > 0) { | |
503 | + let mainIds = subOrders?.map((item: any) => { | |
504 | + return item.mainOrderId; | |
505 | + }); | |
506 | + | |
507 | + let uniqueMainIds = [...new Set(mainIds)]; | |
508 | + | |
509 | + let dataMap = data.reduce((map, obj: any) => { | |
510 | + map.set(obj.id, obj); | |
511 | + return map; | |
512 | + }, new Map()); | |
513 | + | |
514 | + uniqueMainIds.forEach((id: any) => { | |
515 | + let o = dataMap.get(id); | |
516 | + if (o) { | |
517 | + totalPayment = FloatAdd(totalPayment, o.totalPayment); | |
518 | + } | |
519 | + }); | |
520 | + } | |
521 | + return totalPayment; | |
522 | + } | |
523 | + | |
524 | + /** | |
525 | + * 根据主订单id,将该主订单下的所有子订单取消选中 | |
526 | + */ | |
527 | + const removeSelectedSubOrderKeysByMainOrderId = (id: any) => { | |
528 | + let currentMainOrderAllSubOrderIds = | |
529 | + mainOrderIdSubOrderIdRelationsMap.get(id); | |
530 | + if (currentMainOrderAllSubOrderIds) { | |
531 | + let newSelectedSubOrderKeys = selectedSubOrderKeys.filter((item) => { | |
532 | + return !currentMainOrderAllSubOrderIds.includes(item); | |
533 | + }); | |
534 | + setSelectedSubOrderKeys(newSelectedSubOrderKeys); | |
535 | + } | |
536 | + }; | |
537 | + | |
538 | + /** | |
539 | + * 根据主订单id取消选中主订单 | |
540 | + * @param id | |
541 | + */ | |
542 | + const removeSelecetMainOrderKeyByMainOrderId = (id: any) => { | |
543 | + if (selectedMainOrderKeys.includes(id)) { | |
544 | + let newSelectedMainOrderKeys = selectedMainOrderKeys.filter((item) => { | |
545 | + return item !== id; | |
546 | + }); | |
547 | + setSelectedMainOrderKeys(newSelectedMainOrderKeys); | |
548 | + } | |
549 | + }; | |
550 | + | |
551 | + const onCheckboxChange = (record: never) => { | |
552 | + let newSelectedMainOrderKeys = []; | |
553 | + if (selectedMainOrderKeys.includes(record.id)) { | |
554 | + newSelectedMainOrderKeys = selectedMainOrderKeys.filter( | |
555 | + (key) => key !== record.id, | |
556 | + ); | |
557 | + removeSelectedSubOrderKeysByMainOrderId(record.id); | |
558 | + setSelectedRows([]); | |
559 | + | |
560 | + //删除选中主订单的信息 | |
561 | + mainOrderSelectedMap.delete(record.id); | |
562 | + //删除选中主订单附属子订单的信息 | |
563 | + subOrderSelectedMap.delete(record.id); | |
564 | + //总选中按钮取消选中 | |
565 | + setAllMainChecked(false); | |
566 | + } else { | |
567 | + newSelectedMainOrderKeys = [...selectedMainOrderKeys, record.id]; | |
568 | + //子订单全部自动选中 | |
569 | + let subIds = record.subOrderInformationLists?.map((item) => { | |
570 | + return item.id; | |
571 | + }); | |
572 | + let newSelectedSubOrderKeys = [...selectedSubOrderKeys]; | |
573 | + for (let subId of subIds) { | |
574 | + if (!selectedSubOrderKeys.includes(subId)) { | |
575 | + newSelectedSubOrderKeys.push(subId); | |
576 | + } | |
577 | + } | |
578 | + setSelectedSubOrderKeys(newSelectedSubOrderKeys); | |
579 | + | |
580 | + setSelectedRows(record.subOrderInformationLists); | |
581 | + | |
582 | + //选中主订单 | |
583 | + mainOrderSelectedMap.set(record.id, record); | |
584 | + //选中子订单 | |
585 | + subOrderSelectedMap.set(record.id, record.subOrderInformationLists); | |
586 | + setSubOrderSelectedMap(new Map(subOrderSelectedMap)); | |
587 | + | |
588 | + //如果所有主订单都勾选上了,那么勾选上总选中按钮 | |
589 | + if ( | |
590 | + mainOrderSelectedMap?.size === mainOrderIdSubOrderIdRelationsMap.size | |
591 | + ) { | |
592 | + setAllMainChecked(true); | |
593 | + } | |
594 | + } | |
595 | + setSelectedMainOrderKeys(newSelectedMainOrderKeys); | |
596 | + }; | |
597 | + // const handleTableExpand = (mainOrderIds: any) => { | |
598 | + // setExpandedRowKeys(mainOrderIds); | |
599 | + // }; | |
600 | + | |
601 | + const allMainCheckBoxChange = () => { | |
602 | + let checked = !allMainChecked; | |
603 | + setAllMainChecked(checked); | |
604 | + | |
605 | + if (checked) { | |
606 | + let mainOrderIds = data?.map((item) => { | |
607 | + mainOrderSelectedMap.set(item.id, item); | |
608 | + return item.id; | |
609 | + }); | |
610 | + | |
611 | + let subOrderIds = []; | |
612 | + for (let subIdList of mainOrderIdSubOrderIdRelationsMap.values()) { | |
613 | + subOrderIds.push(...subIdList); | |
614 | + } | |
615 | + | |
616 | + if (data) { | |
617 | + for (let item of data) { | |
618 | + mainOrderSelectedMap.set(item.id, item); | |
619 | + | |
620 | + subOrderSelectedMap.set(item.id, item.subOrderInformationLists); | |
621 | + } | |
622 | + } | |
623 | + | |
624 | + setSelectedMainOrderKeys(mainOrderIds); | |
625 | + setSelectedSubOrderKeys(subOrderIds); | |
626 | + } else { | |
627 | + setSelectedMainOrderKeys([]); | |
628 | + setSelectedSubOrderKeys([]); | |
629 | + mainOrderSelectedMap.clear(); | |
630 | + subOrderSelectedMap.clear(); | |
631 | + } | |
632 | + }; | |
633 | + | |
634 | + //表头渲染 | |
635 | + const OrderTableHeader = () => { | |
636 | + return ( | |
637 | + <Flex className="w-full"> | |
638 | + <Flex className="w-[1%] ml-[7px]"> | |
639 | + <Checkbox | |
640 | + onChange={allMainCheckBoxChange} | |
641 | + checked={allMainChecked} | |
642 | + ></Checkbox> | |
643 | + </Flex> | |
644 | + <Flex className="w-[30%] ml-[1%]"> | |
645 | + <span className="font-medium">商品信息</span> | |
646 | + </Flex> | |
647 | + <Flex className="w-[13%]"> | |
648 | + <span className="font-medium">交易金额</span> | |
649 | + </Flex> | |
650 | + | |
651 | + {!isSupplier() ? ( | |
652 | + <> | |
653 | + <Flex className="w-[10%]"> | |
654 | + <span className="font-medium">支付</span> | |
655 | + </Flex> | |
656 | + <Flex className="w-[12%]"> | |
657 | + <span className="font-medium">其他</span> | |
658 | + </Flex> | |
659 | + </> | |
660 | + ) : ( | |
661 | + '' | |
662 | + )} | |
663 | + | |
664 | + <Flex className="w-[10%]"> | |
665 | + <span className="font-medium">交易状态</span> | |
666 | + </Flex> | |
667 | + <Flex className="w-[17%]"> | |
668 | + <span className="font-medium">操作</span> | |
669 | + </Flex> | |
670 | + </Flex> | |
671 | + ); | |
672 | + }; | |
673 | + //子订单内容渲染 | |
674 | + const SubOderRander = ({ record, optRecord }) => { | |
675 | + /** | |
676 | + * 获取订单状态标签 | |
677 | + * @param optRecord | |
678 | + */ | |
679 | + function getOrderStatusTag(optRecord: any): import('react').ReactNode { | |
680 | + const orderStatus = optRecord.orderStatus; | |
681 | + const paymentMethod = optRecord.paymentMethod; | |
682 | + let orderStatusTagText = enumValueToLabel( | |
683 | + optRecord.orderStatus, | |
684 | + ORDER_STATUS_OPTIONS, | |
685 | + ); | |
686 | + | |
687 | + if (orderStatus === 'WAIT_CONFIRM_DELIVER_AFTER_INVOICE') { | |
688 | + if (optRecord.afterInvoicingStatus !== 'COMPLETE_INVOICING') { | |
689 | + orderStatusTagText = '待开票'; | |
690 | + } else { | |
691 | + orderStatusTagText = '待确认发货'; | |
692 | + } | |
693 | + } | |
694 | + | |
695 | + //如果是未审核或者领导已审核,付款状态为预付款则需要财务审核【财务待审核】,否则仓库审核【】 | |
696 | + if (orderStatus === 'UNAUDITED' || orderStatus === 'LEADER_AUDITED') { | |
697 | + if (paymentMethod === 'PAYMENT_IN_ADVANCE') { | |
698 | + orderStatusTagText = '财务待审核'; | |
699 | + } else { | |
700 | + orderStatusTagText = '仓库待审核'; | |
701 | + } | |
702 | + } | |
703 | + | |
704 | + //如果是财务已审核,显示为【仓库待审核】 | |
705 | + if (orderStatus === 'FINANCE_PROCESS') { | |
706 | + orderStatusTagText = '仓库待审核'; | |
707 | + } | |
708 | + | |
709 | + if (orderStatus === 'AUDIT_FAILED') { | |
710 | + return ( | |
711 | + <MyToolTip | |
712 | + key="key" | |
713 | + title={optRecord.checkNotes + ' ' + optRecord.postAuditNotes} | |
714 | + content={ | |
715 | + <> | |
716 | + <Tag | |
717 | + color={TAGS_COLOR.get(optRecord.orderStatus)} | |
718 | + style={{ marginRight: '4px' }} | |
719 | + > | |
720 | + {orderStatusTagText} | |
721 | + </Tag> | |
722 | + <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> | |
723 | + </> | |
724 | + } | |
725 | + /> | |
726 | + ); | |
727 | + } | |
728 | + | |
729 | + if ( | |
730 | + orderStatus === 'AFTER_SALES_COMPLETION' || | |
731 | + orderStatus === 'IN_AFTER_SALES' | |
732 | + ) { | |
733 | + return ( | |
734 | + <Tag | |
735 | + color={TAGS_COLOR.get(optRecord.orderStatus)} | |
736 | + style={{ marginRight: '4px' }} | |
737 | + > | |
738 | + {orderStatusTagText} | |
739 | + </Tag> | |
740 | + ); | |
741 | + } | |
742 | + | |
743 | + if (orderStatus === 'PROCURE_CONVERT_WAREHOUSE_KEEPER') { | |
744 | + return ( | |
745 | + <MyToolTip | |
746 | + key="key" | |
747 | + title={optRecord.checkNotes} | |
748 | + content={ | |
749 | + <> | |
750 | + <Tag | |
751 | + color={TAGS_COLOR.get(optRecord.orderStatus)} | |
752 | + style={{ marginRight: '4px' }} | |
753 | + > | |
754 | + {orderStatusTagText} | |
755 | + </Tag> | |
756 | + <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> | |
757 | + </> | |
758 | + } | |
759 | + /> | |
760 | + ); | |
761 | + } | |
762 | + | |
763 | + return ( | |
764 | + <Tag key="key" color={TAGS_COLOR.get(optRecord.orderStatus)}> | |
765 | + {orderStatusTagText} | |
766 | + </Tag> | |
767 | + ); | |
768 | + } | |
769 | + | |
770 | + /** | |
771 | + * 获取后置审核状态标签 | |
772 | + * @param optRecord | |
773 | + */ | |
774 | + function getPostAuditStatusTag(optRecord: any): import('react').ReactNode { | |
775 | + return ( | |
776 | + <Tag key="key" color={TAGS_COLOR.get(optRecord.postAuditStatus)}> | |
777 | + {enumValueToLabel(optRecord.postAuditStatus, POST_AUDIT_OPTIONS)} | |
778 | + </Tag> | |
779 | + ); | |
780 | + } | |
781 | + | |
782 | + //申请开票附件处理 | |
783 | + const getAfterAnnexList = () => { | |
784 | + // let links = []; | |
785 | + let afterAnnexList = optRecord.afterAnnexList; | |
786 | + let i = 1; | |
787 | + let images = []; | |
788 | + let otherAnnex = []; | |
789 | + if (afterAnnexList?.length > 0) { | |
790 | + for (let url of afterAnnexList) { | |
791 | + let name = getAliYunOSSFileNameFromUrl(url); | |
792 | + if (isImageName(name)) { | |
793 | + images.push({ name: name, url: url }); | |
794 | + } else { | |
795 | + otherAnnex.push({ name: '附件' + i++, url: url }); | |
796 | + } | |
797 | + } | |
798 | + } | |
799 | + | |
800 | + return ( | |
801 | + <div className="pl-1"> | |
802 | + <Image.PreviewGroup | |
803 | + className="mr-10" | |
804 | + preview={{ | |
805 | + onChange: (current, prev) => | |
806 | + console.log(`current index: ${current}, prev index: ${prev}`), | |
807 | + }} | |
808 | + > | |
809 | + {images.map((item, index) => ( | |
810 | + <React.Fragment key={index}> | |
811 | + {index > 0 ? <Divider type="vertical" /> : ''} | |
812 | + <Image | |
813 | + className="max-h-[50px] max-w-[70px]" | |
814 | + src={item.url} | |
815 | + title={item.name} | |
816 | + />{' '} | |
817 | + </React.Fragment> | |
818 | + ))} | |
819 | + </Image.PreviewGroup> | |
820 | + {otherAnnex.map((item, index) => { | |
821 | + return ( | |
822 | + <Popconfirm | |
823 | + title="下载或预览" | |
824 | + key={index} | |
825 | + onConfirm={() => { | |
826 | + window.open( | |
827 | + '/previewApi/onlinePreview?url=' + | |
828 | + encodeURIComponent(Base64.encode(item.url)), | |
829 | + ); | |
830 | + }} | |
831 | + onCancel={() => { | |
832 | + window.open(item.url); | |
833 | + }} | |
834 | + okText="预览" | |
835 | + cancelText="下载" | |
836 | + > | |
837 | + <Button className="px-1" key={index} type="link"> | |
838 | + {item.name} | |
839 | + </Button> | |
840 | + </Popconfirm> | |
841 | + ); | |
842 | + })} | |
843 | + </div> | |
844 | + ); | |
845 | + }; | |
846 | + | |
847 | + //财务审核附件处理 | |
848 | + const getInvoicingCheckAnnexList = () => { | |
849 | + let invoicingCheckAnnexList = optRecord.invoicingCheckAnnexList; | |
850 | + return ( | |
851 | + <div> | |
852 | + <Image.PreviewGroup | |
853 | + className="mr-10" | |
854 | + preview={{ | |
855 | + onChange: (current, prev) => | |
856 | + console.log(`current index: ${current}, prev index: ${prev}`), | |
857 | + }} | |
858 | + > | |
859 | + {invoicingCheckAnnexList.map((url, index) => ( | |
860 | + <React.Fragment key={index}> | |
861 | + <Image className="max-h-[50px] max-w-[70px]" src={url} />{' '} | |
862 | + <Divider type="vertical" /> | |
863 | + </React.Fragment> | |
864 | + ))} | |
865 | + </Image.PreviewGroup> | |
866 | + </div> | |
867 | + ); | |
868 | + }; | |
869 | + | |
870 | + return ( | |
871 | + <> | |
872 | + <Flex className="w-full border-b-indigo-500"> | |
873 | + <Flex vertical className="w-[31%]" gap="small"> | |
874 | + {/* 商品名称 */} | |
875 | + <div> | |
876 | + <div | |
877 | + className="overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer" | |
878 | + onClick={() => { | |
879 | + copyToClipboard(optRecord.productName); | |
880 | + message.info('商品名称复制成功:' + optRecord.productName); | |
881 | + }} | |
882 | + title={optRecord.productName} | |
883 | + > | |
884 | + <span className="font-medium text-black "> | |
885 | + {optRecord.productName} | |
886 | + </span> | |
887 | + </div> | |
888 | + <div className="text-xs text-[#8C8C8C]"> | |
889 | + <span | |
890 | + className="cursor-pointer" | |
891 | + onClick={() => { | |
892 | + copyToClipboard(optRecord.id); | |
893 | + message.info('子订单编号复制成功:' + optRecord.id); | |
894 | + }} | |
895 | + > | |
896 | + {optRecord.id} | |
897 | + </span> | |
898 | + {(roleCode === 'salesRepresentative' || | |
899 | + roleCode === 'salesManager') && | |
900 | + !optRecord.isCurrentUserOrder ? ( | |
901 | + <span className="text-[#f44e4e]">(非本账号订单)</span> | |
902 | + ) : ( | |
903 | + '' | |
904 | + )} | |
905 | + {optRecord.modifiedOptFlag !== null ? ( | |
906 | + <span className="text-[#f44e4e] cursor-pointer"> | |
907 | + {optRecord.modifiedOptFlag === 'MODIFY' ? '(修改中)' : ''} | |
908 | + {optRecord.modifiedOptFlag === 'DELETE' ? '(删除中)' : ''} | |
909 | + {optRecord.modifiedOptFlag === 'INSERT' ? '(新增中)' : ''} | |
910 | + </span> | |
911 | + ) : ( | |
912 | + '' | |
913 | + )} | |
914 | + {optRecord.uid && ( | |
915 | + <span className="text-[#f44e4e] cursor-pointer"> | |
916 | + (商城订单) | |
917 | + </span> | |
918 | + )} | |
919 | + | |
920 | + {optRecord.modified ? ( | |
921 | + <Tooltip title="点击查看详情"> | |
922 | + <span | |
923 | + className="text-[#f44e4e] cursor-pointer" | |
924 | + onClick={async () => { | |
925 | + createOptObject(optRecord.id, record.id); | |
926 | + setModifiedDiffModalVisible(true); | |
927 | + }} | |
928 | + > | |
929 | + (内容有变化) | |
930 | + </span> | |
931 | + </Tooltip> | |
932 | + ) : ( | |
933 | + '' | |
934 | + )} | |
935 | + {!optRecord.logicDelete ? ( | |
936 | + <span className="text-[#f44e4e]">(已作废)</span> | |
937 | + ) : ( | |
938 | + '' | |
939 | + )} | |
940 | + </div> | |
941 | + </div> | |
942 | + | |
943 | + <div | |
944 | + className="overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer" | |
945 | + title={optRecord.parameters} | |
946 | + onClick={() => { | |
947 | + copyToClipboard(optRecord.parameters); | |
948 | + message.info('商品名称复制成功:' + optRecord.parameters); | |
949 | + }} | |
950 | + > | |
951 | + <span className="text-[#8C8C8C]"> | |
952 | + 参数:{optRecord.parameters} | |
953 | + </span> | |
954 | + </div> | |
955 | + </Flex> | |
956 | + <Flex className="w-[13%]" vertical gap="small"> | |
957 | + {!isSupplier() ? ( | |
958 | + <> | |
959 | + <div | |
960 | + className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | |
961 | + title={optRecord.productPrice} | |
962 | + > | |
963 | + <span className="text-[#8C8C8C]">单价:</span> | |
964 | + <span className="text-slate-700"> | |
965 | + ¥{optRecord.productPrice} | |
966 | + </span> | |
967 | + </div> | |
968 | + </> | |
969 | + ) : ( | |
970 | + '' | |
971 | + )} | |
972 | + | |
973 | + <div | |
974 | + className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | |
975 | + title={optRecord.quantity} | |
976 | + > | |
977 | + <span className="text-[#8C8C8C]">数量:</span> | |
978 | + <span className="text-slate-700"> | |
979 | + x{optRecord.quantity + ' '} | |
980 | + </span> | |
981 | + <span className="text-[#8C8C8C]">{optRecord.unit}</span> | |
982 | + </div> | |
983 | + | |
984 | + {!isSupplier() ? ( | |
985 | + <div | |
986 | + className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | |
987 | + title={optRecord.subOrderPayment} | |
988 | + > | |
989 | + <span className="text-[#8C8C8C]">合计:</span> | |
990 | + <span className="text-slate-700"> | |
991 | + ¥{optRecord.subOrderPayment} | |
992 | + </span> | |
993 | + </div> | |
994 | + ) : ( | |
995 | + '' | |
996 | + )} | |
997 | + </Flex> | |
998 | + | |
999 | + <Flex className="w-[10%]" vertical gap="small"> | |
1000 | + {!isSupplier() ? ( | |
1001 | + <> | |
1002 | + {/* 支付方式 */} | |
1003 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1004 | + <span className="text-slate-700"> | |
1005 | + {optRecord.paymentMethodText} | |
1006 | + </span> | |
1007 | + </div> | |
1008 | + {/* 支付渠道 */} | |
1009 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1010 | + <span className="text-slate-700"> | |
1011 | + {enumValueToLabel( | |
1012 | + optRecord.paymentChannel, | |
1013 | + PAYMENT_CHANNEL_OPTIONS, | |
1014 | + )} | |
1015 | + </span> | |
1016 | + </div> | |
1017 | + {/* 回款审核状态 */} | |
1018 | + {optRecord.paymentReceiptStatus !== null ? ( | |
1019 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1020 | + <Tag | |
1021 | + className="hover:cursor-pointer" | |
1022 | + onMouseEnter={(e: any) => { | |
1023 | + e.target.innerText = '点击查看回款凭证'; | |
1024 | + }} | |
1025 | + onMouseLeave={(e: any) => { | |
1026 | + e.target.innerText = enumValueToLabel( | |
1027 | + optRecord.paymentReceiptStatus, | |
1028 | + PAYMENT_RECEIPTS_STATUS_OPTIONS, | |
1029 | + ); | |
1030 | + }} | |
1031 | + onClick={() => { | |
1032 | + createOptObject(optRecord.id, record.id); | |
1033 | + setImagesViewerOptType('paymentReceipt'); | |
1034 | + setImagesViewerModalVisible(true); | |
1035 | + }} | |
1036 | + key="key" | |
1037 | + color={TAGS_COLOR.get(optRecord.paymentReceiptStatus)} | |
1038 | + > | |
1039 | + {enumValueToLabel( | |
1040 | + optRecord.paymentReceiptStatus, | |
1041 | + PAYMENT_RECEIPTS_STATUS_OPTIONS, | |
1042 | + )} | |
1043 | + </Tag> | |
1044 | + </div> | |
1045 | + ) : ( | |
1046 | + '' | |
1047 | + )} | |
1048 | + </> | |
1049 | + ) : ( | |
1050 | + '' | |
1051 | + )} | |
1052 | + </Flex> | |
1053 | + <Flex className="w-[13%]" vertical gap="small"> | |
1054 | + {!isSupplier() ? ( | |
1055 | + <> | |
1056 | + {/* 所属部门 */} | |
1057 | + <div | |
1058 | + className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | |
1059 | + title={enumValueToLabel( | |
1060 | + optRecord.productBelongBusiness, | |
1061 | + PRODUCT_BELONG_DEPARTMENT_OPTIONS, | |
1062 | + )} | |
1063 | + > | |
1064 | + <span className="text-slate-700"> | |
1065 | + {enumValueToLabel( | |
1066 | + optRecord.productBelongBusiness, | |
1067 | + PRODUCT_BELONG_DEPARTMENT_OPTIONS, | |
1068 | + )} | |
1069 | + </span> | |
1070 | + </div> | |
1071 | + | |
1072 | + {/* 开票类型 */} | |
1073 | + {optRecord.invoicingStatus !== null ? ( | |
1074 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1075 | + <span className="text-slate-700"> | |
1076 | + {getInvoicingType(optRecord)} | |
1077 | + </span> | |
1078 | + </div> | |
1079 | + ) : ( | |
1080 | + '' | |
1081 | + )} | |
1082 | + | |
1083 | + {/* 开票状态 */} | |
1084 | + {optRecord.afterInvoicingStatus !== null ? ( | |
1085 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1086 | + <Tooltip | |
1087 | + title={ | |
1088 | + optRecord.invoicingUrgentCause !== null && | |
1089 | + optRecord.afterInvoicingStatus === | |
1090 | + 'URGENT_INVOICE_AUDITING' | |
1091 | + ? optRecord.invoicingUrgentCause | |
1092 | + : enumValueToLabel( | |
1093 | + optRecord.afterInvoicingStatus, | |
1094 | + AFTER_INVOICING_STATUS, | |
1095 | + ) | |
1096 | + } | |
1097 | + > | |
1098 | + <Tag | |
1099 | + color={TAGS_COLOR.get(optRecord.afterInvoicingStatus)} | |
1100 | + > | |
1101 | + {enumValueToLabel( | |
1102 | + optRecord.afterInvoicingStatus, | |
1103 | + AFTER_INVOICING_STATUS, | |
1104 | + )} | |
1105 | + </Tag> | |
1106 | + </Tooltip> | |
1107 | + </div> | |
1108 | + ) : ( | |
1109 | + '' | |
1110 | + )} | |
1111 | + | |
1112 | + {/* 是否加急图标显示 */} | |
1113 | + {optRecord.isUrgent ? ( | |
1114 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1115 | + <Tooltip | |
1116 | + title={'期望开票时间:' + formatdate(optRecord.deadline)} | |
1117 | + > | |
1118 | + <Tag color="red">加急开票</Tag> | |
1119 | + </Tooltip> | |
1120 | + </div> | |
1121 | + ) : ( | |
1122 | + '' | |
1123 | + )} | |
1124 | + | |
1125 | + {(roleCode === 'warehouseKeeper' || roleCode === 'admin') && | |
1126 | + optRecord.shippingWarehouse !== null ? ( | |
1127 | + <div | |
1128 | + className="overflow-hidden whitespace-no-wrap overflow-ellipsis" | |
1129 | + title={enumValueToLabel( | |
1130 | + optRecord.shippingWarehouse, | |
1131 | + SHIPPING_WAREHOUSE_OPTIONS, | |
1132 | + )} | |
1133 | + > | |
1134 | + <span className="text-slate-700"> | |
1135 | + {enumValueToLabel( | |
1136 | + optRecord.shippingWarehouse, | |
1137 | + SHIPPING_WAREHOUSE_OPTIONS, | |
1138 | + )} | |
1139 | + </span> | |
1140 | + </div> | |
1141 | + ) : ( | |
1142 | + '' | |
1143 | + )} | |
1144 | + | |
1145 | + {/* 生产时间 */} | |
1146 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1147 | + {optRecord.productionStartTime !== null || | |
1148 | + optRecord.productionEndTime !== null ? ( | |
1149 | + <MyToolTip | |
1150 | + title={ | |
1151 | + formatdate(optRecord.productionStartTime) + | |
1152 | + ' 至 ' + | |
1153 | + formatdate(optRecord.productionEndTime) | |
1154 | + } | |
1155 | + content={ | |
1156 | + <Button type="link" size="small" style={{ padding: 0 }}> | |
1157 | + 生产时间 | |
1158 | + </Button> | |
1159 | + } | |
1160 | + /> | |
1161 | + ) : ( | |
1162 | + '' | |
1163 | + )} | |
1164 | + </div> | |
1165 | + </> | |
1166 | + ) : ( | |
1167 | + '' | |
1168 | + )} | |
1169 | + </Flex> | |
1170 | + | |
1171 | + <Flex className="w-[10%]" vertical gap="small"> | |
1172 | + {/* 开票状态 */} | |
1173 | + {!isSupplier() ? ( | |
1174 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1175 | + <Tag | |
1176 | + color={ | |
1177 | + optRecord.invoicingTime === null || | |
1178 | + optRecord.invoicingTime === undefined | |
1179 | + ? TAGS_COLOR.get(optRecord.invoicingStatus) | |
1180 | + : 'success' | |
1181 | + } | |
1182 | + > | |
1183 | + {getNeedInvoicing(optRecord)} | |
1184 | + </Tag> | |
1185 | + </div> | |
1186 | + ) : ( | |
1187 | + '' | |
1188 | + )} | |
1189 | + | |
1190 | + {/* 订单状态 */} | |
1191 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1192 | + {getOrderStatusTag(optRecord)} | |
1193 | + </div> | |
1194 | + | |
1195 | + {/* 确认发票状态 */} | |
1196 | + {optRecord.invoiceConfirmStatusText !== null && ( | |
1197 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1198 | + <Tag color={'success'} style={{ marginRight: '4px' }}> | |
1199 | + {optRecord.invoiceConfirmStatusText} | |
1200 | + </Tag> | |
1201 | + </div> | |
1202 | + )} | |
1203 | + | |
1204 | + {/* 后置审核状态 */} | |
1205 | + {optRecord.postAuditStatus !== null ? ( | |
1206 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1207 | + {getPostAuditStatusTag(optRecord)} | |
1208 | + </div> | |
1209 | + ) : ( | |
1210 | + '' | |
1211 | + )} | |
1212 | + | |
1213 | + {/**采购是否已下单状态 */} | |
1214 | + {optRecord.procureOrderStatus !== null && | |
1215 | + optRecord.procureOrderStatus !== undefined ? ( | |
1216 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1217 | + <Tag color="success"> | |
1218 | + {enumValueToLabel( | |
1219 | + optRecord.procureOrderStatus, | |
1220 | + PROCURE_ORDER_STATUS, | |
1221 | + )} | |
1222 | + </Tag> | |
1223 | + </div> | |
1224 | + ) : ( | |
1225 | + '' | |
1226 | + )} | |
1227 | + | |
1228 | + {/* 物流信息 */} | |
1229 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1230 | + {optRecord.orderStatus === 'CONFIRM_RECEIPT' || | |
1231 | + optRecord.orderStatus === 'AFTER_SALES_COMPLETION' || | |
1232 | + optRecord.orderStatus === 'IN_AFTER_SALES' || | |
1233 | + optRecord.orderStatus === 'SHIPPED' ? ( | |
1234 | + <MyToolTip | |
1235 | + title={ | |
1236 | + optRecord.serialNumber === undefined | |
1237 | + ? '暂无物流信息' | |
1238 | + : enumValueToLabel( | |
1239 | + optRecord.logisticsMethod, | |
1240 | + LOGISTICS_STATUS_OPTIONS, | |
1241 | + ) + | |
1242 | + ' ' + | |
1243 | + optRecord.serialNumber + | |
1244 | + ' ' + | |
1245 | + optRecord.logisticsNotes | |
1246 | + } | |
1247 | + content={ | |
1248 | + <Button type="link" size="small" style={{ padding: 0 }}> | |
1249 | + 物流信息 | |
1250 | + </Button> | |
1251 | + } | |
1252 | + /> | |
1253 | + ) : ( | |
1254 | + '' | |
1255 | + )} | |
1256 | + | |
1257 | + {/* 修改审核状态 */} | |
1258 | + {optRecord.modifiedAuditStatus !== null && | |
1259 | + optRecord.modifiedAuditStatus !== 'AUDIT_FAILURE' ? ( | |
1260 | + <div className="overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
1261 | + <Tooltip | |
1262 | + title={recordOptNode ? recordOptNode : <Spin />} | |
1263 | + onOpenChange={(open) => { | |
1264 | + console.log('open:' + open); | |
1265 | + console.log('id:' + optRecord.id); | |
1266 | + if (open) { | |
1267 | + triggerRecordOptNode(optRecord.id); | |
1268 | + } else { | |
1269 | + setRecordOptNode(null); | |
1270 | + } | |
1271 | + }} | |
1272 | + > | |
1273 | + <Tag color={TAGS_COLOR.get(optRecord.modifiedAuditStatus)}> | |
1274 | + {enumValueToLabel( | |
1275 | + optRecord.modifiedAuditStatus, | |
1276 | + MODIFIED_AUDIT_STATUS_OPTIONS, | |
1277 | + )} | |
1278 | + </Tag> | |
1279 | + </Tooltip> | |
1280 | + </div> | |
1281 | + ) : ( | |
1282 | + '' | |
1283 | + )} | |
1284 | + | |
1285 | + {optRecord.modifiedAuditStatus === 'AUDIT_FAILURE' ? ( | |
1286 | + <MyToolTip | |
1287 | + key="key" | |
1288 | + title={optRecord.modifiedAuditNotes} | |
1289 | + content={ | |
1290 | + <> | |
1291 | + <Tag | |
1292 | + color={TAGS_COLOR.get(optRecord.modifiedAuditNotes)} | |
1293 | + style={{ marginRight: '4px' }} | |
1294 | + > | |
1295 | + {enumValueToLabel( | |
1296 | + optRecord.modifiedAuditStatus, | |
1297 | + MODIFIED_AUDIT_STATUS_OPTIONS, | |
1298 | + )} | |
1299 | + </Tag> | |
1300 | + <QuestionCircleOutlined style={{ color: '#C1C1C1' }} /> | |
1301 | + </> | |
1302 | + } | |
1303 | + /> | |
1304 | + ) : ( | |
1305 | + '' | |
1306 | + )} | |
1307 | + </div> | |
1308 | + </Flex> | |
1309 | + <Flex className="w-[18%]" wrap="wrap" gap="small"> | |
1310 | + {optRecord.paths?.includes('postAudit') ? ( | |
1311 | + <Button | |
1312 | + className="p-0" | |
1313 | + type="link" | |
1314 | + onClick={() => { | |
1315 | + createOptObject(optRecord.id, record.id); | |
1316 | + setCheckVisible(true); | |
1317 | + setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT); | |
1318 | + }} | |
1319 | + > | |
1320 | + 后置审核 | |
1321 | + </Button> | |
1322 | + ) : ( | |
1323 | + '' | |
1324 | + )} | |
1325 | + {/* 加急审核 */} | |
1326 | + {optRecord.paths?.includes('URGENT_INVOICE_AUDITING') ? ( | |
1327 | + <Button | |
1328 | + className="p-0" | |
1329 | + type="link" | |
1330 | + onClick={() => { | |
1331 | + console.log('here'); | |
1332 | + setCurrentMainId(record.id); | |
1333 | + setCurretnOptSubId(optRecord.id); | |
1334 | + setCheckVisible(true); | |
1335 | + setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING); | |
1336 | + }} | |
1337 | + > | |
1338 | + 加急审核(新) | |
1339 | + </Button> | |
1340 | + ) : ( | |
1341 | + '' | |
1342 | + )} | |
1343 | + {optRecord.paths?.includes('URGENT_INVOICE_AUDITING_old') ? ( | |
1344 | + <Button | |
1345 | + className="p-0" | |
1346 | + type="link" | |
1347 | + onClick={() => { | |
1348 | + console.log('here'); | |
1349 | + setCurrentMainId(record.id); | |
1350 | + setCurretnOptSubId(optRecord.id); | |
1351 | + setCheckVisible(true); | |
1352 | + setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD); | |
1353 | + }} | |
1354 | + > | |
1355 | + 加急审核(旧) | |
1356 | + </Button> | |
1357 | + ) : ( | |
1358 | + '' | |
1359 | + )} | |
1360 | + {optRecord.paths?.includes('salesConfirm') && ( | |
1361 | + <ButtonConfirm | |
1362 | + className="p-0" | |
1363 | + title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。" | |
1364 | + text="订单确认" | |
1365 | + onConfirm={async () => { | |
1366 | + let res = await postServiceOrderSalesConfirm({ | |
1367 | + data: { | |
1368 | + subOrderIds: [optRecord.id], | |
1369 | + }, | |
1370 | + }); | |
1371 | + | |
1372 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
1373 | + message.success(res.message); | |
1374 | + refreshTable(); | |
1375 | + } | |
1376 | + }} | |
1377 | + /> | |
1378 | + )} | |
1379 | + {optRecord.paths?.includes('uploadPaymentReceiptBill') ? ( | |
1380 | + <Button | |
1381 | + className="p-0" | |
1382 | + type="link" | |
1383 | + onClick={() => { | |
1384 | + createOptObject(optRecord.id, record.id); | |
1385 | + setUploadPayBillModalVisible(true); | |
1386 | + }} | |
1387 | + > | |
1388 | + 回款 | |
1389 | + </Button> | |
1390 | + ) : ( | |
1391 | + '' | |
1392 | + )} | |
1393 | + {optRecord.paths?.includes('reissue_old') ? ( | |
1394 | + /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'|| | |
1395 | + optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/ | |
1396 | + <Button | |
1397 | + className="p-0" | |
1398 | + type="link" | |
1399 | + onClick={() => { | |
1400 | + setCurrentMainId(record.id); | |
1401 | + setReissueVisibleOld(true); | |
1402 | + }} | |
1403 | + > | |
1404 | + 重新开票(旧) | |
1405 | + </Button> | |
1406 | + ) : ( | |
1407 | + '' | |
1408 | + )} | |
1409 | + {optRecord.paths?.includes('reissue') ? ( | |
1410 | + /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'|| | |
1411 | + optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/ | |
1412 | + <Button | |
1413 | + className="p-0" | |
1414 | + type="link" | |
1415 | + onClick={() => { | |
1416 | + setCurrentMainId(record.id); | |
1417 | + setCurretnOptSubId(optRecord.id); | |
1418 | + setReissueVisible(true); | |
1419 | + }} | |
1420 | + > | |
1421 | + 重新开票(新) | |
1422 | + </Button> | |
1423 | + ) : ( | |
1424 | + '' | |
1425 | + )} | |
1426 | + | |
1427 | + {optRecord.paths?.includes('confirmReissue_old') ? ( | |
1428 | + <Button | |
1429 | + className="p-0" | |
1430 | + type="link" | |
1431 | + onClick={() => { | |
1432 | + setCurrentMainId(record.id); | |
1433 | + setCurretnOptSubId(optRecord.id); | |
1434 | + setCheckVisible(true); | |
1435 | + setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD); | |
1436 | + }} | |
1437 | + > | |
1438 | + 重新开票审核(旧) | |
1439 | + </Button> | |
1440 | + ) : ( | |
1441 | + '' | |
1442 | + )} | |
1443 | + {optRecord.paths?.includes('confirmReissue') ? ( | |
1444 | + <Button | |
1445 | + className="p-0" | |
1446 | + type="link" | |
1447 | + onClick={() => { | |
1448 | + setCurrentMainId(record.id); | |
1449 | + setCurretnOptSubId(optRecord.id); | |
1450 | + setCheckVisible(true); | |
1451 | + setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE); | |
1452 | + }} | |
1453 | + > | |
1454 | + 重新开票审核(新) | |
1455 | + </Button> | |
1456 | + ) : ( | |
1457 | + '' | |
1458 | + )} | |
1459 | + | |
1460 | + {optRecord.paths?.includes('leaderAudit') ? ( | |
1461 | + <Button | |
1462 | + className="p-0" | |
1463 | + type="link" | |
1464 | + onClick={() => { | |
1465 | + setCurrentMainId(record.id); | |
1466 | + setCurretnOptSubId(optRecord.id); | |
1467 | + setCheckVisible(true); | |
1468 | + setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); | |
1469 | + }} | |
1470 | + > | |
1471 | + 审核 | |
1472 | + </Button> | |
1473 | + ) : ( | |
1474 | + '' | |
1475 | + )} | |
1476 | + | |
1477 | + {optRecord.paths?.includes('creditAudit') ? ( | |
1478 | + <Button | |
1479 | + className="p-0" | |
1480 | + type="link" | |
1481 | + onClick={() => { | |
1482 | + setCurrentMainId(record.id); | |
1483 | + setCurretnOptSubId(optRecord.id); | |
1484 | + setCheckVisible(true); | |
1485 | + setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT); | |
1486 | + }} | |
1487 | + > | |
1488 | + 赊账审核 | |
1489 | + </Button> | |
1490 | + ) : ( | |
1491 | + '' | |
1492 | + )} | |
1493 | + | |
1494 | + {optRecord.paths?.includes('auditPaymentReceipt') ? ( | |
1495 | + <Button | |
1496 | + className="p-0" | |
1497 | + type="link" | |
1498 | + onClick={() => { | |
1499 | + createOptObject(optRecord.id, record.id); | |
1500 | + setCheckVisible(true); | |
1501 | + setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT); | |
1502 | + }} | |
1503 | + > | |
1504 | + 回款审核 | |
1505 | + </Button> | |
1506 | + ) : ( | |
1507 | + '' | |
1508 | + )} | |
1509 | + | |
1510 | + {optRecord.paths?.includes('modifiedAuditRequest') ? ( | |
1511 | + <Button | |
1512 | + className="p-0" | |
1513 | + type="link" | |
1514 | + onClick={() => { | |
1515 | + createOptObject(optRecord.id, record.id); | |
1516 | + setCheckVisible(true); | |
1517 | + setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT); | |
1518 | + }} | |
1519 | + > | |
1520 | + 节点修改审核 | |
1521 | + </Button> | |
1522 | + ) : ( | |
1523 | + '' | |
1524 | + )} | |
1525 | + | |
1526 | + {optRecord.paths?.includes('applyModify') ? ( | |
1527 | + <Button | |
1528 | + className="p-0" | |
1529 | + type="link" | |
1530 | + onClick={() => { | |
1531 | + createOptObject(optRecord.id, record.id); | |
1532 | + setOrderDrawerVisible(true); | |
1533 | + setOrderOptType('order-change-normal'); | |
1534 | + }} | |
1535 | + > | |
1536 | + 申请修改 | |
1537 | + </Button> | |
1538 | + ) : ( | |
1539 | + '' | |
1540 | + )} | |
1541 | + | |
1542 | + {optRecord.paths?.includes('modifiedLeaderAuditRequest') ? ( | |
1543 | + <Button | |
1544 | + className="p-0" | |
1545 | + type="link" | |
1546 | + onClick={() => { | |
1547 | + createOptObject(optRecord.id, record.id); | |
1548 | + setCheckVisible(true); | |
1549 | + setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT); | |
1550 | + }} | |
1551 | + > | |
1552 | + 领导修改审核 | |
1553 | + </Button> | |
1554 | + ) : ( | |
1555 | + '' | |
1556 | + )} | |
1557 | + | |
1558 | + {optRecord.paths?.includes('shippingWarehouseChangeRequest') ? ( | |
1559 | + <Button | |
1560 | + className="p-0" | |
1561 | + type="link" | |
1562 | + onClick={() => { | |
1563 | + setIds([optRecord.id]); | |
1564 | + createOptObject(optRecord.id, record.id); | |
1565 | + setShippingWarehouseChangeModalVisible(true); | |
1566 | + }} | |
1567 | + > | |
1568 | + 修改仓库 | |
1569 | + </Button> | |
1570 | + ) : ( | |
1571 | + '' | |
1572 | + )} | |
1573 | + | |
1574 | + {optRecord.paths?.includes('saleCancelInvoicing_old') ? ( | |
1575 | + <ButtonConfirm | |
1576 | + className="p-0" | |
1577 | + title="确认取消申请开票?" | |
1578 | + text="取消申请(旧)" | |
1579 | + onConfirm={async () => { | |
1580 | + let res = await postServiceOrderSaleCancelInvoicing({ | |
1581 | + data: { | |
1582 | + subOrderIds: [optRecord.id], | |
1583 | + }, | |
1584 | + }); | |
1585 | + | |
1586 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
1587 | + message.success(res.message); | |
1588 | + refreshTable(); | |
1589 | + } | |
1590 | + }} | |
1591 | + /> | |
1592 | + ) : ( | |
1593 | + '' | |
1594 | + )} | |
1595 | + {optRecord.paths?.includes('saleCancelInvoicing') ? ( | |
1596 | + <ButtonConfirm | |
1597 | + className="p-0" | |
1598 | + title="确认取消申请开票?" | |
1599 | + text="取消申请(新)" | |
1600 | + onConfirm={async () => { | |
1601 | + let res = await postServiceInvoiceCancelApply({ | |
1602 | + data: { | |
1603 | + subOrderIds: [optRecord.id], | |
1604 | + }, | |
1605 | + }); | |
1606 | + | |
1607 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
1608 | + message.success(res.message); | |
1609 | + refreshTable(); | |
1610 | + } | |
1611 | + }} | |
1612 | + /> | |
1613 | + ) : ( | |
1614 | + '' | |
1615 | + )} | |
1616 | + {optRecord.paths?.includes('noNeedInvoicingEdit') ? ( | |
1617 | + <Button | |
1618 | + className="p-0" | |
1619 | + type="link" | |
1620 | + onClick={() => { | |
1621 | + createOptObject(optRecord.id, record.id); | |
1622 | + setFinancialEditVisible(true); | |
1623 | + setIsMainOrder(false); | |
1624 | + }} | |
1625 | + > | |
1626 | + 编辑时间 | |
1627 | + </Button> | |
1628 | + ) : ( | |
1629 | + '' | |
1630 | + )} | |
1631 | + {optRecord.paths?.includes('sendProduct') ? ( | |
1632 | + <Button | |
1633 | + className="p-0" | |
1634 | + type="link" | |
1635 | + onClick={() => { | |
1636 | + createOptObject(optRecord.id, record.id); | |
1637 | + setDeliverVisible(true); | |
1638 | + setIsSendProduct(true); | |
1639 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
1640 | + }} | |
1641 | + > | |
1642 | + 仓库发货 | |
1643 | + </Button> | |
1644 | + ) : ( | |
1645 | + '' | |
1646 | + )} | |
1647 | + | |
1648 | + {optRecord.paths?.includes('supplierSendOrder') ? ( | |
1649 | + <Button | |
1650 | + className="p-0" | |
1651 | + type="link" | |
1652 | + onClick={() => { | |
1653 | + optRecord.mainOrderId = record.id; | |
1654 | + setSelectedRows([cloneDeep(optRecord)]); //克隆一份数据,避免后续修改污染 | |
1655 | + setDeliverVisible(true); | |
1656 | + setIsSendProduct(true); | |
1657 | + setOrderCheckType(CHECK_TYPE.SUPPLIER); | |
1658 | + }} | |
1659 | + > | |
1660 | + 供应商发货 | |
1661 | + </Button> | |
1662 | + ) : ( | |
1663 | + '' | |
1664 | + )} | |
1665 | + | |
1666 | + {optRecord.paths?.includes('procureSend') ? ( | |
1667 | + <Button | |
1668 | + className="p-0" | |
1669 | + type="link" | |
1670 | + onClick={() => { | |
1671 | + createOptObject(optRecord.id, record.id); | |
1672 | + setDeliverVisible(true); | |
1673 | + setIsSendProduct(true); | |
1674 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
1675 | + }} | |
1676 | + > | |
1677 | + {isSupplier() ? '发货' : '采购发货'} | |
1678 | + </Button> | |
1679 | + ) : ( | |
1680 | + '' | |
1681 | + )} | |
1682 | + | |
1683 | + {optRecord.paths?.includes('editProductionTime') ? ( | |
1684 | + <Button | |
1685 | + className="p-0" | |
1686 | + type="link" | |
1687 | + onClick={() => { | |
1688 | + createOptObject(optRecord.id, record.id); | |
1689 | + setProductionTimeModalVisible(true); | |
1690 | + }} | |
1691 | + > | |
1692 | + 生产时间 | |
1693 | + </Button> | |
1694 | + ) : ( | |
1695 | + '' | |
1696 | + )} | |
1697 | + | |
1698 | + {optRecord.paths?.includes('queryAnnex') && | |
1699 | + optRecord.listAnnex?.length > 0 ? ( | |
1700 | + <Button | |
1701 | + className="p-0" | |
1702 | + type="link" | |
1703 | + onClick={() => { | |
1704 | + optRecord.mainOrderId = record.id; | |
1705 | + createOptObject(optRecord.id, record.id); | |
1706 | + setAttachmentModalVisible(true); | |
1707 | + }} | |
1708 | + > | |
1709 | + 附件 | |
1710 | + </Button> | |
1711 | + ) : ( | |
1712 | + '' | |
1713 | + )} | |
1714 | + | |
1715 | + {optRecord.paths?.includes('modifySendInformation') ? ( | |
1716 | + <Button | |
1717 | + className="p-0" | |
1718 | + type="link" | |
1719 | + onClick={() => { | |
1720 | + createOptObject(optRecord.id, record.id); | |
1721 | + setDeliverVisible(true); | |
1722 | + setIsSendProduct(false); | |
1723 | + }} | |
1724 | + > | |
1725 | + 修改发货信息 | |
1726 | + </Button> | |
1727 | + ) : ( | |
1728 | + '' | |
1729 | + )} | |
1730 | + | |
1731 | + {optRecord.paths?.includes('printOrder') ? ( | |
1732 | + <Button | |
1733 | + className="p-0" | |
1734 | + type="link" | |
1735 | + onClick={async () => { | |
1736 | + createOptObject(optRecord.id, record.id); | |
1737 | + setOrderPrintVisible(true); | |
1738 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
1739 | + }} | |
1740 | + > | |
1741 | + 仓库打印 | |
1742 | + </Button> | |
1743 | + ) : ( | |
1744 | + '' | |
1745 | + )} | |
1746 | + | |
1747 | + {optRecord.paths?.includes('supplierPrint') ? ( | |
1748 | + <Button | |
1749 | + className="p-0" | |
1750 | + type="link" | |
1751 | + onClick={async () => { | |
1752 | + createOptObject(optRecord.id, record.id); | |
1753 | + setOrderPrintVisible(true); | |
1754 | + setOrderCheckType(CHECK_TYPE.SUPPLIER); | |
1755 | + }} | |
1756 | + > | |
1757 | + 供应商打印 | |
1758 | + </Button> | |
1759 | + ) : ( | |
1760 | + '' | |
1761 | + )} | |
1762 | + | |
1763 | + {optRecord.paths?.includes('procurePrint') ? ( | |
1764 | + <ButtonConfirm | |
1765 | + className="p-0" | |
1766 | + title="确认打印?" | |
1767 | + text="采购打印" | |
1768 | + onConfirm={async () => { | |
1769 | + let res = await postServiceOrderProcurePrint({ | |
1770 | + data: { | |
1771 | + ids: [optRecord.id], | |
1772 | + }, | |
1773 | + }); | |
1774 | + | |
1775 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
1776 | + message.success(res.message); | |
1777 | + refreshTable(); | |
1778 | + } | |
1779 | + }} | |
1780 | + /> | |
1781 | + ) : ( | |
1782 | + // <Button | |
1783 | + // className="p-0" | |
1784 | + // type="link" | |
1785 | + // onClick={async () => { | |
1786 | + // setOrderPrintVisible(true); | |
1787 | + // setSelectedRows([optRecord]); | |
1788 | + // setOrderRow(record); | |
1789 | + // setOrderCheckType(CHECK_TYPE.PROCURE); | |
1790 | + // }} | |
1791 | + // > | |
1792 | + // 采购打印 | |
1793 | + // </Button> | |
1794 | + '' | |
1795 | + )} | |
1796 | + | |
1797 | + {optRecord.paths?.includes('editOrder') && false ? ( | |
1798 | + <Button | |
1799 | + className="p-0" | |
1800 | + type="link" | |
1801 | + onClick={() => { | |
1802 | + createOptObject(optRecord.id, record.id); | |
1803 | + setFinancialVisible(true); | |
1804 | + setIsEdit(true); | |
1805 | + }} | |
1806 | + > | |
1807 | + 编辑 | |
1808 | + </Button> | |
1809 | + ) : ( | |
1810 | + '' | |
1811 | + )} | |
1812 | + | |
1813 | + {optRecord.paths?.includes('invoicing') ? ( | |
1814 | + <Button | |
1815 | + className="p-0" | |
1816 | + type="link" | |
1817 | + onClick={() => { | |
1818 | + createOptObject(optRecord.id, record.id); | |
1819 | + setFinancialVisible(true); | |
1820 | + setIsEdit(false); | |
1821 | + setIsMainOrder(false); | |
1822 | + }} | |
1823 | + > | |
1824 | + 开票 | |
1825 | + </Button> | |
1826 | + ) : ( | |
1827 | + '' | |
1828 | + )} | |
1829 | + | |
1830 | + {optRecord.paths?.includes('applyInvoicing') ? ( | |
1831 | + <Button | |
1832 | + className="p-0" | |
1833 | + type="link" | |
1834 | + onClick={() => { | |
1835 | + setInvoicingDrawerFormVisible(true); | |
1836 | + createOptObject(optRecord.id, record.id); | |
1837 | + setIsEdit(false); | |
1838 | + setIsMainOrder(false); | |
1839 | + }} | |
1840 | + > | |
1841 | + 申请开票(新) | |
1842 | + </Button> | |
1843 | + ) : ( | |
1844 | + '' | |
1845 | + )} | |
1846 | + | |
1847 | + {optRecord.paths?.includes('applyInvoicing_old') ? ( | |
1848 | + <Button | |
1849 | + className="p-0" | |
1850 | + type="link" | |
1851 | + onClick={() => { | |
1852 | + setApplyForInvoicingVisible(true); | |
1853 | + createOptObject(optRecord.id, record.id); | |
1854 | + setIsEdit(false); | |
1855 | + setIsMainOrder(false); | |
1856 | + }} | |
1857 | + > | |
1858 | + 申请开票(旧) | |
1859 | + </Button> | |
1860 | + ) : ( | |
1861 | + '' | |
1862 | + )} | |
1863 | + | |
1864 | + {optRecord.paths?.includes('checkOrder') ? ( | |
1865 | + <Button | |
1866 | + className="p-0" | |
1867 | + type="link" | |
1868 | + onClick={() => { | |
1869 | + setCurrentMainId(record.id); | |
1870 | + setCurretnOptSubId(optRecord.id); | |
1871 | + setCheckVisible(true); | |
1872 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
1873 | + }} | |
1874 | + > | |
1875 | + 审核 | |
1876 | + </Button> | |
1877 | + ) : ( | |
1878 | + '' | |
1879 | + )} | |
1880 | + | |
1881 | + {optRecord.paths?.includes('afterSalesCheck') ? ( | |
1882 | + <Button | |
1883 | + className="p-0" | |
1884 | + type="link" | |
1885 | + onClick={() => { | |
1886 | + createOptObject(optRecord.id, record.id); | |
1887 | + setCheckVisible(true); | |
1888 | + setOrderCheckType(CHECK_TYPE.AFTER_SALES); | |
1889 | + }} | |
1890 | + > | |
1891 | + 售后审核 | |
1892 | + </Button> | |
1893 | + ) : ( | |
1894 | + '' | |
1895 | + )} | |
1896 | + | |
1897 | + {optRecord.paths?.includes('financeCheckOrder') ? ( | |
1898 | + <Button | |
1899 | + className="p-0" | |
1900 | + type="link" | |
1901 | + onClick={() => { | |
1902 | + createOptObject(optRecord.id, record.id); | |
1903 | + setCheckVisible(true); | |
1904 | + setOrderCheckType(CHECK_TYPE.FINALCIAL); | |
1905 | + }} | |
1906 | + > | |
1907 | + 财务审核 | |
1908 | + </Button> | |
1909 | + ) : ( | |
1910 | + '' | |
1911 | + )} | |
1912 | + | |
1913 | + {optRecord.paths?.includes('procureCheckOrder') ? ( | |
1914 | + <Button | |
1915 | + className="p-0" | |
1916 | + type="link" | |
1917 | + onClick={() => { | |
1918 | + createOptObject(optRecord.id, record.id); | |
1919 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
1920 | + setProcureCheckModalVisible(true); | |
1921 | + }} | |
1922 | + > | |
1923 | + 采购审核 | |
1924 | + </Button> | |
1925 | + ) : ( | |
1926 | + '' | |
1927 | + )} | |
1928 | + | |
1929 | + {optRecord.paths?.includes('procureConvertProcure') ? ( | |
1930 | + <Button | |
1931 | + className="p-0" | |
1932 | + type="link" | |
1933 | + onClick={() => { | |
1934 | + createOptObject(optRecord.id, record.id); | |
1935 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
1936 | + setProcureConvertModalVisible(true); | |
1937 | + }} | |
1938 | + > | |
1939 | + 转发 | |
1940 | + </Button> | |
1941 | + ) : ( | |
1942 | + '' | |
1943 | + )} | |
1944 | + | |
1945 | + {optRecord.paths?.includes('rePrintOrder') ? ( | |
1946 | + <Button | |
1947 | + className="p-0" | |
1948 | + type="link" | |
1949 | + onClick={() => { | |
1950 | + createOptObject(optRecord.id, record.id); | |
1951 | + setOrderPrintVisible(true); | |
1952 | + setIsRePrintOrder(true); | |
1953 | + }} | |
1954 | + > | |
1955 | + 重新打印 | |
1956 | + </Button> | |
1957 | + ) : ( | |
1958 | + '' | |
1959 | + )} | |
1960 | + | |
1961 | + {optRecord.paths?.includes('confirmReceipt') ? ( | |
1962 | + <Button | |
1963 | + className="p-0" | |
1964 | + type="link" | |
1965 | + onClick={() => { | |
1966 | + createOptObject(optRecord.id, record.id); | |
1967 | + setConfirmReceiptVisible(true); | |
1968 | + }} | |
1969 | + > | |
1970 | + 确认收货 | |
1971 | + </Button> | |
1972 | + ) : ( | |
1973 | + '' | |
1974 | + )} | |
1975 | + | |
1976 | + {optRecord.paths?.includes('applyAfterSales') ? ( | |
1977 | + <Button | |
1978 | + className="p-0" | |
1979 | + type="link" | |
1980 | + onClick={() => { | |
1981 | + createOptObject(optRecord.id, record.id); | |
1982 | + setOrderDrawerVisible(true); | |
1983 | + setOrderOptType('after_sales'); | |
1984 | + }} | |
1985 | + > | |
1986 | + 申请售后 | |
1987 | + </Button> | |
1988 | + ) : ( | |
1989 | + '' | |
1990 | + )} | |
1991 | + | |
1992 | + {optRecord.paths?.includes('procureOrder') ? ( | |
1993 | + <ButtonConfirm | |
1994 | + className="p-0" | |
1995 | + title="是否已下单?" | |
1996 | + text="下单" | |
1997 | + onConfirm={async () => { | |
1998 | + let res = await postServiceOrderProcureOrder({ | |
1999 | + data: { subIds: [optRecord.id] }, | |
2000 | + }); | |
2001 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
2002 | + message.success(res.message); | |
2003 | + refreshTable(); | |
2004 | + return true; | |
2005 | + } | |
2006 | + }} | |
2007 | + /> | |
2008 | + ) : ( | |
2009 | + '' | |
2010 | + )} | |
2011 | + | |
2012 | + {optRecord.paths?.includes('cancelSend') ? ( | |
2013 | + <ButtonConfirm | |
2014 | + className="p-0" | |
2015 | + title="是否取消发货" | |
2016 | + text="取消发货" | |
2017 | + onConfirm={async () => { | |
2018 | + let res = await postServiceOrderCancelSend({ | |
2019 | + data: { subIds: [optRecord.id] }, | |
2020 | + }); | |
2021 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
2022 | + message.success(res.message); | |
2023 | + refreshTable(); | |
2024 | + return true; | |
2025 | + } | |
2026 | + }} | |
2027 | + /> | |
2028 | + ) : ( | |
2029 | + '' | |
2030 | + )} | |
2031 | + | |
2032 | + {optRecord.paths?.includes('noNeedSend') ? ( | |
2033 | + <ButtonConfirm | |
2034 | + className="p-0" | |
2035 | + title="此订单是否无需发货?" | |
2036 | + text="无需发货" | |
2037 | + onConfirm={async () => { | |
2038 | + let res = await postServiceOrderNoNeedSend({ | |
2039 | + data: { ids: [optRecord.id] }, | |
2040 | + }); | |
2041 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
2042 | + message.success(res.message); | |
2043 | + refreshTable(); | |
2044 | + return true; | |
2045 | + } | |
2046 | + }} | |
2047 | + /> | |
2048 | + ) : ( | |
2049 | + '' | |
2050 | + )} | |
2051 | + | |
2052 | + {optRecord.paths?.includes('viewImages') ? ( | |
2053 | + <Button | |
2054 | + className="p-0" | |
2055 | + type="link" | |
2056 | + onClick={() => { | |
2057 | + createOptObject(optRecord.id, record.id); | |
2058 | + setImagesViewerOptType('shippingReceipt'); | |
2059 | + setImagesViewerModalVisible(true); | |
2060 | + }} | |
2061 | + > | |
2062 | + 查看收货凭证 | |
2063 | + </Button> | |
2064 | + ) : ( | |
2065 | + '' | |
2066 | + )} | |
2067 | + | |
2068 | + {optRecord.paths?.includes('confirmDeliver') ? ( | |
2069 | + <Button | |
2070 | + className="p-0" | |
2071 | + type="link" | |
2072 | + onClick={() => { | |
2073 | + createOptObject(optRecord.id, record.id); | |
2074 | + setOrderCheckType(CHECK_TYPE.CONFIRM_DELIVER); | |
2075 | + setCheckVisible(true); | |
2076 | + }} | |
2077 | + > | |
2078 | + 确认发货 | |
2079 | + </Button> | |
2080 | + ) : ( | |
2081 | + '' | |
2082 | + )} | |
2083 | + {optRecord.paths?.includes('feedbackRegistration') ? ( | |
2084 | + <Button | |
2085 | + className="p-0" | |
2086 | + type="link" | |
2087 | + onClick={() => { | |
2088 | + createOptObject(optRecord.id, record.id); | |
2089 | + setFeedbackRegistrationModalVisible(true); | |
2090 | + }} | |
2091 | + > | |
2092 | + 回访登记 | |
2093 | + </Button> | |
2094 | + ) : ( | |
2095 | + '' | |
2096 | + )} | |
2097 | + | |
2098 | + {optRecord.paths?.includes('confirmInvoice') ? ( | |
2099 | + <ButtonConfirm | |
2100 | + className="p-0" | |
2101 | + title="已和客户确认发票??" | |
2102 | + text="确认发票" | |
2103 | + onConfirm={async () => { | |
2104 | + let body = [optRecord.id]; | |
2105 | + const data = await postServiceOrderConfirmInvoice({ | |
2106 | + data: body, | |
2107 | + }); | |
2108 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
2109 | + message.success(data.message); | |
2110 | + refreshTable(); | |
2111 | + } | |
2112 | + }} | |
2113 | + /> | |
2114 | + ) : ( | |
2115 | + '' | |
2116 | + )} | |
2117 | + {optRecord.paths?.includes('orderCancel') ? ( | |
2118 | + <ButtonConfirm | |
2119 | + className="p-0" | |
2120 | + title="确认作废?" | |
2121 | + text="作废" | |
2122 | + onConfirm={async () => { | |
2123 | + let body = { ids: [optRecord.id], checkIsMainOrderId: false }; | |
2124 | + const data = await postServiceOrderOrderCancel({ | |
2125 | + data: body, | |
2126 | + }); | |
2127 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
2128 | + message.success(data.message); | |
2129 | + refreshTable(); | |
2130 | + } | |
2131 | + }} | |
2132 | + /> | |
2133 | + ) : ( | |
2134 | + '' | |
2135 | + )} | |
2136 | + </Flex> | |
2137 | + </Flex> | |
2138 | + | |
2139 | + <Flex title={optRecord.notes}> | |
2140 | + <div | |
2141 | + className="max-w-[1100px] overflow-hidden whitespace-normal overflow-ellipsis hover:cursor-pointer" | |
2142 | + onClick={() => { | |
2143 | + copyToClipboard(optRecord.notes); | |
2144 | + message.info('备注复制成功:' + optRecord.notes); | |
2145 | + }} | |
2146 | + > | |
2147 | + <span className="text-[#8C8C8C]"> | |
2148 | + 备注: | |
2149 | + {optRecord.notes === null ? '暂无备注' : optRecord.notes} | |
2150 | + </span> | |
2151 | + </div> | |
2152 | + {!isSupplier() && (isSales() || isWarehousekeeper() || isAdmin()) && ( | |
2153 | + <EditTwoTone | |
2154 | + className="pl-1 pr-1 hover:curcor-pointer" | |
2155 | + onClick={() => { | |
2156 | + setNotesEditVisible(true); | |
2157 | + setSelectedRows([optRecord.id]); | |
2158 | + setNotes(optRecord.notes); | |
2159 | + setNotesType(1); | |
2160 | + }} | |
2161 | + /> | |
2162 | + )} | |
2163 | + </Flex> | |
2164 | + | |
2165 | + {(isProcure() || isWarehousekeeper() || isSales() || isAdmin()) && | |
2166 | + !isSupplier() ? ( | |
2167 | + <div className="pt-2"> | |
2168 | + <Flex title={optRecord.supplierName}> | |
2169 | + <div> | |
2170 | + <span className="text-[#8C8C8C]"> | |
2171 | + 所属采购: | |
2172 | + {optRecord.supplierName === null | |
2173 | + ? '暂无' | |
2174 | + : optRecord.supplierName} | |
2175 | + </span> | |
2176 | + </div> | |
2177 | + | |
2178 | + <Divider type="vertical" /> | |
2179 | + | |
2180 | + <div className="overflow-hidden whitespace-normal overflow-ellipsis hover:cursor-pointer"> | |
2181 | + <span className="text-[#8C8C8C]"> | |
2182 | + 采购备注: | |
2183 | + {optRecord.procureNotes === null | |
2184 | + ? '暂无备注' | |
2185 | + : optRecord.procureNotes} | |
2186 | + </span> | |
2187 | + </div> | |
2188 | + {/* 编辑备注按钮 */} | |
2189 | + {(isProcure() || isAdmin()) && ( | |
2190 | + <EditTwoTone | |
2191 | + className="pl-1 pr-1 hover:curcor-pointer" | |
2192 | + onClick={() => { | |
2193 | + setSelectedRows([optRecord.id]); | |
2194 | + setNotes(optRecord.procureNotes); | |
2195 | + setNotesEditVisible(true); | |
2196 | + setNotesType(2); | |
2197 | + }} | |
2198 | + /> | |
2199 | + )} | |
2200 | + </Flex> | |
2201 | + | |
2202 | + {(isAdmin() || isProcure()) && ( | |
2203 | + <Flex title={optRecord.supplierNotes}> | |
2204 | + <div className="max-w-[90%] whitespace-no-wrap overflow-hidden overflow-ellipsis"> | |
2205 | + <span className="text-[#8C8C8C]"> | |
2206 | + 供应商备注: | |
2207 | + {optRecord.supplierNotes === null | |
2208 | + ? '暂无备注' | |
2209 | + : optRecord.supplierNotes} | |
2210 | + </span> | |
2211 | + </div> | |
2212 | + {/* 编辑备注按钮 */} | |
2213 | + <EditTwoTone | |
2214 | + className="pl-1 hover:curcor-pointer" | |
2215 | + onClick={() => { | |
2216 | + setSelectedRows([optRecord.id]); | |
2217 | + setNotes(optRecord.supplierNotes); | |
2218 | + setNotesEditVisible(true); | |
2219 | + setNotesType(3); | |
2220 | + }} | |
2221 | + /> | |
2222 | + </Flex> | |
2223 | + )} | |
2224 | + </div> | |
2225 | + ) : ( | |
2226 | + '' | |
2227 | + )} | |
2228 | + | |
2229 | + {isAdmin() || isSales() || isFinance() ? ( | |
2230 | + <Flex title={optRecord.notes} className="pt-2"> | |
2231 | + <div className="flex items-center"> | |
2232 | + <div className="flex items-center max-w-[500px]"> | |
2233 | + <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
2234 | + <Tooltip | |
2235 | + title={optRecord.applyInvoicingNotes} | |
2236 | + placement="topLeft" | |
2237 | + > | |
2238 | + <span className="text-[#8C8C8C]"> | |
2239 | + 申请开票备注: | |
2240 | + {optRecord.applyInvoicingNotes === undefined || | |
2241 | + optRecord.applyInvoicingNotes === null | |
2242 | + ? '暂无备注' | |
2243 | + : optRecord.applyInvoicingNotes} | |
2244 | + </span> | |
2245 | + </Tooltip> | |
2246 | + </div> | |
2247 | + | |
2248 | + {getAfterAnnexList()} | |
2249 | + | |
2250 | + <Tooltip title="编辑"> | |
2251 | + <EditTwoTone | |
2252 | + className="pl-1 hover:curcor-pointer" | |
2253 | + onClick={() => { | |
2254 | + setNotesEditVisible(true); | |
2255 | + setSelectedRows([optRecord.id]); | |
2256 | + setNotes(optRecord.applyInvoicingNotes); | |
2257 | + setNotesType(4); | |
2258 | + }} | |
2259 | + /> | |
2260 | + </Tooltip> | |
2261 | + </div> | |
2262 | + <Divider type="vertical" className="mx-5" /> | |
2263 | + <div className="flex items-center max-w-[500px]"> | |
2264 | + <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
2265 | + <Tooltip title={optRecord.checkNotes} placement="topLeft"> | |
2266 | + <span className="text-[#8C8C8C] mr-3"> | |
2267 | + 财务审核备注: | |
2268 | + {optRecord.checkNotes === undefined || | |
2269 | + optRecord.checkNotes === null | |
2270 | + ? '暂无备注' | |
2271 | + : optRecord.checkNotes} | |
2272 | + </span> | |
2273 | + </Tooltip> | |
2274 | + </div> | |
2275 | + | |
2276 | + {getInvoicingCheckAnnexList()} | |
2277 | + </div> | |
2278 | + </div> | |
2279 | + </Flex> | |
2280 | + ) : ( | |
2281 | + '' | |
2282 | + )} | |
2283 | + | |
2284 | + {isAdmin() || isSales() || isFinance() ? ( | |
2285 | + <Flex title={optRecord.notes} className="pt-2"> | |
2286 | + <div className="flex items-center"> | |
2287 | + <div className="flex items-center max-w-[500px]"> | |
2288 | + <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
2289 | + <Tooltip title={optRecord.reissueNotes} placement="topLeft"> | |
2290 | + <span className="text-[#8C8C8C]"> | |
2291 | + 重新开票备注: | |
2292 | + {optRecord.reissueNotes === undefined || | |
2293 | + optRecord.reissueNotes === null | |
2294 | + ? '暂无备注' | |
2295 | + : optRecord.reissueNotes} | |
2296 | + </span> | |
2297 | + </Tooltip> | |
2298 | + </div> | |
2299 | + | |
2300 | + <Tooltip title="编辑"> | |
2301 | + <EditTwoTone | |
2302 | + className="pl-1 hover:curcor-pointer" | |
2303 | + onClick={() => { | |
2304 | + setNotesEditVisible(true); | |
2305 | + setSelectedRows([optRecord.id]); | |
2306 | + setNotes(optRecord.reissueNotes); | |
2307 | + setNotesType(5); | |
2308 | + }} | |
2309 | + /> | |
2310 | + </Tooltip> | |
2311 | + </div> | |
2312 | + <Divider type="vertical" className="mx-5" /> | |
2313 | + </div> | |
2314 | + </Flex> | |
2315 | + ) : ( | |
2316 | + '' | |
2317 | + )} | |
2318 | + | |
2319 | + {isAdmin() || isSales() ? ( | |
2320 | + <Flex title={optRecord.notes} className="pt-2"> | |
2321 | + <div className="flex items-center"> | |
2322 | + <div className="flex items-center max-w-[500px]"> | |
2323 | + <div className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis"> | |
2324 | + <Tooltip | |
2325 | + title={optRecord.feedbackRegistrationContent} | |
2326 | + placement="topLeft" | |
2327 | + > | |
2328 | + <span className="text-[#8C8C8C] mr-3"> | |
2329 | + 产品回访登记: | |
2330 | + {optRecord.feedbackRegistrationContent === undefined || | |
2331 | + optRecord.feedbackRegistrationContent === null | |
2332 | + ? '暂无' | |
2333 | + : optRecord.feedbackRegistrationContent} | |
2334 | + </span> | |
2335 | + </Tooltip> | |
2336 | + </div> | |
2337 | + </div> | |
2338 | + </div> | |
2339 | + </Flex> | |
2340 | + ) : ( | |
2341 | + '' | |
2342 | + )} | |
2343 | + </> | |
2344 | + ); | |
2345 | + }; | |
2346 | + const expandedRowRender = (record) => { | |
2347 | + let subOrders = record.subOrderInformationLists; | |
2348 | + | |
2349 | + return ( | |
2350 | + <ProTable | |
2351 | + id="sub-table" | |
2352 | + className="w-full " | |
2353 | + showHeader={false} | |
2354 | + columns={[ | |
2355 | + { | |
2356 | + title: 'ID', | |
2357 | + dataIndex: 'id', | |
2358 | + key: 'id', | |
2359 | + render: (text: any, optRecord: any) => { | |
2360 | + return <SubOderRander record={record} optRecord={optRecord} />; | |
2361 | + }, | |
2362 | + }, | |
2363 | + ]} | |
2364 | + rowSelection={{ | |
2365 | + onSelect: (row: any) => { | |
2366 | + let subId = row.id; | |
2367 | + let mainId = row.mainOrderId; | |
2368 | + let newSelectedSubOrderKeys = [...selectedSubOrderKeys]; | |
2369 | + let currentMainOrderSelectedSubOrderList = | |
2370 | + subOrderSelectedMap.get(mainId); | |
2371 | + if (!selectedSubOrderKeys.includes(subId)) { | |
2372 | + //选中子订单 | |
2373 | + newSelectedSubOrderKeys.push(subId); | |
2374 | + | |
2375 | + //在Map中添加对应的主订单中的子订单 | |
2376 | + if (currentMainOrderSelectedSubOrderList) { | |
2377 | + currentMainOrderSelectedSubOrderList.push(row); | |
2378 | + } else { | |
2379 | + currentMainOrderSelectedSubOrderList = [row]; | |
2380 | + } | |
2381 | + | |
2382 | + //如果该主订单的所有子订单都选中了,那么勾选上主订单 | |
2383 | + if ( | |
2384 | + currentMainOrderSelectedSubOrderList?.length === | |
2385 | + mainOrderIdSubOrderIdRelationsMap.get(mainId)?.length | |
2386 | + ) { | |
2387 | + selectedMainOrderKeys.push(mainId, record); | |
2388 | + mainOrderSelectedMap.set(mainId, record); | |
2389 | + } | |
2390 | + | |
2391 | + //如果所有主订单都勾选上了,那么勾选上总选中按钮 | |
2392 | + if ( | |
2393 | + mainOrderSelectedMap?.size === | |
2394 | + mainOrderIdSubOrderIdRelationsMap.size | |
2395 | + ) { | |
2396 | + setAllMainChecked(true); | |
2397 | + } | |
2398 | + } else { | |
2399 | + //取消选中子订单 | |
2400 | + newSelectedSubOrderKeys = newSelectedSubOrderKeys.filter( | |
2401 | + (item) => { | |
2402 | + return item !== subId; | |
2403 | + }, | |
2404 | + ); | |
2405 | + | |
2406 | + removeSelecetMainOrderKeyByMainOrderId(mainId); //某个子订单取消勾选了,对应的主订单也要取消勾选 | |
2407 | + | |
2408 | + //在Map中删除掉对应的主订单中的子订单 | |
2409 | + if (currentMainOrderSelectedSubOrderList) { | |
2410 | + currentMainOrderSelectedSubOrderList = | |
2411 | + currentMainOrderSelectedSubOrderList.filter((item) => { | |
2412 | + return item.id !== subId; | |
2413 | + }); | |
2414 | + } else { | |
2415 | + subOrderSelectedMap.set(mainId, [row]); | |
2416 | + } | |
2417 | + | |
2418 | + mainOrderSelectedMap.delete(mainId); | |
2419 | + //总选中按钮取消选中 | |
2420 | + setAllMainChecked(false); | |
2421 | + } | |
2422 | + | |
2423 | + //如果该主订单已经没有子订单选中,删除key | |
2424 | + if (currentMainOrderSelectedSubOrderList?.length === 0) { | |
2425 | + subOrderSelectedMap.delete(record.id); | |
2426 | + } else { | |
2427 | + subOrderSelectedMap.set( | |
2428 | + record.id, | |
2429 | + currentMainOrderSelectedSubOrderList, | |
2430 | + ); | |
2431 | + } | |
2432 | + | |
2433 | + setSelectedSubOrderKeys(newSelectedSubOrderKeys); | |
2434 | + setSelectedRows(currentMainOrderSelectedSubOrderList); | |
2435 | + }, | |
2436 | + selectedRowKeys: selectedSubOrderKeys, | |
2437 | + // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom | |
2438 | + // 注释该行则默认不显示下拉选项 | |
2439 | + // selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT], | |
2440 | + // defaultSelectedRowKeys: [], | |
2441 | + }} | |
2442 | + rowKey="id" | |
2443 | + headerTitle={false} | |
2444 | + search={false} | |
2445 | + options={false} | |
2446 | + dataSource={subOrders} | |
2447 | + pagination={false} | |
2448 | + tableAlertRender={false} | |
2449 | + /> | |
2450 | + ); | |
2451 | + }; | |
2452 | + | |
2453 | + // 主订单内容渲染 | |
2454 | + const MainOrderColumnRender = ({ record }: { record: OrderListItemType }) => { | |
2455 | + return ( | |
2456 | + <Flex vertical={true}> | |
2457 | + {/* 编号、时间、销售信息 */} | |
2458 | + <Flex | |
2459 | + className="px-4 py-4 bg-white rounded-t-lg" | |
2460 | + justify="space-between" | |
2461 | + > | |
2462 | + <Flex wrap="wrap" gap="middle" vertical> | |
2463 | + <Flex> | |
2464 | + <Flex> | |
2465 | + <Checkbox | |
2466 | + onChange={() => onCheckboxChange(record)} | |
2467 | + checked={selectedMainOrderKeys.includes(record.id)} | |
2468 | + > | |
2469 | + <Space split={<Divider type="vertical" />}> | |
2470 | + <div> | |
2471 | + <span className="text-[#8C8C8C]">订单号:</span> | |
2472 | + <span className="text-slate-700">{record.id}</span> | |
2473 | + {record.modified ? ( | |
2474 | + <Tooltip title="点击查看详情"> | |
2475 | + <span | |
2476 | + className="text-[#f44e4e] cursor-pointer" | |
2477 | + onClick={async () => { | |
2478 | + createOptObject(null, record.id); | |
2479 | + setModifiedDiffModalVisible(true); | |
2480 | + }} | |
2481 | + > | |
2482 | + (修改过) | |
2483 | + </span> | |
2484 | + </Tooltip> | |
2485 | + ) : ( | |
2486 | + '' | |
2487 | + )} | |
2488 | + </div> | |
2489 | + </Space> | |
2490 | + </Checkbox> | |
2491 | + <Tooltip title="点击复制订单号"> | |
2492 | + <CopyOutlined | |
2493 | + className="hover:cursor-pointer" | |
2494 | + style={{ color: '#8C8C8C' }} | |
2495 | + onClick={() => { | |
2496 | + copyToClipboard(record.id); | |
2497 | + message.info('订单号复制成功!'); | |
2498 | + }} | |
2499 | + /> | |
2500 | + </Tooltip> | |
2501 | + <Divider type="vertical" /> | |
2502 | + <span>{formatDateTime(record.createTime)}</span> | |
2503 | + <Divider type="vertical" /> | |
2504 | + <Space split={<Divider type="vertical" />}> | |
2505 | + <div | |
2506 | + className="hover:cursor-pointer" | |
2507 | + onClick={() => { | |
2508 | + copyToClipboard(record.salesCode); | |
2509 | + message.info('代表复制成功:' + record.salesCode); | |
2510 | + }} | |
2511 | + > | |
2512 | + <span className="text-[#8C8C8C]">代表:</span> | |
2513 | + <span className="text-slate-700">{record.salesCode}</span> | |
2514 | + </div> | |
2515 | + {!isSupplier() ? ( | |
2516 | + <> | |
2517 | + <div | |
2518 | + title={record.institution} | |
2519 | + className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" | |
2520 | + > | |
2521 | + <span className="text-[#8C8C8C]">单位:</span> | |
2522 | + <span className="text-slate-700"> | |
2523 | + {record.institution} | |
2524 | + </span> | |
2525 | + </div> | |
2526 | + <span> | |
2527 | + <span className="text-[#8C8C8C]">联系人:</span> | |
2528 | + <span className="text-slate-700"> | |
2529 | + {record.institutionContactName + ' '} | |
2530 | + </span> | |
2531 | + </span> | |
2532 | + </> | |
2533 | + ) : ( | |
2534 | + '' | |
2535 | + )} | |
2536 | + <div | |
2537 | + title={record.institution} | |
2538 | + className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[150px]" | |
2539 | + > | |
2540 | + <span | |
2541 | + className="hover:cursor-pointer" | |
2542 | + onClick={() => { | |
2543 | + copyToClipboard(record.customerName); | |
2544 | + message.info('收货人复制成功:' + record.customerName); | |
2545 | + }} | |
2546 | + > | |
2547 | + <span className="text-[#8C8C8C]">收货人:</span> | |
2548 | + {!isSupplier() && ( | |
2549 | + <Tooltip className="order-tooltip" title="详情"> | |
2550 | + <ContainerTwoTone | |
2551 | + className="px-1 hover:curcor-pointer" | |
2552 | + onClick={() => { | |
2553 | + createOptObject(null, record.id); | |
2554 | + setDeliverInfoDrawerVisible(true); | |
2555 | + }} | |
2556 | + /> | |
2557 | + </Tooltip> | |
2558 | + )} | |
2559 | + <span className="text-slate-700"> | |
2560 | + {record.customerName + ' '} | |
2561 | + </span> | |
2562 | + </span> | |
2563 | + </div> | |
2564 | + | |
2565 | + {isSupplier() ? ( | |
2566 | + <div | |
2567 | + title={record.customerShippingAddress} | |
2568 | + className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px] hover:cursor-pointer" | |
2569 | + onClick={() => { | |
2570 | + copyToClipboard(record.customerShippingAddress); | |
2571 | + message.info( | |
2572 | + '收货地址复制成功:' + record.customerShippingAddress, | |
2573 | + ); | |
2574 | + }} | |
2575 | + > | |
2576 | + <span className="text-[#8C8C8C]">收货地址:</span> | |
2577 | + <span className="text-slate-700"> | |
2578 | + {record.customerShippingAddress} | |
2579 | + </span> | |
2580 | + </div> | |
2581 | + ) : ( | |
2582 | + '' | |
2583 | + )} | |
2584 | + </Space> | |
2585 | + </Flex> | |
2586 | + </Flex> | |
2587 | + | |
2588 | + {isSupplier() ? ( | |
2589 | + <Flex className="pl-6" align="center"> | |
2590 | + <Flex | |
2591 | + className="hover:cursor-pointer" | |
2592 | + onClick={() => { | |
2593 | + copyToClipboard(record.customerContactNumber); | |
2594 | + message.info( | |
2595 | + '联系电话复制成功:' + record.customerContactNumber, | |
2596 | + ); | |
2597 | + }} | |
2598 | + > | |
2599 | + <span className="text-[#8C8C8C]">联系电话:</span> | |
2600 | + <span className="text-slate-700"> | |
2601 | + {record.customerContactNumber + ' '} | |
2602 | + </span> | |
2603 | + </Flex> | |
2604 | + </Flex> | |
2605 | + ) : ( | |
2606 | + '' | |
2607 | + )} | |
2608 | + | |
2609 | + <Flex className="pl-6" align="center"> | |
2610 | + {roleCode === 'finance' ? ( | |
2611 | + <div | |
2612 | + title={enumValueToLabel( | |
2613 | + record.receivingCompany, | |
2614 | + getReceivingCompanyOptions(PAYEE_OPTIONS), | |
2615 | + )} | |
2616 | + className="whitespace-no-wrap overflow-hidden overflow-ellipsis max-w-[400px]" | |
2617 | + > | |
2618 | + <span className="text-[#8C8C8C]">开票收款单位:</span> | |
2619 | + <span className="text-slate-700"> | |
2620 | + {record.receivingCompany !== null | |
2621 | + ? enumValueToLabel( | |
2622 | + record.receivingCompany, | |
2623 | + getReceivingCompanyOptions(PAYEE_OPTIONS), | |
2624 | + ) | |
2625 | + : '暂无'} | |
2626 | + </span> | |
2627 | + </div> | |
2628 | + ) : ( | |
2629 | + '' | |
2630 | + )} | |
2631 | + | |
2632 | + {roleCode === 'finance' ? <Divider type="vertical" /> : ''} | |
2633 | + | |
2634 | + <div title={record.notes}> | |
2635 | + <div | |
2636 | + className="max-w-[850px] whitespace-normal overflow-hidden overflow-ellipsis hover:cursor-pointer" | |
2637 | + onClick={() => { | |
2638 | + copyToClipboard(record.notes); | |
2639 | + message.info('备注复制成功:' + record.notes); | |
2640 | + }} | |
2641 | + > | |
2642 | + <span className="text-[#8C8C8C]">备注:</span> | |
2643 | + <span className="ml-2"> | |
2644 | + {record.notes === null ? '暂无备注' : record.notes} | |
2645 | + </span> | |
2646 | + </div> | |
2647 | + </div> | |
2648 | + | |
2649 | + {!isSupplier() ? ( | |
2650 | + <Tooltip title="编辑"> | |
2651 | + <EditTwoTone | |
2652 | + className="pl-1 hover:curcor-pointer" | |
2653 | + onClick={() => { | |
2654 | + setNotesEditVisible(true); | |
2655 | + setSelectedRows([record.id]); | |
2656 | + setNotes(record.notes); | |
2657 | + setNotesType(0); | |
2658 | + }} | |
2659 | + /> | |
2660 | + </Tooltip> | |
2661 | + ) : ( | |
2662 | + '' | |
2663 | + )} | |
2664 | + | |
2665 | + {record.goodsWeight !== null ? ( | |
2666 | + <div title={record.goodsWeight + 'kg'} className="pl-3"> | |
2667 | + <div | |
2668 | + className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer" | |
2669 | + onClick={() => { | |
2670 | + copyToClipboard(record.goodsWeight + 'kg'); | |
2671 | + message.info( | |
2672 | + '包裹重量复制成功:' + record.goodsWeight + 'kg', | |
2673 | + ); | |
2674 | + }} | |
2675 | + > | |
2676 | + <span className="text-[#8C8C8C]">包裹重量:</span> | |
2677 | + <span className="ml-2">{record.goodsWeight + 'kg'}</span> | |
2678 | + </div> | |
2679 | + </div> | |
2680 | + ) : ( | |
2681 | + '' | |
2682 | + )} | |
2683 | + | |
2684 | + {record.goodsVolume !== null ? ( | |
2685 | + <div title={record.goodsVolume + 'm³'} className="pl-3"> | |
2686 | + <div | |
2687 | + className="max-w-md overflow-hidden whitespace-no-wrap overflow-ellipsis hover:cursor-pointer" | |
2688 | + onClick={() => { | |
2689 | + copyToClipboard(record.goodsVolume + 'm³'); | |
2690 | + message.info( | |
2691 | + '包裹体积复制成功:' + record.goodsVolume + 'm³', | |
2692 | + ); | |
2693 | + }} | |
2694 | + > | |
2695 | + <span className="text-[#8C8C8C]">包裹体积:</span> | |
2696 | + <span className="ml-2">{record.goodsVolume + 'm³'}</span> | |
2697 | + </div> | |
2698 | + </div> | |
2699 | + ) : ( | |
2700 | + '' | |
2701 | + )} | |
2702 | + </Flex> | |
2703 | + </Flex> | |
2704 | + <Flex wrap="wrap" gap="middle" vertical> | |
2705 | + <Flex justify="flex-end"> | |
2706 | + <Flex wrap="wrap" gap="middle" align="center"> | |
2707 | + {!isSupplier() ? ( | |
2708 | + <div> | |
2709 | + <span className="text-[#8C8C8C]">总金额:¥</span> | |
2710 | + <span className="text-lg font-medium"> | |
2711 | + {record.totalPayment} | |
2712 | + </span> | |
2713 | + </div> | |
2714 | + ) : ( | |
2715 | + '' | |
2716 | + )} | |
2717 | + | |
2718 | + {rolePath?.includes('addOrder') ? ( | |
2719 | + <Tooltip title="复制"> | |
2720 | + <CopyTwoTone | |
2721 | + className="hover:cursor-pointer" | |
2722 | + onClick={() => { | |
2723 | + createOptObject(null, record.id); | |
2724 | + copyOrderToClipboard(record); | |
2725 | + setOrderOptType('copy'); | |
2726 | + setOrderDrawerVisible(true); | |
2727 | + }} | |
2728 | + /> | |
2729 | + </Tooltip> | |
2730 | + ) : ( | |
2731 | + <Tooltip title="复制文本"> | |
2732 | + <CopyTwoTone | |
2733 | + className="hover:cursor-pointer" | |
2734 | + onClick={() => { | |
2735 | + copyOrderToClipboard(record); | |
2736 | + }} | |
2737 | + /> | |
2738 | + </Tooltip> | |
2739 | + )} | |
2740 | + {!isSupplier() ? ( | |
2741 | + <Tooltip title="历史"> | |
2742 | + <ClockCircleTwoTone | |
2743 | + className="hover:cursor-pointer" | |
2744 | + onClick={() => { | |
2745 | + setHistoryModalVisible(true); | |
2746 | + if (subOrderSelectedMap.get(record.id)?.length) { | |
2747 | + setSelectedRows(subOrderSelectedMap.get(record.id)); | |
2748 | + } else { | |
2749 | + setSelectedRows(record.subOrderInformationLists); | |
2750 | + } | |
2751 | + }} | |
2752 | + /> | |
2753 | + </Tooltip> | |
2754 | + ) : ( | |
2755 | + '' | |
2756 | + )} | |
2757 | + </Flex> | |
2758 | + </Flex> | |
2759 | + <Flex justify="flex-end"> | |
2760 | + <Space.Compact direction="vertical" align="end"> | |
2761 | + <Space wrap> | |
2762 | + {record.paths?.includes('postAudit') ? ( | |
2763 | + <Button | |
2764 | + className="p-0" | |
2765 | + type="link" | |
2766 | + onClick={() => { | |
2767 | + setCurrentMainId(record.id); | |
2768 | + setCurretnOptSubId(null); | |
2769 | + setCheckVisible(true); | |
2770 | + setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT); | |
2771 | + }} | |
2772 | + > | |
2773 | + 后置审核 | |
2774 | + </Button> | |
2775 | + ) : ( | |
2776 | + '' | |
2777 | + )} | |
2778 | + {record.paths?.includes('URGENT_INVOICE_AUDITING') ? ( | |
2779 | + <Button | |
2780 | + className="p-0" | |
2781 | + type="link" | |
2782 | + onClick={() => { | |
2783 | + createOptObject(null, record.id); | |
2784 | + setCheckVisible(true); | |
2785 | + setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING); | |
2786 | + }} | |
2787 | + > | |
2788 | + 加急审核(新) | |
2789 | + </Button> | |
2790 | + ) : ( | |
2791 | + '' | |
2792 | + )} | |
2793 | + {record.paths?.includes('URGENT_INVOICE_AUDITING_old') ? ( | |
2794 | + <Button | |
2795 | + className="p-0" | |
2796 | + type="link" | |
2797 | + onClick={() => { | |
2798 | + createOptObject(null, record.id); | |
2799 | + setCheckVisible(true); | |
2800 | + setOrderCheckType( | |
2801 | + CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD, | |
2802 | + ); | |
2803 | + }} | |
2804 | + > | |
2805 | + 加急审核(旧) | |
2806 | + </Button> | |
2807 | + ) : ( | |
2808 | + '' | |
2809 | + )} | |
2810 | + {record.paths?.includes('salesConfirm') && ( | |
2811 | + <ButtonConfirm | |
2812 | + className="p-0" | |
2813 | + title="是否确认此商城订单信息无误?确认无误之后订单将进入审核流程。" | |
2814 | + text="订单确认" | |
2815 | + onConfirm={async () => { | |
2816 | + let subIds = subOrderSelectedMap | |
2817 | + .get(record.id) | |
2818 | + ?.map((item) => { | |
2819 | + return item.id; | |
2820 | + }); | |
2821 | + if (subIds === null || subIds === undefined) { | |
2822 | + subIds = record.subOrderInformationLists.map( | |
2823 | + (item) => { | |
2824 | + return item.id; | |
2825 | + }, | |
2826 | + ); | |
2827 | + } | |
2828 | + let res = await postServiceOrderSalesConfirm({ | |
2829 | + data: { | |
2830 | + subOrderIds: subIds, | |
2831 | + }, | |
2832 | + }); | |
2833 | + | |
2834 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
2835 | + message.success(res.message); | |
2836 | + refreshTable(); | |
2837 | + } | |
2838 | + }} | |
2839 | + /> | |
2840 | + )} | |
2841 | + {record.paths?.includes('uploadPaymentReceiptBill') ? ( | |
2842 | + <Button | |
2843 | + className="p-0" | |
2844 | + type="link" | |
2845 | + onClick={() => { | |
2846 | + createOptObject(null, record.id); | |
2847 | + setUploadPayBillModalVisible(true); | |
2848 | + }} | |
2849 | + > | |
2850 | + 回款 | |
2851 | + </Button> | |
2852 | + ) : ( | |
2853 | + '' | |
2854 | + )} | |
2855 | + | |
2856 | + {record.paths?.includes('modifiedAuditRequest') ? ( | |
2857 | + <Button | |
2858 | + className="p-0" | |
2859 | + type="link" | |
2860 | + onClick={() => { | |
2861 | + createOptObject(null, record.id); | |
2862 | + setCheckVisible(true); | |
2863 | + setOrderCheckType(CHECK_TYPE.NODE_OPERATING_AUDIT); | |
2864 | + }} | |
2865 | + > | |
2866 | + 节点修改审核 | |
2867 | + </Button> | |
2868 | + ) : ( | |
2869 | + '' | |
2870 | + )} | |
2871 | + | |
2872 | + {record.paths?.includes('auditPaymentReceipt') ? ( | |
2873 | + <Button | |
2874 | + className="p-0" | |
2875 | + type="link" | |
2876 | + onClick={() => { | |
2877 | + createOptObject(null, record.id); | |
2878 | + setCheckVisible(true); | |
2879 | + setOrderCheckType(CHECK_TYPE.PAYMENT_RECEIPTS_AUDIT); | |
2880 | + }} | |
2881 | + > | |
2882 | + 回款审核 | |
2883 | + </Button> | |
2884 | + ) : ( | |
2885 | + '' | |
2886 | + )} | |
2887 | + | |
2888 | + {record.paths?.includes('modifiedLeaderAuditRequest') ? ( | |
2889 | + <Button | |
2890 | + className="p-0" | |
2891 | + type="link" | |
2892 | + onClick={() => { | |
2893 | + createOptObject(null, record.id); | |
2894 | + setCheckVisible(true); | |
2895 | + setOrderCheckType(CHECK_TYPE.MODIFY_LEADER_AUDIT); | |
2896 | + }} | |
2897 | + > | |
2898 | + 领导修改审核 | |
2899 | + </Button> | |
2900 | + ) : ( | |
2901 | + '' | |
2902 | + )} | |
2903 | + | |
2904 | + {false ? ( | |
2905 | + <Button | |
2906 | + className="p-0" | |
2907 | + type="link" | |
2908 | + onClick={() => { | |
2909 | + createOptObject(null, record.id); | |
2910 | + setFinancialReceiptsModalVisible(true); | |
2911 | + setIsEdit(true); | |
2912 | + }} | |
2913 | + > | |
2914 | + 收款记录 | |
2915 | + </Button> | |
2916 | + ) : ( | |
2917 | + '' | |
2918 | + )} | |
2919 | + | |
2920 | + {record.paths?.includes('reissue_old') ? ( | |
2921 | + /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'|| | |
2922 | + optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/ | |
2923 | + <Button | |
2924 | + className="p-0" | |
2925 | + type="link" | |
2926 | + onClick={() => { | |
2927 | + setCurrentMainId(record.id); | |
2928 | + setReissueVisibleOld(true); | |
2929 | + console.log(reissueVisible); | |
2930 | + }} | |
2931 | + > | |
2932 | + 重新开票(旧) | |
2933 | + </Button> | |
2934 | + ) : ( | |
2935 | + '' | |
2936 | + )} | |
2937 | + | |
2938 | + {record.paths?.includes('confirmReissue_old') ? ( | |
2939 | + <Button | |
2940 | + className="p-0" | |
2941 | + type="link" | |
2942 | + onClick={() => { | |
2943 | + setCurrentMainId(record.id); | |
2944 | + setCurretnOptSubId(null); | |
2945 | + setCheckVisible(true); | |
2946 | + setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE_OLD); | |
2947 | + }} | |
2948 | + > | |
2949 | + 重新开票审核(旧) | |
2950 | + </Button> | |
2951 | + ) : ( | |
2952 | + '' | |
2953 | + )} | |
2954 | + | |
2955 | + {record.paths?.includes('reissue') ? ( | |
2956 | + /*optRecord.afterInvoicingStatus==='PARTIAL_INVOICING'|| | |
2957 | + optRecord.afterInvoicingStatus==='COMPLETE_INVOICING'*/ | |
2958 | + <Button | |
2959 | + className="p-0" | |
2960 | + type="link" | |
2961 | + onClick={() => { | |
2962 | + setCurrentMainId(record.id); | |
2963 | + setReissueVisible(true); | |
2964 | + }} | |
2965 | + > | |
2966 | + 重新开票(新) | |
2967 | + </Button> | |
2968 | + ) : ( | |
2969 | + '' | |
2970 | + )} | |
2971 | + | |
2972 | + {record.paths?.includes('confirmReissue') ? ( | |
2973 | + <Button | |
2974 | + className="p-0" | |
2975 | + type="link" | |
2976 | + onClick={() => { | |
2977 | + setCurrentMainId(record.id); | |
2978 | + setCurretnOptSubId(null); | |
2979 | + setCheckVisible(true); | |
2980 | + setOrderCheckType(CHECK_TYPE.CONFIRM_REISSUE); | |
2981 | + }} | |
2982 | + > | |
2983 | + 重新开票审核(新) | |
2984 | + </Button> | |
2985 | + ) : ( | |
2986 | + '' | |
2987 | + )} | |
2988 | + | |
2989 | + {record.paths?.includes('procureOrder') ? ( | |
2990 | + <ButtonConfirm | |
2991 | + className="p-0" | |
2992 | + title="是否下单?" | |
2993 | + text="下单" | |
2994 | + onConfirm={async () => { | |
2995 | + let subIds = subOrderSelectedMap | |
2996 | + .get(record.id) | |
2997 | + ?.map((item) => { | |
2998 | + return item.id; | |
2999 | + }); | |
3000 | + if (subIds === null || subIds === undefined) { | |
3001 | + subIds = record.subOrderInformationLists.map( | |
3002 | + (item) => { | |
3003 | + return item.id; | |
3004 | + }, | |
3005 | + ); | |
3006 | + } | |
3007 | + let res = await postServiceOrderProcureOrder({ | |
3008 | + data: { subIds: subIds }, | |
3009 | + }); | |
3010 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
3011 | + message.success(res.message); | |
3012 | + refreshTable(); | |
3013 | + return true; | |
3014 | + } | |
3015 | + }} | |
3016 | + /> | |
3017 | + ) : ( | |
3018 | + '' | |
3019 | + )} | |
3020 | + | |
3021 | + {record.paths?.includes('cancelSend') ? ( | |
3022 | + <ButtonConfirm | |
3023 | + className="p-0" | |
3024 | + title="是否取消发货?" | |
3025 | + text="取消发货" | |
3026 | + onConfirm={async () => { | |
3027 | + let subIds = subOrderSelectedMap | |
3028 | + .get(record.id) | |
3029 | + ?.map((item) => { | |
3030 | + return item.id; | |
3031 | + }); | |
3032 | + if (subIds === null || subIds === undefined) { | |
3033 | + subIds = record.subOrderInformationLists.map( | |
3034 | + (item) => { | |
3035 | + return item.id; | |
3036 | + }, | |
3037 | + ); | |
3038 | + } | |
3039 | + let res = await postServiceOrderCancelSend({ | |
3040 | + data: { subIds: subIds }, | |
3041 | + }); | |
3042 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
3043 | + message.success(res.message); | |
3044 | + refreshTable(); | |
3045 | + return true; | |
3046 | + } | |
3047 | + }} | |
3048 | + /> | |
3049 | + ) : ( | |
3050 | + '' | |
3051 | + )} | |
3052 | + | |
3053 | + {record.paths?.includes('applyModify') ? ( | |
3054 | + <Button | |
3055 | + className="p-0" | |
3056 | + type="link" | |
3057 | + onClick={() => { | |
3058 | + createOptObject(null, record.id); | |
3059 | + setOrderDrawerVisible(true); | |
3060 | + setOrderOptType('order-change-normal'); | |
3061 | + }} | |
3062 | + > | |
3063 | + 申请修改 | |
3064 | + </Button> | |
3065 | + ) : ( | |
3066 | + '' | |
3067 | + )} | |
3068 | + | |
3069 | + {record.paths?.includes('leaderAudit') ? ( | |
3070 | + <Button | |
3071 | + className="p-0" | |
3072 | + type="link" | |
3073 | + onClick={() => { | |
3074 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3075 | + record.id, | |
3076 | + ); | |
3077 | + setSelectedRows(selectedSubOrders); | |
3078 | + if (selectedSubOrders === undefined) { | |
3079 | + selectedSubOrders = record.subOrderInformationLists; | |
3080 | + } | |
3081 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3082 | + if ( | |
3083 | + selectedSubOrders[i].orderStatus !== | |
3084 | + 'LEADER_PROCESS' | |
3085 | + ) { | |
3086 | + message.error('请选择领导待审核的子订单进行审核'); | |
3087 | + return; | |
3088 | + } | |
3089 | + } | |
3090 | + createOptObject(null, record.id); | |
3091 | + setCheckVisible(true); | |
3092 | + setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); | |
3093 | + }} | |
3094 | + > | |
3095 | + 审核 | |
3096 | + </Button> | |
3097 | + ) : ( | |
3098 | + '' | |
3099 | + )} | |
3100 | + | |
3101 | + {record.paths?.includes('changeOrderAudit') ? ( | |
3102 | + <Button | |
3103 | + className="p-0" | |
3104 | + type="link" | |
3105 | + onClick={() => { | |
3106 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3107 | + record.id, | |
3108 | + ); | |
3109 | + setSelectedRows(selectedSubOrders); | |
3110 | + if (selectedSubOrders === undefined) { | |
3111 | + selectedSubOrders = record.subOrderInformationLists; | |
3112 | + } | |
3113 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3114 | + if ( | |
3115 | + selectedSubOrders[i].orderStatus !== | |
3116 | + 'MODIFY_APPLY_WAIT_FOR_AUDIT' | |
3117 | + ) { | |
3118 | + message.error('请选择[修改待审核]的子订单进行审核'); | |
3119 | + return; | |
3120 | + } | |
3121 | + } | |
3122 | + createOptObject(null, record.id); | |
3123 | + setCheckVisible(true); | |
3124 | + setOrderCheckType( | |
3125 | + CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT, | |
3126 | + ); | |
3127 | + }} | |
3128 | + > | |
3129 | + 审核 | |
3130 | + </Button> | |
3131 | + ) : ( | |
3132 | + '' | |
3133 | + )} | |
3134 | + | |
3135 | + {record.paths?.includes('creditAudit') ? ( | |
3136 | + <Button | |
3137 | + className="p-0" | |
3138 | + type="link" | |
3139 | + onClick={() => { | |
3140 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3141 | + record.id, | |
3142 | + ); | |
3143 | + setSelectedRows(selectedSubOrders); | |
3144 | + if (selectedSubOrders === undefined) { | |
3145 | + selectedSubOrders = record.subOrderInformationLists; | |
3146 | + } | |
3147 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3148 | + if ( | |
3149 | + selectedSubOrders[i].orderStatus !== | |
3150 | + 'CREDIT_CONFIRM' | |
3151 | + ) { | |
3152 | + message.error('请选择[赊账待审核]的子订单进行审核'); | |
3153 | + return; | |
3154 | + } | |
3155 | + } | |
3156 | + createOptObject(null, record.id); | |
3157 | + setCheckVisible(true); | |
3158 | + setOrderCheckType(CHECK_TYPE.CREDIT_AUDIT); | |
3159 | + }} | |
3160 | + > | |
3161 | + 赊账审核 | |
3162 | + </Button> | |
3163 | + ) : ( | |
3164 | + '' | |
3165 | + )} | |
3166 | + | |
3167 | + {record.paths?.includes('editProductionTime') ? ( | |
3168 | + <Button | |
3169 | + className="p-0" | |
3170 | + type="link" | |
3171 | + onClick={() => { | |
3172 | + createOptObject(null, record.id); | |
3173 | + setProductionTimeModalVisible(true); | |
3174 | + }} | |
3175 | + > | |
3176 | + 生产时间 | |
3177 | + </Button> | |
3178 | + ) : ( | |
3179 | + '' | |
3180 | + )} | |
3181 | + | |
3182 | + {record.paths?.includes('procureConvertProcure') ? ( | |
3183 | + <Button | |
3184 | + className="p-0" | |
3185 | + type="link" | |
3186 | + onClick={() => { | |
3187 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3188 | + record.id, | |
3189 | + ); | |
3190 | + if (selectedSubOrders === undefined) { | |
3191 | + selectedSubOrders = record.subOrderInformationLists; | |
3192 | + } | |
3193 | + | |
3194 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3195 | + if ( | |
3196 | + !selectedSubOrders[i].paths.includes( | |
3197 | + 'procureConvertProcure', | |
3198 | + ) | |
3199 | + ) { | |
3200 | + message.error('请选择允许转发的子订单进行转发'); | |
3201 | + return; | |
3202 | + } | |
3203 | + } | |
3204 | + createOptObject(null, record.id); | |
3205 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
3206 | + setProcureConvertModalVisible(true); | |
3207 | + }} | |
3208 | + > | |
3209 | + 转发 | |
3210 | + </Button> | |
3211 | + ) : ( | |
3212 | + '' | |
3213 | + )} | |
3214 | + {record.paths?.includes('sendProduct') ? ( | |
3215 | + <Button | |
3216 | + className="p-0" | |
3217 | + type="link" | |
3218 | + onClick={() => { | |
3219 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3220 | + return message.error('请选择选择子订单'); | |
3221 | + } | |
3222 | + createOptObject(null, record.id); | |
3223 | + setDeliverVisible(true); | |
3224 | + setIsSendProduct(true); | |
3225 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3226 | + }} | |
3227 | + > | |
3228 | + 仓库发货 | |
3229 | + </Button> | |
3230 | + ) : ( | |
3231 | + '' | |
3232 | + )} | |
3233 | + | |
3234 | + {/* 供应商发货 */} | |
3235 | + {record.paths?.includes('supplierSendOrder') ? ( | |
3236 | + <Button | |
3237 | + className="p-0" | |
3238 | + type="link" | |
3239 | + onClick={() => { | |
3240 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3241 | + return message.error('请选择选择子订单'); | |
3242 | + } | |
3243 | + createOptObject(null, record.id); | |
3244 | + setDeliverVisible(true); | |
3245 | + setIsSendProduct(true); | |
3246 | + setOrderCheckType(CHECK_TYPE.SUPPLIER); | |
3247 | + }} | |
3248 | + > | |
3249 | + 供应商发货 | |
3250 | + </Button> | |
3251 | + ) : ( | |
3252 | + '' | |
3253 | + )} | |
3254 | + | |
3255 | + {record.paths?.includes('procureSend') ? ( | |
3256 | + <Button | |
3257 | + className="p-0" | |
3258 | + type="link" | |
3259 | + onClick={() => { | |
3260 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3261 | + return message.error('请选择选择子订单'); | |
3262 | + } | |
3263 | + createOptObject(null, record.id); | |
3264 | + setDeliverVisible(true); | |
3265 | + setIsSendProduct(true); | |
3266 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
3267 | + }} | |
3268 | + > | |
3269 | + {isSupplier() ? '发货' : '采购发货'} | |
3270 | + </Button> | |
3271 | + ) : ( | |
3272 | + '' | |
3273 | + )} | |
3274 | + | |
3275 | + {record.paths?.includes('printOrder') ? ( | |
3276 | + <Button | |
3277 | + className="p-0" | |
3278 | + type="link" | |
3279 | + onClick={() => { | |
3280 | + const selectedSubOrders = subOrderSelectedMap.get( | |
3281 | + record.id, | |
3282 | + ); | |
3283 | + if (!selectedSubOrders?.length) { | |
3284 | + return message.error('请选择选择子订单'); | |
3285 | + } | |
3286 | + | |
3287 | + for (let subOrderRecord of selectedSubOrders) { | |
3288 | + let paths = subOrderRecord.paths; | |
3289 | + if (!checkePrintable(paths)) { | |
3290 | + return message.error('请选择可以打印的子订单'); | |
3291 | + } | |
3292 | + } | |
3293 | + createOptObject(null, record.id); | |
3294 | + setOrderPrintVisible(true); | |
3295 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3296 | + }} | |
3297 | + > | |
3298 | + 仓库打印 | |
3299 | + </Button> | |
3300 | + ) : ( | |
3301 | + '' | |
3302 | + )} | |
3303 | + | |
3304 | + {record.paths?.includes('supplierPrint') ? ( | |
3305 | + <Button | |
3306 | + className="p-0" | |
3307 | + type="link" | |
3308 | + onClick={() => { | |
3309 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3310 | + return message.error('请选择选择子订单'); | |
3311 | + } | |
3312 | + | |
3313 | + createOptObject(null, record.id); | |
3314 | + setOrderPrintVisible(true); | |
3315 | + setOrderCheckType(CHECK_TYPE.SUPPLIER); | |
3316 | + }} | |
3317 | + > | |
3318 | + 供应商打印 | |
3319 | + </Button> | |
3320 | + ) : ( | |
3321 | + '' | |
3322 | + )} | |
3323 | + | |
3324 | + {record.paths?.includes('rePrintOrder') ? ( | |
3325 | + <Button | |
3326 | + className="p-0" | |
3327 | + type="link" | |
3328 | + onClick={() => { | |
3329 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3330 | + return message.error('请选择选择子订单'); | |
3331 | + } | |
3332 | + createOptObject(null, record.id); | |
3333 | + setOrderPrintVisible(true); | |
3334 | + setIsRePrintOrder(true); | |
3335 | + }} | |
3336 | + > | |
3337 | + 重新打印 | |
3338 | + </Button> | |
3339 | + ) : ( | |
3340 | + '' | |
3341 | + )} | |
3342 | + {record.paths?.includes('confirmReceipt') ? ( | |
3343 | + <Button | |
3344 | + className="p-0" | |
3345 | + type="link" | |
3346 | + onClick={() => { | |
3347 | + createOptObject(null, record.id); | |
3348 | + setConfirmReceiptVisible(true); | |
3349 | + }} | |
3350 | + > | |
3351 | + 确认收货 | |
3352 | + </Button> | |
3353 | + ) : ( | |
3354 | + '' | |
3355 | + )} | |
3356 | + {record.paths?.includes('modifySendInformation') ? ( | |
3357 | + <Button | |
3358 | + className="p-0" | |
3359 | + type="link" | |
3360 | + onClick={() => { | |
3361 | + if (!subOrderSelectedMap.get(record.id)?.length) { | |
3362 | + return message.error( | |
3363 | + '请选择已经发货或者已经确认收货的子订单', | |
3364 | + ); | |
3365 | + } | |
3366 | + for (let row of subOrderSelectedMap.get(record.id)) { | |
3367 | + if ( | |
3368 | + row.orderStatus !== 'CONFIRM_RECEIPT' && | |
3369 | + row.orderStatus !== 'SHIPPED' | |
3370 | + ) { | |
3371 | + return message.error( | |
3372 | + '请选择已经发货或者已经确认收货的子订单', | |
3373 | + ); | |
3374 | + } | |
3375 | + } | |
3376 | + createOptObject(null, record.id); | |
3377 | + setDeliverVisible(true); | |
3378 | + setIsSendProduct(false); | |
3379 | + }} | |
3380 | + > | |
3381 | + 修改发货信息 | |
3382 | + </Button> | |
3383 | + ) : ( | |
3384 | + '' | |
3385 | + )} | |
3386 | + {record.paths?.includes('invoicing') ? ( | |
3387 | + <Button | |
3388 | + type="link" | |
3389 | + className="p-0" | |
3390 | + onClick={() => { | |
3391 | + createOptObject(null, record.id); | |
3392 | + setFinancialVisible(true); | |
3393 | + setIsEdit(false); | |
3394 | + }} | |
3395 | + > | |
3396 | + 开票 | |
3397 | + </Button> | |
3398 | + ) : ( | |
3399 | + '' | |
3400 | + )} | |
3401 | + | |
3402 | + {record.paths?.includes('applyInvoicing_old') ? ( | |
3403 | + <Button | |
3404 | + type="link" | |
3405 | + className="p-0" | |
3406 | + onClick={() => { | |
3407 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3408 | + record.id, | |
3409 | + ); | |
3410 | + if (selectedSubOrders === undefined) { | |
3411 | + selectedSubOrders = record.subOrderInformationLists; | |
3412 | + } | |
3413 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3414 | + if ( | |
3415 | + selectedSubOrders[i].invoicingStatus === | |
3416 | + 'UN_INVOICE' || | |
3417 | + selectedSubOrders[i].afterInvoicingStatus === | |
3418 | + 'APPLY_FOR_INVOICING' | |
3419 | + ) { | |
3420 | + message.error( | |
3421 | + '请选择需要开票且未申请开票的子订单进行申请', | |
3422 | + ); | |
3423 | + return; | |
3424 | + } | |
3425 | + } | |
3426 | + | |
3427 | + createOptObject(null, record.id); | |
3428 | + setApplyForInvoicingVisible(true); | |
3429 | + setIsEdit(false); | |
3430 | + setIsMainOrder(false); | |
3431 | + }} | |
3432 | + > | |
3433 | + 申请开票(旧) | |
3434 | + </Button> | |
3435 | + ) : ( | |
3436 | + '' | |
3437 | + )} | |
3438 | + | |
3439 | + {record.paths?.includes('applyInvoicing') ? ( | |
3440 | + <Button | |
3441 | + type="link" | |
3442 | + className="p-0" | |
3443 | + onClick={() => { | |
3444 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3445 | + record.id, | |
3446 | + ); | |
3447 | + if (selectedSubOrders === undefined) { | |
3448 | + selectedSubOrders = record.subOrderInformationLists; | |
3449 | + } | |
3450 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3451 | + if ( | |
3452 | + selectedSubOrders[i].invoicingStatus === | |
3453 | + 'UN_INVOICE' || | |
3454 | + selectedSubOrders[i].afterInvoicingStatus === | |
3455 | + 'APPLY_FOR_INVOICING' | |
3456 | + ) { | |
3457 | + message.error( | |
3458 | + '请选择需要开票且未申请开票的子订单进行申请', | |
3459 | + ); | |
3460 | + return; | |
3461 | + } | |
3462 | + } | |
3463 | + | |
3464 | + createOptObject(null, record.id); | |
3465 | + setInvoicingDrawerFormVisible(true); | |
3466 | + setIsEdit(false); | |
3467 | + setIsMainOrder(false); | |
3468 | + }} | |
3469 | + > | |
3470 | + 申请开票(新) | |
3471 | + </Button> | |
3472 | + ) : ( | |
3473 | + '' | |
3474 | + )} | |
3475 | + | |
3476 | + {record.paths?.includes('updateOrder') ? ( | |
3477 | + <Button | |
3478 | + className="p-0" | |
3479 | + type="link" | |
3480 | + onClick={() => { | |
3481 | + //勾选的子订单:如果有勾选,后面只校验有勾选的 | |
3482 | + | |
3483 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3484 | + record.id, | |
3485 | + ); | |
3486 | + if ( | |
3487 | + selectedSubOrders === undefined || | |
3488 | + selectedSubOrders.length === 0 | |
3489 | + ) { | |
3490 | + selectedSubOrders = record.subOrderInformationLists; | |
3491 | + } | |
3492 | + for ( | |
3493 | + let index = 0; | |
3494 | + index < selectedSubOrders.length; | |
3495 | + index++ | |
3496 | + ) { | |
3497 | + let orderStatus = | |
3498 | + selectedSubOrders[index].orderStatus; | |
3499 | + //仓库管理员在审核之后的任何时候都可以编辑 | |
3500 | + if ( | |
3501 | + roleCode !== 'warehouseKeeper' && | |
3502 | + roleCode !== 'admin' | |
3503 | + ) { | |
3504 | + //是审核通过及之后的订单 | |
3505 | + if ( | |
3506 | + orderStatus !== 'UNAUDITED' && | |
3507 | + orderStatus !== 'AUDIT_FAILED' && | |
3508 | + orderStatus !== 'LEADER_PROCESS' && | |
3509 | + orderStatus !== 'SALES_CONFIRM' && | |
3510 | + orderStatus !== 'CREDIT_CONFIRM' | |
3511 | + ) { | |
3512 | + message.error( | |
3513 | + '请选择【未审核、审核失败、销售待确认、赊账待审核】的订单进行编辑', | |
3514 | + ); | |
3515 | + return; | |
3516 | + } | |
3517 | + } else { | |
3518 | + //仓库管理员只能编辑是还未审核的订单 | |
3519 | + if ( | |
3520 | + roleCode !== 'admin' && | |
3521 | + (orderStatus === 'UNAUDITED' || | |
3522 | + orderStatus === 'AUDIT_FAILED') | |
3523 | + ) { | |
3524 | + message.error('请选择已审核的订单进行编辑'); | |
3525 | + return; | |
3526 | + } | |
3527 | + } | |
3528 | + } | |
3529 | + | |
3530 | + createOptObject(null, record.id); | |
3531 | + setOrderDrawerVisible(true); | |
3532 | + setOrderOptType('edit'); | |
3533 | + }} | |
3534 | + > | |
3535 | + 编辑 | |
3536 | + </Button> | |
3537 | + ) : ( | |
3538 | + '' | |
3539 | + )} | |
3540 | + | |
3541 | + {record?.subOrderInformationLists[0].paths?.includes( | |
3542 | + 'noNeedInvoicingEdit', | |
3543 | + ) ? ( | |
3544 | + <Button | |
3545 | + className="p-0" | |
3546 | + type="link" | |
3547 | + onClick={() => { | |
3548 | + createOptObject(null, record.id); | |
3549 | + setFinancialEditVisible(true); | |
3550 | + setIsMainOrder(true); | |
3551 | + }} | |
3552 | + > | |
3553 | + 财务编辑 | |
3554 | + </Button> | |
3555 | + ) : ( | |
3556 | + '' | |
3557 | + )} | |
3558 | + | |
3559 | + {record.paths?.includes('checkOrder') ? ( | |
3560 | + <Button | |
3561 | + className="p-0" | |
3562 | + type="link" | |
3563 | + onClick={() => { | |
3564 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3565 | + record.id, | |
3566 | + ); | |
3567 | + setSelectedRows(selectedSubOrders); | |
3568 | + if (selectedSubOrders === undefined) { | |
3569 | + selectedSubOrders = record.subOrderInformationLists; | |
3570 | + } | |
3571 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3572 | + let orderStatus = selectedSubOrders[i].orderStatus; | |
3573 | + if ( | |
3574 | + orderStatus !== 'UNAUDITED' && | |
3575 | + orderStatus !== 'FINANCE_PROCESS' && | |
3576 | + orderStatus !== 'LEADER_AUDITED' | |
3577 | + ) { | |
3578 | + message.error( | |
3579 | + '请选择未审核或者领导已审核的子订单进行审核', | |
3580 | + ); | |
3581 | + return; | |
3582 | + } | |
3583 | + } | |
3584 | + | |
3585 | + createOptObject(null, record.id); | |
3586 | + setCheckVisible(true); | |
3587 | + setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
3588 | + }} | |
3589 | + > | |
3590 | + 审核 | |
3591 | + </Button> | |
3592 | + ) : ( | |
3593 | + '' | |
3594 | + )} | |
3595 | + | |
3596 | + {record.paths?.includes('afterSalesCheck') ? ( | |
3597 | + <Button | |
3598 | + className="p-0" | |
3599 | + type="link" | |
3600 | + onClick={() => { | |
3601 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3602 | + record.id, | |
3603 | + ); | |
3604 | + setSelectedRows(selectedSubOrders); | |
3605 | + if (selectedSubOrders === undefined) { | |
3606 | + selectedSubOrders = record.subOrderInformationLists; | |
3607 | + } | |
3608 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3609 | + if ( | |
3610 | + selectedSubOrders[i].orderStatus !== | |
3611 | + 'IN_AFTER_SALES' | |
3612 | + ) { | |
3613 | + message.error('请选择售后中的子订单进行审核'); | |
3614 | + return; | |
3615 | + } | |
3616 | + } | |
3617 | + | |
3618 | + createOptObject(null, record.id); | |
3619 | + setCheckVisible(true); | |
3620 | + setOrderCheckType(CHECK_TYPE.AFTER_SALES); | |
3621 | + }} | |
3622 | + > | |
3623 | + 售后审核 | |
3624 | + </Button> | |
3625 | + ) : ( | |
3626 | + '' | |
3627 | + )} | |
3628 | + | |
3629 | + {record.paths?.includes('noNeedSend') ? ( | |
3630 | + <ButtonConfirm | |
3631 | + className="p-0" | |
3632 | + title="此订单是否无需发货?" | |
3633 | + text="无需发货" | |
3634 | + onConfirm={async () => { | |
3635 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3636 | + record.id, | |
3637 | + ); | |
3638 | + if (selectedSubOrders === undefined) { | |
3639 | + selectedSubOrders = record.subOrderInformationLists; | |
3640 | + } | |
3641 | + setSelectedRows(selectedSubOrders); | |
3642 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3643 | + if ( | |
3644 | + selectedSubOrders[i].orderStatus !== 'AUDITED' && | |
3645 | + selectedSubOrders[i].orderStatus !== | |
3646 | + 'PROCURE_PROCESS' && | |
3647 | + selectedSubOrders[i].orderStatus !== | |
3648 | + 'PROCURE_PROCESS_FOR_MINE' && | |
3649 | + selectedSubOrders[i].orderStatus !== | |
3650 | + 'PROCURE_WAIT_SHIP' && | |
3651 | + selectedSubOrders[i].orderStatus !== | |
3652 | + 'SUPPLIER_WAIT_SHIP' && | |
3653 | + selectedSubOrders[i].orderStatus !== 'WAIT_SHIP' | |
3654 | + ) { | |
3655 | + message.error( | |
3656 | + '请选择未发货的子订单进行无需发货操作', | |
3657 | + ); | |
3658 | + return; | |
3659 | + } | |
3660 | + } | |
3661 | + | |
3662 | + const data = await postServiceOrderNoNeedSend({ | |
3663 | + data: { | |
3664 | + ids: selectedSubOrders.map((item) => { | |
3665 | + return item.id; | |
3666 | + }), | |
3667 | + }, | |
3668 | + }); | |
3669 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
3670 | + message.success(data.message); | |
3671 | + refreshTable(); | |
3672 | + } | |
3673 | + }} | |
3674 | + /> | |
3675 | + ) : ( | |
3676 | + '' | |
3677 | + )} | |
3678 | + | |
3679 | + {record.paths?.includes('saleCancelInvoicing_old') ? ( | |
3680 | + <ButtonConfirm | |
3681 | + className="p-0" | |
3682 | + title="确认取消申请开票?" | |
3683 | + text="取消申请(旧)" | |
3684 | + onConfirm={async () => { | |
3685 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3686 | + record.id, | |
3687 | + ); | |
3688 | + if (selectedSubOrders === undefined) { | |
3689 | + selectedSubOrders = record.subOrderInformationLists; | |
3690 | + } | |
3691 | + | |
3692 | + console.log(selectedSubOrders); | |
3693 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3694 | + if ( | |
3695 | + selectedSubOrders[i].afterInvoicingStatus !== | |
3696 | + 'APPLY_FOR_INVOICING' | |
3697 | + ) { | |
3698 | + message.error( | |
3699 | + '请选择已[申请开票]的子订单进行取消申请', | |
3700 | + ); | |
3701 | + return; | |
3702 | + } | |
3703 | + } | |
3704 | + let res = await postServiceOrderSaleCancelInvoicing({ | |
3705 | + data: { | |
3706 | + subOrderIds: selectedSubOrders.map((item) => { | |
3707 | + return item.id; | |
3708 | + }), | |
3709 | + }, | |
3710 | + }); | |
3711 | + | |
3712 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
3713 | + message.success(res.message); | |
3714 | + refreshTable(); | |
3715 | + } | |
3716 | + }} | |
3717 | + /> | |
3718 | + ) : ( | |
3719 | + '' | |
3720 | + )} | |
3721 | + {/* 财务审核:主订单暂无 */} | |
3722 | + {record.paths?.includes('financeCheckOrder') ? ( | |
3723 | + <Button | |
3724 | + className="p-0" | |
3725 | + type="link" | |
3726 | + onClick={() => { | |
3727 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3728 | + record.id, | |
3729 | + ); | |
3730 | + setSelectedRows(selectedSubOrders); | |
3731 | + if (selectedSubOrders === undefined) { | |
3732 | + selectedSubOrders = record.subOrderInformationLists; | |
3733 | + } | |
3734 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3735 | + if ( | |
3736 | + selectedSubOrders[i].orderStatus !== 'UNAUDITED' && | |
3737 | + selectedSubOrders[i].orderStatus !== | |
3738 | + 'FINANCE_PROCESS' && | |
3739 | + selectedSubOrders[i].orderStatus !== | |
3740 | + 'LEADER_AUDITED' | |
3741 | + ) { | |
3742 | + message.error( | |
3743 | + '请选择[未审核]、[财务待审核]、[领导已审核]的子订单进行审核', | |
3744 | + ); | |
3745 | + return; | |
3746 | + } | |
3747 | + } | |
3748 | + createOptObject(null, record.id); | |
3749 | + setCheckVisible(true); | |
3750 | + setOrderCheckType(CHECK_TYPE.FINALCIAL); | |
3751 | + }} | |
3752 | + > | |
3753 | + 财务审核 | |
3754 | + </Button> | |
3755 | + ) : ( | |
3756 | + '' | |
3757 | + )} | |
3758 | + | |
3759 | + {/* 采购审核 */} | |
3760 | + {record.paths?.includes('procureCheckOrder') ? ( | |
3761 | + <Button | |
3762 | + className="p-0" | |
3763 | + type="link" | |
3764 | + onClick={() => { | |
3765 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3766 | + record.id, | |
3767 | + ); | |
3768 | + setSelectedRows(selectedSubOrders); | |
3769 | + if (selectedSubOrders === undefined) { | |
3770 | + selectedSubOrders = record.subOrderInformationLists; | |
3771 | + } | |
3772 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3773 | + if ( | |
3774 | + selectedSubOrders[i].orderStatus !== | |
3775 | + 'PROCURE_UN_PROCESS' | |
3776 | + ) { | |
3777 | + message.error('请选择未审核的子订单进行审核'); | |
3778 | + return; | |
3779 | + } | |
3780 | + } | |
3781 | + | |
3782 | + createOptObject(null, record.id); | |
3783 | + setProcureCheckModalVisible(true); | |
3784 | + setOrderCheckType(CHECK_TYPE.PROCURE); | |
3785 | + }} | |
3786 | + > | |
3787 | + 采购审核 | |
3788 | + </Button> | |
3789 | + ) : ( | |
3790 | + '' | |
3791 | + )} | |
3792 | + | |
3793 | + {record.paths?.includes('applyAfterSales') ? ( | |
3794 | + <Button | |
3795 | + className="p-0" | |
3796 | + type="link" | |
3797 | + onClick={() => { | |
3798 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3799 | + record.id, | |
3800 | + ); | |
3801 | + if (selectedSubOrders === undefined) { | |
3802 | + selectedSubOrders = record.subOrderInformationLists; | |
3803 | + } | |
3804 | + setSelectedRows(selectedSubOrders); | |
3805 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3806 | + if ( | |
3807 | + selectedSubOrders[i].orderStatus !== | |
3808 | + 'CONFIRM_RECEIPT' && | |
3809 | + selectedSubOrders[i].orderStatus !== | |
3810 | + 'AFTER_SALES_FAILURE' | |
3811 | + ) { | |
3812 | + message.error('请选择确认收货状态的子订单进行售后'); | |
3813 | + return; | |
3814 | + } | |
3815 | + } | |
3816 | + | |
3817 | + createOptObject(null, record.id); | |
3818 | + setOrderDrawerVisible(true); | |
3819 | + setOrderOptType('after-sales'); | |
3820 | + }} | |
3821 | + > | |
3822 | + 申请售后 | |
3823 | + </Button> | |
3824 | + ) : ( | |
3825 | + '' | |
3826 | + )} | |
3827 | + | |
3828 | + {/* {record.paths?.includes('afterSalesCompletion') ? ( | |
3829 | + <ButtonConfirm | |
3830 | + className="p-0" | |
3831 | + title="售后是否已完成?" | |
3832 | + text="完成售后" | |
3833 | + onConfirm={async () => { | |
3834 | + let selectedSubOrders = subOrderSelectedMap.get(record.id); | |
3835 | + if (selectedSubOrders === undefined) { | |
3836 | + selectedSubOrders = record.subOrderInformationLists; | |
3837 | + } | |
3838 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3839 | + if ( | |
3840 | + selectedSubOrders[i].orderStatus !== | |
3841 | + 'IN_AFTER_SALES' | |
3842 | + ) { | |
3843 | + message.error( | |
3844 | + '请选择售后中状态的子订单进行完成售后', | |
3845 | + ); | |
3846 | + return false; | |
3847 | + } | |
3848 | + } | |
3849 | + | |
3850 | + const ids = selectedSubOrders?.map((item) => { | |
3851 | + return item.id; | |
3852 | + }); | |
3853 | + | |
3854 | + let body = { | |
3855 | + ids: ids, | |
3856 | + }; | |
3857 | + const data = await postServiceOrderAfterSalesCompletion( | |
3858 | + { | |
3859 | + data: body, | |
3860 | + }, | |
3861 | + ); | |
3862 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
3863 | + message.success(data.message); | |
3864 | + refreshTable(); | |
3865 | + } | |
3866 | + }} | |
3867 | + /> | |
3868 | + ) : ( | |
3869 | + '' | |
3870 | + )} */} | |
3871 | + | |
3872 | + {record.paths?.includes('salOrderSave') ? ( | |
3873 | + <ButtonConfirm | |
3874 | + className="p-0" | |
3875 | + title="是否推送至金蝶ERP?" | |
3876 | + text="推送ERP" | |
3877 | + onConfirm={async () => { | |
3878 | + let res = await postKingdeeRepSalOrderSave({ | |
3879 | + data: { | |
3880 | + id: record.id, | |
3881 | + }, | |
3882 | + }); | |
3883 | + | |
3884 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
3885 | + message.success('推送成功'); | |
3886 | + mainTableRef.current.reload(); | |
3887 | + } | |
3888 | + }} | |
3889 | + /> | |
3890 | + ) : ( | |
3891 | + '' | |
3892 | + )} | |
3893 | + | |
3894 | + {record.paths?.includes('salBillOutbound') ? ( | |
3895 | + <ButtonConfirm | |
3896 | + className="p-0" | |
3897 | + title="是否下推金蝶ERP出库单?" | |
3898 | + text="下推出库" | |
3899 | + onConfirm={async () => { | |
3900 | + let res = await postKingdeeRepSalBillOutbound({ | |
3901 | + data: { | |
3902 | + id: record.id, | |
3903 | + }, | |
3904 | + }); | |
3905 | + | |
3906 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
3907 | + message.success('下推成功'); | |
3908 | + mainTableRef.current.reload(); | |
3909 | + } | |
3910 | + }} | |
3911 | + /> | |
3912 | + ) : ( | |
3913 | + '' | |
3914 | + )} | |
3915 | + | |
3916 | + {record.paths?.includes('confirmInvoice') ? ( | |
3917 | + <ButtonConfirm | |
3918 | + className="p-0" | |
3919 | + title="已和客户确认发票?" | |
3920 | + text="确认发票" | |
3921 | + onConfirm={async () => { | |
3922 | + let body = [ | |
3923 | + ...record.subOrderInformationLists.map( | |
3924 | + (subOrder) => subOrder.id, | |
3925 | + ), | |
3926 | + ]; | |
3927 | + const data = await postServiceOrderConfirmInvoice({ | |
3928 | + data: body, | |
3929 | + }); | |
3930 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
3931 | + message.success(data.message); | |
3932 | + refreshTable(); | |
3933 | + } | |
3934 | + }} | |
3935 | + /> | |
3936 | + ) : ( | |
3937 | + '' | |
3938 | + )} | |
3939 | + | |
3940 | + {record.paths?.includes('orderCancel') ? ( | |
3941 | + <ButtonConfirm | |
3942 | + className="p-0" | |
3943 | + title="确认作废?" | |
3944 | + text="作废" | |
3945 | + onConfirm={async () => { | |
3946 | + let body = { | |
3947 | + ids: [record.id], | |
3948 | + checkIsMainOrderId: true, | |
3949 | + }; | |
3950 | + const data = await postServiceOrderOrderCancel({ | |
3951 | + data: body, | |
3952 | + }); | |
3953 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
3954 | + message.success(data.message); | |
3955 | + refreshTable(); | |
3956 | + } | |
3957 | + }} | |
3958 | + /> | |
3959 | + ) : ( | |
3960 | + '' | |
3961 | + )} | |
3962 | + | |
3963 | + {record.paths?.includes('procurePrint') ? ( | |
3964 | + <ButtonConfirm | |
3965 | + className="p-0" | |
3966 | + title="确认打印?" | |
3967 | + text="采购打印" | |
3968 | + onConfirm={async () => { | |
3969 | + let selectedSubOrders = subOrderSelectedMap.get( | |
3970 | + record.id, | |
3971 | + ); | |
3972 | + if (selectedSubOrders === undefined) { | |
3973 | + selectedSubOrders = record.subOrderInformationLists; | |
3974 | + } | |
3975 | + for (let i = 0; i < selectedSubOrders.length; i++) { | |
3976 | + if ( | |
3977 | + selectedSubOrders[i].orderStatus !== | |
3978 | + 'PROCURE_PROCESS_FOR_MINE' | |
3979 | + ) { | |
3980 | + message.error( | |
3981 | + '请选择采购待打印状态的子订单进行打印', | |
3982 | + ); | |
3983 | + return false; | |
3984 | + } | |
3985 | + } | |
3986 | + | |
3987 | + const ids = selectedSubOrders?.map((item) => { | |
3988 | + return item.id; | |
3989 | + }); | |
3990 | + let res = await postServiceOrderProcurePrint({ | |
3991 | + data: { | |
3992 | + ids: ids, | |
3993 | + }, | |
3994 | + }); | |
3995 | + | |
3996 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
3997 | + message.success(res.message); | |
3998 | + refreshTable(); | |
3999 | + } | |
4000 | + }} | |
4001 | + /> | |
4002 | + ) : ( | |
4003 | + // <Button | |
4004 | + // className="p-0" | |
4005 | + // type="link" | |
4006 | + // onClick={() => { | |
4007 | + // if (!subOrderSelectedMap.get(record.id)?.length) { | |
4008 | + // return message.error('请选择选择子订单'); | |
4009 | + // } | |
4010 | + // setSelectedRows(subOrderSelectedMap.get(record.id)); | |
4011 | + // setOrderRow(record); | |
4012 | + // setOrderPrintVisible(true); | |
4013 | + // setOrderCheckType(CHECK_TYPE.PROCURE); | |
4014 | + // }} | |
4015 | + // > | |
4016 | + // 采购打印 | |
4017 | + // </Button> | |
4018 | + '' | |
4019 | + )} | |
4020 | + </Space> | |
4021 | + </Space.Compact> | |
4022 | + </Flex> | |
4023 | + </Flex> | |
4024 | + </Flex> | |
4025 | + | |
4026 | + <Flex className="p-0 pb-[24px] pt-[4px] pl-[23px] pr-[5px] bg-white rounded-b-lg"> | |
4027 | + {expandedRowRender(record)} | |
4028 | + </Flex> | |
4029 | + </Flex> | |
4030 | + ); | |
4031 | + }; | |
4032 | + | |
4033 | + // 主订单列表 | |
4034 | + const mainOrdersColumns: ProColumns<OrderType>[] = MAIN_ORDER_COLUMNS.map( | |
4035 | + (item) => { | |
4036 | + //首能账号只能搜索订单编号 | |
4037 | + let canSearchIndex = [ | |
4038 | + 'id', | |
4039 | + 'salesCode', | |
4040 | + 'subNotes', | |
4041 | + 'orderStatus', | |
4042 | + 'createTime', | |
4043 | + 'modifiedAuditStatus', | |
4044 | + ]; | |
4045 | + if (isSupplier() && !canSearchIndex.includes(item.dataIndex)) { | |
4046 | + item.search = false; | |
4047 | + } | |
4048 | + | |
4049 | + canSearchIndex = [ | |
4050 | + 'id', | |
4051 | + 'salesCode', | |
4052 | + 'customerName', | |
4053 | + 'institution', | |
4054 | + 'productName', | |
4055 | + 'orderStatus', | |
4056 | + 'createTime', | |
4057 | + ]; | |
4058 | + | |
4059 | + if (isExaminer() && !canSearchIndex.includes(item.dataIndex)) { | |
4060 | + item.search = false; | |
4061 | + } | |
4062 | + | |
4063 | + if (item.dataIndex === 'name') { | |
4064 | + return { | |
4065 | + ...item, | |
4066 | + title: <OrderTableHeader />, | |
4067 | + render: (text, record) => { | |
4068 | + return <MainOrderColumnRender record={record} />; | |
4069 | + }, | |
4070 | + }; | |
4071 | + } | |
4072 | + | |
4073 | + /** | |
4074 | + * 采购的订单状态筛选内容 | |
4075 | + */ | |
4076 | + if (roles.includes('PROCURE') && item.dataIndex === 'orderStatus') { | |
4077 | + item.valueEnum = enumToProTableEnumValue( | |
4078 | + PROCURE_PRIMARY_ORDER_STATUS_OPTIONS, | |
4079 | + ); | |
4080 | + } | |
4081 | + return item; | |
4082 | + }, | |
4083 | + ); | |
4084 | + | |
4085 | + /** | |
4086 | + * 采购可以筛选供应商备注 | |
4087 | + */ | |
4088 | + // if ( | |
4089 | + // (roleCode === 'procure' || | |
4090 | + // roles.includes('PROCURE') || | |
4091 | + // roleCode === 'admin') && | |
4092 | + // !isSupplier() | |
4093 | + // ) { | |
4094 | + // mainOrdersColumns.push({ | |
4095 | + // title: '供应商备注', | |
4096 | + // width: 120, | |
4097 | + // dataIndex: 'supplierNotes', | |
4098 | + // valueType: 'text', | |
4099 | + // hideInTable: true, | |
4100 | + // }); | |
4101 | + // } | |
4102 | + | |
4103 | + /** | |
4104 | + * 采购可以筛选其他采购 | |
4105 | + */ | |
4106 | + // if ( | |
4107 | + // (roleCode === 'procure' || | |
4108 | + // roles.includes('PROCURE') || | |
4109 | + // roleCode === 'admin') && | |
4110 | + // !isSupplier() | |
4111 | + // ) { | |
4112 | + // mainOrdersColumns.push({ | |
4113 | + // title: '采购名称', | |
4114 | + // width: 120, | |
4115 | + // dataIndex: 'supplierName', | |
4116 | + // valueType: 'select', | |
4117 | + // request: async () => { | |
4118 | + // const res = await postServiceOrderProvideProcurementRoles(); | |
4119 | + // let options = res.data?.map((item) => { | |
4120 | + // return { label: item, value: item }; | |
4121 | + // }); | |
4122 | + // return options; | |
4123 | + // }, | |
4124 | + // hideInTable: true, | |
4125 | + // }); | |
4126 | + // } | |
4127 | + | |
4128 | + /** | |
4129 | + * 排除采购 | |
4130 | + */ | |
4131 | + // if ( | |
4132 | + // (roleCode === 'procure' || | |
4133 | + // roles.includes('PROCURE') || | |
4134 | + // roleCode === 'admin') && | |
4135 | + // !isSupplier() | |
4136 | + // ) { | |
4137 | + // mainOrdersColumns.push({ | |
4138 | + // title: '采购排除', | |
4139 | + // width: 120, | |
4140 | + // dataIndex: 'excludeProcureNames', | |
4141 | + // fieldProps: { | |
4142 | + // mode: 'multiple', | |
4143 | + // }, | |
4144 | + // valueType: 'select', | |
4145 | + // request: async () => { | |
4146 | + // const res = await postServiceOrderProvideProcurementRoles(); | |
4147 | + // let options = res.data?.map((item) => { | |
4148 | + // return { label: item, value: item }; | |
4149 | + // }); | |
4150 | + // return options; | |
4151 | + // }, | |
4152 | + // hideInTable: true, | |
4153 | + // }); | |
4154 | + // } | |
4155 | + | |
4156 | + /** | |
4157 | + * 仓库可以筛选发货仓库 | |
4158 | + */ | |
4159 | + // if (roleCode === 'warehouseKeeper' || roleCode === 'admin') { | |
4160 | + // mainOrdersColumns.push({ | |
4161 | + // title: '发货仓库', | |
4162 | + // width: 120, | |
4163 | + // dataIndex: 'shippingWarehouse', | |
4164 | + // valueType: 'select', | |
4165 | + // valueEnum: enumToProTableEnumValue(SHIPPING_WAREHOUSE_OPTIONS), | |
4166 | + // hideInTable: true, | |
4167 | + // }); | |
4168 | + // } | |
4169 | + | |
4170 | + //判断是否是采购,是的话新增一个筛选条件 | |
4171 | + // if ( | |
4172 | + // roleCode === 'procure' || | |
4173 | + // roles.includes('PROCURE') || | |
4174 | + // roleCode === 'admin' | |
4175 | + // ) { | |
4176 | + // mainOrdersColumns.push({ | |
4177 | + // title: isSupplier() ? '下单状态' : '采购下单状态', | |
4178 | + // dataIndex: 'procureOrderStatus', | |
4179 | + // valueType: 'select', | |
4180 | + // hideInTable: true, | |
4181 | + // valueEnum: enumToProTableEnumValue(PROCURE_ORDER_STATUS), | |
4182 | + // }); | |
4183 | + // } | |
4184 | + | |
4185 | + function toolBarRender() { | |
4186 | + let toolBtns = []; | |
4187 | + let radios: any[] = []; | |
4188 | + let afterSalesRadios: any[] = []; | |
4189 | + radios.push(<Radio value={0}>全部</Radio>); | |
4190 | + | |
4191 | + // if ( | |
4192 | + // roleCode === 'admin' || | |
4193 | + // roleCode === 'salesManager' || | |
4194 | + // roles.includes('PROCURE') || | |
4195 | + // roleCode === 'salesRepresentative' | |
4196 | + // ) { | |
4197 | + // radios.push(<Radio value={70}>只看作废</Radio>); | |
4198 | + // } | |
4199 | + | |
4200 | + // if (roleCode === 'warehouseKeeper') { | |
4201 | + // radios.push(<Radio value={40}>待处理</Radio>); | |
4202 | + // } | |
4203 | + | |
4204 | + // //采购可以筛选出需要处理的订单 | |
4205 | + // if (roles.includes('PROCURE') && !isSupplier()) { | |
4206 | + // radios.push(<Radio value={60}>其他采购</Radio>); | |
4207 | + // radios.push(<Radio value={10}>待处理</Radio>); | |
4208 | + // } | |
4209 | + | |
4210 | + // //财务可以将需要处理的订单排序到前面 | |
4211 | + // if (roleCode === 'finance') { | |
4212 | + // radios.push(<Radio value={50}>加急</Radio>); | |
4213 | + | |
4214 | + // radios.push(<Radio value={40}>待处理</Radio>); | |
4215 | + | |
4216 | + // radios.push(<Checkbox onChange={financeSorted}>排序</Checkbox>); | |
4217 | + // } | |
4218 | + | |
4219 | + // if (roleCode === 'salesRepresentative' || roleCode === 'salesManager') { | |
4220 | + // radios.push(<Radio value={30}>只看我创建</Radio>); | |
4221 | + | |
4222 | + // radios.push(<Radio value={40}>待审核</Radio>); | |
4223 | + // } | |
4224 | + | |
4225 | + // if (roleCode === 'admin') { | |
4226 | + // radios.push(<Radio value={10}>待处理</Radio>); | |
4227 | + // radios.push(<Checkbox onChange={financeSorted}>排序</Checkbox>); | |
4228 | + // } | |
4229 | + | |
4230 | + afterSalesRadios.push(<Radio value={0}>全部</Radio>); | |
4231 | + afterSalesRadios.push(<Radio value={'IN_AFTER_SALES'}>售后中</Radio>); | |
4232 | + afterSalesRadios.push( | |
4233 | + <Radio value={'AFTER_SALES_COMPLETION'}>售后完成</Radio>, | |
4234 | + ); | |
4235 | + afterSalesRadios.push( | |
4236 | + <Radio value={'AFTER_SALES_FAILURE'}>售后失败</Radio>, | |
4237 | + ); | |
4238 | + | |
4239 | + //筛选按钮配置 | |
4240 | + // let radioGroup = ( | |
4241 | + // <Radio.Group | |
4242 | + // onChange={(e: any) => { | |
4243 | + // setFilterCondition(e.target.value); | |
4244 | + // refreshTable(); | |
4245 | + // }} | |
4246 | + // defaultValue={0} | |
4247 | + // > | |
4248 | + // {radios} | |
4249 | + // </Radio.Group> | |
4250 | + // ); | |
4251 | + | |
4252 | + let afterSalesRadioGroup = ( | |
4253 | + <Radio.Group | |
4254 | + onChange={(e: any) => { | |
4255 | + if (e.target.value === 0) { | |
4256 | + setFilterCondition(e.target.value); | |
4257 | + setFilterOrderStatus(''); | |
4258 | + } else { | |
4259 | + setFilterOrderStatus(e.target.value); | |
4260 | + } | |
4261 | + refreshTable(); | |
4262 | + }} | |
4263 | + defaultValue={0} | |
4264 | + > | |
4265 | + {afterSalesRadios} | |
4266 | + </Radio.Group> | |
4267 | + ); | |
4268 | + | |
4269 | + toolBtns.push(afterSalesRadioGroup); | |
4270 | + | |
4271 | + // toolBtns.push(<ImportExpressBillModal></ImportExpressBillModal>); | |
4272 | + | |
4273 | + //导出按钮配置 | |
4274 | + const exportItems: MenuProps['items'] = [ | |
4275 | + { | |
4276 | + label: '导出查询结果订单', | |
4277 | + key: '2', | |
4278 | + onClick: async () => { | |
4279 | + let body = { flag: 50, ...searchParams }; | |
4280 | + exportLoading(); | |
4281 | + downloadFile( | |
4282 | + '/api/service/order/export', | |
4283 | + '订单导出结果.xls', | |
4284 | + 'POST', | |
4285 | + body, | |
4286 | + exportLoadingDestory, | |
4287 | + ); | |
4288 | + }, | |
4289 | + }, | |
4290 | + { | |
4291 | + label: '导出已选中订单', | |
4292 | + key: '1', | |
4293 | + onClick: async () => { | |
4294 | + if (mainOrderSelectedMap.size === 0) { | |
4295 | + message.error('请选择订单'); | |
4296 | + return; | |
4297 | + } | |
4298 | + let body = { flag: 30, id: Array.from(mainOrderSelectedMap.keys()) }; | |
4299 | + exportLoading(); | |
4300 | + downloadFile( | |
4301 | + '/api/service/order/export', | |
4302 | + '订单导出结果.xls', | |
4303 | + 'POST', | |
4304 | + body, | |
4305 | + exportLoadingDestory, | |
4306 | + ); | |
4307 | + }, | |
4308 | + }, | |
4309 | + { | |
4310 | + label: '导出当天订单', | |
4311 | + key: '4', | |
4312 | + onClick: async () => { | |
4313 | + let body = { flag: 40, ids: [] }; | |
4314 | + exportLoading(); | |
4315 | + downloadFile( | |
4316 | + '/api/service/order/export', | |
4317 | + '订单导出结果.xls', | |
4318 | + 'POST', | |
4319 | + body, | |
4320 | + exportLoadingDestory, | |
4321 | + ); | |
4322 | + }, | |
4323 | + }, | |
4324 | + { | |
4325 | + label: '导出所有订单', | |
4326 | + key: '3', | |
4327 | + onClick: async () => { | |
4328 | + let body = { flag: 10, ids: [] }; | |
4329 | + exportLoading(); | |
4330 | + downloadFile( | |
4331 | + '/api/service/order/export', | |
4332 | + '订单导出结果.xls', | |
4333 | + 'POST', | |
4334 | + body, | |
4335 | + exportLoadingDestory, | |
4336 | + ); | |
4337 | + }, | |
4338 | + }, | |
4339 | + ]; | |
4340 | + | |
4341 | + const exportMenuProps = { | |
4342 | + items: exportItems, | |
4343 | + onClick: () => {}, | |
4344 | + }; | |
4345 | + | |
4346 | + // //一键审核按钮配置 | |
4347 | + // const auditItems: MenuProps['items'] = [ | |
4348 | + // { | |
4349 | + // label: '后置审核', | |
4350 | + // key: '1', | |
4351 | + // onClick: async () => { | |
4352 | + // setIsMainOrder(true); | |
4353 | + // setCheckVisible(true); | |
4354 | + // setOrderCheckType(CHECK_TYPE.WAITING_FOR_POST_AUDIT); | |
4355 | + // }, | |
4356 | + // }, | |
4357 | + // { | |
4358 | + // label: '加急开票审核(旧)', | |
4359 | + // key: '2', | |
4360 | + // disabled: true, | |
4361 | + // onClick: async () => { | |
4362 | + // setIsMainOrder(true); | |
4363 | + // setCheckVisible(true); | |
4364 | + // setOrderCheckType(CHECK_TYPE.URGENT_INVOICE_AUDITING_OLD); | |
4365 | + // }, | |
4366 | + // }, | |
4367 | + // { | |
4368 | + // label: '领导审核', | |
4369 | + // key: '3', | |
4370 | + // onClick: async () => { | |
4371 | + // setIsMainOrder(true); | |
4372 | + // setCheckVisible(true); | |
4373 | + // setOrderCheckType(CHECK_TYPE.LEADER_AUDIT); | |
4374 | + // }, | |
4375 | + // }, | |
4376 | + // { | |
4377 | + // label: '修改申请审核', | |
4378 | + // key: '4', | |
4379 | + // onClick: async () => { | |
4380 | + // setIsMainOrder(true); | |
4381 | + // setCheckVisible(true); | |
4382 | + // setOrderCheckType(CHECK_TYPE.MODIFY_APPLY_WAIT_FOR_AUDIT); | |
4383 | + // }, | |
4384 | + // }, | |
4385 | + // ]; | |
4386 | + | |
4387 | + // const auditProps = { | |
4388 | + // items: auditItems, | |
4389 | + // onClick: () => { }, | |
4390 | + // }; | |
4391 | + | |
4392 | + // if (rolePath?.includes('leaderMergeAudit')) { | |
4393 | + // toolBtns.push( | |
4394 | + // <Dropdown | |
4395 | + // disabled={selectedSubOrderKeys.length === 0} | |
4396 | + // menu={auditProps} | |
4397 | + // > | |
4398 | + // <Button> | |
4399 | + // <Space> | |
4400 | + // 一键审核 | |
4401 | + // <DownOutlined /> | |
4402 | + // </Space> | |
4403 | + // </Button> | |
4404 | + // </Dropdown>, | |
4405 | + // ); | |
4406 | + // } | |
4407 | + | |
4408 | + // if (rolePath?.includes('mergeAudit')) { | |
4409 | + // toolBtns.push( | |
4410 | + // <Button | |
4411 | + // type="primary" | |
4412 | + // key="out" | |
4413 | + // onClick={() => { | |
4414 | + // setIsMainOrder(true); | |
4415 | + // if (roles.includes('PROCURE')) { | |
4416 | + // setProcureCheckModalVisible(true); | |
4417 | + // } | |
4418 | + | |
4419 | + // if (roleCode === 'warehouseKeeper') { | |
4420 | + // setCheckVisible(true); | |
4421 | + // setOrderCheckType(CHECK_TYPE.WEARHOUSE_KEEPER); | |
4422 | + // } | |
4423 | + // }} | |
4424 | + // disabled={selectedSubOrderKeys?.length === 0} | |
4425 | + // > | |
4426 | + // 一键审核 | |
4427 | + // </Button>, | |
4428 | + // ); | |
4429 | + // } | |
4430 | + | |
4431 | + // if (rolePath?.includes('mergeProcureOrder')) { | |
4432 | + // toolBtns.push( | |
4433 | + // <Button | |
4434 | + // key="mergeProcureOrder" | |
4435 | + // type="primary" | |
4436 | + // disabled={selectedSubOrderKeys.length === 0} | |
4437 | + // onClick={() => { | |
4438 | + // Modal.confirm({ | |
4439 | + // title: '一键下单', | |
4440 | + // content: '选中的订单是否都已下单?', | |
4441 | + // onOk: async () => { | |
4442 | + // let res = await postServiceOrderProcureOrder({ | |
4443 | + // data: { subIds: [...selectedSubOrderKeys.values()].flat() }, | |
4444 | + // }); | |
4445 | + // if (res.result === RESPONSE_CODE.SUCCESS) { | |
4446 | + // message.success(res.message); | |
4447 | + // refreshTable(); | |
4448 | + // return true; | |
4449 | + // } | |
4450 | + // }, | |
4451 | + // }); | |
4452 | + // }} | |
4453 | + // > | |
4454 | + // 一键下单 | |
4455 | + // </Button>, | |
4456 | + // ); | |
4457 | + // } | |
4458 | + | |
4459 | + // if (rolePath?.includes('mergeApplyInvoicing')) { | |
4460 | + // toolBtns.push( | |
4461 | + // <Button | |
4462 | + // type="primary" | |
4463 | + // key="out" | |
4464 | + // onClick={() => { | |
4465 | + // setIsEdit(false); | |
4466 | + // setIsMainOrder(true); | |
4467 | + // setApplyForInvoicingVisible(true); | |
4468 | + // }} | |
4469 | + // disabled={!canMergeInvoicing} /*{selectedSubOrderKeys?.length === 0}*/ | |
4470 | + // > | |
4471 | + // {roleCode === 'admin' ? '合并(销售)' : '合并开票'} | |
4472 | + // </Button>, | |
4473 | + // ); | |
4474 | + // } | |
4475 | + | |
4476 | + // <Button | |
4477 | + // type="primary" | |
4478 | + // key="out" | |
4479 | + // onClick={() => { | |
4480 | + // setIsEdit(false); | |
4481 | + // setIsMainOrder(true); | |
4482 | + // setInvoicingDrawerFormVisible(true); | |
4483 | + // }} | |
4484 | + // disabled={selectedSubOrderKeys?.length === 0} | |
4485 | + // > | |
4486 | + // 申请开票(旧) | |
4487 | + // </Button>; | |
4488 | + | |
4489 | + // if (rolePath?.includes('mergeInvoicing')) { | |
4490 | + // toolBtns.push( | |
4491 | + // <Button | |
4492 | + // type="primary" | |
4493 | + // key="out" | |
4494 | + // onClick={() => { | |
4495 | + // //检查订单状态是否正确 | |
4496 | + // // 遍历Map中的键值对 | |
4497 | + // let errorIds = new Set(); | |
4498 | + // [...subOrderSelectedMap.values()].flat().forEach((subOrder) => { | |
4499 | + // if ( | |
4500 | + // subOrder.afterInvoicingStatus !== 'APPLY_FOR_INVOICING' && | |
4501 | + // subOrder.afterInvoicingStatus !== 'PARTIAL_INVOICING' | |
4502 | + // ) { | |
4503 | + // errorIds.add(subOrder.mainOrderId); | |
4504 | + // return; | |
4505 | + // } | |
4506 | + // }); | |
4507 | + // if (errorIds.size > 0) { | |
4508 | + // message.error( | |
4509 | + // '订单号为:' + | |
4510 | + // [...errorIds.values()].join(',') + | |
4511 | + // '的订单存在不是[申请开票]或者[部分开票]状态的子订单,请检查!', | |
4512 | + // ); | |
4513 | + // return; | |
4514 | + // } | |
4515 | + // setIsMainOrder(true); | |
4516 | + // setFinancialVisible(true); | |
4517 | + // }} | |
4518 | + // disabled={selectedSubOrderKeys?.length === 0} | |
4519 | + // > | |
4520 | + // {roleCode === 'admin' ? '合并(财务)' : '合并开票'} | |
4521 | + // </Button>, | |
4522 | + // ); | |
4523 | + // } | |
4524 | + | |
4525 | + // toolBtns.push( | |
4526 | + // <Button | |
4527 | + // type="primary" | |
4528 | + // key="inv" | |
4529 | + // onClick={() => { | |
4530 | + // setIsMainOrder(true); | |
4531 | + // let flat = [...subOrderSelectedMap.values()].flat(); | |
4532 | + // //遍历flat,判断afterInvoicingStatusList存在于canApplyAfterInvoicingStatus | |
4533 | + // flat.forEach((item) => { | |
4534 | + // if ( | |
4535 | + // item.invoicingStatus === 'UN_INVOICE' || | |
4536 | + // (item.afterInvoicingStatus !== null && | |
4537 | + // !canApplyAfterInvoicingStatus.includes( | |
4538 | + // item.afterInvoicingStatus, | |
4539 | + // )) | |
4540 | + // ) { | |
4541 | + // message.error('存在不能进行开票的订单'); | |
4542 | + // return; | |
4543 | + // } | |
4544 | + // }); | |
4545 | + // //遍历afterInvoicingStatusList | |
4546 | + // setInvoicingDrawerFormVisible(true); | |
4547 | + // }} | |
4548 | + // disabled={selectedSubOrderKeys?.length === 0} | |
4549 | + // > | |
4550 | + // 申请开票 | |
4551 | + // </Button>, | |
4552 | + // ); | |
4553 | + | |
4554 | + // if (rolePath?.includes('addOrder')) { | |
4555 | + // toolBtns.push( | |
4556 | + // <Button | |
4557 | + // type="primary" | |
4558 | + // key="out" | |
4559 | + // onClick={() => { | |
4560 | + // setOrderDrawerVisible(true); | |
4561 | + // setOrderOptType('add'); | |
4562 | + // }} | |
4563 | + // > | |
4564 | + // 新增 | |
4565 | + // </Button>, | |
4566 | + // ); | |
4567 | + // } | |
4568 | + | |
4569 | + // if (rolePath?.includes('importExcel')) { | |
4570 | + // toolBtns.push( | |
4571 | + // <Button | |
4572 | + // type="primary" | |
4573 | + // key="out" | |
4574 | + // onClick={() => { | |
4575 | + // setImportModalVisible(true); | |
4576 | + // }} | |
4577 | + // > | |
4578 | + // 批量发货 | |
4579 | + // </Button>, | |
4580 | + // ); | |
4581 | + // } | |
4582 | + | |
4583 | + if (rolePath?.includes('export')) { | |
4584 | + toolBtns.push( | |
4585 | + <Dropdown menu={exportMenuProps}> | |
4586 | + <Button> | |
4587 | + <Space> | |
4588 | + 导出 | |
4589 | + <DownOutlined /> | |
4590 | + </Space> | |
4591 | + </Button> | |
4592 | + </Dropdown>, | |
4593 | + ); | |
4594 | + } | |
4595 | + | |
4596 | + return [toolBtns]; | |
4597 | + } | |
4598 | + // 监听 params 变化并重新获取数据 | |
4599 | + useEffect(() => { | |
4600 | + if (paramsNew) { | |
4601 | + setNewParams(paramsNew); | |
4602 | + } | |
4603 | + refreshTable(); | |
4604 | + console.log(paramsNew, '5656paramsNewc', newParams); | |
4605 | + }, [paramsNew]); | |
4606 | + return ( | |
4607 | + <div className="order-page-container"> | |
4608 | + <div id="resizeDiv"></div> | |
4609 | + <div id="resizeDiv"></div> | |
4610 | + <ProTable | |
4611 | + id="main-table" | |
4612 | + // tableStyle={{backgroundColor:'red'}} | |
4613 | + | |
4614 | + actionRef={mainTableRef} | |
4615 | + formRef={mainTableFormRef} | |
4616 | + expandIconColumnIndex={-1} | |
4617 | + columns={mainOrdersColumns} | |
4618 | + rowKey="id" | |
4619 | + pagination={{ | |
4620 | + showQuickJumper: true, | |
4621 | + pageSize: pageSize, | |
4622 | + current: currentPage, | |
4623 | + showSizeChanger: true, | |
4624 | + onChange: (page, size) => { | |
4625 | + setPageSize(size); | |
4626 | + setCurrentPage(page); | |
4627 | + }, | |
4628 | + showTotal: (total, range) => { | |
4629 | + return ( | |
4630 | + <> | |
4631 | + <span> | |
4632 | + {'第 ' + | |
4633 | + range[0] + | |
4634 | + '-' + | |
4635 | + range[1] + | |
4636 | + ' 条/总共 ' + | |
4637 | + total + | |
4638 | + ' 条主订单 '} | |
4639 | + </span> | |
4640 | + <span className="text-[#8C8C8C]"> | |
4641 | + {' (' + subOrderCount + ' 条子订单)'} | |
4642 | + </span> | |
4643 | + </> | |
4644 | + ); | |
4645 | + }, | |
4646 | + }} | |
4647 | + // showHeader={false} | |
4648 | + expandedRowKeys={expandedRowKeys} | |
4649 | + // expandable={{ expandedRowRender }} | |
4650 | + dateFormatter="string" | |
4651 | + options={false} | |
4652 | + headerTitle="" | |
4653 | + search={ | |
4654 | + searchShow | |
4655 | + ? { | |
4656 | + labelWidth: 'auto', | |
4657 | + // onCollapse: resize, | |
4658 | + } | |
4659 | + : false | |
4660 | + } | |
4661 | + request={async ( | |
4662 | + // 第一个参数 params 查询表单和 params 参数的结合 | |
4663 | + // 第一个参数中一定会有 pageSize 和 current ,这两个参数是 antd 的规范 | |
4664 | + params, | |
4665 | + sorter, | |
4666 | + filter, | |
4667 | + ) => { | |
4668 | + //订单id处理 | |
4669 | + /** | |
4670 | + * 以params中的id为主,如果params没id,则取url中的id | |
4671 | + * 第一次进来这个页面,url带有id的话,会自动填充到查询表单中,但是第一次查询params不会带这个id进来 | |
4672 | + */ | |
4673 | + let orderIds = mainTableFormRef.current?.getFieldValue('id'); | |
4674 | + let subOrderId = | |
4675 | + mainTableFormRef.current?.getFieldValue('subOrderId'); | |
4676 | + params.id = params.id || orderIds; | |
4677 | + params.subOrderId = params.subOrderId || subOrderId; | |
4678 | + if (params.id !== '') { | |
4679 | + params.id = params.id?.replace(/ /g, ''); | |
4680 | + if (params.id?.indexOf(',')) { | |
4681 | + params.id = params.id.split(','); | |
4682 | + params.id = params.id.filter((id) => { | |
4683 | + return id !== ''; | |
4684 | + }); | |
4685 | + } | |
4686 | + } | |
4687 | + | |
4688 | + params.condition = filterCondifion; | |
4689 | + params.orderStatus = filterOrderStatus; | |
4690 | + | |
4691 | + //排序 | |
4692 | + // params.sorted = sorted; | |
4693 | + //是否只查看已作废 | |
4694 | + params.isDeleteQueryOrder = filterCondifion === 70; | |
4695 | + if (paramsNew.isDeleteQueryOrderNow === false) { | |
4696 | + params.isDeleteQueryOrder = false; | |
4697 | + } | |
4698 | + //保存这个搜索条件 | |
4699 | + setSearchParam(params); | |
4700 | + const { data } = await postServiceOrderQueryServiceOrder({ | |
4701 | + // ...params, | |
4702 | + // FIXME: remove @ts-ignore | |
4703 | + // @ts-ignore | |
4704 | + sorter, | |
4705 | + filter, | |
4706 | + data: { ...params, ...paramsNew }, | |
4707 | + }); | |
4708 | + | |
4709 | + setRolePath(data.specialPath); | |
4710 | + setSubOrderCount(data.count); | |
4711 | + setAllMainChecked(false); | |
4712 | + setSelectedMainOrderKeys([]); | |
4713 | + subOrderSelectedMap.clear(); | |
4714 | + mainOrderSelectedMap.clear(); | |
4715 | + setData(data?.data); | |
4716 | + | |
4717 | + //主订单id与子订单id的对照关系保存 | |
4718 | + mainOrderIdSubOrderIdRelationsMap.clear(); | |
4719 | + for (let row of data?.data) { | |
4720 | + let mianOrderId = row.id; | |
4721 | + let subOrderIds = row.subOrderInformationLists?.map((item) => { | |
4722 | + //目前子订单存储的totalPayment不准确,这里重新处理取主订单的totalPayment | |
4723 | + //totalPayment在财务开票计算金额时使用到 | |
4724 | + item.totalPayment = row.totalPayment; | |
4725 | + return item.id; | |
4726 | + }); | |
4727 | + mainOrderIdSubOrderIdRelationsMap.set(mianOrderId, subOrderIds); | |
4728 | + } | |
4729 | + | |
4730 | + return { | |
4731 | + data: data?.data || [], | |
4732 | + total: data?.total || 0, | |
4733 | + }; | |
4734 | + }} | |
4735 | + toolbar={{ | |
4736 | + multipleLine: true, | |
4737 | + }} | |
4738 | + toolBarRender={() => { | |
4739 | + if (toolbarShow) { | |
4740 | + return toolBarRender(); | |
4741 | + } | |
4742 | + }} | |
4743 | + /> | |
4744 | + | |
4745 | + {orderDrawerVisible && ( | |
4746 | + <OrderDrawer | |
4747 | + data={orderOptType === 'add' ? {} : buildMainOrder()} | |
4748 | + subOrders={orderOptType === 'add' ? [] : buildSubOrders()} | |
4749 | + onClose={(isSuccess: boolean) => { | |
4750 | + setOrderDrawerVisible(false); | |
4751 | + clearOptObject(); | |
4752 | + if (isSuccess) { | |
4753 | + refreshTable(); | |
4754 | + } | |
4755 | + }} | |
4756 | + orderOptType={orderOptType} | |
4757 | + /> | |
4758 | + )} | |
4759 | + | |
4760 | + {checkVisible && ( | |
4761 | + <CheckModal | |
4762 | + setCheckVisible={(val: boolean) => { | |
4763 | + setCheckVisible(val); | |
4764 | + if (!val) { | |
4765 | + clearOptObject(); | |
4766 | + } | |
4767 | + }} | |
4768 | + data={isMainOrder ? getFirstMainOrder() : buildMainOrder()} | |
4769 | + subOrders={ | |
4770 | + isMainOrder | |
4771 | + ? [...subOrderSelectedMap.values()].flat() | |
4772 | + : buildSubOrders() | |
4773 | + } | |
4774 | + orderCheckType={orderCheckType} | |
4775 | + openOrderDrawer={(type: any, id: any) => { | |
4776 | + setCurrentMainId(id); | |
4777 | + setOrderOptType(type); | |
4778 | + setOrderDrawerVisible(true); | |
4779 | + }} | |
4780 | + onClose={() => { | |
4781 | + clearOptObject(); | |
4782 | + setCheckVisible(false); | |
4783 | + refreshTable(); | |
4784 | + }} | |
4785 | + /> | |
4786 | + )} | |
4787 | + | |
4788 | + {applyForInvoicingVisible && ( | |
4789 | + <ApplyForInvoicingModal | |
4790 | + setCheckVisible={(val: boolean) => { | |
4791 | + setApplyForInvoicingVisible(val); | |
4792 | + if (!val) { | |
4793 | + clearOptObject(); | |
4794 | + } | |
4795 | + }} | |
4796 | + subOrders={ | |
4797 | + isMainOrder | |
4798 | + ? [...subOrderSelectedMap.values()].flat() | |
4799 | + : buildSubOrders() | |
4800 | + } | |
4801 | + totalPayment={getApplyInvoicingTotalPayment()} | |
4802 | + isMainOrder={isMainOrder} | |
4803 | + isEdit={isEdit} | |
4804 | + onClose={() => { | |
4805 | + setApplyForInvoicingVisible(false); | |
4806 | + setIsMainOrder(false); | |
4807 | + clearOptObject(); | |
4808 | + refreshTable(); | |
4809 | + }} | |
4810 | + /> | |
4811 | + )} | |
4812 | + | |
4813 | + {notesEditVisible && ( | |
4814 | + <OrderNotesEditModal | |
4815 | + setNotesEditVisible={(val: boolean) => { | |
4816 | + setNotesEditVisible(val); | |
4817 | + if (!val) { | |
4818 | + clearOptObject(); | |
4819 | + } | |
4820 | + }} | |
4821 | + ids={selectedRows} | |
4822 | + notesType={notesType} | |
4823 | + notes={notes} | |
4824 | + onClose={() => { | |
4825 | + setNotesEditVisible(false); | |
4826 | + setSelectedRows([]); | |
4827 | + setNotes(notes); | |
4828 | + setNotesType(1); | |
4829 | + refreshTable(); | |
4830 | + }} | |
4831 | + /> | |
4832 | + )} | |
4833 | + | |
4834 | + {deliverVisible && ( | |
4835 | + <DeliverModal | |
4836 | + data={buildSubOrders()} | |
4837 | + isSendProduct={isSendProduct} | |
4838 | + setVisible={(val: boolean) => { | |
4839 | + setDeliverVisible(val); | |
4840 | + if (!val) { | |
4841 | + clearOptObject(); | |
4842 | + } | |
4843 | + }} | |
4844 | + sendType={orderCheckType} | |
4845 | + onClose={() => { | |
4846 | + clearOptObject(); | |
4847 | + setDeliverVisible(false); | |
4848 | + setIsSendProduct(false); | |
4849 | + refreshTable(); | |
4850 | + }} | |
4851 | + /> | |
4852 | + )} | |
4853 | + | |
4854 | + {financialVisible && ( | |
4855 | + <FinancialDrawer | |
4856 | + isEdit={isEdit} | |
4857 | + mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()} | |
4858 | + subOrders={ | |
4859 | + isMainOrder | |
4860 | + ? [...subOrderSelectedMap.values()].flat() | |
4861 | + : buildSubOrders() | |
4862 | + } | |
4863 | + isMainOrder={isMainOrder} | |
4864 | + cancel={() => { | |
4865 | + setFinancialVisible(false); | |
4866 | + clearOptObject(); | |
4867 | + setIsMainOrder(false); | |
4868 | + setIsEdit(false); | |
4869 | + }} | |
4870 | + onClose={() => { | |
4871 | + setFinancialVisible(false); | |
4872 | + clearOptObject(); | |
4873 | + refreshTable(); | |
4874 | + setIsMainOrder(false); | |
4875 | + setIsEdit(false); | |
4876 | + }} | |
4877 | + /> | |
4878 | + )} | |
4879 | + | |
4880 | + {financialEditVisible && ( | |
4881 | + <FinancialEditDrawer | |
4882 | + mainOrder={buildMainOrder()} | |
4883 | + subOrders={buildSubOrders()} | |
4884 | + isMainOrder={isMainOrder} | |
4885 | + setVisible={() => { | |
4886 | + setFinancialEditVisible(false); | |
4887 | + clearOptObject(); | |
4888 | + }} | |
4889 | + onClose={() => { | |
4890 | + setFinancialEditVisible(false); | |
4891 | + refreshTable(); | |
4892 | + setIsMainOrder(false); | |
4893 | + clearOptObject(); | |
4894 | + }} | |
4895 | + /> | |
4896 | + )} | |
4897 | + | |
4898 | + {orderPrintVisible && ( | |
4899 | + <OrderPrintModal | |
4900 | + mainOrder={buildMainOrder()} | |
4901 | + subOrders={buildSubOrders()} | |
4902 | + isRePrint={isRePrintOrder} | |
4903 | + setVisible={(val: boolean) => { | |
4904 | + setOrderPrintVisible(val); | |
4905 | + if (!val) { | |
4906 | + clearOptObject(); | |
4907 | + } | |
4908 | + }} | |
4909 | + printOptType={orderCheckType} | |
4910 | + onClose={() => { | |
4911 | + setOrderPrintVisible(false); | |
4912 | + clearOptObject(); | |
4913 | + setIsRePrintOrder(false); | |
4914 | + refreshTable(); | |
4915 | + }} | |
4916 | + /> | |
4917 | + )} | |
4918 | + | |
4919 | + {confirmReceiptVisible && ( | |
4920 | + <ConfirmReceiptModal | |
4921 | + data={buildSubOrders()} | |
4922 | + onClose={() => { | |
4923 | + setConfirmReceiptVisible(false); | |
4924 | + clearOptObject(); | |
4925 | + refreshTable(); | |
4926 | + }} | |
4927 | + /> | |
4928 | + )} | |
4929 | + | |
4930 | + {imagesViewerModalVisible && ( | |
4931 | + <ImagesViewerModal | |
4932 | + optType={imagesViewerOptType} | |
4933 | + setVisible={(val: boolean) => { | |
4934 | + setImagesViewerModalVisible(val); | |
4935 | + if (!val) { | |
4936 | + clearOptObject(); | |
4937 | + } | |
4938 | + }} | |
4939 | + onClose={() => { | |
4940 | + setImagesViewerModalVisible(false); | |
4941 | + }} | |
4942 | + orderRow={buildSubOrders()[0]} | |
4943 | + /> | |
4944 | + )} | |
4945 | + | |
4946 | + {importModalVisible && ( | |
4947 | + <ImportModal | |
4948 | + onClose={() => { | |
4949 | + setImportModalVisible(false); | |
4950 | + refreshTable(); | |
4951 | + }} | |
4952 | + /> | |
4953 | + )} | |
4954 | + | |
4955 | + {attachmentModalVisible && ( | |
4956 | + <AttachmentModal | |
4957 | + data={buildSubOrders()[0]} | |
4958 | + onClose={() => { | |
4959 | + setAttachmentModalVisible(false); | |
4960 | + clearOptObject(); | |
4961 | + }} | |
4962 | + /> | |
4963 | + )} | |
4964 | + | |
4965 | + {historyModalVisible && ( | |
4966 | + <HistoryModal | |
4967 | + subOrders={selectedRows} | |
4968 | + isCancelledOrder={filterCondifion === 70} | |
4969 | + onClose={() => { | |
4970 | + setHistoryModalVisible(false); | |
4971 | + setSelectedRows({}); | |
4972 | + clearOptObject(); | |
4973 | + }} | |
4974 | + /> | |
4975 | + )} | |
4976 | + | |
4977 | + {deliverInfoDrawerVisible && ( | |
4978 | + <DeliverInfoDrawer | |
4979 | + data={buildMainOrder()} | |
4980 | + onClose={() => { | |
4981 | + setDeliverInfoDrawerVisible(false); | |
4982 | + clearOptObject(); | |
4983 | + }} | |
4984 | + /> | |
4985 | + )} | |
4986 | + | |
4987 | + {deliverInfoDrawerVisible && ( | |
4988 | + <DeliverInfoDrawer | |
4989 | + data={buildMainOrder()} | |
4990 | + onClose={() => { | |
4991 | + setDeliverInfoDrawerVisible(false); | |
4992 | + clearOptObject(); | |
4993 | + }} | |
4994 | + /> | |
4995 | + )} | |
4996 | + | |
4997 | + {procureCheckModalVisible && ( | |
4998 | + <ProcureCheckModal | |
4999 | + setCheckVisible={(val: boolean) => { | |
5000 | + setProcureCheckModalVisible(val); | |
5001 | + if (!val) { | |
5002 | + clearOptObject(); | |
5003 | + } | |
5004 | + }} | |
5005 | + isMainOrder={isMainOrder} | |
5006 | + orders={ | |
5007 | + isMainOrder | |
5008 | + ? [...subOrderSelectedMap.values()].flat() | |
5009 | + : buildSubOrders() | |
5010 | + } | |
5011 | + onClose={() => { | |
5012 | + setProcureCheckModalVisible(false); | |
5013 | + clearOptObject(); | |
5014 | + setIsMainOrder(false); | |
5015 | + refreshTable(); | |
5016 | + }} | |
5017 | + /> | |
5018 | + )} | |
5019 | + | |
5020 | + {afterSalesDrawerVisible && ( | |
5021 | + <AfterSalesDrawer | |
5022 | + setVisible={(val: boolean) => { | |
5023 | + setAfterSalesDrawerVisible(val); | |
5024 | + if (!val) { | |
5025 | + clearOptObject(); | |
5026 | + } | |
5027 | + }} | |
5028 | + mainOrder={buildMainOrder()} | |
5029 | + subOrders={buildSubOrders()} | |
5030 | + onClose={() => { | |
5031 | + setAfterSalesDrawerVisible(false); | |
5032 | + clearOptObject(); | |
5033 | + refreshTable(); | |
5034 | + }} | |
5035 | + /> | |
5036 | + )} | |
5037 | + | |
5038 | + {procureConvertModalVisible && ( | |
5039 | + <ProcureConvertModal | |
5040 | + setVisible={(val: boolean) => { | |
5041 | + setProcureConvertModalVisible(val); | |
5042 | + if (!val) { | |
5043 | + clearOptObject(); | |
5044 | + } | |
5045 | + }} | |
5046 | + subOrders={buildSubOrders()} | |
5047 | + onClose={() => { | |
5048 | + setProcureConvertModalVisible(false); | |
5049 | + clearOptObject(); | |
5050 | + refreshTable(); | |
5051 | + }} | |
5052 | + /> | |
5053 | + )} | |
5054 | + | |
5055 | + {financialMergeDrawerVisible && ( | |
5056 | + <FinancialMergeDrawer | |
5057 | + setVisible={(val: boolean) => { | |
5058 | + setFinancialMergeDrawerVisible(val); | |
5059 | + if (!val) { | |
5060 | + clearOptObject(); | |
5061 | + } | |
5062 | + }} | |
5063 | + dataList={ | |
5064 | + isMainOrder | |
5065 | + ? [...subOrderSelectedMap.values()].flat() | |
5066 | + : buildSubOrders() | |
5067 | + } | |
5068 | + onClose={() => { | |
5069 | + setFinancialMergeDrawerVisible(false); | |
5070 | + setIsMainOrder(false); | |
5071 | + clearOptObject(); | |
5072 | + refreshTable(); | |
5073 | + }} | |
5074 | + /> | |
5075 | + )} | |
5076 | + | |
5077 | + {financialReceiptsModalVisible && ( | |
5078 | + <FinancialReceiptsModal | |
5079 | + setVisible={(val: boolean) => { | |
5080 | + setFinancialReceiptsModalVisible(val); | |
5081 | + if (!val) { | |
5082 | + clearOptObject(); | |
5083 | + } | |
5084 | + }} | |
5085 | + datas={selectedRows} | |
5086 | + onClose={() => { | |
5087 | + setFinancialReceiptsModalVisible(false); | |
5088 | + setSelectedRows({}); | |
5089 | + refreshTable(); | |
5090 | + }} | |
5091 | + /> | |
5092 | + )} | |
5093 | + | |
5094 | + {shippingWarehouseChangeModalVisible && ( | |
5095 | + <ShippingWarehouseChangeModal | |
5096 | + setVisible={(val: boolean) => { | |
5097 | + setShippingWarehouseChangeModalVisible(val); | |
5098 | + if (!val) { | |
5099 | + clearOptObject(); | |
5100 | + } | |
5101 | + }} | |
5102 | + subOrderIds={ids} | |
5103 | + originShippingWarehouse={buildSubOrders()[0].shippingWarehouse} | |
5104 | + onClose={() => { | |
5105 | + setShippingWarehouseChangeModalVisible(false); | |
5106 | + clearOptObject(); | |
5107 | + setIds([]); | |
5108 | + refreshTable(); | |
5109 | + }} | |
5110 | + /> | |
5111 | + )} | |
5112 | + {reissueVisible && ( | |
5113 | + <ReissueModal | |
5114 | + setVisible={(val: boolean) => { | |
5115 | + setReissueVisible(val); | |
5116 | + if (!val) { | |
5117 | + clearOptObject(); | |
5118 | + } | |
5119 | + }} | |
5120 | + subOrders={ | |
5121 | + isMainOrder | |
5122 | + ? [...subOrderSelectedMap.values()].flat() | |
5123 | + : buildSubOrders() | |
5124 | + } | |
5125 | + onClose={() => { | |
5126 | + setReissueVisible(false); | |
5127 | + clearOptObject(); | |
5128 | + refreshTable(); | |
5129 | + }} | |
5130 | + /> | |
5131 | + )} | |
5132 | + {reissueVisibleOld && ( | |
5133 | + <ReissueModal_old | |
5134 | + setVisible={(val: boolean) => { | |
5135 | + setReissueVisibleOld(val); | |
5136 | + console.log(reissueVisible); | |
5137 | + if (!val) { | |
5138 | + clearOptObject(); | |
5139 | + } | |
5140 | + }} | |
5141 | + mainOrder={buildMainOrder()} | |
5142 | + subOrders={buildSubOrders()} | |
5143 | + onClose={() => { | |
5144 | + setReissueVisibleOld(false); | |
5145 | + clearOptObject(); | |
5146 | + refreshTable(); | |
5147 | + }} | |
5148 | + /> | |
5149 | + )} | |
5150 | + {productionTimeModalVisible && ( | |
5151 | + <ProductionTimeModal | |
5152 | + setVisible={(val: boolean) => { | |
5153 | + setProductionTimeModalVisible(val); | |
5154 | + if (!val) { | |
5155 | + clearOptObject(); | |
5156 | + } | |
5157 | + }} | |
5158 | + subOrders={buildSubOrders()} | |
5159 | + onClose={() => { | |
5160 | + setProductionTimeModalVisible(false); | |
5161 | + clearOptObject(); | |
5162 | + refreshTable(); | |
5163 | + }} | |
5164 | + /> | |
5165 | + )} | |
5166 | + | |
5167 | + {modifiedDiffModalVisible && ( | |
5168 | + <ModifiedDiffModal | |
5169 | + setVisible={(val: boolean) => { | |
5170 | + setModifiedDiffModalVisible(val); | |
5171 | + if (!val) { | |
5172 | + clearOptObject(); | |
5173 | + } | |
5174 | + }} | |
5175 | + subOrders={buildSubOrders()} | |
5176 | + mainOrder={buildMainOrder()} | |
5177 | + onClose={() => { | |
5178 | + setModifiedDiffModalVisible(false); | |
5179 | + clearOptObject(); | |
5180 | + }} | |
5181 | + /> | |
5182 | + )} | |
5183 | + | |
5184 | + {uploadPayBillModalVisible && ( | |
5185 | + <UploadPayBillModal | |
5186 | + setVisible={(val: boolean) => { | |
5187 | + setUploadPayBillModalVisible(val); | |
5188 | + if (!val) { | |
5189 | + clearOptObject(); | |
5190 | + } | |
5191 | + }} | |
5192 | + subOrders={buildSubOrders()} | |
5193 | + mainOrder={buildMainOrder()} | |
5194 | + onClose={() => { | |
5195 | + setUploadPayBillModalVisible(false); | |
5196 | + clearOptObject(); | |
5197 | + refreshTable(); | |
5198 | + }} | |
5199 | + /> | |
5200 | + )} | |
5201 | + {feedbackRegistrationModalVisible && ( | |
5202 | + <FeedbackRegistrationModal | |
5203 | + setVisible={(val: boolean) => { | |
5204 | + setFeedbackRegistrationModalVisible(val); | |
5205 | + if (!val) { | |
5206 | + clearOptObject(); | |
5207 | + } | |
5208 | + }} | |
5209 | + subOrders={buildSubOrders()} | |
5210 | + mainOrder={buildMainOrder()} | |
5211 | + onClose={() => { | |
5212 | + setFeedbackRegistrationModalVisible(false); | |
5213 | + clearOptObject(); | |
5214 | + refreshTable(); | |
5215 | + }} | |
5216 | + /> | |
5217 | + )} | |
5218 | + | |
5219 | + {invoicingDrawerFormVisible && ( | |
5220 | + <InvoicingDrawerForm | |
5221 | + dataList={ | |
5222 | + isMainOrder | |
5223 | + ? [...subOrderSelectedMap.values()].flat() | |
5224 | + : buildSubOrders() | |
5225 | + } | |
5226 | + setVisible={(val: boolean) => { | |
5227 | + setInvoicingDrawerFormVisible(val); | |
5228 | + if (!val) { | |
5229 | + clearOptObject(); | |
5230 | + } | |
5231 | + }} | |
5232 | + mainOrder={isMainOrder ? getFirstMainOrder() : buildMainOrder()} | |
5233 | + onClose={() => { | |
5234 | + setInvoicingDrawerFormVisible(false); | |
5235 | + setIsMainOrder(true); | |
5236 | + clearOptObject(); | |
5237 | + refreshTable(); | |
5238 | + }} | |
5239 | + /> | |
5240 | + )} | |
5241 | + {contextHolder} | |
5242 | + <FloatButton.BackTop visibilityHeight={0} /> | |
5243 | + </div> | |
5244 | + ); | |
5245 | +}; | |
5246 | + | |
5247 | +export default OrderList; | ... | ... |
src/pages/Order/FeedBack/OrderNotesEditModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderNotesEdit } from '@/services'; | |
3 | +import { ModalForm, ProFormTextArea } from '@ant-design/pro-components'; | |
4 | +import { Form, message } from 'antd'; | |
5 | +export default ({ setNotesEditVisible, notes, ids, notesType, onClose }) => { | |
6 | + const [form] = Form.useForm<{ name: string; company: string }>(); | |
7 | + return ( | |
8 | + <ModalForm<{ | |
9 | + name: string; | |
10 | + company: string; | |
11 | + }> | |
12 | + width={500} | |
13 | + open | |
14 | + title="修改备注" | |
15 | + form={form} | |
16 | + autoFocusFirstInput | |
17 | + modalProps={{ | |
18 | + okText: '保存', | |
19 | + cancelText: '取消', | |
20 | + destroyOnClose: true, | |
21 | + onCancel: () => { | |
22 | + setNotesEditVisible(false); | |
23 | + }, | |
24 | + }} | |
25 | + submitTimeout={2000} | |
26 | + onFinish={async (values) => { | |
27 | + let body = { | |
28 | + id: ids[0], | |
29 | + notes: values.name, | |
30 | + notesType: notesType, | |
31 | + }; | |
32 | + const res = await postServiceOrderNotesEdit({ data: body }); | |
33 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
34 | + message.success(res.message); | |
35 | + onClose(); | |
36 | + } | |
37 | + }} | |
38 | + onOpenChange={setNotesEditVisible} | |
39 | + > | |
40 | + <ProFormTextArea | |
41 | + width="lg" | |
42 | + name="name" | |
43 | + initialValue={notes} | |
44 | + placeholder="填写备注内容" | |
45 | + /> | |
46 | + </ModalForm> | |
47 | + ); | |
48 | +}; | ... | ... |
src/pages/Order/FeedBack/OtherInfoModal.tsx
0 → 100644
1 | +import { Col, Modal, Row } from 'antd'; | |
2 | + | |
3 | +const DeliverModal = ({ data, setVisible }) => { | |
4 | + return ( | |
5 | + <Modal | |
6 | + open | |
7 | + width={900} | |
8 | + title={'其他信息'} | |
9 | + onOk={async () => {}} | |
10 | + onCancel={() => { | |
11 | + setVisible(false); | |
12 | + }} | |
13 | + > | |
14 | + <Row gutter={[16, 24]}> | |
15 | + <Col span={6}> | |
16 | + <span className="text-[#333333]">销售申请开票附件</span> | |
17 | + </Col> | |
18 | + <Col span={18}>{data.customerName}</Col> | |
19 | + <Col span={6}> | |
20 | + <span className="className='text-[#333333]'">联系方式</span> | |
21 | + </Col> | |
22 | + <Col span={18}>{data.customerContactNumber}</Col> | |
23 | + | |
24 | + <Col span={6}> | |
25 | + <span className="className='text-[#333333]'">收货地址</span> | |
26 | + </Col> | |
27 | + <Col span={18}>{data.customerShippingAddress}</Col> | |
28 | + | |
29 | + <Col span={6}> | |
30 | + <span className="className='text-[#333333]'">单位联系人</span> | |
31 | + </Col> | |
32 | + <Col span={18}>{data.institutionContactName}</Col> | |
33 | + <Col span={6}> | |
34 | + <span className="className='text-[#333333]'">单位名称</span> | |
35 | + </Col> | |
36 | + <Col span={18}>{data.institution}</Col> | |
37 | + <Col span={6}> | |
38 | + <span className="className='text-[#333333]'">开户银行</span> | |
39 | + </Col> | |
40 | + <Col span={18}>{data.bank}</Col> | |
41 | + | |
42 | + <Col span={6}> | |
43 | + <span className="className='text-[#333333]'">银行账号</span> | |
44 | + </Col> | |
45 | + <Col span={18}>{data.bankAccountNumber}</Col> | |
46 | + <Col span={6}> | |
47 | + <span className="className='text-[#333333]'">开票识别号</span> | |
48 | + </Col> | |
49 | + <Col span={18}>{data.invoiceIdentificationNumber}</Col> | |
50 | + </Row> | |
51 | + </Modal> | |
52 | + ); | |
53 | +}; | |
54 | + | |
55 | +export default DeliverModal; | ... | ... |
src/pages/Order/FeedBack/ProcureCheckModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postServiceOrderProcureCheckOrder, | |
4 | + postServiceOrderProcureConvertWarehouseKeeper, | |
5 | + postServiceOrderQuerySupplier, | |
6 | +} from '@/services'; | |
7 | +import { | |
8 | + ModalForm, | |
9 | + ProFormSelect, | |
10 | + ProFormTextArea, | |
11 | +} from '@ant-design/pro-components'; | |
12 | +import { Button, Form, Input, Popconfirm, message } from 'antd'; | |
13 | +import { useState } from 'react'; | |
14 | +export default ({ setCheckVisible, isMainOrder, orders, onClose }) => { | |
15 | + const [form] = Form.useForm<{ supplier: string }>(); | |
16 | + const [checkNotes, setCheckNotes] = useState<string>(''); | |
17 | + | |
18 | + console.log(isMainOrder); | |
19 | + | |
20 | + let ids: any[] = orders.map((order: any) => order.id); | |
21 | + async function doCheck(body: object) { | |
22 | + const data = await postServiceOrderProcureCheckOrder({ | |
23 | + data: body, | |
24 | + }); | |
25 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
26 | + message.success(data.message); | |
27 | + onClose(); | |
28 | + } | |
29 | + } | |
30 | + | |
31 | + return ( | |
32 | + <ModalForm<{ | |
33 | + supplier: string; | |
34 | + }> | |
35 | + width={500} | |
36 | + open | |
37 | + title="采购审核" | |
38 | + form={form} | |
39 | + autoFocusFirstInput | |
40 | + modalProps={{ | |
41 | + okText: '确认', | |
42 | + cancelText: '取消', | |
43 | + destroyOnClose: true, | |
44 | + onCancel: () => { | |
45 | + setCheckVisible(false); | |
46 | + }, | |
47 | + }} | |
48 | + submitter={{ | |
49 | + render: (props, defaultDoms) => { | |
50 | + return [ | |
51 | + defaultDoms[0], | |
52 | + <> | |
53 | + <Popconfirm | |
54 | + title="是否转回仓库" | |
55 | + description={ | |
56 | + <div> | |
57 | + <div className="py-2"> | |
58 | + <span>转回仓库后将由仓库管理员进行打印、发货</span> | |
59 | + </div> | |
60 | + <Input.TextArea | |
61 | + placeholder="请填写备注" | |
62 | + onChange={(e: any) => { | |
63 | + setCheckNotes(e.target.value); | |
64 | + }} | |
65 | + rows={4} | |
66 | + ></Input.TextArea> | |
67 | + </div> | |
68 | + } | |
69 | + onConfirm={async () => { | |
70 | + let res = await postServiceOrderProcureConvertWarehouseKeeper( | |
71 | + { | |
72 | + data: { | |
73 | + subIds: ids, | |
74 | + checkNotes: checkNotes, | |
75 | + }, | |
76 | + }, | |
77 | + ); | |
78 | + | |
79 | + if (res?.result === RESPONSE_CODE.SUCCESS) { | |
80 | + message.success(res.message); | |
81 | + onClose(); | |
82 | + return true; | |
83 | + } | |
84 | + }} | |
85 | + okText="确定" | |
86 | + cancelText="取消" | |
87 | + > | |
88 | + <Button type="primary">转回仓库</Button> | |
89 | + </Popconfirm> | |
90 | + </>, | |
91 | + defaultDoms[1], | |
92 | + ]; | |
93 | + }, | |
94 | + }} | |
95 | + submitTimeout={2000} | |
96 | + onFinish={async (values) => { | |
97 | + if (values.supplier === '0') { | |
98 | + message.error('选择转回仓库请点击转回仓库按钮!'); | |
99 | + return; | |
100 | + } | |
101 | + let procureIsPrintAndSend = true; | |
102 | + return doCheck({ | |
103 | + ...values, | |
104 | + subOrderIds: ids, | |
105 | + procureIsPrintAndSend: procureIsPrintAndSend, | |
106 | + }); | |
107 | + }} | |
108 | + onOpenChange={setCheckVisible} | |
109 | + > | |
110 | + <ProFormSelect | |
111 | + key="key" | |
112 | + label="采购名称" | |
113 | + width="lg" | |
114 | + name="supplier" | |
115 | + // options={options} | |
116 | + placeholder="请选择采购" | |
117 | + rules={[{ required: true, message: '采购名称必填' }]} | |
118 | + request={async () => { | |
119 | + const res = await postServiceOrderQuerySupplier(); | |
120 | + let options = res.data?.map((item) => { | |
121 | + return { label: item, value: item }; | |
122 | + }); | |
123 | + options.push({ label: '转回仓库', value: '0' }); | |
124 | + return options; | |
125 | + }} | |
126 | + /> | |
127 | + | |
128 | + <ProFormTextArea label="备注" name="procureNotes" key="procureNotes" /> | |
129 | + </ModalForm> | |
130 | + ); | |
131 | +}; | ... | ... |
src/pages/Order/FeedBack/ProcureConvertModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postServiceOrderProcureConvertProcure, | |
4 | + postServiceOrderProcureConvertWarehouseKeeper, | |
5 | + postServiceOrderProvideProcurementRoles, | |
6 | +} from '@/services'; | |
7 | +import { | |
8 | + ModalForm, | |
9 | + ProFormSelect, | |
10 | + ProFormTextArea, | |
11 | +} from '@ant-design/pro-components'; | |
12 | +import { Form, message } from 'antd'; | |
13 | +export default ({ setVisible, subOrders, onClose }) => { | |
14 | + const [form] = Form.useForm<{ | |
15 | + procureName: string; | |
16 | + procureConvertNotes: string; | |
17 | + }>(); | |
18 | + | |
19 | + let subOrderIds: any[] = subOrders?.map((subOrder) => subOrder.id); | |
20 | + | |
21 | + return ( | |
22 | + <ModalForm<{ | |
23 | + procureName: string; | |
24 | + procureConvertNotes: string; | |
25 | + }> | |
26 | + width={500} | |
27 | + open | |
28 | + title="采购转发" | |
29 | + form={form} | |
30 | + autoFocusFirstInput | |
31 | + modalProps={{ | |
32 | + okText: '确认', | |
33 | + cancelText: '取消', | |
34 | + destroyOnClose: true, | |
35 | + onCancel: () => { | |
36 | + setVisible(false); | |
37 | + }, | |
38 | + }} | |
39 | + submitter={{ | |
40 | + render: (props, defaultDoms) => { | |
41 | + return defaultDoms; | |
42 | + }, | |
43 | + }} | |
44 | + submitTimeout={2000} | |
45 | + onFinish={async (values) => { | |
46 | + let data; | |
47 | + if (values.procureName === '仓库') { | |
48 | + //转给仓库 | |
49 | + data = await postServiceOrderProcureConvertWarehouseKeeper({ | |
50 | + data: { | |
51 | + subIds: subOrderIds, | |
52 | + checkNotes: values.procureConvertNotes, | |
53 | + }, | |
54 | + }); | |
55 | + } else { | |
56 | + data = await postServiceOrderProcureConvertProcure({ | |
57 | + data: { | |
58 | + procureName: values.procureName, | |
59 | + procureConvertNotes: values.procureConvertNotes, | |
60 | + subIds: subOrderIds, | |
61 | + }, | |
62 | + }); | |
63 | + } | |
64 | + | |
65 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
66 | + message.success(data.message); | |
67 | + onClose(); | |
68 | + } | |
69 | + }} | |
70 | + onOpenChange={setVisible} | |
71 | + > | |
72 | + <ProFormSelect | |
73 | + key="key" | |
74 | + label="采购名称" | |
75 | + width="lg" | |
76 | + name="procureName" | |
77 | + // options={options} | |
78 | + placeholder="请选择采购" | |
79 | + rules={[{ required: true, message: '采购必填' }]} | |
80 | + request={async () => { | |
81 | + const res = await postServiceOrderProvideProcurementRoles(); | |
82 | + let options = res.data?.map((item) => { | |
83 | + return { label: item, value: item }; | |
84 | + }); | |
85 | + return options; | |
86 | + }} | |
87 | + /> | |
88 | + | |
89 | + <ProFormTextArea | |
90 | + key="key" | |
91 | + label="转发备注" | |
92 | + width="lg" | |
93 | + name="procureConvertNotes" | |
94 | + placeholder="请填写转发备注" | |
95 | + /> | |
96 | + </ModalForm> | |
97 | + ); | |
98 | +}; | ... | ... |
src/pages/Order/FeedBack/ProcureNotesEditModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderNotesEdit } from '@/services'; | |
3 | +import { ModalForm, ProFormTextArea } from '@ant-design/pro-components'; | |
4 | +import { Form, message } from 'antd'; | |
5 | +export default ({ setNotesEditVisible, notesType, data, onClose }) => { | |
6 | + const [form] = Form.useForm<{ procureNotes: string }>(); | |
7 | + return ( | |
8 | + <ModalForm<{ | |
9 | + procureNotes: string; | |
10 | + }> | |
11 | + width={500} | |
12 | + open | |
13 | + title="修改备注" | |
14 | + form={form} | |
15 | + autoFocusFirstInput | |
16 | + modalProps={{ | |
17 | + okText: '保存', | |
18 | + cancelText: '取消', | |
19 | + destroyOnClose: true, | |
20 | + onCancel: () => { | |
21 | + setNotesEditVisible(false); | |
22 | + }, | |
23 | + }} | |
24 | + submitTimeout={2000} | |
25 | + onFinish={async (values) => { | |
26 | + let body = { | |
27 | + id: data.id, | |
28 | + notes: values.procureNotes, | |
29 | + notesType: notesType, | |
30 | + }; | |
31 | + const res = await postServiceOrderNotesEdit({ data: body }); | |
32 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
33 | + message.success(res.message); | |
34 | + onClose(); | |
35 | + } | |
36 | + }} | |
37 | + onOpenChange={setNotesEditVisible} | |
38 | + > | |
39 | + <ProFormTextArea | |
40 | + width="lg" | |
41 | + key="procureNotes" | |
42 | + name="procureNotes" | |
43 | + initialValue={data.procureNotes} | |
44 | + placeholder="填写备注内容" | |
45 | + /> | |
46 | + </ModalForm> | |
47 | + ); | |
48 | +}; | ... | ... |
src/pages/Order/FeedBack/ProductionTimeModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderEditProductionTime } from '@/services'; | |
3 | +import { ModalForm, ProFormDatePicker } from '@ant-design/pro-components'; | |
4 | +import { Form, message } from 'antd'; | |
5 | + | |
6 | +// import { cloneDeep } from 'lodash'; | |
7 | +export default ({ setVisible, subOrders, onClose }) => { | |
8 | + const [form] = Form.useForm<{ | |
9 | + productionStartTime: string; | |
10 | + productionEndTime: string; | |
11 | + }>(); | |
12 | + let ids = subOrders?.map((item: { id: any }) => { | |
13 | + return item.id; | |
14 | + }); | |
15 | + let defaultValue = {}; | |
16 | + if (subOrders && subOrders.length > 0) { | |
17 | + defaultValue = subOrders[0]; | |
18 | + } | |
19 | + return ( | |
20 | + <> | |
21 | + <ModalForm<{ | |
22 | + productionStartTime: string; | |
23 | + productionEndTime: string; | |
24 | + }> | |
25 | + width={500} | |
26 | + open | |
27 | + title="生产时间" | |
28 | + form={form} | |
29 | + autoFocusFirstInput | |
30 | + initialValues={defaultValue} | |
31 | + modalProps={{ | |
32 | + okText: '保存', | |
33 | + cancelText: '取消', | |
34 | + destroyOnClose: true, | |
35 | + onCancel: () => { | |
36 | + setVisible(false); | |
37 | + }, | |
38 | + }} | |
39 | + onFinish={async (values) => { | |
40 | + if (values.productionStartTime > values.productionEndTime) { | |
41 | + message.error('开始时间不能大于结束时间'); | |
42 | + return; | |
43 | + } | |
44 | + let res = await postServiceOrderEditProductionTime({ | |
45 | + data: { | |
46 | + ...values, | |
47 | + ids: ids, | |
48 | + }, | |
49 | + }); | |
50 | + | |
51 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
52 | + message.success(res.message); | |
53 | + onClose(); | |
54 | + } | |
55 | + }} | |
56 | + onOpenChange={setVisible} | |
57 | + > | |
58 | + <span className="text-[red] leading-8"> | |
59 | + 如果选中多个子订单,将默认回显第一个子订单的生产时间 | |
60 | + </span> | |
61 | + <ProFormDatePicker | |
62 | + width="lg" | |
63 | + key="productionStartTime" | |
64 | + name="productionStartTime" | |
65 | + label="开始时间" | |
66 | + placeholder="请输入开始时间" | |
67 | + rules={[{ required: true, message: '开始时间必填' }]} | |
68 | + /> | |
69 | + | |
70 | + <ProFormDatePicker | |
71 | + width="lg" | |
72 | + key="productionEndTime" | |
73 | + name="productionEndTime" | |
74 | + label="结束时间" | |
75 | + placeholder="请输入结束时间" | |
76 | + rules={[{ required: true, message: '结束时间必填' }]} | |
77 | + /> | |
78 | + </ModalForm> | |
79 | + </> | |
80 | + ); | |
81 | +}; | ... | ... |
src/pages/Order/FeedBack/ReissueModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postServiceInvoiceFindInvoice, | |
4 | + postServiceInvoiceReissue, | |
5 | + postServiceOrderFindServiceOrder, | |
6 | +} from '@/services'; | |
7 | +import { | |
8 | + ModalForm, | |
9 | + ProFormSelect, | |
10 | + ProFormText, | |
11 | + ProFormTextArea, | |
12 | +} from '@ant-design/pro-components'; | |
13 | +import { Form } from 'antd'; | |
14 | +import { useEffect, useState } from 'react'; | |
15 | + | |
16 | +export default ({ setVisible, subOrders, onClose }) => { | |
17 | + const [invoiceSelectList, setInvoiceSelectList] = useState([]); | |
18 | + const [mainOrders, setMainOrders] = useState(''); | |
19 | + const [submitting, setSubmitting] = useState(false); | |
20 | + | |
21 | + const [form] = Form.useForm<{ invoiceId: string; notes: string }>(); | |
22 | + | |
23 | + let getInvoiceSelectList = async () => { | |
24 | + const res = await postServiceInvoiceFindInvoice({ | |
25 | + data: { | |
26 | + subOrderIdIn: subOrders.map((item) => item.id), | |
27 | + }, | |
28 | + }); | |
29 | + setInvoiceSelectList([]); | |
30 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
31 | + let temInvoiceSelectList = []; | |
32 | + res.data.forEach((item) => { | |
33 | + temInvoiceSelectList.push({ | |
34 | + label: item.invoiceNumber, | |
35 | + value: item.id, | |
36 | + }); | |
37 | + }); | |
38 | + setInvoiceSelectList(temInvoiceSelectList); | |
39 | + } | |
40 | + }; | |
41 | + useEffect(() => { | |
42 | + getInvoiceSelectList(); | |
43 | + }, []); | |
44 | + return ( | |
45 | + <ModalForm<{ | |
46 | + invoiceId: string; | |
47 | + notes: string; | |
48 | + }> | |
49 | + title="重新开票" | |
50 | + form={form} | |
51 | + width={500} | |
52 | + open | |
53 | + autoFocusFirstInput | |
54 | + initialValues={{}} | |
55 | + modalProps={{ | |
56 | + okText: '确认', | |
57 | + cancelText: '取消', | |
58 | + destroyOnClose: true, | |
59 | + onCancel: () => { | |
60 | + setVisible(false); | |
61 | + }, | |
62 | + }} | |
63 | + submitting={submitting} | |
64 | + onFinish={async (values) => { | |
65 | + setSubmitting(true); | |
66 | + postServiceInvoiceReissue({ | |
67 | + data: values, | |
68 | + }); | |
69 | + setVisible(false); | |
70 | + onClose(); | |
71 | + }} | |
72 | + submitTimeout={2000} | |
73 | + > | |
74 | + <ProFormSelect | |
75 | + width="lg" | |
76 | + name="invoiceId" | |
77 | + label="选择要重新开的发票" | |
78 | + options={invoiceSelectList} | |
79 | + onChange={async (value) => { | |
80 | + console.log(value); | |
81 | + let result = await postServiceOrderFindServiceOrder({ | |
82 | + data: { | |
83 | + invoiceId: value, | |
84 | + }, | |
85 | + }); | |
86 | + if (result && result.result === RESPONSE_CODE.SUCCESS) { | |
87 | + //对data里面每个元素的id用,进行拼接 | |
88 | + let map = result.data.map((item) => item.id); | |
89 | + let str = map.join(','); | |
90 | + setMainOrders(str); | |
91 | + } | |
92 | + }} | |
93 | + /> | |
94 | + <ProFormText | |
95 | + width="lg" | |
96 | + name="purchaser" | |
97 | + label="抬头名称" | |
98 | + key="purchaser" | |
99 | + placeholder="请输入抬头名称" | |
100 | + rules={[{ required: true, message: '抬头名称必填' }]} | |
101 | + /> | |
102 | + <ProFormText | |
103 | + width="md" | |
104 | + name="关联订单" | |
105 | + label="发票关联订单号" | |
106 | + readonly={true} | |
107 | + value={mainOrders} | |
108 | + /> | |
109 | + <ProFormTextArea | |
110 | + width="lg" | |
111 | + name="notes" | |
112 | + rules={[ | |
113 | + { | |
114 | + required: true, // 设置为必填 | |
115 | + message: '必须填写重新开票原因', // 当未填写时显示的提示信息 | |
116 | + }, | |
117 | + ]} | |
118 | + placeholder="请填写订单重新开票的原因" | |
119 | + /> | |
120 | + </ModalForm> | |
121 | + ); | |
122 | +}; | ... | ... |
src/pages/Order/FeedBack/ReissueModal_old.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postServiceInvoiceFindInvoiceOld, | |
4 | + postServiceInvoiceReissueOld, | |
5 | + postServiceOrderFindServiceOrder, | |
6 | +} from '@/services'; | |
7 | +import { | |
8 | + ModalForm, | |
9 | + ProFormSelect, | |
10 | + ProFormText, | |
11 | + ProFormTextArea, | |
12 | +} from '@ant-design/pro-components'; | |
13 | +import { Form } from 'antd'; | |
14 | +import { useEffect, useState } from 'react'; | |
15 | + | |
16 | +export default ({ setVisible, mainOrder, onClose }) => { | |
17 | + const [invoiceSelectList, setInvoiceSelectList] = useState([]); | |
18 | + const [mainOrders, setMainOrders] = useState(''); | |
19 | + const [submitting, setSubmitting] = useState(false); | |
20 | + | |
21 | + const [form] = Form.useForm<{ invoiceId: string; notes: string }>(); | |
22 | + | |
23 | + let getInvoiceSelectList = async () => { | |
24 | + console.log(mainOrder); | |
25 | + const res = await postServiceInvoiceFindInvoiceOld({ | |
26 | + data: { | |
27 | + mainOrderId: mainOrder.id, | |
28 | + }, | |
29 | + }); | |
30 | + setInvoiceSelectList([]); | |
31 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
32 | + let temInvoiceSelectList = []; | |
33 | + res.data.forEach((item) => { | |
34 | + temInvoiceSelectList.push({ | |
35 | + label: item.invoiceNumber, | |
36 | + value: item.id, | |
37 | + }); | |
38 | + }); | |
39 | + setInvoiceSelectList(temInvoiceSelectList); | |
40 | + } | |
41 | + }; | |
42 | + useEffect(() => { | |
43 | + getInvoiceSelectList(); | |
44 | + }, []); | |
45 | + return ( | |
46 | + <ModalForm | |
47 | + title="重新开票(旧)" | |
48 | + form={form} | |
49 | + width={500} | |
50 | + open | |
51 | + autoFocusFirstInput | |
52 | + initialValues={{}} | |
53 | + modalProps={{ | |
54 | + okText: '确认', | |
55 | + cancelText: '取消', | |
56 | + destroyOnClose: true, | |
57 | + onCancel: () => { | |
58 | + setVisible(false); | |
59 | + }, | |
60 | + }} | |
61 | + submitting={submitting} | |
62 | + onFinish={async (values) => { | |
63 | + setSubmitting(true); | |
64 | + postServiceInvoiceReissueOld({ | |
65 | + data: values, | |
66 | + }); | |
67 | + setVisible(false); | |
68 | + onClose(); | |
69 | + }} | |
70 | + submitTimeout={2000} | |
71 | + > | |
72 | + <ProFormSelect | |
73 | + width="lg" | |
74 | + name="invoiceId" | |
75 | + label="选择要重新开的发票" | |
76 | + options={invoiceSelectList} | |
77 | + onChange={async (value) => { | |
78 | + console.log(value); | |
79 | + let result = await postServiceOrderFindServiceOrder({ | |
80 | + data: { | |
81 | + invoiceId: value, | |
82 | + }, | |
83 | + }); | |
84 | + if (result && result.result === RESPONSE_CODE.SUCCESS) { | |
85 | + //对data里面每个元素的id用,进行拼接 | |
86 | + let map = result.data.map((item) => item.id); | |
87 | + let str = map.join(','); | |
88 | + setMainOrders(str); | |
89 | + } | |
90 | + }} | |
91 | + /> | |
92 | + <ProFormText | |
93 | + width="lg" | |
94 | + name="purchaser" | |
95 | + label="抬头名称" | |
96 | + key="purchaser" | |
97 | + placeholder="请输入抬头名称" | |
98 | + rules={[{ required: true, message: '抬头名称必填' }]} | |
99 | + /> | |
100 | + <ProFormText | |
101 | + width="md" | |
102 | + name="关联订单" | |
103 | + label="发票关联订单号" | |
104 | + readonly={true} | |
105 | + value={mainOrders} | |
106 | + /> | |
107 | + <ProFormTextArea | |
108 | + width="lg" | |
109 | + name="notes" | |
110 | + rules={[ | |
111 | + { | |
112 | + required: true, // 设置为必填 | |
113 | + message: '必须填写重新开票原因', // 当未填写时显示的提示信息 | |
114 | + }, | |
115 | + ]} | |
116 | + placeholder="请填写订单重新开票的原因" | |
117 | + /> | |
118 | + </ModalForm> | |
119 | + ); | |
120 | +}; | ... | ... |
src/pages/Order/FeedBack/ShippingWarehouseChangeModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postServiceOrderShippingWarehouseChange } from '@/services'; | |
3 | +import { enumToSelect } from '@/utils'; | |
4 | +import { ModalForm, ProFormSelect } from '@ant-design/pro-components'; | |
5 | +import { Form, message } from 'antd'; | |
6 | +import { SHIPPING_WAREHOUSE_OPTIONS } from './constant'; | |
7 | + | |
8 | +export default ({ | |
9 | + setVisible, | |
10 | + subOrderIds, | |
11 | + originShippingWarehouse, | |
12 | + onClose, | |
13 | +}) => { | |
14 | + const [form] = Form.useForm<{ shippingWarehouse: string }>(); | |
15 | + | |
16 | + let newOriginShippingWarehouse = originShippingWarehouse; | |
17 | + if ( | |
18 | + originShippingWarehouse === null || | |
19 | + originShippingWarehouse === undefined | |
20 | + ) { | |
21 | + newOriginShippingWarehouse = 'DALANG_WAREHOUSE'; | |
22 | + } | |
23 | + return ( | |
24 | + <> | |
25 | + <ModalForm<{ | |
26 | + shippingWarehouse: string; | |
27 | + }> | |
28 | + width={500} | |
29 | + open | |
30 | + title="修改发货仓库" | |
31 | + form={form} | |
32 | + autoFocusFirstInput | |
33 | + modalProps={{ | |
34 | + okText: '保存', | |
35 | + cancelText: '取消', | |
36 | + destroyOnClose: true, | |
37 | + onCancel: () => { | |
38 | + setVisible(false); | |
39 | + }, | |
40 | + }} | |
41 | + onFinish={async (values) => { | |
42 | + let res = await postServiceOrderShippingWarehouseChange({ | |
43 | + data: { | |
44 | + ...values, | |
45 | + ids: subOrderIds, | |
46 | + }, | |
47 | + }); | |
48 | + | |
49 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
50 | + message.success(res.message); | |
51 | + } | |
52 | + onClose(); | |
53 | + }} | |
54 | + onOpenChange={setVisible} | |
55 | + > | |
56 | + <ProFormSelect | |
57 | + key={'shippingWarehouse'} | |
58 | + placeholder="请选择发货仓库" | |
59 | + name="shippingWarehouse" | |
60 | + width="lg" | |
61 | + label="发货仓库" | |
62 | + rules={[{ required: true, message: '发货仓库必填' }]} | |
63 | + initialValue={newOriginShippingWarehouse} | |
64 | + options={enumToSelect(SHIPPING_WAREHOUSE_OPTIONS)} | |
65 | + /> | |
66 | + , | |
67 | + </ModalForm> | |
68 | + </> | |
69 | + ); | |
70 | +}; | ... | ... |
src/pages/Order/FeedBack/UploadPayBillModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postServiceOrderFileProcess, | |
4 | + postServiceOrderUploadPaymentReceipt, | |
5 | +} from '@/services'; | |
6 | +import { transImageFile } from '@/utils'; | |
7 | +import { PlusOutlined } from '@ant-design/icons'; | |
8 | +import { ModalForm } from '@ant-design/pro-components'; | |
9 | +import { Form, Modal, Upload, UploadFile, UploadProps, message } from 'antd'; | |
10 | +import { RcFile } from 'antd/lib/upload'; | |
11 | +import { cloneDeep } from 'lodash'; | |
12 | +import { useEffect, useRef, useState } from 'react'; | |
13 | +import { COMFIR_RECEIPT_IMAGES_NUMBER } from './constant'; | |
14 | + | |
15 | +// import { cloneDeep } from 'lodash'; | |
16 | +export default ({ setVisible, subOrders, mainOrder, onClose }) => { | |
17 | + const [form] = Form.useForm(); | |
18 | + const [previewOpen, setPreviewOpen] = useState(false); | |
19 | + const [previewImage, setPreviewImage] = useState(''); | |
20 | + const [previewTitle, setPreviewTitle] = useState(''); | |
21 | + const handleCancel = () => setPreviewOpen(false); | |
22 | + const [fileList, setFileList] = useState<UploadFile[]>([]); | |
23 | + const getBase64 = (file: RcFile): Promise<string> => | |
24 | + new Promise((resolve, reject) => { | |
25 | + const reader = new FileReader(); | |
26 | + reader.readAsDataURL(file); | |
27 | + reader.onload = () => resolve(reader.result as string); | |
28 | + reader.onerror = (error) => reject(error); | |
29 | + }); | |
30 | + | |
31 | + const subOrderIds = subOrders?.map((item: any) => { | |
32 | + return item.id; | |
33 | + }); | |
34 | + const fileListObj = useRef<UploadFile[]>([]); //使用引用类型,使得在useEffect里面设置监听事件后,不用更新监听事件也能保持obj与外界一致 | |
35 | + const handleBeforeUpload = (file: any) => { | |
36 | + setFileList([...fileList, file]); | |
37 | + return false; | |
38 | + }; | |
39 | + const uploadButton = ( | |
40 | + <div> | |
41 | + <PlusOutlined /> | |
42 | + <div style={{ marginTop: 8 }}>上传凭证</div> | |
43 | + </div> | |
44 | + ); | |
45 | + /** 粘贴快捷键的回调 */ | |
46 | + const onPaste = async (e: any) => { | |
47 | + /** 获取剪切板的数据clipboardData */ | |
48 | + let clipboardData = e.clipboardData, | |
49 | + i = 0, | |
50 | + items, | |
51 | + item, | |
52 | + types; | |
53 | + | |
54 | + /** 为空判断 */ | |
55 | + if (clipboardData) { | |
56 | + items = clipboardData.items; | |
57 | + if (!items) { | |
58 | + message.info('您的剪贴板中没有照片'); | |
59 | + return; | |
60 | + } | |
61 | + | |
62 | + item = items[0]; | |
63 | + types = clipboardData.types || []; | |
64 | + /** 遍历剪切板的数据 */ | |
65 | + for (; i < types.length; i++) { | |
66 | + if (types[i] === 'Files') { | |
67 | + item = items[i]; | |
68 | + break; | |
69 | + } | |
70 | + } | |
71 | + | |
72 | + /** 判断文件是否为图片 */ | |
73 | + if (item && item.kind === 'file' && item.type.match(/^image\//i)) { | |
74 | + const imgItem = item.getAsFile(); | |
75 | + const newFileList = cloneDeep(fileListObj.current); | |
76 | + let filteredArray = newFileList.filter( | |
77 | + (obj) => obj.status !== 'removed', | |
78 | + ); //过滤掉状态为已删除的照片 | |
79 | + const listItem = { | |
80 | + ...imgItem, | |
81 | + status: 'done', | |
82 | + url: await getBase64(imgItem), | |
83 | + originFileObj: imgItem, | |
84 | + }; | |
85 | + | |
86 | + if (filteredArray.length >= COMFIR_RECEIPT_IMAGES_NUMBER) { | |
87 | + message.info('发货照片数量不能超过3'); | |
88 | + console.log(mainOrder); | |
89 | + return; | |
90 | + } | |
91 | + fileListObj.current = filteredArray; | |
92 | + filteredArray.push(listItem); | |
93 | + setFileList(filteredArray); | |
94 | + return; | |
95 | + } | |
96 | + } | |
97 | + | |
98 | + message.info('您的剪贴板中没有照片'); | |
99 | + }; | |
100 | + const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => { | |
101 | + //fileListObj得在change里变化,change的参数是已经处理过的file数组 | |
102 | + //beforeUpload中的参数file是未处理过,还需要Base64拿到文件数据处理 | |
103 | + fileListObj.current = newFileList; | |
104 | + setFileList(newFileList); | |
105 | + }; | |
106 | + const handlePreview = async (file: UploadFile) => { | |
107 | + if (!file.url && !file.preview) { | |
108 | + file.preview = await getBase64(file.originFileObj as RcFile); | |
109 | + } | |
110 | + setPreviewImage(file.url || (file.preview as string)); | |
111 | + setPreviewOpen(true); | |
112 | + setPreviewTitle( | |
113 | + file.name || | |
114 | + file.originFileObj?.name || | |
115 | + file.url!.substring(file.url!.lastIndexOf('/') + 1), | |
116 | + ); | |
117 | + }; | |
118 | + const props: UploadProps = { | |
119 | + onRemove: (file) => { | |
120 | + const index = fileList.indexOf(file); | |
121 | + const newFileList = fileList.slice(); | |
122 | + newFileList.splice(index, 1); | |
123 | + setFileList(newFileList); | |
124 | + }, | |
125 | + beforeUpload: handleBeforeUpload, | |
126 | + listType: 'picture-card', | |
127 | + onPreview: handlePreview, | |
128 | + fileList, | |
129 | + onChange: handleChange, | |
130 | + accept: 'image/png, image/jpeg, image/png', | |
131 | + // action: '/api/service/order/fileProcess', | |
132 | + name: 'files', | |
133 | + headers: { Authorization: localStorage.getItem('token') }, | |
134 | + }; | |
135 | + | |
136 | + useEffect(() => { | |
137 | + document.addEventListener('paste', onPaste); | |
138 | + return () => { | |
139 | + document.removeEventListener('paste', onPaste); | |
140 | + }; | |
141 | + }, []); | |
142 | + return ( | |
143 | + <> | |
144 | + <ModalForm<{ | |
145 | + filePaths: any; | |
146 | + }> | |
147 | + width={500} | |
148 | + open | |
149 | + title="回款凭证上传" | |
150 | + form={form} | |
151 | + autoFocusFirstInput | |
152 | + modalProps={{ | |
153 | + okText: '提交', | |
154 | + cancelText: '取消', | |
155 | + destroyOnClose: true, | |
156 | + onCancel: () => { | |
157 | + setVisible(false); | |
158 | + }, | |
159 | + }} | |
160 | + onFinish={async () => { | |
161 | + if (fileList.length <= 0) { | |
162 | + message.error('请上传至少一张凭证'); | |
163 | + return; | |
164 | + } | |
165 | + message.open({ | |
166 | + type: 'loading', | |
167 | + content: '正在上传凭证...', | |
168 | + duration: 0, | |
169 | + }); | |
170 | + //附件处理 | |
171 | + let formData = new FormData(); | |
172 | + //附件处理 | |
173 | + for (let file of fileList) { | |
174 | + if (file.originFileObj) { | |
175 | + formData.append('files', file.originFileObj as RcFile); | |
176 | + } else { | |
177 | + //有url的话取url(源文件),没url取thumbUrl。有url的时候thumbUrl是略缩图 | |
178 | + if (file?.url === undefined || file?.url === null) { | |
179 | + formData.append( | |
180 | + 'files', | |
181 | + transImageFile(file?.thumbUrl), | |
182 | + file?.originFileObj?.name, | |
183 | + ); | |
184 | + } else { | |
185 | + formData.append( | |
186 | + 'files', | |
187 | + transImageFile(file?.url), | |
188 | + file?.originFileObj?.name, | |
189 | + ); | |
190 | + } | |
191 | + } | |
192 | + } | |
193 | + let res = await postServiceOrderFileProcess({ | |
194 | + data: formData, | |
195 | + }); | |
196 | + message.destroy(); | |
197 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
198 | + let fileUrls = res?.data?.map((item) => { | |
199 | + return { url: item }; | |
200 | + }); | |
201 | + //财务审核 | |
202 | + const data = await postServiceOrderUploadPaymentReceipt({ | |
203 | + data: { | |
204 | + subOrderIds: subOrderIds, | |
205 | + filePaths: fileUrls, | |
206 | + }, | |
207 | + }); | |
208 | + if (data.result === RESPONSE_CODE.SUCCESS) { | |
209 | + message.success(data.message); | |
210 | + onClose(); | |
211 | + } | |
212 | + } else { | |
213 | + message.success('上传失败'); | |
214 | + } | |
215 | + onClose(); | |
216 | + }} | |
217 | + onOpenChange={setVisible} | |
218 | + > | |
219 | + <div className="pb-4 text-xs decoration-gray-50">可复制照片粘贴</div> | |
220 | + <Upload {...props}> | |
221 | + {fileList.length < COMFIR_RECEIPT_IMAGES_NUMBER ? uploadButton : ''} | |
222 | + </Upload> | |
223 | + </ModalForm> | |
224 | + | |
225 | + <Modal | |
226 | + open={previewOpen} | |
227 | + title={previewTitle} | |
228 | + footer={null} | |
229 | + onCancel={handleCancel} | |
230 | + > | |
231 | + <img alt="图片预览" style={{ width: '100%' }} src={previewImage} /> | |
232 | + </Modal> | |
233 | + </> | |
234 | + ); | |
235 | +}; | ... | ... |
src/pages/Order/FeedBack/constant.ts
0 → 100644
1 | +import { | |
2 | + postOrderErpOrderZoNingSelectSaleUserHasZoning, | |
3 | + postServiceOrderQueryCustomerInformation, | |
4 | +} from '@/services'; | |
5 | +import { enumToProTableEnumValue } from '@/utils'; | |
6 | +import { getReceivingCompanyOptions, isSupplier } from '@/utils/order'; | |
7 | +export const COMFIR_RECEIPT_IMAGES_NUMBER = 3; | |
8 | + | |
9 | +export const PAYMENT_CHANNEL_OPTIONS = { | |
10 | + ALIPAY: '支付宝', | |
11 | + WECHAT: '微信', | |
12 | + BANK_TRANSFER: '银行转账', | |
13 | + BALANCE: '预存款', | |
14 | + OFFLINE: '线下付款', | |
15 | +}; | |
16 | + | |
17 | +export const RECEIPTS_RECORD_TYPES = { | |
18 | + ADVANCE_CHARGE: '预付款', | |
19 | + PAYMENT_FOR_SHIPMENT: '发货款', | |
20 | + ACCEPTANCE_PAYMENT: '验收款', | |
21 | + BALANCE_PAYMENT: '尾款', | |
22 | +}; | |
23 | + | |
24 | +export const PAYMENT_METHOD_OPTIONS = { | |
25 | + UNPAID: '未付款', | |
26 | + TAOBAO_ORDER_HAS_BEEN_PAID: '淘宝订单已付款', | |
27 | + OFFICIAL_WEBSITE_ORDER_HAS_BEEN_PAID: '官网订单已付款', | |
28 | + PAYMENT_IN_ADVANCE: '预付款', | |
29 | + WITHHOLDING_ADVANCE_DEPOSIT: '扣预存', | |
30 | + PLATFORM_SETTLEMENT: '平台结算', | |
31 | + CASH_ON_DELIVERY: '货到付款', | |
32 | + HIRE_PURCHASE: '分期付款', | |
33 | + PAYMENT_RECEIPT: '已回款', | |
34 | + PREPAID_NO_NEED_SEND: '预存款无需发货', | |
35 | +}; | |
36 | + | |
37 | +export const PRODUCT_BELONG_DEPARTMENT_OPTIONS = { | |
38 | + APPLICATION_PROJECT: '应用项目事业部门', | |
39 | + TEST: '测试事业部门', | |
40 | + CUSTOMIZATION: '定制化事业部门', | |
41 | + EXPERIMENTAL_EQUIPMENT: '实验设备事业部门', | |
42 | + EXPERIMENTAL_CONSUMABLES: '实验耗材事业部门', | |
43 | + CLAMPING_APPARATUS: '工夹具事业部', | |
44 | +}; | |
45 | + | |
46 | +export const SHIPPING_WAREHOUSE_OPTIONS = { | |
47 | + DALANG_WAREHOUSE: '大朗仓库', | |
48 | + HOUJIE_WAREHOUSE: '厚街仓库', | |
49 | +}; | |
50 | + | |
51 | +export const INVOCING_STATUS_OPTIONS_OLD = { | |
52 | + UN_INVOICE: '不需开票', | |
53 | + SPECIALLY_INVOICED: '专票', | |
54 | + COMMON_INVOICED: '普票', | |
55 | + INVOICED: '需要开票', | |
56 | +}; | |
57 | + | |
58 | +export const PAYEE_OPTIONS = { | |
59 | + ZHUGUANG_PUBLIC_ACCOUNT: '广东烛光新能源科技有限公司', | |
60 | + EXPERIMENT_PUBLIC_ACCOUNT: '东莞市科路得实验器材科技有限公司', | |
61 | + NEW_ENERGY_PUBLIC_ACCOUNT: '东莞市科路得新能源科技有限公司', | |
62 | + INNOVATION_PUBLIC_ACCOUNT: '东莞科路得创新科技有限公司', | |
63 | + JIANTU_PUBLIC_ACCOUNT: '东莞市坚途新材料科技有限公司', | |
64 | + KNOWLEDGE_PUBLIC_ACCOUNT: '东莞市科路得知识产权代理有限公司', | |
65 | + // ZHUGUANG_ACCEPTANCE_DRAFT: '烛光承兑汇票', | |
66 | + LIUPING_ACCOUNT: '刘平账户', | |
67 | + INNOVATION_ALIPAY: '创新支付宝', | |
68 | + ZHUGUANG_ALIPAY: '烛光支付宝', | |
69 | + // ZHUGUANG_WISE_COLLECTION: '烛光慧收款', | |
70 | + // EXPERIMENT_QR_CODE: '实验二维码', | |
71 | + // INNOVATION_QR_CODE: '创新二维码', | |
72 | + // NEW_ENERGY_QR_CODE: '新能源二维码', | |
73 | +}; | |
74 | + | |
75 | +export const PROCURE_ORDER_STATUS = { | |
76 | + PROCUREMENT_HAS_BEEN_ORDERED: '已下单', | |
77 | + PROCURE_NOT_ORDERED: '未下单', | |
78 | +}; | |
79 | + | |
80 | +export const INVOCING_STATUS_OPTIONS = { | |
81 | + UN_INVOICE: '不需开票', | |
82 | + SPECIALLY_INVOICED: '专票', | |
83 | + COMMON_INVOICED: '普票', | |
84 | +}; | |
85 | + | |
86 | +export const INVOCING_STATUS = { | |
87 | + UN_INVOICE: '不需开票', | |
88 | + SPECIALLY_INVOICED: '专票', | |
89 | + COMMON_INVOICED: '普票', | |
90 | + INVOICED: '需要开票', | |
91 | +}; | |
92 | + | |
93 | +/** | |
94 | + * 普通审核 | |
95 | + * 财务审核 | |
96 | + * 采购审核 | |
97 | + */ | |
98 | +export const CHECK_TYPE = { | |
99 | + CONFIRM_DELIVER: 'CONFIRM_DELIVER', | |
100 | + WEARHOUSE_KEEPER: 'WEARHOUSE_KEEPER', | |
101 | + FINALCIAL: 'FINALCIAL', | |
102 | + PROCURE: 'PROCURE', | |
103 | + SUPPLIER: 'SUPPLIER', | |
104 | + AFTER_SALES: 'AFTER_SALES', | |
105 | + LEADER_AUDIT: 'LEADER_AUDIT', | |
106 | + MODIFY_APPLY_WAIT_FOR_AUDIT: 'MODIFY_APPLY_WAIT_FOR_AUDIT', | |
107 | + WAITING_FOR_POST_AUDIT: 'WAITING_FOR_POST_AUDIT', | |
108 | + NODE_OPERATING_AUDIT: 'NODE_OPERATING_AUDIT', | |
109 | + MODIFY_LEADER_AUDIT: 'MODIFY_LEADER_AUDIT', | |
110 | + URGENT_INVOICE_AUDITING: 'URGENT_INVOICE_AUDITING', | |
111 | + URGENT_INVOICE_AUDITING_OLD: 'URGENT_INVOICE_AUDITING_OLD', | |
112 | + PAYMENT_RECEIPTS_AUDIT: 'PAYMENT_RECEIPTS_AUDIT', | |
113 | + CONFIRM_REISSUE: 'CONFIRM_REISSUE', | |
114 | + CONFIRM_REISSUE_OLD: 'CONFIRM_REISSUE_OLD', | |
115 | + PREPAID_AUDIT: 'PREPAID_AUDIT', | |
116 | + CREDIT_AUDIT: 'CREDIT_AUDIT', | |
117 | +}; | |
118 | + | |
119 | +/** | |
120 | + * 是否需要开票 | |
121 | + * @param subOrder | |
122 | + */ | |
123 | +export const getNeedInvoicing = (subOrder: any) => { | |
124 | + if (subOrder.invoicingTime !== null && subOrder.invoicingTime !== undefined) { | |
125 | + return '已开票'; | |
126 | + } | |
127 | + if (subOrder.afterInvoicingStatus === 'COMPLETE_INVOICING') { | |
128 | + return '已开票'; | |
129 | + } | |
130 | + if (subOrder.afterInvoicingStatus === 'REISSUE') { | |
131 | + return '重新开票'; | |
132 | + } | |
133 | + if (subOrder.invoicingStatus === 'UN_INVOICE') { | |
134 | + return '不需开票'; | |
135 | + } | |
136 | + return '需要开票'; | |
137 | +}; | |
138 | + | |
139 | +/** | |
140 | + * 开砖专票还是普票 | |
141 | + * @param subOrder | |
142 | + * @returns | |
143 | + */ | |
144 | +export const getInvoicingType = (subOrder: any) => { | |
145 | + let invoicingStatus = subOrder.invoicingStatus; | |
146 | + if (invoicingStatus === 'SPECIALLY_INVOICED') { | |
147 | + return '开专票'; | |
148 | + } | |
149 | + | |
150 | + if (invoicingStatus === 'COMMON_INVOICED') { | |
151 | + return '开普票'; | |
152 | + } | |
153 | + | |
154 | + return undefined; | |
155 | +}; | |
156 | + | |
157 | +export const LOGISTICS_STATUS_OPTIONS = { | |
158 | + JINGDONG_LOGISTICS: '京东', | |
159 | + SF_EXPRESS: '顺丰', | |
160 | + ZHONGTONG_LOGISTICS: '中通快递', | |
161 | + SHENTONG_LOGISTICS: '申通快递', | |
162 | + YUANTONG_LOGISTICS: '圆通快递', | |
163 | + DEBANG_LOGISTICS: '德邦物流', | |
164 | + YUNDA_LOGISTICS: '韵达快递', | |
165 | + OTHER_LOGISTICS: '其他物流方式', | |
166 | +}; | |
167 | + | |
168 | +export const POST_AUDIT_OPTIONS = { | |
169 | + WAITING_FOR_POST_AUDIT: '待后置审核', | |
170 | + POST_AUDITED: '已后置审核', | |
171 | + POST_AUDIT_FAIL: '后置审核失败', | |
172 | +}; | |
173 | + | |
174 | +export const PAYMENT_RECEIPTS_STATUS_OPTIONS = { | |
175 | + WAIT_AUDIT: '回款待审核', | |
176 | + AUDIT_PASS: '回款已审核', | |
177 | + AUDIT_NOTPASS: '回款审核失败', | |
178 | +}; | |
179 | + | |
180 | +export const ORDER_STATUS_OPTIONS = { | |
181 | + WAIT_CONFIRM_DELIVER_AFTER_INVOICE: '待开票后确认发货', | |
182 | + SALES_CONFIRM: '销售待确认', | |
183 | + UNAUDITED: '未审核', | |
184 | + LEADER_PROCESS: '领导待审核', | |
185 | + MODIFY_APPLY_WAIT_FOR_AUDIT: '修改待审核', | |
186 | + LEADER_AUDITED: '领导已审核', | |
187 | + FINANCE_PROCESS: '财务已审核', | |
188 | + AUDITED: '已审核', | |
189 | + PROCURE_UN_PROCESS: '采购待审核', | |
190 | + PROCURE_PROCESS: '采购已审核', | |
191 | + PROCURE_PROCESS_FOR_MINE: '采购待打印', | |
192 | + PROCURE_WAIT_SHIP: isSupplier() ? '待发货' : '采购待发货', | |
193 | + SUPPLIER_WAIT_SHIP: '供应商待发货', | |
194 | + WAIT_SHIP: '待发货', | |
195 | + SHIPPED: '已发货', | |
196 | + CONFIRM_RECEIPT: '确认收货', | |
197 | + AUDIT_FAILED: '审核失败', | |
198 | + IN_AFTER_SALES: '售后中', | |
199 | + AFTER_SALES_COMPLETION: '售后完成', | |
200 | + AFTER_SALES_FAILURE: '售后失败', | |
201 | + NO_NEED_SEND: '无需发货', | |
202 | + PROCURE_CONVERT_WAREHOUSE_KEEPER: '采购转仓库', | |
203 | + CREDIT_CONFIRM: '赊账待审核', | |
204 | + CONFIRM_INVOICE: '确认发票', | |
205 | +}; | |
206 | + | |
207 | +// export const ORDER_STATUS_OPTIONS = { | |
208 | +// IN_AFTER_SALES: '售后中', | |
209 | +// AFTER_SALES_COMPLETION: '售后完成', | |
210 | +// AFTER_SALES_FAILURE: '售后失败', | |
211 | +// }; | |
212 | + | |
213 | +export const MODIFIED_AUDIT_STATUS_OPTIONS = { | |
214 | + AUDIT_FAILURE: '修改审核失败', | |
215 | + PENDING_AUDIT_FOR_CURRENT_NODE_PERSONNEL: '节点待审核', | |
216 | + LEADER_PENDING_AUDIT: '领导待审核', | |
217 | + AUDIT_SUCCESS: '修改审核成功', | |
218 | +}; | |
219 | + | |
220 | +/** | |
221 | + * 采购筛选订单的主要订单状态 | |
222 | + */ | |
223 | +export const PROCURE_PRIMARY_ORDER_STATUS_OPTIONS = { | |
224 | + PROCURE_UN_PROCESS: isSupplier() ? '未审核' : '采购未审核', | |
225 | + PROCURE_WAIT_SHIP: isSupplier() ? '待发货' : '采购待发货', | |
226 | + SHIPPED: '已发货', | |
227 | +}; | |
228 | + | |
229 | +export const AFTE_SALES_PLAN_OPTIONS = { | |
230 | + RETURNS_OR_REFUNDS: '退货/退款', | |
231 | + EXCHANGE_GOODS: '换货', | |
232 | + FREE_ORDER: '免单', | |
233 | + DISCOUNT: '折扣', | |
234 | + OTHER: '其他', | |
235 | +}; | |
236 | + | |
237 | +export const FINANCIAL_STATUS_OPTIONS = { | |
238 | + INVOICING: '已开票', | |
239 | + UN_INVOICING: '取消开票', | |
240 | +}; | |
241 | + | |
242 | +export const AFTER_INVOICING_STATUS = { | |
243 | + NOT_YET_INVOICED: '尚未开票', | |
244 | + APPLY_FOR_INVOICING: '申请开票', | |
245 | + URGENT_INVOICE_AUDITING: '加急待审核', | |
246 | + URGENT_INVOICE_AUDIT_NOTPASS: '加急审核失败', | |
247 | + PARTIAL_INVOICING: '部分开票', | |
248 | + COMPLETE_INVOICING: '完全开票', | |
249 | + INVOICING: '开票中', | |
250 | + REISSUE: '重新开票', | |
251 | +}; | |
252 | + | |
253 | +export const TAGS_COLOR = new Map<string, string>([ | |
254 | + ['AUDIT_FAILURE', 'error'], | |
255 | + ['PENDING_AUDIT_FOR_CURRENT_NODE_PERSONNEL', 'processing'], | |
256 | + ['LEADER_PENDING_AUDIT', 'processing'], | |
257 | + ['AUDIT_SUCCESS', 'success'], | |
258 | + ['UN_INVOICE', 'success'], | |
259 | + ['LEADER_PROCESS', 'processing'], | |
260 | + ['MODIFY_APPLY_WAIT_FOR_AUDIT', 'processing'], | |
261 | + ['LEADER_AUDITED', 'processing'], | |
262 | + ['INVOICED', 'processing'], | |
263 | + ['SPECIALLY_INVOICED', 'processing'], | |
264 | + ['COMMON_INVOICED', 'processing'], | |
265 | + ['AFTER_INVOICED', 'success'], | |
266 | + ['UNAUDITED', 'warning'], | |
267 | + ['AUDITED', 'processing'], | |
268 | + ['WAIT_SHIP', 'processing'], | |
269 | + ['SHIPPED', 'processing'], | |
270 | + ['AUDIT_FAILED', 'error'], | |
271 | + ['CONFIRM_RECEIPT', 'processing'], | |
272 | + ['FINANCE_PROCESS', 'processing'], | |
273 | + ['PROCURE_UN_PROCESS', 'processing'], | |
274 | + ['PROCURE_PROCESS', 'processing'], | |
275 | + ['SUPPLIER_WAIT_SHIP', 'processing'], | |
276 | + ['SUPPLIER_SHIPPED', 'processing'], | |
277 | + ['IN_AFTER_SALES', 'red'], | |
278 | + ['AFTER_SALES_COMPLETION', 'red'], | |
279 | + ['PROCURE_PROCESS_FOR_MINE', 'processing'], | |
280 | + ['PROCURE_WAIT_SHIP', 'processing'], | |
281 | + ['NO_NEED_SEND', 'success'], | |
282 | + ['PROCURE_CONVERT_WAREHOUSE_KEEPER', 'processing'], | |
283 | + ['AFTER_SALES_FAILURE', 'red'], | |
284 | + ['WAITING_FOR_POST_AUDIT', 'purple'], | |
285 | + ['POST_AUDITED', 'success'], | |
286 | + ['COMPLETE_INVOICING', 'success'], | |
287 | + ['PARTIAL_INVOICING', 'processing'], | |
288 | + ['URGENT_INVOICE_AUDITING', 'warning'], | |
289 | + ['APPLY_FOR_INVOICING', 'processing'], | |
290 | + ['AUDIT_FAILURE', 'error'], | |
291 | + ['WAIT_AUDIT', 'warning'], | |
292 | + ['AUDIT_PASS', 'success'], | |
293 | + ['AUDIT_NOTPASS', 'error'], | |
294 | + ['WAIT_CONFIRM_DELIVER_AFTER_INVOICE', 'processing'], | |
295 | + ['INVOICING', 'processing'], | |
296 | + ['SALES_CONFIRM', 'warning'], | |
297 | + ['URGENT_INVOICE_AUDIT_NOTPASS', 'red'], | |
298 | + ['REISSUE', 'processing'], | |
299 | + ['CREDIT_CONFIRM', 'warning'], | |
300 | +]); | |
301 | +export const SALES_CODE_OPTIONS = [ | |
302 | + { label: 'D-Linda', value: 'D-Linda' }, | |
303 | + { label: 'G-Rita', value: 'G-Rita' }, | |
304 | + { label: 'G-Iris', value: 'G-Iris' }, | |
305 | + { label: 'X-Jessica', value: 'X-Jessica' }, | |
306 | + { label: 'G-Daniel', value: 'G-Daniel' }, | |
307 | + { label: 'D-Strong', value: 'D-Strong' }, | |
308 | + { label: 'T-Alice', value: 'T-Alice' }, | |
309 | + { label: 'X-Demi', value: 'X-Demi' }, | |
310 | + { label: 'T-Nico', value: 'T-Nico' }, | |
311 | + { label: 'T-kk', value: 'T-kk' }, | |
312 | + { label: 'T-Alma', value: 'T-Alma' }, | |
313 | + { label: 'T-Dream', value: 'T-Dream' }, | |
314 | + { label: 'T-Aimee', value: 'T-Aimee' }, | |
315 | + { label: 'D-Tina', value: 'D-Tina' }, | |
316 | + { label: 'D-Vivi', value: 'D-Vivi' }, | |
317 | + { label: 'X-Ada', value: 'X-Ada' }, | |
318 | + { label: 'X-Amy', value: 'X-Amy' }, | |
319 | + { label: 'G-Nancy', value: 'G-Nancy' }, | |
320 | + { label: 'X-Sara', value: 'X-Sara' }, | |
321 | + { label: 'X-CC', value: 'X-CC' }, | |
322 | + { label: 'X-Lucy', value: 'X-Lucy' }, | |
323 | + { label: 'X-Lulu', value: 'X-Lulu' }, | |
324 | + { label: 'X-P', value: 'X-P' }, | |
325 | + { label: 'TB', value: 'TB' }, | |
326 | + { label: 'TBHC', value: 'TBHC' }, | |
327 | + { label: 'TBC', value: 'TBC' }, | |
328 | + { label: 'G-Lisa', value: 'G-Lisa' }, | |
329 | + { label: 'G-Lynn', value: 'G-Lynn' }, | |
330 | + { label: 'G-Smile', value: 'G-Smile' }, | |
331 | + { label: 'G-Yvonne', value: 'G-Yvonne' }, | |
332 | + { label: 'G-Wendy', value: 'G-Wendy' }, | |
333 | + { label: 'T-Andy', value: 'T-Andy' }, | |
334 | + { label: 'CQ_Peter', value: 'CQ_Peter' }, | |
335 | + { label: 'MA_A_Mao', value: 'MA_A_Mao' }, | |
336 | + { label: 'CQ-2', value: 'CQ-2' }, | |
337 | + { label: 'JJ', value: 'JJ' }, | |
338 | + { label: 'CQ-3', value: 'CQ-3' }, | |
339 | + { label: 'GW', value: 'GW' }, | |
340 | +]; | |
341 | + | |
342 | +// export const SALES_CODE_OPTIONS = [ | |
343 | +// { label: 'HQ_Linda', value: 'HQ_Linda' }, | |
344 | +// { label: 'HQ-1_Rita', value: 'HQ-1_Rita' }, | |
345 | +// { label: 'HQ-2_Lisa', value: 'HQ-2_Lisa' }, | |
346 | +// { label: 'HQ-3_iris', value: 'HQ-3_iris' }, | |
347 | +// { label: 'HQ-4_Lynn', value: 'HQ-4_Lynn' }, | |
348 | +// { label: 'HQ-5_Jessica', value: 'HQ-5_Jessica' }, | |
349 | +// { label: 'HQ-6_smile', value: 'HQ-6_smile' }, | |
350 | +// { label: 'HQ-7_Yvonne', value: 'HQ-7_Yvonne' }, | |
351 | +// { label: 'HQ-8_Daniel', value: 'HQ-8_Daniel' }, | |
352 | +// { label: 'HQ-9_Wendy', value: 'HQ-9_Wendy' }, | |
353 | +// { label: 'W_strong', value: 'W_strong' }, | |
354 | +// { label: 'W-1_Alice', value: 'W-1_Alice' }, | |
355 | +// { label: 'W-2_Demi', value: 'W-2_Demi' }, | |
356 | +// { label: 'W-3_Nico', value: 'W-3_Nico' }, | |
357 | +// { label: 'W-4_kk', value: 'W-4_kk' }, | |
358 | +// { label: 'W-5_Alma', value: 'W-5_Alma' }, | |
359 | +// { label: 'W-6_Dream', value: 'W-6_Dream' }, | |
360 | +// { label: 'W-7_Aimee', value: 'W-7_Aimee' }, | |
361 | +// { label: 'XX_Tina', value: 'XX_Tina' }, | |
362 | +// { label: 'XX-2_Vivi', value: 'XX-2_Vivi' }, | |
363 | +// { label: 'XX-A1_Ada', value: 'XX-A1_Ada' }, | |
364 | +// { label: 'XX-A2_Amy', value: 'XX-A2_Amy' }, | |
365 | +// { label: 'XX-N1_Nancy', value: 'XX-N1_Nancy' }, | |
366 | +// { label: 'XX-N2_Sara', value: 'XX-N2_Sara' }, | |
367 | +// { label: 'XX-C_CC', value: 'XX-C_CC' }, | |
368 | +// { label: 'XX-L1_Lucy', value: 'XX-L1_Lucy' }, | |
369 | +// { label: 'XX-L2_Lulu', value: 'XX-L2_Lulu' }, | |
370 | +// { label: 'XX-P', value: 'XX-P' }, | |
371 | +// { label: 'TB', value: 'TB' }, | |
372 | +// { label: 'HCTB', value: 'HCTB' }, | |
373 | +// { label: 'TBC', value: 'TBC' }, | |
374 | +// { label: 'GW-3_iris', value: 'GW-3_iris' }, | |
375 | +// { label: 'GW-4_Lynn', value: 'GW-4_Lynn' }, | |
376 | +// { label: 'GW-6_smile', value: 'GW-6_smile' }, | |
377 | +// { label: 'GW-7_Yvonne', value: 'GW-7_Yvonne' }, | |
378 | +// { label: 'GW-9_Wendy', value: 'GW-9_Wendy' }, | |
379 | +// { label: 'W-9_Jack', value: 'W-9_Jack' }, | |
380 | +// { label: 'W-8_Andy', value: 'W-8_Andy' }, | |
381 | +// { label: 'CQ_Peter', value: 'CQ_Peter' }, | |
382 | +// { label: 'MA_A_Mao', value: 'MA_A_Mao' }, | |
383 | +// { label: 'CQ-2', value: 'CQ-2' }, | |
384 | +// { label: 'JJ', value: 'JJ' }, | |
385 | +// { label: 'CQ-3', value: 'CQ-3' }, | |
386 | +// ]; | |
387 | + | |
388 | +export const HISTORY_OPT_TYPE = new Map<string, string>([ | |
389 | + ['DELETE', '作废'], | |
390 | + ['UPDATE', '编辑'], | |
391 | + ['ADD', '创建'], | |
392 | + ['SEND', '发货'], | |
393 | + ['CHECK', '审核'], | |
394 | + ['CONFIRM_RECEIPT', '确认收货'], | |
395 | + ['PRINT_ORDER', '打印'], | |
396 | + ['INVOICING', '财务开票'], | |
397 | + ['EDIT_ORDER', '财务编辑'], | |
398 | + ['MODIFY_SEN_INFORMATION', '发货信息编辑'], | |
399 | + ['UN_INVOICING', '财务取消开票'], | |
400 | + ['FINANCE_CHECK_ORDER', '财务审核'], | |
401 | + ['PROCURE_CHECK_ORDER', '采购审核'], | |
402 | + ['SUPPLIER_PRINT', '供应商打印'], | |
403 | + ['EXTERNAL_PROCUREMENT', '仓库操作外部采购子订单'], | |
404 | + ['APPLY_AFTER_SALES', '申请售后子订单'], | |
405 | + ['AFTER_SALES_COMPLETION', '完成售后子订单'], | |
406 | + ['PROCURE_PRINT', '采购打印子订单'], | |
407 | + ['PROCURE_SEND', '采购发货子订单'], | |
408 | + ['NO_NEED_SEND', '不需要发货'], | |
409 | + ['PROCURE_CONVERT_WAREHOUSE_KEEPER', '采购转仓库'], | |
410 | + ['PROCURE_CONVERT_PROCURE', '采购转发'], | |
411 | + ['MERGE_APPLY_INVOICING', '合并申请开票'], | |
412 | + ['PROCURE_ORDER', '采购下单'], | |
413 | + ['SALES_APPLY_INVOICING', '申请开票'], | |
414 | + ['LEADER_AUDIT', '直属领导审核'], | |
415 | + ['FINANCE_APPLY_INVOICING', '财务开票'], | |
416 | + ['after-sales', '申请售后'], | |
417 | + ['after-sales-CHECK', '售后审核'], | |
418 | + ['order-change-normal', '申请修改'], | |
419 | + ['order-change-normal-CHECK', '申请修改审核'], | |
420 | + ['modify_leader_audit', '申请修改领导审核'], | |
421 | + ['node_operating_audit', '申请修改节点审核'], | |
422 | + ['warehouse_audit', '仓库审核'], | |
423 | + ['post_audit', '后置审核'], | |
424 | + ['applyModify', '申请修改订单信息'], | |
425 | + ['OUTSIDE_SYSTEM_PUSH', '外部系统推送了本订单'], | |
426 | + ['cancelSendOrder', '取消发货'], | |
427 | + ['salesConfirm', '商城订单销售确认'], | |
428 | + ['credit_audit', '赊账审核'], | |
429 | +]); | |
430 | + | |
431 | +export const MAIN_ORDER_COLUMNS = [ | |
432 | + { | |
433 | + title: '订单列表', | |
434 | + width: 120, | |
435 | + dataIndex: 'name', | |
436 | + search: false, | |
437 | + }, | |
438 | + { | |
439 | + title: '订单编号', | |
440 | + dataIndex: 'id', | |
441 | + valueType: 'text', | |
442 | + hideInTable: true, | |
443 | + }, | |
444 | + { | |
445 | + title: '收货人', | |
446 | + dataIndex: 'customerName', | |
447 | + valueType: 'text', | |
448 | + hideInTable: true, | |
449 | + }, | |
450 | + { | |
451 | + title: '销售代表', | |
452 | + dataIndex: 'salesCode', | |
453 | + valueType: 'text', | |
454 | + hideInTable: true, | |
455 | + }, | |
456 | + { | |
457 | + title: '子订单编号', | |
458 | + dataIndex: 'subOrderId', | |
459 | + valueType: 'text', | |
460 | + hideInTable: true, | |
461 | + }, | |
462 | + { | |
463 | + title: '收货人联系电话', | |
464 | + dataIndex: 'customerContactNumber', | |
465 | + valueType: 'text', | |
466 | + hideInTable: true, | |
467 | + }, | |
468 | + { | |
469 | + title: '单位', | |
470 | + dataIndex: 'institution', | |
471 | + valueType: 'select', | |
472 | + hideInTable: true, | |
473 | + hideInSearch: true, | |
474 | + // fieldProps: { | |
475 | + // showSearch: true, | |
476 | + // }, | |
477 | + request: async (value, { params }) => { | |
478 | + const keywords = value.keyWords; | |
479 | + const { data } = await postServiceOrderQueryCustomerInformation({ | |
480 | + data: { name: 'institution', institution: keywords }, | |
481 | + params: params, | |
482 | + }); | |
483 | + let options = data | |
484 | + .filter((c: any) => { | |
485 | + return c.orderName === 'institution'; | |
486 | + }) | |
487 | + .map((item: any) => { | |
488 | + return { | |
489 | + label: item.orderValue, | |
490 | + value: item.orderValue, | |
491 | + }; | |
492 | + }); | |
493 | + return options; | |
494 | + }, | |
495 | + }, | |
496 | + { | |
497 | + title: '课题组', | |
498 | + dataIndex: 'institutionContactName', | |
499 | + valueType: 'select', | |
500 | + hideInTable: true, | |
501 | + // fieldProps: { | |
502 | + // showSearch: true, | |
503 | + // }, | |
504 | + request: async (value, { params }) => { | |
505 | + const keywords = value.keyWords; | |
506 | + const { data } = await postServiceOrderQueryCustomerInformation({ | |
507 | + data: { | |
508 | + name: 'institutionContactName', | |
509 | + institutionContactName: keywords, | |
510 | + }, | |
511 | + params: params, | |
512 | + }); | |
513 | + let options = data | |
514 | + .filter((c: any) => { | |
515 | + return c.orderName === 'institutionCustomerUser'; | |
516 | + }) | |
517 | + .map((item: any) => { | |
518 | + return { | |
519 | + label: item.orderValue, | |
520 | + value: item.orderValue, | |
521 | + }; | |
522 | + }); | |
523 | + return options; | |
524 | + }, | |
525 | + }, | |
526 | + { | |
527 | + title: '收货人地址', | |
528 | + dataIndex: 'customerShippingAddress', | |
529 | + valueType: 'text', | |
530 | + hideInTable: true, | |
531 | + }, | |
532 | + { | |
533 | + title: '商品名称', | |
534 | + dataIndex: 'productName', | |
535 | + valueType: 'text', | |
536 | + hideInTable: true, | |
537 | + }, | |
538 | + { | |
539 | + title: '主订单备注', | |
540 | + dataIndex: 'mainNotes', | |
541 | + valueType: 'text', | |
542 | + hideInTable: true, | |
543 | + hideInSearch: true, | |
544 | + }, | |
545 | + { | |
546 | + title: '子订单备注', | |
547 | + dataIndex: 'subNotes', | |
548 | + valueType: 'text', | |
549 | + hideInTable: true, | |
550 | + hideInSearch: true, | |
551 | + }, | |
552 | + { | |
553 | + title: '商品参数', | |
554 | + dataIndex: 'parameters', | |
555 | + valueType: 'text', | |
556 | + hideInTable: true, | |
557 | + hideInSearch: true, | |
558 | + }, | |
559 | + { | |
560 | + title: '预警状态', | |
561 | + dataIndex: 'warningStatus', | |
562 | + valueType: 'select', | |
563 | + hideInTable: true, | |
564 | + hideInSearch: true, | |
565 | + valueEnum: { | |
566 | + invoiceConfirmWarning: { | |
567 | + text: '待确认开票预警', | |
568 | + status: 'invoiceConfirmWarning', | |
569 | + }, | |
570 | + paymentReceiptStatusWarning: { | |
571 | + text: '待回款预警', | |
572 | + status: 'paymentReceiptStatusWarning', | |
573 | + }, | |
574 | + }, | |
575 | + }, | |
576 | + { | |
577 | + title: '售后类型', | |
578 | + dataIndex: 'orderStatus', | |
579 | + valueType: 'select', | |
580 | + hideInTable: true, | |
581 | + // hideInSearch:true, | |
582 | + valueEnum: (() => { | |
583 | + const filteredOptions = Object.entries(ORDER_STATUS_OPTIONS).filter( | |
584 | + ([key]) => | |
585 | + [ | |
586 | + 'IN_AFTER_SALES', | |
587 | + 'AFTER_SALES_COMPLETION', | |
588 | + 'AFTER_SALES_FAILURE', | |
589 | + ].includes(key), | |
590 | + ); | |
591 | + return Object.fromEntries(filteredOptions); | |
592 | + })(), | |
593 | + }, | |
594 | + { | |
595 | + title: '修改审核状态', | |
596 | + dataIndex: 'modifiedAuditStatus', | |
597 | + valueType: 'select', | |
598 | + hideInTable: true, | |
599 | + valueEnum: enumToProTableEnumValue(MODIFIED_AUDIT_STATUS_OPTIONS), | |
600 | + hideInSearch: true, | |
601 | + }, | |
602 | + { | |
603 | + title: '支付方式', | |
604 | + dataIndex: 'paymentMethod', | |
605 | + valueType: 'select', | |
606 | + hideInTable: true, | |
607 | + valueEnum: enumToProTableEnumValue(PAYMENT_METHOD_OPTIONS), | |
608 | + hideInSearch: true, | |
609 | + }, | |
610 | + { | |
611 | + title: '回款审核状态', | |
612 | + dataIndex: 'paymentReceiptStatus', | |
613 | + valueType: 'select', | |
614 | + hideInTable: true, | |
615 | + hideInSearch: true, | |
616 | + valueEnum: enumToProTableEnumValue(PAYMENT_RECEIPTS_STATUS_OPTIONS), | |
617 | + }, | |
618 | + { | |
619 | + title: '物流方式', | |
620 | + dataIndex: 'logisticsMethod', | |
621 | + valueType: 'select', | |
622 | + hideInTable: true, | |
623 | + hideInSearch: true, | |
624 | + valueEnum: enumToProTableEnumValue(LOGISTICS_STATUS_OPTIONS), | |
625 | + }, | |
626 | + { | |
627 | + title: '支付渠道', | |
628 | + dataIndex: 'paymentChannel', | |
629 | + valueType: 'select', | |
630 | + hideInTable: true, | |
631 | + hideInSearch: true, | |
632 | + valueEnum: enumToProTableEnumValue(PAYMENT_CHANNEL_OPTIONS), | |
633 | + }, | |
634 | + { | |
635 | + title: '银行名称', | |
636 | + dataIndex: 'bank', | |
637 | + valueType: 'text', | |
638 | + hideInTable: true, | |
639 | + hideInSearch: true, | |
640 | + }, | |
641 | + { | |
642 | + title: '支付流水', | |
643 | + dataIndex: 'paymentTransactionId', | |
644 | + valueType: 'text', | |
645 | + hideInTable: true, | |
646 | + hideInSearch: true, | |
647 | + }, | |
648 | + { | |
649 | + title: '所属部门', | |
650 | + dataIndex: 'productBelongBusiness', | |
651 | + valueType: 'select', | |
652 | + hideInTable: true, | |
653 | + hideInSearch: true, | |
654 | + valueEnum: enumToProTableEnumValue(PRODUCT_BELONG_DEPARTMENT_OPTIONS), | |
655 | + }, | |
656 | + { | |
657 | + title: '所属大区', | |
658 | + dataIndex: 'orderZoning', | |
659 | + valueType: 'select', | |
660 | + hideInTable: true, | |
661 | + hideInSearch: true, | |
662 | + request: async () => { | |
663 | + const res = await postOrderErpOrderZoNingSelectSaleUserHasZoning({ | |
664 | + data: JSON.parse(localStorage.getItem('userInfo')).id, | |
665 | + }); | |
666 | + let sel = []; | |
667 | + res.data.forEach((item) => { | |
668 | + sel.push({ | |
669 | + label: item.zoning, | |
670 | + value: item.id, | |
671 | + }); | |
672 | + }); | |
673 | + return sel; | |
674 | + }, | |
675 | + }, | |
676 | + { | |
677 | + title: '创建日期', | |
678 | + dataIndex: 'createTime', | |
679 | + valueType: 'dateTimeRange', | |
680 | + hideInTable: true, | |
681 | + hideInSearch: true, | |
682 | + search: { | |
683 | + transform: (value) => { | |
684 | + return { | |
685 | + beginTime: value[0], | |
686 | + endTime: value[1], | |
687 | + }; | |
688 | + }, | |
689 | + }, | |
690 | + }, | |
691 | + { | |
692 | + title: '是否需要开票', | |
693 | + dataIndex: 'invoicingStatus', | |
694 | + valueType: 'select', | |
695 | + hideInTable: true, | |
696 | + hideInSearch: true, | |
697 | + valueEnum: enumToProTableEnumValue(INVOCING_STATUS_OPTIONS), | |
698 | + }, | |
699 | + { | |
700 | + title: '开票状态', | |
701 | + dataIndex: 'afterInvoicingStatus', | |
702 | + valueType: 'select', | |
703 | + hideInTable: true, | |
704 | + hideInSearch: true, | |
705 | + valueEnum: enumToProTableEnumValue(AFTER_INVOICING_STATUS), | |
706 | + }, | |
707 | + { | |
708 | + title: '发票号码', | |
709 | + dataIndex: 'invoiceNumberLike', | |
710 | + valueType: 'text', | |
711 | + hideInTable: true, | |
712 | + hideInSearch: true, | |
713 | + }, | |
714 | + { | |
715 | + title: '付款公司', | |
716 | + dataIndex: 'receivingCompany', | |
717 | + valueType: 'select', | |
718 | + hideInTable: true, | |
719 | + hideInSearch: true, | |
720 | + valueEnum: enumToProTableEnumValue( | |
721 | + getReceivingCompanyOptions(PAYEE_OPTIONS), | |
722 | + ), | |
723 | + }, | |
724 | + { | |
725 | + title: '开票日期', | |
726 | + dataIndex: 'invoicingTime', | |
727 | + valueType: 'dateRange', | |
728 | + hideInTable: true, | |
729 | + hideInSearch: true, | |
730 | + search: { | |
731 | + transform: (value) => { | |
732 | + return { | |
733 | + invoicingBeginTime: value[0], | |
734 | + invoicingEndTime: value[1], | |
735 | + }; | |
736 | + }, | |
737 | + }, | |
738 | + }, | |
739 | + { | |
740 | + title: '申请开票时间', | |
741 | + dataIndex: 'applyTime', | |
742 | + valueType: 'dateTimeRange', | |
743 | + hideInTable: true, | |
744 | + hideInSearch: true, | |
745 | + search: { | |
746 | + transform: (value) => { | |
747 | + return { | |
748 | + applyBeginTime: value[0], | |
749 | + applyEndTime: value[1], | |
750 | + }; | |
751 | + }, | |
752 | + }, | |
753 | + }, | |
754 | + { | |
755 | + title: '生产开始时间', | |
756 | + dataIndex: 'productionStartTime', | |
757 | + valueType: 'dateRange', | |
758 | + hideInTable: true, | |
759 | + hideInSearch: true, | |
760 | + search: { | |
761 | + transform: (value) => { | |
762 | + return { | |
763 | + productionStartTimeStart: value[0], | |
764 | + productionStartTimeEnd: value[1], | |
765 | + }; | |
766 | + }, | |
767 | + }, | |
768 | + }, | |
769 | + | |
770 | + { | |
771 | + title: '生产结束时间', | |
772 | + dataIndex: 'productionEndTime', | |
773 | + valueType: 'dateRange', | |
774 | + hideInTable: true, | |
775 | + hideInSearch: true, | |
776 | + search: { | |
777 | + transform: (value) => { | |
778 | + return { | |
779 | + productionEndTimeStart: value[0], | |
780 | + productionEndTimeEnd: value[1], | |
781 | + }; | |
782 | + }, | |
783 | + }, | |
784 | + }, | |
785 | + | |
786 | + // { | |
787 | + // title: '是否完全收款', | |
788 | + // dataIndex: 'receiptsStatus', | |
789 | + // valueType: 'select', | |
790 | + // hideInTable: true, | |
791 | + // valueEnum:[{text:'是',status:'YES'},{text:'否',status:'NO'}] | |
792 | + // } | |
793 | +]; | |
794 | + | |
795 | +export const SUB_ORDER_COLUMNS = [ | |
796 | + { title: 'ID', dataIndex: 'id', key: 'id', width: 80 }, | |
797 | + { | |
798 | + title: '商品编码', | |
799 | + dataIndex: 'productCode', | |
800 | + key: 'productCode', | |
801 | + width: 80, | |
802 | + }, | |
803 | + { | |
804 | + title: '商品名称', | |
805 | + dataIndex: 'productName', | |
806 | + key: 'productName', | |
807 | + width: 80, | |
808 | + }, | |
809 | + { title: '商品参数', dataIndex: 'parameters', key: 'parameters', width: 80 }, | |
810 | + { title: '商品数量', dataIndex: 'quantity', key: 'quantity', width: 80 }, | |
811 | + { | |
812 | + title: '子订单金额(¥)', | |
813 | + dataIndex: 'subOrderPayment', | |
814 | + key: 'subOrderPayment', | |
815 | + width: 80, | |
816 | + }, | |
817 | + { | |
818 | + title: '所属事业部', | |
819 | + dataIndex: 'productBelongBusiness', | |
820 | + key: 'productBelongBusiness', | |
821 | + width: 80, | |
822 | + }, | |
823 | + { | |
824 | + title: '支付方式', | |
825 | + dataIndex: 'paymentMethod', | |
826 | + key: 'paymentMethod', | |
827 | + width: 80, | |
828 | + }, | |
829 | + { | |
830 | + title: '支付渠道', | |
831 | + dataIndex: 'paymentChannel', | |
832 | + key: 'paymentChannel', | |
833 | + width: 80, | |
834 | + }, | |
835 | + { | |
836 | + title: '支付流水', | |
837 | + dataIndex: 'paymentTransactionId', | |
838 | + key: 'paymentTransactionId', | |
839 | + width: 80, | |
840 | + }, | |
841 | + { | |
842 | + title: '物流方式', | |
843 | + dataIndex: 'logisticsMethod', | |
844 | + key: 'logisticsMethod', | |
845 | + width: 80, | |
846 | + }, | |
847 | + { | |
848 | + title: '物流单号', | |
849 | + dataIndex: 'serialNumber', | |
850 | + key: 'serialNumber', | |
851 | + width: 80, | |
852 | + }, | |
853 | + { | |
854 | + title: '开票状态', | |
855 | + dataIndex: 'invoicingStatus', | |
856 | + key: 'invoicingStatus', | |
857 | + component: 'tag', | |
858 | + width: 80, | |
859 | + }, | |
860 | + { | |
861 | + title: '订单状态', | |
862 | + dataIndex: 'orderStatus', | |
863 | + key: 'orderStatus', | |
864 | + component: 'tag', | |
865 | + width: 80, | |
866 | + }, | |
867 | +]; | ... | ... |
src/pages/Order/FeedBack/hooks.ts
0 → 100644
1 | +import { useModel } from 'umi'; | |
2 | +import { OPERATION_TYPE, ROLE } from './type.d'; | |
3 | + | |
4 | +function setAllValuesToTrue(obj: Record<string, boolean | object>) { | |
5 | + return Object.keys(obj).reduce( | |
6 | + (result, key) => { | |
7 | + if (typeof obj[key] === 'object') { | |
8 | + result[key] = setAllValuesToTrue(obj[key] as Record<string, object>); | |
9 | + } else { | |
10 | + result[key] = true; | |
11 | + } | |
12 | + return result; | |
13 | + }, | |
14 | + {} as Record<string, boolean | object>, | |
15 | + ); | |
16 | +} | |
17 | + | |
18 | +// 获取用户可编辑字段 | |
19 | +export const useFieldAuth = ({ operation }: { operation: OPERATION_TYPE }) => { | |
20 | + const { role } = useModel('user'); | |
21 | + | |
22 | + let authFields = { | |
23 | + bank: false, | |
24 | + bankAccountNumber: false, | |
25 | + createTime: false, | |
26 | + customerContactNumber: false, | |
27 | + customerName: false, | |
28 | + customerShippingAddress: false, | |
29 | + id: false, | |
30 | + institution: false, | |
31 | + institutionContactName: false, | |
32 | + invoiceIdentificationNumber: false, | |
33 | + notes: false, | |
34 | + salesCode: false, | |
35 | + subOrderInformationLists: { | |
36 | + id: false, | |
37 | + invoicingStatus: false, | |
38 | + mainOrderId: false, | |
39 | + orderStatus: false, | |
40 | + parameters: false, | |
41 | + paymentChannel: false, | |
42 | + productCode: false, | |
43 | + productName: false, | |
44 | + quantity: false, | |
45 | + subOrderPayment: false, | |
46 | + }, | |
47 | + } as Record<string, boolean | object>; | |
48 | + | |
49 | + console.log(role); | |
50 | + | |
51 | + if (operation === OPERATION_TYPE.CREATE) { | |
52 | + return authFields; | |
53 | + } else if (operation === OPERATION_TYPE.EDIT) { | |
54 | + if (role === ROLE.ADMIN) { | |
55 | + return authFields; | |
56 | + } else if (role === ROLE.SALESMAN) { | |
57 | + // 将所有的字段设置为没有权限编辑 | |
58 | + authFields = setAllValuesToTrue(authFields); | |
59 | + // 筛选字段为可编辑 | |
60 | + authFields = { | |
61 | + ...authFields, | |
62 | + invoiceInformation: false, | |
63 | + }; | |
64 | + } | |
65 | + } | |
66 | + return { authFields }; | |
67 | +}; | ... | ... |
src/pages/Order/FeedBack/index.css
0 → 100644
1 | +.order-page-container .ant-table .ant-table-middle { | |
2 | + margin-inline: 0 !important; | |
3 | +} | |
4 | + | |
5 | +.order-page-container td { | |
6 | + font-family: 'San Francisco', 'Helvetica Neue', Helvetica, Arial, | |
7 | + 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC', | |
8 | + 'WenQuanYi Micro Hei', sans-serif; | |
9 | + font-size: 13px; | |
10 | +} | |
11 | + | |
12 | +#total-payment .ant-input-number-group-addon { | |
13 | + padding: 0 !important; | |
14 | +} | |
15 | + | |
16 | +.order-page-container table:hover, | |
17 | +.order-page-container tr:hover, | |
18 | +.order-page-container thead:hover { | |
19 | + background: none !important; | |
20 | +} | |
21 | + | |
22 | +#main-table .ant-table-tbody > tr.ant-table-row:hover > td { | |
23 | + background: none !important; | |
24 | +} | |
25 | + | |
26 | +.order-page-container .ant-pro-card { | |
27 | + background-color: transparent; | |
28 | +} | |
29 | + | |
30 | +#main-table .ant-table-tbody .ant-table-cell { | |
31 | + padding: 10px 0 0; | |
32 | +} | |
33 | + | |
34 | +.order-page-container .ant-pagination { | |
35 | + background-color: #fff !important; | |
36 | + padding: 10px; | |
37 | + border-radius: 8px; | |
38 | +} | |
39 | + | |
40 | +.order-page-container .ant-pro-table .ant-form { | |
41 | + background-color: #fff; | |
42 | + border-radius: 8px; | |
43 | +} | |
44 | + | |
45 | +#main-table .ant-table-tbody { | |
46 | + background-color: #f5f5f5; | |
47 | +} | |
48 | + | |
49 | +.order-page-container .ant-pro-card-body { | |
50 | + padding: 0 !important; | |
51 | +} | |
52 | + | |
53 | +.order-page-container .ant-table-thead .ant-table-cell { | |
54 | + background-color: #fff !important; | |
55 | + border-radius: 8px !important; | |
56 | +} | |
57 | + | |
58 | +#sub-table tbody td { | |
59 | + padding: 10px 0 !important; | |
60 | +} | |
61 | + | |
62 | +#sub-table tbody tr:first-child td:first-child { | |
63 | + border-top-left-radius: 8px; | |
64 | +} | |
65 | + | |
66 | +#sub-table tbody tr:first-child td:nth-child(2) { | |
67 | + border-top-right-radius: 8px; | |
68 | +} | |
69 | + | |
70 | +#sub-table tbody tr:last-child td:first-child { | |
71 | + border-bottom-left-radius: 8px; | |
72 | +} | |
73 | + | |
74 | +#sub-table tbody tr:last-child td:nth-child(2) { | |
75 | + border-bottom-right-radius: 8px; | |
76 | +} | |
77 | + | |
78 | +#sub-table tbody tr td:first-child { | |
79 | + border-top: 1px solid #d7d6d6; | |
80 | + | |
81 | + /* 设置行与行之间分割线的颜色 */ | |
82 | + border-bottom: 1px solid #d7d6d6; | |
83 | + | |
84 | + /* 设置行与行之间分割线的颜色 */ | |
85 | + border-left: 1px solid #d7d6d6; | |
86 | + | |
87 | + /* 设置行与行之间分割线的颜色 */ | |
88 | +} | |
89 | + | |
90 | +#sub-table tbody tr td:nth-child(2) { | |
91 | + border-top: 1px solid #d7d6d6; | |
92 | + | |
93 | + /* 设置行与行之间分割线的颜色 */ | |
94 | + border-bottom: 1px solid #d7d6d6; | |
95 | + | |
96 | + /* 设置行与行之间分割线的颜色 */ | |
97 | + border-right: 1px solid #d7d6d6; | |
98 | + | |
99 | + /* 设置行与行之间分割线的颜色 */ | |
100 | +} | ... | ... |
src/pages/Order/FeedBack/index.less
0 → 100644
1 | +// 嵌套表格去掉左方多余部分 | |
2 | +.order-page-container .ant-table .ant-table-middle { | |
3 | + margin-inline: 0 !important; | |
4 | +} | |
5 | + | |
6 | +.order-page-container td { | |
7 | + font-family: 'San Francisco', 'Helvetica Neue', Helvetica, Arial, | |
8 | + 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC', | |
9 | + 'WenQuanYi Micro Hei', sans-serif; | |
10 | + font-size: 13px; | |
11 | +} | |
12 | +//订单编辑抽屉中,订单总额addonAfter的padding去除 | |
13 | +#total-payment .ant-input-number-group-addon { | |
14 | + padding: 0 !important; | |
15 | +} | |
16 | + | |
17 | +.order-page-container table:hover, | |
18 | +.order-page-container tr:hover, | |
19 | +.order-page-container thead:hover { | |
20 | + background: none !important; | |
21 | +} | |
22 | + | |
23 | +#main-table .ant-table-tbody > tr.ant-table-row:hover > td { | |
24 | + background: none !important; | |
25 | +} | |
26 | + | |
27 | +.order-page-container .ant-pro-card { | |
28 | + background-color: transparent; | |
29 | +} | |
30 | + | |
31 | +#main-table .ant-table-tbody .ant-table-cell { | |
32 | + padding: 10px 0 0; | |
33 | +} | |
34 | + | |
35 | +.order-page-container .ant-pagination { | |
36 | + background-color: #fff !important; | |
37 | + padding: 10px; | |
38 | + border-radius: 8px; | |
39 | +} | |
40 | + | |
41 | +.order-page-container .ant-pro-table .ant-form { | |
42 | + background-color: #fff; | |
43 | + border-radius: 8px; | |
44 | +} | |
45 | + | |
46 | +#main-table .ant-table-tbody { | |
47 | + background-color: #f5f5f5; | |
48 | +} | |
49 | + | |
50 | +.order-page-container .ant-pro-card-body { | |
51 | + padding: 0 !important; | |
52 | +} | |
53 | + | |
54 | +.order-page-container .ant-table-thead .ant-table-cell { | |
55 | + background-color: #fff !important; | |
56 | + border-radius: 8px !important; | |
57 | +} | |
58 | + | |
59 | +#sub-table tbody td { | |
60 | + padding: 10px 0 !important; | |
61 | +} | |
62 | + | |
63 | +// 子订单第一行的上边两个角为圆角 | |
64 | +#sub-table tbody tr:first-child td:first-child { | |
65 | + border-top-left-radius: 8px; | |
66 | +} | |
67 | + | |
68 | +#sub-table tbody tr:first-child td:nth-child(2) { | |
69 | + border-top-right-radius: 8px; | |
70 | +} | |
71 | + | |
72 | +//子订单最后一行的下边两个角为圆角 | |
73 | +#sub-table tbody tr:last-child td:first-child { | |
74 | + border-bottom-left-radius: 8px; | |
75 | +} | |
76 | + | |
77 | +#sub-table tbody tr:last-child td:nth-child(2) { | |
78 | + border-bottom-right-radius: 8px; | |
79 | +} | |
80 | + | |
81 | +//子订单边线颜色 | |
82 | +#sub-table tbody tr td:first-child { | |
83 | + border-top: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */ | |
84 | + border-bottom: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */ | |
85 | + border-left: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */ | |
86 | +} | |
87 | + | |
88 | +#sub-table tbody tr td:nth-child(2) { | |
89 | + border-top: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */ | |
90 | + border-bottom: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */ | |
91 | + border-right: 1px solid #d7d6d6; /* 设置行与行之间分割线的颜色 */ | |
92 | +} | |
93 | + | |
94 | +//tooltip字体颜色自定义 | |
95 | +// .order-tooltip .ant-tooltip-inner{ | |
96 | +// color: black !important; | |
97 | +// } | ... | ... |
src/pages/Order/FeedBack/index.tsx
0 → 100644
1 | +import OrderList from './OrderList'; | |
2 | +import './index.less'; | |
3 | + | |
4 | +const OrderPage = () => { | |
5 | + return ( | |
6 | + <div className="order-page-container"> | |
7 | + <div id="resizeDiv"></div> | |
8 | + <div id="resizeDiv"></div> | |
9 | + <OrderList paramsNew={{}} searchShow={true} toolbarShow={true} /> | |
10 | + </div> | |
11 | + ); | |
12 | +}; | |
13 | + | |
14 | +export default OrderPage; | ... | ... |
src/pages/Order/FeedBack/table.less
0 → 100644
src/pages/Order/FeedBack/type.d.ts
0 → 100644
1 | +export enum ROLE { | |
2 | + ADMIN = 'admin', // 管理 | |
3 | + SALESMAN = 'salesman', //销售 | |
4 | + FINANCE = 'finance', // 财务 | |
5 | +} | |
6 | + | |
7 | +export enum OPERATION_TYPE { | |
8 | + CREATE = 'create', | |
9 | + EDIT = 'edit', | |
10 | + READ = 'read', | |
11 | +} | |
12 | + | |
13 | +export interface OrderType { | |
14 | + id: string; | |
15 | +} | |
16 | + | |
17 | +export interface OrderListItemType { | |
18 | + goodsVolume: any; | |
19 | + goodsWeight: any; | |
20 | + receivingCompany: any; | |
21 | + modified: any; | |
22 | + paths: any; | |
23 | + totalPayment: ReactNode; | |
24 | + notes: ReactNode; | |
25 | + invoiceIdentificationNumber: ReactNode; | |
26 | + bankAccountNumber: ReactNode; | |
27 | + bank: ReactNode; | |
28 | + id: undefined; | |
29 | + subOrderInformationLists: any; | |
30 | + createTime: ReactNode; | |
31 | + mainOrderId: number; | |
32 | + salesCode: string; | |
33 | + customerName: string; | |
34 | + customerContactNumber: string; | |
35 | + customerShippingAddress: string; | |
36 | + institutionContactName: string; | |
37 | + institution: string; | |
38 | + mainOrderCreateTime: string; | |
39 | + mainOrderUpdateTime: string; | |
40 | + mainOrderCreateByName: string; | |
41 | + mainOrderUpdateByName: any; | |
42 | + subOrders: { | |
43 | + subOrderId: number; | |
44 | + productCode: number; | |
45 | + productName: string; | |
46 | + quantity: number; | |
47 | + productPrice: number; | |
48 | + unit: string; | |
49 | + parameters: any; | |
50 | + totalPayment: number; | |
51 | + subOrderPayment: number; | |
52 | + isCancel: number; | |
53 | + logisticsStatus: string; | |
54 | + paymentStatus: string; | |
55 | + paymentMethod: string; | |
56 | + paymentChannel: string; | |
57 | + paymentTransactionId: any; | |
58 | + invoiceInformation: any; | |
59 | + invoicingStatus: string; | |
60 | + productBelongDepartment: string; | |
61 | + waybillNumber: any; | |
62 | + notes: any; | |
63 | + examineNotes: any; | |
64 | + orderStatus: string; | |
65 | + subOrderCreateTime: string; | |
66 | + subOrderUpdateTime: string; | |
67 | + subOrderCreateByName: string; | |
68 | + subOrderUpdateByName: any; | |
69 | + }[]; | |
70 | +} | ... | ... |