var app = getApp()
const util = require('../../utils/utils.js')
Page({

  data: {
    accountList: [],
    links: '',//下一页地址
    pages: 1,//当前页地址
  },

  onLoad: function (options) {
    var that = this;
    that.getList()
  },
  //获取订单列表
  getList: function () {
    let that = this
    let data = {
      page: that.data.pages
    }
    app.request("/user/wallerLogList", data, "GET").then(res => {
      if (res.status == 200) {
        let arr = res.data.data
          var accountList = that.data.accountList.concat(arr);
        if (arr.length == 0) {
          my.showToast({
            content: '暂无更多~',
            icon: 'none'
          })
        }else{
        
          that.setData({
            accountList,
            links: res.data.meta.pagination.links
          })
        }
        my.hideLoading({
          complete: (res) => { },
        })
      }
    }).catch(err => {
      console.log(err)
    })
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {
    if (this.data.links == null) {
      my.showToast({
        content: '暂无更多',
        icon: 'none'
      })
      return
    } else {
      let page = this.data.pages++
      page++
      this.setData({
        pages: page
      })
      this.getList()
    }
  },
  onShareAppMessage: function () {

  }
})