Commit c7bf956a authored by 武广's avatar 武广

feat: 添加延迟收货

parent 65ffab8e
...@@ -11,6 +11,7 @@ import { ...@@ -11,6 +11,7 @@ import {
const TableList = ref => { const TableList = ref => {
const actionRef = useRef(null); const actionRef = useRef(null);
const columns = [ const columns = [
{ {
title: '批次号', title: '批次号',
...@@ -99,7 +100,7 @@ const TableList = ref => { ...@@ -99,7 +100,7 @@ const TableList = ref => {
<Button <Button
type="primary" type="primary"
style={{ style={{
marginRottom: '10px', marginRight: '10px',
}} }}
onClick={() => { onClick={() => {
downUploadeOrder({ batchNo: record.batchNo, status: 0 }); downUploadeOrder({ batchNo: record.batchNo, status: 0 });
......
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Modal, notification, Input } from 'antd';
import React, { useState } from 'react';
import { apiDelayDeliverGoods } from '../service';
const UpdateStock = props => {
const { getFieldDecorator, validateFields, resetFields } = props.form;
const valueInfo = {};
const [loading, setLoading] = useState(false);
const submit = async () => {
validateFields(async (err, { remark }) => {
if (err) return;
setLoading(true);
const params = {
orderIds: [props.orderId],
operationType: 5,
remark,
};
console.log('params :>> ', params);
const res = await apiDelayDeliverGoods(params);
if (res?.businessCode === '0000') {
notification.success({ message: '提交成功!' });
props.onCancel('success');
resetFields();
}
setLoading(false);
});
};
const onCancel = () => {
props.onCancel();
resetFields();
};
const formItemLayout = {
labelCol: {
span: 7,
},
wrapperCol: {
span: 15,
},
};
return (
<Modal
title="延迟发货"
visible={props.visible}
okButtonProps={{ loading }}
onCancel={onCancel}
onOk={submit}
width={500}
>
<Form {...formItemLayout}>
<Form.Item label="延迟原因:">
{getFieldDecorator('remark', {
rules: [{ required: true, message: '请输入延迟原因!' }],
initialValue: valueInfo.remark,
})(<Input.TextArea />)}
</Form.Item>
</Form>
</Modal>
);
};
export default Form.create()(UpdateStock);
import { Button, notification } from 'antd'; import { Button, notification, Modal } from 'antd';
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
...@@ -8,6 +8,7 @@ import LogisticsForm from './components/LogisticsForm'; ...@@ -8,6 +8,7 @@ import LogisticsForm from './components/LogisticsForm';
import style from './styles.less'; import style from './styles.less';
import PopoverDom from './components/PreviewImage'; import PopoverDom from './components/PreviewImage';
import LogisticsCom from './components/LogisticsCom'; import LogisticsCom from './components/LogisticsCom';
import DelayDeliverGoods from './components/DelayDeliverGoods';
import { import {
queryToSend, queryToSend,
queryExpress, queryExpress,
...@@ -17,6 +18,8 @@ import { ...@@ -17,6 +18,8 @@ import {
getJDLogisticsInfo, getJDLogisticsInfo,
} from './service'; } from './service';
const { confirm } = Modal;
const TableList = props => { const TableList = props => {
const dateFormat = 'YYYY-MM-DD'; const dateFormat = 'YYYY-MM-DD';
const [companys, setCompanys] = useState([]); const [companys, setCompanys] = useState([]);
...@@ -37,6 +40,9 @@ const TableList = props => { ...@@ -37,6 +40,9 @@ const TableList = props => {
const [orderStatus, setorderStatus] = useState(1); const [orderStatus, setorderStatus] = useState(1);
const [endTimeStr, setEndTimeStr] = useState(moment().format(dateFormat)); const [endTimeStr, setEndTimeStr] = useState(moment().format(dateFormat));
const [visibleDelay, setVisibleDelay] = useState(false);
const [delayOrderIDs, setDelayOrderIDs] = useState(0);
// const startDisabledDate = current => // const startDisabledDate = current =>
// current && (endTime.diff(current, 'days') > 30 || endTime.diff(current, 'days') < 0); // current && (endTime.diff(current, 'days') > 30 || endTime.diff(current, 'days') < 0);
// const endDisabledDate = current => // const endDisabledDate = current =>
...@@ -68,6 +74,29 @@ const TableList = props => { ...@@ -68,6 +74,29 @@ const TableList = props => {
setLogisticsComList(tempObj); setLogisticsComList(tempObj);
}; };
const onDelay = (id, state, content) => {
if (state === 1) {
confirm({
title: '提示',
content,
cancelButtonProps: {
style: {
display: 'none',
},
},
});
} else {
setDelayOrderIDs(id);
setVisibleDelay(true);
}
};
const onCancelDelay = e => {
setVisibleDelay(false);
if (e && actionRef.current) {
actionRef.current.reload();
}
};
const renderContent = (record, key) => { const renderContent = (record, key) => {
if (record.mchOrderSkuVoList) { if (record.mchOrderSkuVoList) {
return record?.mchOrderSkuVoList.map((item, index) => ( return record?.mchOrderSkuVoList.map((item, index) => (
...@@ -295,6 +324,12 @@ const TableList = props => { ...@@ -295,6 +324,12 @@ const TableList = props => {
{props.type === 2 ? '更新物流信息' : '填写物流信息'} {props.type === 2 ? '更新物流信息' : '填写物流信息'}
</Button> </Button>
)} )}
<Button
type="primary"
onClick={() => onDelay(record.orderId, +record.delayStatus, record.delayRemark)}
>
{+record.delayStatus === 1 ? '已延迟发货' : '延迟发货'}
</Button>
</React.Fragment> </React.Fragment>
), ),
}, },
...@@ -361,12 +396,13 @@ const TableList = props => { ...@@ -361,12 +396,13 @@ const TableList = props => {
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
if (ref.current) { // if (ref.current) {
const obj = { ...ref.current.getFieldsValue(), logisticsStatus: props.type || 1 }; // const obj = { ...ref.current.getFieldsValue(), logisticsStatus: props.type || 1 };
obj.startTime = startTimeStr; // obj.startTime = startTimeStr;
obj.endTime = endTimeStr; // obj.endTime = endTimeStr;
downOrder(obj); // downOrder(obj);
} // }
onDelay(1, 0, '速递');
}} }}
> >
导出数据 导出数据
...@@ -406,6 +442,11 @@ const TableList = props => { ...@@ -406,6 +442,11 @@ const TableList = props => {
value={LogisticsComList} value={LogisticsComList}
key={LogisticsComList.key} key={LogisticsComList.key}
/> />
<DelayDeliverGoods
visible={visibleDelay}
orderId={delayOrderIDs}
onCancel={e => onCancelDelay(e)}
/>
</PageHeaderWrapper> </PageHeaderWrapper>
); );
}; };
......
...@@ -144,3 +144,10 @@ export async function downUploadeOrder(params) { ...@@ -144,3 +144,10 @@ export async function downUploadeOrder(params) {
}; };
saveAs(blob, `批量发货-${status[params.status]}-${format(new Date(), 'yyyyMMddHHmmss')}.xlsx`); saveAs(blob, `批量发货-${status[params.status]}-${format(new Date(), 'yyyyMMddHHmmss')}.xlsx`);
} }
// 延迟发货
export function apiDelayDeliverGoods(data) {
return request.post('/api/kdsp/order/operation/record/create', {
data,
prefix: config.kdspApi,
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment