|
|
|
@ -6,25 +6,27 @@ var openID; |
|
|
|
|
|
|
|
var isBindedPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/AccountRpc/IsBinded'; |
|
|
|
var isBindByPhone = '/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 getCustomerList = '/MainSystem/B3WeChatMiniProgram/Rpcs/CustomerRpc/GetList'; |
|
|
|
/** |
|
|
|
* 获取绑定客户ID及用户电话 参数1、appID 2、openID |
|
|
|
* 返回值globalCustomerID,WeixinUser_Phone |
|
|
|
* 成功调用获取cookie方法及判断是否绑定成功方法 |
|
|
|
*/ |
|
|
|
function GetBindCustomer(that) { |
|
|
|
let method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetBindCustomer'; |
|
|
|
let method = getBindCustomer; |
|
|
|
let params = [app.globalData.appID, app.globalData.openID]; |
|
|
|
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) { |
|
|
|
// 判断是否绑定成功 参数openid 返回值phoneNum
|
|
|
|
IsBinded(app.globalData.openID); |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -36,11 +38,12 @@ function GetBindCustomer(that) { |
|
|
|
* 成功调用是否关注公众号方法 |
|
|
|
*/ |
|
|
|
function IsBinded(openid) { |
|
|
|
let method = '/MainSystem/B3MiniProgramRpc/Rpcs/ManagerRpc/AccountRpc/IsBinded'; |
|
|
|
let method = isBindedPath; |
|
|
|
let params = [openid]; |
|
|
|
network.newRequestLoading(method, params, function (res) { |
|
|
|
network.transfer_request(method, params, function (res) { |
|
|
|
if (res.result != "") { |
|
|
|
app.globalData.phoneNum = res.result; |
|
|
|
// 判断是否关注公众号
|
|
|
|
IsBindWeixinMP(app.globalData.phoneNum) |
|
|
|
} |
|
|
|
}) |
|
|
|
@ -53,7 +56,7 @@ function IsBindWeixinMP(phone) { |
|
|
|
// res.result = false;
|
|
|
|
if (res.result == true) { |
|
|
|
wx.switchTab({ |
|
|
|
url: '/pages/indexL/indexL', |
|
|
|
url: '/pages/homePage/homePage', |
|
|
|
}) |
|
|
|
} else { |
|
|
|
wx.showModal({ |
|
|
|
@ -66,9 +69,9 @@ function IsBindWeixinMP(phone) { |
|
|
|
} |
|
|
|
// 获取cookie值 参数1、appID 2、openID
|
|
|
|
function WeixinLogin(successtion) { |
|
|
|
let method = '/MainSystem/MainSystem/Auth/WeixinLogin'; |
|
|
|
let method = getCookie; |
|
|
|
let params = [app.globalData.appID, app.globalData.openID]; |
|
|
|
network.newRequestLoading(method, params, function (res) { |
|
|
|
network.transfer_request(method, params, function (res) { |
|
|
|
app.globalData.cookie = res.result; |
|
|
|
successtion(); |
|
|
|
}) |
|
|
|
@ -76,7 +79,7 @@ function WeixinLogin(successtion) { |
|
|
|
//绑定中转服务器客户对应信息 成功判断是否关注公众号
|
|
|
|
function Bind(that) { |
|
|
|
let userInfos = app.globalData.userInfo |
|
|
|
let method2 = "/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/Bind"; |
|
|
|
let method2 = bindPath; |
|
|
|
let params2 = [{ |
|
|
|
"AppId": app.globalData.appID, |
|
|
|
"OpenId": app.globalData.openID, |
|
|
|
@ -118,22 +121,24 @@ Page({ |
|
|
|
// 页面生命周期函数
|
|
|
|
onShow: function () { |
|
|
|
var that = this; |
|
|
|
/* |
|
|
|
//由登录页面进入详情页变更值为0;分享直接进入为1
|
|
|
|
app.globalData.shareInState = 0; |
|
|
|
wx.login({ |
|
|
|
success: function (res) { |
|
|
|
let code = res.code; |
|
|
|
let method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetMiniOpenIdByCode'; |
|
|
|
let method = getOpenIdByCode; |
|
|
|
let params = [app.globalData.appID, code]; |
|
|
|
// 获取openID
|
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
app.globalData.openID = res.result; |
|
|
|
// 获取绑定客户ID及用户电话
|
|
|
|
GetBindCustomer(that) |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
*/ |
|
|
|
let method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CustomerRpc/GetList'; |
|
|
|
|
|
|
|
// 获取客户列表
|
|
|
|
let method = getCustomerList; |
|
|
|
let params = []; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
if (res.result.length > 0) { |
|
|
|
@ -191,7 +196,7 @@ Page({ |
|
|
|
"HeadImgUrl": userInfos.avatarUrl, |
|
|
|
"UnionId": "" |
|
|
|
}]; |
|
|
|
network.newRequestLoading(method, params, function (res) { |
|
|
|
network.transfer_request(method, params, function (res) { |
|
|
|
if (res.result != null) { |
|
|
|
app.globalData.phoneNum = that.data.phoneNum; |
|
|
|
Bind(that) |
|
|
|
|