Commit 9e9cc8e2 authored by leiqingsong's avatar leiqingsong

修复优惠券创建的优惠券id提示隐藏

parent fc538223
...@@ -239,7 +239,7 @@ export default { ...@@ -239,7 +239,7 @@ export default {
}; };
}, },
async created() { async created() {
console.log('部署好了'); console.log("部署好了");
this.currentUrl = location.href; this.currentUrl = location.href;
this.active_id = this.$route.query.id; this.active_id = this.$route.query.id;
this.active_type = this.$route.query.active_type; this.active_type = this.$route.query.active_type;
...@@ -402,7 +402,8 @@ export default { ...@@ -402,7 +402,8 @@ export default {
// 初始化 抽奖参数 // 初始化 抽奖参数
init() { init() {
this.basecircle = this.prizeListOrigin.length; this.basecircle = this.prizeListOrigin.length;
this.selected = 1;
this.running = false; this.running = false;
this.isBeginPrize = false; this.isBeginPrize = false;
...@@ -411,24 +412,21 @@ export default { ...@@ -411,24 +412,21 @@ export default {
this.speed = 300; this.speed = 300;
}, },
// 开始抽奖 // 开始抽奖
async mouseDown_Start(e) { mouseDown_Start(e) {
let canvas = document.getElementById("bg"); let canvas = document.getElementById("bg");
let local = this.getPointOnCanvas(canvas, e.pageX, e.pageY); let local = this.getPointOnCanvas(canvas, e.pageX, e.pageY);
if (local.x > 100 && local.x < 300 && local.y > 100 && local.y < 300) { if (local.x > 100 && local.x < 300 && local.y > 100 && local.y < 300) {
// 点击开始 // 点击开始
// 开始前 必要检测 // 开始前 必要检测
if(!this.before_Start()) { if (!this.before_Start()) {
// 检测未通过 // 检测未通过
return false; return false;
} }
if (this.running) { if (this.running) {
this.$toast("游戏进行中,请勿多次点击!"); this.$toast("游戏进行中,请勿多次点击!");
return false; } else {
this.game_result();
} }
await this.game_result();
this.init();
// 转起来
this.wheel_timer = setInterval(this.rotate, this.speed);
} }
}, },
// 游戏开始前的检测 // 游戏开始前的检测
...@@ -465,7 +463,7 @@ export default { ...@@ -465,7 +463,7 @@ export default {
return check_res; return check_res;
}, },
// 游戏后台结果 // 游戏后台结果
async game_result() { game_result() {
let params = { let params = {
activityId: this.active_id, activityId: this.active_id,
openId: this.userBaseInfo.openid, openId: this.userBaseInfo.openid,
...@@ -473,23 +471,34 @@ export default { ...@@ -473,23 +471,34 @@ export default {
unionId: this.userBaseInfo.unionid, unionId: this.userBaseInfo.unionid,
userName: this.userBaseInfo.name userName: this.userBaseInfo.name
}; };
let res = await APi_Active.play(params); this.init();
if (!res.data.prizeId) { APi_Active.play(params)
this.$toast(res.data.message); .then(res => {
return false; if (res.errorCode == "500") {
} else { this.$toast('errcode: 500, 获取数据异常。');
// 在奖项列表中找到抽奖结果奖项的下标 } else if (!res.data.prizeId) {
let id = this.prizeListOrigin this.$toast(res.data.message);
.map(item => item.id) } else {
.indexOf(res.data.prizeId); // 在奖项列表中找到抽奖结果奖项的下标
this.selected = id + 1; let id = this.prizeListOrigin
this.isAward = res.data.prizeName !== "谢谢惠顾"; .map(item => item.id)
// 中奖后 设置中奖奖品信息 .indexOf(res.data.prizeId);
if (this.isAward) { this.selected = id + 1;
this.awardGood = this.prizeListOrigin[id]; this.isAward = res.data.prizeName !== "谢谢惠顾";
this.awardGood.coupon = JSON.parse(this.prizeListOrigin[id].coupon); // 中奖后 设置中奖奖品信息
} if (this.isAward) {
} this.awardGood = this.prizeListOrigin[id];
this.awardGood.coupon = JSON.parse(
this.prizeListOrigin[id].coupon
);
}
// 转起来
this.wheel_timer = setInterval(this.rotate, this.speed);
}
})
.catch(error => {
});
}, },
// 开始旋转 // 开始旋转
rotate() { rotate() {
...@@ -515,7 +524,6 @@ export default { ...@@ -515,7 +524,6 @@ export default {
} }
if (this.isBeginPrize && this.selected > 0) { if (this.isBeginPrize && this.selected > 0) {
// 开始抽奖
if (--this.selected == 0) { if (--this.selected == 0) {
//到了选择的奖项之后 //到了选择的奖项之后
this.clearTimer(); this.clearTimer();
...@@ -589,7 +597,9 @@ export default { ...@@ -589,7 +597,9 @@ export default {
this.awardGood.coupon ? this.awardGood.coupon.id : this.couponDetail.id this.awardGood.coupon ? this.awardGood.coupon.id : this.couponDetail.id
); );
let params = { let params = {
couponId: this.awardGood.coupon ? this.awardGood.coupon.id : this.couponDetail.id, couponId: this.awardGood.coupon
? this.awardGood.coupon.id
: this.couponDetail.id,
unionId: this.userBaseInfo.unionid, unionId: this.userBaseInfo.unionid,
vipId: this.userBaseInfo.vipId vipId: this.userBaseInfo.vipId
}; };
......
...@@ -131,9 +131,10 @@ ...@@ -131,9 +131,10 @@
<van-cell title="使用说明" style="font-size:14px;"> <van-cell title="使用说明" style="font-size:14px;">
<template slot="default"> <template slot="default">
<van-field <van-field
class="right"
type="textarea"
v-model="addForm.instruction" v-model="addForm.instruction"
placeholder="请输入使用说明" placeholder="请输入使用说明"
class="right"
style="font-size:14px;" style="font-size:14px;"
/> />
</template> </template>
...@@ -156,7 +157,7 @@ ...@@ -156,7 +157,7 @@
/> />
</div> </div>
</template> </template>
</van-cell> --> </van-cell>-->
<van-cell title="总限制次数" style="font-size:14px;" class="js"> <van-cell title="总限制次数" style="font-size:14px;" class="js">
<van-stepper <van-stepper
v-model="addForm.limitOfUse" v-model="addForm.limitOfUse"
...@@ -168,6 +169,7 @@ ...@@ -168,6 +169,7 @@
<van-cell title="总限制提示" style="font-size:14px;"> <van-cell title="总限制提示" style="font-size:14px;">
<template slot="default"> <template slot="default">
<van-field <van-field
type="textarea"
v-model="addForm.remind" v-model="addForm.remind"
placeholder="请输入总限制提示" placeholder="请输入总限制提示"
class="right" class="right"
...@@ -349,10 +351,10 @@ export default { ...@@ -349,10 +351,10 @@ export default {
this.$toast("请输入结束时间"); this.$toast("请输入结束时间");
return false; return false;
} }
if (!this.addForm.couponIds) { // if (!this.addForm.couponIds) {
this.$toast("请输入优惠券ID"); // this.$toast("请输入优惠券ID");
return false; // return false;
} // }
if (!this.addForm.limitOfUse) { if (!this.addForm.limitOfUse) {
this.$toast("请输入总限制次数"); this.$toast("请输入总限制次数");
......
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