锶源昆仑会员+体验官
This commit is contained in:
97
pages/account/index/index.js
Normal file
97
pages/account/index/index.js
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
accounts : '', //数额
|
||||
logsArr : [], // 提货列表数据
|
||||
listType : 'income', //列表分类
|
||||
page : {}, //分页信息
|
||||
lodingStats : false, //加载状态
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取账户信息
|
||||
this.accountInfo()
|
||||
},
|
||||
|
||||
/**
|
||||
* 账户信息
|
||||
*/
|
||||
accountInfo(page){
|
||||
let urlPage = wx.$api.user.account
|
||||
if(this.data.listType == 'withdrawal'){
|
||||
urlPage = wx.$api.user.bankList
|
||||
}
|
||||
urlPage({
|
||||
page : page || 1
|
||||
}).then(res => {
|
||||
let listArr = this.data.logsArr,
|
||||
newData = [],
|
||||
newPage = ''
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.logs.data)
|
||||
newPage = res.data.logs.page
|
||||
if(this.data.listType == 'withdrawal'){
|
||||
newData = listArr.concat(res.data.lists.data)
|
||||
newPage = res.data.lists.page
|
||||
}
|
||||
this.setData({
|
||||
accounts : res.data.account,
|
||||
logsArr : newData,
|
||||
page : newPage,
|
||||
lodingStats : false
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 状态筛选
|
||||
*/
|
||||
onTabs(val){
|
||||
if(this.data.listType === val.currentTarget.dataset.type) return
|
||||
this.setData({
|
||||
listType: val.currentTarget.dataset.type
|
||||
})
|
||||
// 获取账户信息
|
||||
this.accountInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取账户信息
|
||||
this.accountInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 上拉加载
|
||||
*/
|
||||
onReachBottom(){
|
||||
this.setData({
|
||||
lodingStats: true
|
||||
})
|
||||
let pageNumber = this.data.page.current
|
||||
if(this.data.page.has_more){
|
||||
pageNumber++
|
||||
// 获取账户信息
|
||||
this.accountInfo(pageNumber);
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user