Commit a5649e79 authored by XieZhiXiong's avatar XieZhiXiong

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

parent 5adf255d
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
* @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-14 16:55:09 * @LastEditTime: 2020-12-22 16:57:28
* @Description: 联动逻辑相关 * @Description: 联动逻辑相关
*/ */
import { Modal } from 'antd'; import { Modal } from 'antd';
import { ExclamationCircleOutlined } from '@ant-design/icons'; import { ExclamationCircleOutlined } from '@ant-design/icons';
import { FormEffectHooks, FormPath } from '@formily/antd'; import { FormEffectHooks, FormPath } from '@formily/antd';
import moment from 'moment';
import { useLinkageUtils } from '@/utils/formEffectUtils'; import { useLinkageUtils } from '@/utils/formEffectUtils';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'; import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { import {
...@@ -40,6 +41,7 @@ import { ...@@ -40,6 +41,7 @@ import {
purchaseOrderBillSchema, purchaseOrderBillSchema,
machiningWarehousingBillSchema, machiningWarehousingBillSchema,
machiningDeliveryBillSchema, machiningDeliveryBillSchema,
refundDeliveryBillSchema,
} from '../schema'; } from '../schema';
const { const {
...@@ -178,32 +180,32 @@ const machiningDeliveryColumns = [ ...@@ -178,32 +180,32 @@ const machiningDeliveryColumns = [
}, },
]; ];
// 售后订单列表 // 售后退货发货订单列表
const afterSaleColumns = [ const afterSaleRefundDeliveryColumns = [
{ {
title: '申请单号', title: '申请单号',
align: 'center', align: 'center',
dataIndex: 'orderNo', dataIndex: 'applyNo',
}, },
{ {
title: '申请单摘要', title: '申请单摘要',
align: 'center', align: 'center',
dataIndex: 'invoicesAbstract', dataIndex: 'applyAbstract',
}, },
{ {
title: '会员名称', title: '供应会员',
align: 'center', align: 'center',
dataIndex: 'memberName', dataIndex: 'supplierName',
}, },
{ {
title: '单据时间', title: '单据时间',
align: 'center', align: 'center',
dataIndex: 'createTime', dataIndex: 'applyTime',
}, },
{ {
title: '申请单状态', title: '申请单状态',
align: 'center', align: 'center',
dataIndex: 'state', dataIndex: 'outerStatusName',
}, },
]; ];
...@@ -286,7 +288,36 @@ const getMachiningDeliveryList = async (params: any) => { ...@@ -286,7 +288,36 @@ const getMachiningDeliveryList = async (params: any) => {
phone: item.receiveUserTel || '', phone: item.receiveUserTel || '',
})), })),
total: res.data.totalCount, 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 []; return [];
}; };
...@@ -363,7 +394,12 @@ const getParams = type => { ...@@ -363,7 +394,12 @@ const getParams = type => {
// 退货发货单 // 退货发货单
case DOC_TYPE_RETURN_INVOICE: { 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; break;
} }
...@@ -518,7 +554,6 @@ export const useBusinessEffects = (context, actions) => { ...@@ -518,7 +554,6 @@ export const useBusinessEffects = (context, actions) => {
// 关联单据改变 // 关联单据改变
onFieldValueChange$('orderNo').subscribe(fieldState => { onFieldValueChange$('orderNo').subscribe(fieldState => {
const invoicesTypeIdVal = getFieldValue('invoicesTypeId'); const invoicesTypeIdVal = getFieldValue('invoicesTypeId');
const relevanceInvoicesVal = getFieldValue('relevanceInvoices');
const first = fieldState.value && fieldState.value[0]; const first = fieldState.value && fieldState.value[0];
// 设置单据公用的数据相关 // 设置单据公用的数据相关
...@@ -653,6 +688,10 @@ export const useBusinessEffects = (context, actions) => { ...@@ -653,6 +688,10 @@ export const useBusinessEffects = (context, actions) => {
case DOC_TYPE_RETURN_INVOICE: case DOC_TYPE_RETURN_INVOICE:
// 退货入库单 // 退货入库单
case DOC_TYPE_RETURN_RECEIPT: { case DOC_TYPE_RETURN_RECEIPT: {
// 设置配送方式相关字段数据
setFieldValue('transport', DELIVERY_TYPE[first.deliveryType]);
setFieldValue('deliveryType', first.deliveryType);
// 获取明细数据 商品 数据 // 获取明细数据 商品 数据
PublicApi.getAsReturnGoodsPageReturnedGoods({ PublicApi.getAsReturnGoodsPageReturnedGoods({
returnId: first.id, returnId: first.id,
......
...@@ -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);
...@@ -1010,7 +1010,6 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -1010,7 +1010,6 @@ const BillsForm: React.FC<BillsFormProps> = ({
if (!isEdit) { if (!isEdit) {
return; return;
} }
console.log('value', value)
PublicApi.postWarehouseInvoicesUpdata({ PublicApi.postWarehouseInvoicesUpdata({
id: +id, id: +id,
invoicesAbstract: rest.invoicesAbstract, invoicesAbstract: rest.invoicesAbstract,
...@@ -1400,9 +1399,9 @@ const BillsForm: React.FC<BillsFormProps> = ({ ...@@ -1400,9 +1399,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,6 +752,72 @@ export const machiningDeliveryBillSchema: ISchema = { ...@@ -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 = { export const goodsSearchSchema: ISchema = {
type: 'object', type: 'object',
properties: { 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