|
|
|
@ -5,12 +5,12 @@ var app = getApp(); |
|
|
|
var openID; |
|
|
|
|
|
|
|
var isBindedPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/IsBinded'; |
|
|
|
var isBindByPhone = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/XuBindByPhone'; |
|
|
|
var bindByPhone = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/XuBindByPhone'; |
|
|
|
var isBindWeixinPath = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/IsBindWeixinMP'; |
|
|
|
var getOpenIdByCode = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetMiniOpenIdByCode'; |
|
|
|
var bindPath = "/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/Bind"; |
|
|
|
var getBindCustomer = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetBindCustomer'; |
|
|
|
var getCookie ='/MainSystem/MainSystem/Auth/WeixinLogin'; |
|
|
|
var getCookie = '/MainSystem/MainSystem/Auth/WeixinLogin'; |
|
|
|
var getCustomerList = '/MainSystem/B3WeChatMiniProgram/Rpcs/CustomerRpc/GetList'; |
|
|
|
/** |
|
|
|
* 获取绑定客户ID及用户电话 参数1、appID 2、openID |
|
|
|
@ -20,12 +20,12 @@ var getCustomerList = '/MainSystem/B3WeChatMiniProgram/Rpcs/CustomerRpc/GetList' |
|
|
|
function GetBindCustomer(that) { |
|
|
|
let method = getBindCustomer; |
|
|
|
let params = [app.globalData.appID, app.globalData.openID]; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
if (res.result != null) { |
|
|
|
app.globalData.globalCustomerID = res.result.ID; |
|
|
|
app.globalData.phoneNum = res.result.WeixinUser_Phone; |
|
|
|
// 获取cookie值
|
|
|
|
WeixinLogin(function (res) { |
|
|
|
WeixinLogin(function(res) { |
|
|
|
// 判断是否绑定成功 参数openid 返回值phoneNum
|
|
|
|
IsBinded(app.globalData.openID); |
|
|
|
}); |
|
|
|
@ -40,7 +40,7 @@ function GetBindCustomer(that) { |
|
|
|
function IsBinded(openid) { |
|
|
|
let method = isBindedPath; |
|
|
|
let params = [openid]; |
|
|
|
network.transfer_request(method, params, function (res) { |
|
|
|
network.transfer_request(method, params, function(res) { |
|
|
|
if (res.result != "") { |
|
|
|
app.globalData.phoneNum = res.result; |
|
|
|
// 判断是否关注公众号
|
|
|
|
@ -52,7 +52,7 @@ function IsBinded(openid) { |
|
|
|
function IsBindWeixinMP(phone) { |
|
|
|
let method = isBindWeixinPath; |
|
|
|
let params = [phone]; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
// res.result = false;
|
|
|
|
if (res.result == true) { |
|
|
|
wx.switchTab({ |
|
|
|
@ -71,7 +71,7 @@ function IsBindWeixinMP(phone) { |
|
|
|
function WeixinLogin(successtion) { |
|
|
|
let method = getCookie; |
|
|
|
let params = [app.globalData.appID, app.globalData.openID]; |
|
|
|
network.transfer_request(method, params, function (res) { |
|
|
|
network.transfer_request(method, params, function(res) { |
|
|
|
app.globalData.cookie = res.result; |
|
|
|
successtion(); |
|
|
|
}) |
|
|
|
@ -93,7 +93,7 @@ function Bind(that) { |
|
|
|
"UnionId": "", |
|
|
|
"CustomerId": app.globalData.globalCustomerID |
|
|
|
}]; |
|
|
|
network.requestLoading(method2, params2, function (res) { |
|
|
|
network.requestLoading(method2, params2, function(res) { |
|
|
|
if (res.result == true) { |
|
|
|
IsBindWeixinMP(app.globalData.phoneNum) |
|
|
|
} |
|
|
|
@ -111,7 +111,7 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
// 客户列表变更选项信息
|
|
|
|
listenerPickerSelected: function (e) { |
|
|
|
listenerPickerSelected: function(e) { |
|
|
|
this.setData({ |
|
|
|
index: e.detail.value, |
|
|
|
}); |
|
|
|
@ -119,17 +119,17 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
// 页面生命周期函数
|
|
|
|
onShow: function () { |
|
|
|
onShow: function() { |
|
|
|
var that = this; |
|
|
|
//由登录页面进入详情页变更值为0;分享直接进入为1
|
|
|
|
app.globalData.shareInState = 0; |
|
|
|
wx.login({ |
|
|
|
success: function (res) { |
|
|
|
success: function(res) { |
|
|
|
let code = res.code; |
|
|
|
let method = getOpenIdByCode; |
|
|
|
let params = [app.globalData.appID, code]; |
|
|
|
// 获取openID
|
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
app.globalData.openID = res.result; |
|
|
|
// 获取绑定客户ID及用户电话
|
|
|
|
GetBindCustomer(that) |
|
|
|
@ -140,11 +140,10 @@ Page({ |
|
|
|
// 获取客户列表
|
|
|
|
let method = getCustomerList; |
|
|
|
let params = []; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
if (res.result.length > 0) { |
|
|
|
var lastArr = that.data.customerArray.concat(res.result) |
|
|
|
that.setData({ |
|
|
|
customerArray: lastArr, |
|
|
|
customerArray: res.result, |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
@ -152,13 +151,13 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
// 电话输入框
|
|
|
|
getPhone: function (e) { |
|
|
|
getPhone: function(e) { |
|
|
|
let val = e.detail.value; |
|
|
|
this.data.phoneNum = val; |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取授权 成功 绑定信息到客户服务器 回调函数绑定中转服务器
|
|
|
|
getUserInfo: function (e) { |
|
|
|
getUserInfo: function(e) { |
|
|
|
var that = this; |
|
|
|
if (e.detail.userInfo != null) { |
|
|
|
app.globalData.userInfo = e.detail.userInfo |
|
|
|
@ -180,7 +179,7 @@ Page({ |
|
|
|
return false; |
|
|
|
} |
|
|
|
let userInfos = app.globalData.userInfo |
|
|
|
let method = isBindByPhone; |
|
|
|
let method = bindByPhone; |
|
|
|
let params = [{ |
|
|
|
"OpenId": app.globalData.openID, |
|
|
|
"Phone": this.data.phoneNum, |
|
|
|
@ -192,7 +191,7 @@ Page({ |
|
|
|
"HeadImgUrl": userInfos.avatarUrl, |
|
|
|
"UnionId": "" |
|
|
|
}]; |
|
|
|
network.transfer_request(method, params, function (res) { |
|
|
|
network.transfer_request(method, params, function(res) { |
|
|
|
if (res.result != null) { |
|
|
|
app.globalData.phoneNum = that.data.phoneNum; |
|
|
|
// 判断是否绑定成功
|
|
|
|
@ -207,7 +206,4 @@ Page({ |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |