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,7 +38,9 @@ const ExchangePrDeliverVerify: React.FC = () => { ...@@ -36,7 +38,9 @@ const ExchangePrDeliverVerify: React.FC = () => {
<> <>
<DetailInfo <DetailInfo
id={id} id={id}
headExtra={() => ( headExtra={info => (
<>
{(info && info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY) && (
<Button <Button
type="default" type="default"
icon={<SettingOutlined />} icon={<SettingOutlined />}
...@@ -45,6 +49,8 @@ const ExchangePrDeliverVerify: React.FC = () => { ...@@ -45,6 +49,8 @@ const ExchangePrDeliverVerify: React.FC = () => {
手工退货发货 手工退货发货
</Button> </Button>
)} )}
</>
)}
/> />
<ManualDeliveryModal <ManualDeliveryModal
......
...@@ -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,7 +37,15 @@ const ExchangePrReceivedVerify: React.FC = () => { ...@@ -36,7 +37,15 @@ const ExchangePrReceivedVerify: React.FC = () => {
<> <>
<DetailInfo <DetailInfo
id={id} id={id}
headExtra={(detailInfo) => ( headExtra={info => {
const detailed = info || {};
// @ts-ignore
const { manualReplaceGoodsAddress = {} } = detailed;
return (
<>
{(info && info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY) && (
<>
<Button <Button
type="default" type="default"
icon={<SettingOutlined />} icon={<SettingOutlined />}
...@@ -44,11 +53,16 @@ const ExchangePrReceivedVerify: React.FC = () => { ...@@ -44,11 +53,16 @@ const ExchangePrReceivedVerify: React.FC = () => {
> >
手工确认换货收货 手工确认换货收货
</Button> </Button>
)}
/>
<ManualDeliveryModal <ManualDeliveryModal
key="2"
title="确认换货收货" title="确认换货收货"
value={{
deliveryAddressTxt: manualReplaceGoodsAddress.deliveryAddress,
deliveryTime: manualReplaceGoodsAddress.deliveryTime,
logisticsOrderNo: manualReplaceGoodsAddress.logisticsOrderNo,
logisticsNameTxt: manualReplaceGoodsAddress.logisticsName,
}}
visible={modalVisible} visible={modalVisible}
confirmLoading={submitLoading} confirmLoading={submitLoading}
onSubmit={handleSubmit} onSubmit={handleSubmit}
...@@ -56,6 +70,12 @@ const ExchangePrReceivedVerify: React.FC = () => { ...@@ -56,6 +70,12 @@ const ExchangePrReceivedVerify: React.FC = () => {
isEdit={false} 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,7 +38,9 @@ const ExchangePrDeliverVerify: React.FC = () => { ...@@ -36,7 +38,9 @@ const ExchangePrDeliverVerify: React.FC = () => {
<> <>
<DetailInfo <DetailInfo
id={id} id={id}
headExtra={() => ( headExtra={info => (
<>
{(info && info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY) && (
<Button <Button
type="default" type="default"
icon={<SettingOutlined />} icon={<SettingOutlined />}
...@@ -45,6 +49,8 @@ const ExchangePrDeliverVerify: React.FC = () => { ...@@ -45,6 +49,8 @@ const ExchangePrDeliverVerify: React.FC = () => {
手工换货发货 手工换货发货
</Button> </Button>
)} )}
</>
)}
/> />
<ManualDeliveryModal <ManualDeliveryModal
......
...@@ -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,7 +37,15 @@ const ExchangePrReceivedVerify: React.FC = () => { ...@@ -36,7 +37,15 @@ const ExchangePrReceivedVerify: React.FC = () => {
<> <>
<DetailInfo <DetailInfo
id={id} id={id}
headExtra={() => ( headExtra={info => {
const detailed = info || {};
// @ts-ignore
const { manualReturnGoodsAddress = {} } = detailed;
return (
<>
{(info && info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY) && (
<>
<Button <Button
type="default" type="default"
icon={<SettingOutlined />} icon={<SettingOutlined />}
...@@ -44,10 +53,15 @@ const ExchangePrReceivedVerify: React.FC = () => { ...@@ -44,10 +53,15 @@ const ExchangePrReceivedVerify: React.FC = () => {
> >
手工确认退货收货 手工确认退货收货
</Button> </Button>
)}
/>
<ManualDeliveryModal <ManualDeliveryModal
key="2"
value={{
deliveryAddressTxt: manualReturnGoodsAddress.deliveryAddress,
deliveryTime: manualReturnGoodsAddress.deliveryTime,
logisticsOrderNo: manualReturnGoodsAddress.logisticsOrderNo,
logisticsNameTxt: manualReturnGoodsAddress.logisticsName,
}}
visible={modalVisible} visible={modalVisible}
confirmLoading={submitLoading} confirmLoading={submitLoading}
onSubmit={handleSubmit} onSubmit={handleSubmit}
...@@ -55,6 +69,12 @@ const ExchangePrReceivedVerify: React.FC = () => { ...@@ -55,6 +69,12 @@ const ExchangePrReceivedVerify: React.FC = () => {
isEdit={false} 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,12 +88,15 @@ const ExchangePrSubmitVerify: React.FC = () => { ...@@ -88,12 +88,15 @@ const ExchangePrSubmitVerify: React.FC = () => {
message.error('请选择换货自提地址'); message.error('请选择换货自提地址');
return; return;
} }
if (returnAddress) {
setReturnAddress({ setReturnAddress({
receiveId: returnAddress.id, receiveId: returnAddress.id,
receiveAddress: returnAddress.receiveAddress, receiveAddress: returnAddress.receiveAddress,
receiveUserName: returnAddress.receiveUserName, receiveUserName: returnAddress.receiveUserName,
receiveUserTel: returnAddress.receiveUserTel, receiveUserTel: returnAddress.receiveUserTel,
}); });
}
if (exchangeAddress) {
setExchangeAddress({ setExchangeAddress({
deliveryType: exchangeAddress.deliveryType, deliveryType: exchangeAddress.deliveryType,
sendId: exchangeAddress.id, sendId: exchangeAddress.id,
...@@ -101,6 +104,7 @@ const ExchangePrSubmitVerify: React.FC = () => { ...@@ -101,6 +104,7 @@ const ExchangePrSubmitVerify: React.FC = () => {
sendUserName: exchangeAddress.sendUserName, sendUserName: exchangeAddress.sendUserName,
sendUserTel: exchangeAddress.sendUserTel, 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