Commit fae1fade authored by leiqingsong's avatar leiqingsong

活动模块前端细节处理1

parent 7e806b05
......@@ -69,9 +69,13 @@ export function getAllCouponsByOyStallCode(id) {
})
}
export function getUserBaseInfo(code) {
/**
* 现有开展活动
*/
export function getCurrentActive() {
return request({
url: `activity/getUserInfo?code=${code}`,
url: `activity/underway`,
method: 'get'
})
}
\ No newline at end of file
}
export function CoutDown(Endtime) {
let leftTime = (new Date(Endtime)) - new Date(); //计算剩余的毫秒数
let days = parseInt(leftTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数
let hours = parseInt(leftTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时
let minutes = parseInt(leftTime / 1000 / 60 % 60, 10);//计算剩余的分钟
let seconds = parseInt(leftTime / 1000 % 60, 10);//计算剩余的秒数
days = checkTime(days);
hours = checkTime(hours);
minutes = checkTime(minutes);
seconds = checkTime(seconds);
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;
}
function checkTime(i) { //将0-9的数字前面加上0,例1变为01
if (i < 10) {
i = "0" + i;
}
return i;
}
}
\ No newline at end of file
<template>
<div id="active-detail">
<img class="bg" src="../../../public/img/activeDetail_bg.jpg" alt="bg" />
<template v-if="type === 'coupon'">
<template v-if="active_type === 'coupon'">
<div class="coupon">
<div class="user-icon">用户头像</div>
<p class="slogan">送你限量优惠券,手慢无~</p>
......@@ -22,12 +22,13 @@
<div class="btn">立即领取</div>
</div>
</template>
<template v-if="type === 'wheel'">
<template v-if="active_type === 'wheel'">
<div class="wheel-container">
<p class="title">{{ activityName }}</p>
<div class="wheel">
<div class="wheel-point" @click="Start_Game"></div>
<img src="../../../public/img/wheel.png" alt="wheel" />
<div class="circle"></div>
<div
class="wheel-bg"
:class="{freeze: freeze}"
......@@ -41,7 +42,7 @@
>
<div class="prize-name">{{ item.name }}</div>
<div class="prize-icon">
<img :src="item.icon" />
<img src="/img/counter.png" />
</div>
</div>
</div>
......@@ -59,7 +60,7 @@
</div>
<div class="time-line">
距离结束仅剩
<span>16天10:45:38</span>
<span id="timer"></span>
</div>
<div class="description">
<div class="t">活动介绍</div>
......@@ -67,12 +68,16 @@
</div>
</div>
</template>
<div class="btn-share" :style="type === 'coupon'? 'bottom: 0': ''" @click="handleShare">立即分享</div>
<div
class="btn-share"
:style="active_type === 'coupon'? 'bottom: 0': ''"
@click="handleShare"
>立即分享</div>
<van-overlay :show="showAward" @click="showAward = false">
<div class="wrapper" @click.stop>
<div v-if="isAward" class="block">
<p style="font-size: 20px;font-weight: bold;">OLAY全场通用抵扣券</p>
<p style="font-size: 20px;font-weight: bold;">一等奖</p>
<p style="font-size: 20px;font-weight: bold;">{{ awardGood.prizeName }}</p>
<p style="font-size: 20px;font-weight: bold;">恭喜您中奖!</p>
<van-button style="background: #f00;color: #fff;" @click="handleGet">领取奖品</van-button>
<van-button style="border-color: #7f7777;" @click="showAward = false">继续抽奖</van-button>
......@@ -83,7 +88,6 @@
</div>
</div>
</van-overlay>
<wx-auth :show-auth="showAuthDialog" @confirm="handleCheckAuth"></wx-auth>
</div>
</template>
......@@ -92,11 +96,14 @@
import axios from "axios";
import wxAuth from "@/components/wxAuth";
import * as APi_Active from "@/api/active";
import { CoutDown } from "@/utils/Foundation";
export default {
name: "active-detail",
components: { wxAuth },
data() {
return {
timer: null,
timeLine: "1586628005000",
isAward: false,
showAward: false,
userBaseInfo: "",
......@@ -110,7 +117,7 @@ export default {
userId: "",
code: "",
active_id: "",
type: "coupon",
active_type: "coupon",
freeze: false,
rolling: false,
wheelDeg: 0,
......@@ -149,40 +156,41 @@ export default {
],
activityName: "",
prizeDesc: "",
des: ""
des: "",
awardGood: {
prizeName: ""
}
};
},
async created() {
console.log("活动详情1");
this.currentUrl = location.href;
this.active_id = this.$route.query.id;
this.type = this.$route.query.type;
this.active_type = this.$route.query.active_type;
console.log("query", this.$route.query);
// 验证用户是否登录
if (!sessionStorage.getItem("userId")) {
// 1.获取code
if (this.$route.query.code === undefined) {
this.showAuthDialog = true;
if (this.$route.query.unionid === undefined) {
// this.showAuthDialog = true;
// this.getUnionid();
} else {
this.userBaseInfo = await this.getUserBaseInfo(this.$route.query.code);
console.log("userbaseInfo", this.userBaseInfo);
if (this.userBaseInfo.unionid) {
let params = {
number: 7,
unionId: this.userBaseInfo.unionid
};
APi_Active.isMember(params).then(res => {
this.isMember = res.data.vipId !== "";
this.userBaseInfo.phone = res.data.mobile ? res.data.mobile : "";
});
} else {
console.log("没有unionid");
this.isMember = false;
}
let params = {
number: 7,
unionId: this.$route.query.unionid
};
APi_Active.isMember(params).then(res => {
this.isMember = res.data.vipId !== "";
this.userBaseInfo.mobile = res.data.mobile;
this.userBaseInfo.name = res.data.name;
});
}
}
},
mounted() {
this.timer = setInterval(() => {
CoutDown('2020-5-13 2:5:47');
}, 1000);
this.getAgentAuth();
this.GET_DetailById(this.active_id);
},
......@@ -205,7 +213,9 @@ export default {
// 领取
handleGet() {
this.showAward = false;
this.$toast('领取成功!奖品已经发送到您的会员账户,请进入欧亚小程序查看。')
this.$toast(
"领取成功!奖品已经发送到您的会员账户,请进入欧亚小程序查看。"
);
},
GET_DetailById(id) {
APi_Active.getActiveDetailById(id).then(res => {
......@@ -213,64 +223,18 @@ export default {
this.activityName = res.data.activityName;
this.des = res.data.des;
this.prizeDesc = res.data.prizeDesc;
// this.prizeListOrigin = res.data.list;
});
},
handleCheckAuth() {
this.showAuthDialog = false;
this.getAuthCode();
},
async getUserBaseInfo(code) {
const res = await APi_Active.getUserBaseInfo(code);
return res;
},
// 获取code
getAuthCode() {
// alert('获取code')
const basicInfo = {
head: "https://open.weixin.qq.com/connect/oauth2/authorize?",
appId: "ww4df265003b43fa0d",
redirectUrI: encodeURIComponent(
`oysales.oywanhao.com:8087/activeDetail?id=${this.active_id}&type=${this.type}`
),
responseType: "code",
scope: "snsapi_base",
state: "ztest",
tail: "#wechat_redirect"
};
let url =
basicInfo.head +
"appid=" +
basicInfo.appId +
"&redirect_uri=" +
basicInfo.redirectUrI +
"&response_type=" +
basicInfo.responseType +
"&scope=" +
basicInfo.scope +
"&state=" +
basicInfo.state +
basicInfo.tail;
window.location.href = url;
this.getUnionid();
},
getUnionid() {
// window.location.href = 'http://wxmc.oysd.cn/GetWXUserInfo.aspx'
// 获取用户 unionid、openid
// http://wxmc.oysd.cn/GetWXUserInfo.aspx
// axios({
// url: `http://wxmc.oysd.cn/GetWXUserInfo.aspx`,
// method: 'get'
// }).then(res => {
// console.log(res);
// this.unionid = res.msg.unionid;
// this.openid = res.msg.openid;
// let params = {
// number: 7,
// unionId: this.unionid
// }
// APi_Active.isMember(params).then(res => {
// this.isMember = res.data.vipId !== '';
// })
// })
let redirect_uri = encodeURIComponent(
`oysales.oywanhao.com:8087/activeDetail?id=${this.active_id}&active_type=${this.active_type}`
);
window.location.href = `http://wxsyls.oysd.cn/getwxuserinfo.aspx?jump=${redirect_uri}`;
},
Start_Game() {
if (!this.isMember) {
......@@ -281,23 +245,26 @@ export default {
}
let params = {
activityId: this.active_id,
openId: this.userBaseInfo.openId,
openId: this.$route.query.openId,
phone: this.userBaseInfo.phone,
unionId: this.userBaseInfo.unionId,
// userId:
userName: this.getUserBaseInfo.nickname
unionId: this.$route.query.unionId,
userName: this.userBaseInfo.name
};
APi_Active.play(params)
.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));
const random = prizeList
.map(item => item.id)
.indexOf(res.data.prizeId);
this.wheelDeg =
wheelDeg -
(wheelDeg % 360) +
6 * 360 -
(360 / prizeList.length) * random;
setTimeout(() => {
this.awardGood = prizeList[random] || "";
this.rolling = false;
this.showAward = true;
this.isAward = res.data.prizeName !== "谢谢惠顾";
......@@ -309,14 +276,12 @@ export default {
},
// 分享
handleShare() {
console.log("立即分享");
let url = `http://oysales.oywanhao.com:8087/activeDetail?id=${this.active_id}&type=${this.type}`;
console.log("url", url);
let url = `http://oysales.oywanhao.com:8087/activeDetail?id=${this.active_id}&active_type=${this.active_type}`;
wx.invoke(
"shareToExternalContact",
{
title: "大转盘", // 分享标题
desc: "抽奖活动", // 分享描述
title: `${this.activityName}`, // 分享标题
desc: `${this.des}`, // 分享描述
link: url, // 分享链接
imgUrl: "" // 分享封面
},
......@@ -329,6 +294,9 @@ export default {
}
);
}
},
destroyed() {
clearInterval(this.timer)
}
};
</script>
......
......@@ -2,102 +2,137 @@
<div class="container">
<div class="title">
<span>大转盘抽奖</span>
<span class="fr">查看更多<span class="icon">></span></span>
</div>
<div class="active">
<div class="list" v-for="item in activeList" :key="item.id" @click="toDetail(item.id, item.activityType)">
<div class="left"></div>
<template v-for="(item, index) in activeList">
<div
v-if="index < wheelActive_limit"
class="list"
:key="item.id"
@click="toDetail(item.id, item.activityType)"
>
<div class="left">
<img :src="item.logo" alt="logo" style="width:100%;height:100%;" />
</div>
<div class="right">
<h3>{{ item.activityName }}</h3>
<p>{{ item.des }}</p>
</div>
</div>
</div>
</template>
<span
class="more"
v-if="activeList.length && !activeList_finished"
@click="handleWheelActiveMore"
>
查看更多
<span class="icon">></span>
</span>
</div>
<div v-if="couponList.length > 0" class="fg">送券活动</div>
<div class="active">
<div class="list" v-for="item in couponList" :key="item.id" @click="toDetail(item.id, item.activityType)">
<div class="left"></div>
<div class="right">
<h3>{{ item.activityName }}</h3>
<p>{{ item.des }}</p>
</div>
<div
class="list"
v-for="item in couponList"
:key="item.id"
@click="toDetail(item.id, item.activityType)"
>
<div class="left"></div>
<div class="right">
<h3>{{ item.activityName }}</h3>
<p>{{ item.des }}</p>
</div>
</div>
</div>
</div>
</template>
<script>
import * as API_Active from '@/api/active';
import * as API_Active from "@/api/active";
export default {
data() {
return {
wheelActive_limit: 3,
activeList_finished: false,
activeList: [
{
id: 1,
activityType: 'coupon',
activityName: '砍价',
des: '由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。'
activityType: "coupon",
activityName: "砍价",
des: "由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
},
{
id: 2,
activityType: 'wheel',
activityName: '集赞',
des: '由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。'
activityType: "wheel",
activityName: "集赞",
des: "由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
}
],
couponList: [
{
id: 1,
activityType: 'coupon',
activityName: '砍价',
des: '由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。'
activityType: "coupon",
activityName: "砍价",
des: "由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
},
{
id: 2,
activityType: 'wheel',
activityName: '集赞',
des: '由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。'
activityType: "wheel",
activityName: "集赞",
des: "由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
}
],
params: {
pageNo: 1,
pageSize: 10
}
}
};
},
mounted() {
this.getActiveList(this.params);
},
methods: {
handleWheelActiveMore() {
this.wheelActive_limit += 3;
if (this.wheelActive_limit === this.activeList.length - 3) {
this.activeList_finished = true;
return;
}
},
// 获取 活动列表
getActiveList(params) {
API_Active.getActiveList(params).then(res => {
console.log('获取到数据');
console.log("获取到数据");
this.activeList = res.data.list;
})
});
},
// 跳转到 活动详情
toDetail(active_id, type) {
this.$router.push({
path: '/activeDetail',
path: "/activeDetail",
query: {
id: active_id,
type: type
active_type: type
}
})
});
}
}
};
</script>
<style scoped>
.more {
float: right;
margin-bottom: 5px;
font-size: 12px;
}
.container {
height: auto;
background-color: rgba(248, 248, 248, 1);
min-height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
justify-content: flex-start;
}
.title {
height: 44px;
......@@ -114,7 +149,7 @@ export default {
font-size: 12px;
color: rgba(45, 71, 106, 1);
height: 44px;
line-height: 44px;
line-height: 44px;
}
.icon {
font-weight: 800;
......@@ -122,7 +157,7 @@ export default {
.active {
background-color: #fff;
padding: 12px 12px 0 12px;
box-shadow:0px 2px 4px 0px rgba(221,221,221,1);
box-shadow: 0px 2px 4px 0px rgba(221, 221, 221, 1);
}
.list {
height: 94px;
......@@ -130,19 +165,20 @@ export default {
background-color: #fff;
display: flex;
justify-content: space-between;
border-bottom: 1px solid rgba(238,238,238,1);
border-bottom: 1px solid rgba(238, 238, 238, 1);
margin-bottom: 14px;
}
.list3 {
border-bottom: none;
margin-bottom: 0;
}
.left,.right {
.left,
.right {
height: 80px;
}
.left {
width: 80px;
background:rgba(248,248,248,1);
width: 80px;
background: rgba(248, 248, 248, 1);
}
.right {
width: 76%;
......@@ -151,12 +187,12 @@ export default {
}
h3 {
font-size: 14px;
font-weight:bold;
color:rgba(45,71,106,1);
font-weight: bold;
color: rgba(45, 71, 106, 1);
}
p {
margin-top: 10px;
font-size:12px;
color:rgba(45,71,106,0.8);
font-size: 12px;
color: rgba(45, 71, 106, 0.8);
}
</style>
......@@ -127,7 +127,13 @@
<van-field class="right" v-model="prizeList[index].name" placeholder="请输入奖项名称" />
</template>
</van-cell>
<van-cell title="选择优惠券" value="1" is-link @click="show = true" center />
<van-cell
title="选择优惠券"
:value="prizeList[index].checked_coupon.name"
is-link
@click="handleCheckCoupon(index)"
center
/>
<van-cell title="总发放数量限制" style="font-size:14px;">
<template slot="default">
<div class="jpsl">
......@@ -135,15 +141,15 @@
class="right noborder"
readonly
clickable
:value="prizeList[index].prize"
:value="prizeList[index].total_limit"
placeholder="请输入限制次数"
@touchstart.native.stop="prizeList[index].prizeShow = true"
@touchstart.native.stop="prizeList[index].total_limit_show = true"
/>
<van-number-keyboard
v-model="prizeList[index].prize"
:show="prizeList[index].prizeShow"
v-model="prizeList[index].total_limit"
:show="prizeList[index].total_limit_show"
:maxlength="6"
@blur="prizeList[index].prizeShow = false"
@blur="prizeList[index].total_limit_show = false"
/>
</div>
</template>
......@@ -155,15 +161,15 @@
class="right noborder"
readonly
clickable
:value="prizeList[index].prize"
:value="prizeList[index].preLimit"
placeholder="请输入限制次数"
@touchstart.native.stop="prizeList[index].prizeShow = true"
@touchstart.native.stop="prizeList[index].preLimit_show = true"
/>
<van-number-keyboard
v-model="prizeList[index].prize"
:show="prizeList[index].prizeShow"
v-model="prizeList[index].preLimit"
:show="prizeList[index].preLimit_show"
:maxlength="6"
@blur="prizeList[index].prizeShow = false"
@blur="prizeList[index].preLimit_show = false"
/>
</div>
</template>
......@@ -175,15 +181,15 @@
class="right noborder"
readonly
clickable
:value="prizeList[index].prize"
:value="prizeList[index].limit"
placeholder="请输入限制数量"
@touchstart.native.stop="prizeList[index].prizeShow = true"
@touchstart.native.stop="prizeList[index].limit_show = true"
/>
<van-number-keyboard
v-model="prizeList[index].prize"
:show="prizeList[index].prizeShow"
v-model="prizeList[index].limit"
:show="prizeList[index].limit_show"
:maxlength="6"
@blur="prizeList[index].prizeShow = false"
@blur="prizeList[index].limit_show = false"
/>
</div>
</template>
......@@ -231,7 +237,7 @@
<!-- 活动图片 -->
<div class="detail" style="margin-top:0;">
<div class="des">活动图片</div>
<van-uploader v-model="fileList" multiple :max-count="9" />
<van-uploader v-model="fileList_show" multiple :max-count="9" :after-read="afterImgRead" />
</div>
<!-- 奖品介绍 -->
<div class="detail">
......@@ -250,7 +256,7 @@
</div>
<div class="creat" @click="handleCreate">创建活动</div>
<van-action-sheet v-model="show" :actions="coupons" cancel-text="取消" />
<van-action-sheet v-model="show" :actions="coupons" cancel-text="取消" @select="onSelect" />
</div>
</template>
......@@ -261,25 +267,23 @@ import { Toast } from "vant";
export default {
data() {
return {
// 选择优惠券 当前下标
current_index: -1,
logo_imgs: [],
bg_imgs: [],
show: false,
coupons: [
{ name: "选项" },
{ name: "选项" },
{ name: "选项", subname: "描述信息" }
],
coupons: [],
basicInfo: {
title: "第一个转盘活动",
title: "",
startTime: new Date(),
startTime1: "2020-04-09 08:25:25",
startTime1: "",
endTime: new Date(),
endTime1: "2020-04-10 18:25:25",
endTime1: "",
startShow: false,
endShow: false,
jointimes: "2",
jointimes: "",
jointimes_show: false,
total_join: "4",
total_join: "",
total_join_show: false
},
// 抽奖设置
......@@ -297,27 +301,30 @@ export default {
// 奖品设置
prizeList: [
{
name: "奖1",
timeLine_type: "1",
type: "1",
discountsMoney: "1",
name: "",
timeLine_type: "",
type: "",
discountsMoney: "",
discountsShow: false,
full: "",
fullMoney: "",
fullShow: false,
validity: "",
startTime: new Date(),
startTime1: "2020-04-08 08:25:25",
startTime1: "",
startShow: false,
endTime: new Date(),
endTime1: "2020-04-16 18:25:25",
endTime1: "",
endShow: false,
prize: "1",
prizeShow: false,
limit: "1",
limitShow: false,
probability: "5",
probability_show: false
total_limit: "",
total_limit_show: false,
preLimit: "",
preLimit_show: false,
limit: "",
limit_show: false,
probability: "",
probability_show: false,
checked_coupon: {}
}
],
title: "",
......@@ -329,76 +336,104 @@ export default {
startShow: false,
endShow: false,
// 活动描述
message: "123",
message: "",
// 活动图片
fileList_show: [],
fileList: [],
prize_produce: "456",
prize_produce: "",
pTime: new Date(),
confirmTime: new Date()
};
},
methods: {
handleCheckCoupon(index) {
this.show = true;
this.current_index = index;
},
onSelect(val) {
this.prizeList[this.current_index].checked_coupon = val;
this.show = false;
},
getCoupons() {
let id = sessionStorage.getItem("oyStallCode") || 1;
API_Active.getAllCouponsByOyStallCode(id).then(res => {
this.coupons = res.data;
});
},
afterImgRead(file) {
if (file.length) {
// let imgs = [];
file.forEach(e => {
let params = new FormData();
params.append("file", e.file);
let url = "http://139.155.48.151:8084/admin/auth/util/saveImg";
axios.post(url, params).then(res => {
let img_url = JSON.parse(JSON.stringify(res.data.data.imgPath));
// imgs.push(img_url);
this.fileList.push(img_url);
});
});
} else {
let params = new FormData();
params.append("file", file.file);
let url = "http://139.155.48.151:8084/admin/auth/util/saveImg";
axios.post(url, params).then(res => {
this.fileList.push(JSON.parse(JSON.stringify(res.data.data.imgPath)));
});
}
console.log(this.fileList);
},
async afterLogoRead(file) {
let logo_img = await this.getImgUrl(file.file);
if (logo_img.result === "success") {
let item = {
url: bg_img.data.imgPath,
status: "done",
message: "上传成功"
};
this.logo_imgs.push(item);
}
let item = {
url: logo_img,
status: "done",
message: "上传成功"
};
this.logo_imgs[0] = item;
},
async afterBGRead(file) {
let bg_img = await this.getImgUrl(file.file);
if (bg_img.result === "success") {
let item = {
url: bg_img.data.imgPath,
status: "done",
message: "上传成功"
};
this.bg_imgs.push(item);
}
let item = {
url: bg_img,
status: "done",
message: "上传成功"
};
this.bg_imgs[0] = item;
},
// 上传图片
async getImgUrl(file) {
let params = new FormData();
params.append("file", file);
let url = "http://139.155.48.151:8084/admin/auth/util/saveImg";
const res = await axios.post(url, params);
return res;
const img = await axios.post(url, params);
let urls = img.data.data.imgPath;
return urls;
},
radioChange(val) {
// console.log(val);
},
handleCreate() {
console.log("创建活动");
console.log(this.basicInfo);
console.log(this.LuckyDraw);
console.log(this.prizeList);
console.log(this.message);
console.log(this.fileList);
let params_prizeList = [];
this.prizeList.forEach(p => {
this.prizeList.forEach((p, index) => {
let temp = {};
temp.id = index;
temp.prizeName = p.name;
if (p.type == 1) {
temp.prizeType = 2;
} else if (p.type === 2) {
temp.prizeType = 3;
} else if (p.type == 2) {
temp.prizeType = 1;
temp.prizeName = "谢谢惠顾";
}
temp.startTime = p.startTime1;
temp.endTime = p.endTime1;
temp.quantity = p.prize;
temp.quantity = p.total_limit;
temp.personLimit = p.limit;
temp.probability = p.probability;
temp.limitReceive = p.limit;
temp.limitReceive = p.preLimit;
temp.coupon_id = p.checked_coupon.couponId;
params_prizeList.push(temp);
});
let params = {
......@@ -553,6 +588,7 @@ export default {
}
this.prizeList.push({
name: "",
timeLine_type: "",
type: "",
discountsMoney: "",
discountsShow: false,
......@@ -566,10 +602,15 @@ export default {
endTime: new Date(),
endTime1: "",
endShow: false,
prize: "",
prizeShow: false,
total_limit: "",
total_limit_show: false,
preLimit: "",
preLimit_show: false,
limit: "",
limitShow: false
limit_show: false,
probability: "",
probability_show: false,
checked_coupon: {}
});
},
removePrice(index) {
......
<template>
<div id="more">
</div>
</template>
<script>
export default {
name: 'more',
components: {},
data() {
return {
}
}
}
</script>
<style lang="scss">
</style>
......@@ -4,10 +4,7 @@
<div class="manInfo-logos">
<img class="logos-logo" :src="test.manInfo.logoUrl" />
</div>
<div
class="manInfo-name"
@click="manInfoClick"
>我的专柜:{{test.manInfo.barName}}</div>
<div class="manInfo-name" @click="manInfoClick">我的专柜:{{test.manInfo.barName}}</div>
<div class="manInfo-switch" @click="switchBarClick">
<div class="switch-text">切换</div>
<img class="switch-icon" :src="test.manInfo.icon['1']" />
......@@ -17,7 +14,8 @@
<div class="tips-tip">店铺粉丝 {{test.barInfo.fans}}</div>
<div class="tips-tip">个人粉丝 {{test.barInfo.personalFans}}</div>
<div class="tips-tip">
昨日新增 <span>{{test.barInfo.newFans}}</span>
昨日新增
<span>{{test.barInfo.newFans}}</span>
<span>/</span>
<span>{{test.barInfo.allNewFans}}</span>
</div>
......@@ -56,16 +54,19 @@
<div class="actives-banners">
<div class="actives-banner-title">现有开展活动</div>
</div>
<div class="actives-main">
<div class="active-logos">
<img class="active-logo" :src="test.activeInfo.icon['1']" />
</div>
<div class="active-infos">
<div class="active-title">大转盘</div>
<div class="active-dsc">{{test.cache.actDsc}}</div>
<template v-for="(item, index) in currentActives">
<div v-if="index < active_limit" :key="item.id" class="actives-main">
<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-dsc">{{item.des}}</div>
</div>
</div>
</div>
<div class="actives-main">
</template>
<!-- <div class="actives-main">
<div class="active-logos">
<img class="active-logo" :src="test.activeInfo.icon['2']" />
</div>
......@@ -82,8 +83,8 @@
<div class="active-title">集卡</div>
<div class="active-dsc">{{test.cache.actDsc}}</div>
</div>
</div>
<div class="actives-mores">
</div>-->
<div v-if="currentActives.length > 3 && !finished" class="actives-mores" @click="handleMore">
<div class="mores-title">查看更多</div>
<img class="mores-icon" :src="test.cache.arrowRightDark" />
</div>
......@@ -115,14 +116,22 @@
<script>
import axios from "axios";
import { getStoreDetail, getMemberListByCode, getDirector } from "@/api/sidebar/voucher";
import {
getStoreDetail,
getMemberListByCode,
getDirector
} from "@/api/sidebar/voucher";
import { configWx, getUserInfo } from "@/utils/aCommon";
import { getUserInfoByUserId } from "@/api/sidebar/voucher";
import { log } from 'util';
import { getCurrentActive } from "@/api/active";
import { log } from "util";
export default {
name: "discountIndex",
data() {
return {
finished: false,
active_limit: 3,
currentActives: [],
test: {
cache: {
imgUrl: "/hi.jpg",
......@@ -143,7 +152,7 @@ export default {
fans: "299",
personalFans: "77",
newFans: "11",
allNewFans: '15'
allNewFans: "15"
},
menuInfo: {
icon: {
......@@ -210,55 +219,69 @@ export default {
userInfoResNew: ""
},
flag: 1
}
};
},
created() {
this.checkNowMenuBar()
if(sessionStorage.getItem('userId')) {
if(sessionStorage.getItem('avatar')) {
this.test.manInfo.logoUrl = sessionStorage.getItem('avatar')
this.checkNowMenuBar();
if (sessionStorage.getItem("userId")) {
if (sessionStorage.getItem("avatar")) {
this.test.manInfo.logoUrl = sessionStorage.getItem("avatar");
}
if(sessionStorage.getItem('personalFan')) {
this.test.barInfo.personalFans = sessionStorage.getItem('personalFan')
if (sessionStorage.getItem("personalFan")) {
this.test.barInfo.personalFans = sessionStorage.getItem("personalFan");
}
if(sessionStorage.getItem('barName')) {
this.test.manInfo.barName = sessionStorage.getItem('barName')
if (sessionStorage.getItem("barName")) {
this.test.manInfo.barName = sessionStorage.getItem("barName");
}
if(sessionStorage.getItem('allFans')) {
this.test.barInfo.fans = sessionStorage.getItem('allFans')
if (sessionStorage.getItem("allFans")) {
this.test.barInfo.fans = sessionStorage.getItem("allFans");
}
if(sessionStorage.getItem('newFans')) {
this.test.barInfo.newFans = sessionStorage.getItem('newFans')
if (sessionStorage.getItem("newFans")) {
this.test.barInfo.newFans = sessionStorage.getItem("newFans");
}
if(sessionStorage.getItem('allNewFans')) {
this.test.barInfo.allNewFans = sessionStorage.getItem('allNewFans')
if (sessionStorage.getItem("allNewFans")) {
this.test.barInfo.allNewFans = sessionStorage.getItem("allNewFans");
}
if(sessionStorage.getItem('role')) {
this.flag = sessionStorage.getItem('role')
if (sessionStorage.getItem("role")) {
this.flag = sessionStorage.getItem("role");
}
}else {
} else {
this.zReadyUserId()
this.zTestGetNowUrlInfo()
this.zTestGetNowUrlInfo();
}
this.GET_CurrentActive();
},
methods: {
handleMore() {
this.active_limit += 3;
if (this.active_limit === this.currentActives.length - 3) {
this.finished = true;
return;
}
},
// 获取当前 活动
GET_CurrentActive() {
getCurrentActive().then(res => {
this.currentActives = res.data;
});
},
// 获取用户角色
getDirector(userId) {
getDirector({userId}).then(res => {
if(res.data == true) {
this.flag = 1
}else {
this.flag = 2
}
sessionStorage.setItem("role", this.flag)
})
getDirector({ userId }).then(res => {
if (res.data == true) {
this.flag = 1;
} else {
this.flag = 2;
}
sessionStorage.setItem("role", this.flag);
});
},
// 获取用户信息
getUserInfo() {
let headerData = {
agentId: "1000033",
corpId: "ww4df265003b43fa0d"
}
};
axios({
url:
"http://139.155.48.151:8085/workWx/auth/user/get?userId=" +
......@@ -267,10 +290,10 @@ export default {
headers: headerData
})
.then(res => {
this.test.manInfo.barFrom = res.data.data.name
sessionStorage.setItem("barFrom", res.data.data.name)
this.test.manInfo.logoUrl = res.data.data.avatar
sessionStorage.setItem("avatar", res.data.data.avatar)
this.test.manInfo.barFrom = res.data.data.name;
sessionStorage.setItem("barFrom", res.data.data.name);
this.test.manInfo.logoUrl = res.data.data.avatar;
sessionStorage.setItem("avatar", res.data.data.avatar);
})
.catch(err => {
console.log(err);
......@@ -290,8 +313,8 @@ export default {
headers: headerData
})
.then(res => {
this.test.barInfo.personalFans = res.data.data.length
sessionStorage.setItem("personalFan", res.data.data.length)
this.test.barInfo.personalFans = res.data.data.length;
sessionStorage.setItem("personalFan", res.data.data.length);
})
.catch(err => {
console.log(err);
......@@ -301,68 +324,74 @@ export default {
let headerData = {
agentId: "1000033",
corpId: "ww4df265003b43fa0d"
}
};
axios({
url: "http://139.155.48.151:8085/workWx/auth/contact/getCustomerInfoByOyStallCode?oyStallCode=" + this.oyStallCode,
url:
"http://139.155.48.151:8085/workWx/auth/contact/getCustomerInfoByOyStallCode?oyStallCode=" +
this.oyStallCode,
method: "get",
headers: headerData
})
.then(res => {
console.log(res,'粉丝')
this.test.barInfo.fans = res.data.data.length
sessionStorage.setItem("allFans", res.data.data.length)
console.log(res, "粉丝");
this.test.barInfo.fans = res.data.data.length;
sessionStorage.setItem("allFans", res.data.data.length);
})
.catch(err => {
console.log(err)
})
console.log(err);
});
},
getNewFans() {
this.getAddFans(1,this.zcache.userId)
getNewFans() {
this.getAddFans(1, this.zcache.userId);
},
getAllNewFans() {
getAllNewFans() {
let params = {
oyStallCode: this.oyStallCode
}
};
getMemberListByCode(params).then(res => {
console.log(res,'res');
this.getAddFans(2,res.data)
})
console.log(res, "res");
this.getAddFans(2, res.data);
});
},
getAddFans(flag,userId) {
let JsonStr = {}
if(flag == 1) {
JsonStr.userid = [userId]
}else {
JsonStr.userid = userId
getAddFans(flag, userId) {
let JsonStr = {};
if (flag == 1) {
JsonStr.userid = [userId];
} else {
JsonStr.userid = userId;
}
let timeNow = Math.round(new Date() / 1000)
JsonStr.start_time = timeNow-24*60*60
JsonStr.end_time = timeNow
console.log(JsonStr,'obj')
let timeNow = Math.round(new Date() / 1000);
JsonStr.start_time = timeNow - 24 * 60 * 60;
JsonStr.end_time = timeNow;
console.log(JsonStr, "obj");
axios({
url: "http://139.155.48.151:8085/workWx/auth/contact/getUserBehaviorData",
url:
"http://139.155.48.151:8085/workWx/auth/contact/getUserBehaviorData",
method: "post",
headers: {
'Content-Type': 'application/json',
'agentId': "1000033",
'corpId': "ww4df265003b43fa0d"
},
"Content-Type": "application/json",
agentId: "1000033",
corpId: "ww4df265003b43fa0d"
},
data: JsonStr
})
.then(res => {
let data = JSON.parse(res.data.data)
if(flag == 1) {
this.test.barInfo.newFans = data.behavior_data[0].new_contact_cnt + data.behavior_data[1].new_contact_cnt
sessionStorage.setItem("newFans", this.test.barInfo.newFans)
}else {
this.test.barInfo.allNewFans = data.behavior_data[0].new_contact_cnt + data.behavior_data[1].new_contact_cnt
sessionStorage.setItem("allNewFans", this.test.barInfo.allNewFans)
}
.then(res => {
let data = JSON.parse(res.data.data);
if (flag == 1) {
this.test.barInfo.newFans =
data.behavior_data[0].new_contact_cnt +
data.behavior_data[1].new_contact_cnt;
sessionStorage.setItem("newFans", this.test.barInfo.newFans);
} else {
this.test.barInfo.allNewFans =
data.behavior_data[0].new_contact_cnt +
data.behavior_data[1].new_contact_cnt;
sessionStorage.setItem("allNewFans", this.test.barInfo.allNewFans);
}
})
.catch(err => {
console.log(err)
})
console.log(err);
});
},
// 获取店铺信息
getStore() {
......@@ -370,16 +399,18 @@ export default {
oyStallCode: this.oyStallCode
};
getStoreDetail(params).then(res => {
if(res.data.stallInfo != null) {
this.test.manInfo.barName = res.data.stallInfo.name
sessionStorage.setItem("barName", res.data.stallInfo.name)
if (res.data.stallInfo != null) {
this.test.manInfo.barName = res.data.stallInfo.name;
sessionStorage.setItem("barName", res.data.stallInfo.name);
}
});
},
checkNowMenuBar() {
let inData = "1";
this.test.menuBarInfo.icon.now = this.test.menuBarInfo.icon.ua;
this.test.menuBarInfo.icon.now[inData] = this.test.menuBarInfo.icon.ac[inData];
this.test.menuBarInfo.icon.now[inData] = this.test.menuBarInfo.icon.ac[
inData
];
},
manInfoClick() {
this.$router.push("counterInfo");
......@@ -395,22 +426,22 @@ export default {
testButtonClick() {},
menu01Click() {},
menu02Click() {
this.$router.push("Task")
this.$router.push("Task");
},
menu03Click() {
this.$router.push("activeList")
this.$router.push("activeList");
},
menu04Click() {
this.$router.push("counterInfo")
this.$router.push("counterInfo");
},
menu05Click() {
this.$router.push("ActTemplate")
this.$router.push("ActTemplate");
},
menu06Click() {
this.$router.push("goodManage")
this.$router.push("goodManage");
},
handleCoupon() {
this.$router.push("coupon")
this.$router.push("coupon");
},
buttonMainMarketingClick() {
// this.$router.push("home")
......@@ -431,11 +462,11 @@ export default {
zReadyUserId() {
if (this.$route.query.code === undefined) {
// alert('没code')
this.zTestPreAuthCode()
this.zTestPreAuthCode();
} else {
// alert('有code')
this.zTestGetNowUrlInfo()
this.zTestGetUserInfoByOldToken()
this.zTestGetNowUrlInfo();
this.zTestGetUserInfoByOldToken();
}
},
// 测试-获取当前Url信息
......@@ -484,7 +515,9 @@ export default {
};
this.zcache.userInfoResOld = "PostData:" + JSON.stringify(postData);
axios({
url: "http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code=" + this.zcache.code,
url:
"http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code=" +
this.zcache.code,
method: "post",
headers: headerData
})
......@@ -493,8 +526,8 @@ export default {
this.zcache.userId = String(res.data.data.userId);
this.getUserFromId(this.zcache.userId);
this.getUserInfo();
this.getNewFans()
this.getDirector(res.data.data.userId)
this.getNewFans();
this.getDirector(res.data.data.userId);
})
.catch(err => {
console.log(err);
......@@ -504,15 +537,15 @@ export default {
let userName = id;
getUserInfoByUserId({ userName })
.then(res => {
sessionStorage.setItem("oyStallCode", res.data[0].oyStallCode)
this.oyStallCode = res.data[0].oyStallCode
this.getStore()
this.getFans()
this.getAllFans()
this.getNewFans()
this.getAllNewFans()
sessionStorage.setItem("oyStallCode", res.data[0].oyStallCode);
this.oyStallCode = res.data[0].oyStallCode;
this.getStore();
this.getFans();
this.getAllFans();
this.getNewFans();
this.getAllNewFans();
})
.catch(err => {})
.catch(err => {});
}
}
};
......@@ -686,7 +719,6 @@ export default {
.main-actives {
/*border: 1px solid lightcoral;*/
width: 100%;
height: 380px;
/*margin-bottom: 94px;*/
margin-top: 36px;
padding: 0px 12px;
......
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