account.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // pages/my/account/account.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. show: false,
  8. amountList: [{
  9. tit: '充600元',
  10. tips: '赠送300元',
  11. value: 600
  12. },
  13. {
  14. tit: '充300元',
  15. tips: '赠送100元',
  16. value: 300
  17. },
  18. {
  19. tit: '充100元',
  20. tips: '赠送20元',
  21. value: 100
  22. }],
  23. active: 0,
  24. value: 0,
  25. balance:false,
  26. },
  27. /**
  28. * 生命周期函数--监听页面加载
  29. */
  30. onLoad: function (options) {
  31. this.setData({
  32. value: this.data.amountList[0].value
  33. })
  34. },
  35. showPopup() {
  36. this.setData({
  37. show: !this.data.show,
  38. active: 0,
  39. value: this.data.amountList[0].value
  40. });
  41. },
  42. showBalance(){
  43. this.setData({
  44. balance:!this.data.balance
  45. })
  46. },
  47. toDrtail() {
  48. wx.navigateTo({
  49. url: '/pages/my/account/detail/detail',
  50. })
  51. },
  52. changeCurrent(e) {
  53. let { index, value } = e.currentTarget.dataset
  54. this.setData({
  55. active: index,
  56. value
  57. })
  58. },
  59. inputChange(e) {
  60. let { value } = e.detail
  61. console.log(value);
  62. this.setData({
  63. value: value ? value : 0,
  64. active: -1
  65. })
  66. }
  67. })