From 80bcaf6057652806cddc2fa193bad9b7c27d524a Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Tue, 2 Apr 2024 18:01:23 +0800 Subject: [PATCH] =?UTF-8?q?=E2=8F=AA=20fallback:=20=E5=9B=9E=E9=80=80?= =?UTF-8?q?=E7=BA=A2=E5=8C=85=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/redPackets/index.jsx | 13 +------------ src/components/redPackets/rules.js | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/components/redPackets/index.jsx b/src/components/redPackets/index.jsx index 511c750f..72dabd5e 100644 --- a/src/components/redPackets/index.jsx +++ b/src/components/redPackets/index.jsx @@ -508,17 +508,6 @@ export default class addKnockGold extends Component { return "请输入" } - /* 动态placeholder */ - dynamicPlaceholders() { - if (this.state.model.channel == 2) { - return "请输入面额0.1 ~ 500元" - } else if (this.state.model.channel == 1) { - return "请输入面额0.01 ~ 200元" - } else if (this.state.model.channel == 3) { - return "请输入面额0.1 ~ 200元" - } - } - switchComponents() { if (this.state.model.channel == 1 && this.state.model.receive_mode === 2) { return @@ -729,7 +718,7 @@ export default class addKnockGold extends Component { this.computeAllBudget() }} value={this.state.model.denomination} - placeholder={this.dynamicPlaceholders()} + placeholder={"请输入"} disabled={this.state.isEdit} labelWidth={"0px"} maxLength={6} diff --git a/src/components/redPackets/rules.js b/src/components/redPackets/rules.js index 6af90e64..dbdc8040 100644 --- a/src/components/redPackets/rules.js +++ b/src/components/redPackets/rules.js @@ -28,7 +28,10 @@ export default { reg: /^[1-9]\d{0,4}$|^100000$/ } ], - denomination: [{ type: "required", message: "请输入面额" }, { ...regObj }], + denomination: [ + { type: "required", message: "请输入支付宝(0.01)/ 微信(0.1) ~ 200面额" }, + { ...regObj } + ], total_contract_price: [ { type: "required", message: "请输入合同总价" }, { @@ -169,13 +172,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, 500)) { + if (rulesRandom(model, 0.1)) { return false } } if ([1, 3].includes(model.channel)) { - if (rulesRandom(model, 0.01, 200)) { + if (rulesRandom(model, 0.01)) { return false } } @@ -220,13 +223,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, 500)) { + if (rulesFixed(model, 0.1)) { return false } } if ([1, 3].includes(model.channel)) { - if (rulesFixed(model, 0.01, 200)) { + if (rulesFixed(model, 0.01)) { return false } } @@ -244,10 +247,10 @@ export function additionalRules(params, computeMin, computeMax) { } /* 随机额度微信/支付宝验证方法 */ -function rulesRandom(model, num, max) { +function rulesRandom(model, num) { if ( model.min_denomination < num || - model.max_denomination > max || + model.max_denomination > 200 || !fP.test(model.max_denomination) || !fP.test(model.min_denomination) ) { @@ -255,16 +258,16 @@ function rulesRandom(model, num, max) { Notify.error("随机红包最小面额不得大于最大面额") return true } else { - Notify.error(`请输入${num} ~ ${max}的面额且保留2位小数`) + Notify.error(`请输入${num} ~ 200的面额且保留2位小数`) return true } } } /* 固定额度微信/支付宝验证方法 */ -function rulesFixed(model, num, max) { - if (model.denomination < num || model.denomination > max || !fP.test(model.denomination)) { - Notify.error(`请输入${num} ~ ${max}的面额且保留2位小数`) +function rulesFixed(model, num) { + if (model.denomination < num || model.denomination > 200 || !fP.test(model.denomination)) { + Notify.error(`请输入${num} ~ 200的面额且保留2位小数`) return true } }