// pages/guarantee/guarantee.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, successation) {
|
|
let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Employee/BusinessGuaranteeRpc/GetList';
|
|
let params = [0,PageIndex, PageSize];
|
|
network.transfer_request(method, params, function (res) {
|
|
successation();
|
|
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: {
|
|
winHeight: app.globalData.winHeight,
|
|
// tab切换
|
|
currentTab: 0,
|
|
|
|
arrayN:[],
|
|
arrayY: [],
|
|
arrayNN:[],
|
|
arrayYY:[]
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
var that = this;
|
|
getListN(that, PageIndexN, PageSizeN, function (res){
|
|
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, function (res) {
|
|
|
|
})
|
|
},
|
|
upperY:function(e){
|
|
var that = this;
|
|
PageIndexY = 0
|
|
PageSizeY = 10
|
|
getListY(that, PageIndexY, PageSizeY)
|
|
},
|
|
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
scrollLower: 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,
|
|
})
|
|
}
|
|
})
|