// pages/outStore/outStore.js var app = getApp() var network = require("../../utils/net.js") var timechage = require("../../utils/dateTimeUtil.js") var PageIndexN = 0 var PageSizeN = 10 var PageIndexY = 0 var PageSizeY = 10 function getListN(that, PageIndex, PageSize, Customer_ID, StartDate, EndDate, successaction) { let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleOutStoreRpc/GetSaleOutStore'; let params = [{ "BillState": 0, "PageIndex": PageIndex, "PageSize": PageSize, "Customer_ID": Customer_ID, "StartDate": StartDate, "EndDate": EndDate }]; network.transfer_request(method, params, function (res) { successaction(); that.setData({ arrayNN: res.result }) setTimeN(that) }) } function setTimeN(that) { let array = []; for (var i = 0; i < that.data.arrayNN.length; i++) { var dmo = { ID: that.data.arrayNN[i].ID, Money: that.data.arrayNN[i].Money, Customer_Name: that.data.arrayNN[i].Customer_Name, LoadTime: timechage.formatTimeTwo(that.data.arrayNN[i].LoadTime.substring(6, 19), 'Y-M-D') } array.push(dmo); } that.setData({ arrayN: array }) } function getListY(that, PageIndex, PageSize, Customer_ID, StartDate, EndDate) { let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleOutStoreRpc/GetSaleOutStore'; let params = [{ "BillState": 20, "PageIndex": PageIndex, "PageSize": PageSize, "Customer_ID": Customer_ID, "StartDate": StartDate, "EndDate": EndDate }]; network.transfer_request(method, params, function (res) { that.setData({ arrayYY: res.result }) setTimeY(that) }) } function setTimeY(that) { let array = []; for (var i = 0; i < that.data.arrayYY.length; i++) { var dmo = { ID: that.data.arrayYY[i].ID, Money: that.data.arrayYY[i].Money, Customer_Name: that.data.arrayYY[i].Customer_Name, LoadTime: timechage.formatTimeTwo(that.data.arrayYY[i].LoadTime.substring(6, 19), 'Y-M-D') } array.push(dmo); } that.setData({ arrayY: array }) } Page({ /** * 页面的初始数据 */ data: { winHeight: app.globalData.winHeight, // tab切换 currentTab: 0, arrayN: [1,2,3,4,5,6,7,7,7,8,8,8,8,1], arrayY: [1, 2, 3, 4, 5, 6, 7, 7, 7, 8, 8, 8, 8, 1], arrayNN: [], arrayYY: [], Customer_ID: null, StartDate: null, EndDate: null }, onShow: function () { var that = this; this.setData({ Customer_ID: app.globalData.selectCustomer_ID, StartDate: app.globalData.selectStartDate, EndDate: app.globalData.selectEndDate }) PageIndexN = 0 PageSizeN = 10 PageIndexY = 0 PageSizeY = 10 getListN(that, PageIndexN, PageSizeN, this.data.Customer_ID, this.data.StartDate, this.data.EndDate, function (res) { getListY(that, PageIndexY, PageSizeY, that.data.Customer_ID, that.data.StartDate, that.data.EndDate); }); }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { PageIndexN = 0 PageSizeN = 10 PageIndexY = 0 PageSizeY = 10 this.setData({ arrayN: [], arrayY: [], arrayNN: [], arrayYY: [] }) app.globalData.SaleOutCustomer_ID = null app.globalData.SaleOutStartDate = null app.globalData.SaleOutEndDate = null }, upperN: function (e) { var that = this; PageIndexN = 0 PageSizeN = 10 getListN(that, PageIndexN, PageSizeN, this.data.Customer_ID, this.data.StartDate, this.data.EndDate, function (res) { }) }, lowerN: function (e) { var that = this; PageIndexN = PageIndexN + 1; PageSizeN = 10; let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleOutStoreRpc/GetSaleOutStore'; let params = [{ "BillState": 0, "PageIndex": PageIndexN, "PageSize": PageSizeN, "Customer_ID": that.data.Customer_ID, "StartDate": that.data.StartDate, "EndDate": that.data.EndDate }]; network.transfer_request(method, params, function (res) { let addarry = that.data.arrayNN.concat(res.result) that.setData({ arrayNN: addarry }) setTimeN(that) }) }, upperY: function (e) { var that = this; PageIndexY = 0 PageSizeY = 10 getListY(that, PageIndexY, PageSizeY, this.data.Customer_ID, this.data.StartDate, this.data.EndDate) }, lowerY: function (e) { var that = this; PageIndexY = PageIndexY + 1; PageSizeY = 10; let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleOutStoreRpc/GetSaleOutStore'; let params = [{ "BillState": 20, "PageIndex": PageIndexY, "PageSize": PageSizeY, "Customer_ID": that.data.Customer_ID, "StartDate": that.data.StartDate, "EndDate": that.data.EndDate }]; network.transfer_request(method, params, function (res) { let addarry = that.data.arrayYY.concat(res.result) that.setData({ arrayYY: addarry }) setTimeY(that) }) }, /** * 滑动切换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 }) } }, itemclick: function (e) { wx.navigateTo({ url: 'outStoreDetail/outStoreDetail?ID=' + e.currentTarget.dataset.data.ID, }) }, chose: function (e) { wx.navigateTo({ url: 'query/query', }) } })