Commit fd87edb8 authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接 v2售后退货相关

parent 54b15728
......@@ -5,7 +5,6 @@
* @LastEditTime: 2021-02-24 17:25:15
* @Description: 联动逻辑相关
*/
import lodash from 'lodash';
import BigNumber from 'bignumber.js';
import { FormEffectHooks, FormPath } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils';
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 14:20:17
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-26 18:07:46
* @LastEditTime: 2021-05-07 16:44:47
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -213,6 +213,7 @@ const schema: ISchema = {
type: 'string',
title: '退款金额(元)',
editable: false,
default: 0,
'x-component-props': {
addonBefore: '¥ '
},
......
......@@ -2,15 +2,12 @@ import React, { Suspense, useEffect, useState } from 'react';
import {
PageHeader,
Descriptions,
Card,
Spin,
Button,
Row,
Col,
Badge,
message,
} from 'antd';
import { FormOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
......@@ -26,6 +23,11 @@ import {
RETURN_OUTER_STATUS_UNCONFIRMED_FINISHED,
RETURN_INNER_STATUS_UNCOMMITTED,
} from '@/constants';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
import { normalizeFiledata, FileData, findLastIndexFlowState } from '@/utils';
import AvatarWrap from '@/components/AvatarWrap';
import StatusTag from '@/components/StatusTag';
......@@ -118,6 +120,12 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
setVisibleReturnInfo(true);
};
const isMateriel = (
detailInfo?.orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| detailInfo?.orderType === ORDER_TYPE_BIDDING_CONTRACT
|| detailInfo?.orderType === ORDER_TYPE_TENDER_CONTRACT
);
const productColumns: EditableColumns[] = [
{
title: '订单号',
......@@ -130,6 +138,9 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
</EyePreview>
),
},
...(
!isMateriel
? [
{
title: '商品ID',
dataIndex: 'productId',
......@@ -154,8 +165,44 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
title: '单位',
dataIndex: 'unit',
align: 'center',
}
]
: [
{
title: '物料编号',
dataIndex: 'materielNo',
align: 'center',
},
{
title: '物料名称、规格',
dataIndex: 'materielName',
align: 'center',
render: (text, record) => `${text}/${record.materielType}`,
},
{
title: '品类',
dataIndex: 'materielCategory',
align: 'center',
},
{
title: '品牌',
dataIndex: 'materielBrand',
align: 'center',
},
{
title: '单位',
dataIndex: 'materielUnit',
align: 'center',
},
{
title: detailInfo?.orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
dataIndex: 'productId',
align: 'center',
render: (text, record) => `${text}/${record.productName}/${record.category}/${record.brand}`,
},
]
),
{
title: '采购数量',
dataIndex: 'purchaseCount',
align: 'center',
......@@ -206,7 +253,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
</>
),
},
];
] as EditableColumns[];
// 获取退货申请详情
const getDetailInfo = () => {
......
......@@ -7,10 +7,10 @@ import moment from 'moment';
import { findLastIndex } from 'lodash';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined, PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { GetAsReturnGoodsPageReturnedGoodsResponse } from '@/services/AfterServiceApi';
import { normalizeFiledata, FileData, isJSONStr } from '@/utils';
import { GetAsReturnGoodsPageReturnedGoodsResponseDetail } from '@/services/AfterServiceApi';
import { normalizeFiledata, FileData } from '@/utils';
import { PurchaseOrderOutWorkStateTexts, ORDER_TYPE2 } from '@/constants';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
......@@ -88,7 +88,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
const [detailInfo, setDetailInfo] = useState<DetailInfo>({
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
});
const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsPageReturnedGoodsResponse>({ data: [], totalCount: 0 });
const [returnGoodsList, setReturnGoodsList] = useState<GetAsReturnGoodsPageReturnedGoodsResponseDetail[]>([]);
const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
......@@ -140,9 +140,8 @@ const ReturnForm: React.FC<BillsFormProps> = ({
},
isMateriel ? {
title: '合同编号',
dataIndex: 'type2',
dataIndex: 'contractNo',
align: 'center',
render: () => 'H-13-00002',
} : null,
].filter(Boolean) as ColumnType<any>[];
......@@ -251,6 +250,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
outerTaskList,
returnBatch,
returnId,
roleId,
...rest
} = res.data;
......@@ -292,8 +292,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
...rest,
});
setReturnGoodsList({
data: goodsDetailList.map(item => ({
setReturnGoodsList(goodsDetailList.map(item => ({
...item,
remaining: item.purchaseCount || 0, // 可退货数量,这里取 采购数量判断即可
extraData: {
......@@ -302,9 +301,9 @@ const ReturnForm: React.FC<BillsFormProps> = ({
id: item.orderRecordId,
taskType,
},
})),
totalCount: goodsDetailList.length,
});
associated: !item.materielId ? '' : `${item.productId}/${item.productName}/${item.category}/${item.brand}`,
materielNameAndType: `${item.materielName || ''}${item.materielType ? '/' + item.materielType : ''}`,
})));
setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
}
}).finally(() => {
......@@ -380,17 +379,17 @@ const ReturnForm: React.FC<BillsFormProps> = ({
setVisibleGoodsDrawer(true);
};
const TableAddButton = isEdit || !id ? (
const TableAddButton = (
<Button
style={{ marginBottom: 16 }}
block
icon={<PlusOutlined />}
onClick={handleAddGoods}
type="dashed"
disabled={!isEdit || !!id}
block
>
{!isMateriel ? '选择退货商品' : '选择退货物料'}
</Button>
) : null;
);
const handleSubmit = values => {
const {
......@@ -411,7 +410,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
refundList,
...rest
} = values;
setSubmitLoading(true);
const payload = {
......@@ -463,6 +461,9 @@ const ReturnForm: React.FC<BillsFormProps> = ({
extraData,
needReturnName,
isNeedReturn,
refundAmount,
associated,
materielNameAndType,
...rest
}) => ({
...rest,
......@@ -484,7 +485,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
payId: id,
};
}),
isNeedReturn: 1,
})),
taskType: returnGoodsList[0].extraData.taskType,
};
......@@ -571,6 +571,19 @@ const ReturnForm: React.FC<BillsFormProps> = ({
taskType: item.processEnum,
remaining: item.purchaseCount - (item.returnCount || 0), // 可退货数量
},
isHasTax: item.taxInclusive,
taxRate: item.taxRate,
contractId: item.contractId,
contractNo: item.contractNo,
associated: !isMateriel ? '' : `${item.productId}/${item.productName}/${item.category}/${item.brand}`,
materielId: item.materialId,
materielNo: item.materialCode,
materielNameAndType: `${item.materialName || ''}${item.materialType ? '/' + item.materialType : ''}`,
materielName: item.materialName,
materielType: item.materialType,
materielCategory: item.materialCategory,
materielBrand: item.materialBrand,
materielUnit: item.materialUnit,
};
value.push(atom);
});
......@@ -667,7 +680,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
<NiceForm
value={{
...detailInfo,
returnGoodsList: returnGoodsList.data,
returnGoodsList: returnGoodsList,
}}
previewPlaceholder=" "
expressionScope={{
......
......@@ -301,32 +301,32 @@ export const addSchema = (orderType: number): ISchema => {
title: '订单号',
'x-component': 'OrderNo',
},
productId: {
materielNo: {
type: 'string',
title: '物料编号',
'x-component': 'Text',
},
productName: {
materielNameAndType: {
type: 'string',
title: '物料名称、规格',
'x-component': 'Text',
},
category: {
materielCategory: {
type: 'string',
title: '品类',
'x-component': 'Text',
},
brand: {
materielBrand: {
type: 'string',
title: '品牌',
'x-component': 'Text',
},
unit: {
materielUnit: {
type: 'string',
title: '单位',
'x-component': 'Text',
},
aaa: {
associated: {
type: 'string',
title: orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
'x-component': 'Text',
......
......@@ -2,7 +2,6 @@ import React, { Suspense, useEffect, useState } from 'react';
import {
PageHeader,
Descriptions,
Card,
Spin,
Button,
Row,
......@@ -28,6 +27,11 @@ import {
RETURN_OUTER_STATUS_UNCONFIRMED_FINISHED,
RETURN_INNER_STATUS_UNCOMMITTED,
} from '@/constants';
import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
} from '@/constants/order';
import { normalizeFiledata, FileData, findLastIndexFlowState } from '@/utils';
import AvatarWrap from '@/components/AvatarWrap';
import StatusTag from '@/components/StatusTag';
......@@ -145,6 +149,12 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
});
};
const isMateriel = (
detailInfo?.orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| detailInfo?.orderType === ORDER_TYPE_BIDDING_CONTRACT
|| detailInfo?.orderType === ORDER_TYPE_TENDER_CONTRACT
);
const productColumns: EditableColumns[] = [
{
title: '订单号',
......@@ -157,6 +167,9 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
</EyePreview>
),
},
...(
!isMateriel
? [
{
title: '商品ID',
dataIndex: 'productId',
......@@ -181,8 +194,44 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
title: '单位',
dataIndex: 'unit',
align: 'center',
}
]
: [
{
title: '物料编号',
dataIndex: 'materielNo',
align: 'center',
},
{
title: '物料名称、规格',
dataIndex: 'materielName',
align: 'center',
render: (text, record) => `${text}/${record.materielType}`,
},
{
title: '品类',
dataIndex: 'materielCategory',
align: 'center',
},
{
title: '品牌',
dataIndex: 'materielBrand',
align: 'center',
},
{
title: '单位',
dataIndex: 'materielUnit',
align: 'center',
},
{
title: detailInfo?.orderType !== ORDER_TYPE_TENDER_CONTRACT ? '关联报价商品ID、名称、规格、品类、品牌' : '关联投标商品ID、名称、规格、品类、品牌',
dataIndex: 'productId',
align: 'center',
render: (text, record) => `${text}/${record.productName}/${record.category}/${record.brand}`,
},
]
),
{
title: '采购数量',
dataIndex: 'purchaseCount',
align: 'center',
......@@ -248,7 +297,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
</>
),
},
];
] as EditableColumns[];
// 获取退货申请详情
const getDetailInfo = () => {
......
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