|
|
|
@ -24,18 +24,18 @@ var bindPath = "/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/Bind"; |
|
|
|
var XuBindDriver = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/XuBindDriver' |
|
|
|
var GetDriverByIdCard = "/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/GetDriverByIdCard" |
|
|
|
var GetDriverByOpenId = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/GetDriverByOpenId' |
|
|
|
var isBindedPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/IsBinded'; |
|
|
|
// var isBindedPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/IsBinded';
|
|
|
|
var GetBindDriverName = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/GetBindDriverName' |
|
|
|
|
|
|
|
|
|
|
|
//获取openID 参数1、app.globalData.AppId 2、code
|
|
|
|
function getOpenId(successaction) { |
|
|
|
wx.login({ |
|
|
|
success: function (res) { |
|
|
|
success: function(res) { |
|
|
|
var code = res.code; |
|
|
|
var method = getOpenIdByCode; |
|
|
|
var params = [app.globalData.AppId, code]; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
app.globalData.OpenId = res.result; |
|
|
|
successaction(app.globalData.OpenId) |
|
|
|
}) |
|
|
|
@ -47,7 +47,7 @@ function getOpenId(successaction) { |
|
|
|
function IsBind(openid, successaction) { |
|
|
|
var method = getBindCustomer; |
|
|
|
var params = [app.globalData.AppId, openid]; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
app.globalData.CustomerId = res.result.ID; |
|
|
|
successaction(res.result.WeixinUser_Phone) |
|
|
|
}) |
|
|
|
@ -57,7 +57,7 @@ function IsBind(openid, successaction) { |
|
|
|
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) { |
|
|
|
@ -78,8 +78,6 @@ function IsBindWeixinMP(phone) { |
|
|
|
|
|
|
|
Page({ |
|
|
|
data: { |
|
|
|
array: [], |
|
|
|
index: 0, |
|
|
|
idCard: "", |
|
|
|
customerList: [{ |
|
|
|
ID: 0, |
|
|
|
@ -90,31 +88,39 @@ Page({ |
|
|
|
|
|
|
|
|
|
|
|
// 绑定客户
|
|
|
|
listenerPickerSelected: function (e) { |
|
|
|
listenerPickerSelected: function(e) { |
|
|
|
this.setData({ |
|
|
|
customerIndex: e.detail.value, |
|
|
|
}); |
|
|
|
app.globalData.CustomerId = this.data.customerList[this.data.customerIndex].ID; |
|
|
|
}, |
|
|
|
|
|
|
|
// 姓名
|
|
|
|
getDriverName: function (e) { |
|
|
|
getDriverName: function(e) { |
|
|
|
app.globalData.UserName = e.detail.value |
|
|
|
}, |
|
|
|
|
|
|
|
// 手机号码
|
|
|
|
getPhone: function (e) { |
|
|
|
getPhone: function(e) { |
|
|
|
Phone = e.detail.value; |
|
|
|
app.globalData.Phone = Phone; |
|
|
|
}, |
|
|
|
|
|
|
|
// 身份证
|
|
|
|
getIDCardNum: function (e) { |
|
|
|
var that = this |
|
|
|
getIDCardNum: function(e) { |
|
|
|
if (!app.globalData.CustomerId) { |
|
|
|
wx: wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '请先绑定客户', |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
var that = this; |
|
|
|
if (e.detail.value.length == 18) { |
|
|
|
Idcard = e.detail.value; |
|
|
|
var method = GetDriverByIdCard; |
|
|
|
var params = ["服务号", Idcard]; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
var params = [1, Idcard]; |
|
|
|
network.transfer_request(method, params, function(res) { |
|
|
|
//res就是我们请求接口返回的数据
|
|
|
|
if (res.result != null) { |
|
|
|
app.globalData.UserName = res.result.Name, |
|
|
|
@ -129,11 +135,11 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取所有客户列表
|
|
|
|
choiceCustomer: function () { |
|
|
|
choiceCustomer: function() { |
|
|
|
var that = this; |
|
|
|
var method = getCustomerList; |
|
|
|
var params = []; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
if (res.result.length > 0) { |
|
|
|
var lastArr = that.data.customerList.concat(res.result) |
|
|
|
that.setData({ |
|
|
|
@ -143,7 +149,7 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
getUserInfo: function (e) { |
|
|
|
getUserInfo: function(e) { |
|
|
|
var that = this; |
|
|
|
if (e.detail.userInfo != null) { |
|
|
|
app.globalData.userInfo = e.detail.userInfo; |
|
|
|
@ -203,10 +209,10 @@ Page({ |
|
|
|
} |
|
|
|
|
|
|
|
wx.login({ |
|
|
|
success: function (res) { |
|
|
|
success: function(res) { |
|
|
|
var method = XuBindDriver; |
|
|
|
var params = [{ |
|
|
|
"Domain_ID": that.data.array[that.data.index].ID, |
|
|
|
// "Domain_ID": that.data.array[that.data.index].ID,
|
|
|
|
"Driver_Name": app.globalData.UserName, |
|
|
|
"Phone": app.globalData.Phone, |
|
|
|
"IdCard": Idcard, |
|
|
|
@ -233,10 +239,9 @@ Page({ |
|
|
|
"AppId": app.globalData.AppId, |
|
|
|
"CustomerId": that.data.customerList[that.data.customerIndex].ID, |
|
|
|
}]; |
|
|
|
app.globalData.CustomerId = that.data.array[that.data.index].ID; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.transfer_request(method, params, function(res) { |
|
|
|
app.globalData.Phone = that.data.phoneNum; |
|
|
|
that.bingDriverInTransferServer(transferParams, function (res) { |
|
|
|
that.bingDriverInTransferServer(transferParams, function(res) { |
|
|
|
IsBindWeixinMP(app.globalData.Phone) |
|
|
|
}); |
|
|
|
}) |
|
|
|
@ -245,21 +250,21 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
bingDriverInTransferServer: function (params, successaction) { |
|
|
|
bingDriverInTransferServer: function(params, successaction) { |
|
|
|
var that = this; |
|
|
|
var method = bindPath; |
|
|
|
network.requestLoading(method, params, function (res) { |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
successaction(res.result); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onShow: function () { |
|
|
|
onShow: function() { |
|
|
|
var that = this; |
|
|
|
that.choiceCustomer(); |
|
|
|
getOpenId(function (res) { |
|
|
|
getOpenId(function(res) { |
|
|
|
openid = res; |
|
|
|
IsBind(openid, function (res) { |
|
|
|
IsBind(openid, function(res) { |
|
|
|
app.globalData.Phone = res; |
|
|
|
if (res == "") { |
|
|
|
|
|
|
|
|