Browse Source

1、接口请求方法及登录方式统一

master
chenxuhui 7 years ago
parent
commit
347b461426
19 changed files with 394 additions and 326 deletions
  1. +23
    -12
      app.js
  2. BIN
      imgs/bindImage.png
  3. +2
    -2
      pages/debitNoteList/debitNoteDetail/debitNoteDetail.js
  4. +2
    -2
      pages/debitNoteList/debitNoteList.js
  5. +18
    -18
      pages/homePage/homePage.js
  6. +145
    -184
      pages/login/login.js
  7. +5
    -1
      pages/login/login.json
  8. +20
    -10
      pages/login/login.wxml
  9. +70
    -43
      pages/login/login.wxss
  10. +1
    -1
      pages/orderDetails/orderDetails.js
  11. +3
    -3
      pages/orderInquiry/orderInquiry.js
  12. +1
    -1
      pages/saleOutStore/outStoreDetail/outStoreDetail.js
  13. +2
    -2
      pages/saleOutStore/saleOutStore.js
  14. +1
    -1
      pages/sendCargo/sendCargo.js
  15. +1
    -0
      pages/sendCargo/sendCargo.wxml
  16. +2
    -2
      pages/sendCargo/sendCargo.wxss
  17. +4
    -4
      pages/sendTheDetails/sendTheDetails.js
  18. +1
    -1
      pages/statementOfAccount/statementOfAccount.js
  19. +93
    -39
      utils/net.js

+ 23
- 12
app.js View File

@ -1,20 +1,31 @@
App({ App({
onLaunch: function () { onLaunch: function () {
var that = this;
wx.getSystemInfo({
success: function (res) {
that.globalData.winHeight = res.windowHeight;
}
});
}, },
globalData: { 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:"",
}, },
}) })

BIN
imgs/bindImage.png View File

Before After
Width: 1207  |  Height: 258  |  Size: 15 KiB

+ 2
- 2
pages/debitNoteList/debitNoteDetail/debitNoteDetail.js View File

