Commit ea26962a authored by XieZhiXiong's avatar XieZhiXiong

feat: 修改换货发货交互方式

parent f56395f6
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-05 15:18:15 * @Date: 2020-11-05 15:18:15
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-18 10:42:45 * @LastEditTime: 2021-08-20 15:33:06
* @Description: 换货发货统计、换货发货明细 * @Description: 换货发货统计、换货发货明细
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
...@@ -32,6 +32,7 @@ import { ...@@ -32,6 +32,7 @@ import {
MAIL_INNER_STATUS_CONFIRMED_RECEIVING, MAIL_INNER_STATUS_CONFIRMED_RECEIVING,
MAIL_INNER_STATUS_CONFIRMED_DELIVER, MAIL_INNER_STATUS_CONFIRMED_DELIVER,
} from '../../constants'; } from '../../constants';
import ReturnDeliverDrawer, { AfterType } from '../DeliverDrawer';
import styles from './index.less'; import styles from './index.less';
const { confirm } = Modal; const { confirm } = Modal;
...@@ -82,6 +83,16 @@ interface ExchangeDeliverInfoProps extends MellowCardProps { ...@@ -82,6 +83,16 @@ interface ExchangeDeliverInfoProps extends MellowCardProps {
* 是否可操作 * 是否可操作
*/ */
isEdit?: boolean; isEdit?: boolean;
/**
* 售后类型,2 换货,3 退货
*/
afterType: AfterType,
/**
* 退货配送方式
*/
deliveryType: number,
}; };
const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
...@@ -94,9 +105,14 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({ ...@@ -94,9 +105,14 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
innerStatus, innerStatus,
target, target,
isEdit = false, isEdit = false,
afterType,
deliveryType,
...rest ...rest
}) => { }) => {
const [radioValue, setRadioValue] = useState<('1' | '2')>('2'); const [radioValue, setRadioValue] = useState<('1' | '2')>('2');
const [visible, setVisible] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const [currentDetailed, setCurrentDetailed] = useState<Detailed | null>(null);
const summaryColumns: EditableColumns[] = [ const summaryColumns: EditableColumns[] = [
{ {
...@@ -216,17 +232,13 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({ ...@@ -216,17 +232,13 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
}, },
]; ];
const handleConfirmExchangeDeliver = (id) => { const handleVisibleDrawer = flag => {
if (onConfirmExchangeDeliver) { setVisible(!!flag);
confirm({ };
title: '提示',
icon: <ExclamationCircleOutlined />, const handleConfirmExchangeDeliver = (record: Detailed) => {
content: `是否确认换货发货?`, setCurrentDetailed(record);
onOk() { handleVisibleDrawer(true);
return onConfirmExchangeDeliver(id);
},
});
}
}; };
const handleConfirmExchangeReceive = (id) => { const handleConfirmExchangeReceive = (id) => {
...@@ -252,6 +264,15 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({ ...@@ -252,6 +264,15 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
setRadioValue(value); setRadioValue(value);
}; };
const handleReturnDeliverSubmit = () => {
if (onConfirmExchangeDeliver) {
setSubmitLoading(true);
onConfirmExchangeDeliver(currentDetailed.deliveryId).finally(() => {
setSubmitLoading(false);
});
}
};
const options = [ const options = [
{ {
label: `换货${!isPurchaser ? '发货' : '收货'}统计`, label: `换货${!isPurchaser ? '发货' : '收货'}统计`,
...@@ -369,7 +390,7 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({ ...@@ -369,7 +390,7 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
textAlign: 'right', textAlign: 'right',
display: 'block', display: 'block',
}} }}
onClick={() => handleConfirmExchangeDeliver(item.deliveryId)} onClick={() => handleConfirmExchangeDeliver(item)}
> >
确认换货发货 确认换货发货
</a> </a>
...@@ -424,6 +445,38 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({ ...@@ -424,6 +445,38 @@ const ExchangeDeliverInfo: React.FC<ExchangeDeliverInfoProps> = ({
</Tabs> </Tabs>
</> </>
) : null} ) : null}
<ReturnDeliverDrawer
afterType={afterType}
flowType="returnDeliver"
value={{
productList: currentDetailed?.detailList?.map((item) => ({
orderNo: item.orderNo,
productId: item.productId,
productName: item.productName,
category: item.category,
brand: item.brand,
unit: item.unit,
applyCount: item.count,
deliveryCount: item.deliveryCount,
noDeliveryCount: item.count - item.deliveryCount,
receiveCount: item.storageCount,
subCount: item.differenceCount,
count: item.deliveryCount,
})),
returnDeliverAddress: currentDetailed?.logisticsReceiveAddress || '',
deliveryTime: currentDetailed?.deliveryTime,
logisticsOrderNo: currentDetailed?.logisticsOrderNo,
logisticsName: currentDetailed?.logisticsName,
}}
deliveryType={deliveryType}
visible={visible}
onClose={() => handleVisibleDrawer(false)}
onSubmit={handleReturnDeliverSubmit}
submitLoading={submitLoading}
ediableProduct={false}
ediableLogistics={!currentDetailed?.logisticsId}
/>
</MellowCard> </MellowCard>
); );
}; };
......
...@@ -52,6 +52,49 @@ export interface SummaryData { ...@@ -52,6 +52,49 @@ export interface SummaryData {
differenceCount: number 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 { export interface Detailed {
/** /**
* 发货Id * 发货Id
...@@ -108,46 +151,9 @@ export interface Detailed { ...@@ -108,46 +151,9 @@ export interface Detailed {
/** /**
* 发货明细 ,DeliveryGoodsDetailVO * 发货明细 ,DeliveryGoodsDetailVO
*/ */
detailList: { detailList: DetailedListItem[]
/** /**
* 订单号 * 物流收货地址
*/ */
orderNo?: string logisticsReceiveAddress?: string,
/**
* 商品id
*/
productId?: string
/**
* 商品名称
*/
productName?: string
/**
* 品类
*/
category?: string
/**
* 品牌
*/
brand?: string
/**
* 单位
*/
unit?: string
/**
* 数量
*/
count?: number
/**
* 发货数量
*/
deliveryCount?: number
/**
* 入库数量
*/
storageCount?: number
/**
* 差异数量,(差异数量=发货数量-入库数量)
*/
differenceCount?: number
}[]
} }
\ No newline at end of file
...@@ -579,6 +579,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -579,6 +579,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
innerStatus={detailInfo?.innerStatus} innerStatus={detailInfo?.innerStatus}
target={target} target={target}
isEdit={isEditExchangeDeliver} isEdit={isEditExchangeDeliver}
afterType={2}
deliveryType={detailInfo?.replaceGoodsAddress?.deliveryType}
id="replaceDeliveryGoodsList" id="replaceDeliveryGoodsList"
/> />
</Suspense> </Suspense>
......
...@@ -632,6 +632,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -632,6 +632,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
innerStatus={detailInfo?.innerStatus} innerStatus={detailInfo?.innerStatus}
target={target} target={target}
isEdit={isEditExchangeDeliver} isEdit={isEditExchangeDeliver}
afterType={2}
deliveryType={detailInfo?.replaceGoodsAddress?.deliveryType}
id="replaceDeliveryGoodsList" id="replaceDeliveryGoodsList"
/> />
</Suspense> </Suspense>
......
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