Commit 06f36166 by 谢中龙

导购相关

parent 292a06cc
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</block> </block>
<view class="cell-me"> <view class="cell-me">
<cell bind:startmessage='startmessage' isMask="0" styleType="1" blockStyle="button" buttonText="0" bind:completemessage="completemessage" plugid='c9918b9af349c100b285d1b9a4d19ec6' /> <cell bind:startmessage='startmessage' isMask="0" styleType="2" blockStyle="button" buttonText="0" bind:completemessage="completemessage" plugid='c9918b9af349c100b285d1b9a4d19ec6' />
</view> </view>
</view> </view>
......
...@@ -44,7 +44,7 @@ wxService.page({ ...@@ -44,7 +44,7 @@ wxService.page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let currentUserInfo = wx.getStorageSync('_baseUserInfo'); let currentUserInfo = wx.getStorageSync('guidBaseInfo');
if (!currentUserInfo) { //未登录成功 if (!currentUserInfo) { //未登录成功
wx.redirectTo({ wx.redirectTo({
url: '/shoppingGuid/page/pages/welcomGuider/welcomGuider', url: '/shoppingGuid/page/pages/welcomGuider/welcomGuider',
...@@ -52,11 +52,14 @@ wxService.page({ ...@@ -52,11 +52,14 @@ wxService.page({
return ; return ;
} }
let userInfo = wx.getStorageSync('_userInfo'); let userInfo = wx.getStorageSync('guidInfo');
if (currentUserInfo.member) { if (currentUserInfo.member) {
if (!currentUserInfo.member.name) { if (!currentUserInfo.member.qiyeInfo.name) {
currentUserInfo.member.name = userInfo.nickName; currentUserInfo.member.name = userInfo.nickName;
} }
else{
currentUserInfo.member.name = currentUserInfo.member.qiyeInfo.name;
}
} }
this.setData({ this.setData({
...@@ -66,20 +69,20 @@ wxService.page({ ...@@ -66,20 +69,20 @@ wxService.page({
//获取导购业绩 //获取导购业绩
// this.echartsComponnet = this.selectComponent('#barChart'); // this.echartsComponnet = this.selectComponent('#barChart');
this.getGuidAchievement(); this.getGuidAchievement();
let series = [ // let series = [
{ // {
name: '本月', // name: '本月',
color: 'rgba(0,145,255,0.2)', // color: 'rgba(0,145,255,0.2)',
data: [10, 15, 100], // data: [10, 15, 100],
}, // },
{ // {
name: '累计', // name: '累计',
color: 'rgba(0, 145, 255, 1)', // color: 'rgba(0, 145, 255, 1)',
data: [20, 30, 300], // data: [20, 30, 300],
} // }
]; // ];
this.initBarChart(series); // this.initBarChart(series);
}, },
......
...@@ -87,6 +87,12 @@ wxService.page({ ...@@ -87,6 +87,12 @@ wxService.page({
current == 1? this.getRecruitRanking() : this.getStoreRanking() current == 1? this.getRecruitRanking() : this.getStoreRanking()
}); });
}, },
//跳转到我的招募码
onTapShowMyQrcode(){
wx.navigateTo({
url: '/shoppingGuid/page/pages/qrcode/qrcode',
})
},
// 回到商城 // 回到商城
onTapToMall(){ onTapToMall(){
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class='main-container'> <view class='main-container'>
<!-- top --> <!-- top -->
<view class='top-icons'> <view class='top-icons'>
<view class='icon-item'> <view class='icon-item' bindtap='onTapShowMyQrcode'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/home_qrcode.png' mode='aspectFit' /> <image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/home_qrcode.png' mode='aspectFit' />
<view class='icon-title'>招募码</view> <view class='icon-title'>招募码</view>
</view> </view>
......
// shoppingGuid/page/pages/qrcode/qrcode.js // shoppingGuid/page/pages/qrcode/qrcode.js
Page({ const wxService = require('../../../../utils/wxService')
const app = getApp();
wxService.page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
codeImg : '',
avator: 'https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/biaka_default_u_logo.png',
name :''
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
const currentEnv = wx.getStorageSync('_qyWeChat');
if (currentEnv) {
this.getEnterpriseQrcode();
this.getAvator();
this.getName();
}
else {
//不是在企业微信内打开的 提示信息
wx.showToast({
title: '请在企业微信内打开!',
icon: 'none'
});
}
}, },
//获取员工名称
/** getName(){
* 生命周期函数--监听页面初次渲染完成 let currentUserInfo = wx.getStorageSync('guidBaseInfo');
*/ if (!currentUserInfo) { //未登录成功
onReady: function () { wx.redirectTo({
url: '/shoppingGuid/page/pages/welcomGuider/welcomGuider',
});
return;
}
let userInfo = wx.getStorageSync('guidInfo');
let name = '';
if (currentUserInfo.member) {
if (!currentUserInfo.member.qiyeInfo.name) {
name = userInfo.nickName;
}
else {
name = currentUserInfo.member.qiyeInfo.name;
}
}
this.setData({
name: name
})
}, },
//获取企业二维码
/** getEnterpriseQrcode(){
* 生命周期函数--监听页面显示 wx.qy.getQrCode({
*/ success: res => {
onShow: function () { console.log('获取员工二维码---', res)
this.setData({
codeImg: res.qrCode
});
},
fail: res => {
console.log('获取员工二维码失败---', res)
}
});
}, },
/** //获取头像
* 生命周期函数--监听页面隐藏 getAvator(){
*/ wx.qy.getAvatar({
onHide: function () { success: res => {
console.log('获取员工二头像---', res)
}, this.setData({
avator: res.avatar
/** });
* 生命周期函数--监听页面卸载 },
*/ fail: res => {
onUnload: function () { console.log('获取员工头像失败---', res)
}
});
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 生命周期函数--监听页面显示
*/ */
onPullDownRefresh: function () { onShow: function () {
}, },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
......
{ {
"navigationBarTitleText": "对外名片",
"usingComponents": {} "usingComponents": {}
} }
\ No newline at end of file
<!--shoppingGuid/page/pages/qrcode/qrcode.wxml--> <!--shoppingGuid/page/pages/qrcode/qrcode.wxml-->
<text>shoppingGuid/page/pages/qrcode/qrcode.wxml</text> <view class='qrcode'>
<view class='card'>
<image class='g-qrcode' mode='aspectFit' src='{{codeImg}}'></image>
<image class='g-logo' mode='aspectFit' src='{{avator}}'></image>
<text class='name'>{{name}}</text>
</view>
</view>
/* shoppingGuid/page/pages/qrcode/qrcode.wxss */ /* shoppingGuid/page/pages/qrcode/qrcode.wxss */
\ No newline at end of file page{
background: #f2f2f2;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
view{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.qrcode{
padding: 50rpx;
}
.qrcode .card{
width: 100%;
height: auto;
padding: 30rpx;
background: #ffffff;
border-radius: 10rpx;
border: 12rpx solid rgba(0, 145, 255, 0.46);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-bottom: 100rpx;
}
.qrcode .card .g-qrcode{
width: 320rpx;
height: 320rpx;
margin-bottom: 40rpx;
}
.qrcode .card .g-logo{
width: 140rpx;
height: 140rpx;
margin-bottom: 25rpx;
border-radius: 50%;
}
.qrcode .card .name{
font-size: 36rpx;
color: #333333;
font-weight: bold;
}
...@@ -66,6 +66,8 @@ wxService.page({ ...@@ -66,6 +66,8 @@ wxService.page({
//回访 //回访
onTapRecall(e){ onTapRecall(e){
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
console.log(item)
}, },
/** /**
......
...@@ -8,18 +8,46 @@ wxService.page({ ...@@ -8,18 +8,46 @@ wxService.page({
*/ */
data: { data: {
code : null, code : null,
jsCodeSession : {} jsCodeSession : {},
btnIsDisabled : true
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.showLoading({
title: '检查登录状态..',
});
this.qyLogin();
return ;
//先判断是是不是已经登录了
let currentUserInfo = wx.getStorageSync('guidBaseInfo');
let userInfo = wx.getStorageSync('guidInfo');
if (currentUserInfo){
wx.qy.checkSession({
success : res => {
wx.redirectTo({
url: '/shoppingGuid/page/pages/home/home',
});
},
fail : res => { //失效了
this.qyLogin();
}
});
}
else{
this.qyLogin();
}
},
//企业微信登录
qyLogin(){
const currentEnv = wx.getStorageSync('_qyWeChat'); const currentEnv = wx.getStorageSync('_qyWeChat');
if (currentEnv) { if (currentEnv) {
wx.qy.login({ wx.qy.login({
success: res => { success: res => {
console.log('企业微信登录获取code---', res.code);
this.setData({ this.setData({
code: res.code code: res.code
}); });
...@@ -31,33 +59,31 @@ wxService.page({ ...@@ -31,33 +59,31 @@ wxService.page({
} }
}) })
} }
else{ else {
//不是在企业微信内打开的 提示信息 //不是在企业微信内打开的 提示信息
wx.showToast({ wx.showToast({
title: '请在企业微信内打开!', title: '请在企业微信内打开!',
icon: 'none' icon: 'none'
}); });
} }
}, },
//获取session_key //获取session_key
jscode2session(code){ jscode2session(code){
wxService.post(`/member/qiyeweixin/jscode2session?brandId=${app.globalData.brandId}&code=${code}`).then(r => { wxService.post(`/member/qiyeweixin/jscode2session?brandId=${app.globalData.brandId}&code=${code}`).then(r => {
console.log('jscode2session ----',r);
this.setData({ this.setData({
jsCodeSession : r.data.data, jsCodeSession : r.data.data,
btnIsDisabled : false,
}); });
}) })
}, },
//获取企业微信信息 //获取企业微信信息
onTapGetEnterpriseUserInfo(){ onTapGetEnterpriseUserInfo(){
const currentEnv = wx.getStorageSync('_qyWeChat'); const currentEnv = wx.getStorageSync('_qyWeChat');
if(currentEnv){ if(currentEnv){
wx.qy.getEnterpriseUserInfo({ wx.qy.getEnterpriseUserInfo({
success: res => { success: res => {
console.log('获取企业微信信息为----', res)
this.getGuidUserInfo(res); this.getGuidUserInfo(res);
}, },
fail: err => { fail: err => {
...@@ -72,28 +98,27 @@ wxService.page({ ...@@ -72,28 +98,27 @@ wxService.page({
icon: 'none' icon: 'none'
}); });
} }
}, },
//授权获取用户信息之后 //授权获取用户信息之后
getGuidUserInfo(userInfo){ getGuidUserInfo(userInfo){
wx.showLoading({
title: '正在登录..',
});
//判断是在企业微信中登录 //判断是在企业微信中登录
let param = { let param = {
code: this.data.code,
wechatInfo: userInfo,
brandId: app.globalData.brandId, brandId: app.globalData.brandId,
deviceid: this.data.jsCodeSession.deviceid, deviceid: this.data.jsCodeSession.deviceid,
userid: this.data.jsCodeSession.userid, userid: this.data.jsCodeSession.userid,
corpid: this.data.jsCodeSession.corpid, corpid: this.data.jsCodeSession.corpid,
sessionKey: this.data.jsCodeSession.session_key,
}; };
console.log('调用企业微信登录接口参数----------', param)
wxService.post('/member/qiyeweixin/minaLogin', param).then(r => { wxService.post('/member/qiyeweixin/minaLogin', param).then(r => {
console.log(r)
wx.setStorageSync('guidInfo', userInfo); wx.setStorageSync('guidInfo', userInfo);
wx.setStorageSync('token', r.data.data.token);
console.log('login token -----', r.data.data.token)
let qiyeLoginUserInfo = r.data.data; let qiyeLoginUserInfo = r.data.data;
wx.setStorageSync('guidBaseInfo', qiyeLoginUserInfo); wx.setStorageSync('guidBaseInfo', qiyeLoginUserInfo);
wx.hideLoading();
wx.redirectTo({ wx.redirectTo({
url: '/shoppingGuid/page/pages/home/home', url: '/shoppingGuid/page/pages/home/home',
}); });
......
{ {
"navigationBarTitleText": "欢迎您,导购", "navigationBarTitleText": "欢迎",
"usingComponents": {} "usingComponents": {}
} }
\ No newline at end of file
<!--shoppingGuid/page/pages/welcomGuider/welcomGuider.wxml--> <!--shoppingGuid/page/pages/welcomGuider/welcomGuider.wxml-->
<view class='login'> <view class='login'>
<image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/welcom.png' mode='widthFix'></image> <image src='https://bigaka-xie.oss-cn-shanghai.aliyuncs.com/welcom.png' mode='widthFix'></image>
<!-- <button type='primary' <button type='primary' bindtap='onTapGetEnterpriseUserInfo' disabled='{{btnIsDisabled}}'>立即进入</button>
bindgetuserinfo="getGuidUserInfo"
open-type='getUserInfo'>
立即进入</button> -->
<button type='primary' bindtap='onTapGetEnterpriseUserInfo'>立即进入</button>
<button class='enter-mall' bindtap='onTapToMall'>进入商城</button> <button class='enter-mall' bindtap='onTapToMall'>进入商城</button>
</view> </view>
...@@ -101,6 +101,7 @@ wxService.page({ ...@@ -101,6 +101,7 @@ wxService.page({
id: item.couponId, id: item.couponId,
url: item.imageBg url: item.imageBg
} }
let tentacleInfo = { let tentacleInfo = {
content: JSON.stringify(content), content: JSON.stringify(content),
contentId: item.couponId, contentId: item.couponId,
...@@ -122,7 +123,6 @@ wxService.page({ ...@@ -122,7 +123,6 @@ wxService.page({
imgUrl: item.imageBg,//小程序消息的封面图 imgUrl: item.imageBg,//小程序消息的封面图
page: path, //小程序消息打开后的路径 page: path, //小程序消息打开后的路径
success: function (r) { success: function (r) {
//todo:
wx.showToast({ wx.showToast({
title: '发送成功!' title: '发送成功!'
}); });
...@@ -134,6 +134,7 @@ wxService.page({ ...@@ -134,6 +134,7 @@ wxService.page({
} }
}); });
}, },
//立即推荐商品给用户 //立即推荐商品给用户
onTapToRecommandProduct(e){ onTapToRecommandProduct(e){
let item = e.currentTarget.dataset.item; let item = e.currentTarget.dataset.item;
...@@ -179,7 +180,21 @@ wxService.page({ ...@@ -179,7 +180,21 @@ wxService.page({
// 先不管触点 测试调用企业微信接口 // 先不管触点 测试调用企业微信接口
// let inner_id = Integer.digit(item.productId, 10, 64); // let inner_id = Integer.digit(item.productId, 10, 64);
// var path = 'pages/productDetail/productDetail' + '?i=' + inner_id; // var path = 'pages/productDetail/productDetail' + '?i=' + inner_id;
// this.openQyContact(item, path); // wx.qy.shareToExternalContact({
// appid: app.globalData.appId,//小程序的appid
// title: item.productName, //小程序消息的title
// imgUrl: item.productImgUrl,//小程序消息的封面图
// page: path, //小程序消息打开后的路径
// success: function (res) {
// //todo:
// wx.showToast({
// title: '推荐成功!'
// });
// },
// fail: function (err) {
// console.log('error---------------', err);
// }
// });
}, },
......
...@@ -114,8 +114,11 @@ class Http { ...@@ -114,8 +114,11 @@ class Http {
post (url, parmas, channel) { post (url, parmas, channel) {
let baseUserInfo = wx.getStorageSync('_baseUserInfo') let baseUserInfo = wx.getStorageSync('_baseUserInfo')
console.log('--------------header-----------------', this.getTentacle()) let guideUserInfo = wx.getStorageSync('guidBaseInfo');
if(baseUserInfo){ // console.log('--------------header-----------------', this.getTentacle())
// console.log('--------------token-----------------', this.getToken())
if (baseUserInfo || guideUserInfo){
return this.request({ return this.request({
url, url,
method: 'POST', method: 'POST',
......
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