rankings.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <!-- 分销排行 -->
  2. <template>
  3. <view class="rankings-wrap">
  4. <!-- 标题栏 -->
  5. <shopro-navbar back-icon-color="#fff" :background="{}" :backTextStyle="{ color: '#fff', fontSize: '40rpx', fontWeight: '500' }" backText="分销排行榜"></shopro-navbar>
  6. <!-- 排行榜 -->
  7. <view class="rankings-list-box">
  8. <scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
  9. <view class="ranking-list u-flex u-row-between" v-for="(item, index) in rankingsList" :key="index">
  10. <view class="list-left u-flex">
  11. <view class="tag-box u-flex u-row-center u-col-center">
  12. <text class="tag-text" v-if="index >= 3">{{ index + 1 }}</text>
  13. <image v-else class="tag-icon" :src="rankingsIcon[index]" mode=""></image>
  14. </view>
  15. <image class="user-avatar" :src="item.user ? item.user.avatar : $IMG_URL + '/imgs/base_avatar.png'" mode=""></image>
  16. <view class="user-info">
  17. <view class="name u-m-b-10">{{ item.user ? item.user.nickname : '当前用户已注销' }}</view>
  18. <view class="date">{{ $u.timeFormat(item.createtime, 'yyyy年mm月dd日') }}</view>
  19. </view>
  20. </view>
  21. <view class="list-right y-end">
  22. <view class="num u-m-b-10">{{ item.total_income }}</view>
  23. <view class="des">累计收益</view>
  24. </view>
  25. </view>
  26. <!-- 更多 -->
  27. <u-loadmore v-if="rankingsList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
  28. <view class="hack-box" style="height: 200rpx;width: 100%;"></view>
  29. </scroll-view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. components: {},
  36. data() {
  37. return {
  38. rankingsIcon: {
  39. 0: this.$IMG_URL + '/imgs/commission/01.png',
  40. 1: this.$IMG_URL + '/imgs/commission/02.png',
  41. 2: this.$IMG_URL + '/imgs/commission/03.png'
  42. },
  43. rankingsList: [], //排行榜
  44. loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
  45. currentPage: 1,
  46. lastPage: 1
  47. };
  48. },
  49. computed: {},
  50. onLoad() {
  51. this.getRankings();
  52. },
  53. methods: {
  54. getRankings() {
  55. let that = this;
  56. that.loadStatus = 'loading';
  57. that.$http('commission.ranking', {
  58. page: that.currentPage
  59. }).then(res => {
  60. if (res.code === 1) {
  61. that.rankingsList = [...that.rankingsList, ...res.data.data];
  62. that.lastPage = res.data.last_page;
  63. that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
  64. }
  65. });
  66. },
  67. // 加载更多
  68. loadMore() {
  69. if (this.currentPage < this.lastPage) {
  70. this.currentPage += 1;
  71. this.getRankings();
  72. }
  73. }
  74. }
  75. };
  76. </script>
  77. <style lang="scss">
  78. .rankings-wrap {
  79. background: url($IMG_URL+'/imgs/commission/rankings_bg.png') no-repeat;
  80. background-size: 100% auto;
  81. height: 100%;
  82. overflow: hidden;
  83. }
  84. // 排行榜列表
  85. .rankings-list-box {
  86. background-color: #fff;
  87. border-radius: 20rpx 20rpx 0px 0px;
  88. width: 690rpx;
  89. height: 100%;
  90. margin: 60rpx auto 0;
  91. .scroll-box {
  92. height: 100%;
  93. }
  94. .ranking-list {
  95. height: 140rpx;
  96. padding: 0 30rpx;
  97. border-bottom: 1rpx solid #e5e5e5;
  98. .list-left {
  99. .tag-box {
  100. width: 50rpx;
  101. font-size: 36rpx;
  102. font-weight: 500;
  103. color: #beb4b3;
  104. margin-right: 20rpx;
  105. .tag-icon {
  106. width: 40rpx;
  107. height: 60rpx;
  108. }
  109. }
  110. .user-avatar {
  111. width: 66rpx;
  112. height: 66rpx;
  113. border-radius: 50%;
  114. margin-right: 30rpx;
  115. }
  116. .user-info {
  117. .name {
  118. font-size: 28rpx;
  119. font-weight: bold;
  120. color: #333333;
  121. }
  122. .date {
  123. font-size: 24rpx;
  124. font-weight: 400;
  125. color: #999999;
  126. }
  127. }
  128. }
  129. .list-right {
  130. .num {
  131. font-size: 30rpx;
  132. font-weight: 500;
  133. color: #5e4ddf;
  134. }
  135. .des {
  136. font-size: 24rpx;
  137. font-weight: 500;
  138. color: #a09a98;
  139. }
  140. }
  141. }
  142. }
  143. </style>