|
|
|
@ -21,11 +21,11 @@ var isBindWeixinPath = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/IsBindWei |
|
|
|
// 直接请求青花瓷服务器获取绑定信息的返回
|
|
|
|
var bindPath = "/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/Bind"; |
|
|
|
|
|
|
|
var XuBindDriver = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/XuBindDriver' |
|
|
|
// var XuBindDriver = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/XuBindDriver'
|
|
|
|
var bindByPhone = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/AccountRpc/XuBindByPhone'; |
|
|
|
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'; |
|
|
|
|
|
|
|
//获取openID 参数1、app.globalData.AppId 2、code
|
|
|
|
function getOpenId(successaction) { |
|
|
|
@ -52,6 +52,23 @@ function IsBind(openid, successaction) { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 客户服务器判断是否绑定成功 参数openid |
|
|
|
* 返回值phoneNum |
|
|
|
* 成功调用是否关注公众号方法 |
|
|
|
*/ |
|
|
|
function IsBinded(openid) { |
|
|
|
let method = isBindedPath; |
|
|
|
let params = [openid]; |
|
|
|
network.transfer_request(method, params, function (res) { |
|
|
|
if (res.result != "") { |
|
|
|
app.globalData.Phone = res.result; |
|
|
|
// 判断是否关注公众号
|
|
|
|
IsBindWeixinMP(app.globalData.Phone) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
//绑定公众号 参数用户电话 返回true已关注 false未关注
|
|
|
|
function IsBindWeixinMP(phone) { |
|
|
|
let method = isBindWeixinPath; |
|
|
|
@ -91,10 +108,10 @@ Page({ |
|
|
|
app.globalData.CustomerId = this.data.customerList[this.data.customerIndex].ID; |
|
|
|
}, |
|
|
|
|
|
|
|
// 姓名
|
|
|
|
getDriverName: function(e) { |
|
|
|
app.globalData.UserName = e.detail.value |
|
|
|
}, |
|
|
|
// // 姓名
|
|
|
|
// getDriverName: function(e) {
|
|
|
|
// app.globalData.UserName = e.detail.value
|
|
|
|
// },
|
|
|
|
|
|
|
|
// 手机号码
|
|
|
|
getPhone: function(e) { |
|
|
|
@ -103,32 +120,32 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
// 身份证
|
|
|
|
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 = [1, Idcard]; |
|
|
|
network.transfer_request(method, params, function(res) { |
|
|
|
//res就是我们请求接口返回的数据
|
|
|
|
if (res.result != null) { |
|
|
|
app.globalData.UserName = res.result.Name, |
|
|
|
app.globalData.Phone = res.result.Telephone; |
|
|
|
that.setData({ |
|
|
|
name: res.result.Name, |
|
|
|
phoneNum: res.result.Telephone, |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 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 = [1, Idcard];
|
|
|
|
// network.transfer_request(method, params, function(res) {
|
|
|
|
// //res就是我们请求接口返回的数据
|
|
|
|
// if (res.result != null) {
|
|
|
|
// app.globalData.UserName = res.result.Name,
|
|
|
|
// app.globalData.Phone = res.result.Telephone;
|
|
|
|
// that.setData({
|
|
|
|
// name: res.result.Name,
|
|
|
|
// phoneNum: res.result.Telephone,
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
|
|
|
|
// 获取所有客户列表
|
|
|
|
choiceCustomer: function() { |
|
|
|
@ -180,21 +197,21 @@ Page({ |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 判断用户姓名
|
|
|
|
if (app.globalData.UserName == "") { |
|
|
|
wx.showToast({ |
|
|
|
image: '/imgs/ddpc.png', |
|
|
|
title: '用户姓名不能为空', |
|
|
|
}) |
|
|
|
return false; |
|
|
|
} |
|
|
|
// if (app.globalData.UserName == "") {
|
|
|
|
// wx.showToast({
|
|
|
|
// image: '/imgs/ddpc.png',
|
|
|
|
// title: '用户姓名不能为空',
|
|
|
|
// })
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// 判断身份证信息
|
|
|
|
if ((Idcard.length < 18) || (Idcard.length > 18)) { |
|
|
|
wx.showToast({ |
|
|
|
image: '/imgs/ddpc.png', |
|
|
|
title: '身份证号不正确', |
|
|
|
}) |
|
|
|
return false; |
|
|
|
} |
|
|
|
// if ((Idcard.length < 18) || (Idcard.length > 18)) {
|
|
|
|
// wx.showToast({
|
|
|
|
// image: '/imgs/ddpc.png',
|
|
|
|
// title: '身份证号不正确',
|
|
|
|
// })
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
|
|
|
|
} else { |
|
|
|
wx.showModal({ |
|
|
|
@ -202,46 +219,56 @@ Page({ |
|
|
|
content: '请给予权限,不涉及个人隐私', |
|
|
|
showCancel: false, |
|
|
|
}) |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
wx.login({ |
|
|
|
success: function(res) { |
|
|
|
var method = XuBindDriver; |
|
|
|
var params = [{ |
|
|
|
// "Domain_ID": that.data.array[that.data.index].ID,
|
|
|
|
"Driver_Name": app.globalData.UserName, |
|
|
|
"Phone": app.globalData.Phone, |
|
|
|
"IdCard": Idcard, |
|
|
|
"OpenId": app.globalData.OpenId, |
|
|
|
"NickName": nickName, |
|
|
|
"Sex": gender, |
|
|
|
"Province": province, |
|
|
|
"City": city, |
|
|
|
"Country": country, |
|
|
|
"HeadImgUrl": avatarUrl, |
|
|
|
"UnionId": " " |
|
|
|
}]; |
|
|
|
var transferParams = [{ |
|
|
|
"OpenId": app.globalData.OpenId, |
|
|
|
"Phone": app.globalData.Phone, |
|
|
|
"NickName": nickName, |
|
|
|
"Sex": gender, |
|
|
|
"Province": province, |
|
|
|
"City": city, |
|
|
|
"Country": country, |
|
|
|
"HeadImgUrl": avatarUrl, |
|
|
|
"UnionId": " ", |
|
|
|
//请求新增参数
|
|
|
|
"AppId": app.globalData.AppId, |
|
|
|
"CustomerId": that.data.customerList[that.data.customerIndex].ID, |
|
|
|
}]; |
|
|
|
network.transfer_request(method, params, function(res) { |
|
|
|
app.globalData.Phone = that.data.phoneNum; |
|
|
|
that.bingDriverInTransferServer(transferParams, function(res) { |
|
|
|
IsBindWeixinMP(app.globalData.Phone) |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
var method = bindByPhone; |
|
|
|
let params = [{ |
|
|
|
"OpenId": app.globalData.OpenId, |
|
|
|
"Phone": app.globalData.Phone, |
|
|
|
"NickName": nickName, |
|
|
|
"Sex": gender, |
|
|
|
"Province": province, |
|
|
|
"City": city, |
|
|
|
"Country": country, |
|
|
|
"HeadImgUrl": avatarUrl, |
|
|
|
"UnionId": "" |
|
|
|
}]; |
|
|
|
// var params = [{
|
|
|
|
// // "Domain_ID": that.data.array[that.data.index].ID,
|
|
|
|
// "Driver_Name": app.globalData.UserName,
|
|
|
|
// "Phone": app.globalData.Phone,
|
|
|
|
// "IdCard": Idcard,
|
|
|
|
// "OpenId": app.globalData.OpenId,
|
|
|
|
// "NickName": nickName,
|
|
|
|
// "Sex": gender,
|
|
|
|
// "Province": province,
|
|
|
|
// "City": city,
|
|
|
|
// "Country": country,
|
|
|
|
// "HeadImgUrl": avatarUrl,
|
|
|
|
// "UnionId": " "
|
|
|
|
// }];
|
|
|
|
var transferParams = [{ |
|
|
|
"OpenId": app.globalData.OpenId, |
|
|
|
"Phone": app.globalData.Phone, |
|
|
|
"NickName": nickName, |
|
|
|
"Sex": gender, |
|
|
|
"Province": province, |
|
|
|
"City": city, |
|
|
|
"Country": country, |
|
|
|
"HeadImgUrl": avatarUrl, |
|
|
|
"UnionId": " ", |
|
|
|
//请求新增参数
|
|
|
|
"AppId": app.globalData.AppId, |
|
|
|
"CustomerId": that.data.customerList[that.data.customerIndex].ID, |
|
|
|
}]; |
|
|
|
network.transfer_request(method, params, function(res) { |
|
|
|
app.globalData.Phone = that.data.phoneNum; |
|
|
|
//绑定中转服务器客户对应信息 成功判断是否关注公众号
|
|
|
|
that.bingDriverInTransferServer(transferParams, function(res) { |
|
|
|
IsBindWeixinMP(app.globalData.Phone) |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
@ -249,7 +276,9 @@ Page({ |
|
|
|
var that = this; |
|
|
|
var method = bindPath; |
|
|
|
network.requestLoading(method, params, function(res) { |
|
|
|
successaction(res.result); |
|
|
|
if (res.result == true) { |
|
|
|
successaction(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
@ -263,7 +292,8 @@ Page({ |
|
|
|
if (res == "") { |
|
|
|
|
|
|
|
} else { |
|
|
|
IsBindWeixinMP(app.globalData.Phone) |
|
|
|
// 判断是否绑定成功 参数openid 返回值phoneNum
|
|
|
|
IsBinded(openid); |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|