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.
 

235 lines
5.3 KiB

// pages/guarantee/guarantee.js
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) {
let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/BusinessGuaranteeRpc/GetList';
let params = [0,PageIndex, PageSize];
network.transfer_request(method, params, function (res) {
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,
GuaranteeMoney: that.data.arrayNN[i].GuaranteeMoney,
Customer_Name: that.data.arrayNN[i].Customer_Name,
GuaranteeDate: timechage.formatTimeTwo(that.data.arrayNN[i].GuaranteeDate.substring(6, 19), 'Y-M-D')
}
array.push(dmo);
}
that.setData({
arrayN: array
})
}
function getListY(that, PageIndex, PageSize) {
let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/BusinessGuaranteeRpc/GetList';
let params = [20, PageIndex, PageSize];
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,
GuaranteeMoney: that.data.arrayYY[i].GuaranteeMoney,
Customer_Name: that.data.arrayYY[i].Customer_Name,
GuaranteeDate: timechage.formatTimeTwo(that.data.arrayYY[i].GuaranteeDate.substring(6, 19), 'Y-M-D')
}
array.push(dmo);
}
that.setData({
arrayY: array
})
}
Page({
/**
* 页面的初始数据
*/
data: {
winWidth: 0,
winHeight: 0,
// tab切换
currentTab: 0,
arrayN:[],
arrayY: [],
arrayNN:[],
arrayYY:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
/**
* 获取系统信息
*/
wx.getSystemInfo({
success: function (res) {
that.setData({
winWidth: res.windowWidth,
winHeight: res.windowHeight
});
}
});
getListN(that, PageIndexN, PageSizeN)
getListY(that, PageIndexY, PageSizeY)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
PageIndexN = 0
PageSizeN = 10
PageIndexY = 0
PageSizeY = 10
this.setData({
arrayN: [],
arrayY: [],
arrayNN: [],
arrayYY: []
})
},
upperN:function(e){
var that = this;
PageIndexN = 0
PageSizeN = 10
getListN(that, PageIndexN, PageSizeN)
},
upperY:function(e){
var that = this;
PageIndexY = 0
PageSizeY = 10
getListY(that, PageIndexY, PageSizeY)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
* scroll-view的存在屏蔽了下拉刷新
*/
onPullDownRefresh: function () {
// var that = this;
// if(this.data.currentTab==0){
// PageIndexN = 0
// PageSizeN = 10
// getListN(that, PageIndexN, PageSizeN)
// }else{
// PageIndexY = 0
// PageSizeY = 10
// getListY(that, PageIndexY, PageSizeY)
// }
// wx.stopPullDownRefresh() //停止下拉刷新
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
var that = this;
if(this.data.currentTab == 0){
PageIndexN = PageIndexN+1;
PageSizeN = 10;
let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/BusinessGuaranteeRpc/GetList';
let params = [0, PageIndexN, PageSizeN];
network.transfer_request(method, params, function (res) {
let addarry = that.data.arrayNN.concat(res.result)
that.setData({
arrayNN:addarry
})
setTimeN(that)
})
}else{
PageIndexY = PageIndexY + 1;
PageSizeY = 10;
let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/BusinessGuaranteeRpc/GetList';
let params = [20, PageIndexY, PageSizeY];
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
})
}
},
createNew:function(e){
wx.navigateTo({
url: 'newbill/newbill',
})
},
itemclickN:function(e){
wx.navigateTo({
url: 'detail/detail?ID='+e.currentTarget.dataset.data.ID,
})
},
itemclickY:function(e){
wx.navigateTo({
url: 'detailshow/detailshow?ID=' + e.currentTarget.dataset.data.ID,
})
}
})