Commit 84bb3c45 authored by XieZhiXiong's avatar XieZhiXiong

chore: 去掉多余的变量声明

parent e3fff14b
......@@ -9,7 +9,6 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { GetAsReturnGoodsGetDetailByConsumerResponse } from '@/services/AfterServiceV2Api';
import { normalizeFiledata, FileData } from '@/utils';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
......@@ -51,7 +50,86 @@ interface BillsFormProps {
* 订单类型
*/
orderType?: number,
};
}
type ReturnGoodsListItemType = {
/**
* 订单号
*/
orderNo: string,
/**
* 商品id
*/
productId: string,
/**
* 商品名称
*/
productName: string,
/**
* 品类
*/
category: string,
/**
* 品牌
*/
brand: string,
/**
* 单位
*/
unit: string,
/**
* 采购数量
*/
purchaseCount: number,
/**
* 物料编号
*/
associatedProductId: string,
/**
* 物料名称、规格
*/
associatedProductName: string,
/**
* 物料品类
*/
associatedCategory: string,
/**
* 物料品牌
*/
associatedBrand: string,
/**
* 物料单位
*/
associatedUnit: string,
/**
* 关联报价商品ID、名称、规格、品类、品牌
*/
associated: string,
/**
* 采购单价
*/
purchasePrice: number,
/**
* 采购金额
*/
purchaseAmount: number,
/**
* 已支付金额
*/
payAmount: number,
/**
* 退货数量
*/
returnCount: number,
/**
* 退款金额
*/
refundAmount: number,
/**
* 额外的数据
*/
extraData: { [key: string]: any },
}
interface DetailInfo {
applyTime: string;
......@@ -73,6 +151,10 @@ interface DetailInfo {
* 订单类型
*/
orderType?: number,
/**
* 商品数据
*/
returnGoodsList?: ReturnGoodsListItemType[],
}
interface OrderNoProps {
......@@ -105,7 +187,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
const [detailInfo, setDetailInfo] = useState<DetailInfo>({
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
});
const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsGetDetailByConsumerResponse['goodsDetailList']>([]);
const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
......@@ -340,24 +421,24 @@ const ReturnForm: React.FC<BillsFormProps> = ({
},
] :
[]
,
,
returnGoodsList: goodsDetailList.map(item => ({
...item,
remaining: item.purchaseCount || 0, // 可退货数量,这里取 采购数量判断即可
extraData: {
returnReason: item.returnReason,
payList: (item.payList || []).map(({ payId, ...rest }) => ({ ...rest, id: payId })),
id: item.orderRecordId,
taskTypeKey,
orderId: item.orderId,
},
associated: !item.associatedProductId ? '' : `${item.productId}/${item.productName}/${item.associatedCategory}/${item.associatedBrand}`,
materielNameAndType: `${item.associatedProductName || ''}${item.associatedType ? '/' + item.associatedType : ''}`,
})),
...rest,
});
setOrderTypeValue(rest.orderType);
setReturnGoodsList(goodsDetailList.map(item => ({
...item,
remaining: item.purchaseCount || 0, // 可退货数量,这里取 采购数量判断即可
extraData: {
returnReason: item.returnReason,
payList: (item.payList || []).map(({ payId, ...rest }) => ({ ...rest, id: payId })),
id: item.orderRecordId,
taskTypeKey,
orderId: item.orderId,
},
associated: !item.associatedProductId ? '' : `${item.productId}/${item.productName}/${item.associatedCategory}/${item.associatedBrand}`,
materielNameAndType: `${item.associatedProductName || ''}${item.associatedType ? '/' + item.associatedType : ''}`,
})));
setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
}
}).catch((err) => {
......@@ -638,9 +719,10 @@ const ReturnForm: React.FC<BillsFormProps> = ({
taxRate: item.taxRate,
contractId: item.contractId,
contractNo: item.contractNo,
associated: !isMateriel ? '' : `${item.associatedProductId}/${item.quotedName}/${item.category}/${item.brand}`,
associated: !isMateriel ? '' : `${item.quotedProductNo}/${item.quotedName}/${item.quotedSpec}/${item.quotedCategory}/${item.quotedBrand}`,
associatedProductId: item.quotedProductNo || '',
associatedProductName: `${item.quotedName || ''}`,
associatedType: `${item.quotedSpec || ''}`,
associatedCategory: item.quotedCategory || '',
associatedBrand: item.quotedBrand || '',
associatedUnit: item.unit || '',
......@@ -739,10 +821,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
>
<Card>
<NiceForm
value={{
...detailInfo,
returnGoodsList: returnGoodsList,
}}
value={detailInfo}
previewPlaceholder=" "
expressionScope={{
TableAddButton,
......
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