index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="CommissionRank">
  4. <!-- #ifdef MP -->
  5. <view
  6. class="accountTitle"
  7. :style="{ 'background-image': 'url(' + imgHost + '/statics/images/brokerage_rank_bg1.png)', height: getHeight.barTop + getHeight.barHeight + 'px' }"
  8. >
  9. <view :style="{height:getHeight.barTop+'px'}"></view>
  10. <view class="sysTitle acea-row row-center-wrapper" :style="{ height: getHeight.barHeight + 'px' }">
  11. <view>佣金排行</view>
  12. <text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
  13. </view>
  14. </view>
  15. <view :style="{ height: getHeight.barTop + getHeight.barHeight + 'px' }"></view>
  16. <!-- #endif -->
  17. <view class="header" :style="'background-image: url(' + imgHost + '/statics/images/brokerage_rank_bg2.png);'">
  18. <view class="acea-row row-middle">
  19. <view class="left">
  20. <view class="tips" v-if="rankInfo.position">
  21. 您目前的排名
  22. <text class="num">{{ rankInfo.position }}</text>
  23. </view>
  24. <view class="tips" v-else>您目前暂无排名</view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="wrapper">
  29. <view class="nav acea-row row-around">
  30. <view class="item" :class="active == index ? 'on' : ''" v-for="(item, index) in navList" :key="index" @click="switchTap(index)">
  31. {{ item }}
  32. </view>
  33. </view>
  34. <view class="list" v-if="rankList.length">
  35. <view class="item acea-row row-between-wrapper" v-for="(item, index) in rankList" :key="index">
  36. <view class="acea-row row-middle">
  37. <view class="num" v-if="index <= 2">
  38. <image :src="'../static/no' + (index + 1) + '.png'"></image>
  39. </view>
  40. <view class="num" v-else>
  41. {{ index + 1 }}
  42. </view>
  43. <view class="pictrue">
  44. <image :src="item.avatar"></image>
  45. </view>
  46. <view class="text line1">{{ item.nickname }}</view>
  47. </view>
  48. <view class="people">¥{{ item.brokerage_price }}</view>
  49. </view>
  50. </view>
  51. <view v-if="!rankList.length">
  52. <emptyPage title="暂无排行榜数据哦~"></emptyPage>
  53. </view>
  54. </view>
  55. <view style="height: 130rpx" v-if="rankInfo.position > 0"></view>
  56. <view class="footer acea-row row-between-wrapper" v-if="rankInfo.position > 0">
  57. <view class="acea-row row-middle">
  58. <view class="me">我</view>
  59. <view class="pictrue">
  60. <image :src="rankInfo.avatar"></image>
  61. </view>
  62. <view class="name line1">{{ rankInfo.nickname }}</view>
  63. <view class="ranking">第{{ rankInfo.position }}名</view>
  64. </view>
  65. <view class="num">¥{{ rankInfo.brokerage_price }}</view>
  66. </view>
  67. </view>
  68. <!-- #ifdef MP -->
  69. <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize>
  70. <!-- #endif -->
  71. </view>
  72. </template>
  73. <script>
  74. import emptyPage from '@/components/emptyPage.vue';
  75. import { getBrokerageRank } from '@/api/user.js';
  76. import { toLogin } from '@/libs/login.js';
  77. import { mapGetters } from 'vuex';
  78. import colors from '@/mixins/color';
  79. import { HTTP_REQUEST_URL } from '@/config/app';
  80. export default {
  81. components: {
  82. emptyPage
  83. },
  84. mixins: [colors],
  85. data() {
  86. return {
  87. imgHost: HTTP_REQUEST_URL,
  88. // #ifdef MP
  89. getHeight: this.$util.getWXStatusHeight(),
  90. // #endif
  91. navList: ['周排行', '月排行'],
  92. active: 0,
  93. rankInfo: {
  94. position: 0,
  95. avatar: '',
  96. brokerage_price: '',
  97. nickname: ''
  98. },
  99. rankList: [],
  100. page: 1,
  101. limit: 20,
  102. loadend: false,
  103. loading: false,
  104. loadTitle: '加载更多',
  105. type: 'week',
  106. isAuto: false, //没有授权的不会自动授权
  107. isShowAuth: false //是否隐藏授权
  108. };
  109. },
  110. computed: mapGetters(['isLogin']),
  111. watch: {
  112. isLogin: {
  113. handler: function (newV, oldV) {
  114. if (newV) {
  115. //#ifndef MP
  116. this.getBrokerageRankList();
  117. //#endif
  118. }
  119. },
  120. deep: true
  121. }
  122. },
  123. onLoad() {
  124. if (this.isLogin) {
  125. this.getBrokerageRankList();
  126. } else {
  127. toLogin();
  128. }
  129. },
  130. onShow() {
  131. uni.removeStorageSync('form_type_cart');
  132. },
  133. methods: {
  134. onLoadFun: function () {
  135. this.getBrokerageRankList();
  136. this.isShowAuth = false;
  137. },
  138. // 授权关闭
  139. authColse: function (e) {
  140. this.isShowAuth = e;
  141. },
  142. goarrow(){
  143. uni.navigateBack()
  144. },
  145. switchTap: function (index) {
  146. this.active = index;
  147. this.type = index ? 'month' : 'week';
  148. this.page = 1;
  149. this.loadend = false;
  150. this.$set(this, 'rankList', []);
  151. this.getBrokerageRankList();
  152. },
  153. getBrokerageRankList: function () {
  154. if (this.loadend) return;
  155. if (this.loading) return;
  156. this.loading = true;
  157. this.loadTitle = '';
  158. getBrokerageRank({
  159. page: this.page,
  160. limit: this.limit,
  161. type: this.type
  162. })
  163. .then((res) => {
  164. let list = res.data.rank;
  165. let loadend = list.length < this.limit;
  166. this.rankInfo.avatar = res.data.avatar;
  167. this.rankInfo.brokerage_price = res.data.brokerage_price;
  168. this.rankInfo.nickname = res.data.nickname;
  169. this.rankInfo.position = res.data.position;
  170. this.rankList.push.apply(this.rankList, list);
  171. this.loading = false;
  172. this.loadend = loadend;
  173. this.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  174. this.$set(this, 'rankList', this.rankList);
  175. this.page += 1;
  176. })
  177. .catch((err) => {
  178. this.loading = false;
  179. this.loadTitle = '加载更多';
  180. });
  181. }
  182. },
  183. onReachBottom() {
  184. this.getBrokerageRankList();
  185. }
  186. };
  187. </script>
  188. <style scoped lang="scss">
  189. .accountTitle {
  190. background-repeat: no-repeat;
  191. background-size: 100% 100%;
  192. position: fixed;
  193. left: 0;
  194. top: 0;
  195. width: 100%;
  196. z-index: 99;
  197. .sysTitle {
  198. width: 100%;
  199. position: relative;
  200. font-weight: 500;
  201. color: #fff;
  202. font-size: 30rpx;
  203. .iconfont {
  204. position: absolute;
  205. font-size: 36rpx;
  206. left: 11rpx;
  207. width: 60rpx;
  208. }
  209. }
  210. }
  211. .CommissionRank {
  212. padding-bottom: 30rpx;
  213. .footer {
  214. position: fixed;
  215. height: 128rpx;
  216. background-color: #fff;
  217. font-size: 28rpx;
  218. width: 100%;
  219. bottom: 0;
  220. left: 0;
  221. border-top: 1px solid #eeeeee;
  222. padding: 0 64rpx;
  223. .me {
  224. color: #ff7d00;
  225. }
  226. .pictrue {
  227. width: 80rpx;
  228. height: 80rpx;
  229. margin-left: 48rpx;
  230. image {
  231. width: 100%;
  232. height: 100%;
  233. border-radius: 50%;
  234. }
  235. }
  236. .name {
  237. max-width: 164rpx;
  238. margin-left: 24rpx;
  239. }
  240. .ranking {
  241. color: #ff7d00;
  242. margin-left: 16rpx;
  243. }
  244. .num{
  245. color: #ff7d00;
  246. }
  247. }
  248. .header {
  249. height: 434rpx;
  250. padding-top: 26rpx;
  251. background-repeat: no-repeat;
  252. background-size: 100% 100%;
  253. width: 100%;
  254. .left {
  255. .tips {
  256. font-size: 28rpx;
  257. font-weight: 400;
  258. color: #ffcb99;
  259. margin: 164rpx 0 0 46rpx;
  260. .num {
  261. font-family: 'SemiBold';
  262. font-size: 40rpx;
  263. margin: 0 8rpx;
  264. }
  265. }
  266. }
  267. }
  268. .wrapper {
  269. width: 710rpx;
  270. background-color: #fff;
  271. border-radius: 20rpx;
  272. margin: -154rpx auto 0 auto;
  273. .nav {
  274. font-size: 28rpx;
  275. font-weight: 400;
  276. color: #999;
  277. .item {
  278. color: #999999;
  279. padding: 32rpx 0 12rpx 0;
  280. &.on {
  281. color: #333;
  282. font-size: 32rpx;
  283. position: relative;
  284. font-weight: 600;
  285. &::after {
  286. position: absolute;
  287. content: '';
  288. width: 56rpx;
  289. height: 4rpx;
  290. background: #e93323;
  291. border-radius: 2rpx;
  292. left: 50%;
  293. margin-left: -28rpx;
  294. bottom: 0;
  295. }
  296. }
  297. }
  298. }
  299. .list {
  300. padding: 0 44rpx 72rpx 28rpx;
  301. .item {
  302. margin-top: 48rpx;
  303. .num {
  304. font-weight: 400;
  305. color: #999;
  306. font-size: 28rpx;
  307. width: 64rpx;
  308. height: 64rpx;
  309. text-align: center;
  310. line-height: 64rpx;
  311. image {
  312. width: 100%;
  313. height: 100%;
  314. display: block;
  315. }
  316. }
  317. .pictrue {
  318. width: 80rpx;
  319. height: 80rpx;
  320. margin-left: 28rpx;
  321. image {
  322. width: 100%;
  323. height: 100%;
  324. border-radius: 50%;
  325. }
  326. }
  327. .text {
  328. font-weight: 400;
  329. color: #333333;
  330. font-size: 28rpx;
  331. margin-left: 24rpx;
  332. width: 180rpx;
  333. }
  334. }
  335. }
  336. }
  337. }
  338. </style>