// 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: []
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function(options) {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function() {
|
|
var that = this;
|
|
PageIndex = 0
|
|
PageSize = 10
|
|
getList(that, PageIndex, PageSize)
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
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() {
|
|
console.log('00000-----------')
|
|
var that = this;
|
|
PageIndex = 0;
|
|
PageSize = 10;
|
|
getList(that, PageIndex, PageSize)
|
|
wx.stopPullDownRefresh() //停止下拉刷新
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
console.log('baseUrl-----------')
|
|
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',
|
|
})
|
|
}
|
|
})
|