Commit 43d435bf authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接 v2售后换货相关

parent fd87edb8
.steps {
padding-top: 2px;
overflow: auto;
}
\ No newline at end of file
......@@ -22,6 +22,11 @@ import {
ORDER_TYPE2_POINTS,
ORDER_TYPE2_CHANNEL_POINTS,
} 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';
......@@ -89,6 +94,12 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
const [infoLoading, setInfoloading] = useState(false);
const isPointsOrder = detailInfo?.orderType === ORDER_TYPE2_POINTS || detailInfo?.orderType === ORDER_TYPE2_CHANNEL_POINTS;
const isMateriel = (
detailInfo?.orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| detailInfo?.orderType === ORDER_TYPE_BIDDING_CONTRACT
|| detailInfo?.orderType === ORDER_TYPE_TENDER_CONTRACT
);
const productColumns: EditableColumns[] = [
{
title: '订单号',
......@@ -101,31 +112,70 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
</EyePreview>
),
},
{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
},
...(
!isMateriel
? [
{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
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: !isPointsOrder ? '采购数量' : '兑换数量',
dataIndex: 'purchaseCount',
......@@ -163,7 +213,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
dataIndex: 'needReplaceName',
align: 'center',
},
];
] as EditableColumns[];
// 获取换货申请详情
const getDetailInfo = () => {
......
......@@ -40,7 +40,6 @@ const {
onFormInputChange$,
onFormInit$,
onFieldInputChange$,
onFieldValueChange$,
} = FormEffectHooks;
interface BillsFormProps {
......@@ -53,10 +52,6 @@ interface BillsFormProps {
* 订单id,从订单列表跳转过来的
*/
orderId?: number,
/**
* 历史记录目标路径
*/
target: string;
};
interface DetailInfo {
......@@ -94,7 +89,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
id,
isEdit = false,
orderId,
target,
}) => {
const [detailInfo, setDetailInfo] = useState<DetailInfo>({
applyTime: moment().format('YYYY-MM-DD HH:mm:ss'),
......@@ -106,6 +100,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false);
const [orderTypeValue, setOrderTypeValue] = useState(0);
const isPointsOrder = orderTypeValue === ORDER_TYPE2_POINTS || orderTypeValue === ORDER_TYPE2_CHANNEL_POINTS;
const isMateriel = (
orderTypeValue === ORDER_TYPE_INQUIRY_CONTRACT
|| orderTypeValue === ORDER_TYPE_BIDDING_CONTRACT
......@@ -148,63 +143,68 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
},
isMateriel ? {
title: '合同编号',
dataIndex: 'type2',
dataIndex: 'contractNo',
align: 'center',
render: () => 'H-13-00002',
} : null,
].filter(Boolean) as ColumnType<any>[];
const childTableColumn = (record): ColumnType<any>[] => {
const isPointsOrder = record.type === ORDER_TYPE2_POINTS || record.type === ORDER_TYPE2_CHANNEL_POINTS;
return [
{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
},
{
title: !isPointsOrder ? '订单数量' : '兑换数量',
dataIndex: 'purchaseCount',
align: 'center',
},
{
title: !isPointsOrder ? '单价' : '所需积分',
dataIndex: 'price',
align: 'center',
},
{
title: !isPointsOrder ? '采购金额' : '所需积分小计',
dataIndex: 'amount',
align: 'center',
render: (_, record) => (record.purchaseCount * record.price).toFixed(2),
},
{
title: '已换货数量',
dataIndex: 'replaceCount',
align: 'center',
},
];
};
const childTableColumn: ColumnType<any>[] = ([
!isMateriel ?{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
} : {
title: '物料编号',
dataIndex: 'materialCode',
align: 'center',
},
!isMateriel ? {
title: '商品名称',
dataIndex: 'productName',
align: 'center',
} : {
title: '物料名称、规格',
dataIndex: 'materialName',
align: 'center',
render: (text, record) => `${text}/${record.materialType}`,
},
{
title: '品类',
dataIndex: !isMateriel ? 'category' : 'materialCategory',
align: 'center',
},
{
title: '品牌',
dataIndex: !isMateriel ? 'brand' : 'materialBrand',
align: 'center',
},
{
title: '单位',
dataIndex: !isMateriel ? 'unit' : 'materialUnit',
align: 'center',
},
{
title: !isPointsOrder ? '订单数量' : '兑换数量',
dataIndex: 'purchaseCount',
align: 'center',
},
{
title: !isPointsOrder ? '单价' : '所需积分',
dataIndex: 'price',
align: 'center',
},
{
title: !isPointsOrder ? '采购金额' : '所需积分小计',
dataIndex: 'amount',
align: 'center',
render: (_, record) => (record.purchaseCount * record.price).toFixed(2),
},
{
title: '已换货数量',
dataIndex: 'replaceCount',
align: 'center',
},
]);
// 根据供应会员获取订单列表
const getOrderList = (params): Promise<OrderListRes> => {
......@@ -257,6 +257,8 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
outerTaskList,
replaceBatch,
replaceId,
manualReplaceGoodsAddress,
returnBatch,
...rest
} = res.data;
......@@ -307,11 +309,13 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
remaining: item.purchaseCount || 0, // 已换货数量,这里取 采购数量判断即可
id: item.orderRecordId,
taskType,
orderType: rest.orderType,
},
associated: !item.materielId ? '' : `${item.productId}/${item.productName}/${item.category}/${item.brand}`,
materielNameAndType: `${item.materielName || ''}${item.materielType ? '/' + item.materielType : ''}`,
})),
...rest,
});
setOrderTypeValue(rest.orderType);
setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
}
}).finally(() => {
......@@ -387,17 +391,17 @@ const ExchangeForm: 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 = value => {
const {
......@@ -424,7 +428,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
const payload = {
...rest,
replaceId: id || 0,
replaceId: +id || 0,
supplierMemberId: supplierMember[0].memberId,
supplierRoleId: supplierMember[0].roleId,
supplierMemberName: supplierMember[0].name,
......@@ -475,6 +479,8 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
brand,
unit,
extraData,
associated,
materielNameAndType,
...rest
}) => ({
orderRecordId: extraData.id,
......@@ -484,7 +490,6 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
...rest,
})),
taskType: replaceGoodsList[0].extraData.taskType,
orderType: replaceGoodsList[0].extraData.orderType,
};
PublicApi.postAsReplaceGoodsSave(payload)
......@@ -554,8 +559,20 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
remaining: item.purchaseCount - (item.replaceCount || 0), // 可换货数量
id: item.id,
taskType: item.processEnum,
orderType: item.orderType,
},
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);
});
......@@ -652,7 +669,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
setGoodsValue([]);
});
onFieldValueChange$('orderType').subscribe(fieldState => {
onFieldInputChange$('orderType').subscribe(fieldState => {
setOrderTypeValue(fieldState.value);
});
}}
......
......@@ -302,32 +302,37 @@ 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: {
materielType: {
type: 'string',
title: '规格',
'x-component': 'Text',
},
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',
......
......@@ -26,6 +26,11 @@ import {
ORDER_TYPE2_POINTS,
ORDER_TYPE2_CHANNEL_POINTS,
} 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';
......@@ -102,6 +107,11 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
const [returnAddress, setReturnAddress] = useState<ReturnAddressValues>(null);
const isPointsOrder = detailInfo?.orderType === ORDER_TYPE2_POINTS || detailInfo?.orderType === ORDER_TYPE2_CHANNEL_POINTS;
const isMateriel = (
detailInfo?.orderType === ORDER_TYPE_INQUIRY_CONTRACT
|| detailInfo?.orderType === ORDER_TYPE_BIDDING_CONTRACT
|| detailInfo?.orderType === ORDER_TYPE_TENDER_CONTRACT
);
// 获取换货申请详情
const getDetailInfo = () => {
......@@ -181,31 +191,70 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
</EyePreview>
),
},
{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
},
...(
!isMateriel
? [
{
title: '商品ID',
dataIndex: 'productId',
align: 'center',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
},
{
title: '品牌',
dataIndex: 'brand',
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: !isPointsOrder ? '采购数量' : '兑换数量',
dataIndex: 'purchaseCount',
......@@ -252,7 +301,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
</>
),
},
];
] as EditableColumns[];
useEffect(() => {
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