Commit 05556731 authored by XieZhiXiong's avatar XieZhiXiong

feat: 添加退货数量默认值、过滤退货数量为0的数据

parent 4cc3d73b
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-07 15:11:54
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-09 14:12:50
* @LastEditTime: 2021-08-11 16:36:25
* @Description: 退货发货处理抽屉
*/
import React from 'react';
......@@ -18,7 +18,7 @@ import {
import { ArrayTable } from '@formily/antd-components';
import { PublicApi } from '@/services/api';
import {
GetAsReturnGoodsPageReturnedGoodsResponseDetail,
GetAsReturnGoodsGetDetailByConsumerResponse,
} from '@/services/AfterServiceV2Api';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import NiceForm from '@/components/NiceForm';
......@@ -70,6 +70,10 @@ export type ValuesType = {
* 已发货数量
*/
deliveryCount: string,
/**
* 未退货发货数量
*/
noDeliveryCount: number,
}[],
/**
* 退货发货地址
......@@ -77,6 +81,13 @@ export type ValuesType = {
returnDeliverAddress: AddressValueType,
}
type ProductListItemType = GetAsReturnGoodsGetDetailByConsumerResponse['goodsDetailList'][0] & {
/**
* 退货数量
*/
count: number,
}
interface IProps {
/**
* 是否可见
......@@ -89,7 +100,7 @@ interface IProps {
/**
* 商品列表
*/
productList: GetAsReturnGoodsPageReturnedGoodsResponseDetail[],
productList: ProductListItemType[],
},
/**
* 配送方式
......@@ -153,7 +164,8 @@ const ReturnDeliverDrawer: React.FC<IProps> = (props) => {
const { productList, ...rest } = values;
onSubmit({
...rest,
productList: productList.filter((item) => +item.deliveryCount < +item.returnCount),
// 过滤掉退货数量为0的数据
productList: productList.filter((item) => +item.deliveryCount < +item.returnCount && +item.count > 0),
});
}
};
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-10 18:18:45
* @LastEditTime: 2021-08-11 16:18:09
* @Description: 退货发货
*/
import React, { useState } from 'react';
......@@ -77,7 +77,11 @@ const ReturnPrDeliverVerify: React.FC = () => {
<ReturnDeliverDrawer
value={{
productList: info?.goodsDetailList.filter((item) => item.isNeedReturn && item.noDeliveryCount > 0),
productList: (
info?.goodsDetailList
.filter((item) => item.isNeedReturn && item.noDeliveryCount > 0)
.map((item) => ({ ...item, count: item.noDeliveryCount }))
),
}}
deliveryType={info?.returnGoodsAddress.deliveryType}
visible={visible}
......
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