Commit 3f3b03b5 authored by xd's avatar xd

解决冲突

parents 02f5c0ea ab17a886
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"core-js": "^3.4.4", "core-js": "^3.4.4",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"jssdk": "^0.0.1", "jssdk": "^0.0.1",
"qs": "^6.9.3",
"vant": "^2.5.9", "vant": "^2.5.9",
"vconsole": "^3.3.4", "vconsole": "^3.3.4",
"vee-validate": "^2.0.0-rc.25", "vee-validate": "^2.0.0-rc.25",
......
...@@ -32,7 +32,7 @@ export function isMember(params) { ...@@ -32,7 +32,7 @@ export function isMember(params) {
return request({ return request({
url: `activity/isMember`, url: `activity/isMember`,
method: 'get', method: 'get',
data: params params
}) })
} }
...@@ -79,3 +79,13 @@ export function getCurrentActive() { ...@@ -79,3 +79,13 @@ export function getCurrentActive() {
}) })
} }
/**
* 顾客领取优惠券
*/
export function collectMyCoupon(params) {
return request({
url: `admin/auth/coupon/collectMyCoupon`,
method: `get`,
params
})
}
\ No newline at end of file
...@@ -14,9 +14,9 @@ export function CoutDown(Endtime) { ...@@ -14,9 +14,9 @@ export function CoutDown(Endtime) {
if (days >= 0 || hours >= 0 || minutes >= 0 || seconds >= 0) { if (days >= 0 || hours >= 0 || minutes >= 0 || seconds >= 0) {
document.getElementById("timer").innerHTML = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒"; document.getElementById("timer").innerHTML = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒";
} }
if (days <= 0 && hours <= 0 && minutes <= 0 && seconds <= 0) { if (days <= 0 || hours <= 0) {
window.clearInterval(_ordertimer); console.log('已结束');
_ordertimer = null; document.getElementById("timer").innerHTML = '已结束'
} }
function checkTime(i) { //将0-9的数字前面加上0,例1变为01 function checkTime(i) { //将0-9的数字前面加上0,例1变为01
if (i < 10) { if (i < 10) {
......
import axios from 'axios' import axios from 'axios'
import md5 from "js-md5" import md5 from "js-md5"
import qs from 'qs'
let BASE_API = "http://139.155.48.151:8084" let BASE_API = "http://139.155.48.151:8084"
const zlog = console.log.bind(console) const zlog = console.log.bind(console)
...@@ -9,7 +10,8 @@ const zlog = console.log.bind(console) ...@@ -9,7 +10,8 @@ const zlog = console.log.bind(console)
// 创建 axios 实例 // 创建 axios 实例
const service = axios.create({ const service = axios.create({
baseURL: BASE_API, baseURL: BASE_API,
timeout: 20000 timeout: 20000,
paramsSerializer: params => qs.stringify(params, { arrayFormat: 'repeat' })
}) })
// request 拦截器 // request 拦截器
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="btn">立即领取</div> <div class="btn" @click="handleGet">立即领取</div>
</div> </div>
</template> </template>
<template v-if="active_type === 'wheel'"> <template v-if="active_type === 'wheel'">
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
:style="active_type === 'coupon'? 'bottom: 0': ''" :style="active_type === 'coupon'? 'bottom: 0': ''"
@click="handleShare" @click="handleShare"
>立即分享</div> >立即分享</div>
<van-overlay :show="showAward" @click="showAward = false"> <van-overlay :show="showAward && !res_error" @click="showAward = false">
<div class="wrapper" @click.stop> <div class="wrapper" @click.stop>
<div v-if="isAward" class="block"> <div v-if="isAward" class="block">
<p style="font-size: 20px;font-weight: bold;">OLAY全场通用抵扣券</p> <p style="font-size: 20px;font-weight: bold;">OLAY全场通用抵扣券</p>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<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="showAward = false">继续抽奖</van-button>
</div> </div>
<div v-else class="block" style="background: #413d3de0;color: #fff;"> <div v-if="!isAward" 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>
...@@ -102,11 +102,14 @@ export default { ...@@ -102,11 +102,14 @@ export default {
components: { wxAuth }, components: { wxAuth },
data() { data() {
return { return {
game_end: false,
res_error: false,
error_message: "",
timer: null, timer: null,
timeLine: "1586628005000", timeLine: "",
isAward: false, isAward: false,
showAward: false, showAward: false,
userBaseInfo: "", userBaseInfo: {},
isMember: false, isMember: false,
openid: "", openid: "",
unionid: "", unionid: "",
...@@ -163,24 +166,26 @@ export default { ...@@ -163,24 +166,26 @@ export default {
}; };
}, },
async created() { async created() {
console.log("活动详情1");
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;
console.log("query", this.$route.query);
// 验证用户是否登录 // 验证用户是否登录
if (!sessionStorage.getItem("userId")) { if (!sessionStorage.getItem("userId")) {
// 1.获取code // 1.获取code
if (this.$route.query.unionid === undefined) { if (this.$route.query.unionid === undefined) {
// this.showAuthDialog = true; this.getUnionid();
// this.getUnionid();
} else { } else {
console.log("有unionid");
this.userBaseInfo.unionid = JSON.stringify(this.$route.query.unionid);
this.userBaseInfo.openid = JSON.stringify(this.$route.query.openid);
let params = { let params = {
number: 7, number: 7,
unionId: this.$route.query.unionid unionId: this.$route.query.unionid
}; };
console.log("params", params);
APi_Active.isMember(params).then(res => { APi_Active.isMember(params).then(res => {
this.isMember = res.data.vipId !== ""; this.isMember = 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;
}); });
...@@ -188,11 +193,18 @@ export default { ...@@ -188,11 +193,18 @@ export default {
} }
}, },
mounted() { mounted() {
this.timer = setInterval(() => {
CoutDown('2020-5-13 2:5:47');
}, 1000);
this.getAgentAuth(); this.getAgentAuth();
this.GET_DetailById(this.active_id); this.GET_DetailById(this.active_id);
let cur_date = new Date();
let end_time = new Date(this.timeLine);
if (end_time - cur_date > 0) {
this.timer = setInterval(() => {
CoutDown(this.timeLine);
}, 1000);
} else {
document.getElementById("timer").innerHTML = '已结束';
this.game_end = true;
}
}, },
watch: { watch: {
prizeNumber() { prizeNumber() {
...@@ -212,23 +224,36 @@ export default { ...@@ -212,23 +224,36 @@ export default {
methods: { methods: {
// 领取 // 领取
handleGet() { handleGet() {
console.log("中奖奖品信息", this.awardGood);
let params = {
couponId: this.awardGood.activityPrize.couponId,
unionId: this.userBaseInfo.unionid,
vipId: this.userBaseInfo.vipId
};
APi_Active.collectMyCoupon(params).then(res => {
this.showAward = false; this.showAward = false;
this.$toast( this.$toast(
"领取成功!奖品已经发送到您的会员账户,请进入欧亚小程序查看。" "领取成功!奖品已经发送到您的会员账户,请进入欧亚小程序查看。"
); );
});
}, },
GET_DetailById(id) { GET_DetailById(id) {
APi_Active.getActiveDetailById(id).then(res => { APi_Active.getActiveDetailById(id).then(res => {
console.log("获取到活动详情"); this.activityName = res.data.activityInfo.activityName;
this.activityName = res.data.activityName; this.des = res.data.activityInfo.des;
this.des = res.data.des; this.prizeDesc = res.data.activityInfo.prizeDesc;
this.prizeDesc = res.data.prizeDesc; let time = res.data.activityInfo.endTime;
// this.prizeListOrigin = res.data.list; this.timeLine =
`${time.substring(0, 4)}-${time.substring(4, 6)}-${time.substring(
6,
8
)}` + time.substring(8);
this.prizeListOrigin = res.data.list;
}); });
}, },
handleCheckAuth() { handleCheckAuth() {
this.showAuthDialog = false; this.showAuthDialog = false;
this.getUnionid(); // this.getUnionid();
}, },
getUnionid() { getUnionid() {
let redirect_uri = encodeURIComponent( let redirect_uri = encodeURIComponent(
...@@ -237,7 +262,12 @@ export default { ...@@ -237,7 +262,12 @@ export default {
window.location.href = `http://wxsyls.oysd.cn/getwxuserinfo.aspx?jump=${redirect_uri}`; window.location.href = `http://wxsyls.oysd.cn/getwxuserinfo.aspx?jump=${redirect_uri}`;
}, },
Start_Game() { Start_Game() {
if (!this.isMember) { if (this.game_end) {
this.$toast('活动已结束');
return;
}
console.log("会员基本信息", this.userBaseInfo);
if (!this.userBaseInfo.vipId) {
this.$toast("非会员,"); this.$toast("非会员,");
let url = "http://oysales.oywanhao.com/register"; let url = "http://oysales.oywanhao.com/register";
window.location.href = url; window.location.href = url;
...@@ -245,16 +275,24 @@ export default { ...@@ -245,16 +275,24 @@ export default {
} }
let params = { let params = {
activityId: this.active_id, activityId: this.active_id,
openId: this.$route.query.openId, openId: this.userBaseInfo.openid,
phone: this.userBaseInfo.phone, phone: this.userBaseInfo.phone,
unionId: this.$route.query.unionId, unionId: this.userBaseInfo.unionid,
userName: this.userBaseInfo.name userName: this.userBaseInfo.name
}; };
console.log("params", params);
if (this.rolling) return;
APi_Active.play(params) APi_Active.play(params)
.then(res => { .then(res => {
this.rolling = true;
const { wheelDeg, prizeList } = this;
// const random = parseInt(6 * Math.random(0, 5)); // const random = parseInt(6 * Math.random(0, 5));
console.log("抽奖结果", res.data);
if (!res.data.prizedId) {
this.res_error = true;
this.$toast(res.data.message);
return;
}
const { wheelDeg, prizeList } = this;
this.rolling = true;
const random = prizeList const random = prizeList
.map(item => item.id) .map(item => item.id)
.indexOf(res.data.prizeId); .indexOf(res.data.prizeId);
...@@ -264,7 +302,7 @@ export default { ...@@ -264,7 +302,7 @@ export default {
6 * 360 - 6 * 360 -
(360 / prizeList.length) * random; (360 / prizeList.length) * random;
setTimeout(() => { setTimeout(() => {
this.awardGood = prizeList[random] || ""; this.awardGood = res.data;
this.rolling = false; this.rolling = false;
this.showAward = true; this.showAward = true;
this.isAward = res.data.prizeName !== "谢谢惠顾"; this.isAward = res.data.prizeName !== "谢谢惠顾";
...@@ -296,7 +334,7 @@ export default { ...@@ -296,7 +334,7 @@ export default {
} }
}, },
destroyed() { destroyed() {
clearInterval(this.timer) clearInterval(this.timer);
} }
}; };
</script> </script>
......
...@@ -414,9 +414,8 @@ export default { ...@@ -414,9 +414,8 @@ export default {
// console.log(val); // console.log(val);
}, },
handleCreate() { handleCreate() {
console.log("创建活动");
let params_prizeList = []; let params_prizeList = [];
let total_probability = 0;
this.prizeList.forEach((p, index) => { this.prizeList.forEach((p, index) => {
let temp = {}; let temp = {};
temp.id = index; temp.id = index;
...@@ -427,15 +426,18 @@ export default { ...@@ -427,15 +426,18 @@ export default {
temp.prizeType = 1; temp.prizeType = 1;
temp.prizeName = "谢谢惠顾"; temp.prizeName = "谢谢惠顾";
} }
temp.startTime = p.startTime1;
temp.endTime = p.endTime1;
temp.quantity = p.total_limit; temp.quantity = p.total_limit;
temp.personLimit = p.limit; temp.personLimit = p.limit;
temp.probability = p.probability; temp.probability = p.probability;
total_probability += Number(p.probability);
temp.limitReceive = p.preLimit; temp.limitReceive = p.preLimit;
temp.coupon_id = p.checked_coupon.couponId; temp.coupon_id = p.checked_coupon.couponId;
params_prizeList.push(temp); params_prizeList.push(temp);
}); });
if (total_probability != 100) {
this.$toast('所有奖项概率之和必须为100%');
return;
}
let params = { let params = {
activityInfo: { activityInfo: {
id: 0, id: 0,
...@@ -448,13 +450,12 @@ export default { ...@@ -448,13 +450,12 @@ export default {
joinLimit: this.basicInfo.jointimes, joinLimit: this.basicInfo.jointimes,
totalLimit: this.basicInfo.total_join, totalLimit: this.basicInfo.total_join,
desc: this.message, des: this.message,
image: JSON.stringify(this.fileList), image: JSON.stringify(this.fileList),
prizeDesc: this.prize_produce prizeDesc: this.prize_produce
}, },
activityPrizes: params_prizeList activityPrizes: params_prizeList
}; };
console.log(params);
API_Active.createActive(params).then(res => { API_Active.createActive(params).then(res => {
if (res.result === "fail") { if (res.result === "fail") {
this.$toast(res.errorMsg); this.$toast(res.errorMsg);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</div> </div>
<div class="main-menus"> <div class="main-menus">
<div class="menus-row"> <div class="menus-row">
<div class="menu" @click="menu02Click" :style="flag == 1? '' : 'margin-right:10px;' " > <div class="menu" @click="menu02Click" :style="flag == 1? '' : 'margin-right:10px;' ">
<img class="menu-logo" :src="test.menuInfo.icon['2']" /> <img class="menu-logo" :src="test.menuInfo.icon['2']" />
<div class="menu-text">任务列表</div> <div class="menu-text">任务列表</div>
</div> </div>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<img class="menu-logo" :src="test.menuInfo.icon['4']" /> <img class="menu-logo" :src="test.menuInfo.icon['4']" />
<div class="menu-text">专柜维护</div> <div class="menu-text">专柜维护</div>
</div> </div>
<div class="menu margin2" @click="handleCoupon" v-if="flag == 1"> <div class="menu margin1" @click="handleCoupon" v-if="flag == 1">
<img class="menu-logo" :src="test.menuInfo.icon['1']" /> <img class="menu-logo" :src="test.menuInfo.icon['1']" />
<div class="menu-text">优惠券管理</div> <div class="menu-text">优惠券管理</div>
</div> </div>
...@@ -54,14 +54,20 @@ ...@@ -54,14 +54,20 @@
<div class="actives-banners"> <div class="actives-banners">
<div class="actives-banner-title">现有开展活动</div> <div class="actives-banner-title">现有开展活动</div>
</div> </div>
<p v-if="currentActives.length === 0" style="font-size: 16px;">当前暂无活动</p>
<template v-for="(item, index) in currentActives"> <template v-for="(item, index) in currentActives">
<div v-if="index < active_limit" :key="item.id" class="actives-main"> <div
v-if="index < active_limit"
:key="item.id"
class="actives-main"
@click="toDetail(item.id, item.activityType)"
>
<div class="active-logos"> <div class="active-logos">
<!-- <img class="active-logo" :src="test.activeInfo.icon['1']" /> --> <!-- <img class="active-logo" :src="test.activeInfo.icon['1']" /> -->
<img class="active-logo" :src="item.logo" /> <img class="active-logo" :src="item.logo" />
</div> </div>
<div class="active-infos"> <div class="active-infos">
<div class="active-title">{{item.activityName}}}</div> <div class="active-title">{{item.activityName}}</div>
<div class="active-dsc">{{item.des}}</div> <div class="active-dsc">{{item.des}}</div>
</div> </div>
</div> </div>
...@@ -246,12 +252,22 @@ export default { ...@@ -246,12 +252,22 @@ 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();
}, },
methods: { methods: {
// 跳转到 活动详情
toDetail(active_id, type) {
this.$router.push({
path: "/activeDetail",
query: {
id: active_id,
active_type: type
}
});
},
handleMore() { handleMore() {
this.active_limit += 3; this.active_limit += 3;
if (this.active_limit === this.currentActives.length - 3) { if (this.active_limit === this.currentActives.length - 3) {
...@@ -262,7 +278,7 @@ export default { ...@@ -262,7 +278,7 @@ export default {
// 获取当前 活动 // 获取当前 活动
GET_CurrentActive() { GET_CurrentActive() {
getCurrentActive().then(res => { getCurrentActive().then(res => {
this.currentActives = res.data; this.currentActives = res.data || [];
}); });
}, },
// 获取用户角色 // 获取用户角色
......
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