revenueRankingPage.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. if(val){
  78. return val.charAt(0)+("*".repeat(val.length-1))
  79. }
  80. return ""
  81. }
  82. },
  83. components:{
  84. backHome
  85. },
  86. created() {
  87. },
  88. mounted() {
  89. this.color1 = app.globalData.color1;
  90. this.color2 = app.globalData.color2;
  91. this.incomeRankTop10Amounts();
  92. wx.hideMenuItems({
  93. menuList: ['menuItem:share:qq','menuItem:share:QZone','menuItem:favorite','menuItem:originPage','menuItem:copyUrl','menuItem:openWithSafari','menuItem:openWithQQBrowser'] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
  94. });
  95. },
  96. onPullDownRefresh() {
  97. this.incomeRank();
  98. },
  99. methods:{
  100. tab(index){
  101. this.currentTab = index;
  102. this.incomeRank();
  103. },
  104. incomeRank(){
  105. if(this.currentTab==1){
  106. this.incomeRankTop10Amounts();
  107. }else if(this.currentTab==2){
  108. this.incomeRankTop10ThisMonth();
  109. }else if(this.currentTab==3){
  110. this.incomeRankTop10Today();
  111. }
  112. },
  113. async incomeRankTop10Today(){
  114. const res = await this.$myRequest({
  115. url: '/income/trigger/incomeRankTop10Today',
  116. data:{}
  117. });
  118. this.rankingList = []
  119. if(res&&res.data.success){
  120. this.rankingList = res.data.list||[]
  121. }
  122. },
  123. async incomeRankTop10ThisMonth(){
  124. const res = await this.$myRequest({
  125. url: '/income/trigger/incomeRankTop10ThisMonth',
  126. data:{}
  127. });
  128. this.rankingList = []
  129. if(res&&res.data.success){
  130. this.rankingList = res.data.list||[]
  131. }
  132. },
  133. async incomeRankTop10Amounts(){
  134. const res = await this.$myRequest({
  135. url: '/income/trigger/incomeRankTop10Amounts',
  136. data:{}
  137. });
  138. this.rankingList = []
  139. if(res&&res.data.success){
  140. this.rankingList = res.data.list||[]
  141. }
  142. },
  143. backHome(){
  144. uni.navigateBack({
  145. delta:1,
  146. })
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss">
  152. .ranking_body{
  153. margin-left: 20rpx;
  154. margin-right: 20rpx;
  155. background: #ffffff;
  156. border-radius: 16rpx;
  157. padding-top: 20rpx;
  158. margin-top: 20rpx;
  159. min-height: 1200rpx;
  160. .title{
  161. text-align: center;
  162. font-size: 32rpx;
  163. font-family: Verdana, Verdana-Bold;
  164. font-weight: 700;
  165. text-align: center;
  166. color: #262626;
  167. }
  168. .rank_tab{
  169. display: flex;
  170. margin: 0 auto;
  171. margin-top: 40rpx;
  172. width: 450rpx;
  173. height: 60rpx;
  174. background: #ffffff;
  175. border: 2rpx solid #ededed;
  176. border-radius: 8rpx;
  177. .tab_item{
  178. height: 100%;
  179. text-align: center;
  180. flex: auto;
  181. line-height: 60rpx;
  182. font-size: 24rpx;
  183. font-family: Verdana, Verdana-Regular;
  184. font-weight: 400;
  185. color: #b1b1b1;
  186. }
  187. .tab_line{
  188. width: 2rpx;
  189. height: 60rpx;
  190. background: #ededed;
  191. }
  192. .active1{
  193. border-radius: 8rpx 0 0 8rpx;
  194. color: #FFFFFF;
  195. }
  196. .active2{
  197. border-radius: 0;
  198. color: #FFFFFF;
  199. }
  200. .active3{
  201. border-radius: 0 8rpx 8rpx 0 ;
  202. color: #FFFFFF;
  203. }
  204. }
  205. .rank_list{
  206. width: 100%;
  207. .rank_title{
  208. display: flex;
  209. width: 100%;
  210. margin: 0 auto;
  211. margin-top: 40rpx;
  212. .rank_title_name{
  213. font-size: 28rpx;
  214. flex: auto;
  215. font-family: Verdana, Verdana-Bold;
  216. font-weight: 700;
  217. text-align: center;
  218. color: #b1b1b1;
  219. }
  220. }
  221. .rank_item{
  222. display: flex;
  223. align-items: center;
  224. width: 100%;
  225. height: 104rpx;
  226. margin: 0 auto;
  227. position: relative;
  228. .rank_item_name{
  229. font-size: 28rpx;
  230. flex: auto;
  231. font-family: Verdana, Verdana-Bold;
  232. font-weight: 400;
  233. text-align: center;
  234. color: #666666;
  235. .icon{
  236. width: 36rpx;
  237. height: 40rpx;
  238. }
  239. }
  240. .item_line{
  241. position: absolute;
  242. bottom: 0;
  243. left: 50%;
  244. transform: translateX(-50%);
  245. width: 630rpx;
  246. height: 2rpx;
  247. background-color: rgba(0,0,0,0.05);
  248. }
  249. }
  250. }
  251. .back_home{
  252. position: fixed;
  253. bottom: 180rpx;
  254. right: 0;
  255. width: 100rpx;
  256. height: 120rpx;
  257. border-radius: 20rpx 0rpx 0rpx 20rpx;
  258. box-shadow: 0rpx 10rpx 20rpx 0rpx rgba(119,55,12,0.20);
  259. display: flex;
  260. flex-direction: column;
  261. justify-content: center;
  262. align-items: center;
  263. .back_home_icon{
  264. width: 30rpx;
  265. height: 28rpx;
  266. margin-bottom: 9rpx;
  267. }
  268. font-size: 20rpx;
  269. font-family: PingFang SC, PingFang SC-Semibold;
  270. font-weight: 600;
  271. text-align: center;
  272. color: #ffffff;
  273. }
  274. .empty {
  275. display: flex;
  276. flex-direction: column;
  277. align-items: center;
  278. margin-top: 300rpx;
  279. .emptyImg {
  280. width: 283rpx;
  281. height: 227rpx;
  282. }
  283. .text {
  284. margin-top: -20rpx;
  285. font-size: 28rpx;
  286. font-family: PingFang SC, PingFang SC-Medium;
  287. font-weight: 500;
  288. text-align: center;
  289. color: #b1b3ba;
  290. }
  291. }
  292. }
  293. </style>