Commit 4d292b98 by 吕明尚

套餐开始时段和结束时段限制

parent 480fa6aa
...@@ -153,10 +153,11 @@ ...@@ -153,10 +153,11 @@
<el-input v-model="form.price" placeholder="请输入金额" /> <el-input v-model="form.price" placeholder="请输入金额" />
</el-form-item> </el-form-item>
<el-form-item label="套餐开始时段" prop="packaStartPeriod"> <el-form-item label="套餐开始时段" prop="packaStartPeriod">
<el-input v-model="form.packaStartPeriod" placeholder="请输入套餐开始时段" /> <!--指定0到23范围的数字-->
<el-input-number v-model="form.packaStartPeriod" :min="0" :max="23" label="套餐开始时段"/>
</el-form-item> </el-form-item>
<el-form-item label="套餐结束时段" prop="packaEndPeriod"> <el-form-item label="套餐结束时段" prop="packaEndPeriod">
<el-input v-model="form.packaEndPeriod" placeholder="请输入套餐结束时段" /> <el-input-number v-model="form.packaEndPeriod" :min="0" :max="23" label="套餐开始时段"/>
</el-form-item> </el-form-item>
<el-form-item label="是否首次下单可用" prop="firstOrderAvailable"> <el-form-item label="是否首次下单可用" prop="firstOrderAvailable">
<el-radio-group v-model="form.firstOrderAvailable"> <el-radio-group v-model="form.firstOrderAvailable">
...@@ -223,6 +224,19 @@ export default { ...@@ -223,6 +224,19 @@ export default {
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
packaEndPeriod: [
{required: true, message: "请输入套餐结束时段", trigger: "blur"},
{
validator: (rule, value, callback) => {
if (value <= this.form.packaStartPeriod) {
callback(new Error("套餐结束时段必须大于套餐开始时段"));
} else {
callback();
}
},
trigger: "blur"
}
],
} }
}; };
}, },
......
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