You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

214 lines
5.6 KiB

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 getList = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/SaleForecastRpc/GetList'
// 未审核订单列表
function getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize) {
let getArr = [];
let method = getList;
let params = [{
"BillState": 0,
"Customer_ID": that.data.Customer_ID,
"PageIndex": UnCheckPageIndex,
"PageSize": UnCheckPageSize,
}];
// let params = [false, UnCheckPageIndex, UnCheckPageSize];
network.transfer_request(method, params, function (res) {
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 = {
// BillState: "未审核"
// Customer_Name: "陈旭辉"
// Date: "/Date(1540453380000+0800)/"
// DepartmentWorkFlow_Detail_Name: "初始"
// DepartmentWorkFlow_ID: 2
// ID: 4
// Money: 143
// Number: 1
// billType: array[i].BillType_Name,
//添加单据状态的传递,在详情页面判断此值,进行是否允许提交的操作 true : 可提交
orderState: true,
orderID: array[i].ID,
Customer_Name: array[i].Customer_Name,
time: timechage.formatTimeTwo(array[i].Date.substring(6, 19), 'Y/M/D')
}
getArr.push(dmo);
}
let arrLast = that.data.unCheckDataArr.concat(getArr);
that.setData({
unCheckDataArr: arrLast,
})
})
}
// 已审核订单列表
function getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize) {
let getArr = [];
let method = getList;
let params = [{
"BillState": 20,
"Customer_ID": that.data.Customer_ID,
"PageIndex": CheckedPageIndex,
"PageSize": CheckedPageSize,
}];
// let params = [true, CheckedPageIndex, CheckedPageSize];
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: false,
orderID: array[i].ID,
Customer_Name: array[i].Customer_Name,
time: timechage.formatTimeTwo(array[i].Date.substring(6, 19), 'Y/M/D')
}
getArr.push(dmo);
}
let arrLast = that.data.checkedDataArr.concat(getArr);
that.setData({
checkedDataArr: arrLast,
})
})
}
Page({
data: {
checkedDataArr: [],
unCheckDataArr: [],
currentTab: 0,
winHeight: 0,
winWidth: 0,
Customer_ID: null,
},
createNew: function (e) {
wx.navigateTo({
url: 'newBill/newBill',
})
},
/**
* 滑动切换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 ID = event.currentTarget.dataset.detailitemid;
var State = event.currentTarget.dataset.detailitemstate;
wx.navigateTo({
url: 'Detail/Detail?ID=' + ID + '&State=' + State,
})
},
//点击进入筛选页面
chose: function (e) {
wx.navigateTo({
url: 'query/query',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
onShow: function (options) {
this.setData({
checkedDataArr: [1,2,3],
unCheckDataArr: [1,2,3],
Customer_ID: app.globalData.SelectCustomer_ID,
})
var that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
winWidth: res.windowWidth,
winHeight: res.windowHeight
});
}
});
// UnCheckPageIndex = 0;
// CheckedPageIndex = 0;
// getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize);
// getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize);
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
app.globalData.SelectCustomer_ID = null
app.globalData.SelectStartDate = null
app.globalData.SelectEndDate = null
app.globalData.SelectBillState = 0
},
//未审核订单滑动到底部加载
unCheckedScrollLower: function (event) {
var that = this;
UnCheckPageIndex = UnCheckPageIndex + 1;
getUnCheckOrderList(that, UnCheckPageIndex, UnCheckPageSize);
},
//已审核订单滑动到底部加载
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);
} else {
CheckedPageIndex = CheckedPageIndex + 1;
getCheckedOrderList(that, CheckedPageIndex, CheckedPageSize);
}
},
})