100 lines
2.5 KiB
JavaScript
100 lines
2.5 KiB
JavaScript
/*
|
||
* 手太欠
|
||
* 愿这世界都如故事里一样 美好而动人~
|
||
*/
|
||
|
||
Page({
|
||
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
account : {
|
||
all_in : '0.00',
|
||
balance : '0.00',
|
||
frozen : '0.00'
|
||
},
|
||
logsArr : [],
|
||
page : { current: 1 },
|
||
pageLoding : false,
|
||
needSign : false,
|
||
examine : ''
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow() {
|
||
// 页面数据
|
||
this.setData({
|
||
logsArr: [],
|
||
page : { current: 1 }
|
||
})
|
||
// 获取账户信息
|
||
this.accountInfo()
|
||
},
|
||
|
||
/**
|
||
* 获取账户信息
|
||
*/
|
||
accountInfo() {
|
||
wx.$api.user.account({
|
||
page: this.data.page.current
|
||
}).then(res => {
|
||
let { all_in, balance, frozen, need_sign, examine, logs } = res.data
|
||
this.setData({
|
||
account : { all_in, balance, frozen },
|
||
needSign : need_sign,
|
||
examine : examine,
|
||
logsArr : logs.page.current == 1 ? logs.data : this.data.logsArr.concat(logs.data),
|
||
page : logs.page,
|
||
pageLoding : !logs.page.has_more
|
||
})
|
||
wx.stopPullDownRefresh()
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 上拉加载
|
||
*/
|
||
onReachBottom(){
|
||
this.setData({
|
||
pageLoding: true
|
||
})
|
||
if(this.data.page.has_more){
|
||
let atpage = this.data.page
|
||
atpage.current += 1
|
||
this.setData({
|
||
page: atpage
|
||
})
|
||
this.accountInfo()
|
||
}
|
||
},
|
||
/**
|
||
* 提现
|
||
*/
|
||
onWithdraw(){
|
||
console.log(this.data.needSign)
|
||
|
||
if(this.data.needSign){
|
||
wx.showModal({
|
||
title : '提示',
|
||
content : '您还未完成实名认证与签约成为VIP用户,暂时无法提现',
|
||
cancelText : '稍后完成',
|
||
confirmText : '立即完善',
|
||
confirmColor : '#da2b54',
|
||
complete : res => {
|
||
if (res.confirm) {
|
||
wx.navigateTo({
|
||
url: '/pages/idcard/idcard'
|
||
})
|
||
}
|
||
}
|
||
})
|
||
return
|
||
}
|
||
wx.navigateTo({
|
||
url: '/pages/withdraw/withdraw'
|
||
})
|
||
}
|
||
}) |