Commit 051aac20b902add0b8fd449f731886014c19ec70

Authored by zhongnanhuang
2 parents 1d3923f9 a7490fa1

Merge branch 'znh231124' into 'develop'

feat: update copyOrder,subOrderNotes



See merge request !8
src/app.ts
@@ -102,6 +102,10 @@ export const request: RequestConfig = { @@ -102,6 +102,10 @@ export const request: RequestConfig = {
102 message.error(data.message); 102 message.error(data.message);
103 } 103 }
104 104
  105 + if (data.result === 401) {
  106 + history.push('/login');
  107 + }
  108 +
105 // do something 109 // do something
106 return response; 110 return response;
107 }, 111 },
src/pages/Login/index.tsx
@@ -10,7 +10,7 @@ import { @@ -10,7 +10,7 @@ import {
10 ProFormText, 10 ProFormText,
11 } from '@ant-design/pro-components'; 11 } from '@ant-design/pro-components';
12 import { history, useModel } from '@umijs/max'; 12 import { history, useModel } from '@umijs/max';
13 -import { theme } from 'antd'; 13 +import { Button, theme } from 'antd';
14 import { useEffect, useState } from 'react'; 14 import { useEffect, useState } from 'react';
15 15
16 export default () => { 16 export default () => {
@@ -41,9 +41,11 @@ export default () => { @@ -41,9 +41,11 @@ export default () => {
41 data: { ...values, imgCaptchaUuid: uuid }, 41 data: { ...values, imgCaptchaUuid: uuid },
42 }); 42 });
43 43
44 - setUserLocalInfo(res.data.token, res.data?.user);  
45 if (res.result === RESPONSE_CODE.SUCCESS) { 44 if (res.result === RESPONSE_CODE.SUCCESS) {
  45 + setUserLocalInfo(res.data.token, res.data?.user);
46 history.push('/order'); 46 history.push('/order');
  47 + } else {
  48 + fetchCode();
47 } 49 }
48 }} 50 }}
49 > 51 >
@@ -96,6 +98,9 @@ export default () => { @@ -96,6 +98,9 @@ export default () => {
96 fetchCode(); 98 fetchCode();
97 }} 99 }}
98 /> 100 />
  101 + <Button type="link" size="small" onClick={fetchCode}>
  102 + 点击刷新
  103 + </Button>
