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
shenshaokai
jinfa-platform
Commits
b378995c
Commit
b378995c
authored
Jul 28, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 对接适用用户接口
parent
d52e5b78
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
33 deletions
+45
-33
index.tsx
...CouponUnsubmitted/components/CouponForm/effects/index.tsx
+35
-4
useBusinessEffects.ts
...itted/components/CouponForm/effects/useBusinessEffects.ts
+8
-6
schema.tsx
...erchantCouponUnsubmitted/components/CouponForm/schema.tsx
+2
-23
No files found.
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/CouponForm/effects/index.tsx
View file @
b378995c
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:03:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-
08 16:35:58
* @LastEditTime: 2021-07-
28 14:58:01
* @Description:
*/
import
{
FormPath
,
FormEffectHooks
}
from
'@formily/antd'
;
...
...
@@ -25,7 +25,10 @@ const fetchCouponTypes = async () => {
type
:
data
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
value
})),
};
}
return
{};
return
{
data
:
[],
totalCount
:
0
,
};
};
// 初始化 领券方式
...
...
@@ -38,7 +41,10 @@ const fetchCouponGetWay = async () => {
getWay
:
data
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
value
})),
};
}
return
{};
return
{
data
:
[],
totalCount
:
0
,
};
};
// 初始化 适用用户角色
...
...
@@ -60,7 +66,26 @@ const fetchApplicationUserRole = async () => {
applicationUserRole
:
options
,
};
}
return
{};
return
{
data
:
[],
totalCount
:
0
,
};
};
// 初始化 适用用户
const
fetchSuitableUser
=
async
()
=>
{
const
res
=
await
PublicApi
.
getMarketingCouponSuitableMemberTypeList
();
if
(
res
.
code
===
1000
)
{
const
{
data
=
[]
}
=
res
;
return
{
suitableMemberTypes
:
data
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
value
})),
};
}
return
{
data
:
[],
totalCount
:
0
,
};
};
// 获取 实用会员选项
...
...
@@ -80,6 +105,10 @@ const fetchMemberOtions: (params: { current: string, pageSize: string, levelConf
totalCount
:
res
.
data
.
totalCount
,
};
}
return
{
data
:
[],
totalCount
:
0
,
};
};
export
const
createEffects
=
(
context
,
actions
)
=>
{
...
...
@@ -93,6 +122,8 @@ export const createEffects = (context, actions) => {
useAsyncInitSelect
([
'applicationUserRole'
],
fetchApplicationUserRole
);
useAsyncInitSelect
([
'suitableMemberTypes'
],
fetchSuitableUser
);
// 初始化 品牌数据
onFieldMount$
(
'applicableBrands'
).
subscribe
(()
=>
{
PublicApi
.
getProductSelectGetSelectBrand
().
then
((
res
)
=>
{
...
...
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/CouponForm/effects/useBusinessEffects.ts
View file @
b378995c
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-2
3 17:36:48
* @LastEditTime: 2021-07-2
8 14:33:19
* @Description:
*/
import
{
FormEffectHooks
,
FormPath
,
IFormActions
}
from
'@formily/antd'
;
...
...
@@ -16,6 +16,10 @@ import {
MERCHANT_COUPON_RECEIVE_DESIGNATED
,
MERCHANT_COUPON_RECEIVE_ACTIVITY
,
MERCHANT_COUPON_RECEIVE_OPERATE
,
SUITABLE_TYPE_NEW_USER
,
SUITABLE_TYPE_OLD_USER
,
SUITABLE_TYPE_NEW_MEMBER
,
SUITABLE_TYPE_OLD_MEMBER
,
}
from
'@/constants/marketing'
;
const
{
...
...
@@ -31,8 +35,6 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
// 优惠券类型
onFieldInputChange$
(
'type'
).
subscribe
(
state
=>
{
const
{
value
}
=
state
;
const
denominationValue
=
getFieldValue
(
'denomination'
);
// 券面额
const
useConditionMoneyValue
=
getFieldValue
(
'useConditionMoney'
);
// 使用条件
// 0元抵扣券
if
(
value
===
MERCHANT_COUPON_TYPE_VOUCHER
)
{
...
...
@@ -192,8 +194,8 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
value
===
MERCHANT_COUPON_RECEIVE_DESIGNATED
||
value
===
MERCHANT_COUPON_RECEIVE_OPERATE
)
&&
(
newItem
.
value
===
1
||
newItem
.
value
===
2
newItem
.
value
===
SUITABLE_TYPE_NEW_USER
||
newItem
.
value
===
SUITABLE_TYPE_OLD_USER
)
)
{
newItem
.
disabled
=
true
;
...
...
@@ -233,7 +235,7 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
const
{
value
}
=
state
;
// 包含新会员(仅会员用户) 或者 老会员(仅会员用户),展示 适用用户角色 与 会员等级列表
if
(
value
&&
(
value
.
includes
(
3
)
||
value
.
includes
(
4
)))
{
if
(
value
&&
(
value
.
includes
(
SUITABLE_TYPE_NEW_MEMBER
)
||
value
.
includes
(
SUITABLE_TYPE_OLD_MEMBER
)))
{
linkage
.
show
(
'*(applicationUserRole,applicationMemberLevel)'
);
}
else
{
linkage
.
hide
(
'*(applicationUserRole,applicationMemberLevel)'
);
...
...
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/CouponForm/schema.tsx
View file @
b378995c
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:05:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-
19 17:20:56
* @LastEditTime: 2021-07-
28 14:38:37
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
...
...
@@ -441,28 +441,7 @@ const schema: ISchema = {
suitableMemberTypes
:
{
title
:
'适用用户'
,
type
:
'string'
,
enum
:
[
{
label
:
'新用户(不包含会员)'
,
value
:
1
,
disabled
:
false
,
},
{
label
:
'老用户(不包含会员)'
,
value
:
2
,
disabled
:
false
,
},
{
label
:
'新会员(仅会员用户)'
,
value
:
3
,
disabled
:
false
,
},
{
label
:
'老会员(仅会员用户)'
,
value
:
4
,
disabled
:
false
,
},
],
enum
:
[],
default
:
[],
required
:
true
,
'x-component'
:
'TofuCheckGroup'
,
...
...
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