Commit 84b9e6c0 authored by XieZhiXiong's avatar XieZhiXiong

feat: 新增单据 退货入库单 相关逻辑

parent 928a8162
...@@ -120,6 +120,9 @@ const Relevance = props => { ...@@ -120,6 +120,9 @@ const Relevance = props => {
fetchTableData={fetchTableData} fetchTableData={fetchTableData}
formilyProps={formilyProps} formilyProps={formilyProps}
tableProps={tableProps} tableProps={tableProps}
resetModal={{
destroyOnClose: true,
}}
/> />
</RowStyleLayout> </RowStyleLayout>
); );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47 * @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-22 16:57:28 * @LastEditTime: 2020-12-22 17:34:41
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { Modal } from 'antd'; import { Modal } from 'antd';
...@@ -42,6 +42,7 @@ import { ...@@ -42,6 +42,7 @@ import {
machiningWarehousingBillSchema, machiningWarehousingBillSchema,
machiningDeliveryBillSchema, machiningDeliveryBillSchema,
refundDeliveryBillSchema, refundDeliveryBillSchema,
afterSaleBillSchema,
} from '../schema'; } from '../schema';
const { const {
...@@ -180,8 +181,9 @@ const machiningDeliveryColumns = [ ...@@ -180,8 +181,9 @@ const machiningDeliveryColumns = [
}, },
]; ];
// 售后退货发货订单列表 // 售后发货、入库订单列表
const afterSaleRefundDeliveryColumns = [ const getAfterSaleColumns = (isPurchaser?: boolean) => {
return [
{ {
title: '申请单号', title: '申请单号',
align: 'center', align: 'center',
...@@ -192,10 +194,14 @@ const afterSaleRefundDeliveryColumns = [ ...@@ -192,10 +194,14 @@ const afterSaleRefundDeliveryColumns = [
align: 'center', align: 'center',
dataIndex: 'applyAbstract', dataIndex: 'applyAbstract',
}, },
{ isPurchaser ? {
title: '供应会员', title: '供应会员',
align: 'center', align: 'center',
dataIndex: 'supplierName', dataIndex: 'supplierName',
} : {
title: '采购会员',
align: 'center',
dataIndex: 'consumerName',
}, },
{ {
title: '单据时间', title: '单据时间',
...@@ -207,7 +213,8 @@ const afterSaleRefundDeliveryColumns = [ ...@@ -207,7 +213,8 @@ const afterSaleRefundDeliveryColumns = [
align: 'center', align: 'center',
dataIndex: 'outerStatusName', dataIndex: 'outerStatusName',
}, },
]; ];
};
// 获取采购入库单相关数据 // 获取采购入库单相关数据
const fetchOrderPurchaseReceiptAddList = async (params: any) => { const fetchOrderPurchaseReceiptAddList = async (params: any) => {
...@@ -322,6 +329,64 @@ const getRefundDeliveryList = async (params: any) => { ...@@ -322,6 +329,64 @@ const getRefundDeliveryList = async (params: any) => {
return []; return [];
}; };
// 获取售后退货入库单单相关数据
const getRefundWarehousingList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReturnGoodsPageToBeAddReturnGoodsStorage({
applyNo: search,
startTime: startTime ? moment(+startTime).format('YYYY-MM-DD HH:mm:ss') : null,
endTime: endTime ? moment(+endTime).format('YYYY-MM-DD HH:mm:ss') : null,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
id: item.returnId,
memberName: item.consumerName,
membersId: item.parentMemberId,
membersRoleId: item.parentMemberRoleId,
deliveryAddresId: item.returnGoodsAddress.sendId,
fullAddress: item.returnGoodsAddress.sendAddress || '',
receiverName: item.returnGoodsAddress.sendUserName || '',
phone: item.returnGoodsAddress.sendUserTel || '',
deliveryType: item.returnGoodsAddress.deliveryType || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取售后换货退货发货单单相关数据
const getExchangeDeliveryList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReplaceGoodsPageToBeAddReturnDeliveryGoods({
applyNo: search,
startTime: startTime ? moment(+startTime).format('YYYY-MM-DD HH:mm:ss') : null,
endTime: endTime ? moment(+endTime).format('YYYY-MM-DD HH:mm:ss') : null,
...rest,
})
if (res.code === 1000) {
return {
data: res.data.data.map(item => ({
...item,
id: item.replaceId,
memberName: item.supplierName,
membersId: item.parentMemberId,
membersRoleId: item.parentMemberRoleId,
deliveryAddresId: item.returnGoodsAddress.receiveId,
fullAddress: item.returnGoodsAddress.receiveAddress || '',
receiverName: item.returnGoodsAddress.receiveUserName || '',
phone: item.returnGoodsAddress.receiveUserTel || '',
deliveryType: item.returnGoodsAddress.deliveryType || '',
})),
total: res.data.totalCount,
};
}
return [];
};
// 获取关联组件对应的 params // 获取关联组件对应的 params
const getParams = type => { const getParams = type => {
const basicParams = { const basicParams = {
...@@ -395,9 +460,9 @@ const getParams = type => { ...@@ -395,9 +460,9 @@ const getParams = type => {
// 退货发货单 // 退货发货单
case DOC_TYPE_RETURN_INVOICE: { case DOC_TYPE_RETURN_INVOICE: {
basicParams.modalProps.title = '选择售后单'; basicParams.modalProps.title = '选择售后单';
basicParams.columns = afterSaleRefundDeliveryColumns; basicParams.columns = getAfterSaleColumns(true);
basicParams.fetchTableData = getRefundDeliveryList; basicParams.fetchTableData = getRefundDeliveryList;
basicParams.formilyProps.ctx.schema = refundDeliveryBillSchema; basicParams.formilyProps.ctx.schema = afterSaleBillSchema(true);
basicParams.tableProps.rowKey = 'applyNo'; basicParams.tableProps.rowKey = 'applyNo';
basicParams.tableProps.lableKey = 'applyNo'; basicParams.tableProps.lableKey = 'applyNo';
break; break;
...@@ -405,6 +470,28 @@ const getParams = type => { ...@@ -405,6 +470,28 @@ const getParams = type => {
// 退货入库单 // 退货入库单
case DOC_TYPE_RETURN_RECEIPT: { case DOC_TYPE_RETURN_RECEIPT: {
basicParams.modalProps.title = '选择售后单';
basicParams.columns = getAfterSaleColumns(false);
basicParams.fetchTableData = getRefundWarehousingList;
basicParams.formilyProps.ctx.schema = afterSaleBillSchema(false);
basicParams.tableProps.rowKey = 'applyNo';
basicParams.tableProps.lableKey = 'applyNo';
break;
}
// 换货退货发货单
case DOC_TYPE_EXCHANGE_RETURN_INVOICE: {
basicParams.modalProps.title = '选择售后单';
basicParams.columns = getAfterSaleColumns(false);
basicParams.fetchTableData = getExchangeDeliveryList;
basicParams.formilyProps.ctx.schema = afterSaleBillSchema(false);
basicParams.tableProps.rowKey = 'applyNo';
basicParams.tableProps.lableKey = 'applyNo';
break;
}
// 换货退货入库单
case DOC_TYPE_EXCHANGE_RETURN_RECEIPT: {
break; break;
} }
...@@ -421,12 +508,6 @@ const getParams = type => { ...@@ -421,12 +508,6 @@ const getParams = type => {
break; break;
} }
// 换货退货发货单
case DOC_TYPE_EXCHANGE_RETURN_INVOICE: {
break;
}
default: default:
break; break;
} }
...@@ -657,6 +738,10 @@ export const useBusinessEffects = (context, actions) => { ...@@ -657,6 +738,10 @@ export const useBusinessEffects = (context, actions) => {
case DOC_TYPE_EXCHANGE_INVOICE: case DOC_TYPE_EXCHANGE_INVOICE:
// 换货入库单 // 换货入库单
case DOC_TYPE_EXCHANGE_RECEIPT: { case DOC_TYPE_EXCHANGE_RECEIPT: {
// 设置配送方式相关字段数据
setFieldValue('transport', DELIVERY_TYPE[first.deliveryType]);
setFieldValue('deliveryType', first.deliveryType);
// 获取明细数据 商品 数据 // 获取明细数据 商品 数据
PublicApi.getAsReplaceGoodsPageReturnedGoods({ PublicApi.getAsReplaceGoodsPageReturnedGoods({
replaceId: first.id, replaceId: first.id,
......
...@@ -445,15 +445,15 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -445,15 +445,15 @@ const BillsForm: React.FC<BillsFormProps> = ({
fullAddress: returnGoodsAddress.receiveAddress || '', fullAddress: returnGoodsAddress.receiveAddress || '',
receiverName: returnGoodsAddress.receiveUserName || '', receiverName: returnGoodsAddress.receiveUserName || '',
phone: returnGoodsAddress.receiveUserTel || '', phone: returnGoodsAddress.receiveUserTel || '',
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
} }
] : ] :
[] []
, ,
deliveryType: returnGoodsAddress.deliveryType, deliveryType: returnGoodsAddress.deliveryType,
transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType], transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType],
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
}); });
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
...@@ -492,15 +492,15 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -492,15 +492,15 @@ const BillsForm: React.FC<BillsFormProps> = ({
fullAddress: returnGoodsAddress.receiveAddress || '', fullAddress: returnGoodsAddress.receiveAddress || '',
receiverName: returnGoodsAddress.receiveUserName || '', receiverName: returnGoodsAddress.receiveUserName || '',
phone: returnGoodsAddress.receiveUserTel || '', phone: returnGoodsAddress.receiveUserTel || '',
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
} }
] : ] :
[] []
, ,
deliveryType: returnGoodsAddress.deliveryType, deliveryType: returnGoodsAddress.deliveryType,
transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType], transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType],
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
}); });
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
...@@ -540,15 +540,15 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -540,15 +540,15 @@ const BillsForm: React.FC<BillsFormProps> = ({
fullAddress: returnGoodsAddress.receiveAddress || '', fullAddress: returnGoodsAddress.receiveAddress || '',
receiverName: returnGoodsAddress.receiveUserName || '', receiverName: returnGoodsAddress.receiveUserName || '',
phone: returnGoodsAddress.receiveUserTel || '', phone: returnGoodsAddress.receiveUserTel || '',
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
} }
] : ] :
[] []
, ,
deliveryType: returnGoodsAddress.deliveryType, deliveryType: returnGoodsAddress.deliveryType,
transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType], transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType],
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
}); });
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
...@@ -587,15 +587,15 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -587,15 +587,15 @@ const BillsForm: React.FC<BillsFormProps> = ({
fullAddress: returnGoodsAddress.receiveAddress || '', fullAddress: returnGoodsAddress.receiveAddress || '',
receiverName: returnGoodsAddress.receiveUserName || '', receiverName: returnGoodsAddress.receiveUserName || '',
phone: returnGoodsAddress.receiveUserTel || '', phone: returnGoodsAddress.receiveUserTel || '',
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
} }
] : ] :
[] []
, ,
deliveryType: returnGoodsAddress.deliveryType, deliveryType: returnGoodsAddress.deliveryType,
transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType], transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType],
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
}); });
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
...@@ -635,15 +635,15 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -635,15 +635,15 @@ const BillsForm: React.FC<BillsFormProps> = ({
fullAddress: returnGoodsAddress.receiveAddress || '', fullAddress: returnGoodsAddress.receiveAddress || '',
receiverName: returnGoodsAddress.receiveUserName || '', receiverName: returnGoodsAddress.receiveUserName || '',
phone: returnGoodsAddress.receiveUserTel || '', phone: returnGoodsAddress.receiveUserTel || '',
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
} }
] : ] :
[] []
, ,
deliveryType: returnGoodsAddress.deliveryType, deliveryType: returnGoodsAddress.deliveryType,
transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType], transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType],
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
}); });
}).finally(() => { }).finally(() => {
setInfoLoading(false); setInfoLoading(false);
...@@ -1193,9 +1193,9 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -1193,9 +1193,9 @@ const BillsForm: React.FC<BillsFormProps> = ({
}), }),
relevanceInvoicesId: orderNo[0].id, relevanceInvoicesId: orderNo[0].id,
relevanceInvoices: rest.relevanceInvoices, relevanceInvoices: rest.relevanceInvoices,
supplyMembersName: billInfo.supplyMembersName, supplyMembersName: orderNo[0].supplyMembersName,
supplyMembersId: billInfo.supplyMembersId, supplyMembersId: orderNo[0].supplyMembersId,
supplyMembersRoleId: billInfo.supplyMembersRoleId, supplyMembersRoleId: orderNo[0].supplyMembersRoleId,
invoicesTypeId, invoicesTypeId,
}) })
.then(res => { .then(res => {
...@@ -1501,9 +1501,9 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -1501,9 +1501,9 @@ const BillsForm: React.FC<BillsFormProps> = ({
}), }),
relevanceInvoicesId: orderNo[0].id, relevanceInvoicesId: orderNo[0].id,
relevanceInvoices: rest.relevanceInvoices, relevanceInvoices: rest.relevanceInvoices,
supplyMembersName: billInfo.supplyMembersName, supplyMembersName: orderNo[0].supplyMembersName,
supplyMembersId: billInfo.supplyMembersId, supplyMembersId: orderNo[0].supplyMembersId,
supplyMembersRoleId: billInfo.supplyMembersRoleId, supplyMembersRoleId: orderNo[0].supplyMembersRoleId,
invoicesTypeId, invoicesTypeId,
}) })
.then(res => { .then(res => {
......
...@@ -752,8 +752,9 @@ export const machiningDeliveryBillSchema: ISchema = { ...@@ -752,8 +752,9 @@ export const machiningDeliveryBillSchema: ISchema = {
}, },
}; };
// 售后退货发货 弹窗 search schema // 售后发货、入库 弹窗 search schema
export const refundDeliveryBillSchema: ISchema = { export const afterSaleBillSchema = (isPurchaser: boolean): ISchema => {
return {
type: 'object', type: 'object',
properties: { properties: {
megaLayout: { megaLayout: {
...@@ -787,6 +788,7 @@ export const refundDeliveryBillSchema: ISchema = { ...@@ -787,6 +788,7 @@ export const refundDeliveryBillSchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
...(isPurchaser ? {
supplierName: { supplierName: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
...@@ -794,6 +796,15 @@ export const refundDeliveryBillSchema: ISchema = { ...@@ -794,6 +796,15 @@ export const refundDeliveryBillSchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
} : {
consumerName: {
type: 'string',
'x-component-props': {
placeholder: '采购会员',
allowClear: true,
},
},
}),
'[startTime, endTime]': { '[startTime, endTime]': {
type: 'string', type: 'string',
'x-component': 'DateSelect', 'x-component': 'DateSelect',
...@@ -816,6 +827,7 @@ export const refundDeliveryBillSchema: ISchema = { ...@@ -816,6 +827,7 @@ export const refundDeliveryBillSchema: ISchema = {
}, },
}, },
}, },
}
}; };
export const goodsSearchSchema: ISchema = { export const goodsSearchSchema: ISchema = {
......
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