wallet.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. var app = getApp()
  2. const util = require('../../../utils/utils.js')
  3. Page({
  4. data: {
  5. balance:'0.00',//显示余额
  6. state:'',//认证状态
  7. phone: '',//手机认证状态
  8. imgUrl:'',
  9. stateStatus: wx.getStorageSync('userState').is_card_certified,
  10. is_bindPhone: wx.getStorageSync('userState').is_bind_mobile
  11. },
  12. getBalance: util.throttle(function (e) {
  13. this.setData({ balance: wx.getStorageSync('userInfo').wallet_money})
  14. //获取实名认证状态
  15. console.log(wx.getStorageSync('userState').is_card_certified == 1)
  16. if (wx.getStorageSync('userState').is_card_certified == 1){
  17. this.setData({
  18. state:'已认证'
  19. })
  20. }else{
  21. this.setData({
  22. state:'去认证'
  23. })
  24. }
  25. if (wx.getStorageSync('userState').is_bind_mobile == 1) {
  26. this.setData({
  27. phone: '去换绑'
  28. })
  29. } else {
  30. this.setData({
  31. phone: '去认证'
  32. })
  33. }
  34. },1000),
  35. walletDetail: function () {
  36. wx.navigateTo({
  37. url: '/pages/wallet_details/wallet_details',
  38. })
  39. },
  40. goCertified:function(){
  41. wx.navigateTo({
  42. url: '/pages/real_name/real_name?state2=2&index=1',
  43. })
  44. },
  45. goBindphone: function () {
  46. wx.navigateTo({
  47. url: '/pages/real_name/real_name?state1=1&index=0',
  48. })
  49. },
  50. huanbang: function () {
  51. wx.navigateTo({
  52. url: '/pages/huan_bang/huan_bang',
  53. })
  54. },
  55. onLoad: function (options) {
  56. var img = wx.getStorageSync('imgUrl');
  57. this.setData({ imgUrl: 'http://resource.' + img[1]})
  58. },
  59. onReady: function () {
  60. },
  61. onShow: function () {
  62. this.getBalance();
  63. this.setData({
  64. stateStatus: wx.getStorageSync('userState').is_card_certified,
  65. is_bindPhone: wx.getStorageSync('userState').is_bind_mobile
  66. })
  67. },
  68. onHide: function () {
  69. },
  70. onUnload: function () {
  71. },
  72. onPullDownRefresh: function () {
  73. },
  74. onReachBottom: function () {
  75. },
  76. onShareAppMessage: function () {
  77. }
  78. })