wallet.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="wallet">
  3. <view class="wallet_head">
  4. <view class="wallet_head_txt">余额:(金币)</view>
  5. <view class="wallet_head_price">{{ wallet || 0 }}</view>
  6. <view class="wallet_head_btn"><button hover-class="hover-view" @click="recharge">充值</button></view>
  7. </view>
  8. <view class="balance_main">
  9. <view class="balance_main_head center">账单明细</view>
  10. <view class="balance_main_list">
  11. <view class="balance_main_list_li flex" v-for="(item, index) in walletList" :key="index">
  12. <view class="balance_main_list_li_con">
  13. <view class="balance_main_list_li_name">{{ item.type }}</view>
  14. <view class="balance_main_list_li_time">时间:{{ item.create_time }}</view>
  15. </view>
  16. <view class="balance_main_list_li_price" :class="{ blue: item.coin < 0 }">{{ item.coin }}</view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. page: 1,
  27. pages: 0,
  28. wallet: '', //金币数量
  29. walletList: [] //金币列表
  30. };
  31. },
  32. methods: {
  33. //去充值
  34. recharge() {
  35. uni.navigateTo({ url: '/pages/me/recharge' });
  36. },
  37. //获取金币列表
  38. getWalletList() {
  39. this.$api.myCoin({ page: this.page, msg: '数据加载中' }).then(res => {
  40. if (res.code === 1) {
  41. this.wallet = res.data.balance;
  42. this.pages = res.data.record.last_page;
  43. this.walletList = this.page == 1 ? res.data.record.data : [...this.walletList, ...res.data.record.data];
  44. }
  45. });
  46. }
  47. },
  48. onLoad({ token }) {
  49. if (token) {
  50. uni.setStorageSync('token', token);
  51. }
  52. this.getWalletList();
  53. },
  54. onReachBottom() {
  55. if (this.page < this.pages) {
  56. this.page++;
  57. this.getWalletList();
  58. }
  59. }
  60. };
  61. </script>
  62. <style lang="scss">
  63. .wallet {
  64. padding: 30rpx 30rpx 0 30rpx;
  65. }
  66. .wallet_head {
  67. height: 220rpx;
  68. margin-bottom: 60rpx;
  69. background: url(https://chaomd.liuniu946.com/image/yuebeijing@2x.png) no-repeat;
  70. background-size: cover;
  71. padding: 30rpx 30rpx 30rpx 40rpx;
  72. .wallet_head_txt {
  73. color: #ffffff;
  74. font-size: 28rpx;
  75. }
  76. .wallet_head_price {
  77. color: #ffffff;
  78. font-size: 60rpx;
  79. font-weight: bold;
  80. line-height: 1;
  81. }
  82. .wallet_head_btn {
  83. display: flex;
  84. justify-content: flex-end;
  85. button {
  86. width: 150rpx;
  87. height: 60rpx;
  88. background: #f6af32;
  89. border-radius: 30rpx;
  90. }
  91. }
  92. }
  93. .balance_main_head {
  94. background: #ffffff;
  95. height: 80rpx;
  96. font-size: 30rpx;
  97. font-weight: bold;
  98. border-radius: 10rpx 10rpx 0rpx 0rpx;
  99. border-bottom: 2rpx solid #fafafa;
  100. }
  101. .balance_main_list {
  102. background: #ffffff;
  103. border-radius: 0rpx 0rpx 10rpx 10rpx;
  104. .balance_main_list_li {
  105. padding: 20rpx 30rpx;
  106. border-bottom: 2rpx solid #fafafa;
  107. .balance_main_list_li_name {
  108. color: #666666;
  109. font-size: 26rpx;
  110. margin-bottom: 20rpx;
  111. }
  112. .balance_main_list_li_time {
  113. color: #999999;
  114. }
  115. .balance_main_list_li_price {
  116. color: #f6af32;
  117. font-size: 30rpx;
  118. }
  119. .blue {
  120. color: #327cf6;
  121. }
  122. }
  123. }
  124. </style>