yibo 7 years ago
parent
commit
91ff8530c1
3 changed files with 31 additions and 35 deletions
  1. +19
    -23
      pages/login/login.js
  2. +6
    -6
      pages/order/detail/detail.js
  3. +6
    -6
      pages/order/newBill/newBill.js

+ 19
- 23
pages/login/login.js View File

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

+ 6
- 6
pages/order/detail/detail.js View File

@ -480,12 +480,12 @@ Page({
}) })
return; return;
} }
if (dmo.Details[i].SecondNumber == null) {
wx.showToast({
title: '辅数量不能为空',
})
return;
}
// if (dmo.Details[i].SecondNumber == null) {
// wx.showToast({
// title: '辅数量不能为空',
// })
// return;
// }
} }
let method = update; let method = update;


+ 6
- 6
pages/order/newBill/newBill.js View File

@ -437,12 +437,12 @@ Page({
}) })
return; return;
} }
if (dmo.Details[i].SecondNumber == null) {
wx.showToast({
title: '辅数量不能为空',
})
return;
}
// if (dmo.Details[i].SecondNumber == null) {
// wx.showToast({
// title: '辅数量不能为空',
// })
// return;
// }
} }
let method = insert; let method = insert;


Loading…
Cancel
Save