Commit 96c9a728 by zhangzhen

套餐设置时间配置优化

parent 4ddb211d
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item label="时长" prop="duration"> <el-form-item label="时长" prop="duration">
<!--指定0到23范围的数字--> <!--指定0到23范围的数字-->
<el-input-number v-model="form.duration" :max="24" :min="0.5" :step="0.5" label="时长"/> <el-input-number v-model="form.duration" :max="23-form.packaStartPeriod" :min="1" :step="1" label="时长" @input="onDurationChange" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="金额" prop="price">--> <!-- <el-form-item label="金额" prop="price">-->
<!-- <el-input v-model="form.price" placeholder="请输入金额" />--> <!-- <el-input v-model="form.price" placeholder="请输入金额" />-->
...@@ -218,10 +218,10 @@ ...@@ -218,10 +218,10 @@
</el-form-item> </el-form-item>
<el-form-item label="套餐开始时段" prop="packaStartPeriod"> <el-form-item label="套餐开始时段" prop="packaStartPeriod">
<!--指定0到23范围的数字--> <!--指定0到23范围的数字-->
<el-input-number v-model="form.packaStartPeriod" :min="0" :max="23" label="套餐开始时段"/> <el-input-number v-model="form.packaStartPeriod" :min="0" :max="23-form.duration" label="套餐开始时段" @input="onStartTimeChange" />
</el-form-item> </el-form-item>
<el-form-item label="套餐结束时段" prop="packaEndPeriod"> <el-form-item label="套餐结束时段" prop="packaEndPeriod">
<el-input-number v-model="form.packaEndPeriod" :min="0" :max="23" label="套餐开始时段"/> <el-input-number disabled v-model="form.packaEndPeriod" :min="0" :max="23" label="套餐开始时段"/>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<!--指定0到23范围的数字--> <!--指定0到23范围的数字-->
...@@ -312,9 +312,9 @@ export default { ...@@ -312,9 +312,9 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: null, name: null,
duration: null, duration: '',
price: null, price: null,
packaStartPeriod: null, packaStartPeriod: '',
packaEndPeriod: null, packaEndPeriod: null,
firstOrderAvailable: null, firstOrderAvailable: null,
type: null, type: null,
...@@ -325,18 +325,8 @@ export default { ...@@ -325,18 +325,8 @@ export default {
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
packaEndPeriod: [ packaStartPeriod: [
{required: true, message: "请输入套餐结束时段", trigger: "blur"}, {required: true, message: "请输入套餐结束时段", trigger: "blur"}
{
validator: (rule, value, callback) => {
if (value <= this.form.packaStartPeriod) {
callback(new Error("套餐结束时段必须大于套餐开始时段"));
} else {
callback();
}
},
trigger: "blur"
}
], ],
} }
}; };
...@@ -345,6 +335,12 @@ export default { ...@@ -345,6 +335,12 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
onDurationChange(val){
this.form.packaEndPeriod = Number(this.form.packaStartPeriod)+val
},
onStartTimeChange(val){
this.form.packaEndPeriod = Number(this.form.duration)+val
},
/** 查询套餐列表 */ /** 查询套餐列表 */
getList() { getList() {
this.loading = true; this.loading = true;
...@@ -369,10 +365,10 @@ export default { ...@@ -369,10 +365,10 @@ export default {
this.form = { this.form = {
id: null, id: null,
name: null, name: null,
duration: null, duration: 1,
price: null, price: null,
packaStartPeriod: null, packaStartPeriod: 0,
packaEndPeriod: null, packaEndPeriod: 1,
createBy: null, createBy: null,
createTime: null, createTime: null,
updateBy: null, updateBy: null,
......
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