Authored by 李奇

活动修改

... ... @@ -302,7 +302,10 @@ const whSurfController = {
return res.json({
code: 200,
data: result
data: {
list: result[1],
total: result[0]
}
});
}
};
... ...
... ... @@ -103,7 +103,8 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
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`;
let countSql = `select count(1) total
from act_wheel_surf_user u , act_wheel_surf_prize p where u.prize_id = p.id and u.act_id =:act_id`;
arr.forEach(function(value, index) {
if (!obj[value]) {
... ... @@ -117,7 +118,6 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
break;
case 'title':
sql += ' and a.title=:title';
countSql += ' and a.title=:title';
break;
case 'uid':
sql += ' and u.uid=:uid';
... ... @@ -134,7 +134,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
});
try {
return mysqlCli.query(sql, obj);
return Promise.all([mysqlCli.query(countSql, obj).then(res => {return res[0].total}), mysqlCli.query(sql, obj)]);
} catch (e) {
return Promise.reject({code: 305, result: false, msg: '服务错误,请稍等'});
}
... ...
... ... @@ -250,8 +250,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
if (sendResult.data.isRepReceive === 'N') {
sendResult.code = 201; // 不能重复领取
} else {
// getPrize.desc = '恭喜您获得' + sendResult.data.amount + '元红包';
getPrize.desc = '恭喜您!中奖了';
getPrize.desc = '恭喜您获得' + sendResult.data.amount + '元红包';
}
}
} catch (e) {
... ... @@ -270,8 +269,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
sendMessage(1, {}, {succeedTimes: 1}, 0);
if (sendResult && sendResult.code === 200) {
// getPrize.desc = '恭喜您获得' + getPrize.name + '优惠券';
getPrize.desc = '恭喜您!中奖了';
getPrize.desc = '恭喜您获得' + getPrize.name + '优惠券';
}
} catch (e) {
... ... @@ -279,8 +277,7 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
}
} else if (getPrize.type === 4) {
sendResult.code = 200;
// getPrize.desc = '恭喜您获得' + getPrize.name;
getPrize.desc = '恭喜您!中奖了';
getPrize.desc = '恭喜您获得' + getPrize.name;
}
// 插入数据库
... ...
... ... @@ -282,7 +282,7 @@
});
}
this.$Modal.warning({
this.$Modal.confirm({
title: '注意',
content: '奖品创建之后不能新增和删除只能编辑奖品参数',
cancelText: '取消',
... ... @@ -312,16 +312,13 @@
this.prize._editIdx = idx;
this.isEditing = true;
console.log(JSON.stringify(this.prize))
this.$nextTick(() => {
const form = 'prizeForm';
this.validateForm(form);
});
},
confirmEdit() {
this.$Modal.warning({
this.$Modal.confirm({
title: '注意',
content: '暂存之后需要再次点击底部【保存修改】按钮才能完成修改',
cancelText: '取消',
... ...
... ... @@ -24,7 +24,7 @@
</div>
<Table :columns="columns1" :data="data"></Table>
<div class="page">
<Page :total="100" />
<Page :total="total" :pageSize="10" :current="pageNo" @on-change="pageChange"/>
</div>
</div>
</template>
... ... @@ -42,6 +42,9 @@
uid: '',
type: '',
name: '',
total: 0,
pageNo: 1,
pageSize: 10,
columns1: [
{
title: '用户UID',
... ... @@ -86,7 +89,7 @@
},
methods: {
list(params) {
params = params || {act_id: this.actId, pageNo: 1, pageSize: 10};
params = params || {act_id: this.actId, pageNo: 1, pageSize: this.pageSize};
$.ajax({
method: 'post',
... ... @@ -94,11 +97,16 @@
contentType: 'application/json',
data: JSON.stringify(params)
}).then(res => {
this.data = res.data;
this.data = res.data.list;
this.total = res.data.total;
});
},
search() {
let params = {act_id: this.actId, pageSize: 10};
let params = {
act_id: this.actId,
pageNo: 1,
pageSize: 10
};
if (this.uid) {
params.uid = this.uid;
... ... @@ -114,10 +122,34 @@
this.list(params);
},
pageChange(page) {
this.pageNo = page;
let params = {
act_id: this.actId,
pageNo: this.pageNo,
pageSize: this.pageSize
};
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.pageNo = 1;
this.list();
}
},
... ...