Authored by 李奇

奖品配置修改

... ... @@ -2,7 +2,7 @@ root = true
[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
... ...
... ... @@ -99,23 +99,33 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
obj.start = (pageNo - 1) * pageSize;
obj.page = pageSize;
let sql = `select u.id, u.act_id act_id, u.prize_id prize_id, u.create_time create_time,a.title title,p.name name,p.type type ,p.value value,p.img img
let sql = `select u.uid, u.act_id act_id, u.prize_id prize_id, u.create_time create_time,a.title title,p.name name,p.type type ,p.value value,p.img img
from act_wheel_surf_user u , act_wheel_surf_prize p ,activity a where u.prize_id = p.id and u.act_id =:act_id and a.id=:act_id`;
let arr = Object.keys(obj);
let countSql = `select count(1) from act_wheel_surf_user where act_id = :act_id`;
arr.forEach(function(value, index) {
switch (obj[value]) {
if (!obj[value]) {
return;
}
switch (value) {
case 'type':
sql += ' and p.type=:type';
countSql += ' and p.type=:type';
break;
case 'title':
sql += ' and a.title=:title';
countSql += ' and a.title=:title';
break;
case 'uid':
sql += ' and u.uid=:uid';
countSql += ' and u.uid=:uid';
break;
case 'name':
sql += ' and p.name=:name';
countSql += ' and p.name=:name';
break;
}
if (index === arr.length - 1) {
... ...
... ... @@ -107,7 +107,7 @@ router.post('/wheelSurf/api/prize/create', wheelSurf.prizeCreate);
router.post('/wheelSurf/api/prize/update', wheelSurf.prizeUpdate);
router.get('/wheelSurf/api/prize/delete', wheelSurf.prizeDelete);
router.post('/wheelSurf/api/prize/modify', wheelSurf.prizeModify);
router.post('/wheelSurf/api/prize/userFind', wheelSurf.userFind);
router.get('/wheelSurf/*', wheelSurf.entry);
... ...
... ... @@ -101,7 +101,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
// 判断用户是否登录 如果没登录就取当前活动最大次数
if (obj.uid) {
// 每日最大次数
if (!data.conf.times_type) {
if (data.conf.times_type === 1) {
// 获取当天0点和23:59:59
let endTime = new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1);
let startTime = new Date(new Date(new Date().toLocaleDateString()).getTime());
... ... @@ -115,7 +115,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
residueCount = data.conf.act_total_times - await ActWheelSurfUser.count({where: obj});
}
} else {
residueCount = data.conf.times_type ? data.conf.act_total_times : data.conf.day_limit_times;
residueCount = data.conf.times_type === 3 ? data.conf.act_total_times : data.conf.day_limit_times;
}
data.residueCount = residueCount;
return Promise.resolve(data);
... ...
... ... @@ -18,15 +18,15 @@
<Option :value="4">实物奖品</Option>
</Select>
</FormItem>
<FormItem label="奖品口令" prop="value">
<Input v-model="prize.value" placeholder="红包优惠券口令(实物奖品不填)" :maxlenght="200"></Input>
<FormItem label="奖品token" prop="value">
<Input v-model="prize.value" placeholder="红包优惠券token(实物奖品和谢谢惠顾不填)" :maxlenght="200"></Input>
</FormItem>
<FormItem label="奖品总数" prop="total">
<Input v-model="prize.total" placeholder="奖品总数(不限量奖品可填9999999999)" number
:maxlength="9"></Input>
</FormItem>
<FormItem label="剩余奖品数" prop="total_left">
<Input v-model="prize.total_left" placeholder="剩余奖品总数)" number
<Input v-model="prize.total_left" placeholder="剩余奖品总数(值等于奖品总数)" number
:maxlength="9"></Input>
</FormItem>
<FormItem label="中奖概率" prop="chance">
... ... @@ -188,6 +188,10 @@
{required: true, message: '奖品总数不能为空'},
{type: 'integer', message: '奖品总数必须是整数', trigger: 'blur'}
],
total_left: [
{required: true, message: '剩余奖品总数不能为空'},
{type: 'integer', message: '剩余奖品总数必须是整数', trigger: 'blur'}
],
chance: [
{required: true, message: '中奖概率不能为空'},
{type: 'number', message: '奖品总数必须是数字', trigger: 'blur'}
... ...
... ... @@ -20,10 +20,6 @@
<Input type="text" v-model="conf.share_url"
placeholder="分享链接" :maxlength="500"></Input>
</FormItem>
<FormItem label="提示文案(上)" prop="btm_tip_one">
<Input type="text" v-model="conf.btm_tip_one"
placeholder="提示文案(上)"></Input>
</FormItem>
<FormItem v-if="false" label="提示文案(下)" prop="btm_tip_two">
<Input type="text" v-model="conf.btm_tip_two"
placeholder="提示文案(下)"></Input>
... ... @@ -40,25 +36,12 @@
<Input type="text" v-model="conf.jump_btn_right_url"
placeholder="底部按钮3链接"></Input>
</FormItem>
<FormItem label="活动次数限制" prop="times_type">
<Select v-model="conf.times_type" @on-change="limitChange">
<Option :value="1">只限制每天最大抽奖次数</Option>
<Option :value="2">只限制每人参与活动最大抽奖次数</Option>
<Option :value="3">同时限制以上两种</Option>
</Select>
</FormItem>
<FormItem label="每天最大抽奖次数" prop="day_limit_times"
v-if="conf.times_type == 1 || conf.times_type == 3">
<FormItem label="每天最大抽奖次数" prop="day_limit_times">
<Input type="text"
v-model="conf.day_limit_times"
placeholder="每天最大抽奖次数"></Input>
</FormItem>
<FormItem v-if="conf.times_type == 2 || conf.times_type == 3" label="每人参与活动最大抽奖次数"
prop="act_total_times">
<Input type="text" v-model="conf.act_total_times"
placeholder="每人参与活动最大抽奖次数"></Input>
placeholder="每天最大抽奖次数" number></Input>
</FormItem>
<FormItem label="底部资源码" prop="bottomContentCode">
<FormItem label="底部资源码" prop="bottomContentCode">
<Input type="text" v-model="conf.bottomContentCode"
placeholder="底部资源码"></Input>
</FormItem>
... ... @@ -201,7 +184,7 @@
prize_btn_bg: '',
rule_btn_bg: '',
share_btn_bg: '',
times_type: 0,
times_type: 1,
day_over_limit_bg: '',
my_prize_btn_bg: '',
win_prize_bg: '',
... ... @@ -212,13 +195,8 @@
{ required: false, message: '分享链接不能为空'}
],
day_limit_times: [
{ required: true, message: '每天最大次数不能为空'}
],
act_total_times: [
{ required: true, message: '每人参与活动最大次数不能为空'}
],
btm_tip_one: [
{ required: false, message: '提示文案(上)不能为空'}
{ required: true, message: '每天最大次数不能为空'},
{ type: 'integer', message: '每天最大次数必须是整数', trigger: 'blur'}
],
bottomContentCode: [
{ required: true, message: '底部资源码不能为空'}
... ...
<template>
<div class="list">
<div class="filter">
<Row>
<Col span="6" class="field-col">
<Input v-model="uid" placeholder="用户UID" :maxlength="20"></Input>
</Col>
<Col span="6" class="field-col">
<Select v-model="type">
<Option :value="1">谢谢惠顾</Option>
<Option :value="2">红包</Option>
<Option :value="3">优惠券</Option>
<Option :value="4">实物奖品</Option>
</Select>
</Col>
<Col span="6" class="field-col">
<Input v-model="name" placeholder="奖品名称" :maxlength="100"></Input>
</Col>
<Col span="6">
<Button type="primary" @click="search">检索</Button>
<Button @click="reset" type="warning" style="margin-left: 10px;">重置
</Button></Col>
</Row>
</div>
<Table :columns="columns1" :data="data"></Table>
<div class="page">
<Page :total="100" />
</div>
</div>
</template>
<script>
const pirzeType = {
1: '谢谢惠顾',
2: '红包',
3: '优惠券',
4: '实物奖品'
};
module.exports = {
data() {
return {
actId: 0,
uid: '',
type: '',
name: '',
columns1: [
{
title: '用户UID',
key: 'id'
key: 'uid'
},
{
title: '奖品类型',
key: 'title'
key: 'type',
render: (h, {row}) => {
return h('span', {}, pirzeType[row.type]);
}
},
{
title: '奖品名称',
key: 'startTime',
key: 'name'
},
{
title: '奖品图片',
key: 'img',
render: (h, {row}) => {
return h('span', {}, moment(row.startTime * 1000).format('YYYY-MM-DD HH:mm:ss '));
return h('img', {
attrs: {
src: row.img
},
style: {
width: '100%',
height: 'auto'
}
});
}
},
{
title: '中奖时间',
key: 'endTime',
render: (h, {row}) => {
return h('span', {}, moment(row.endTime * 1000).format('YYYY-MM-DD HH:mm:ss '));
return h('span', {}, moment(new Date(row.create_time).getTime()).format('YYYY-MM-DD HH:mm:ss '));
}
}
],
... ... @@ -35,25 +85,63 @@
};
},
methods: {
list() {
list(params) {
params = params || {act_id: this.actId, pageNo: 1, pageSize: 10};
$.ajax({
url: '/admin/wheelSurf/api/prizeSent',
method: 'post',
url: '/admin/wheelSurf/api/prize/userFind',
contentType: 'application/json',
data: JSON.stringify(params)
}).then(res => {
this.data = res.data;
});
},
search() {
let params = {act_id: this.actId, pageSize: 10};
if (this.uid) {
params.uid = this.uid;
}
if (this.type) {
params.type = this.type;
}
if (this.name) {
params.name = this.name;
}
this.list(params);
},
reset() {
this.uid = '';
this.type = '';
this.name = '';
this.list();
}
},
created() {
this.actId= this.$route.query.actId;
this.list();
}
};
</script>
<style lang="scss">
<style lang="scss" scoped>
.activity-list {
}
.create-btn {
margin-bottom: 10px;
.filter {
margin-bottom: 20px;
}
.page {
margin-top: 20px;
text-align: right;
}
.field-col {
padding-right: 20px;
}
</style>
... ...