Commit 03700c6d authored by leiqingsong's avatar leiqingsong

活动页面修改

parent 9bff9c37
wx_application/public/img/wheel.png

547 KB | W: | H:

wx_application/public/img/wheel.png

487 KB | W: | H:

wx_application/public/img/wheel.png
wx_application/public/img/wheel.png
wx_application/public/img/wheel.png
wx_application/public/img/wheel.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div class="wheel-container"> <div class="wheel-container">
<p class="title">{{ activityName }}</p> <p class="title">{{ activityName }}</p>
<div class="wheel"> <div class="wheel">
<div class="wheel-point" @click="Start_Game"></div> <div class="wheel-point" @click="Start_Game">开始</div>
<img src="../../../public/img/wheel.png" alt="wheel" /> <img src="../../../public/img/wheel.png" alt="wheel" />
<!-- <div class="circle"></div> --> <!-- <div class="circle"></div> -->
<div <div
...@@ -45,9 +45,10 @@ ...@@ -45,9 +45,10 @@
class="prize-item" class="prize-item"
:style="`transform: rotate(${(360/ prizeList.length) * index }deg)`" :style="`transform: rotate(${(360/ prizeList.length) * index }deg)`"
> >
<div class="prize-name">{{ item.name }}</div> <div class="prize-name">{{ item.prizeName }}</div>
<div class="prize-icon"> <div class="prize-icon">
<img src="/img/counter.png" /> <!-- <p>一等奖</p> -->
<!-- <img src="/img/counter.png" /> -->
</div> </div>
</div> </div>
</div> </div>
...@@ -80,26 +81,28 @@ ...@@ -80,26 +81,28 @@
:style="active_type === 'coupon'? 'bottom: 0': ''" :style="active_type === 'coupon'? 'bottom: 0': ''"
@click="handleShare" @click="handleShare"
>立即分享</div> >立即分享</div>
<van-overlay :show="showAward && !res_error" @click="showAward = false"> <van-overlay :show="showAward" @click="showAward = false">
<div class="wrapper" @click.stop> <div class="wrapper">
<div v-if="isAward" class="block"> <div v-if="isAward" class="block">
<div class="award-coupon"> <div class="award-coupon">
<img class="bg_img" src="/img/coupon.png" alt="coupon" /> <img class="bg_img" src="/img/coupon.png" alt="coupon" />
<div class="other"> <div class="other">
<p>{{ awardGood.coupon.type }}</p> <p>{{ awardGood.coupon.type }}</p>
<!-- <p>代金券</p> -->
<div class="split"> <div class="split">
<img src="../../../public/img/split.png" alt="split" /> <img src="../../../public/img/split.png" alt="split" />
</div> </div>
<p>{{ awardGood.coupon.unit }}元</p> <p>{{ awardGood.coupon.unit }}元</p>
<!-- <p>2000元</p> -->
</div> </div>
</div> </div>
<p style="font-size: 20px;font-weight: bold;">OLAY全场通用抵扣券</p> <p style="font-size: 20px;font-weight: bold;">OLAY全场通用抵扣券</p>
<p style="font-size: 20px;font-weight: bold;">{{ awardGood.prizeName }}!</p> <p style="font-size: 20px;font-weight: bold;">{{ awardGood.prizeName }}!</p>
<p style="font-size: 20px;font-weight: bold;">恭喜您中奖!</p> <p style="font-size: 20px;font-weight: bold;">恭喜您中奖!</p>
<van-button style="background: #f00;color: #fff;" @click="handleGet">领取奖品</van-button> <van-button style="background: #f00;color: #fff;" @click="handleGet">领取奖品</van-button>
<van-button style="border-color: #7f7777;" @click="showAward = false">继续抽奖</van-button> <van-button style="border-color: #7f7777;" @click="handleGoOn">继续抽奖</van-button>
</div> </div>
<div v-if="!isAward" class="block" style="background: #413d3de0;color: #fff;"> <div v-else class="block" style="background: #413d3de0;color: #fff;">
<p style="font-size: 22px;">谢谢惠顾!</p> <p style="font-size: 22px;">谢谢惠顾!</p>
<p style="font-size: 14px;">很遗憾,此次未能中奖,再接再厉!</p> <p style="font-size: 14px;">很遗憾,此次未能中奖,再接再厉!</p>
</div> </div>
...@@ -114,16 +117,17 @@ import axios from "axios"; ...@@ -114,16 +117,17 @@ import axios from "axios";
import wxAuth from "@/components/wxAuth"; import wxAuth from "@/components/wxAuth";
import * as APi_Active from "@/api/active"; import * as APi_Active from "@/api/active";
import { CoutDown } from "@/utils/Foundation"; import { CoutDown } from "@/utils/Foundation";
import { Dialog } from "vant";
export default { export default {
name: "active-detail", name: "active-detail",
components: { wxAuth }, components: { wxAuth },
data() { data() {
return { return {
goOn: false,
env: "",
userIcon: "/img/photo.png", userIcon: "/img/photo.png",
couponDetail: {}, couponDetail: {},
game_end: false, game_end: false,
res_error: false,
error_message: "",
timer: null, timer: null,
timeLine: "", timeLine: "",
isAward: false, isAward: false,
...@@ -191,11 +195,16 @@ export default { ...@@ -191,11 +195,16 @@ export default {
this.userIcon = this.$route.query.headurl this.userIcon = this.$route.query.headurl
? decodeURIComponent(this.$route.query.headurl) ? decodeURIComponent(this.$route.query.headurl)
: ""; : "";
// 验证用户是否登录 this.env = window.navigator.userAgent.toLowerCase();
if (!sessionStorage.getItem("userId")) {
// 微信端才做验证
if (
this.env.match(/MicroMessenger/i) !== "micromessenger" ||
this.env.match(/wxwork/i) == "wxwork"
) {
// 1.获取code // 1.获取code
if (this.$route.query.unionid === undefined) { if (this.$route.query.unionid === undefined) {
this.getUnionid(); // this.getUnionid();
} else { } else {
this.userBaseInfo.unionid = JSON.stringify(this.$route.query.unionid); this.userBaseInfo.unionid = JSON.stringify(this.$route.query.unionid);
this.userBaseInfo.openid = JSON.stringify(this.$route.query.openid); this.userBaseInfo.openid = JSON.stringify(this.$route.query.openid);
...@@ -203,9 +212,26 @@ export default { ...@@ -203,9 +212,26 @@ export default {
number: 7, number: 7,
unionId: this.$route.query.unionid unionId: this.$route.query.unionid
}; };
console.log("params", params); //TODO 会员验证提示
APi_Active.isMember(params).then(res => { APi_Active.isMember(params).then(res => {
this.isMember = res.data.vipId != null; if (res.data.errMessage === "会员不存在") {
this.isMember = false;
Dialog.confirm({
title: "确认框",
message:
"当前活动为会员才可参加,尚未找到您的会员信息,是否前往注册?"
})
.then(() => {
// on confirm
let url = "http://oysales.oywanhao.com/register";
window.location.href = url;
})
.catch(() => {
// on cancel
return false;
});
}
this.isMember = true;
this.userBaseInfo.vipId = res.data.vipId; this.userBaseInfo.vipId = res.data.vipId;
this.userBaseInfo.mobile = res.data.mobile; this.userBaseInfo.mobile = res.data.mobile;
this.userBaseInfo.name = res.data.name; this.userBaseInfo.name = res.data.name;
...@@ -233,12 +259,21 @@ export default { ...@@ -233,12 +259,21 @@ export default {
} }
}, },
methods: { methods: {
// 继续抽奖
handleGoOn() {
this.goOn = true;
this.showAward = false;
},
// 领取( // 领取(
handleGet() { handleGet() {
if (this.$route.query.unionid === undefined) { if (
this.$toast("企业微信端不能领取"); this.env.match(/MicroMessenger/i) !== "micromessenger" ||
return; this.env.match(/wxwork/i) == "wxwork"
) {
this.$toast("请在微信端领取!");
return false;
} }
// 会员领取
let params = { let params = {
couponId: this.awardGood.activityPrize couponId: this.awardGood.activityPrize
? this.awardGood.coupon.id ? this.awardGood.coupon.id
...@@ -248,9 +283,15 @@ export default { ...@@ -248,9 +283,15 @@ export default {
}; };
APi_Active.collectMyCoupon(params).then(res => { APi_Active.collectMyCoupon(params).then(res => {
this.showAward = false; this.showAward = false;
this.$toast( if (res.data == "领取失败") {
"领取成功!奖品已经发送到您的会员账户,请进入欧亚小程序查看。" this.$toast("领取失败");
); return false;
}
if (!this.goOn) {
this.$toast(
"领取成功!奖品已经发送到您的会员账户,请进入欧亚小程序查看。"
);
}
}); });
}, },
GET_DetailById(id) { GET_DetailById(id) {
...@@ -300,35 +341,32 @@ export default { ...@@ -300,35 +341,32 @@ export default {
}, },
Start_Game() { Start_Game() {
// 在微信端打开 会有身份验证 路径中会带上 unionid // 在微信端打开 会有身份验证 路径中会带上 unionid
if (this.$route.query.unionid === undefined) { // if (
this.$toast("企业微信端不能参与抽奖活动"); // this.env.match(/MicroMessenger/i) !== "micromessenger" ||
return false; // this.env.match(/wxwork/i) == "wxwork"
} // ) {
// this.$toast("请在微信端参与活动!");
// return false;
// }
if (this.game_end) { if (this.game_end) {
this.$toast("活动已结束"); this.$toast("活动已结束");
return false; return false;
} }
if (this.userBaseInfo.vipId === null) {
this.$toast("非会员,");
let url = "http://oysales.oywanhao.com/register";
window.location.href = url;
return false;
}
if (this.rolling) { if (this.rolling) {
this.$toast("抽奖中,请勿多次点击!"); this.$toast("抽奖中,请勿多次点击!");
return false; return false;
} }
let params = { let params = {
activityId: this.active_id, activityId: this.active_id,
openId: this.userBaseInfo.openid, openId: this.userBaseInfo.openid || "ofoA-xH5niSEVKKdaw2rE4bEZ3KY",
phone: this.userBaseInfo.phone, phone: this.userBaseInfo.phone,
unionId: this.userBaseInfo.unionid, unionId: this.userBaseInfo.unionid || "oCIMxuC30KJI9Kn_y4miMflyQ7BY",
userName: this.userBaseInfo.name userName: this.userBaseInfo.name
}; };
APi_Active.play(params) APi_Active.play(params)
.then(res => { .then(res => {
if (!res.data.prizedId) { if (!res.data.prizeId) {
this.res_error = true; this.showAward = false;
this.$toast(res.data.message); this.$toast(res.data.message);
return false; return false;
} }
...@@ -336,7 +374,7 @@ export default { ...@@ -336,7 +374,7 @@ export default {
this.rolling = true; this.rolling = true;
const random = prizeList const random = prizeList
.map(item => item.id) .map(item => item.id)
.indexOf(res.data.prizedId); .indexOf(res.data.prizeId);
this.wheelDeg = this.wheelDeg =
wheelDeg - wheelDeg -
(wheelDeg % 360) + (wheelDeg % 360) +
...@@ -348,12 +386,21 @@ export default { ...@@ -348,12 +386,21 @@ export default {
this.rolling = false; this.rolling = false;
this.showAward = true; this.showAward = true;
this.isAward = res.data.prizeName !== "谢谢惠顾"; this.isAward = res.data.prizeName !== "谢谢惠顾";
if (!this.isAward) {
this.$toast("");
}
}, 4500); }, 4500);
}) })
.catch(err => { .catch(err => {
console.log("err", err); console.log("err", err);
}); });
}, },
getUrlParams(name) {
let reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
if (reg.test(location.href))
return unescape(RegExp.$2.replace(/\+/g, " "));
return "";
},
// 分享 // 分享
handleShare() { handleShare() {
let env = window.navigator.userAgent.toLowerCase(); let env = window.navigator.userAgent.toLowerCase();
...@@ -381,12 +428,14 @@ export default { ...@@ -381,12 +428,14 @@ export default {
); );
} else if (env.match(/micromessenger/i) == "micromessenger") { } else if (env.match(/micromessenger/i) == "micromessenger") {
console.log("微信客户端"); console.log("微信客户端");
let wx_url = `http://oysales.oywanhao.com:8087/activeDetail?id=${this.$route.query.id}&active_type=${this.$route.query.active_type}`; let id = this.getUrlParams("id");
let type = this.getUrlParams("active_type");
let wx_url = `http://oysales.oywanhao.com:8087/activeDetail?id=${id}&active_type=${type}`;
wx.ready(function() { wx.ready(function() {
wx.onMenuShareTimeline({ wx.onMenuShareTimeline({
title: `${this.$route.query.active_type === 'wheel' ? '抽奖' : '送券'}活动`, // 分享标题 title: `${type === "wheel" ? "抽奖" : "送券"}活动`, // 分享标题
link: url, // 分享链接,将当前登录用户转为puid,以便于发展下线 link: wx_url, // 分享链接,将当前登录用户转为puid,以便于发展下线
imgUrl: "", // 分享图标 imgUrl: "", // 分享图标
success: function() { success: function() {
// 用户确认分享后执行的回调函数 // 用户确认分享后执行的回调函数
...@@ -532,7 +581,7 @@ export default { ...@@ -532,7 +581,7 @@ export default {
right: 0; right: 0;
bottom: 0; bottom: 0;
margin: auto; margin: auto;
font-size: 32px; font-size: 20px;
text-align: center; text-align: center;
line-height: 32px; line-height: 32px;
z-index: 10; z-index: 10;
...@@ -580,8 +629,12 @@ export default { ...@@ -580,8 +629,12 @@ export default {
transform-origin: bottom; transform-origin: bottom;
.prize-name { .prize-name {
padding: 16px 0 0; padding: 0.75rem 0 0;
font-size: 14px; font-size: 0.4375rem;
height: 70%;
width: 0.5rem;
overflow: hidden;
text-overflow: ellipsis;
} }
.prize-icon { .prize-icon {
...@@ -693,8 +746,11 @@ export default { ...@@ -693,8 +746,11 @@ export default {
width: 90%; width: 90%;
height: 60%; height: 60%;
margin: auto; margin: auto;
text-align: center;
font-size: 32px;
color: #f00; color: #f00;
p { p {
width: 50%;
margin: 0; margin: 0;
} }
} }
......
...@@ -238,7 +238,7 @@ export default { ...@@ -238,7 +238,7 @@ export default {
this.flag = sessionStorage.getItem("role"); this.flag = sessionStorage.getItem("role");
} }
} else { } else {
this.zReadyUserId() // this.zReadyUserId()
this.zTestGetNowUrlInfo() this.zTestGetNowUrlInfo()
} }
this.GET_CurrentActive() this.GET_CurrentActive()
......
...@@ -74,7 +74,7 @@ export default { ...@@ -74,7 +74,7 @@ export default {
getTemplate(params) { getTemplate(params) {
API_Active.getTemplate(params).then(res => { API_Active.getTemplate(params).then(res => {
this.active.push(...res.data.list); this.active.push(...res.data.list);
if (res.data.list === []) { if (res.data.list.length === 0) {
this.list_finished = true; this.list_finished = true;
} }
}); });
......
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