Files
cardtest/pages/withdrawal_record/withdrawal_record.js
zhangmanman 540d76bdb8 [更新]
2021-08-09 15:57:37 +08:00

90 lines
2.2 KiB
JavaScript

// 本时生活
Page({
/**
* 页面的初始数据
*/
data: {
accounts : [], //列表
page : {}, //分页信息
lodingStats : false, //加载状态
WithdrawalWay : [
{value: '', name: "全部", status: ''},
{value: 0, name: "提现中", status: 'init'},
{value: 1, name: "已提现", status: 'end'}
],
WithdrawalIndex : 0, //收益订单筛选列表index
WithdrawalValue : 'init', //收益订单筛选列表value
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.setData({
WithdrawalValue: options.status,
WithdrawalIndex: parseInt(options.idx)
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
// 获取提现列表
this.recordInfo();
},
/**
* 提现列表
*/
recordInfo(page) {
wx.$api.user.withdrawsList(this.data.WithdrawalValue, page).then(res=>{
let listArr = this.data.accounts,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
accounts : newData,
page : res.data.page
})
}).catch(err => {});
},
/**
* 团队类型选择
*/
screenWithdrawal(val) {
this.setData({
WithdrawalIndex: val.detail.value,
WithdrawalValue: this.data.WithdrawalWay[val.detail.value].status
})
// 获取提现列表
this.recordInfo();
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取提现列表
this.recordInfo();
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取提现列表
this.recordInfo(pageNumber);
}
}
})