Commit a5649e79 authored by XieZhiXiong's avatar XieZhiXiong

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

parent 5adf255d
......@@ -2,12 +2,13 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-14 16:55:09
* @LastEditTime: 2020-12-22 16:57:28
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { FormEffectHooks, FormPath } from '@formily/antd';
import moment from 'moment';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import {
......@@ -40,6 +41,7 @@ import {
purchaseOrderBillSchema,
machiningWarehousingBillSchema,
machiningDeliveryBillSchema,
refundDeliveryBillSchema,
} from '../schema';
const {
......@@ -178,32 +180,32 @@ const machiningDeliveryColumns = [
},
];
// 售后订单列表
const afterSaleColumns = [
// 售后退货发货订单列表
const afterSaleRefundDeliveryColumns = [
{
title: '申请单号',
align: 'center',
dataIndex: 'orderNo',
dataIndex: 'applyNo',
},
{
title: '申请单摘要',
align: 'center',
dataIndex: 'invoicesAbstract',
dataIndex: 'applyAbstract',
},
{
title: '会员名称',
title: '供应会员',
align: 'center',
dataIndex: 'memberName',
dataIndex: 'supplierName',
},
{
title: '单据时间',
align: 'center',
dataIndex: 'createTime',
dataIndex: 'applyTime',
},
{
title: '申请单状态',
align: 'center',
dataIndex: 'state',
dataIndex: 'outerStatusName',
},
];
......@@ -286,7 +288,36 @@ const getMachiningDeliveryList = async (params: any) => {
phone: item.receiveUserTel || '',
})),
total: res.data.totalCount,
};;
};
}
return [];
};
// 获取售后退货发货单单相关数据
const getRefundDeliveryList = async (params: any) => {
const { search, startTime, endTime, ...rest } = params;
const res = await PublicApi.getAsReturnGoodsPageToBeAddReturnDeliveryGoods({
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.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 [];
};
......@@ -363,7 +394,12 @@ const getParams = type => {
// 退货发货单
case DOC_TYPE_RETURN_INVOICE: {
basicParams.modalProps.title = '选择售后单';
basicParams.columns = afterSaleRefundDeliveryColumns;
basicParams.fetchTableData = getRefundDeliveryList;
basicParams.formilyProps.ctx.schema = refundDeliveryBillSchema;
basicParams.tableProps.rowKey = 'applyNo';
basicParams.tableProps.lableKey = 'applyNo';
break;
}
......@@ -518,7 +554,6 @@ export const useBusinessEffects = (context, actions) => {
// 关联单据改变
onFieldValueChange$('orderNo').subscribe(fieldState => {
const invoicesTypeIdVal = getFieldValue('invoicesTypeId');
const relevanceInvoicesVal = getFieldValue('relevanceInvoices');
const first = fieldState.value && fieldState.value[0];
// 设置单据公用的数据相关
......@@ -653,6 +688,10 @@ export const useBusinessEffects = (context, actions) => {
case DOC_TYPE_RETURN_INVOICE:
// 退货入库单
case DOC_TYPE_RETURN_RECEIPT: {
// 设置配送方式相关字段数据
setFieldValue('transport', DELIVERY_TYPE[first.deliveryType]);
setFieldValue('deliveryType', first.deliveryType);
// 获取明细数据 商品 数据
PublicApi.getAsReturnGoodsPageReturnedGoods({
returnId: first.id,
......
......@@ -540,15 +540,15 @@ const BillsForm: React.FC<BillsFormProps> = ({
fullAddress: returnGoodsAddress.receiveAddress || '',
receiverName: returnGoodsAddress.receiveUserName || '',
phone: returnGoodsAddress.receiveUserTel || '',
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
}
] :
[]
,
deliveryType: returnGoodsAddress.deliveryType,
transport: DELIVERY_TYPE[returnGoodsAddress.deliveryType],
supplyMembersName: supplierName,
supplyMembersId: parentMemberId,
supplyMembersRoleId: parentMemberRoleId,
});
}).finally(() => {
setInfoLoading(false);
......@@ -1010,7 +1010,6 @@ const BillsForm: React.FC<BillsFormProps> = ({
if (!isEdit) {
return;
}
console.log('value', value)
PublicApi.postWarehouseInvoicesUpdata({
id: +id,
invoicesAbstract: rest.invoicesAbstract,
......@@ -1400,9 +1399,9 @@ const BillsForm: React.FC<BillsFormProps> = ({
}),
relevanceInvoicesId: orderNo[0].id,
relevanceInvoices: rest.relevanceInvoices,
supplyMembersName: billInfo.supplyMembersName,
supplyMembersId: billInfo.supplyMembersId,
supplyMembersRoleId: billInfo.supplyMembersRoleId,
supplyMembersName: orderNo[0].supplyMembersName,
supplyMembersId: orderNo[0].supplyMembersId,
supplyMembersRoleId: orderNo[0].supplyMembersRoleId,
invoicesTypeId,
})
.then(res => {
......
......@@ -752,6 +752,72 @@ export const machiningDeliveryBillSchema: ISchema = {
},
};
// 售后退货发货 弹窗 search schema
export const refundDeliveryBillSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'Mega-Layout',
properties: {
search: {
type: 'string',
'x-component': 'Search',
'x-mega-props': {},
'x-component-props': {
placeholder: '搜索',
align: 'flex-start',
tip: '输入 通知单号 进行搜索',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 3,
},
properties: {
applyAbstract: {
type: 'string',
'x-component-props': {
placeholder: '申请单摘要',
allowClear: true,
},
},
supplierName: {
type: 'string',
'x-component-props': {
placeholder: '供应会员',
allowClear: true,
},
},
'[startTime, endTime]': {
type: 'string',
'x-component': 'DateSelect',
'x-component-props': {
placeholder: '单据时间',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
}
}
},
},
},
},
},
};
export const goodsSearchSchema: ISchema = {
type: 'object',
properties: {
......
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