Commit 42b124cb authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents dd3a3b52 bd59a776
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-09 10:48:12
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-18 17:31:42
* @LastEditTime: 2020-12-14 16:38:53
* @Description: 手动发货弹窗
*/
import React from 'react';
......@@ -10,6 +10,8 @@ import { Modal } from 'antd';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { DatePicker } from '@formily/antd-components'
import NiceForm from '@/components/NiceForm';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { PublicApi } from '@/services/api';
import { schema } from './schema';
const modalFormActions = createFormActions();
......@@ -42,6 +44,51 @@ const VerifyModal: React.FC<VerifyModalProps> = ({
onSubmit(values);
}
};
// 获取发货地址
const fetchShipperAddress = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getLogisticsSelectListShipperAddress().then(res => {
if (res.code === 1000) {
const options =
res.data ?
res.data.map(item => ({
label: `${item.fullAddress}/${item.shipperName}/${item.phone}`,
value: item.id,
...item,
})) :
[];
resolve(options);
}
reject();
}).catch(() => {
reject();
});
});
};
// 获取物流公司
const fetchLogisticsCompany = (): Promise<any[]> => {
return new Promise((resolve, reject) => {
PublicApi.getLogisticsSelectListCompany({
cooperateType: '2', // 1-平台物流服务商,2-商户合作物流公司
}).then(res => {
if (res.code === 1000) {
const options =
res.data ?
res.data.map(item => ({
label: item.name,
value: item.id,
})) :
[];
resolve(options);
}
reject();
}).catch(() => {
reject();
});
});
};
return (
<Modal
......@@ -54,7 +101,8 @@ const VerifyModal: React.FC<VerifyModalProps> = ({
>
<NiceForm
effects={($, { setFieldState }) => {
useAsyncSelect('deliveryAddress', fetchShipperAddress, ['label', 'value']);
useAsyncSelect('logisticsName', fetchLogisticsCompany, ['label', 'value']);
}}
components={{
DatePicker,
......
......@@ -17,17 +17,15 @@ export const schema: ISchema = {
labelAlign: 'top',
},
properties: {
address: {
deliveryAddress: {
type: 'string',
title: '发货地址',
enum: [
],
enum: [],
'x-component-props': {
placeholder: '请选择',
},
},
sendTime: {
deliveryTime: {
type: 'string',
title: '发货时间',
'x-component': 'DatePicker',
......@@ -38,7 +36,7 @@ export const schema: ISchema = {
style: { width: '100%' },
},
},
codeNo: {
logisticsOrderNo: {
type: 'string',
title: '发货单号',
required: true,
......@@ -46,13 +44,11 @@ export const schema: ISchema = {
placeholder: '请选择',
},
},
company: {
logisticsName: {
type: 'string',
title: '物流公司',
required: true,
enum: [
],
enum: [],
'x-component-props': {
placeholder: '请选择',
},
......
......@@ -277,3 +277,22 @@ export const REFUND_OUTER_STATUS_TAG_MAP = {
[REFUND_OUTER_STATUS_NOT_RECEIVED]: 'warning',
[REFUND_OUTER_STATUS_RECEIVED]: 'success',
};
// 工作流相关
/**
* 售后退货外部流转
*/
export const RETURN_GOODS_OUTER_DELIVERY = 18;
/**
* 售后换货外部流转
*/
export const EXCHANGE_GOODS_OUTER_DELIVERY = 20;
/**
* 售后换货手工发货
*/
export const EXCHANGE_GOODS_MANUAL_DELIVERY = 30;
/**
* 售后退货手工发货
*/
export const RETURN_GOODS_MANUAL_DELIVERY = 31;
\ No newline at end of file
......@@ -541,6 +541,7 @@ const ExchangeForm: React.FC<BillsFormProps> = ({
<GoodsDrawer
title="选择换货商品"
type={2}
visible={visibleGoodsDrawer}
fetchOrderList={getOrderList}
onClose={() => setVisibleGoodsDrawer(false)}
......
......@@ -370,6 +370,7 @@ const RepairForm: React.FC<BillsFormProps> = ({
</Card>
<GoodsDrawer
type={4}
visible={visibleDrawer}
fetchOrderList={getOrderList}
onClose={() => setVisibleDrawer(false)}
......
......@@ -6,6 +6,7 @@ import { SettingOutlined } from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus';
import ManualDeliveryModal from '../../components/ManualDeliveryModal';
import DetailInfo from '../components/DetailInfo';
import { RETURN_GOODS_MANUAL_DELIVERY } from '../../constants';
const ReturnPrDeliverVerify: React.FC = () => {
const { id } = usePageStatus();
......@@ -36,14 +37,18 @@ const ReturnPrDeliverVerify: React.FC = () => {
<>
<DetailInfo
id={id}
headExtra={() => (
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工退货发货
</Button>
headExtra={info => (
<>
{(info && info.taskType === RETURN_GOODS_MANUAL_DELIVERY) && (
<Button
type="default"
icon={<SettingOutlined />}
onClick={() => handleVisible(true)}
>
手工退货发货
</Button>
)}
</>
)}
/>
......
......@@ -63,7 +63,6 @@ const ReturnForm: React.FC<BillsFormProps> = ({
const [unsaved, setUnsaved] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const [returnGoodsLoading, setReturnGoodsLoading] = useState(false);
const [orderInfo, setOrderInfo] = useState<OrderInfo>(null);
const [visibleGoodsDrawer, setVisibleGoodsDrawer] = useState(false);
const [visibleReturnInfoDrawer, setVisibleReturnInfoDrawer] = useState(false);
......@@ -153,7 +152,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
// 缺
{
title: '已退款金额',
dataIndex: 'returnCount2',
dataIndex: 'refunded',
align: 'center',
},
];
......@@ -248,47 +247,29 @@ const ReturnForm: React.FC<BillsFormProps> = ({
,
...rest,
});
}
}).finally(() => {
setInfoLoading(false);
});
};
// 获取退货明细列表
const getReturnGoods = () => {
if (!id) {
return;
}
setReturnGoodsLoading(true);
PublicApi.getAsReturnGoodsPageReturnedGoods({
returnId: id,
current: `${1}`,
pageSize: `${99999}`,
}).then(res => {
if (res.code === 1000) {
setReturnGoodsList(res.data);
setReturnGoodsList({
data: res.data.data.map(item => ({
data: goodsDetailList.map(item => ({
...item,
returnedCount:item.purchaseCount || 0, // 已退货数量,这里取 采购数量判断即可
returnedCount: item.purchaseCount || 0, // 已退货数量,这里取 采购数量判断即可
extraData: {
id: item.orderRecordId,
returnReason: item.returnReason,
payList: item.payList,
payList: item.payList || [],
id: item.orderRecordId || [],
taskType,
},
})),
totalCount: res.data.totalCount,
totalCount: goodsDetailList.length,
});
setGoodsValue(res.data && res.data.data ? res.data.data.map(item => item.orderRecordId) : []);
setGoodsValue(goodsDetailList.map(item => item.orderRecordId));
}
}).finally(() => {
setReturnGoodsLoading(false);
setInfoLoading(false);
});
};
useEffect(() => {
getDetailInfo();
getReturnGoods();
}, []);
const handleAddGoods = () => {
......@@ -405,7 +386,8 @@ const ReturnForm: React.FC<BillsFormProps> = ({
}),
isNeedReturn: 1,
})),
taskType: 18,
// taskType: returnGoodsList[0].taskType,
taskType: 31,
};
PublicApi.postAsReturnGoodsSave(payload)
......@@ -490,6 +472,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
id: item.id,
returnReason: '',
payList: item.payList,
taskType: item.processEnum,
},
};
value.push(atom);
......@@ -541,7 +524,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
);
return (
<Spin spinning={infoLoading || returnGoodsLoading}>
<Spin spinning={infoLoading}>
<PageHeaderWrapper
style={{
padding: 24,
......@@ -575,14 +558,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
<NiceForm
initialValues={{
...detailInfo,
returnGoodsList: returnGoodsList.data.map(item => ({
...item,
extraData: {
returnReason: item.returnReason,
payList: item.payList || [],
id: item.orderRecordId || [],
},
})),
returnGoodsList: returnGoodsList.data,
}}
expressionScope={{
TableAddButton,
......
......@@ -188,7 +188,10 @@ const QuotaMenage: React.FC = () => {
render: (text, record) => (
<>
{/* 授信状态为 正常 时可申请调额 */}
{record.status === CREDIT_STATUS_NORMAL && (
{(
record.status === CREDIT_STATUS_NORMAL &&
record.isCanApply
) && (
<Button
type="link"
onClick={() => handleAdjustment(record)}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-09 16:00:20
* @LastEditTime: 2020-12-14 16:55:09
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
......@@ -217,6 +217,8 @@ const fetchOrderPurchaseReceiptAddList = async (params: any) => {
data: res.data.data.map(item => ({
...item,
memberName: item.supplyMembersName,
membersId: item.supplyMembersId,
membersRoleId: item.supplyMembersRoleId,
})),
total: res.data.totalCount,
};
......@@ -234,6 +236,8 @@ const getOrderSalesInvoiceOrderList = async (params: any) => {
data: res.data.data.map(item => ({
...item,
memberName: item.memberName,
membersId: item.memberId,
membersRoleId: item.memberRoleId,
})),
total: res.data.totalCount,
};
......@@ -481,7 +485,7 @@ export const useBusinessEffects = (context, actions) => {
const { originAsyncData = [] } = fieldState;
const current = originAsyncData.find(item => item.id === fieldState.value);
const params = getParams(fieldState.value);
if (current) {
linkage.value('invoicesTypeCode', current.number);
}
......@@ -493,8 +497,11 @@ export const useBusinessEffects = (context, actions) => {
if (fieldState.name === 'invoicesTypeId') {
const invoicesTypeIdState = getFieldState('invoicesTypeId');
console.log('invoicesTypeIdState2', invoicesTypeIdState)
if (invoicesTypeIdState.value) {
const current = invoicesTypeIdState.originAsyncData.find(item => item.id === invoicesTypeIdState.value);
if (current) {
linkage.value('invoicesTypeCode', current.number);
}
......@@ -518,6 +525,8 @@ export const useBusinessEffects = (context, actions) => {
// 设置单据公用的数据相关
setFieldValue('memberName', first ? first.memberName : '');
setFieldValue('membersId', first ? first.membersId : '');
setFieldValue('membersRoleId', first ? first.membersRoleId : '');
setFieldValue('address', first ? `${first.fullAddress} ${first.receiverName}/${first.phone}` : '');
// 以下数据只用于收集,不用于展示
......
......@@ -224,6 +224,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
}
const {
supplyMembersName,
supplyMembersId,
supplyMembersRoleId,
deliveryAddresId,
orderNo,
deliveryAddressInfo,
......@@ -239,6 +241,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
id: +relevanceInvoicesId,
deliveryAddresId: +deliveryAddresId,
memberName: supplyMembersName,
membersId: supplyMembersId,
membersRoleId: supplyMembersRoleId,
fullAddress: deliveryAddressInfo.fullAddress || '',
receiverName: deliveryAddressInfo.receiverName || '',
phone: deliveryAddressInfo.phone || '',
......@@ -265,6 +269,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
}
const {
createMemberName,
createMemberId,
createRoleId,
deliveryAddresId,
orderNo,
deliveryAddressInfo,
......@@ -280,6 +286,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
id: +relevanceInvoicesId,
deliveryAddresId: +deliveryAddresId,
memberName: createMemberName,
membersId: createMemberId,
membersRoleId: createRoleId,
fullAddress: deliveryAddressInfo.fullAddress || '',
receiverName: deliveryAddressInfo.receiverName || '',
phone: deliveryAddressInfo.phone || '',
......@@ -716,6 +724,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
transport,
invoicesDetailsRequests = [],
memberName,
membersId,
membersRoleId,
...rest
} = value;
const newInvoicesDetailsRequests = invoicesDetailsRequests.map(({
......@@ -738,6 +748,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
}
PublicApi.postOrderPurchaseReceiptAdd({
...rest,
invoicesTypeCode: invoicesTypeCode,
orderNo: orderNo[0].orderNo,
relevanceInvoicesId: orderNo[0].id,
transactionTime: newTransactionTime,
......@@ -766,6 +777,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
};
}),
supplyMembersName: memberName,
supplyMembersId: membersId,
supplyMembersRoleId: membersRoleId,
})
.then(res => {
if (res.code !== 1000) {
......@@ -837,6 +850,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
}
PublicApi.postOrderSalesInvoiceOrder({
...rest,
invoicesTypeCode: invoicesTypeCode,
orderNo: orderNo[0].orderNo,
relevanceInvoicesId: orderNo[0].id,
transactionTime: newTransactionTime,
......@@ -864,7 +878,11 @@ const BillsForm: React.FC<BillsFormProps> = ({
productCount: goodsCount,
};
}),
createMemberName: memberName,
// 后台说 不管是 采购入库单,还是 销售发货单 都用这三个字段
// createMemberName: memberName,
supplyMembersName: memberName,
supplyMembersId: membersId,
supplyMembersRoleId: membersRoleId,
})
.then(res => {
if (res.code !== 1000) {
......
......@@ -377,6 +377,16 @@ export const addBillSchema: ISchema = {
type: 'boolean',
display: false,
},
// 会员id,可以是采购会员id、销售会员id
membersId: {
type: 'boolean',
display: false,
},
// 会员角色id,可以是采购会员角色id、销售会员角色id
membersRoleId: {
type: 'boolean',
display: false,
},
},
},
},
......
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