Commit 84bb3c45 authored by XieZhiXiong's avatar XieZhiXiong

chore: 去掉多余的变量声明

parent e3fff14b
...@@ -9,7 +9,6 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout'; ...@@ -9,7 +9,6 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons'; import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd'; import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { GetAsReturnGoodsGetDetailByConsumerResponse } from '@/services/AfterServiceV2Api';
import { normalizeFiledata, FileData } from '@/utils'; import { normalizeFiledata, FileData } from '@/utils';
import { import {
ORDER_TYPE_INQUIRY_CONTRACT, ORDER_TYPE_INQUIRY_CONTRACT,
...@@ -51,7 +50,86 @@ interface BillsFormProps { ...@@ -51,7 +50,86 @@ interface BillsFormProps {
* 订单类型 * 订单类型
*/ */
orderType?: number, 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 { interface DetailInfo {
applyTime: string; applyTime: string;
...@@ -73,6 +151,10 @@ interface DetailInfo { ...@@ -73,6 +151,10 @@ interface DetailInfo {
* 订单类型 * 订单类型
*/ */
orderType?: number, orderType?: number,
/**
* 商品数据
*/
returnGoodsList?: ReturnGoodsListItemType[],
} }
interface OrderNoProps { interface OrderNoProps {
...@@ -105,7 +187,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -105,7 +187,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
const [detailInfo, setDetailInfo] = useState<DetailInfo>({ const [detailInfo, setDetailInfo] = useState<DetailInfo>({
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'), applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
}); });
const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsGetDetailByConsumerResponse['goodsDetailList']>([]);
const [unsaved, setUnsaved] = useState(false); const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false); const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false); const [submitLoading, setSubmitLoading] = useState(false);
...@@ -341,11 +422,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -341,11 +422,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
] : ] :
[] []
, ,
...rest, returnGoodsList: goodsDetailList.map(item => ({
});
setOrderTypeValue(rest.orderType);
setReturnGoodsList(goodsDetailList.map(item => ({
...item, ...item,
remaining: item.purchaseCount || 0, // 可退货数量,这里取 采购数量判断即可 remaining: item.purchaseCount || 0, // 可退货数量,这里取 采购数量判断即可
extraData: { extraData: {
...@@ -357,7 +434,11 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -357,7 +434,11 @@ const ReturnForm: React.FC<BillsFormProps> = ({
}, },
associated: !item.associatedProductId ? '' : `${item.productId}/${item.productName}/${item.associatedCategory}/${item.associatedBrand}`, associated: !item.associatedProductId ? '' : `${item.productId}/${item.productName}/${item.associatedCategory}/${item.associatedBrand}`,
materielNameAndType: `${item.associatedProductName || ''}${item.associatedType ? '/' + item.associatedType : ''}`, materielNameAndType: `${item.associatedProductName || ''}${item.associatedType ? '/' + item.associatedType : ''}`,
}))); })),
...rest,
});
setOrderTypeValue(rest.orderType);
setGoodsValue(goodsDetailList.map(item => item.orderRecordId)); setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
} }
}).catch((err) => { }).catch((err) => {
...@@ -638,9 +719,10 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -638,9 +719,10 @@ const ReturnForm: React.FC<BillsFormProps> = ({
taxRate: item.taxRate, taxRate: item.taxRate,
contractId: item.contractId, contractId: item.contractId,
contractNo: item.contractNo, 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 || '', associatedProductId: item.quotedProductNo || '',
associatedProductName: `${item.quotedName || ''}`, associatedProductName: `${item.quotedName || ''}`,
associatedType: `${item.quotedSpec || ''}`,
associatedCategory: item.quotedCategory || '', associatedCategory: item.quotedCategory || '',
associatedBrand: item.quotedBrand || '', associatedBrand: item.quotedBrand || '',
associatedUnit: item.unit || '', associatedUnit: item.unit || '',
...@@ -739,10 +821,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({ ...@@ -739,10 +821,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
> >
<Card> <Card>
<NiceForm <NiceForm
value={{ value={detailInfo}
...detailInfo,
returnGoodsList: returnGoodsList,
}}
previewPlaceholder=" " previewPlaceholder=" "
expressionScope={{ expressionScope={{
TableAddButton, 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