💪 optimize: 优化代码
This commit is contained in:
parent
80635ea7c4
commit
0fe0c5f978
|
@ -159,13 +159,13 @@ export function additionalRules(params, computeMin, computeMax) {
|
|||
if (model.cash_amount_type === "2") {
|
||||
/* TODO: 2:微信 1:支付宝 */
|
||||
if (model.channel === 2) {
|
||||
if (!rulesRandom(model, 0.1)) {
|
||||
if (rulesRandom(model, 0.1)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (model.channel === 1) {
|
||||
if (!rulesRandom(model, 0.01)) {
|
||||
if (rulesRandom(model, 0.01)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -210,13 +210,13 @@ export function additionalRules(params, computeMin, computeMax) {
|
|||
if (model.cash_amount_type === "1") {
|
||||
/* TODO: 2:微信 1:支付宝 */
|
||||
if (model.channel === 2) {
|
||||
if (!rulesFixed(model, 0.1)) {
|
||||
if (rulesFixed(model, 0.1)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (model.channel === 1) {
|
||||
if (!rulesFixed(model, 0.01)) {
|
||||
if (rulesFixed(model, 0.01)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -243,13 +243,11 @@ function rulesRandom(model, num) {
|
|||
) {
|
||||
if (model.min_denomination > model.max_denomination) {
|
||||
Notify.error("随机红包最小面额不得大于最大面额")
|
||||
return false
|
||||
return true
|
||||
} else {
|
||||
Notify.error(`请输入${num} ~ 200的面额且保留2位小数`)
|
||||
return false
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,8 +255,6 @@ function rulesRandom(model, num) {
|
|||
function rulesFixed(model, num) {
|
||||
if (model.denomination < num || model.denomination > 200 || !fP.test(model.denomination)) {
|
||||
Notify.error(`请输入${num} ~ 200的面额且保留2位小数`)
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue