// pages/orderList/orderList.js const app = getApp(); var network = require("../../utils/net.js"); var timechage = require("../../utils/dateTimeUtil.js"); var UnCheckPageIndex = 0 var UnCheckPageSize = 10 var CheckedPageIndex = 0 var CheckedPageSize = 10 var outStoreMethod = '/MainSystem/B3MiniProgramRpc/Rpcs/ManagerRpc/WorkFlowApproveRecordRpc/GetList' // 未审核订单列表 function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, successaction) { let getArr = []; let method = outStoreMethod; let params = [false, UnCheckPageIndex, UnCheckPageSize]; network.newRequestLoading(method, params, function (res) { var array = res.result; successaction(); if (array.length <= 0) { wx.showToast({ title: '无数据更新', }) if (UnCheckPageIndex > 0) { UnCheckPageIndex = UnCheckPageIndex - 1; } return; } for (var i = 0; i < array.length; i++) { var dmo = { //是否显示审批按钮所在bottom billState: true, billType: array[i].BillType_Name, billID: array[i].Bill_ID, remark: array[i].EndStateName, time: timechage.formatTimeTwo(array[i].CreateTime.substring(6, 19), 'Y/M/D h:m') } getArr.push(dmo); } let arrLast = that.data.unCheckDataArr.concat(getArr); that.setData({ unCheckDataArr: arrLast, }) }) } // 已审核订单列表 function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) { let getArr = []; let method = outStoreMethod; let params = [true, CheckedPageIndex, CheckedPageSize]; network.newRequestLoading(method, params, function (res) { var array = res.result; if (array.length <= 0) { wx.showToast({ title: '无数据更新', }) if (CheckedPageIndex > 0) { CheckedPageIndex = CheckedPageIndex - 1; } return; } for (var i = 0; i < array.length; i++) { var dmo = { //是否显示审批按钮所在bottom billState: false, billType: array[i].BillType_Name, billID: array[i].Bill_ID, remark: array[i].Remark, time: timechage.formatTimeTwo(array[i].CreateTime.substring(6, 19), 'Y/M/D h:m') } getArr.push(dmo); } let arrLast = that.data.checkedDataArr.concat(getArr); that.setData({ checkedDataArr: arrLast, }) }) } Page({ data: { checkedDataArr: [1,2,3], unCheckDataArr: [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], currentTab: 0, winHeight: 0, winWidth: 0, }, /** * 滑动切换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 }) } }, //点击进入详情页面 transToOrderDetail: function (event) { var itemID = event.currentTarget.dataset.detailitemid; wx.navigateTo({ url: 'orderDetail/orderDetail?id=' + itemID, }) }, onShow: function (options) { // this.setData({ // checkedDataArr: [], // unCheckDataArr: [], // }) var that = this; wx.getSystemInfo({ success: function (res) { that.setData({ winWidth: res.windowWidth, winHeight: res.windowHeight }); } }); // UnCheckPageIndex = 0; // CheckedPageIndex = 0; // getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, function (res) { // getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize); // }); }, //未审核订单滑动到底部加载 unCheckedScrollLower: function (event) { var that = this; UnCheckPageIndex = UnCheckPageIndex + 1; getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, function (res) { }); }, //已审核订单滑动到底部加载 CheckedScrollLower: function (event) { var that = this; CheckedPageIndex = CheckedPageIndex + 1; getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize); }, /** * 页面上拉触底事件的处理函数 */ // onReachBottom: function () { // var that = this; // if (this.data.currentTab === 0) { // UnCheckPageIndex = UnCheckPageIndex + 1; // getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize, function (res) { }); // } else { // CheckedPageIndex = CheckedPageIndex + 1; // getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize); // } // }, })