fallback: 回退代码

This commit is contained in:
wangsongsole 2024-04-02 17:58:49 +08:00
parent 57edf48a90
commit b35807b416
2 changed files with 15 additions and 23 deletions

View File

@ -508,17 +508,6 @@ export default class addKnockGold extends Component {
return "请输入" 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() { switchComponents() {
if (this.state.model.channel == 1 && this.state.model.receive_mode === 2) { if (this.state.model.channel == 1 && this.state.model.receive_mode === 2) {
return <ZFBMobileComponent data={this.state.model} /> return <ZFBMobileComponent data={this.state.model} />
@ -729,7 +718,7 @@ export default class addKnockGold extends Component {
this.computeAllBudget() this.computeAllBudget()
}} }}
value={this.state.model.denomination} value={this.state.model.denomination}
placeholder={this.dynamicPlaceholders()} placeholder={"请输入"}
disabled={this.state.isEdit} disabled={this.state.isEdit}
labelWidth={"0px"} labelWidth={"0px"}
maxLength={6} maxLength={6}

View File

@ -28,7 +28,10 @@ export default {
reg: /^[1-9]\d{0,4}$|^100000$/ 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: [ total_contract_price: [
{ type: "required", message: "请输入合同总价" }, { type: "required", message: "请输入合同总价" },
{ {
@ -169,13 +172,13 @@ export function additionalRules(params, computeMin, computeMax) {
if (model.cash_amount_type === "2") { if (model.cash_amount_type === "2") {
/* TODO: 2:微信 1:支付宝 */ /* TODO: 2:微信 1:支付宝 */
if (model.channel === 2) { if (model.channel === 2) {
if (rulesRandom(model, 0.1, 500)) { if (rulesRandom(model, 0.1)) {
return false return false
} }
} }
if ([1, 3].includes(model.channel)) { if ([1, 3].includes(model.channel)) {
if (rulesRandom(model, 0.01, 200)) { if (rulesRandom(model, 0.01)) {
return false return false
} }
} }
@ -220,13 +223,13 @@ export function additionalRules(params, computeMin, computeMax) {
if (model.cash_amount_type === "1") { if (model.cash_amount_type === "1") {
/* TODO: 2:微信 1:支付宝 */ /* TODO: 2:微信 1:支付宝 */
if (model.channel === 2) { if (model.channel === 2) {
if (rulesFixed(model, 0.1, 500)) { if (rulesFixed(model, 0.1)) {
return false return false
} }
} }
if ([1, 3].includes(model.channel)) { if ([1, 3].includes(model.channel)) {
if (rulesFixed(model, 0.01, 200)) { if (rulesFixed(model, 0.01)) {
return false return false
} }
} }
@ -244,10 +247,10 @@ export function additionalRules(params, computeMin, computeMax) {
} }
/* 随机额度微信/支付宝验证方法 */ /* 随机额度微信/支付宝验证方法 */
function rulesRandom(model, num, max) { function rulesRandom(model, num) {
if ( if (
model.min_denomination < num || model.min_denomination < num ||
model.max_denomination > max || model.max_denomination > 200 ||
!fP.test(model.max_denomination) || !fP.test(model.max_denomination) ||
!fP.test(model.min_denomination) !fP.test(model.min_denomination)
) { ) {
@ -255,16 +258,16 @@ function rulesRandom(model, num, max) {
Notify.error("随机红包最小面额不得大于最大面额") Notify.error("随机红包最小面额不得大于最大面额")
return true return true
} else { } else {
Notify.error(`请输入${num} ~ ${max}的面额且保留2位小数`) Notify.error(`请输入${num} ~ 200的面额且保留2位小数`)
return true return true
} }
} }
} }
/* 固定额度微信/支付宝验证方法 */ /* 固定额度微信/支付宝验证方法 */
function rulesFixed(model, num, max) { function rulesFixed(model, num) {
if (model.denomination < num || model.denomination > max || !fP.test(model.denomination)) { if (model.denomination < num || model.denomination > 200 || !fP.test(model.denomination)) {
Notify.error(`请输入${num} ~ ${max}的面额且保留2位小数`) Notify.error(`请输入${num} ~ 200的面额且保留2位小数`)
return true return true
} }
} }