Commit e5d82bda authored by XieZhiXiong's avatar XieZhiXiong

完成售后换货手工发货相关流程

parent 1fea8375
......@@ -4,6 +4,7 @@ import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus';
import { EXCHANGE_GOODS_MANUAL_DELIVERY } from '../../constants';
import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo';
......@@ -17,8 +18,9 @@ const ExchangePrDeliverVerify: React.FC = () => {
return;
}
setSubmitLoading(true);
PublicApi.postAsReplaceGoodsConfirmReturnDeliveryGoods({
PublicApi.postAsReplaceGoodsManualReturnDeliveryGoods({
dataId: id,
...values,
}).then(res => {
if (res.code === 1000) {
history.goBack();
......@@ -36,14 +38,18 @@ const ExchangePrDeliverVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={() => (
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工退货发货
</Button>
headExtra={info => (
<>
{(info && info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY) && (
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工退货发货
</Button>
)}
</>
)}
/>
......
......@@ -4,6 +4,7 @@ import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus';
import { EXCHANGE_GOODS_MANUAL_DELIVERY } from '../../constants';
import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo';
......@@ -17,7 +18,7 @@ const ExchangePrReceivedVerify: React.FC = () => {
return;
}
setSubmitLoading(true);
PublicApi.postAsReplaceGoodsConfirmReplaceReceiveGoods({
PublicApi.postAsReplaceGoodsConfirmManualReplaceReceiveGoods({
dataId: id,
}).then(res => {
if (res.code === 1000) {
......@@ -36,24 +37,43 @@ const ExchangePrReceivedVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={(detailInfo) => (
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工确认换货收货
</Button>
)}
/>
<ManualDeliveryModal
title="确认换货收货"
visible={modalVisible}
confirmLoading={submitLoading}
onSubmit={handleSubmit}
onVisible={handleVisible}
isEdit={false}
headExtra={info => {
const detailed = info || {};
// @ts-ignore
const { manualReplaceGoodsAddress = {} } = detailed;
return (
<>
{(info && info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY) && (
<>
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工确认换货收货
</Button>
<ManualDeliveryModal
key="2"
title="确认换货收货"
value={{
deliveryAddressTxt: manualReplaceGoodsAddress.deliveryAddress,
deliveryTime: manualReplaceGoodsAddress.deliveryTime,
logisticsOrderNo: manualReplaceGoodsAddress.logisticsOrderNo,
logisticsNameTxt: manualReplaceGoodsAddress.logisticsName,
}}
visible={modalVisible}
confirmLoading={submitLoading}
onSubmit={handleSubmit}
onVisible={handleVisible}
isEdit={false}
/>
</>
)}
</>
)
}}
/>
</>
);
......
......@@ -60,7 +60,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
const [replaceGoodsList, setReplaceGoodsList] = useState<GetAsReplaceGoodsPageReturnedGoodsResponse>({ data: [], totalCount: 0 });
const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [replaceGoodsLoading, setExchangeGoodsLoading] = useState(false);
const [goodsValue, setGoodsValue] = useState([]);
const [submitLoading, setSubmitLoading] = useState(false);
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false);
......@@ -243,44 +242,27 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
,
...rest,
});
}
}).finally(() => {
setInfoLoading(false);
});
};
// 获取换货明细列表
const getReplaceGoods = () => {
if (!id) {
return;
}
setExchangeGoodsLoading(true);
PublicApi.getAsReplaceGoodsPageReturnedGoods({
replaceId: id,
current: `${1}`,
pageSize: `${99999}`,
}).then(res => {
if (res.code === 1000) {
setReplaceGoodsList({
data: res.data.data.map(item => ({
data: goodsDetailList.map(item => ({
...item,
extraData: {
replacedCount: item.purchaseCount || 0, // 已换货数量,这里取 采购数量判断即可
id: item.orderRecordId,
taskType,
},
})),
totalCount: res.data.totalCount,
totalCount: goodsDetailList.length,
});
setGoodsValue(res.data && res.data.data ? res.data.data.map(item => item.orderRecordId) : []);
setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
}
}).finally(() => {
setExchangeGoodsLoading(false);
setInfoLoading(false);
});
};
useEffect(() => {
getDetailInfo();
getReplaceGoods();
}, []);
const handleAddGoods = () => {
......@@ -327,6 +309,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
setSubmitLoading(true);
const payload = {
...rest,
replaceId: id || 0,
supplierMemberId: supplierMember[0].memberId,
supplierRoleId: supplierMember[0].roleId,
......@@ -386,7 +369,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
unit: unit || '',
...rest,
})),
...rest,
taskType: replaceGoodsList[0].extraData.taskType,
};
PublicApi.postAsReplaceGoodsSave(payload)
......@@ -457,6 +440,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
extraData: {
replacedCount: item.replaceCount || item.purchaseCount || 0, // 已换货数量
id: item.id,
taskType: item.processEnum,
},
};
value.push(atom);
......@@ -477,7 +461,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
);
return (
<Spin spinning={infoLoading || replaceGoodsLoading}>
<Spin spinning={infoLoading}>
<PageHeaderWrapper
style={{
padding: 24,
......
......@@ -4,6 +4,7 @@ import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus';
import { EXCHANGE_GOODS_MANUAL_DELIVERY } from '../../constants';
import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo';
......@@ -17,8 +18,9 @@ const ExchangePrDeliverVerify: React.FC = () => {
return;
}
setSubmitLoading(true);
PublicApi.postAsReplaceGoodsConfirmReplaceDeliveryGoods({
PublicApi.postAsReplaceGoodsManualReplaceDeliveryGoods({
dataId: id,
...values,
}).then(res => {
if (res.code === 1000) {
history.goBack();
......@@ -36,14 +38,18 @@ const ExchangePrDeliverVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={() => (
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工换货发货
</Button>
headExtra={info => (
<>
{(info && info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY) && (
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工换货发货
</Button>
)}
</>
)}
/>
......
......@@ -4,6 +4,7 @@ import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus';
import { EXCHANGE_GOODS_MANUAL_DELIVERY } from '../../constants';
import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo';
......@@ -17,7 +18,7 @@ const ExchangePrReceivedVerify: React.FC = () => {
return;
}
setSubmitLoading(true);
PublicApi.postAsReplaceGoodsConfirmReturnReceiveGoods({
PublicApi.postAsReplaceGoodsConfirmManualReturnReceiveGoods({
dataId: id,
}).then(res => {
if (res.code === 1000) {
......@@ -36,23 +37,42 @@ const ExchangePrReceivedVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={() => (
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工确认退货收货
</Button>
)}
/>
<ManualDeliveryModal
visible={modalVisible}
confirmLoading={submitLoading}
onSubmit={handleSubmit}
onVisible={handleVisible}
isEdit={false}
headExtra={info => {
const detailed = info || {};
// @ts-ignore
const { manualReturnGoodsAddress = {} } = detailed;
return (
<>
{(info && info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY) && (
<>
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工确认退货收货
</Button>
<ManualDeliveryModal
key="2"
value={{
deliveryAddressTxt: manualReturnGoodsAddress.deliveryAddress,
deliveryTime: manualReturnGoodsAddress.deliveryTime,
logisticsOrderNo: manualReturnGoodsAddress.logisticsOrderNo,
logisticsNameTxt: manualReturnGoodsAddress.logisticsName,
}}
visible={modalVisible}
confirmLoading={submitLoading}
onSubmit={handleSubmit}
onVisible={handleVisible}
isEdit={false}
/>
</>
)}
</>
)
}}
/>
</>
);
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 17:22:07
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-04 18:39:57
* @LastEditTime: 2020-12-14 19:55:14
* @Description:
*/
import React, { useState } from 'react';
......@@ -88,19 +88,23 @@ const ExchangePrSubmitVerify: React.FC = () => {
message.error('请选择换货自提地址');
return;
}
setReturnAddress({
receiveId: returnAddress.id,
receiveAddress: returnAddress.receiveAddress,
receiveUserName: returnAddress.receiveUserName,
receiveUserTel: returnAddress.receiveUserTel,
});
setExchangeAddress({
deliveryType: exchangeAddress.deliveryType,
sendId: exchangeAddress.id,
sendAddress: exchangeAddress.sendAddress,
sendUserName: exchangeAddress.sendUserName,
sendUserTel: exchangeAddress.sendUserTel,
});
if (returnAddress) {
setReturnAddress({
receiveId: returnAddress.id,
receiveAddress: returnAddress.receiveAddress,
receiveUserName: returnAddress.receiveUserName,
receiveUserTel: returnAddress.receiveUserTel,
});
}
if (exchangeAddress) {
setExchangeAddress({
deliveryType: exchangeAddress.deliveryType,
sendId: exchangeAddress.id,
sendAddress: exchangeAddress.sendAddress,
sendUserName: exchangeAddress.sendUserName,
sendUserTel: exchangeAddress.sendUserTel,
});
}
setVisible(true);
};
......@@ -112,8 +116,8 @@ const ExchangePrSubmitVerify: React.FC = () => {
PublicApi.postAsReplaceGoodsSubmitVerify({
applyId: id,
...values,
...exchangeAddress,
...returnAddress,
...(exchangeAddress || {}),
...(returnAddress || {}),
}).then(res => {
if (res.code === 1000) {
history.goBack();
......
......@@ -386,7 +386,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
}),
isNeedReturn: 1,
})),
taskType: returnGoodsList[0].taskType,
taskType: returnGoodsList[0].extraData.taskType,
};
PublicApi.postAsReturnGoodsSave(payload)
......
......@@ -21,7 +21,6 @@ const ReturnPrReceivedVerify: React.FC = () => {
setSubmitLoading(true);
PublicApi.postAsReturnGoodsConfirmManualReturnReceiveGoods({
dataId: id,
...values,
}).then(res => {
if (res.code === 1000) {
history.goBack();
......
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