99 {/* <ProFormCheckbox noStyle name="autoLogin"> 104 {/* <ProFormCheckbox noStyle name="autoLogin">
100 自动登录 105 自动登录
101 </ProFormCheckbox> */} 106 </ProFormCheckbox> */}
src/pages/Order/components/CheckModal.tsx
@@ -2,15 +2,14 @@ import { RESPONSE_CODE } from &#39;@/constants/enum&#39;; @@ -2,15 +2,14 @@ import { RESPONSE_CODE } from &#39;@/constants/enum&#39;;
2 import { postServiceOrderCheckOrder } from '@/services'; 2 import { postServiceOrderCheckOrder } from '@/services';
3 import { ModalForm, ProFormTextArea } from '@ant-design/pro-components'; 3 import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
4 import { Button, Form, message } from 'antd'; 4 import { Button, Form, message } from 'antd';
5 -export default ({ setCheckVisible, data, onClose }) => { 5 +export default ({ setCheckVisible, data, subOrders, onClose }) => {
6 const [form] = Form.useForm<{ name: string; company: string }>(); 6 const [form] = Form.useForm<{ name: string; company: string }>();
7 let subOrderIds: any[] = []; 7 let subOrderIds: any[] = [];
8 - const subOrderList = data.subOrderInformationLists;  
9 //是单条子订单审核 8 //是单条子订单审核
10 - if (subOrderList === undefined) { 9 + if (subOrders === null) {
11 subOrderIds = [data.id]; 10 subOrderIds = [data.id];
12 } else { 11 } else {
13 - subOrderIds = subOrderList.map((subOrder) => subOrder.id); 12 + subOrderIds = subOrders.map((subOrder) => subOrder.id);
14 } 13 }
15 async function doCheck(body: object) { 14 async function doCheck(body: object) {
16 const data = await postServiceOrderCheckOrder({ 15 const data = await postServiceOrderCheckOrder({
src/pages/Order/components/DeliverModal.tsx
@@ -21,11 +21,11 @@ const DeliverModal = ({ data: propsData, onClose }) =&gt; { @@ -21,11 +21,11 @@ const DeliverModal = ({ data: propsData, onClose }) =&gt; {
21 setData(propsData); 21 setData(propsData);
22 }, [propsData]); 22 }, [propsData]);
23 23
24 - // const handleChange = (key: string, index: number) => (e) => {  
25 - // const newData = cloneDeep(data);  
26 - // newData[index][key] = e.target.value;  
27 - // setData(newData);  
28 - // }; 24 + const handleChange = (key: string, index: number) => (e) => {
  25 + const newData = cloneDeep(data);
  26 + newData[index][key] = e.target.value;
  27 + setData(newData);
  28 + };
29 const columns: ProColumns<any>[] = [ 29 const columns: ProColumns<any>[] = [
30 { 30 {
31 title: 'ID', 31 title: 'ID',
@@ -76,12 +76,11 @@ const DeliverModal = ({ data: propsData, onClose }) =&gt; { @@ -76,12 +76,11 @@ const DeliverModal = ({ data: propsData, onClose }) =&gt; {
76 title: '物流单号', 76 title: '物流单号',
77 width: 150, 77 width: 150,
78 key: 'serialNumber', 78 key: 'serialNumber',
79 - render: (_, record) => ( 79 + render: (_, record, index) => (
80 <Input 80 <Input
81 placeholder="请输入物流单号" 81 placeholder="请输入物流单号"
82 value={record.serialNumber} 82 value={record.serialNumber}
83 - onChange={(event) => (record.serialNumber = event.target.value)}  
84 - // onChange={handleChange('productCode', index)} 83 + onChange={handleChange('serialNumber', index)}
85 /> 84 />
86 ), 85 ),
87 }, 86 },
src/pages/Order/components/OrderDrawer.tsx
@@ -25,10 +25,25 @@ import { @@ -25,10 +25,25 @@ import {
25 PRODUCT_BELONG_DEPARTMENT_OPTIONS, 25 PRODUCT_BELONG_DEPARTMENT_OPTIONS,
26 } from '../constant'; 26 } from '../constant';
27 27
28 -export default ({ onClose, data, isAdd }) => { 28 +export default ({ onClose, data, subOrders, orderOptType }) => {
29 const [invoicingStatus, setInvoicingStatus] = useState(''); 29 const [invoicingStatus, setInvoicingStatus] = useState('');
30 30
31 - if (!isAdd) { 31 + /**
  32 + * 获取当前的操作类型boolean值
  33 + * @param type 操作类型,如果与当前匹配返回true
  34 + */
  35 + function optType(type: string) {
  36 + return orderOptType === type;
  37 + }
  38 +
  39 + useEffect(() => {
  40 + // 在组件挂载或数据变化时,更新组件状态
  41 + if (data) {
  42 + setInvoicingStatus(data.invoicingStatus);
  43 + }
  44 + }, [data]);
  45 + let mainInfoDisbled = optType('edit');
  46 + if (optType('edit') || optType('copy')) {
32 //订单修改和新增的子订单列表命名是list 47 //订单修改和新增的子订单列表命名是list
33 data.list = data.subOrderInformationLists; 48 data.list = data.subOrderInformationLists;
34 //主订单事业部默认显示子订单第一条的事业部 49 //主订单事业部默认显示子订单第一条的事业部
@@ -37,7 +52,9 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -37,7 +52,9 @@ export default ({ onClose, data, isAdd }) =&gt; {
37 data.paymentChannel = data.list[0].paymentChannel; 52 data.paymentChannel = data.list[0].paymentChannel;
38 data.invoicingStatus = data.list[0].invoicingStatus; 53 data.invoicingStatus = data.list[0].invoicingStatus;
39 } 54 }
40 - 55 + if (subOrders !== undefined && subOrders.length > 0) {
  56 + data.list = subOrders;
  57 + }
41 const [form] = Form.useForm<{ 58 const [form] = Form.useForm<{
42 salesCode: ''; 59 salesCode: '';
43 customerName: ''; 60 customerName: '';
@@ -98,14 +115,16 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -98,14 +115,16 @@ export default ({ onClose, data, isAdd }) =&gt; {
98 115
99 return ( 116 return (
100 <DrawerForm<{ 117 <DrawerForm<{
  118 + deleteSubOrderLists: any;
101 name: string; 119 name: string;
102 company: string; 120 company: string;
103 }> 121 }>
104 open 122 open
105 width="35%" 123 width="35%"
106 - title={isAdd ? '新建订单' : '修改订单'} 124 + title={optType('add') || optType('copy') ? '新建订单' : '修改订单'}
107 initialValues={() => { 125 initialValues={() => {
108 - if (!isAdd) { 126 + //编辑和复制回显数据
  127 + if (optType('edit') || optType('copy')) {
109 return data; 128 return data;
110 } 129 }
111 }} 130 }}
@@ -126,7 +145,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -126,7 +145,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
126 submitTimeout={2000} 145 submitTimeout={2000}
127 onFinish={async (values) => { 146 onFinish={async (values) => {
128 let res = {}; 147 let res = {};
129 - if (isAdd) { 148 + if (optType('add') || optType('copy')) {
130 res = await postServiceOrderAddOrder({ data: values }); 149 res = await postServiceOrderAddOrder({ data: values });
131 } else { 150 } else {
132 //计算已删除的子订单id 151 //计算已删除的子订单id
@@ -138,7 +157,10 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -138,7 +157,10 @@ export default ({ onClose, data, isAdd }) =&gt; {
138 return item.id; 157 return item.id;
139 }); 158 });
140 console.log('curIds:' + curIds); 159 console.log('curIds:' + curIds);
141 - const diff = originIds.filter((item) => !curIds.includes(item)); 160 + let diff = originIds.filter((item) => !curIds.includes(item));
  161 + if (mainInfoDisbled) {
  162 + diff = [];
  163 + }
142 values.deleteSubOrderLists = diff; 164 values.deleteSubOrderLists = diff;
143 res = await postServiceOrderUpdateOrder({ data: values }); 165 res = await postServiceOrderUpdateOrder({ data: values });
144 } 166 }
@@ -177,6 +199,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -177,6 +199,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
177 label="收货人" 199 label="收货人"
178 placeholder="请输入收货人" 200 placeholder="请输入收货人"
179 rules={[{ required: true, message: '收货人必填' }]} 201 rules={[{ required: true, message: '收货人必填' }]}
  202 + disabled={mainInfoDisbled}
180 /> 203 />
181 <ProFormText 204 <ProFormText
182 width="lg" 205 width="lg"
@@ -184,6 +207,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -184,6 +207,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
184 label="联系方式" 207 label="联系方式"
185 placeholder="请输入联系方式" 208 placeholder="请输入联系方式"
186 rules={[{ required: true, message: '联系方式必填' }]} 209 rules={[{ required: true, message: '联系方式必填' }]}
  210 + disabled={mainInfoDisbled}
187 /> 211 />
188 <ProFormText 212 <ProFormText
189 width="lg" 213 width="lg"
@@ -191,6 +215,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -191,6 +215,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
191 label="单位" 215 label="单位"
192 placeholder="请输入单位" 216 placeholder="请输入单位"
193 rules={[{ required: true, message: '单位必填' }]} 217 rules={[{ required: true, message: '单位必填' }]}
  218 + disabled={mainInfoDisbled}
194 /> 219 />
195 <ProFormText 220 <ProFormText
196 width="lg" 221 width="lg"
@@ -198,6 +223,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -198,6 +223,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
198 label="单位联系人" 223 label="单位联系人"
199 placeholder="请输入单位联系人" 224 placeholder="请输入单位联系人"
200 rules={[{ required: true, message: '单位联系人必填' }]} 225 rules={[{ required: true, message: '单位联系人必填' }]}
  226 + disabled={mainInfoDisbled}
201 /> 227 />
202 <ProFormTextArea 228 <ProFormTextArea
203 width="lg" 229 width="lg"
@@ -205,12 +231,14 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -205,12 +231,14 @@ export default ({ onClose, data, isAdd }) =&gt; {
205 label="收货地址" 231 label="收货地址"
206 placeholder="请输入收货地址" 232 placeholder="请输入收货地址"
207 rules={[{ required: true, message: '收货地址必填' }]} 233 rules={[{ required: true, message: '收货地址必填' }]}
  234 + disabled={mainInfoDisbled}
208 /> 235 />
209 - <ProFormText 236 + <ProFormDigit
210 name="totalPayment" 237 name="totalPayment"
211 width="lg" 238 width="lg"
212 label="支付总额(¥)" 239 label="支付总额(¥)"
213 rules={[{ required: true, message: '支付总额必填' }]} 240 rules={[{ required: true, message: '支付总额必填' }]}
  241 + disabled={mainInfoDisbled}
214 /> 242 />
215 <ProFormSelect 243 <ProFormSelect
216 placeholder="请输入支付渠道" 244 placeholder="请输入支付渠道"
@@ -219,6 +247,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -219,6 +247,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
219 label="支付渠道" 247 label="支付渠道"
220 options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)} 248 options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)}
221 rules={[{ required: true, message: '支付渠道必填' }]} 249 rules={[{ required: true, message: '支付渠道必填' }]}
  250 + disabled={mainInfoDisbled}
222 /> 251 />
223 <ProFormSelect 252 <ProFormSelect
224 placeholder="请输入支付方式" 253 placeholder="请输入支付方式"
@@ -227,6 +256,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -227,6 +256,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
227 label="支付方式" 256 label="支付方式"
228 options={enumToSelect(PAYMENT_METHOD_OPTIONS)} 257 options={enumToSelect(PAYMENT_METHOD_OPTIONS)}
229 rules={[{ required: true, message: '支付方式必填' }]} 258 rules={[{ required: true, message: '支付方式必填' }]}
  259 + disabled={mainInfoDisbled}
230 /> 260 />
231 <ProFormSelect 261 <ProFormSelect
232 placeholder="请输入所属事业部" 262 placeholder="请输入所属事业部"
@@ -235,6 +265,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -235,6 +265,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
235 label="所属事业部" 265 label="所属事业部"
236 options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)} 266 options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)}
237 rules={[{ required: true, message: '所属事业部必填' }]} 267 rules={[{ required: true, message: '所属事业部必填' }]}
  268 + disabled={mainInfoDisbled}
238 /> 269 />
239 <ProFormSelect 270 <ProFormSelect
240 placeholder="选择是否需要开票" 271 placeholder="选择是否需要开票"
@@ -242,28 +273,38 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -242,28 +273,38 @@ export default ({ onClose, data, isAdd }) =&gt; {
242 width="lg" 273 width="lg"
243 label="是否需要开票" 274 label="是否需要开票"
244 options={enumToSelect(INVOCING_STATUS_OPTIONS)} 275 options={enumToSelect(INVOCING_STATUS_OPTIONS)}
  276 + disabled={mainInfoDisbled}
245 onChange={(_, option) => { 277 onChange={(_, option) => {
  278 + console.log(option);
246 setInvoicingStatus(option.value); 279 setInvoicingStatus(option.value);
247 }} 280 }}
248 rules={[{ required: true, message: '是否需要开票必填' }]} 281 rules={[{ required: true, message: '是否需要开票必填' }]}
249 /> 282 />
250 - <ProFormText  
251 - width="lg"  
252 - name="invoiceIdentificationNumber"  
253 - label="开票信息"  
254 - hidden={invoicingStatus !== 'INVOICED'}  
255 - placeholder="请输入开票信息"  
256 - rules={[  
257 - {  
258 - required: invoicingStatus === 'INVOICED' ? true : false,  
259 - message: '开票信息必填',  
260 - },  
261 - ]}  
262 - />  
263 - {getUserInfo().roleSmallVO?.code === 'admin' ? ( 283 + {optType('add') || optType('copy') ? (
  284 + <ProFormText
  285 + width="lg"
  286 + name="invoiceIdentificationNumber"
  287 + label="开票信息"
  288 + disabled={mainInfoDisbled}
  289 + hidden={invoicingStatus !== 'INVOICED'}
  290 + placeholder="请输入开票信息"
  291 + rules={[
  292 + {
  293 + required: invoicingStatus === 'INVOICED' ? true : false,
  294 + message: '开票信息必填',
  295 + },
  296 + ]}
  297 + />
  298 + ) : (
  299 + ''
  300 + )}
  301 +
  302 + {getUserInfo().roleSmallVO?.code === 'admin' &&
  303 + (optType('add') || optType('edit')) ? (
264 <ProFormDateTimePicker 304 <ProFormDateTimePicker
265 width="lg" 305 width="lg"
266 name="invoicingTime" 306 name="invoicingTime"
  307 + disabled={mainInfoDisbled}
267 hidden={invoicingStatus === 'INVOICED'} 308 hidden={invoicingStatus === 'INVOICED'}
268 label="开票时间" 309 label="开票时间"
269 placeholder="请输入开票时间" 310 placeholder="请输入开票时间"
@@ -275,6 +316,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -275,6 +316,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
275 width="lg" 316 width="lg"
276 name="bank" 317 name="bank"
277 label="开户银行" 318 label="开户银行"
  319 + disabled={mainInfoDisbled}
278 hidden={invoicingStatus !== 'INVOICED'} 320 hidden={invoicingStatus !== 'INVOICED'}
279 placeholder="请输入开户银行" 321 placeholder="请输入开户银行"
280 /> 322 />
@@ -283,12 +325,14 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -283,12 +325,14 @@ export default ({ onClose, data, isAdd }) =&gt; {
283 name="bankAccountNumber" 325 name="bankAccountNumber"
284 hidden={invoicingStatus !== 'INVOICED'} 326 hidden={invoicingStatus !== 'INVOICED'}
285 label="银行账号" 327 label="银行账号"
  328 + disabled={mainInfoDisbled}
286 placeholder="请输入银行账号" 329 placeholder="请输入银行账号"
287 /> 330 />
288 <ProFormText 331 <ProFormText
289 width="lg" 332 width="lg"
290 name="notes" 333 name="notes"
291 label="备注" 334 label="备注"
  335 + disabled={mainInfoDisbled}
292 placeholder="请输入备注" 336 placeholder="请输入备注"
293 /> 337 />
294 338
@@ -386,6 +430,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -386,6 +430,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
386 430
387 <h2>商品信息</h2> 431 <h2>商品信息</h2>
388 <ProFormList 432 <ProFormList
  433 + creatorButtonProps={{ disabled: false }}
389 name="list" 434 name="list"
390 label="" 435 label=""
391 initialValue={[ 436 initialValue={[
@@ -432,7 +477,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -432,7 +477,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
432 > 477 >
433 {[ 478 {[
434 <ProFormSelect 479 <ProFormSelect
435 - key={listMeta.field.key} 480 + key="key"
436 label="商品名称" 481 label="商品名称"
437 width="lg" 482 width="lg"
438 showSearch 483 showSearch
@@ -443,12 +488,18 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -443,12 +488,18 @@ export default ({ onClose, data, isAdd }) =&gt; {
443 autoFillProductInfo(option, listMeta); 488 autoFillProductInfo(option, listMeta);
444 }} 489 }}
445 request={async (value) => { 490 request={async (value) => {
  491 + console.log(value);
446 const { data } = 492 const { data } =
447 await postServiceOrderQueryProductInformation({ 493 await postServiceOrderQueryProductInformation({
448 data: { productName: value.keyWords }, 494 data: { productName: value.keyWords },
449 }); 495 });
450 return data.map((p: any) => { 496 return data.map((p: any) => {
451 - return { ...p, label: p.productName, value: p.id }; 497 + return {
  498 + ...p,
  499 + label: p.productName,
  500 + value: p.productName,
  501 + key: p.id,
  502 + };
452 }); 503 });
453 }} 504 }}
454 />, 505 />,
@@ -473,7 +524,7 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -473,7 +524,7 @@ export default ({ onClose, data, isAdd }) =&gt; {
473 label="商品参数" 524 label="商品参数"
474 placeholder="请输入商品参数" 525 placeholder="请输入商品参数"
475 /> 526 />
476 - <ProFormText 527 + <ProFormDigit
477 width="lg" 528 width="lg"
478 name="quantity" 529 name="quantity"
479 label="商品数量" 530 label="商品数量"
@@ -503,12 +554,12 @@ export default ({ onClose, data, isAdd }) =&gt; { @@ -503,12 +554,12 @@ export default ({ onClose, data, isAdd }) =&gt; {
503 placeholder="请输入子订单金额" 554 placeholder="请输入子订单金额"
504 rules={[{ required: true, message: '子订单金额必填' }]} 555 rules={[{ required: true, message: '子订单金额必填' }]}
505 /> 556 />
506 - <ProFormText 557 + {/* <ProFormText
507 width="lg" 558 width="lg"
508 name="serialNumber" 559 name="serialNumber"
509 label="物流单号" 560 label="物流单号"
510 placeholder="请输入物流单号" 561 placeholder="请输入物流单号"
511 - /> 562 + /> */}
512 <ProFormText 563 <ProFormText
513 width="lg" 564 width="lg"
514 name="notes" 565 name="notes"
src/pages/Order/components/SubOrderNotesEditModal.tsx 0 → 100644
  1 +import { RESPONSE_CODE } from '@/constants/enum';
  2 +import { postServiceOrderDetails } from '@/services';
  3 +import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
  4 +import { Form, message } from 'antd';
  5 +export default ({ setNotesEditVisible, data, 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 = { id: data.id, notes: values.name };
  28 + const res = await postServiceOrderDetails({ data: body });
  29 + if (res.result === RESPONSE_CODE.SUCCESS) {
  30 + message.success(res.message);
  31 + onClose();
  32 + }
  33 + }}
  34 + onOpenChange={setNotesEditVisible}
  35 + >
  36 + <ProFormTextArea
  37 + width="lg"
  38 + name="name"
  39 + initialValue={data.notes}
  40 + placeholder="填写备注内容"
  41 + />
  42 + </ModalForm>
  43 + );
  44 +};
src/pages/Order/constant.ts
@@ -20,8 +20,8 @@ export const PRODUCT_BELONG_DEPARTMENT_OPTIONS = { @@ -20,8 +20,8 @@ export const PRODUCT_BELONG_DEPARTMENT_OPTIONS = {
20 }; 20 };
21 21
22 export const INVOCING_STATUS_OPTIONS = { 22 export const INVOCING_STATUS_OPTIONS = {
23 - UN_INVOICE: '否',  
24 - INVOICED: '是', 23 + UN_INVOICE: '不需开票',
  24 + INVOICED: '需要开票',
25 }; 25 };
26 26
27 export const LOGISTICS_STATUS_OPTIONS = { 27 export const LOGISTICS_STATUS_OPTIONS = {
@@ -154,7 +154,7 @@ export const MAIN_ORDER_COLUMNS = [ @@ -154,7 +154,7 @@ export const MAIN_ORDER_COLUMNS = [
154 search: { 154 search: {
155 transform: (value) => { 155 transform: (value) => {
156 return { 156 return {
157 - startTime: value[0], 157 + beginTime: value[0],
158 endTime: value[1], 158 endTime: value[1],
159 }; 159 };
160 }, 160 },
@@ -175,8 +175,8 @@ export const MAIN_ORDER_COLUMNS = [ @@ -175,8 +175,8 @@ export const MAIN_ORDER_COLUMNS = [
175 search: { 175 search: {
176 transform: (value) => { 176 transform: (value) => {
177 return { 177 return {
178 - startTime: value[0],  
179 - endTime: value[1], 178 + invoicingBeginTime: value[0],
  179 + invoicingEndTime: value[1],
180 }; 180 };
181 }, 181 },
182 }, 182 },
src/pages/Order/index.tsx
@@ -5,7 +5,7 @@ import { @@ -5,7 +5,7 @@ import {
5 postServiceOrderQueryServiceOrder, 5 postServiceOrderQueryServiceOrder,
6 } from '@/services'; 6 } from '@/services';
7 import { orderExport } from '@/services/order'; 7 import { orderExport } from '@/services/order';
8 -import { enumToProTableEnumValue, enumValueToLabel } from '@/utils'; 8 +import { enumValueToLabel } from '@/utils';
9 import { DownOutlined, EllipsisOutlined } from '@ant-design/icons'; 9 import { DownOutlined, EllipsisOutlined } from '@ant-design/icons';
10 import { 10 import {
11 PageContainer, 11 PageContainer,
@@ -33,6 +33,7 @@ import ConfirmReceiptModal from &#39;./components/ConfirmReceiptModal&#39;; @@ -33,6 +33,7 @@ import ConfirmReceiptModal from &#39;./components/ConfirmReceiptModal&#39;;
33 import DeliverModal from './components/DeliverModal'; 33 import DeliverModal from './components/DeliverModal';
34 import FinancialDrawer from './components/FinancialDrawer'; 34 import FinancialDrawer from './components/FinancialDrawer';
35 import OrderDrawer from './components/OrderDrawer'; 35 import OrderDrawer from './components/OrderDrawer';
  36 +import SubOrderNotesEditModal from './components/SubOrderNotesEditModal';
36 import { 37 import {
37 INVOCING_STATUS_OPTIONS, 38 INVOCING_STATUS_OPTIONS,
38 LOGISTICS_STATUS_OPTIONS, 39 LOGISTICS_STATUS_OPTIONS,
@@ -49,11 +50,12 @@ const OrderPage = () =&gt; { @@ -49,11 +50,12 @@ const OrderPage = () =&gt; {
49 const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false); 50 const [orderDrawerVisible, setOrderDrawerVisible] = useState<boolean>(false);
50 const [checkVisible, setCheckVisible] = useState<boolean>(false); 51 const [checkVisible, setCheckVisible] = useState<boolean>(false);
51 const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false); 52 const [orderPrintVisible, setOrderPrintVisible] = useState<boolean>(false);
  53 + const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false);
52 const [financialVisible, setFinancialVisible] = useState<boolean>(false); 54 const [financialVisible, setFinancialVisible] = useState<boolean>(false);
53 const [confirmReceiptVisible, setConfirmReceiptVisible] = 55 const [confirmReceiptVisible, setConfirmReceiptVisible] =
54 useState<boolean>(false); 56 useState<boolean>(false);
55 const [deliverVisible, setDeliverVisible] = useState<boolean>(false); 57 const [deliverVisible, setDeliverVisible] = useState<boolean>(false);
56 - const [isOrderAddOpt, setIsOrderAddOpt] = useState<boolean>(false); 58 + const [orderOptType, setOrderOptType] = useState<string>('');
57 const [isFinalcialEdit, setIsFinalcialEdit] = useState<boolean>(false); 59 const [isFinalcialEdit, setIsFinalcialEdit] = useState<boolean>(false);
58 const [expandedRowKeys, setExpandedRowKeys] = useState<Key[]>([]); 60 const [expandedRowKeys, setExpandedRowKeys] = useState<Key[]>([]);
59 const [orderRow, setOrderRow] = useState<Partial<OrderType>>({}); 61 const [orderRow, setOrderRow] = useState<Partial<OrderType>>({});
@@ -66,12 +68,11 @@ const OrderPage = () =&gt; { @@ -66,12 +68,11 @@ const OrderPage = () =&gt; {
66 const [selectedItems, setSelectedItems] = useState([]); 68 const [selectedItems, setSelectedItems] = useState([]);
67 const mainTableRef = useRef(); 69 const mainTableRef = useRef();
68 70
69 - console.log(enumToProTableEnumValue(ORDER_STATUS_OPTIONS));  
70 const resize = () => { 71 const resize = () => {
71 // 计算元素底部到视口顶部的距离 72 // 计算元素底部到视口顶部的距离
72 let bottomDistance = document 73 let bottomDistance = document
73 .getElementById('mainTable') 74 .getElementById('mainTable')
74 - .getElementsByClassName('ant-table-thead')[0] 75 + ?.getElementsByClassName('ant-table-thead')[0]
75 .getBoundingClientRect().bottom; 76 .getBoundingClientRect().bottom;
76 // 获取屏幕高度 77 // 获取屏幕高度
77 let screenHeight = 78 let screenHeight =
@@ -128,6 +129,30 @@ const OrderPage = () =&gt; { @@ -128,6 +129,30 @@ const OrderPage = () =&gt; {
128 <div>订单编号:{record.id}</div> 129 <div>订单编号:{record.id}</div>
129 </Flex> 130 </Flex>
130 </Checkbox> 131 </Checkbox>
  132 + <Space>
  133 + <div>销售代表:{record.salesCode}</div>
  134 +
  135 + {rolePath?.includes('addOrder') ? (
  136 + <Button
  137 + type="primary"
  138 + size="small"
  139 + onClick={() => {
  140 + setOrderOptType('copy');
  141 + setOrderDrawerVisible(true);
  142 + let copy = cloneDeep(record);
  143 + copy.id = undefined;
  144 + copy.subOrderInformationLists?.forEach((item) => {
  145 + item.id = undefined;
  146 + });
  147 + setOrderRow(copy);
  148 + }}
  149 + >
  150 + 复制
  151 + </Button>
  152 + ) : (
  153 + ''
  154 + )}
  155 + </Space>
131 </Flex> 156 </Flex>
132 {/* 收货、开票、备注信息 */} 157 {/* 收货、开票、备注信息 */}
133 <Flex justify="space-between" className="px-2 py-4"> 158 <Flex justify="space-between" className="px-2 py-4">
@@ -241,9 +266,34 @@ const OrderPage = () =&gt; { @@ -241,9 +266,34 @@ const OrderPage = () =&gt; {
241 className="p-0" 266 className="p-0"
242 type="link" 267 type="link"
243 onClick={() => { 268 onClick={() => {
  269 + //勾选的子订单:如果有勾选,后面只校验有勾选的
  270 + let selectedSubOrders = selectedRowObj[record.id];
  271 + if (
  272 + selectedSubOrders === undefined ||
  273 + selectedSubOrders.length === 0
  274 + ) {
  275 + selectedSubOrders = record.subOrderInformationLists;
  276 + }
  277 + for (
  278 + let index = 0;
  279 + index < selectedSubOrders.length;
  280 + index++
  281 + ) {
  282 + let orderStatus = selectedSubOrders[index].orderStatus;
  283 + //是审核通过及之后的订单
  284 + if (
  285 + orderStatus !== 'UNAUDITED' &&
  286 + orderStatus !== 'AUDIT_FAILED'
  287 + ) {
  288 + message.error(
  289 + '请选择未审核或者审核失败的订单进行编辑',
  290 + );
  291 + return;
  292 + }
  293 + }
244 setOrderDrawerVisible(true); 294 setOrderDrawerVisible(true);
245 setOrderRow(record); 295 setOrderRow(record);
246 - setIsOrderAddOpt(false); 296 + setOrderOptType('edit');
247 }} 297 }}
248 > 298 >
249 编辑 299 编辑
@@ -257,6 +307,23 @@ const OrderPage = () =&gt; { @@ -257,6 +307,23 @@ const OrderPage = () =&gt; {
257 className="p-0" 307 className="p-0"
258 type="link" 308 type="link"
259 onClick={() => { 309 onClick={() => {
  310 + console.log('!!!!!!!!!!!');
  311 + let selectedSubOrders = selectedRowObj[record.id];
  312 + setSelectedRows(selectedSubOrders);
  313 + if (selectedSubOrders === undefined) {
  314 + setSelectedRows(record.subOrderInformationLists);
  315 + }
  316 + for (let i = 0; i < selectedRows.length; i++) {
  317 + if (
  318 + selectedRows[i].orderStatus !== 'UNAUDITED' &&
  319 + selectedRows[i].orderStatus !== 'AUDIT_FAILED'
  320 + ) {
  321 + message.error(
  322 + '请选择未审核或者审核失败的子订单进行审核',
  323 + );
  324 + return;
  325 + }
  326 + }
260 setOrderRow(record); 327 setOrderRow(record);
261 setCheckVisible(true); 328 setCheckVisible(true);
262 }} 329 }}
@@ -329,15 +396,21 @@ const OrderPage = () =&gt; { @@ -329,15 +396,21 @@ const OrderPage = () =&gt; {
329 if (item.component === 'tag') { 396 if (item.component === 'tag') {
330 return { 397 return {
331 ...item, 398 ...item,
332 - render: (text: string) => { 399 + render: (text: string, optRecord) => {
333 let label = enumValueToLabel(text, ORDER_STATUS_OPTIONS); 400 let label = enumValueToLabel(text, ORDER_STATUS_OPTIONS);
334 if (label === undefined) { 401 if (label === undefined) {
335 label = enumValueToLabel(text, INVOCING_STATUS_OPTIONS); 402 label = enumValueToLabel(text, INVOCING_STATUS_OPTIONS);
336 } 403 }
337 let color = 'gold'; 404 let color = 'gold';
338 - if (label === '开票' || label === '已审核') { 405 + if (label === '需要开票' || label === '已审核') {
339 color = 'green'; 406 color = 'green';
340 } 407 }
  408 + if (
  409 + label === '需要开票' &&
  410 + optRecord.invoicingTime !== undefined
  411 + ) {
  412 + label = '已开票';
  413 + }
341 return <Tag color={color}>{label}</Tag>; 414 return <Tag color={color}>{label}</Tag>;
342 }, 415 },
343 }; 416 };
@@ -469,6 +542,7 @@ const OrderPage = () =&gt; { @@ -469,6 +542,7 @@ const OrderPage = () =&gt; {
469 onClick={() => { 542 onClick={() => {
470 setOrderRow(optRecord); 543 setOrderRow(optRecord);
471 setCheckVisible(true); 544 setCheckVisible(true);
  545 + setSelectedRows([optRecord]);
472 }} 546 }}
473 > 547 >
474 审核 548 审核
@@ -510,8 +584,15 @@ const OrderPage = () =&gt; { @@ -510,8 +584,15 @@ const OrderPage = () =&gt; {
510 dataIndex: 'notes', 584 dataIndex: 'notes',
511 key: 'notes', 585 key: 'notes',
512 align: 'center', 586 align: 'center',
513 - render: () => (  
514 - <Button type="dashed" size="small"> 587 + render: (optTxt, optRecord) => (
  588 + <Button
  589 + type="dashed"
  590 + size="small"
  591 + onClick={() => {
  592 + setNotesEditVisible(true);
  593 + setOrderRow(optRecord);
  594 + }}
  595 + >
515 详情 596 详情
516 </Button> 597 </Button>
517 ), 598 ),
@@ -523,6 +604,8 @@ const OrderPage = () =&gt; { @@ -523,6 +604,8 @@ const OrderPage = () =&gt; {
523 ...setSelectedRowObj, 604 ...setSelectedRowObj,
524 [record.id]: selectedRows, 605 [record.id]: selectedRows,
525 }); 606 });
  607 + selectedRowObj[record.id] = selectedRows;
  608 + setSelectedRows(selectedRows);
526 }, 609 },
527 // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom 610 // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
528 // 注释该行则默认不显示下拉选项 611 // 注释该行则默认不显示下拉选项
@@ -599,14 +682,14 @@ const OrderPage = () =&gt; { @@ -599,14 +682,14 @@ const OrderPage = () =&gt; {
599 onClick: () => {}, 682 onClick: () => {},
600 }; 683 };
601 684
602 - if (rolePath.includes('addOrder')) { 685 + if (rolePath?.includes('addOrder')) {
603 toolBtns.push( 686 toolBtns.push(
604 <Button 687 <Button
605 type="primary" 688 type="primary"
606 key="out" 689 key="out"
607 onClick={() => { 690 onClick={() => {
608 setOrderDrawerVisible(true); 691 setOrderDrawerVisible(true);
609 - setIsOrderAddOpt(true); 692 + setOrderOptType('add');
610 }} 693 }}
611 > 694 >
612 新增 695 新增
@@ -662,10 +745,10 @@ const OrderPage = () =&gt; { @@ -662,10 +745,10 @@ const OrderPage = () =&gt; {
662 history.push('/login'); 745 history.push('/login');
663 }, 746 },
664 }, 747 },
665 - {  
666 - label: '修改密码',  
667 - key: '2',  
668 - }, 748 + // {
  749 + // label: '修改密码',
  750 + // key: '2',
  751 + // },
669 ], 752 ],
670 }} 753 }}
671 > 754 >
@@ -734,12 +817,13 @@ const OrderPage = () =&gt; { @@ -734,12 +817,13 @@ const OrderPage = () =&gt; {
734 {orderDrawerVisible && ( 817 {orderDrawerVisible && (
735 <OrderDrawer 818 <OrderDrawer
736 data={orderRow} 819 data={orderRow}
  820 + subOrders={selectedRows}
737 onClose={() => { 821 onClose={() => {
738 setOrderDrawerVisible(false); 822 setOrderDrawerVisible(false);
739 setOrderRow({}); 823 setOrderRow({});
740 mainTableRef.current?.reload(); 824 mainTableRef.current?.reload();
741 }} 825 }}
742 - isAdd={isOrderAddOpt} 826 + orderOptType={orderOptType}
743 /> 827 />
744 )} 828 )}
745 829
@@ -747,9 +831,23 @@ const OrderPage = () =&gt; { @@ -747,9 +831,23 @@ const OrderPage = () =&gt; {
747 <CheckModal 831 <CheckModal
748 setCheckVisible={setCheckVisible} 832 setCheckVisible={setCheckVisible}
749 data={orderRow} 833 data={orderRow}
  834 + subOrders={selectedRows}
750 onClose={() => { 835 onClose={() => {
751 setCheckVisible(false); 836 setCheckVisible(false);
752 setOrderRow({}); 837 setOrderRow({});
  838 + setSelectedRows({});
  839 + mainTableRef.current?.reload();
  840 + }}
  841 + />
  842 + )}
  843 +
  844 + {notesEditVisible && (
  845 + <SubOrderNotesEditModal
  846 + setNotesEditVisible={setNotesEditVisible}
  847 + data={orderRow}
  848 + onClose={() => {
  849 + setNotesEditVisible(false);
  850 + setOrderRow({});
753 mainTableRef.current?.reload(); 851 mainTableRef.current?.reload();
754 }} 852 }}
755 /> 853 />
src/pages/Order/type.d.ts
@@ -15,43 +15,52 @@ export interface OrderType { @@ -15,43 +15,52 @@ export interface OrderType {
15 } 15 }
16 16
17 export interface OrderListItemType { 17 export interface OrderListItemType {
18 - main_order_id: number;  
19 - sales_code: string;  
20 - customer_name: string;  
21 - customer_contact_number: string;  
22 - customer_shipping_address: string;  
23 - institution_contact_name: string; 18 + mainPath: any;
  19 + totalPayment: ReactNode;
  20 + notes: ReactNode;
  21 + invoiceIdentificationNumber: ReactNode;
  22 + bankAccountNumber: ReactNode;
  23 + bank: ReactNode;
  24 + id: undefined;
  25 + subOrderInformationLists: any;
  26 + createTime: ReactNode;
  27 + mainOrderId: number;
  28 + salesCode: string;
  29 + customerName: string;
  30 + customerContactNumber: string;
  31 + customerShippingAddress: string;
  32 + institutionContactName: string;
24 institution: string; 33 institution: string;
25 - main_order_create_time: string;  
26 - main_order_update_time: string;  
27 - main_order_create_by_name: string;  
28 - main_order_update_by_name: any;  
29 - sub_orders: {  
30 - sub_order_id: number;  
31 - product_code: number;  
32 - product_name: string; 34 + mainOrderCreateTime: string;
  35 + mainOrderUpdateTime: string;
  36 + mainOrderCreateByName: string;
  37 + mainOrderUpdateByName: any;
  38 + subOrders: {
  39 + subOrderId: number;
  40 + productCode: number;
  41 + productName: string;
33 quantity: number; 42 quantity: number;
34 - product_price: number; 43 + productPrice: number;
35 unit: string; 44 unit: string;
36 parameters: any; 45 parameters: any;
37 - total_payment: number;  
38 - sub_order_payment: number;  
39 - is_cancel: number;  
40 - logistics_status: string;  
41 - payment_status: string;  
42 - payment_method: string;  
43 - payment_channel: string;  
44 - payment_transaction_id: any;  
45 - invoice_information: any;  
46 - invoicing_status: string;  
47 - product_belong_department: string;  
48 - waybill_number: any; 46 + totalPayment: number;
  47 + subOrderPayment: number;
  48 + isCancel: number;
  49 + logisticsStatus: string;
  50 + paymentStatus: string;
  51 + paymentMethod: string;
  52 + paymentChannel: string;
  53 + paymentTransactionId: any;
  54 + invoiceInformation: any;
  55 + invoicingStatus: string;
  56 + productBelongDepartment: string;
  57 + waybillNumber: any;
49 notes: any; 58 notes: any;
50 - examine_notes: any;  
51 - order_status: string;  
52 - sub_order_create_time: string;  
53 - sub_order_update_time: string;  
54 - sub_order_create_by_name: string;  
55 - sub_order_update_by_name: any; 59 + examineNotes: any;
  60 + orderStatus: string;
  61 + subOrderCreateTime: string;
  62 + subOrderUpdateTime: string;
  63 + subOrderCreateByName: string;
  64 + subOrderUpdateByName: any;
56 }[]; 65 }[];
57 } 66 }
src/pages/OrderPrint/OrderPrintModal.tsx
@@ -77,8 +77,8 @@ export default ({ mainOrder, subOrders, onClose }) =&gt; { @@ -77,8 +77,8 @@ export default ({ mainOrder, subOrders, onClose }) =&gt; {
77 style={{ width: 'auto' }} 77 style={{ width: 'auto' }}
78 onChange={handleChange} 78 onChange={handleChange}
79 options={[ 79 options={[
80 - { value: 'Houjie', label: '科路得出货单' },  
81 - { value: 'Dalang', label: '大朗出货单' }, 80 + { value: 'Houjie', label: '科路得出货单-厚街' },
  81 + { value: 'Dalang', label: '科路得出货单-大朗' },
82 { value: 'Zhuguang', label: '烛光出货单' }, 82 { value: 'Zhuguang', label: '烛光出货单' },
83 ]} 83 ]}
84 /> 84 />
src/services/request.ts
@@ -5008,6 +5008,77 @@ export const postServiceOrderConfirmReceipt = /* #__PURE__ */ (() =&gt; { @@ -5008,6 +5008,77 @@ export const postServiceOrderConfirmReceipt = /* #__PURE__ */ (() =&gt; {
5008 return request; 5008 return request;
5009 })(); 5009 })();
5010 5010
  5011 +/** @description request parameter type for postServiceOrderDetails */
  5012 +export interface PostServiceOrderDetailsOption {
  5013 + /**
  5014 + * @description
  5015 + * dto
  5016 + */
  5017 + body: {
  5018 + /**
  5019 + @description
  5020 + dto */
  5021 + dto: Dto;
  5022 + };
  5023 +}
  5024 +
  5025 +/** @description response type for postServiceOrderDetails */
  5026 +export interface PostServiceOrderDetailsResponse {
  5027 + /**
  5028 + * @description
  5029 + * OK
  5030 + */
  5031 + 200: ServerResult;
  5032 + /**
  5033 + * @description
  5034 + * Created
  5035 + */
  5036 + 201: any;
  5037 + /**
  5038 + * @description
  5039 + * Unauthorized
  5040 + */
  5041 + 401: any;
  5042 + /**
  5043 + * @description
  5044 + * Forbidden
  5045 + */
  5046 + 403: any;
  5047 + /**
  5048 + * @description
  5049 + * Not Found
  5050 + */
  5051 + 404: any;
  5052 +}
  5053 +
  5054 +export type PostServiceOrderDetailsResponseSuccess =
  5055 + PostServiceOrderDetailsResponse[200];
  5056 +/**
  5057 + * @description
  5058 + * 编辑订单详情(现在所有的角色在订单任何状态都可以进行修改)
  5059 + * @tags 内部订单
  5060 + * @produces *
  5061 + * @consumes application/json
  5062 + */
  5063 +export const postServiceOrderDetails = /* #__PURE__ */ (() => {
  5064 + const method = 'post';
  5065 + const url = '/service/order/details';
  5066 + function request(
  5067 + option: PostServiceOrderDetailsOption,
  5068 + ): Promise<PostServiceOrderDetailsResponseSuccess> {
  5069 + return requester(request.url, {
  5070 + method: request.method,
  5071 + ...option,
  5072 + }) as unknown as Promise<PostServiceOrderDetailsResponseSuccess>;
  5073 + }
  5074 +
  5075 + /** http method */
  5076 + request.method = method;
  5077 + /** request url */
  5078 + request.url = url;
  5079 + return request;
  5080 +})();
  5081 +
5011 /** @description request parameter type for postServiceOrderEditOrder */ 5082 /** @description request parameter type for postServiceOrderEditOrder */
5012 export interface PostServiceOrderEditOrderOption { 5083 export interface PostServiceOrderEditOrderOption {
5013 /** 5084 /**