init project
This commit is contained in:
105
pages/myBills/index.js
Normal file
105
pages/myBills/index.js
Normal file
@@ -0,0 +1,105 @@
|
||||
// pages/myBills/index.js
|
||||
const app = getApp();
|
||||
let page = 1;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
list: [],
|
||||
isShowNewplot: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.getData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
page = 1;
|
||||
this.getData()
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
page++
|
||||
this.getData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
return {
|
||||
title: '智慧云馆'
|
||||
}
|
||||
},
|
||||
|
||||
getData() {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
app.$api.memberMoneyLogBill({
|
||||
page: page,
|
||||
pageSize: 10
|
||||
}).then(res => {
|
||||
let list = [];
|
||||
if (page != 1) {
|
||||
list = this.data.list;
|
||||
}
|
||||
if (res.page.data.length == 0) {
|
||||
page--
|
||||
}
|
||||
for (let i = 0; i < res.page.data.length; i++) {
|
||||
list.push(res.page.data[i]);
|
||||
}
|
||||
this.setData({
|
||||
list: list,
|
||||
isShowNewplot: true
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}, err => {
|
||||
wx.stopPullDownRefresh()
|
||||
this.setData({
|
||||
isShowNewplot: true
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user