// pages/my/account/account.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show: false,
    amountList: [{
      tit: '充600元',
      tips: '赠送300元',
      value: 600
    },
    {
      tit: '充300元',
      tips: '赠送100元',
      value: 300
    },
    {
      tit: '充100元',
      tips: '赠送20元',
      value: 100
    }],
    active: 0,
    value: 0,
    balance:false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      value: this.data.amountList[0].value
    })
  },
  showPopup() {
    this.setData({
      show: !this.data.show,
      active: 0,
      value: this.data.amountList[0].value

    });
  },
  showBalance(){
    this.setData({
      balance:!this.data.balance
    })
  },

  toDrtail() {
    wx.navigateTo({
      url: '/pages/my/account/detail/detail',
    })
  },

  changeCurrent(e) {
    let { index, value } = e.currentTarget.dataset
    this.setData({
      active: index,
      value
    })
  },

  inputChange(e) {
    let { value } = e.detail
    console.log(value);
    this.setData({
      value: value ? value : 0,
      active: -1
    })

  }
})