Commit 196102a5 authored by XieZhiXiong's avatar XieZhiXiong

chore: 删除无用的逻辑

parent ad9c447f
import React, { useState } from 'react';
import { Button, Space, Modal } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined, RollbackOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
/*
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-20 15:35:34
* @Description:
*/
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { EXCHANGE_INNER_STATUS_UNCONFIRMED_RETURN_RECEIPT } from '@/constants/afterService';
import DetailInfo from '../components/DetailInfo';
const { confirm } = Modal;
const ExchangePrConfirmBackVerify: React.FC = () => {
const { id } = usePageStatus();
const handleSubmit = (info) => {
if (!id) {
return;
}
if (
info &&
info.returnDeliveryGoodsList &&
info.returnDeliveryGoodsList.length
) {
// 未退货发货数量有大于 0 时
if (
info.returnDeliveryGoodsList.some(item => {
return item.detailList.some(good => good.count - good.deliveryCount > 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `您还有未退货发货的商品,是否确认全部退货发货都已完成?`,
onOk() {
return PublicApi.postAsReplaceGoodsConfirmAllReturnGoodsReceipt({
dataId: +id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
}
// 未退货发货数量全部小于或等于 0 时
if (
info.returnDeliveryGoodsList.every(item => {
return item.detailList.every(good => good.count - good.deliveryCount <= 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否确认全部退货发货单已收到回单?`,
onOk() {
return PublicApi.postAsReplaceGoodsConfirmAllReturnGoodsReceipt({
dataId: +id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
}
}
};
const handleDeliverAgain = (info) => {
if (
info &&
info.returnDeliveryGoodsList &&
info.returnDeliveryGoodsList.length
) {
// 未退货发货数量全部小于或等于 0 时
if (
info.returnDeliveryGoodsList.every(item => {
return item.detailList.every(good => good.count - good.deliveryCount <= 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `您商品都已退货发货,是否确认还需要继续退货发货?`,
onOk() {
return PublicApi.postAsReplaceGoodsContinueReturnDeliveryGoods({
dataId: +id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
}
// 未退货发货数量有大于 0 时
if (
info.returnDeliveryGoodsList.some(item => {
return item.detailList.some(good => good.count - good.deliveryCount > 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否继续退货发货?`,
onOk() {
return PublicApi.postAsReplaceGoodsContinueReturnDeliveryGoods({
dataId: +id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
}
}
};
return (
<>
<DetailInfo
id={id}
headExtra={detailInfo => (
<Space>
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleSubmit(detailInfo)}
>
确认全部退货发货单已收到回单
</Button>
<Button
type="default"
icon={<RollbackOutlined />}
onClick={() => handleDeliverAgain(detailInfo)}
>
继续退货发货
</Button>
</Space>
)}
target="/memberCenter/afterService/exchangeApplication/exchangePrConfirmBack"
isEditRefundDeliver
/>
</>
<DetailInfo
id={id}
target="/memberCenter/afterService/exchangeApplication/exchangePrConfirmBack"
isEditRefundDeliver
/>
);
};
......
import React, { useState } from 'react';
import { Button, Space, Modal } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined, RollbackOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
/*
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-20 15:36:01
* @Description:
*/
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo';
const { confirm } = Modal;
const ExchangePrConfirmBackVerify: React.FC = () => {
const { id } = usePageStatus();
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = (info) => {
if (!id) {
return;
}
setSubmitLoading(true);
PublicApi.postAsReplaceGoodsConfirmAllReplaceGoodsReceipt({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
}).finally(() => {
setSubmitLoading(false);
});
};
const handleDeliverAgain = (info) => {
if (
info &&
info.replaceDeliveryGoodsList &&
info.replaceDeliveryGoodsList.length
) {
// 未换货发货数量全部小于或等于 0 时
if (
info.replaceDeliveryGoodsList.every(item => {
return item.detailList.every(good => good.count - good.deliveryCount <= 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `您商品都已换货发货,是否确认还需要继续换货发货?`,
onOk() {
return PublicApi.postAsReplaceGoodsContinueReplaceDeliveryGoods({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
}
// 未换货发货数量有大于 0 时
if (
info.replaceDeliveryGoodsList.some(item => {
return item.detailList.some(good => good.count - good.deliveryCount > 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否继续换货发货?`,
onOk() {
return PublicApi.postAsReplaceGoodsContinueReplaceDeliveryGoods({
dataId: id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
});
},
});
}
}
};
return (
<>
<DetailInfo
id={id}
headExtra={detailInfo => (
<Space>
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleSubmit(detailInfo)}
loading={submitLoading}
>
确认全部换货发货单已收到回单
</Button>
<Button
type="default"
icon={<RollbackOutlined />}
onClick={() => handleDeliverAgain(detailInfo)}
>
继续换货发货
</Button>
</Space>
)}
target="/memberCenter/afterService/exchangeManage/exchangePrConfirmBack"
isEditExchangeDeliver
/>
</>
<DetailInfo
id={id}
target="/memberCenter/afterService/exchangeManage/exchangePrConfirmBack"
isEditExchangeDeliver
/>
);
};
......
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