wallet.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="yue">
  3. <view class="yue-top">
  4. <view class="yue-top-font">余额:(金币)</view>
  5. <view class="yue-top-money">{{ wallet || 0 }}</view>
  6. <view class="yue-top-btn"><button hover-class="hover-view" @click="navTo('/pages/me/recharge')">充值</button></view>
  7. </view>
  8. <view class="main">
  9. <view class="main-font center">账单明细</view>
  10. <view class="main-main">
  11. <view class="main-item flex" v-for="(item, index) in walletList" :key="index">
  12. <view class="main-item-left">
  13. <view class="main-item-font">{{ item.type }}</view>
  14. <view class="main-item-time">时间:{{ item.create_time }}</view>
  15. </view>
  16. <view class="main-item-money" :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. navTo(url) {
  35. uni.navigateTo({ url });
  36. },
  37. //获取金币列表
  38. loadData() {
  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.loadData();
  53. },
  54. onReachBottom() {
  55. if (this.page < this.pages) {
  56. this.page++;
  57. this.loadData();
  58. }
  59. }
  60. };
  61. </script>
  62. <style lang="scss">
  63. .yue {
  64. padding: 30rpx 30rpx 0 30rpx;
  65. }
  66. .yue-top {
  67. height: 220rpx;
  68. margin-bottom: 60rpx;
  69. background: url(https://www.chaomangdao.com/image/yuebeijing@2x.png) no-repeat;
  70. background-size: cover;
  71. padding: 30rpx 30rpx 30rpx 40rpx;
  72. .yue-top-font {
  73. color: #ffffff;
  74. font-size: 28rpx;
  75. }
  76. .yue-top-money {
  77. color: #ffffff;
  78. font-size: 60rpx;
  79. font-weight: bold;
  80. line-height: 1;
  81. }
  82. .yue-top-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. .main-font {
  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. .main-main {
  102. background: #ffffff;
  103. border-radius: 0rpx 0rpx 10rpx 10rpx;
  104. .main-item {
  105. padding: 20rpx 30rpx;
  106. border-bottom: 2rpx solid #fafafa;
  107. .main-item-font {
  108. color: #666666;
  109. font-size: 26rpx;
  110. margin-bottom: 20rpx;
  111. }
  112. .main-item-time {
  113. color: #999999;
  114. }
  115. .main-item-money {
  116. color: #f6af32;
  117. font-size: 30rpx;
  118. }
  119. .blue {
  120. color: #fe3b3b;
  121. }
  122. }
  123. }
  124. </style>