Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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
project
jinfa-admin
Commits
ba4ab1d6
Commit
ba4ab1d6
authored
Sep 30, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复发券数量可以小于每个Id总可以领取数量的问题
parent
8f44a79f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
7 deletions
+36
-7
useBusinessEffects.ts
...itted/components/CouponForm/effects/useBusinessEffects.ts
+36
-7
No files found.
src/pages/marketingManage/platformCoupon/platformCouponUnsubmitted/components/CouponForm/effects/useBusinessEffects.ts
View file @
ba4ab1d6
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-09-30 16:
19:52
* @LastEditTime: 2021-09-30 16:
39:11
* @Description:
*/
import
{
FormEffectHooks
,
FormPath
,
IFormActions
}
from
'@formily/antd'
;
...
...
@@ -231,12 +231,26 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
onFieldInputChange$
(
'receiveCondition.conditionGetTotal'
).
subscribe
(
state
=>
{
const
{
value
}
=
state
;
const
conditionGetDayValue
=
getFieldValue
(
'receiveCondition.conditionGetDay'
);
// 每会员ID总共可领取;
if
(
+
value
<
+
conditionGetDayValue
)
{
setFieldState
(
'receiveCondition.conditionGetTotal'
,
fieldState
=>
{
FormPath
.
setIn
(
fieldState
,
'errors'
,
'每会员ID总共可领取必须大于每日可领取'
);
});
}
else
{
actions
.
clearErrors
(
'receiveCondition.conditionGetTotal'
);
const
quantityValue
=
getFieldValue
(
'quantity'
);
// 每会员ID总共可领取
if
(
value
&&
quantityValue
)
{
if
(
+
value
>
+
quantityValue
)
{
setFieldState
(
'receiveCondition.conditionGetTotal'
,
fieldState
=>
{
FormPath
.
setIn
(
fieldState
,
'errors'
,
'每会员ID总共可领取数量应该小于等于发券数量'
);
});
}
else
{
actions
.
clearErrors
(
'receiveCondition.conditionGetTotal'
);
}
}
if
(
value
&&
conditionGetDayValue
)
{
if
(
+
value
<
+
conditionGetDayValue
)
{
setFieldState
(
'receiveCondition.conditionGetTotal'
,
fieldState
=>
{
FormPath
.
setIn
(
fieldState
,
'errors'
,
'每会员ID总共可领取必须大于每日可领取'
);
});
}
else
{
actions
.
clearErrors
(
'receiveCondition.conditionGetTotal'
);
}
}
});
...
...
@@ -279,4 +293,18 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
actions
.
clearErrors
(
'[effectiveTimeStart, effectiveTimeEnd]'
);
}
});
// 发券数量
onFieldValueChange$
(
'quantity'
).
subscribe
(
state
=>
{
const
{
value
}
=
state
;
const
conditionGetTotalValue
=
getFieldValue
(
'receiveCondition.conditionGetTotal'
);
// 每会员ID总共可领取
if
(
value
&&
conditionGetTotalValue
&&
+
value
<=
+
conditionGetTotalValue
)
{
setFieldState
(
'quantity'
,
fieldState
=>
{
FormPath
.
setIn
(
fieldState
,
'errors'
,
'发券数量应该大于等于每会员ID总共可领取数量'
);
});
}
else
{
actions
.
clearErrors
(
'quantity'
);
}
});
}
\ No newline at end of file
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