[添加转账,提现等新功能]
This commit is contained in:
97
pages/myBalance/myBalance.js
Normal file
97
pages/myBalance/myBalance.js
Normal file
@@ -0,0 +1,97 @@
|
||||
// pages/myBalance/myBalance.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
type : "balance ", //卡类型
|
||||
number : '', //账户余额
|
||||
accounts : '', //账户列表
|
||||
screenArray : [
|
||||
{
|
||||
channel: 'all',
|
||||
name: '全部'
|
||||
},
|
||||
{
|
||||
channel: 'in',
|
||||
name: '入账'
|
||||
},
|
||||
{
|
||||
channel: 'out',
|
||||
name: '出账'
|
||||
}
|
||||
], //账变记录筛选数组
|
||||
screenChannel: '', //账变记录筛选数组标识
|
||||
screenIndex : 0, //账变记录筛选index
|
||||
page : {}, //分页信息
|
||||
lodingStats : false, //加载状态
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad (options) {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow () {
|
||||
// 获取账变记录
|
||||
this.accountInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 账变记录
|
||||
*/
|
||||
accountInfo(page) {
|
||||
wx.$api.user.logs(this.data.type, this.data.screenChannel, page).then(res=>{
|
||||
let listArr = this.data.accounts,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.data)
|
||||
|
||||
this.setData({
|
||||
number : res.data.account.balance,
|
||||
accounts : newData,
|
||||
page : res.data.page
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 筛选账变记录-条件
|
||||
*/
|
||||
screenBind(e) {
|
||||
this.setData({
|
||||
screenIndex : e.detail.value,
|
||||
screenChannel: this.data.screenArray[e.detail.value].channel
|
||||
})
|
||||
|
||||
// 获取账变记录
|
||||
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