Commit bac296f7 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修改接口地址

parent 46058aa3
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';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo';
const { confirm } = Modal;
const ReturnPrConfirmBackVerify: React.FC = () => {
const { id } = usePageStatus();
const [submitLoading, setSubmitLoading] = useState(false);
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.postAsReturnGoodsConfirmAllReturnGoodsReceipt({
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.postAsReturnGoodsContinueReturnDeliveryGoods({
dataId: id,
});
},
});
}
// 未退货发货数量有大于 0 时
if (
info.returnDeliveryGoodsList.some(item => {
return item.detailList.some(good => good.count - good.deliveryCount > 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否继续退货发货?`,
onOk() {
return PublicApi.postAsReturnGoodsContinueReturnDeliveryGoods({
dataId: id,
});
},
});
}
}
};
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>
)}
/>
</>
);
};
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';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo';
const { confirm } = Modal;
const ReturnPrConfirmBackVerify: React.FC = () => {
const { id } = usePageStatus();
const [submitLoading, setSubmitLoading] = useState(false);
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.postAsReturnGoodsConfirmAllReturnGoodsReceipt({
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.postAsReturnGoodsConfirmAllReturnGoodsReceipt({
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.postAsReturnGoodsContinueReturnDeliveryGoods({
dataId: id,
});
},
});
}
// 未退货发货数量有大于 0 时
if (
info.returnDeliveryGoodsList.some(item => {
return item.detailList.some(good => good.count - good.deliveryCount > 0)
})
) {
confirm({
title: '提示',
icon: <ExclamationCircleOutlined />,
content: `是否继续退货发货?`,
onOk() {
return PublicApi.postAsReturnGoodsContinueReturnDeliveryGoods({
dataId: id,
});
},
});
}
}
};
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>
)}
/>
</>
);
};
export default ReturnPrConfirmBackVerify;
\ No newline at end of file
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