diff --git a/app.js b/app.js
index 1999865..6e2352a 100644
--- a/app.js
+++ b/app.js
@@ -1,20 +1,31 @@
App({
onLaunch: function () {
+ var that = this;
+ wx.getSystemInfo({
+ success: function (res) {
+ that.globalData.winHeight = res.windowHeight;
+ }
+ });
},
globalData: {
+ winHeight:0,
+ cookie: "",
+ decryptCookie: '',
+ userInfo: null,
+ baseUrl: "https://miniprogram.food988.com/Rest.aspx",
+ tranferBaseUrl: 'https://miniprogram.food988.com/RequestTransfer.aspx',
+ globalCustomerID: 0,
+ phoneNum: "",
+ openID: "",
+ appID: "wx0b897783b2588147",
- Phone: "",
- OpenId: "",
- AppName: "WeChat",
- AppId: "wx0b897783b2588147",
- // 自己的服务器
- BaseUrl: "https://miniprogram.food988.com/Rest.aspx",
- // 转发到客户服务器
- TranferBaseUrl:"https://miniprogram.food988.com/RequestTransfer.aspx",
- CustomerId:"",
- // 原测试路径
- // BaseUrl: "https://weixintest.food988.com/Rest.aspx"
-
+ // Phone: "",
+ // OpenId: "",
+ // AppName: "WeChat",
+ // AppId: "wx0b897783b2588147",
+ // BaseUrl: "https://miniprogram.food988.com/Rest.aspx",
+ // TranferBaseUrl:"https://miniprogram.food988.com/RequestTransfer.aspx",
+ // CustomerId:"",
},
})
\ No newline at end of file
diff --git a/imgs/bindImage.png b/imgs/bindImage.png
new file mode 100644
index 0000000..ae5447a
Binary files /dev/null and b/imgs/bindImage.png differ
diff --git a/pages/debitNoteList/debitNoteDetail/debitNoteDetail.js b/pages/debitNoteList/debitNoteDetail/debitNoteDetail.js
index b873ea4..588ebb6 100644
--- a/pages/debitNoteList/debitNoteDetail/debitNoteDetail.js
+++ b/pages/debitNoteList/debitNoteDetail/debitNoteDetail.js
@@ -26,7 +26,7 @@ Page({
let method = getDebitNoteDetail;
let params = [orderID];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
var backDate = timechage.formatTimeTwo(res.result.Date.substring(6, 19), 'Y/M/D');
if (res.result.ConfirmTime){
var backConfirmTime = timechage.formatTimeTwo(res.result.ConfirmTime.substring(6, 19), 'Y/M/D');
@@ -45,7 +45,7 @@ Page({
var orderID = event.currentTarget.dataset.orderid;
let method = confirmDebitNote;
let params = [orderID];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
wx.showToast({
title: '操作成功',
success: function (res){
diff --git a/pages/debitNoteList/debitNoteList.js b/pages/debitNoteList/debitNoteList.js
index f0d1412..8af6b5d 100644
--- a/pages/debitNoteList/debitNoteList.js
+++ b/pages/debitNoteList/debitNoteList.js
@@ -24,7 +24,7 @@ function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, successact
"PageSize": UnCheckPageSize,
}];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
successaction();
var array = res.result;
if (array.length <= 0) {
@@ -64,7 +64,7 @@ function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) {
"PageSize": UnCheckPageSize,
}];
// let params = [true, CheckedPageIndex, CheckedPageSize];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
var array = res.result;
if (array.length <= 0) {
wx.showToast({
diff --git a/pages/homePage/homePage.js b/pages/homePage/homePage.js
index d29e712..25ea194 100644
--- a/pages/homePage/homePage.js
+++ b/pages/homePage/homePage.js
@@ -6,7 +6,7 @@ var timechage = require("../../utils/dateTimeUtil.js")
function GetUserProfile(successtion) {
let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/AccountBalanceRpc/GetCurrentBalanceMoney';
let params = [];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function(res) {
successtion(res);
})
}
@@ -14,26 +14,26 @@ function GetUserProfile(successtion) {
Page({
data: {
currentDate: timechage.formatTimeTwo(Date.parse(new Date()), 'Y/M/D'),
- balance:"",
+ balance: "",
},
- onLoad: function (options) {
+ onLoad: function(options) {
var that = this;
// 添加接口请求当前余额
- GetUserProfile(function (res) {
+ GetUserProfile(function(res) {
console.log(res);
- if (res != null) {
- that.setData({
- balance: res.result
- });
- }
- });
+ if (res != null) {
+ that.setData({
+ balance: res.result
+ });
+ }
+ });
},
/**
* 点击页面按钮进行跳转
*/
- transBtnClicked: function (event) {
+ transBtnClicked: function(event) {
var btnID = event.currentTarget.dataset.itemid;
var transferURL = '';
switch (btnID) {
@@ -41,26 +41,26 @@ Page({
case "1":
transferURL = '/pages/saleForecastList/saleForecastList';
break;
- // 对账单
+ // 对账单
case "2":
transferURL = '/pages/statementOfAccount/statementOfAccount';
break;
- // 客户找车
+ // 客户找车
case "3":
transferURL = '/pages/sendCargo/sendCargo';
break;
- // 销售出库
+ // 销售出库
case "4":
transferURL = '/pages/saleOutStore/saleOutStore';
break;
- // 担保单
+ // 担保单
case "5":
transferURL = '/pages/guarantee/guarantee';
break;
case "6":
transferURL = '/pages/statementOfAccount/statementOfAccount';
- break;
- case "7":
+ break;
+ case "7":
transferURL = '/pages/debitNoteList/debitNoteList';
break;
}
@@ -70,5 +70,5 @@ Page({
})
},
-
+
})
\ No newline at end of file
diff --git a/pages/login/login.js b/pages/login/login.js
index 57bc675..4bef424 100644
--- a/pages/login/login.js
+++ b/pages/login/login.js
@@ -1,54 +1,58 @@
-const app = getApp();
-//引用封装好的加密解密js
-// var Dec = require('../../utils/publicAES.js');
-// console.log(Dec.Encrypt("需要加密的字符串"));
-// console.log(Dec.Decrypt("需要解密的字符串"));
+// pages/login/login.js
var network = require("../../utils/net.js");
-
-var that = this;
-var openid;
-var Phone;
-var nickName;
-var gender;
-var province;
-var city;
-var country;
-var avatarUrl;
-var UnionId;
-var code;
-
-//获取openID 参数1、app.globalData.AppId 2、code
-function getOpenId(successaction) {
- wx.login({
- success: function(res) {
- code = res.code;
- var method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetMiniOpenIdByCode';
- var params = [app.globalData.AppId, code];
- network.previousRequestLoading(method, params, function(res) {
- app.globalData.OpenId = res.result;
- successaction(app.globalData.OpenId)
- })
+var app = getApp();
+var openID;
+
+var isBindedPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/AccountRpc/IsBinded';
+var bindByPhone = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/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 = 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);
+ });
}
})
}
-
-//获取绑定的客户ID 参数1:appid, 参数2:openid 返回用户电话 客户ID 客户Name
-function IsBind(openid, successaction) {
- var method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/GetBindCustomer';
- var params = [app.globalData.AppId, openid];
- network.previousRequestLoading(method, params, function(res) {
- app.globalData.CustomerId = res.result.ID;
- successaction(res.result.WeixinUser_Phone)
+/**
+ * 判断是否绑定成功 参数openid
+ * 返回值phoneNum
+ * 成功调用是否关注公众号方法
+ */
+function IsBinded(openid) {
+ let method = isBindedPath;
+ let params = [openid];
+ network.transfer_request(method, params, function (res) {
+ if (res.result != "") {
+ app.globalData.phoneNum = res.result;
+ // 判断是否关注公众号
+ IsBindWeixinMP(app.globalData.phoneNum)
+ }
})
}
-
-//绑定公众号 参数用户电话 返回true已关注 false未关注
+// 判断是否关注公众号 参数phone 返回值bool 成功进入首页
function IsBindWeixinMP(phone) {
- let method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/IsBindWeixinMP';
+ let method = isBindWeixinPath;
let params = [phone];
- network.previousRequestLoading(method, params, function(res) {
- //添加假数据。方便登录测试,提交版本需更正注释
+ network.requestLoading(method, params, function (res) {
// res.result = false;
if (res.result == true) {
wx.switchTab({
@@ -63,82 +67,138 @@ function IsBindWeixinMP(phone) {
}
})
}
+// 获取cookie值 参数1、appID 2、openID
+function WeixinLogin(successtion) {
+ let method = getCookie;
+ let params = [app.globalData.appID, app.globalData.openID];
+ network.transfer_request(method, params, function (res) {
+ app.globalData.cookie = res.result;
+ successtion();
+ })
+}
+//绑定中转服务器客户对应信息 成功判断是否关注公众号
+function Bind(that) {
+ let userInfos = app.globalData.userInfo
+ let method2 = bindPath;
+ let params2 = [{
+ "AppId": app.globalData.appID,
+ "OpenId": app.globalData.openID,
+ "Phone": that.data.phoneNum,
+ "NickName": userInfos.nickName,
+ "Sex": userInfos.gender,
+ "Province": userInfos.province,
+ "City": userInfos.city,
+ "Country": userInfos.country,
+ "HeadImgUrl": userInfos.avatarUrl,
+ "UnionId": "",
+ "CustomerId": app.globalData.globalCustomerID
+ }];
+ network.requestLoading(method2, params2, function (res) {
+ if (res.result == true) {
+ IsBindWeixinMP(app.globalData.phoneNum)
+ }
+ })
+}
Page({
data: {
- userInfo: "",
- array: [{
+ phoneNum: "",
+ index: 0,
+ customerArray: [{
ID: 0,
Name: "请选择所属客户"
}],
- index: 0,
- //根据customerID值判断是否隐藏选择框(默认显示)
- showCustomerChoise: true,
},
// 客户列表变更选项信息
- listenerPickerSelected: function(e) {
+ listenerPickerSelected: function (e) {
this.setData({
index: e.detail.value,
});
+ app.globalData.globalCustomerID = this.data.customerArray[this.data.index].ID;
},
- // 电话输入框
- phoneNum: function(e) {
- Phone = e.detail.value
- app.globalData.Phone = Phone
- },
-
- // 获取所有客户列表
- choiceCustomer: function(succession) {
+ // 页面生命周期函数
+ onShow: function () {
var that = this;
- var method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CustomerRpc/GetList';
- var params = [];
- network.previousRequestLoading(method, params, function(res) {
- succession();
+ //由登录页面进入详情页变更值为0;分享直接进入为1
+ app.globalData.shareInState = 0;
+ wx.login({
+ success: function (res) {
+ let code = res.code;
+ 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 = getCustomerList;
+ let params = [];
+ network.requestLoading(method, params, function (res) {
if (res.result.length > 0) {
- var lastArr = that.data.array.concat(res.result)
+ var lastArr = that.data.customerArray.concat(res.result)
that.setData({
- array: lastArr,
+ customerArray: lastArr,
})
}
})
+
+ },
+
+ // 电话输入框
+ getPhone: function (e) {
+ let val = e.detail.value;
+ this.data.phoneNum = val;
},
- // 用户绑定按钮操作
- getUserInfo: function(e) {
+ // 获取授权 成功 绑定信息到客户服务器 回调函数绑定中转服务器
+ getUserInfo: function (e) {
var that = this;
if (e.detail.userInfo != null) {
- app.globalData.userInfo = e.detail.userInfo;
- nickName = app.globalData.userInfo.nickName;
- gender = app.globalData.userInfo.gender;
- province = app.globalData.userInfo.province;
- city = app.globalData.userInfo.city;
- country = app.globalData.userInfo.country;
- avatarUrl = app.globalData.userInfo.avatarUrl;
- //判断用户是否获取绑定信息
- if (that.data.showCustomerChoise) {
- if (that.data.array[that.data.index].ID == 0) {
- wx.showToast({
- image: '/imgs/avatar.png',
- title: '请选择所属客户',
- })
- return false;
- }
+ app.globalData.userInfo = e.detail.userInfo
+ if (that.data.customerArray[that.data.index].ID == 0) {
+ wx.showToast({
+ title: '请选择所属客户',
+ })
+ return false;
}
- if (app.globalData.Phone == "") {
+ if (this.data.phoneNum == "") {
wx.showToast({
- image: '/imgs/avatar.png',
- title: '手机号码不能为空',
+ title: '请输入手机号码',
})
return false;
- } else if (!(/^1[34578]\d{9}$/.test(app.globalData.Phone))) {
+ } else if (!(/^1[34578]\d{9}$/.test(this.data.phoneNum))) {
wx.showToast({
- image: '/imgs/avatar.png',
title: '号码不正确',
})
return false;
}
+ let userInfos = app.globalData.userInfo
+ let method = bindByPhone;
+ let params = [{
+ "OpenId": app.globalData.openID,
+ "Phone": this.data.phoneNum,
+ "NickName": userInfos.nickName,
+ "Sex": userInfos.gender,
+ "Province": userInfos.province,
+ "City": userInfos.city,
+ "Country": userInfos.country,
+ "HeadImgUrl": userInfos.avatarUrl,
+ "UnionId": ""
+ }];
+ network.transfer_request(method, params, function (res) {
+ if (res.result != null) {
+ app.globalData.phoneNum = that.data.phoneNum;
+ // 判断是否绑定成功
+ Bind(that)
+ }
+ })
} else {
wx.showModal({
title: '授权提示',
@@ -146,104 +206,5 @@ Page({
showCancel: false
})
}
- var method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/Bind';
- var params = [{
- OpenId: openid,
- Phone: app.globalData.Phone,
- NickName: app.globalData.userInfo.nickName,
- Sex: app.globalData.userInfo.gender,
- Province: app.globalData.userInfo.province,
- City: app.globalData.userInfo.city,
- Country: app.globalData.userInfo.country,
- HeadImgUrl: app.globalData.userInfo.avatarUrl,
- UnionId: "",
- //请求新增参数
- AppId: app.globalData.AppId,
- CustomerId: that.data.array[that.data.index].ID,
- }];
- var storageCustomerID = that.data.array[that.data.index].ID;
- app.globalData.CustomerId = storageCustomerID;
-
- // 先绑定客户服务器
- that.bindCustomerPreviousURL(function(res) {
- // 再绑定中转服务器
- network.previousRequestLoading(method, params, function(res) {
- // 再判断是否关联公众号
- IsBindWeixinMP(app.globalData.Phone);
-
- });
- })
- },
-
- // 进入公众号绑定页面
- bindPublicNumber: function(event){
- wx.navigateTo({
- url: '/pages/first/first?code=' + code,
- })
- },
-
- // 绑定客户服务器
- bindCustomerPreviousURL: function(successaction) {
- var method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/AccountRpc/XuBindByPhone';
- var previousParams = [{
- OpenId: openid,
- Phone: app.globalData.Phone,
- NickName: app.globalData.userInfo.nickName,
- Sex: app.globalData.userInfo.gender,
- Province: app.globalData.userInfo.province,
- City: app.globalData.userInfo.city,
- Country: app.globalData.userInfo.country,
- HeadImgUrl: app.globalData.userInfo.avatarUrl,
- UnionId: "",
- }];
- network.requestLoading(method, previousParams, function(res) {
- successaction(res.result);
- })
- },
-
- // 页面初始化 静默登录相关判断
- onShow: function() {
- var that = this;
- this.choiceCustomer(function (res){
- getOpenId(function (res) {
- openid = res;
- IsBind(openid, function (res) {
- app.globalData.Phone = res;
- if (res == "") {
-
- } else {
- //跳转到指定页面
- IsBindWeixinMP(app.globalData.Phone)
- }
- })
- })
- });
-
},
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
- var that = this
- if (res.from === 'button') {
- // 来自页面内转发按钮
- console.log(res.target)
- }
- return {
- title: '分享页面的标题',
- path: "/pages/login/login",
- //分享成功后执行
- success: function(res) {
- console.log("--------------转发成功--------------------")
- },
-
- fail: function(res) {
- console.log("--------------转发失败--------------------")
- }
- }
- }
-
-
-
})
\ No newline at end of file
diff --git a/pages/login/login.json b/pages/login/login.json
index 58857d8..7806624 100644
--- a/pages/login/login.json
+++ b/pages/login/login.json
@@ -1 +1,5 @@
-{"navigationBarTitleText": "禽客户易"}
\ No newline at end of file
+{
+ "navigationBarBackgroundColor": "white",
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "禽客户易"
+ }
\ No newline at end of file
diff --git a/pages/login/login.wxml b/pages/login/login.wxml
index 9f096c4..0a17aa7 100644
--- a/pages/login/login.wxml
+++ b/pages/login/login.wxml
@@ -1,16 +1,26 @@
-
-
+
+
-
-
- {{array[index].Name}}
-
-
+
+ 绑定客户
+
+
+ {{customerArray[index].Name}}
+
+
+
+
+
+
+ 手机号码
+
+
+
+
+
-
-
-
+
\ No newline at end of file
diff --git a/pages/login/login.wxss b/pages/login/login.wxss
index b5950ef..54cf4bd 100644
--- a/pages/login/login.wxss
+++ b/pages/login/login.wxss
@@ -1,60 +1,87 @@
-page {
- background: #fff;
+/* pages/login/login.wxss */
+.containerView{
+ margin-left: 30rpx;
+ margin-right: 30rpx;
+ height: 240rpx;
+ margin-top: 40%;
+ display: flex;
+ flex-direction: column;
+
}
-.img1 {
- margin-left: 35%;
- height: 150px;
- width: 150px;
- margin-top: 20%;
+.customerChooseView{
+ height: 120rpx;
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ font-size: 20px;
+ color: black;
}
-.pickerPlaceHolder {
- text-align: center;
- height: 40px;
- background: #EAF1F8;
- line-height: 40px;
- color: #999;
+.keyView{
+ padding-top: 60rpx;
+ width: 40%;
+ height: 100%;
}
-.pickerSelected {
- text-align: center;
- height: 40px;
- line-height: 40px;
- background: #EAF1F8;
+.valueView{
+ padding-top: 60rpx;
+ width: 60%;
+ height: 100%;
+}
+
+.pickerPlaceHolder{
+ color:rgb(202, 202, 202);
+}
+
+.pickerSelected{
color: black;
}
-.view2 {
- border-top: 1px solid #fafafa;
- border-right: 1px solid #fafafa;
- border-left: 1px solid #fafafa;
- border-bottom: 1px solid #fafafa;
- width: 90%;
- height: 40px;
- margin-left: 5%;
- margin-right: 5%;
- border-radius: 0.2em;
- margin-top: 5%;
+.lineView {
+ height: 1rpx;
+ background-color: #dbdbdb;
+}
+
+.imageView {
+ height: 80px;
+ width: 100%;
+ margin-top: 30px;
+ position: relative;
+ align-items: center;
+ justify-content: center;
+ box-sizing: content-box;
}
-.input {
+/* .currentImage {
+ width: 100%;
+ height: 100%;
+} */
+
+.btnTextView {
+ position: absolute;
+ width: 100%;
+ top:0;
+ line-height: 65px;
text-align: center;
- height: 40px;
- background: #EAF1F8;
}
-.denglu {
- margin-left: 5%;
- margin-top: 10%;
- width: 90%;
- margin-right: 5%;
- background: #f98b29;
- color: #fff;
+.btnText {
+ color: white;
+ font-size: 34rpx;
}
-.wxmp {
- position: fixed;
- bottom: 0rpx;
- width: 100%;
+.btn_btn {
+ font-size: 40rpx;
+ color: white;
+ margin-top: 10%;
+ padding: 0, auto;
+ display: block;
+ border: none;
+ background: transparent;
}
+.currentImage {
+ width: 100%;
+ height: 80px;
+
+}
\ No newline at end of file
diff --git a/pages/orderDetails/orderDetails.js b/pages/orderDetails/orderDetails.js
index 500fd81..c802a47 100644
--- a/pages/orderDetails/orderDetails.js
+++ b/pages/orderDetails/orderDetails.js
@@ -22,7 +22,7 @@ Page({
var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrderDetail';
var params = [ID];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
that.setData({
list: res.result,
})
diff --git a/pages/orderInquiry/orderInquiry.js b/pages/orderInquiry/orderInquiry.js
index c2dd875..ff84a07 100644
--- a/pages/orderInquiry/orderInquiry.js
+++ b/pages/orderInquiry/orderInquiry.js
@@ -50,7 +50,7 @@ Page({
var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrder';
var params = [0, pageindex, pagesize];
- network.requestLoading(method, params, function(res) {
+ network.transfer_request(method, params, function(res) {
for (var i = 0; i < res.result.length; i++) {
let dmo = {
LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"),
@@ -68,7 +68,7 @@ Page({
var reslut1=[];
var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrder';
var params = [20, pageindex, pagesize];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
for (var i = 0; i < res.result.length; i++) {
let dmo = {
LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"),
@@ -127,7 +127,7 @@ Page({
var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrder';
var params = [0, pageindex, pagesize];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
for (var i = 0; i < res.result.length; i++) {
let dmo = {
LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"),
diff --git a/pages/saleOutStore/outStoreDetail/outStoreDetail.js b/pages/saleOutStore/outStoreDetail/outStoreDetail.js
index ca823c9..25e5a77 100644
--- a/pages/saleOutStore/outStoreDetail/outStoreDetail.js
+++ b/pages/saleOutStore/outStoreDetail/outStoreDetail.js
@@ -18,7 +18,7 @@ Page({
let totalMoney = 0;
let method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/SaleOutStoreRpc/GetSaleOutStoreDetail';
let params = [detailItemID];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
var array = res.result;
for (var i = 0; i < array.length; i++) {
if (array[i].Money) {
diff --git a/pages/saleOutStore/saleOutStore.js b/pages/saleOutStore/saleOutStore.js
index e774608..dd89a12 100644
--- a/pages/saleOutStore/saleOutStore.js
+++ b/pages/saleOutStore/saleOutStore.js
@@ -12,7 +12,7 @@ function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize) {
let getArr = [];
let method = outStoreMethod;
let params = [0, UnCheckPageIndex, UnCheckPageSize];
- network.requestLoading(method, params, function(res) {
+ network.transfer_request(method, params, function(res) {
var array = res.result;
if (array.length <= 0) {
wx.showToast({
@@ -48,7 +48,7 @@ function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) {
let getArr = [];
let method = outStoreMethod;
let params = [20, CheckedPageIndex, CheckedPageSize];
- network.requestLoading(method, params, function(res) {
+ network.transfer_request(method, params, function(res) {
var array = res.result;
if (array.length <= 0) {
wx.showToast({
diff --git a/pages/sendCargo/sendCargo.js b/pages/sendCargo/sendCargo.js
index 363b42d..2328408 100644
--- a/pages/sendCargo/sendCargo.js
+++ b/pages/sendCargo/sendCargo.js
@@ -22,7 +22,7 @@ Page({
var reslut = [];
var method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/GetNoDriverOrder';
var params = [];
- network.requestLoading(method, params, function (res) {
+ network.transfer_request(method, params, function (res) {
for (var i = 0; i < res.result.length; i++) {
let dmo = {
LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"),
diff --git a/pages/sendCargo/sendCargo.wxml b/pages/sendCargo/sendCargo.wxml
index 9c176da..ac12f51 100644
--- a/pages/sendCargo/sendCargo.wxml
+++ b/pages/sendCargo/sendCargo.wxml
@@ -18,6 +18,7 @@ Customer_Name}}
¥{{item.Money}}
+
NO.{{item.
diff --git a/pages/sendCargo/sendCargo.wxss b/pages/sendCargo/sendCargo.wxss
index 5d74076..b732418 100644
--- a/pages/sendCargo/sendCargo.wxss
+++ b/pages/sendCargo/sendCargo.wxss
@@ -44,11 +44,11 @@ page {
}
.goodsNum{
height: 100%;
- width: 50%;
+ width: 30%;
}
.goodsMoney{
height: 100%;
- width: 50%;
+ width: 70%;
text-align: right;
}
diff --git a/pages/sendTheDetails/sendTheDetails.js b/pages/sendTheDetails/sendTheDetails.js
index 5a6d389..c8abecd 100644
--- a/pages/sendTheDetails/sendTheDetails.js
+++ b/pages/sendTheDetails/sendTheDetails.js
@@ -28,7 +28,7 @@ Page({
"PageSize": 100
}];
- network.requestLoading(method2, params2, function(res) {
+ network.transfer_request(method2, params2, function(res) {
that.setData({
name1: res.result,
})
@@ -53,7 +53,7 @@ Page({
var method1 = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/LoadForDriver';
var params1 = [ID];
- network.requestLoading(method1, params1, function(res) {
+ network.transfer_request(method1, params1, function(res) {
that.setData({
ID1: res.result.ID,
LoadTime1: timechage.formatTimeTwo(res.result.LoadTime.substring(6, 19), "Y/M/D"),
@@ -74,7 +74,7 @@ Page({
"PageSize": 100
}];
- network.requestLoading(method2, params2, function(res) {
+ network.transfer_request(method2, params2, function(res) {
//res就是我们请求接口返回的数据
that.setData({
name1: res.result,
@@ -134,7 +134,7 @@ Page({
} else {
var method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/SetDriverToOrder';
var params = [ID, ID4];
- network.requestLoading(method, params, function(res) {
+ network.transfer_request(method, params, function(res) {
if (ID4 != null) {
wx.navigateBack({
delta: "/pages/theDriverSend/theDriverSend"
diff --git a/pages/statementOfAccount/statementOfAccount.js b/pages/statementOfAccount/statementOfAccount.js
index 5f8090e..ba81413 100644
--- a/pages/statementOfAccount/statementOfAccount.js
+++ b/pages/statementOfAccount/statementOfAccount.js
@@ -44,7 +44,7 @@ Page({
getBalanceList: function(params, clear) {
let that = this;
- network.requestLoading(method, params, function(res) {
+ network.transfer_request(method, params, function(res) {
var array = JSON.parse(res.result);
if (array.length <= 0) {
wx.showToast({
diff --git a/utils/net.js b/utils/net.js
index 4a03b3e..3a2aee4 100644
--- a/utils/net.js
+++ b/utils/net.js
@@ -1,98 +1,152 @@
//不显示对话框的请求
const app = getApp()
-function request(url, params, success, fail) {
- this.requestLoading(url, params, "", success, fail)
-}
+var reconnectMethod = '';
+var reconnectParams = [];
+var newReconnectMethod = '';
+var newReconnectParams = [];
+
-// 请求自己的服务器
-function previousRequestLoading(method, params, successaction) {
+function requestLoading(method, params, successaction) {
+ reconnectMethod = method;
+ reconnectParams = params;
wx.showLoading({
title: "加载中",
})
+
var data = {
'id': 1,
'method': method,
'params': params
};
- var baseUrl = app.globalData.BaseUrl;
+
wx.request({
- url: baseUrl,
+ url: app.globalData.baseUrl,
data: data,
header: {
- 'content-type': 'application/json'
+ 'content-type': 'application/json',
+ 'cookie': app.globalData.cookie
},
- method: 'post',
- success: function(res) {
- console.log(res)
+ method: 'POST',
+ success: function (res) {
+ // console.log(res)
if (res.data.error != null) {
- wx.showModal({
- showCancel: false,
- title: '执行出错',
- content: res.data.error.message,
- })
+ if (res.data.error.code == 401) {
+ wx.request({
+ url: app.globalData.baseUrl,
+ data: {
+ 'id': 1,
+ 'method': "/MainSystem/MainSystem/Auth/WeixinLogin",
+ 'params': [app.globalData.appID, app.globalData.openID]
+ },
+ header: {
+ 'content-type': 'application/json',
+ 'cookie': app.globalData.cookie
+ },
+ method: 'POST',
+ success: function (res) {
+ app.globalData.cookie = res.data.result;
+ requestLoading(reconnectMethod, reconnectParams, successaction);
+ }
+ })
+ } else {
+ wx.showModal({
+ showCancel: false,
+ title: '执行出错',
+ content: res.data.error.message,
+ })
+ }
} else {
successaction(res.data)
}
+
},
- fail: function(res) {
+ fail: function (res) {
+ console.log(res)
wx.showModal({
title: '执行出错',
content: res,
})
+
},
- complete: function(res) {
+ complete: function (res) {
wx.hideLoading()
},
})
}
-// 中转,请求客户服务器
-function requestLoading(method, params, successaction) {
+function transfer_request(method, params, successaction) {
+ newReconnectMethod = method;
+ newReconnectParams = params;
wx.showLoading({
title: "加载中",
})
+
var newData = {
- "DecryptCookie": "",
- "CustomerId": app.globalData.CustomerId,
- "AppendUrlString": "?appid=" + app.globalData.AppId + "&phone=" + app.globalData.Phone,
+ "DecryptCookie": app.globalData.cookie,
+ "CustomerId": app.globalData.globalCustomerID,
"Method": method,
"Data": params,
+ "AppendUrlString": "?appid=" + app.globalData.appID + "&phone=" + app.globalData.phoneNum,
};
- var baseUrl = app.globalData.TranferBaseUrl;
+
+ var baseUrl = app.globalData.tranferBaseUrl;
wx.request({
url: baseUrl,
data: newData,
header: {
- 'content-type': 'application/json'
+ 'content-type': 'application/json',
+ 'cookie': app.globalData.cookie
},
- method: 'post',
- success: function(res) {
- console.log(res)
+ method: 'POST',
+ success: function (res) {
+ // console.log(res)
if (res.data.error != null) {
- wx.showModal({
- showCancel: false,
- title: '执行出错',
- content: res.data.error.message,
- })
+ if (res.data.error.code == 401) {
+ wx.request({
+ url: app.globalData.tranferBaseUrl,
+ data: {
+ "DecryptCookie": app.globalData.cookie,
+ "CustomerId": app.globalData.globalCustomerID,
+ "Method": "/MainSystem/MainSystem/Auth/WeixinLogin",
+ "Data": [app.globalData.appID, app.globalData.openID]
+ },
+ header: {
+ 'content-type': 'application/json',
+ 'cookie': app.globalData.cookie
+ },
+ method: 'POST',
+ success: function (res) {
+ app.globalData.cookie = res.data.result;
+ transfer_request(newReconnectMethod, newReconnectParams, successaction);
+
+ }
+ })
+ } else {
+ wx.showModal({
+ showCancel: false,
+ title: '执行出错',
+ content: res.data.error.message,
+ })
+ }
} else {
successaction(res.data)
}
},
- fail: function(res) {
+ fail: function (res) {
+ console.log(res)
wx.showModal({
title: '执行出错',
content: res,
- })
+ });
},
- complete: function(res) {
+ complete: function (res) {
wx.hideLoading()
},
})
}
module.exports = {
- request: request,
requestLoading: requestLoading,
- previousRequestLoading: previousRequestLoading
-}
\ No newline at end of file
+ transfer_request: transfer_request
+}