Commit e5d82bda authored by XieZhiXiong's avatar XieZhiXiong

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

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