Page({
  data: {
    selectedIndex: 0,
    agreementVisible: false,
    rechargeId: '',
    rechargeOptions: [
      { amount: '10万币', price: 10000 },
      { amount: '20万币', price: 20000 },
      { amount: '50万币', price: 50000 },
      { amount: '100万币', price: 100000 },
      { amount: '200万币', price: 200000 },
      { amount: '500万币', price: 500000 },
      { amount: '1000万币', price: 1000000 },
      { amount: '2000万币', price: 2000000 },
      { amount: '5000万币', price: 5000000 },
    ],
  },

  selectOption(e) {
    const index = e.currentTarget.dataset.index
    this.setData({ selectedIndex: index })
  },

  handleIdInput(e) {
    this.setData({
      rechargeId: e.detail.value,
    })
  },

  handleLogin() {
    wx.showToast({
      title: 'ID不正确',
      icon: 'none',
    })
  },

  handleBack() {
    wx.navigateBack({
      delta: 1
    })
  },

  showAgreement() {
    this.setData({ agreementVisible: true })
  },

  hideAgreement() {
    this.setData({ agreementVisible: false })
  },

  openAgreementLink() {
    wx.navigateTo({
      url: '/pages/webview/index',
    })
  },
})
