// pages/order/order.js var app = getApp(); var network = require("../../utils/net.js") var timechage = require("../../utils/dateTimeUtil.js") var PageIndex = 0 var PageSize = 10 var getListPath = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/OrderRpc/GetList' function getList(that, PageIndex, PageSize) { let method = getListPath let params = [{ "BillState": app.globalData.selectBillState, "StartLoadTime": app.globalData.selectStartDate, "EndLoadTime": app.globalData.selectEndDate, "Customer_ID": app.globalData.selectCustomer_ID, "PageIndex": PageIndex, "PageSize": PageSize }]; network.transfer_request(method, params, function(res) { that.setData({ arry: res.result }) setColor(that) }) } function setColor(that) { let array = []; for (var i = 0; i < that.data.arry.length; i++) { var color = ""; if (that.data.arry[i].BillState == "未审核") { color = "rgb(231,20,20)" } else if (that.data.arry[i].BillState == "已审核") { color = "rgb(136,136,136)" } var dmo = { Customer_Name: that.data.arry[i].Customer_Name, LoadTime: timechage.formatTimeTwo(that.data.arry[i].LoadTime.substring(6, 19), 'Y/M/D h:m'), BillState: that.data.arry[i].BillState, ID: that.data.arry[i].ID, DepartmentWorkFlow_Detail_Name: that.data.arry[i].DepartmentWorkFlow_Detail_Name, color: color, Money: that.data.arry[i].Money, Number: that.data.arry[i].Number }; array.push(dmo); } that.setData({ array: array }) } Page({ /** * 页面的初始数据 */ data: { array: [], arry: [], scrollTop: 0, scrollHeight: 0, winHeight: app.globalData.winHeight, }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { var that = this; PageIndex = 0 PageSize = 10 getList(that, PageIndex, PageSize) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { PageIndex = 0 PageSize = 10 this.setData({ array: [], arry: [] }) app.globalData.selectCustomer_ID = null app.globalData.selectStartDate = null app.globalData.selectEndDate = null app.globalData.selectBillState = 0 }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, onReachBottom: function() { }, refesh: function() { console.log('00000-----------') var that = this; PageIndex = 0; PageSize = 10; getList(that, PageIndex, PageSize) wx.stopPullDownRefresh() //停止下拉刷新 }, //未审核订单滑动到底部加载 scrollLower: function(event) { console.log('111111-----------') var that = this; PageIndex = PageIndex + 1; PageSize = 10; let method = getListPath; let params = [{ "BillState": app.globalData.selectBillState, "StartLoadTime": app.globalData.selectStartDate, "EndLoadTime": app.globalData.selectEndDate, "Customer_ID": app.globalData.selectCustomer_ID, "PageIndex": PageIndex, "PageSize": PageSize }]; network.transfer_request(method, params, function(res) { let addarry = that.data.arry.concat(res.result) that.setData({ arry: addarry }) setColor(that) }) }, itemclick: function(e) { wx.navigateTo({ url: 'detail/detail?ID=' + e.currentTarget.dataset.data.ID, }) }, createNew: function(e) { wx.navigateTo({ url: 'newBill/newBill', }) }, chose: function(e) { wx.navigateTo({ url: 'query/query', }) }, // 该方法绑定了页面滚动时的事件 scroll: function(event) { this.setData({ scrollTop: event.detail.scrollTop }); }, })