revenueRankingPage.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <view class="ranking_body">
  3. <view class="title">
  4. 收益排行 TOP10
  5. </view>
  6. <view class="rank_tab">
  7. <view class="tab_item" @click="tab(1)" :class="{active1:currentTab==1}" :style="{background:currentTab==1?color1:''}">
  8. 总量
  9. </view>
  10. <view class="tab_line"></view>
  11. <view class="tab_item" @click="tab(2)" :class="{active2:currentTab==2}" :style="{background:currentTab==2?color1:''}">
  12. 本月
  13. </view>
  14. <view class="tab_line"></view>
  15. <view class="tab_item" @click="tab(3)" :class="{active3:currentTab==3}" :style="{background:currentTab==3?color1:''}">
  16. 今日
  17. </view>
  18. </view>
  19. <view class="rank_list">
  20. <view class="rank_title">
  21. <view class="rank_title_name" style="width: 20%;">
  22. 排名
  23. </view>
  24. <view class="rank_title_name" style="width: 30%;">
  25. 用户名
  26. </view>
  27. <view class="rank_title_name" style="width: 20%;">
  28. 用户等级
  29. </view>
  30. <view class="rank_title_name" style="width: 30%;">
  31. 累计收益(元)
  32. </view>
  33. </view>
  34. <view class="rank_item" v-for="(item,index) in rankingList" :key='index'>
  35. <view class="rank_item_name" style="width: 20%;">
  36. <image class="icon" v-if="index==0" src="https://dm.static.elab-plus.com/yezhu/icon_first.png" mode=""></image>
  37. <image class="icon" v-if="index==1" src="https://dm.static.elab-plus.com/yezhu/icon_twice.png" mode=""></image>
  38. <image class="icon" v-if="index==2" src="https://dm.static.elab-plus.com/yezhu/icon_thrid.png" mode=""></image>
  39. <text v-if="index!=0&&index!=1&&index!=2" >{{index+1}}</text>
  40. </view>
  41. <view class="rank_item_name" style="width: 30%;" :style="{color:(index==0||index==1||index==2)?color1:'auto'}">
  42. {{item.name|nameFilter}}
  43. </view>
  44. <view class="rank_item_name" style="width: 20%;">
  45. {{item.level?'Lv'+item.level:''}}
  46. </view>
  47. <view class="rank_item_name" style="width: 30%;" :style="{color:(index==0||index==1||index==2)?color1:'auto'}">
  48. {{Number(item.amount).toFixed(2)}}
  49. </view>
  50. <view class="item_line">
  51. </view>
  52. </view>
  53. <view class="empty" v-if="rankingList.length == 0">
  54. <image class="emptyImg" src="https://dm.static.elab-plus.com/yezhu/h5/icon_empty.png" mode=""></image>
  55. <view class="text">暂无数据</view>
  56. </view>
  57. <backHome></backHome>
  58. </view>
  59. <login-notice></login-notice>
  60. <login></login>
  61. </view>
  62. </template>
  63. <script>
  64. let app = getApp();
  65. import backHome from "@/components/backHome/backHome.vue"
  66. export default {
  67. data() {
  68. return {
  69. rankingList:[],
  70. color1:"",
  71. color2:"",
  72. currentTab:1,
  73. };
  74. },
  75. filters:{
  76. nameFilter(val){
  77. return val.charAt(0)+("*".repeat(val.length-1))
  78. }
  79. },
  80. components:{
  81. backHome
  82. },
  83. created() {
  84. },
  85. mounted() {
  86. this.color1 = app.globalData.color1;
  87. this.color2 = app.globalData.color2;
  88. this.incomeRankTop10Amounts();
  89. wx.hideMenuItems({
  90. menuList: ['menuItem:share:qq','menuItem:share:QZone','menuItem:favorite','menuItem:originPage','menuItem:copyUrl','menuItem:openWithSafari','menuItem:openWithQQBrowser'] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
  91. });
  92. },
  93. onPullDownRefresh() {
  94. this.incomeRank();
  95. },
  96. methods:{
  97. tab(index){
  98. this.currentTab = index;
  99. this.incomeRank();
  100. },
  101. incomeRank(){
  102. if(this.currentTab==1){
  103. this.incomeRankTop10Amounts();
  104. }else if(this.currentTab==2){
  105. this.incomeRankTop10ThisMonth();
  106. }else if(this.currentTab==3){
  107. this.incomeRankTop10Today();
  108. }
  109. },
  110. async incomeRankTop10Today(){
  111. const res = await this.$myRequest({
  112. url: '/income/trigger/incomeRankTop10Today',
  113. data:{}
  114. });
  115. this.rankingList = []
  116. if(res&&res.data.success){
  117. this.rankingList = res.data.list||[]
  118. }
  119. },
  120. async incomeRankTop10ThisMonth(){
  121. const res = await this.$myRequest({
  122. url: '/income/trigger/incomeRankTop10ThisMonth',
  123. data:{}
  124. });
  125. this.rankingList = []
  126. if(res&&res.data.success){
  127. this.rankingList = res.data.list||[]
  128. }
  129. },
  130. async incomeRankTop10Amounts(){
  131. const res = await this.$myRequest({
  132. url: '/income/trigger/incomeRankTop10Amounts',
  133. data:{}
  134. });
  135. this.rankingList = []
  136. if(res&&res.data.success){
  137. this.rankingList = res.data.list||[]
  138. }
  139. },
  140. backHome(){
  141. uni.navigateBack({
  142. delta:1,
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss">
  149. .ranking_body{
  150. margin-left: 20rpx;
  151. margin-right: 20rpx;
  152. background: #ffffff;
  153. border-radius: 16rpx;
  154. padding-top: 20rpx;
  155. margin-top: 20rpx;
  156. min-height: 1200rpx;
  157. .title{
  158. text-align: center;
  159. font-size: 32rpx;
  160. font-family: Verdana, Verdana-Bold;
  161. font-weight: 700;
  162. text-align: center;
  163. color: #262626;
  164. }
  165. .rank_tab{
  166. display: flex;
  167. margin: 0 auto;
  168. margin-top: 40rpx;
  169. width: 450rpx;
  170. height: 60rpx;
  171. background: #ffffff;
  172. border: 2rpx solid #ededed;
  173. border-radius: 8rpx;
  174. .tab_item{
  175. height: 100%;
  176. text-align: center;
  177. flex: auto;
  178. line-height: 60rpx;
  179. font-size: 24rpx;
  180. font-family: Verdana, Verdana-Regular;
  181. font-weight: 400;
  182. color: #b1b1b1;
  183. }
  184. .tab_line{
  185. width: 2rpx;
  186. height: 60rpx;
  187. background: #ededed;
  188. }
  189. .active1{
  190. border-radius: 8rpx 0 0 8rpx;
  191. color: #FFFFFF;
  192. }
  193. .active2{
  194. border-radius: 0;
  195. color: #FFFFFF;
  196. }
  197. .active3{
  198. border-radius: 0 8rpx 8rpx 0 ;
  199. color: #FFFFFF;
  200. }
  201. }
  202. .rank_list{
  203. width: 100%;
  204. .rank_title{
  205. display: flex;
  206. width: 100%;
  207. margin: 0 auto;
  208. margin-top: 40rpx;
  209. .rank_title_name{
  210. font-size: 28rpx;
  211. flex: auto;
  212. font-family: Verdana, Verdana-Bold;
  213. font-weight: 700;
  214. text-align: center;
  215. color: #b1b1b1;
  216. }
  217. }
  218. .rank_item{
  219. display: flex;
  220. align-items: center;
  221. width: 100%;
  222. height: 104rpx;
  223. margin: 0 auto;
  224. position: relative;
  225. .rank_item_name{
  226. font-size: 28rpx;
  227. flex: auto;
  228. font-family: Verdana, Verdana-Bold;
  229. font-weight: 400;
  230. text-align: center;
  231. color: #666666;
  232. .icon{
  233. width: 36rpx;
  234. height: 40rpx;
  235. }
  236. }
  237. .item_line{
  238. position: absolute;
  239. bottom: 0;
  240. left: 50%;
  241. transform: translateX(-50%);
  242. width: 630rpx;
  243. height: 2rpx;
  244. background-color: rgba(0,0,0,0.05);
  245. }
  246. }
  247. }
  248. .back_home{
  249. position: fixed;
  250. bottom: 180rpx;
  251. right: 0;
  252. width: 100rpx;
  253. height: 120rpx;
  254. border-radius: 20rpx 0rpx 0rpx 20rpx;
  255. box-shadow: 0rpx 10rpx 20rpx 0rpx rgba(119,55,12,0.20);
  256. display: flex;
  257. flex-direction: column;
  258. justify-content: center;
  259. align-items: center;
  260. .back_home_icon{
  261. width: 30rpx;
  262. height: 28rpx;
  263. margin-bottom: 9rpx;
  264. }
  265. font-size: 20rpx;
  266. font-family: PingFang SC, PingFang SC-Semibold;
  267. font-weight: 600;
  268. text-align: center;
  269. color: #ffffff;
  270. }
  271. .empty {
  272. display: flex;
  273. flex-direction: column;
  274. align-items: center;
  275. margin-top: 300rpx;
  276. .emptyImg {
  277. width: 283rpx;
  278. height: 227rpx;
  279. }
  280. .text {
  281. margin-top: -20rpx;
  282. font-size: 28rpx;
  283. font-family: PingFang SC, PingFang SC-Medium;
  284. font-weight: 500;
  285. text-align: center;
  286. color: #b1b3ba;
  287. }
  288. }
  289. }
  290. </style>