89 lines
2.3 KiB
JavaScript
89 lines
2.3 KiB
JavaScript
// pages/mine/vip/vipcenter.js
|
|
const app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
curPage: 1,
|
|
isRefreshing: false, //是否在刷新中
|
|
hasMore: true, //是否有更多数据
|
|
isLoadMore: false, //是否正在加载更多
|
|
recordList: [],
|
|
isDredge: true, //是否开通过会员
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {},
|
|
onShow(e) {
|
|
wx.startPullDownRefresh({})
|
|
},
|
|
//获取提现记录列表
|
|
getRecordList() {
|
|
var _self = this
|
|
wx.showLoading({
|
|
title: '加载中...',
|
|
})
|
|
app.http.get(app.urls.getTakeCashList, {
|
|
header: {
|
|
token: app.globalData.token
|
|
},
|
|
data: {
|
|
page: _self.data.curPage,
|
|
rows: '10'
|
|
}
|
|
})
|
|
.then(res => {
|
|
wx.stopPullDownRefresh({})
|
|
wx.hideLoading({})
|
|
_self.data.recordList = _self.data.recordList.concat(res.data.rows)
|
|
var more = _self.data.recordList.length < res.data.total
|
|
_self.setData({
|
|
recordList: _self.data.recordList,
|
|
isRefreshing: false,
|
|
isLoadMore: false,
|
|
hasMore: more
|
|
})
|
|
})
|
|
.catch(err => {
|
|
wx.stopPullDownRefresh({})
|
|
_self.setData({
|
|
isRefreshing: false,
|
|
isLoadMore: false,
|
|
hasMore: true
|
|
})
|
|
})
|
|
},
|
|
|
|
//加载更多
|
|
doLoadMore() {
|
|
var _self = this
|
|
if (_self.data.hasMore) {
|
|
if (_self.data.isLoadMore) {
|
|
return
|
|
}
|
|
this.setData({
|
|
isLoadMore: true,
|
|
curPage: ++_self.data.curPage
|
|
})
|
|
this.getRecordList()
|
|
}
|
|
},
|
|
onReachBottom() {
|
|
this.doLoadMore()
|
|
},
|
|
//下拉刷新
|
|
onPullDownRefresh() {
|
|
this.setData({
|
|
isLoadMore: false,
|
|
isRefreshing: true,
|
|
hasMore: true,
|
|
recordList: [],
|
|
curPage: 1
|
|
})
|
|
this.getRecordList()
|
|
}
|
|
}) |