Commit e967ff4e authored by xd's avatar xd

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

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