Commit c0e9859a authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复待提交退货申请单无法选择退货地址的问题

parent 90a73683
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-11-06 09:54:04 * @Date: 2020-11-06 09:54:04
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-07 13:57:03 * @LastEditTime: 2021-02-04 15:32:24
* @Description: 退货地址信息 * @Description: 退货地址信息
*/ */
import React from 'react'; import React, { useEffect } from 'react';
import MellowCard from '@/components/MellowCard'; import MellowCard from '@/components/MellowCard';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd'; import { createAsyncFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'; import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { useLinkageUtils } from '@/utils/formEffectUtils'; import { useLinkageUtils } from '@/utils/formEffectUtils';
...@@ -15,7 +15,7 @@ import NiceForm from '@/components/NiceForm'; ...@@ -15,7 +15,7 @@ import NiceForm from '@/components/NiceForm';
import { schema } from './schema'; import { schema } from './schema';
import styles from './index.less'; import styles from './index.less';
const modalFormActions = createFormActions(); const modalFormActions = createAsyncFormActions();
const { const {
onFieldValueChange$, onFieldValueChange$,
onFieldInputChange$, onFieldInputChange$,
...@@ -74,6 +74,25 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({ ...@@ -74,6 +74,25 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({
onSubmit, onSubmit,
}) => { }) => {
useEffect(() => {
const { setFieldState } = modalFormActions;
if (isEdit) {
setFieldState('deliveryAddress', state => {
state.visible = true;
});
setFieldState('deliveryAddressShow', state => {
state.visible = false;
});
} else {
setFieldState('deliveryAddress', state => {
state.visible = false;
});
setFieldState('deliveryAddressShow', state => {
state.visible = true;
});
}
}, [isEdit]);
const handleSubmit = values => { const handleSubmit = values => {
}; };
...@@ -134,14 +153,6 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({ ...@@ -134,14 +153,6 @@ const ReturnAddressInfo: React.FC<ReturnAddressInfo> = ({
onFieldValueChange$('deliveryType').subscribe(fieldState => { onFieldValueChange$('deliveryType').subscribe(fieldState => {
const { name, value } = fieldState; const { name, value } = fieldState;
if (isEdit) {
linkage.show('deliveryAddress');
linkage.hide('deliveryAddressShow');
} else {
linkage.hide('deliveryAddress');
linkage.show('deliveryAddressShow');
}
switch (value) { switch (value) {
// 物流 // 物流
case 1: { case 1: {
......
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