index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="container" v-if="!isLoading">
  3. <view class="space-upper">
  4. <view class="wallet-image">
  5. <image class="image" src="/static/wallet.png"></image>
  6. </view>
  7. <view class="wallet-account">
  8. <view class="wallet-account_balance">
  9. <text>{{ userInfo.balance }}</text>
  10. </view>
  11. <view class="wallet-account_lable">
  12. <text>账户余额(元)</text>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="space-lower">
  17. <view v-if="setting.is_entrance" class="space-lower_item btn-recharge">
  18. <view class="btn-submit" @click="onTargetRecharge()">充 值</view>
  19. </view>
  20. <view class="space-lower_item item-lable dis-flex flex-x-around">
  21. <view class="lable-text" @click="onTargetRechargeOrder()">
  22. <text>充值记录</text>
  23. </view>
  24. <view class="lable-text" @click="onTargetBalanceLog()">
  25. <text>账单详情</text>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import * as UserApi from '@/api/user'
  33. import SettingModel from '@/common/model/Setting'
  34. import SettingKeyEnum from '@/common/enum/setting/Key'
  35. export default {
  36. data() {
  37. return {
  38. // 正在加载
  39. isLoading: true,
  40. // 会员信息
  41. userInfo: {},
  42. // 充值设置
  43. setting: {}
  44. }
  45. },
  46. /**
  47. * 生命周期函数--监听页面显示
  48. */
  49. onShow(options) {
  50. // 获取页面数据
  51. this.getPageData()
  52. },
  53. methods: {
  54. // 获取页面数据
  55. getPageData() {
  56. const app = this
  57. app.isLoading = true
  58. Promise.all([app.getUserInfo(), app.getSetting()]).then(() => (app.isLoading = false))
  59. },
  60. // 获取会员信息
  61. getUserInfo() {
  62. const app = this
  63. return new Promise((resolve, reject) => {
  64. UserApi.info().then((result) => {
  65. app.userInfo = result.data.userInfo
  66. resolve(app.userInfo)
  67. })
  68. })
  69. },
  70. // 获取充值设置
  71. getSetting() {
  72. const app = this
  73. return new Promise((resolve, reject) => {
  74. resolve(true)
  75. // SettingModel.item(SettingKeyEnum.RECHARGE.value, false).then((data) => {
  76. // app.setting = data
  77. // resolve(data)
  78. // })
  79. })
  80. },
  81. // 跳转充值页面
  82. onTargetRecharge() {
  83. this.$navTo('pages/wallet/recharge/index')
  84. },
  85. // 跳转充值记录页面
  86. onTargetRechargeOrder() {
  87. this.$navTo('pages/wallet/recharge/order')
  88. },
  89. // 跳转账单详情页面
  90. onTargetBalanceLog() {
  91. this.$navTo('pages/wallet/balance/log')
  92. }
  93. }
  94. }
  95. </script>
  96. <style>
  97. page {
  98. background: #fff;
  99. }
  100. </style>
  101. <style lang="scss" scoped>
  102. .container {
  103. background: #fff;
  104. }
  105. .space-upper {
  106. padding: 150rpx 0;
  107. text-align: center;
  108. }
  109. .wallet-image .image {
  110. width: 360rpx;
  111. height: 260rpx;
  112. }
  113. .wallet-account {
  114. margin-top: 20rpx;
  115. }
  116. .wallet-account_balance {
  117. font-size: 56rpx;
  118. }
  119. .wallet-account_lable {
  120. margin-top: 14rpx;
  121. color: #cec1c1;
  122. font-size: 26rpx;
  123. }
  124. .space-lower {
  125. margin-top: 30rpx;
  126. padding: 0 110rpx;
  127. }
  128. .btn-recharge .btn-submit {
  129. width: 460rpx;
  130. height: 84rpx;
  131. margin: 0 auto;
  132. border-radius: 50rpx;
  133. background: #786cff;
  134. color: white;
  135. font-size: 30rpx;
  136. display: flex;
  137. justify-content: center;
  138. align-items: center;
  139. }
  140. .item-lable {
  141. margin-top: 80rpx;
  142. font-size: 28rpx;
  143. color: rgb(94, 94, 94);
  144. padding: 0 100rpx;
  145. }
  146. </style>