Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
2108287b
Commit
2108287b
authored
Jan 21, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 初始隐藏地址选择
parent
9cfa93d3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
9 deletions
+28
-9
linkComponentProps.ts
src/components/NiceForm/linkages/linkComponentProps.ts
+7
-0
index.tsx
...ges/afterService/components/ExchangeAddressInfo/index.tsx
+11
-7
index.ts
...terService/components/ExchangeAddressInfo/schema/index.ts
+10
-2
No files found.
src/components/NiceForm/linkages/linkComponentProps.ts
View file @
2108287b
/*
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-21 14:18:19
* @Description:
*/
import
{
FormEffectHooks
,
useValueLinkageEffect
}
from
'@formily/antd'
export
const
useLinkComponentProps
=
(
scope
)
=>
{
...
...
src/pages/afterService/components/ExchangeAddressInfo/index.tsx
View file @
2108287b
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-06 09:54:04
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-21 1
3:39:26
* @LastEditTime: 2021-01-21 1
4:36:00
* @Description: 换货收货地址
*/
import
React
from
'react'
;
...
...
@@ -137,7 +137,7 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
// 联动配送方式
onFieldValueChange$
(
'deliveryType'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
const
{
value
}
=
fieldState
;
switch
(
value
)
{
// 物流
...
...
@@ -145,7 +145,6 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
if
(
isEdit
)
{
linkage
.
show
(
'shippingAddress'
);
linkage
.
hide
(
'pickupAddress'
);
linkage
.
value
(
'shippingAddress'
,
undefined
);
}
else
{
linkage
.
hide
(
'*(shippingAddress,pickupAddress)'
);
linkage
.
show
(
'shippingAddressShow'
);
...
...
@@ -157,7 +156,6 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
if
(
isEdit
)
{
linkage
.
hide
(
'shippingAddress'
);
linkage
.
show
(
'pickupAddress'
);
linkage
.
value
(
'pickupAddress'
,
undefined
);
}
else
{
setFieldState
(
'shippingAddressShow'
,
fieldState
=>
{
fieldState
.
title
=
'换货自提地址'
...
...
@@ -170,7 +168,6 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
// 无需物流
case
3
:
{
linkage
.
hide
(
'*(shippingAddress,pickupAddress)'
);
linkage
.
value
(
'*(shippingAddress,pickupAddress)'
,
undefined
);
break
;
};
default
:
...
...
@@ -178,8 +175,15 @@ const ExchangeAddressInfo: React.FC<ExchangeAddressInfo> = ({
};
});
onFieldValueChange$
(
'*(shippingAddress,pickupAddress)'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
,
originAsyncData
=
[]
}
=
fieldState
;
onFieldInputChange$
(
'deliveryType'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
if
(
value
)
{
linkage
.
value
(
'*(shippingAddress,pickupAddress)'
,
undefined
);
}
});
onFieldInputChange$
(
'*(shippingAddress,pickupAddress)'
).
subscribe
(
fieldState
=>
{
const
{
value
,
originAsyncData
=
[]
}
=
fieldState
;
const
deliveryTypeValue
=
getFieldValue
(
'deliveryType'
);
const
fullData
=
originAsyncData
.
find
(
item
=>
item
.
id
===
value
);
...
...
src/pages/afterService/components/ExchangeAddressInfo/schema/index.ts
View file @
2108287b
...
...
@@ -2,11 +2,11 @@
* @Author: XieZhiXiong
* @Date: 2020-11-09 15:56:35
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-21 1
3:40:28
* @LastEditTime: 2021-01-21 1
4:14:26
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
import
{
UPLOAD_TYPE
,
DELIVERY_TYPE_ENUM
}
from
'@/constants'
;
import
{
DELIVERY_TYPE_ENUM
}
from
'@/constants'
;
export
const
schema
:
ISchema
=
{
type
:
'object'
,
...
...
@@ -30,6 +30,12 @@ export const schema: ISchema = {
width
:
'80%'
,
},
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请选择配送方式'
,
},
],
},
deliveryAddress
:
{
type
:
'object'
,
...
...
@@ -42,6 +48,7 @@ export const schema: ISchema = {
shippingAddress
:
{
type
:
'string'
,
title
:
'换货发货地址'
,
visible
:
false
,
enum
:
[],
'x-component-props'
:
{
placeholder
:
'请选择'
,
...
...
@@ -59,6 +66,7 @@ export const schema: ISchema = {
pickupAddress
:
{
type
:
'string'
,
title
:
'换货自提地址'
,
visible
:
false
,
enum
:
[],
'x-component-props'
:
{
placeholder
:
'请选择'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment