Commit 9bcd1c06 by 陈羽

update: 指定时段更改为起始时间小于结束时间

parent d9a3e1cd
......@@ -43,9 +43,6 @@ export default {
}
return false;
}
},
mounted() {
console.log(this.item);
}
};
</script>
......
<template>
<el-dialog title="赠送积分" :visible.sync="show" width="420px" @closed="close" :close-on-click-modal="false">
<el-dialog title="赠送积分" :visible.sync="show" width="420px" @closed="close" :close-on-click-modal="false" custom-class="sign-lib-integral-wrap">
<el-form :model="form" :rules="rules" ref="form" label-width="0">
<template v-if="form.integralType === 1">
<p class="regular-font-color mb20">请输入需要赠送的积分<span class="fz12 gray ml10">* 仅支持给认证会员赠送积分</span></p>
......@@ -57,8 +57,8 @@ export default {
multipleNum: undefined // 倍数值
},
rules: {
integralCount: [{ required: true, message: '请输入积分值', trigger: 'blur' }, { validator: validInteral, trigger: 'blur' }], // eslint-disable-line
multipleNum: [{ required: true, message: '请输入倍数', trigger: 'blur' }] // eslint-disable-line
integralCount: [ { required: true, message: '请输入积分值', trigger: 'blur' }, { validator: validInteral, trigger: 'blur' } ], // eslint-disable-line
multipleNum: [ { required: true, message: '请输入倍数', trigger: 'blur' } ] // eslint-disable-line
},
loading: false
};
......@@ -102,3 +102,8 @@ export default {
}
};
</script>
<style>
.sign-lib-integral-wrap .el-dialog__footer {
border: none;
}
</style>
......@@ -21,8 +21,10 @@
</el-radio-group>
<!-- 签到时段选择指定时段 -->
<el-form-item prop="time" class="date_picker_item" v-if="form.timeType === 2">
<el-time-picker v-model="form.timeStart" class="store-sign-timepicker" align="center" placeholder="开始时间" style="width:135px;" value-format="HH:mm:ss"> </el-time-picker><span style="margin: 0 5px;"></span>
<el-time-picker v-model="form.timeEnd" align="center" placeholder="结束时间" style="width:135px;" value-format="HH:mm:ss"> </el-time-picker>
<el-time-picker v-model="form.timeStart" :picker-options="{ selectableRange: `00:00:00 - ${maxTime}` }" class="store-sign-timepicker" placeholder="开始时间" style="width:135px;" value-format="HH:mm:ss" format="HH:mm"></el-time-picker><span style="margin: 0 5px;"></span>
<el-time-picker v-model="form.timeEnd" :picker-options="{ selectableRange: `${minTime} - 23:59:59` }" class="store-sign-timepicker" placeholder="结束时间" style="width:135px;" value-format="HH:mm:ss" format="HH:mm"></el-time-picker>
<!-- <el-time-picker v-model="form.timeStart" :picker-options="{ selectableRange: `00:00:00 - ${maxTime}` }" class="store-sign-timepicker" align="center" placeholder="开始时间" style="width:135px;" value-format="HH:mm:ss">
<el-time-picker v-model="form.timeEnd" :picker-options="{ selectableRange: `${minTime} - 23:59:59` }" align="center" placeholder="结束时间" style="width:135px;" value-format="HH:mm:ss"> </el-time-picker> -->
</el-form-item>
</el-form-item>
<el-form-item label="签到间隔" prop="signInterval">
......@@ -242,22 +244,31 @@ export default {
}
this.showStoreCard = true;
},
async onSubmit() {
onSubmit() {
this.$refs[ 'form' ].validate(valid => {
if (valid) {
const params = { ...this.form };
console.log(params);
if (this.uuid) {
params.storeFilterId = this.uuid;
}
if (params.dateType) {
if (params.dateType===2) {
params.dateStart = this.date[ 0 ];
params.dateEnd = this.date[ 1 ];
delete params.date
}
if (params.timeType===2) {
params.timeStart =params.timeStart.substring(0,params.timeStart.lastIndexOf(':'))+':00';
params.timeEnd = params.timeEnd.substring(0,params.timeEnd.lastIndexOf(':'))+':59';
delete params.time
}
if (params.prizeType === 1) {
delete params.prizeId;
} else {
delete params.prizeValue;
}
console.log(params);
return
saveStoreSignSetting(params).then(res => {
if (res.errorCode === 0) {
this.$message.success('保存成功');
......@@ -373,6 +384,39 @@ export default {
dateTypeChange(v) {
this.$refs[ 'form' ].clearValidate('date')
this.date = v === 1 ? null : []
}
},
watch: {},
computed: {
minTime() {
if (!!this.form.timeStart) {
const strTime = this.form.timeStart.split(':');
const second = (+strTime[ 0 ]) * 60 * 60 + (+strTime[ 1 ]) * 60;
const hh = (second / 3600) >> 0;//把秒除得时间
const mm = (second % 3600) / 60 >> 0;//把余数用于除得分钟
const ss = (second % 3600) % 60 >> 0;//最后的余数直接就是秒钟
const tss = ss < 10 ? "0" + ss : ss + "";
const tmm = mm < 10 ? "0" + mm : mm + "";
const thh = hh < 10 ? "0" + hh : hh + "";
return thh + ":" + tmm + ":" + tss;
} else {
return '00:00:00'
}
},
maxTime() {
if (!!this.form.timeEnd) {
const strTime = this.form.timeEnd.split(':');
const second = (+strTime[ 0 ]) * 60 * 60 + (+strTime[ 1 ]) * 60;
const hh = (second / 3600) >> 0;//把秒除得时间
const mm = (second % 3600) / 60 >> 0;//把余数用于除得分钟
const ss = (second % 3600) % 60 >> 0;//最后的余数直接就是秒钟
const tss = ss < 10 ? "0" + ss : ss + "";
const tmm = mm < 10 ? "0" + mm : mm + "";
const thh = hh < 10 ? "0" + hh : hh + "";
return thh + ":" + tmm + ":" + tss;
} else {
return '23:59:59'
}
},
}
};
......
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