|
|
<template>
|
|
|
<div>
|
|
|
<div class="row">
|
|
|
<div class="col-md-12 col-sm-12 col-xs-12">
|
|
|
<div class="x_panel">
|
|
|
<div class="x_title">
|
|
|
<h2>签到活动创建</h2>
|
|
|
<div class="clearfix"></div>
|
|
|
</div>
|
|
|
<div class="x_content">
|
|
|
<Form>
|
|
|
<FormItem label="活动名称">
|
|
|
<Input v-model="title" placeholder="活动名称" style="width: 400px"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="活动时间">
|
|
|
<DatePicker type="daterange" placeholder="开始时间-结束时间"
|
|
|
style="width: 400px" @on-change="dateTimeChange"></DatePicker>
|
|
|
</FormItem>
|
|
|
<FormItem label="每日领取大转盘ID">
|
|
|
<Input v-model="normalWheelId" placeholder="平时每日领取对应的大转盘id" style="width: 400px;"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="第一次累计天数">
|
|
|
<Input v-model="days1.count" placeholder="第一次累计天数" style="width: 100px;" type="number"></Input>
|
|
|
转盘ID
|
|
|
<Input v-model="days1.wheelId" placeholder="对应的大转盘id" style="width: 200px;"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="第二次累计天数">
|
|
|
<Input v-model="days2.count" placeholder="第二次累计天数" style="width: 100px;" type="number"></Input>
|
|
|
转盘ID
|
|
|
<Input v-model="days2.wheelId" placeholder="对应的大转盘id" style="width: 200px;"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem label="第三次累计天数">
|
|
|
<Input v-model="days3.count" placeholder="第二次累计天数" style="width: 100px;" type="number"></Input>
|
|
|
转盘ID
|
|
|
<Input v-model="days3.wheelId" placeholder="对应的大转盘id" style="width: 200px;"></Input>
|
|
|
</FormItem>
|
|
|
<FormItem>
|
|
|
<Button type="primary" @click="save">保存</Button>
|
|
|
<Button style="margin-left: 8px" @click="cancel">取消</Button>
|
|
|
</FormItem>
|
|
|
</Form>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import moment from 'moment';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
title: '',
|
|
|
startTime: '',
|
|
|
endTime: '',
|
|
|
normalWheelId: '',
|
|
|
days1: {
|
|
|
count: 0,
|
|
|
wheelId: ''
|
|
|
},
|
|
|
days2: {
|
|
|
count: 0,
|
|
|
wheelId: ''
|
|
|
},
|
|
|
days3: {
|
|
|
count: 0,
|
|
|
wheelId: ''
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
dateTimeChange(range) {
|
|
|
this.startTime = range[0];
|
|
|
this.endTime = range[1];
|
|
|
},
|
|
|
save() {
|
|
|
let prizeDayArr = [];
|
|
|
|
|
|
if (this.days1.count && this.days1.wheelId) { // 第一次累计
|
|
|
prizeDayArr.push(this.days1);
|
|
|
if (this.days2.count && this.days2.wheelId) { // 第二次累计
|
|
|
if (this.days2.count <= this.days1.count) {
|
|
|
return alert('第二次的天数必须大于第一次的天数');
|
|
|
} else {
|
|
|
prizeDayArr.push(this.days2);
|
|
|
if (this.days3.count && this.days3.wheelId) { // 第三次累计
|
|
|
if (this.days3.count <= this.days2.count) {
|
|
|
return alert('第三次的天数必须大于第二次的天数');
|
|
|
} else {
|
|
|
prizeDayArr.push(this.days3);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
method: 'post',
|
|
|
url: '/admin/dailyCheckIn/api/create',
|
|
|
data: {
|
|
|
title: this.title,
|
|
|
startTime: moment(this.startTime).format('X'),
|
|
|
endTime: moment(this.endTime).format('X'),
|
|
|
normalWheelId: this.normalWheelId,
|
|
|
prizeDayArr: JSON.stringify(prizeDayArr)
|
|
|
}
|
|
|
}).then(res => {
|
|
|
console.log(res);
|
|
|
|
|
|
|
|
|
// this.$router.push({name: 'list'});
|
|
|
});
|
|
|
|
|
|
},
|
|
|
cancel() {
|
|
|
this.$router.push({name: 'list'});
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style>
|
|
|
|
|
|
</style> |
...
|
...
|
|