var app = getApp()
const util = require('../../utils/utils.js')
Page({
  data: {
    list:[],
    page:1
  },
  onLoad: function (options) {
    var that = this;
    app.request("/user/wallerLogList?page=1", '', "GET").then(res => {
      console.log(res)
      if(res.data.data==''){
        wx.showToast({
          title: '暂无数据',
          icon:'none'
        })
      }else{
        that.setData({ list: res.data.data })
      }
    }).catch(err => {
      console.log(err)
    })
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {
    wx.showLoading({
      title: '加载中...',
    })
    var that = this;
    var page = that.data.page+1
    app.request("/user/wallerLogList?page="+page, '', "GET").then(res => {
      console.log(res)
      wx.hideLoading()
      if(res.data.data==''){
        wx.showToast({
          title: '暂无更多数据~',
          icon:'none'
        })
      }else{
        that.setData({ list: that.data.list.concat(res.data.data), page })
      }
    }).catch(err => {
      console.log(err)
    })
  },
  onShareAppMessage: function () {
    
  }
})