139 lines
2.9 KiB
JavaScript
139 lines
2.9 KiB
JavaScript
// packageH/signPage/contractBills/contractBills.js
|
|
const app = getApp();
|
|
Page({
|
|
data: {
|
|
showBox: false,
|
|
dataInfo: {},
|
|
listHeight: 0,
|
|
recordsList: [],
|
|
//more
|
|
isLoadMore: true,
|
|
page: 1,
|
|
total_page: 0,
|
|
},
|
|
onLoad: function (options) {
|
|
},
|
|
|
|
onShow: function () {
|
|
this.getData();
|
|
},
|
|
|
|
getData () {
|
|
this.setData({
|
|
page: 1
|
|
});
|
|
let that = this;
|
|
let queryUrl = app.getNetAddresss("plugin.yun-sign.frontend.contract-num-log.get-list");
|
|
app._getNetWork({
|
|
url: queryUrl,
|
|
data: {
|
|
page: 1
|
|
},
|
|
success (resdata) {
|
|
if (resdata.data.result === 1) {
|
|
let res = resdata.data;
|
|
that.setData({
|
|
isLoadMore: true,
|
|
dataInfo: res.data,
|
|
recordsList: res.data.list.data,
|
|
total_page: res.data.list.last_page
|
|
});
|
|
if (!that.data.total_page) {
|
|
that.setData({
|
|
total_page: 0
|
|
});
|
|
}
|
|
} else {
|
|
app.tips(resdata.data.msg);
|
|
}
|
|
},
|
|
fail (err) {
|
|
console.log(err, "-----fail");
|
|
}
|
|
});
|
|
},
|
|
|
|
|
|
//获取更多数据
|
|
getMoreData () {
|
|
let that = this;
|
|
if (!this.data.isLoadMore) {
|
|
app.tips("没有更多了");
|
|
return;
|
|
}
|
|
if (this.data.page >= this.data.total_page) {
|
|
this.setData({
|
|
isLoadMore: false
|
|
});
|
|
return;
|
|
} else {
|
|
this.setData({
|
|
page: this.data.page + 1
|
|
});
|
|
let queryUrl = app.getNetAddresss("plugin.yun-sign.frontend.contract-num-log.get-list");
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
mask: true
|
|
});
|
|
app._getNetWork({
|
|
url: queryUrl,
|
|
data: {
|
|
page: that.data.page,
|
|
},
|
|
success (resdata) {
|
|
wx.hideLoading();
|
|
console.log(resdata);
|
|
if (resdata.data.result === 1) {
|
|
let res = resdata.data;
|
|
var myData = res.data.data;
|
|
let concatArr = that.data.recordsList.concat(myData);//数组拼接
|
|
that.setData({
|
|
isLoadMore: true,
|
|
recordsList: concatArr
|
|
});
|
|
} else {
|
|
that.setData({
|
|
page: that.data.page - 1,
|
|
isLoadMore: false
|
|
});
|
|
}
|
|
},
|
|
fail (err) {
|
|
console.log(err, "-------失败 -----------");
|
|
that.setData({
|
|
isLoadMore: true
|
|
});
|
|
wx.hideLoading();
|
|
}
|
|
});
|
|
}
|
|
},
|
|
|
|
|
|
handleShowBox () {
|
|
this.setData({
|
|
showBox: !this.data.showBox
|
|
});
|
|
},
|
|
|
|
toSignIndex() {
|
|
wx.redirectTo({
|
|
url: '/packageH/signPage/signIndex/signIndex',
|
|
});
|
|
},
|
|
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function() {
|
|
if (this.data.isLoadMore) {
|
|
this.getMoreData();
|
|
} else {
|
|
console.log('没有更多数据');
|
|
}
|
|
},
|
|
}); |