Commit fd87edb8 authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接 v2售后退货相关

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