提现设置增加校验

This commit is contained in:
chc 2025-01-20 18:12:41 +08:00
parent 79e7e5f087
commit 1a56534d28

View File

@ -1,7 +1,7 @@
<template>
<div class="layout">
<Form ref="formValidate" :label-width="150" label-position="right" :model="formValidate">
<Form ref="formValidate" :label-width="150" label-position="right" :model="formValidate" :rules="ruleValidate">
<FormItem label="提现审核是否开启">
<i-switch v-model="formValidate.apply" style="margin-top:7px;"><span slot="open"></span>
<span slot="close"></span>
@ -36,12 +36,8 @@ export default {
data() {
return {
result:"",
formValidate: { //
apply: true,
minPrice: "",
type: "",
wechatAppId: "",
},
ruleValidate: {}, //
formValidate: {},//
switchTitle: "提现审核是否开启", // title
};
@ -72,7 +68,29 @@ export default {
//
init() {
this.result = JSON.parse(this.res);
Object.keys(this.result).map((item) => {
this.result[item] += "";
});
this.$set(this, "formValidate", { ...this.result });
Object.keys(this.formValidate).forEach((item) => {
this.ruleValidate[item] = [
{
required: true,
message: "请填写必填项",
trigger: "blur",
},
{
validator: (rule, value, callback) => {
if (value < 0) {
callback(new Error("不能输入负数!"));
} else {
callback();
}
},
trigger: "change",
},
];
});
},
},
};