Commit e967ff4e authored by xd's avatar xd

测试精准营销活动页数据显示

parent f1d838da
...@@ -227,12 +227,15 @@ export default { ...@@ -227,12 +227,15 @@ export default {
userInfoResNew: "" userInfoResNew: ""
}, },
flag: 1, flag: 1,
overlayShow: false overlayShow: false,
memberList: []
}; };
}, },
created() { created() {
console.log('created') this.overlayShow = true
this.checkNowMenuBar() this.checkNowMenuBar()
// this.zcache.userId = 'ShanDian'
// this.getUserFromId(this.zcache.userId)
if (sessionStorage.getItem("userId")) { if (sessionStorage.getItem("userId")) {
if (sessionStorage.getItem("avatar")) { if (sessionStorage.getItem("avatar")) {
this.test.manInfo.logoUrl = sessionStorage.getItem("avatar"); this.test.manInfo.logoUrl = sessionStorage.getItem("avatar");
...@@ -296,104 +299,118 @@ export default { ...@@ -296,104 +299,118 @@ export default {
sessionStorage.setItem("role", this.flag); sessionStorage.setItem("role", this.flag);
}); });
}, },
// 获取用户信息 // 获取用户头像信息
getUserInfo() { getUserInfo() {
let headerData = { let headerData = {
agentId: "1000033", agentId: "1000033",
corpId: "ww4df265003b43fa0d" corpId: "ww4df265003b43fa0d"
}; }
axios({ return new Promise((resolve, reject) => {
axios({
url: url:
"http://139.155.48.151:8085/workWx/auth/user/get?userId=" + "http://139.155.48.151:8085/workWx/auth/user/get?userId=" + this.zcache.userId,
this.zcache.userId,
method: "get", method: "get",
headers: headerData headers: headerData
}) })
.then(res => { .then(res => {
this.test.manInfo.barFrom = res.data.data.name; sessionStorage.setItem("avatar", res.data.data.avatar)
sessionStorage.setItem("barFrom", res.data.data.name); resolve(res.data.data.avatar)
this.test.manInfo.logoUrl = res.data.data.avatar;
sessionStorage.setItem("avatar", res.data.data.avatar);
}) })
.catch(err => { .catch(err => {
console.log(err); reject(err)
}); });
})
}, },
// 获取个人粉丝 // 获取个人粉丝
getFans() { getFans() {
let headerData = { let headerData = {
agentId: "1000033", agentId: "1000033",
corpId: "ww4df265003b43fa0d" corpId: "ww4df265003b43fa0d"
}; }
axios({ return new Promise((resolve, reject) => {
url: axios({
"http://139.155.48.151:8085/workWx/auth/contact/listExternalContacts?userId=" + url:
this.zcache.userId, "http://139.155.48.151:8085/workWx/auth/contact/listExternalContacts?userId=" + this.zcache.userId,
method: "get", method: "get",
headers: headerData headers: headerData
})
.then(res => {
sessionStorage.setItem("personalFan", res.data.data.length)
resolve(res.data.data.length)
})
.catch(err => {
reject(err)
})
}) })
.then(res => {
this.test.barInfo.personalFans = res.data.data.length;
sessionStorage.setItem("personalFan", res.data.data.length);
})
.catch(err => {
console.log(err);
});
}, },
// 获取店铺所有粉丝 // 获取店铺所有粉丝
getAllFans() { getAllFans() {
let headerData = { let headerData = {
agentId: "1000033", agentId: "1000033",
corpId: "ww4df265003b43fa0d" corpId: "ww4df265003b43fa0d"
}; }
axios({ return new Promise((resolve, reject) => {
url: axios({
"http://139.155.48.151:8085/workWx/auth/contact/getCustomerInfoByOyStallCode?oyStallCode=" + url: "http://139.155.48.151:8085/workWx/auth/contact/getCustomerInfoByOyStallCode?oyStallCode=" + this.oyStallCode,
this.oyStallCode, method: "get",
method: "get", headers: headerData
headers: headerData })
})
.then(res => { .then(res => {
console.log(res, "粉丝");
let newList = [] let newList = []
res.data.data.forEach(item => { res.data.data.forEach(item => {
if(item != null) { if(item != null) {
newList.push(item) newList.push(item)
} }
}) })
this.test.barInfo.fans = newList.length
sessionStorage.setItem("allFans", newList.length) sessionStorage.setItem("allFans", newList.length)
resolve(newList.length)
}) })
.catch(err => { .catch(err => {
console.log(err) reject(err)
}); })
}, })
// 获取个人新增粉丝
getNewFans() {
this.getAddFans(1, this.zcache.userId);
}, },
// 获取店铺所有新增粉丝 // 获取店铺所有新增粉丝
// getAllNewFans() {
// let params = {
// oyStallCode: this.oyStallCode
// }
// return new Promise((resolve, reject) => {
// getMemberListByCode(params).then(res => {
// resolve(res.data)
// }).catch(err => {
// reject(err)
// })
// })
// },
getAllNewFans() { getAllNewFans() {
let params = { let params = {
oyStallCode: this.oyStallCode oyStallCode: this.oyStallCode
}; }
getMemberListByCode(params).then(res => { getMemberListByCode(params).then(res => {
console.log(res, "res"); this.memberList = res.data
this.getAddFans(2, res.data); this.getAllInfo(res.data)
}); }).catch(err => {
console.log(err);
})
}, },
getAddFans(flag, userId) { getAddFans(flag, userId) {
let JsonStr = {}; let JsonStr = {}
if (flag == 1) { if (flag == 1) {
JsonStr.userid = [userId]; JsonStr.userid = [userId];
} else { } else {
JsonStr.userid = userId; JsonStr.userid = userId
console.log(userId,'拿到吗')
} }
let timeNow = Math.round(new Date() / 1000); let timeNow = Math.round(new Date() / 1000);
JsonStr.start_time = timeNow - 24 * 60 * 60; JsonStr.start_time = timeNow - 24 * 60 * 60;
JsonStr.end_time = timeNow; JsonStr.end_time = timeNow;
console.log(JsonStr, "obj"); return new Promise((resolve, reject) => {
axios({ axios({
url: url:
"http://139.155.48.151:8085/workWx/auth/contact/getUserBehaviorData", "http://139.155.48.151:8085/workWx/auth/contact/getUserBehaviorData",
method: "post", method: "post",
...@@ -403,36 +420,63 @@ export default { ...@@ -403,36 +420,63 @@ export default {
corpId: "ww4df265003b43fa0d" corpId: "ww4df265003b43fa0d"
}, },
data: JsonStr data: JsonStr
}) }).then(res => {
.then(res => {
let data = JSON.parse(res.data.data); let data = JSON.parse(res.data.data);
if (flag == 1) { if (flag == 1) {
this.test.barInfo.newFans = // 获取个人新增粉丝
data.behavior_data[0].new_contact_cnt + let newFans = data.behavior_data[0].new_contact_cnt + data.behavior_data[1].new_contact_cnt;
data.behavior_data[1].new_contact_cnt; // 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); sessionStorage.setItem("newFans", newFans);
resolve(newFans)
} else { } else {
this.test.barInfo.allNewFans = console.log(data,'全部粉丝');
data.behavior_data[0].new_contact_cnt + let allNewFans = data.behavior_data[0].new_contact_cnt + data.behavior_data[1].new_contact_cnt;
data.behavior_data[1].new_contact_cnt; console.log(allNewFans,'allNewFans ');
sessionStorage.setItem("allNewFans", this.test.barInfo.allNewFans); // this.test.barInfo.allNewFans = data.behavior_data[0].new_contact_cnt + data.behavior_data[1].new_contact_cnt;
sessionStorage.setItem("allNewFans", allNewFans);
resolve(allNewFans)
} }
}) })
.catch(err => { .catch(err => {
console.log(err); reject(err)
}); })
})
}, },
// 获取店铺信息 // 获取店铺信息
getStore() { getStore() {
let params = { let params = {
oyStallCode: this.oyStallCode oyStallCode: this.oyStallCode
}; }
getStoreDetail(params).then(res => { return new Promise((resolve, reject) => {
if (res.data.stallInfo != null) { getStoreDetail(params).then(res => {
this.test.manInfo.barName = res.data.stallInfo.name if (res.data.stallInfo != null) {
sessionStorage.setItem("barName", res.data.stallInfo.name) this.test.manInfo.barName = res.data.stallInfo.name
} sessionStorage.setItem("barName", res.data.stallInfo.name)
}); resolve(res.data.stallInfo.name)
}
}).catch(err => {
reject(err)
})
})
},
getAllInfo(list) {
console.log('getAllInfo');
Promise.all([this.getUserInfo(), this.getFans(), this.getAllFans(),this.getAddFans(1,this.zcache.userId),this.getAddFans(2,list)]).then(res => {
console.log('进来了');
console.log(res,'promise');
this.test.manInfo.logoUrl = res[0]
this.test.barInfo.personalFans = res[1]
this.test.barInfo.fans = res[2]
this.test.barInfo.newFans = res[3]
this.test.barInfo.allNewFans = res[4]
this.overlayShow = false
// this.getAddFans(2,this.memberList).then(res => {
// this.test.barInfo.allNewFans = res
// this.overlayShow = false
// })
//
})
}, },
checkNowMenuBar() { checkNowMenuBar() {
let inData = "1"; let inData = "1";
...@@ -497,9 +541,9 @@ export default { ...@@ -497,9 +541,9 @@ export default {
}, },
// 测试-获取当前Url信息 // 测试-获取当前Url信息
zTestGetNowUrlInfo() { zTestGetNowUrlInfo() {
this.zcache.nowUrl = JSON.stringify(this.$route.query); this.zcache.nowUrl = JSON.stringify(this.$route.query)
this.zcache.code = String(this.$route.query.code); this.zcache.code = String(this.$route.query.code)
this.url = this.zcache.nowUrl; this.url = this.zcache.nowUrl
}, },
zTestPreAuthCode() { zTestPreAuthCode() {
console.log('获取code') console.log('获取code')
...@@ -543,35 +587,30 @@ export default { ...@@ -543,35 +587,30 @@ export default {
}; };
this.zcache.userInfoResOld = "PostData:" + JSON.stringify(postData); this.zcache.userInfoResOld = "PostData:" + JSON.stringify(postData);
axios({ axios({
url: url: "http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code=" + this.zcache.code,
"http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code=" +
this.zcache.code,
method: "post", method: "post",
headers: headerData headers: headerData
}) })
.then(res => { .then(res => {
sessionStorage.setItem("userId", String(res.data.data.userId)); sessionStorage.setItem("userId", String(res.data.data.userId))
this.zcache.userId = String(res.data.data.userId); this.zcache.userId = String(res.data.data.userId);
this.getUserFromId(this.zcache.userId); this.getUserFromId(this.zcache.userId);
this.getUserInfo(); // this.getUserInfo();
this.getNewFans();
this.getDirector(res.data.data.userId); this.getDirector(res.data.data.userId);
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
}); });
}, },
getUserFromId(id) { // 获取店铺code
getUserFromId(id) {
let userName = id; let userName = id;
getUserInfoByUserId({ userName }).then(res => { getUserInfoByUserId({ userName }).then(res => {
sessionStorage.setItem("oyStallCode", res.data[0].oyStallCode) sessionStorage.setItem("oyStallCode", res.data[0].oyStallCode)
this.oyStallCode = res.data[0].oyStallCode; this.oyStallCode = res.data[0].oyStallCode;
this.getStore() // this.getAllInfo()
this.getFans()
this.getAllFans()
this.getNewFans()
this.getAllNewFans() this.getAllNewFans()
this.overlayShow = false
}) })
.catch(err => {}) .catch(err => {})
} }
......
NdQI4DAtoC9jyfXm
\ No newline at end of file
...@@ -225,6 +225,7 @@ ...@@ -225,6 +225,7 @@
return context == null || context == "" || context == "undefined" ? "" : context; return context == null || context == "" || context == "undefined" ? "" : context;
} }
const nowUrl= GetQueryString('Url') const nowUrl= GetQueryString('Url')
alert(`nowurl--->${nowUrl}`)
let pageUrl = `http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=${nowUrl}`; let pageUrl = `http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=${nowUrl}`;
// document.getElementById('uri').innerHTML = 'Uri=' + String(pageUri) // document.getElementById('uri').innerHTML = 'Uri=' + String(pageUri)
......
...@@ -86,7 +86,6 @@ ...@@ -86,7 +86,6 @@
} else { } else {
onBridgeReady() onBridgeReady()
} }
// let pageUri = `${nowUrl}&detailid=${voucherId}&actionid=${activeId}&unionid=${unionId}`;
// let storecode = "181" // let storecode = "181"
let pageUri = `pages/user/register/register?storeCode=${storecode}` let pageUri = `pages/user/register/register?storeCode=${storecode}`
let pageUrl = `http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=${pageUri}`; let pageUrl = `http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=${pageUri}`;
......
...@@ -151,14 +151,15 @@ export default { ...@@ -151,14 +151,15 @@ export default {
coupon_id: Number(inVoucherId) coupon_id: Number(inVoucherId)
} }
getVoucherWxUrl(postData).then(res => { getVoucherWxUrl(postData).then(res => {
console.log(res,'指向小程序的链接') console.log(res,'指向小程序的链接')
this.zVoucherUrlSet(res.result.link) this.zlist.voucherUrl = String(res.result.lin);
this.zpick('h5', String(inData))
// this.zVoucherUrlSet(res.result.link)
}); });
}, },
zpick(inMsgType, inUrl) { zpick(inMsgType, inUrl) {
switch (inMsgType) { switch (inMsgType) {
case "text": case "text":
wx.invoke( wx.invoke(
"sendChatMessage", "sendChatMessage",
......
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