Commit 6f5cf3ec authored by XieZhiXiong's avatar XieZhiXiong

feat: 完善换货退货收、发货相关

parent 4dd8b2c4
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 15:18:15
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-08 14:53:46
* @LastEditTime: 2021-08-17 18:27:41
* @Description: 换货发货统计、换货发货明细
*/
import React, { useState } from 'react';
......@@ -102,14 +102,6 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
{
title: '订单号',
dataIndex: 'orderNo',
render: (text, record) => (
<a
href={`${target}/orderDetail?orderNo=${text}`}
target="_blank"
>
{text}
</a>
),
},
{
title: '商品ID',
......@@ -176,14 +168,6 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
{
title: '订单号',
dataIndex: 'orderNo',
render: (text, record) => (
<a
href={`${target}/orderDetail?orderNo=${text}`}
target="_blank"
>
{text}
</a>
),
},
{
title: '商品ID',
......@@ -296,7 +280,7 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
>
{radioValue === '1' ? (
<PolymericTable
rowKey={record => `${record.orderNo}+${record.productId}`}
rowKey={() => Math.random().toFixed(16).slice(2, 10)}
dataSource={summary}
columns={summaryColumns}
loading={false}
......@@ -327,11 +311,20 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
)}
</Descriptions.Item>
<Descriptions.Item label="物流单号">
{item.logisticsId ? (
<Link
to={`/memberCenter/logisticsAbility/logisticsBillSubmit/logisticsBillQuery/preview?id=${item.logisticsId}`}
>
{item.logisticsOrderNo}
</Link>
) : (
<a
href={`https://www.kuaidi100.com/chaxun?nu=${item.logisticsOrderNo}`}
target="_blank"
>
{item.logisticsOrderNo}
</a>
)}
</Descriptions.Item>
<Descriptions.Item label="换货入库单号">
{isPurchaser ? (
......@@ -358,7 +351,7 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
<Descriptions.Item label="内部状态">
<Badge color={'#6C9CEB'} text={item.innerStatusName} />
</Descriptions.Item>
<Descriptions.Item>
<Descriptions.Item contentStyle={{ display: 'block', textAlign: 'right' }}>
{(
isEdit &&
!isPurchaser &&
......@@ -414,7 +407,7 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
</div>
<PolymericTable
rowKey={record => `${record.orderNo}+${record.productId}`}
rowKey={() => Math.random().toFixed(16).slice(2, 10)}
dataSource={item.detailList}
columns={detailedColumns}
loading={false}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 15:18:15
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-09 18:09:01
* @LastEditTime: 2021-08-17 17:30:29
* @Description: 换货收货统计、换货发货明细
*/
import React, { useState } from 'react';
......@@ -104,14 +104,6 @@ const ExchangeReceivedInfo: React.FC<ExchangeReceivedInfoProps> = ({
{
title: '订单号',
dataIndex: 'orderNo',
render: (text, record) => (
<a
href={`${target}/orderDetail?orderNo=${text}`}
target="_blank"
>
{text}
</a>
),
},
{
title: '商品ID',
......@@ -178,14 +170,6 @@ const ExchangeReceivedInfo: React.FC<ExchangeReceivedInfoProps> = ({
{
title: '订单号',
dataIndex: 'orderNo',
render: (text, record) => (
<a
href={`${target}/orderDetail?orderNo=${text}`}
target="_blank"
>
{text}
</a>
),
},
{
title: '商品ID',
......@@ -305,7 +289,7 @@ const ExchangeReceivedInfo: React.FC<ExchangeReceivedInfoProps> = ({
>
{radioValue === '1' ? (
<PolymericTable
rowKey={record => `${record.orderNo}+${record.productId}`}
rowKey={() => Math.random().toFixed(16).slice(2, 10)}
dataSource={summary}
columns={summaryColumns}
loading={false}
......@@ -314,7 +298,7 @@ const ExchangeReceivedInfo: React.FC<ExchangeReceivedInfoProps> = ({
) : null}
{radioValue === '2' ? (
<>
<Tabs>
<Tabs defaultActiveKey={detailed ? `${detailed[detailed.length - 1].batch}` : ''}>
{detailed.map((item) => (
<TabPane
tab={`第 ${item.batch} 批次`}
......@@ -336,11 +320,20 @@ const ExchangeReceivedInfo: React.FC<ExchangeReceivedInfoProps> = ({
)}
</Descriptions.Item>
<Descriptions.Item label="物流单号">
{item.logisticsId ? (
<Link
to={`/memberCenter/logisticsAbility/logisticsBillSubmit/logisticsBillQuery/preview?id=${item.logisticsId}`}
>
{item.logisticsOrderNo}
</Link>
) : (
<a
href={`https://www.kuaidi100.com/chaxun?nu=${item.logisticsOrderNo}`}
target="_blank"
>
{item.logisticsOrderNo}
</a>
)}
</Descriptions.Item>
<Descriptions.Item label="退货入库单号">
{!isPurchaser ? (
......@@ -367,7 +360,7 @@ const ExchangeReceivedInfo: React.FC<ExchangeReceivedInfoProps> = ({
<Descriptions.Item label="内部状态">
<Badge color={'#6C9CEB'} text={item.innerStatusName} />
</Descriptions.Item>
<Descriptions.Item>
<Descriptions.Item contentStyle={{ display: 'block', textAlign: 'right' }}>
{(
isEdit &&
isPurchaser &&
......@@ -423,7 +416,7 @@ const ExchangeReceivedInfo: React.FC<ExchangeReceivedInfoProps> = ({
</div>
<PolymericTable
rowKey={record => `${record.orderNo}+${record.productId}`}
rowKey={() => Math.random().toFixed(16).slice(2, 10)}
dataSource={item.detailList}
columns={detailedColumns}
loading={false}
......
......@@ -52,6 +52,49 @@ export interface SummaryData {
differenceCount: number
}
export type DetailedListItem = {
/**
* 订单号
*/
orderNo?: string
/**
* 商品id
*/
productId?: string
/**
* 商品名称
*/
productName?: string
/**
* 品类
*/
category?: string
/**
* 品牌
*/
brand?: string
/**
* 单位
*/
unit?: string
/**
* 数量
*/
count?: number
/**
* 发货数量
*/
deliveryCount?: number
/**
* 入库数量
*/
storageCount?: number
/**
* 差异数量,(差异数量=发货数量-入库数量)
*/
differenceCount?: number
}
export interface Detailed {
/**
* 退货发货单号Id
......@@ -108,46 +151,5 @@ export interface Detailed {
/**
* 发货明细 ,DeliveryGoodsDetailVO
*/
detailList: {
/**
* 订单号
*/
orderNo?: string
/**
* 商品id
*/
productId?: string
/**
* 商品名称
*/
productName?: string
/**
* 品类
*/
category?: string
/**
* 品牌
*/
brand?: string
/**
* 单位
*/
unit?: string
/**
* 数量
*/
count?: number
/**
* 发货数量
*/
deliveryCount?: number
/**
* 入库数量
*/
storageCount?: number
/**
* 差异数量,(差异数量=发货数量-入库数量)
*/
differenceCount?: number
}[]
detailList: DetailedListItem[]
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-07 17:08:04
* @LastEditTime: 2021-08-17 13:53:35
* @Description:
*/
import React, { useState } from 'react';
......@@ -10,39 +10,56 @@ import { Button } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import moment from 'moment';
import { usePageStatus } from '@/hooks/usePageStatus';
import { EXCHANGE_GOODS_MANUAL_DELIVERY, EXCHANGE_GOODS_MANUAL_DELIVERY_CONTRACT } from '../../constants';
import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo';
import ReturnDeliverDrawer, { ValuesType } from '../../components/DeliverDrawer';
const ExchangePrDeliverVerify: React.FC = () => {
const { id } = usePageStatus();
const [modalVisible, setModalVisible] = useState(false);
const [visible, setVisible] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = values => {
const handleSubmit = (values: ValuesType) => {
if (!id) {
return;
}
const {
productList,
returnDeliverAddress,
deliveryTime,
logisticsNameTxt,
logisticsOrderNo,
} = values;
setSubmitLoading(true);
PublicApi.postAsReplaceGoodsManualReturnDeliveryGoods({
dataId: id,
...values,
dataId: +id,
deliveryAddress: `${returnDeliverAddress.fullAddress} ${returnDeliverAddress.name}/${returnDeliverAddress.phone}`,
productList: productList.map((item) => ({
productId: item.productId,
returnCount: +item.count,
})),
deliveryTime: moment(deliveryTime).valueOf(),
logisticsName: logisticsNameTxt,
logisticsOrderNo,
}).then(res => {
if (res.code === 1000) {
handleVisibleDrawer(false);
setTimeout(() => {
history.goBack();
}, 800);
}
}).finally(() => {
setSubmitLoading(false);
});
};
const handleVisible = flag => {
setModalVisible(!!flag);
const handleVisibleDrawer = flag => {
setVisible(!!flag);
};
return (
<>
<DetailInfo
id={id}
headExtra={info => (
......@@ -51,26 +68,46 @@ const ExchangePrDeliverVerify: React.FC = () => {
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
onClick={() => handleVisibleDrawer(true)}
>
手工退货发货
退货发货
</Button>
)}
<ReturnDeliverDrawer
afterType={2}
flowType="returnDeliver"
value={{
productList: (
info?.goodsDetailList
.filter((item) => item.isNeedReturn && item.noDeliveryCount > 0)
.map((item) => ({
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
category: item.category,
brand: item.brand,
unit: item.unit,
applyCount: item.replaceCount,
deliveryCount: item.deliveryCount,
noDeliveryCount: item.noDeliveryCount,
receiveCount: item.receiveCount,
subCount: item.subCount,
count: item.noDeliveryCount,
}))
),
}}
deliveryType={info?.returnGoodsAddress.deliveryType}
visible={visible}
onClose={() => handleVisibleDrawer(false)}
onSubmit={handleSubmit}
submitLoading={submitLoading}
/>
</>
)}
target="/memberCenter/afterService/exchangeApplication/exchangePrDeliver"
isEditRefundDeliver
/>
<ManualDeliveryModal
title="退货发货处理"
visible={modalVisible}
confirmLoading={submitLoading}
onSubmit={handleSubmit}
onVisible={handleVisible}
isEdit={true}
/>
</>
);
};
......
......@@ -2,88 +2,22 @@
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-07 19:36:18
* @LastEditTime: 2021-08-17 17:20:05
* @Description:
*/
import React, { useState } from 'react';
import { Button } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { SettingOutlined } from '@ant-design/icons';
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { EXCHANGE_GOODS_MANUAL_DELIVERY, EXCHANGE_GOODS_MANUAL_DELIVERY_CONTRACT } from '../../constants';
import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo';
const ExchangePrReceivedVerify: React.FC = () => {
const { id } = usePageStatus();
const [modalVisible, setModalVisible] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const handleSubmit = values => {
if (!id) {
return;
}
setSubmitLoading(true);
PublicApi.postAsReplaceGoodsConfirmManualReturnReceiveGoods({
dataId: +id,
}).then(res => {
if (res.code === 1000) {
history.goBack();
}
}).finally(() => {
setSubmitLoading(false);
});
};
const handleVisible = flag => {
setModalVisible(!!flag);
};
return (
<>
<DetailInfo
id={id}
headExtra={info => {
const detailed = info || {};
// @ts-ignore
const { manualReturnGoodsAddress = {} } = detailed;
return (
<>
{(info && (info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY || info.taskType === EXCHANGE_GOODS_MANUAL_DELIVERY_CONTRACT)) && (
<>
<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}
/>
</>
)}
</>
)
}}
target="/memberCenter/afterService/exchangeManage/exchangePrReceived"
isEditRefundDeliver
/>
</>
);
};
......
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