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
linweijiong
jinfa-platform
Commits
68eede12
Commit
68eede12
authored
Sep 30, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复券有效期可以大于券领取起始时间的问题
parent
5dfe0bdc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
1 deletion
+43
-1
useBusinessEffects.ts
...itted/components/CouponForm/effects/useBusinessEffects.ts
+43
-1
No files found.
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/CouponForm/effects/useBusinessEffects.ts
View file @
68eede12
...
...
@@ -2,10 +2,11 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-09-
22 13:45:32
* @LastEditTime: 2021-09-
30 16:09:51
* @Description:
*/
import
{
FormEffectHooks
,
FormPath
,
IFormActions
}
from
'@formily/antd'
;
import
moment
from
'moment'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
import
{
MERCHANT_COUPON_TYPE_UNIVERSAL
,
...
...
@@ -301,4 +302,44 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
actions
.
clearErrors
(
'receiveCondition.conditionGetTotal'
);
}
});
// 领(发)券起始时间
onFieldValueChange$
(
'[releaseTimeStart, releaseTimeEnd]'
).
subscribe
(
state
=>
{
const
{
value
}
=
state
;
const
releaseTimeStartValue
=
value
?.[
0
];
const
effectiveTime
=
getFieldValue
(
'[effectiveTimeStart, effectiveTimeEnd]'
);
// 券有效期
const
effectiveTimeStartValue
=
effectiveTime
?.[
0
];
if
(
releaseTimeStartValue
&&
effectiveTimeStartValue
&&
moment
(
releaseTimeStartValue
)
>
moment
(
effectiveTimeStartValue
)
)
{
setFieldState
(
'[releaseTimeStart, releaseTimeEnd]'
,
fieldState
=>
{
FormPath
.
setIn
(
fieldState
,
'errors'
,
'领(发)券起始时间应该小于券有效期起始时间'
);
});
}
else
{
actions
.
clearErrors
(
'[releaseTimeStart, releaseTimeEnd]'
);
}
});
// 券有效期始时间
onFieldValueChange$
(
'[effectiveTimeStart, effectiveTimeEnd]'
).
subscribe
(
state
=>
{
const
{
value
}
=
state
;
const
effectiveTimeStartValue
=
value
?.[
0
];
const
releaseTime
=
getFieldValue
(
'[releaseTimeStart, releaseTimeEnd]'
);
// 券有效期
const
releaseTimeStartValue
=
releaseTime
?.[
0
];
if
(
effectiveTimeStartValue
&&
releaseTimeStartValue
&&
moment
(
effectiveTimeStartValue
)
<
moment
(
releaseTimeStartValue
)
)
{
setFieldState
(
'[effectiveTimeStart, effectiveTimeEnd]'
,
fieldState
=>
{
FormPath
.
setIn
(
fieldState
,
'errors'
,
'券有效期起始时间应该大于等于领(发)券起始时间'
);
});
}
else
{
actions
.
clearErrors
(
'[effectiveTimeStart, effectiveTimeEnd]'
);
}
});
}
\ 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