Commit 3bd9eb64 authored by XieZhiXiong's avatar XieZhiXiong

对接待提交审核修改收货。发货地址相关

parent 337db0fd
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-06 09:54:04 * @Date: 2020-11-06 09:54:04
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-25 15:25:52 * @LastEditTime: 2020-12-04 18:04:07
* @Description: 换货收货地址 * @Description: 换货收货地址
*/ */
import React from 'react'; import React from 'react';
...@@ -174,8 +174,8 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({ ...@@ -174,8 +174,8 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
}; };
}); });
onFieldInputChange$('*(shippingAddress,pickupAddress)').subscribe(fieldState => { onFieldValueChange$('*(shippingAddress,pickupAddress)').subscribe(fieldState => {
const { name, value, originAsyncData } = fieldState; const { name, value, originAsyncData = [] } = fieldState;
const deliveryTypeValue = getFieldValue('deliveryType'); const deliveryTypeValue = getFieldValue('deliveryType');
const fullData = originAsyncData.find(item => item.id === value); const fullData = originAsyncData.find(item => item.id === value);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-06 09:54:04 * @Date: 2020-11-06 09:54:04
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-25 15:05:45 * @LastEditTime: 2020-12-04 18:00:18
* @Description: 退货地址信息 * @Description: 退货地址信息
*/ */
import React from 'react'; import React from 'react';
...@@ -129,16 +129,6 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({ ...@@ -129,16 +129,6 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({
const linkage = useLinkageUtils(); const linkage = useLinkageUtils();
onFormInit$().subscribe(() => {
if (isEdit) {
linkage.show('deliveryAddress');
linkage.hide('deliveryAddresShow');
} else {
linkage.hide('deliveryAddress');
linkage.show('deliveryAddresShow');
}
});
// 联动配送方式 // 联动配送方式
onFieldValueChange$('deliveryType').subscribe(fieldState => { onFieldValueChange$('deliveryType').subscribe(fieldState => {
const { name, value } = fieldState; const { name, value } = fieldState;
...@@ -146,14 +136,27 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({ ...@@ -146,14 +136,27 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({
switch (value) { switch (value) {
// 物流 // 物流
case 1: { case 1: {
if (isEdit) {
linkage.show('shippingAddress'); linkage.show('shippingAddress');
linkage.hide('pickupAddress'); linkage.hide('pickupAddress');
} else {
linkage.hide('*(shippingAddress,pickupAddress)');
linkage.show('deliveryAddressShow');
}
break; break;
}; };
// 自提 // 自提
case 2: { case 2: {
if (isEdit) {
linkage.hide('shippingAddress'); linkage.hide('shippingAddress');
linkage.show('pickupAddress'); linkage.show('pickupAddress');
} else {
setFieldState('deliveryAddressShow', fieldState => {
fieldState.title = '退货自提地址'
});
linkage.hide('*(shippingAddress,pickupAddress)');
linkage.show('deliveryAddressShow');
}
break; break;
}; };
// 无需物流 // 无需物流
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-09 15:56:35 * @Date: 2020-11-09 15:56:35
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-20 15:41:12 * @LastEditTime: 2020-12-04 18:02:43
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -67,6 +67,7 @@ export const schema: ISchema = { ...@@ -67,6 +67,7 @@ export const schema: ISchema = {
deliveryAddressShow: { deliveryAddressShow: {
type: 'object', type: 'object',
title: '退货收货地址', title: '退货收货地址',
visible: false,
'x-component': 'Children', 'x-component': 'Children',
'x-component-props': { 'x-component-props': {
children: '{{DeliveryAddress}}', children: '{{DeliveryAddress}}',
......
...@@ -52,7 +52,7 @@ interface DetailInfoProps { ...@@ -52,7 +52,7 @@ interface DetailInfoProps {
// 历史记录目标路径 // 历史记录目标路径
target?: string; target?: string;
// 头部右侧拓展 // 头部右侧拓展
headExtra?: (info: DetailInfo) => React.ReactNode; headExtra?: (info: DetailInfo, returnAddress: ReturnAddressValues, exchangeAddress: ExchangeAddressValues) => React.ReactNode;
}; };
interface DetailInfo extends GetAsReplaceGoodsGetDetailBySupplierResponse { interface DetailInfo extends GetAsReplaceGoodsGetDetailBySupplierResponse {
...@@ -227,7 +227,6 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -227,7 +227,6 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
}; };
const handleReturnAddressSubmit = values => { const handleReturnAddressSubmit = values => {
console.log('values', values)
setReturnAddress(values); setReturnAddress(values);
}; };
...@@ -321,7 +320,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -321,7 +320,7 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
} }
extra={( extra={(
<> <>
{headExtra && headExtra(detailInfo)} {headExtra && headExtra(detailInfo, returnAddress, exchangeAddress)}
</> </>
)} )}
> >
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-04 17:22:07 * @Date: 2020-11-04 17:22:07
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-20 10:47:03 * @LastEditTime: 2020-12-04 18:39:57
* @Description: * @Description:
*/ */
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Button } from 'antd'; import { Button, message } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { FormOutlined } from '@ant-design/icons'; import { FormOutlined } from '@ant-design/icons';
...@@ -14,10 +14,95 @@ import { usePageStatus } from '@/hooks/usePageStatus'; ...@@ -14,10 +14,95 @@ import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo'; import DetailInfo from '../components/DetailInfo';
import VerifyModal from '../../components/VerifyModal'; import VerifyModal from '../../components/VerifyModal';
interface ReturnAddress {
/**
* 收货地址id
*/
receiveId: number;
/**
* 收货地址
*/
receiveAddress: string;
/**
* 收货者名称
*/
receiveUserName: string;
/**
* 收货者电话
*/
receiveUserTel: string;
};
interface ExchangeAddress {
/**
* 配送方式
*/
deliveryType: number;
/**
* 发货地址id
*/
sendId: number;
/**
* 发货地址
*/
sendAddress: string;
/**
* 发货者名称
*/
sendUserName: string;
/**
* 发货者电话
*/
sendUserTel: string;
};
const ExchangePrSubmitVerify: React.FC = () => { const ExchangePrSubmitVerify: React.FC = () => {
const { id } = usePageStatus(); const { id } = usePageStatus();
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false); const [confirmLoading, setConfirmLoading] = useState(false);
const [exchangeAddress, setExchangeAddress] = useState<ExchangeAddress>(null);
const [returnAddress, setReturnAddress] = useState<ReturnAddress>(null);
const handleSubmitVerify = (info, returnAddress, exchangeAddress) => {
// 退货方式为 物流,并且退货收货地址为空时
if (
info.returnGoodsAddress.deliveryType === 1 &&
!returnAddress
) {
message.error('请选择退货收货地址');
return;
}
if (
exchangeAddress &&
exchangeAddress.deliveryType === 1 &&
!exchangeAddress.id
) {
message.error('请选择换货发货地址');
return;
}
if (
exchangeAddress &&
exchangeAddress.deliveryType === 2 &&
!exchangeAddress.id
) {
message.error('请选择换货自提地址');
return;
}
setReturnAddress({
receiveId: returnAddress.id,
receiveAddress: returnAddress.receiveAddress,
receiveUserName: returnAddress.receiveUserName,
receiveUserTel: returnAddress.receiveUserTel,
});
setExchangeAddress({
deliveryType: exchangeAddress.deliveryType,
sendId: exchangeAddress.id,
sendAddress: exchangeAddress.sendAddress,
sendUserName: exchangeAddress.sendUserName,
sendUserTel: exchangeAddress.sendUserTel,
});
setVisible(true);
};
const handleSubmit = values => { const handleSubmit = values => {
if (!id) { if (!id) {
...@@ -27,6 +112,8 @@ const ExchangePrSubmitVerify: React.FC = () => { ...@@ -27,6 +112,8 @@ const ExchangePrSubmitVerify: React.FC = () => {
PublicApi.postAsReplaceGoodsSubmitVerify({ PublicApi.postAsReplaceGoodsSubmitVerify({
applyId: id, applyId: id,
...values, ...values,
...exchangeAddress,
...returnAddress,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
history.goBack(); history.goBack();
...@@ -41,11 +128,11 @@ const ExchangePrSubmitVerify: React.FC = () => { ...@@ -41,11 +128,11 @@ const ExchangePrSubmitVerify: React.FC = () => {
<DetailInfo <DetailInfo
id={id} id={id}
target="/memberCenter/payandSettle/creditApplication/quotaFormQuery/detail" target="/memberCenter/payandSettle/creditApplication/quotaFormQuery/detail"
headExtra={() => ( headExtra={(info, returnAddress, exchangeAddress) => (
<Button <Button
type="primary" type="primary"
icon={<FormOutlined />} icon={<FormOutlined />}
onClick={() => setVisible(true)} onClick={() => handleSubmitVerify(info, returnAddress, exchangeAddress)}
> >
提交审核 提交审核
</Button> </Button>
......
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