Commit 59aa9abb authored by honghy's avatar honghy Committed by wux

【后台-会员等级】新增/修改页面中,“等级有效期”、“积分累计周期”要限制只能输入正整数

parent 2004ed5c
......@@ -27,7 +27,7 @@
</el-col>
</el-form-item>
<el-form-item :label="$t('等级有效期')" style="width: 30%;" prop="validityPeriod">
<el-input v-model.number="queryParams.validityPeriod" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"></el-input>
<el-input v-model="queryParams.validityPeriod" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"></el-input>
</el-form-item>
<el-form-item :label="$t('积分累计周期')" style="width: 30%;" prop="accumulationPeriod">
<el-input v-model.number="queryParams.accumulationPeriod" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"></el-input>
......@@ -205,15 +205,14 @@ export default {
],
validityPeriod: [
{
type: "number",
message: this.$t("请输入整数"),
validator: this.validatePositiveIntegerorNull,
trigger: "blur"
}
],
accumulationPeriod : [
{
required: true,
message: this.$t("请输入积分累计周期"),
validator: this.validatePositiveInteger,
trigger: "blur"
},
{
......@@ -289,6 +288,15 @@ export default {
}
}
},
validatePositiveIntegerorNull(rule, value, callback) {
if (value === '') {
callback();
} else if (!/^\d+$/.test(value)) {
callback(new Error(this.$t("请输入整数")));
} else {
callback();
}
},
handleMemberLevelDetails(){
memberLevelConfigDetails({ id: this.$route.query.id }).then(response => {
this.queryParams = response.data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment