Commit 3f3b03b5 authored by xd's avatar xd

解决冲突

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