@ -26,7 +26,7 @@ Page({
let method = getDebitNoteDetail; let method = getDebitNoteDetail;
let params = [orderID]; 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'); var backDate = timechage.formatTimeTwo(res.result.Date.substring(6, 19), 'Y/M/D');
if (res.result.ConfirmTime){ if (res.result.ConfirmTime){
var backConfirmTime = timechage.formatTimeTwo(res.result.ConfirmTime.substring(6, 19), 'Y/M/D'); var backConfirmTime = timechage.formatTimeTwo(res.result.ConfirmTime.substring(6, 19), 'Y/M/D');
@ -45,7 +45,7 @@ Page({
var orderID = event.currentTarget.dataset.orderid; var orderID = event.currentTarget.dataset.orderid;
let method = confirmDebitNote; let method = confirmDebitNote;
let params = [orderID]; let params = [orderID];
network.requestLoading(method, params, function (res) {
network.transfer_request(method, params, function (res) {
wx.showToast({ wx.showToast({
title: '操作成功', title: '操作成功',
success: function (res){ success: function (res){


+ 2
- 2
pages/debitNoteList/debitNoteList.js View File

@ -24,7 +24,7 @@ function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, successact
"PageSize": UnCheckPageSize, "PageSize": UnCheckPageSize,
}]; }];
network.requestLoading(method, params, function (res) {
network.transfer_request(method, params, function (res) {
successaction(); successaction();
var array = res.result; var array = res.result;
if (array.length <= 0) { if (array.length <= 0) {
@ -64,7 +64,7 @@ function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) {
"PageSize": UnCheckPageSize, "PageSize": UnCheckPageSize,
}]; }];
// let params = [true, CheckedPageIndex, CheckedPageSize]; // let params = [true, CheckedPageIndex, CheckedPageSize];
network.requestLoading(method, params, function (res) {
network.transfer_request(method, params, function (res) {
var array = res.result; var array = res.result;
if (array.length <= 0) { if (array.length <= 0) {
wx.showToast({ wx.showToast({


+ 18
- 18
pages/homePage/homePage.js View File

@ -6,7 +6,7 @@ var timechage = require("../../utils/dateTimeUtil.js")
function GetUserProfile(successtion) { function GetUserProfile(successtion) {
let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/AccountBalanceRpc/GetCurrentBalanceMoney'; let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/AccountBalanceRpc/GetCurrentBalanceMoney';
let params = []; let params = [];
network.requestLoading(method, params, function (res) {
network.transfer_request(method, params, function(res) {
successtion(res); successtion(res);
}) })
} }
@ -14,26 +14,26 @@ function GetUserProfile(successtion) {
Page({ Page({
data: { data: {
currentDate: timechage.formatTimeTwo(Date.parse(new Date()), 'Y/M/D'), currentDate: timechage.formatTimeTwo(Date.parse(new Date()), 'Y/M/D'),
balance:"",
balance: "",
}, },
onLoad: function (options) {
onLoad: function(options) {
var that = this; var that = this;
// 添加接口请求当前余额 // 添加接口请求当前余额
GetUserProfile(function (res) {
GetUserProfile(function(res) {
console.log(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 btnID = event.currentTarget.dataset.itemid;
var transferURL = ''; var transferURL = '';
switch (btnID) { switch (btnID) {
@ -41,26 +41,26 @@ Page({
case "1": case "1":
transferURL = '/pages/saleForecastList/saleForecastList'; transferURL = '/pages/saleForecastList/saleForecastList';
break; break;
// 对账单
// 对账单
case "2": case "2":
transferURL = '/pages/statementOfAccount/statementOfAccount'; transferURL = '/pages/statementOfAccount/statementOfAccount';
break; break;
// 客户找车
// 客户找车
case "3": case "3":
transferURL = '/pages/sendCargo/sendCargo'; transferURL = '/pages/sendCargo/sendCargo';
break; break;
// 销售出库
// 销售出库
case "4": case "4":
transferURL = '/pages/saleOutStore/saleOutStore'; transferURL = '/pages/saleOutStore/saleOutStore';
break; break;
// 担保单
// 担保单
case "5": case "5":
transferURL = '/pages/guarantee/guarantee'; transferURL = '/pages/guarantee/guarantee';
break; break;
case "6": case "6":
transferURL = '/pages/statementOfAccount/statementOfAccount'; transferURL = '/pages/statementOfAccount/statementOfAccount';
break;
case "7":
break;
case "7":
transferURL = '/pages/debitNoteList/debitNoteList'; transferURL = '/pages/debitNoteList/debitNoteList';
break; break;
} }
@ -70,5 +70,5 @@ Page({
}) })
}, },
}) })

+ 145
- 184
pages/login/login.js View File

@ -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 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及用户电话 参数1appID 2openID
* 返回值globalCustomerIDWeixinUser_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) { function IsBindWeixinMP(phone) {
let method = '/MainSystem/B3WeChatMiniProgram/Rpcs/CommonRpc/IsBindWeixinMP';
let method = isBindWeixinPath;
let params = [phone]; let params = [phone];
network.previousRequestLoading(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({
@ -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({ Page({
data: { data: {
userInfo: "",
array: [{
phoneNum: "",
index: 0,
customerArray: [{
ID: 0, ID: 0,
Name: "请选择所属客户" Name: "请选择所属客户"
}], }],
index: 0,
//根据customerID值判断是否隐藏选择框(默认显示)
showCustomerChoise: true,
}, },
// 客户列表变更选项信息 // 客户列表变更选项信息
listenerPickerSelected: function(e) {
listenerPickerSelected: function (e) {
this.setData({ this.setData({
index: e.detail.value, 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 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) { if (res.result.length > 0) {
var lastArr = that.data.array.concat(res.result)
var lastArr = that.data.customerArray.concat(res.result)
that.setData({ 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; var that = this;
if (e.detail.userInfo != null) { 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({ wx.showToast({
image: '/imgs/avatar.png',
title: '手机号码不能为空',
title: '请输入手机号码',
}) })
return false; return false;
} else if (!(/^1[34578]\d{9}$/.test(app.globalData.Phone))) {
} else if (!(/^1[34578]\d{9}$/.test(this.data.phoneNum))) {
wx.showToast({ wx.showToast({
image: '/imgs/avatar.png',
title: '号码不正确', title: '号码不正确',
}) })
return false; 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 { } else {
wx.showModal({ wx.showModal({
title: '授权提示', title: '授权提示',
@ -146,104 +206,5 @@ Page({
showCancel: false 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("--------------转发失败--------------------")
}
}
}
}) })

+ 5
- 1
pages/login/login.json View File

@ -1 +1,5 @@
{"navigationBarTitleText": "禽客户易"}
{
"navigationBarBackgroundColor": "white",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "禽客户易"
}

+ 20
- 10
pages/login/login.wxml View File

@ -1,16 +1,26 @@
<image class='img1' src='/imgs/tuceng.png'>
</image>
<!--pages/login/login.wxml-->
<view class='containerView'>
<view class="view2">
<picker class="{{index==0 ? 'pickerPlaceHolder' : 'pickerSelected'}}" mode="selector" range="{{array}}" value="{{array[index].Name}}" range-key="Name" bindchange="listenerPickerSelected">
<text>{{array[index].Name}}</text>
</picker>
</view>
<view class='customerChooseView'>
<view class='keyView'>绑定客户</view>
<view class='valueView'>
<picker class="{{index==0 ? 'pickerPlaceHolder' : 'pickerSelected'}}" mode="selector" range="{{customerArray}}" value="{{customerArray[index].Name}}" range-key="Name" bindchange="listenerPickerSelected">
<text>{{customerArray[index].Name}}</text>
</picker>
</view>
</view>
<view class='lineView'></view>
<view class='customerChooseView'>
<view class='keyView'>手机号码</view>
<view class='valueView'>
<input class='imput_phone' bindinput='getPhone' type='number' maxlength='11' placeholder='请输入手机号' placeholder-style='color:rgb(202, 202, 202)'></input>
</view>
</view>
<view class='lineView'></view>
<view class='view2'>
<input class='input' placeholder='请输入手机号' placeholder-style='color: #999' type='number' bindinput="phoneNum" maxlength="11"></input>
</view> </view>
<button open-type="getUserInfo" bindgetuserinfo="getUserInfo" class='denglu'>绑定</button>
<button class='btn_btn' plain="true" style='border:none' open-type="getUserInfo" bindgetuserinfo="getUserInfo"><image class='currentImage' src="/imgs/bindImage.png" mode='widthFix'></image></button>
<official-account class="wxmp"></official-account> <official-account class="wxmp"></official-account>

+ 70
- 43
pages/login/login.wxss View File

@ -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; 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; 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;
}

+ 1
- 1
pages/orderDetails/orderDetails.js View File

@ -22,7 +22,7 @@ Page({
var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrderDetail'; var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrderDetail';
var params = [ID]; var params = [ID];
network.requestLoading(method, params, function (res) {
network.transfer_request(method, params, function (res) {
that.setData({ that.setData({
list: res.result, list: res.result,
}) })


+ 3
- 3
pages/orderInquiry/orderInquiry.js View File

@ -50,7 +50,7 @@ Page({
var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrder'; var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrder';
var params = [0, pageindex, pagesize]; 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++) { for (var i = 0; i < res.result.length; i++) {
let dmo = { let dmo = {
LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"), LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"),
@ -68,7 +68,7 @@ Page({
var reslut1=[]; var reslut1=[];
var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrder'; var method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrder';
var params = [20, pageindex, pagesize]; 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++) { for (var i = 0; i < res.result.length; i++) {
let dmo = { let dmo = {
LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"), 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 method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/OrderRpc/GetOrder';
var params = [0, pageindex, pagesize]; 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++) { for (var i = 0; i < res.result.length; i++) {
let dmo = { let dmo = {
LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"), LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"),


+ 1
- 1
pages/saleOutStore/outStoreDetail/outStoreDetail.js View File

@ -18,7 +18,7 @@ Page({
let totalMoney = 0; let totalMoney = 0;
let method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/SaleOutStoreRpc/GetSaleOutStoreDetail'; let method = '/MainSystem/B3MiniProgramRpc/Rpcs/CustomerRpc/SaleOutStoreRpc/GetSaleOutStoreDetail';
let params = [detailItemID]; let params = [detailItemID];
network.requestLoading(method, params, function (res) {
network.transfer_request(method, params, function (res) {
var array = res.result; var array = res.result;
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
if (array[i].Money) { if (array[i].Money) {


+ 2
- 2
pages/saleOutStore/saleOutStore.js View File

@ -12,7 +12,7 @@ function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize) {
let getArr = []; let getArr = [];
let method = outStoreMethod; let method = outStoreMethod;
let params = [0, UnCheckPageIndex, UnCheckPageSize]; let params = [0, UnCheckPageIndex, UnCheckPageSize];
network.requestLoading(method, params, function(res) {
network.transfer_request(method, params, function(res) {
var array = res.result; var array = res.result;
if (array.length <= 0) { if (array.length <= 0) {
wx.showToast({ wx.showToast({
@ -48,7 +48,7 @@ function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) {
let getArr = []; let getArr = [];
let method = outStoreMethod; let method = outStoreMethod;
let params = [20, CheckedPageIndex, CheckedPageSize]; let params = [20, CheckedPageIndex, CheckedPageSize];
network.requestLoading(method, params, function(res) {
network.transfer_request(method, params, function(res) {
var array = res.result; var array = res.result;
if (array.length <= 0) { if (array.length <= 0) {
wx.showToast({ wx.showToast({


+ 1
- 1
pages/sendCargo/sendCargo.js View File

@ -22,7 +22,7 @@ Page({
var reslut = []; var reslut = [];
var method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/GetNoDriverOrder'; var method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/GetNoDriverOrder';
var params = []; var params = [];
network.requestLoading(method, params, function (res) {
network.transfer_request(method, params, function (res) {
for (var i = 0; i < res.result.length; i++) { for (var i = 0; i < res.result.length; i++) {
let dmo = { let dmo = {
LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"), LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"),


+ 1
- 0
pages/sendCargo/sendCargo.wxml View File

@ -18,6 +18,7 @@ Customer_Name}}</text>
<text class='goodsMoneyText'>¥{{item.Money}}</text> <text class='goodsMoneyText'>¥{{item.Money}}</text>
</view> </view>
</view> </view>
<view class='bottomView'> <view class='bottomView'>
<view class='goodsNum'> <view class='goodsNum'>
<text class='goodsNumText'>NO.{{item. <text class='goodsNumText'>NO.{{item.


+ 2
- 2
pages/sendCargo/sendCargo.wxss View File

@ -44,11 +44,11 @@ page {
} }
.goodsNum{ .goodsNum{
height: 100%; height: 100%;
width: 50%;
width: 30%;
} }
.goodsMoney{ .goodsMoney{
height: 100%; height: 100%;
width: 50%;
width: 70%;
text-align: right; text-align: right;
} }


+ 4
- 4
pages/sendTheDetails/sendTheDetails.js View File

@ -28,7 +28,7 @@ Page({
"PageSize": 100 "PageSize": 100
}]; }];
network.requestLoading(method2, params2, function(res) {
network.transfer_request(method2, params2, function(res) {
that.setData({ that.setData({
name1: res.result, name1: res.result,
}) })
@ -53,7 +53,7 @@ Page({
var method1 = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/LoadForDriver'; var method1 = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/LoadForDriver';
var params1 = [ID]; var params1 = [ID];
network.requestLoading(method1, params1, function(res) {
network.transfer_request(method1, params1, function(res) {
that.setData({ that.setData({
ID1: res.result.ID, ID1: res.result.ID,
LoadTime1: timechage.formatTimeTwo(res.result.LoadTime.substring(6, 19), "Y/M/D"), LoadTime1: timechage.formatTimeTwo(res.result.LoadTime.substring(6, 19), "Y/M/D"),
@ -74,7 +74,7 @@ Page({
"PageSize": 100 "PageSize": 100
}]; }];
network.requestLoading(method2, params2, function(res) {
network.transfer_request(method2, params2, function(res) {
//res就是我们请求接口返回的数据 //res就是我们请求接口返回的数据
that.setData({ that.setData({
name1: res.result, name1: res.result,
@ -134,7 +134,7 @@ Page({
} else { } else {
var method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/SetDriverToOrder'; var method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/SetDriverToOrder';
var params = [ID, ID4]; var params = [ID, ID4];
network.requestLoading(method, params, function(res) {
network.transfer_request(method, params, function(res) {
if (ID4 != null) { if (ID4 != null) {
wx.navigateBack({ wx.navigateBack({
delta: "/pages/theDriverSend/theDriverSend" delta: "/pages/theDriverSend/theDriverSend"


+ 1
- 1
pages/statementOfAccount/statementOfAccount.js View File

@ -44,7 +44,7 @@ Page({
getBalanceList: function(params, clear) { getBalanceList: function(params, clear) {
let that = this; let that = this;
network.requestLoading(method, params, function(res) {
network.transfer_request(method, params, function(res) {
var array = JSON.parse(res.result); var array = JSON.parse(res.result);
if (array.length <= 0) { if (array.length <= 0) {
wx.showToast({ wx.showToast({


+ 93
- 39
utils/net.js View File

@ -1,98 +1,152 @@
//不显示对话框的请求 //不显示对话框的请求
const app = getApp() 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({ wx.showLoading({
title: "加载中", title: "加载中",
}) })
var data = { var data = {
'id': 1, 'id': 1,
'method': method, 'method': method,
'params': params 'params': params
}; };
var baseUrl = app.globalData.BaseUrl;
wx.request({ wx.request({
url: baseUrl,
url: app.globalData.baseUrl,
data: data, data: data,
header: { 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) { 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 { } else {
successaction(res.data) successaction(res.data)
} }
}, },
fail: function(res) {
fail: function (res) {
console.log(res)
wx.showModal({ wx.showModal({
title: '执行出错', title: '执行出错',
content: res, content: res,
}) })
}, },
complete: function(res) {
complete: function (res) {
wx.hideLoading() wx.hideLoading()
}, },
}) })
} }
// 中转,请求客户服务器
function requestLoading(method, params, successaction) {
function transfer_request(method, params, successaction) {
newReconnectMethod = method;
newReconnectParams = params;
wx.showLoading({ wx.showLoading({
title: "加载中", title: "加载中",
}) })
var newData = { 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, "Method": method,
"Data": params, "Data": params,
"AppendUrlString": "?appid=" + app.globalData.appID + "&phone=" + app.globalData.phoneNum,
}; };
var baseUrl = app.globalData.TranferBaseUrl;
var baseUrl = app.globalData.tranferBaseUrl;
wx.request({ wx.request({
url: baseUrl, url: baseUrl,
data: newData, data: newData,
header: { 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) { 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 { } else {
successaction(res.data) successaction(res.data)
} }
}, },
fail: function(res) {
fail: function (res) {
console.log(res)
wx.showModal({ wx.showModal({
title: '执行出错', title: '执行出错',
content: res, content: res,
})
});
}, },
complete: function(res) {
complete: function (res) {
wx.hideLoading() wx.hideLoading()
}, },
}) })
} }
module.exports = { module.exports = {
request: request,
requestLoading: requestLoading, requestLoading: requestLoading,
previousRequestLoading: previousRequestLoading
}
transfer_request: transfer_request
}

Loading…
Cancel
Save