From faac5830c3130791e338b5b38b5817e761e51da9 Mon Sep 17 00:00:00 2001 From: chenxuhui Date: Thu, 13 Dec 2018 10:36:15 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=99=BB=E5=BD=95=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=202=E3=80=81=E7=99=BB=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2UI=E5=8E=BB=E6=8E=89=E7=94=9F=E4=BB=BD=E8=AF=81?= =?UTF-8?q?=E5=92=8C=E7=94=A8=E6=88=B7=E5=A7=93=E5=90=8D=203=E3=80=81?= =?UTF-8?q?=E9=A6=96=E9=A1=B5UI=E5=8E=BB=E6=8E=89=E8=BD=A6=E8=BE=86?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/homePage/homePage.js | 6 +- pages/homePage/homePage.wxml | 4 +- pages/login/login.js | 204 ++++++++++++++++++++--------------- pages/login/login.wxml | 8 +- pages/login/login.wxss | 6 +- 5 files changed, 130 insertions(+), 98 deletions(-) diff --git a/pages/homePage/homePage.js b/pages/homePage/homePage.js index 9ad8144..06ec034 100644 --- a/pages/homePage/homePage.js +++ b/pages/homePage/homePage.js @@ -18,11 +18,11 @@ Page({ transferURL = '/pages/orderList/orderList'; break; // 车辆申请 - case "2": + // case "2": // transferURL = '/pages/myCars/myCars'; // 没有列表,直接进入车辆详情 - transferURL = '/pages/myCars/carsDetail/carsDetail'; - break; + // transferURL = '/pages/myCars/carsDetail/carsDetail'; + // break; // 销售出库 case "3": transferURL = '/pages/saleOutStore/saleOutStore'; diff --git a/pages/homePage/homePage.wxml b/pages/homePage/homePage.wxml index 36179f7..cfe212c 100644 --- a/pages/homePage/homePage.wxml +++ b/pages/homePage/homePage.wxml @@ -9,10 +9,10 @@ 我的订单 - + 销售出库 diff --git a/pages/login/login.js b/pages/login/login.js index 1644588..d8afd5e 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -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); } }) }) diff --git a/pages/login/login.wxml b/pages/login/login.wxml index 0650077..5252079 100644 --- a/pages/login/login.wxml +++ b/pages/login/login.wxml @@ -11,21 +11,21 @@ - + - + 手机号码 diff --git a/pages/login/login.wxss b/pages/login/login.wxss index 9e1c619..1b473be 100644 --- a/pages/login/login.wxss +++ b/pages/login/login.wxss @@ -2,8 +2,10 @@ .containerView{ margin-left: 30rpx; margin-right: 30rpx; - height: 480rpx; - margin-top: 25%; + /* height: 480rpx; + margin-top: 25%; */ + height: 240rpx; + margin-top: 40%; display: flex; flex-direction: column;