From 015dccda00552d6db0eb4500bf42ae8c85ab41c2 Mon Sep 17 00:00:00 2001 From: chenxuhui Date: Thu, 20 Dec 2018 09:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E6=94=B9?= =?UTF-8?q?=E5=9B=9E=E5=88=B0=E5=8E=9F=E6=9D=A5=E7=9A=84=E6=A0=B7=E5=AD=90?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E5=8A=A0=E5=AE=8C=E5=88=86=E9=A1=B5=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=A1=AE=E8=AE=A4=E6=95=B0=E9=87=8F=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/orderList/orderList.js | 114 +++++---------------------------- pages/orderList/orderList.json | 2 - pages/orderList/orderList.wxml | 17 +++-- 3 files changed, 23 insertions(+), 110 deletions(-) diff --git a/pages/orderList/orderList.js b/pages/orderList/orderList.js index c3a9a06..8dcea13 100644 --- a/pages/orderList/orderList.js +++ b/pages/orderList/orderList.js @@ -3,97 +3,30 @@ const app = getApp(); var network = require("../../utils/net.js"); var timechage = require("../../utils/dateTimeUtil.js"); var PageSize = 10 -var UnCheckPageIndex = 0 -var CheckedPageIndex = 0 +var PageIndex = 0 var getOrderList = '/MainSystem/B3MiniProgramRpc/XuRpcs/Driver/CarRecordRpc/GetList' -// 未审核订单列表 -function getUnCheckOrderList(that, UnCheckPageIndex, successaction) { - let getArr = []; - let method = getListPath; - let params = [false, app.globalData.Phone, UnCheckPageIndex, PageSize]; - network.transfer_request(method, params, function (res) { - successaction(); - var array = res.result; - if (array.length <= 0) { - wx.showToast({ - title: '无数据更新', - }) - UnCheckPageIndex = UnCheckPageIndex - 1; - return; - } - for (var i = 0; i < array.length; i++) { - var dmo = { - OrderState: "未审核", - ID: array[i].ID, - Employee_Name: array[i].Employee_Name, - TotalNumber: array[i].TotalNumber, - Customer_Name: array[i].Customer_Name, - LoadTime: timechage.formatTimeTwo(array[i].LoadTime.substring(6, 19), 'Y/M/D'), - Address: array[i].Address, - } - getArr.push(dmo); - } - let arrLast = that.data.unCheckDataArr.concat(getArr); - that.setData({ - unCheckDataArr: arrLast, - }) - }) -} - -// 已审核订单列表 -function getCheckedOrderList(that, CheckedPageIndex) { - let getArr = []; - let method = getListPath; - let params = [true, app.globalData.Phone, CheckedPageIndex, PageSize]; - network.transfer_request(method, params, function (res) { - var array = res.result; - if (array.length <= 0) { - wx.showToast({ - title: '无数据更新', - }) - CheckedPageIndex = CheckedPageIndex - 1; - return; - } - for (var i = 0; i < array.length; i++) { - var dmo = { - //添加单据状态的传递,在详情页面判断此值,进行是否允许提交的操作 - OrderState: "已审核", - ID: array[i].ID, - Employee_Name: array[i].Employee_Name, - TotalNumber: array[i].TotalNumber, - Customer_Name: array[i].Customer_Name, - LoadTime: timechage.formatTimeTwo(array[i].LoadTime.substring(6, 19), 'Y/M/D'), - Address: array[i].Address, - } - getArr.push(dmo); - } - let arrLast = that.data.checkedDataArr.concat(getArr); - // console.log(arrLast); - that.setData({ - checkedDataArr: arrLast, - }) - }) -} - Page({ data: { - checkedDataArr: [], - unCheckDataArr: [], winHeight: app.globalData.winHeight, - currentTab: 0, orderList: [], }, onShow: function(options) { + PageIndex = 0; + this.getOrderList(); + }, + + getOrderList:function (){ var that = this; var method = getOrderList; - network.transfer_request(method, [app.globalData.Phone], function(res) { + network.transfer_request(method, [app.globalData.Phone, PageIndex, PageSize], function (res) { var array = res.result; if (array.length <= 0) { wx: wx.showToast({ title: '暂无订单数据', }) + PageIndex = PageIndex - 1; return; } let getArr = []; @@ -108,8 +41,9 @@ Page({ } getArr.push(dmo); } + let arrLast = that.data.orderList.concat(getArr); that.setData({ - orderList: getArr, + orderList: arrLast, }) }) }, @@ -121,28 +55,10 @@ Page({ url: 'orderDetail/orderDetail?id=' + itemID, }) }, - /** - * 滑动切换tab - */ - bindChange: function (e) { - var that = this; - that.setData({ - currentTab: e.detail.current - }); - - }, - /** - * 点击tab切换 - */ - swichNav: function (e) { - var that = this; - if (this.data.currentTab === e.target.dataset.current) { - return false; - } else { - that.setData({ - currentTab: e.target.dataset.current - }) - } - }, + + onReachBottom :function(){ + PageIndex = PageIndex + 1; + this.getOrderList(); + } }) \ No newline at end of file diff --git a/pages/orderList/orderList.json b/pages/orderList/orderList.json index 6011cfd..544e7bb 100644 --- a/pages/orderList/orderList.json +++ b/pages/orderList/orderList.json @@ -1,5 +1,3 @@ { - "navigationBarBackgroundColor": "white", - "navigationBarTextStyle": "black", "navigationBarTitleText": "我的订单" } \ No newline at end of file diff --git a/pages/orderList/orderList.wxml b/pages/orderList/orderList.wxml index 45088b4..d199328 100644 --- a/pages/orderList/orderList.wxml +++ b/pages/orderList/orderList.wxml @@ -1,11 +1,10 @@ - + - - + - - +