index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='member-center'>
  4. <image class="bag" src="../../../static/images/jf-head.png" mode=""></image>
  5. <view class='header'>
  6. <swiper class="swiper" :current="swiperIndex" previous-margin="55rpx" next-margin="55rpx"
  7. @change="swiperChange">
  8. <block v-for="(item, index) in distributionLevel" :key="index">
  9. <swiper-item>
  10. <view class="swiper-item" :class="{on: swiperIndex == index}"
  11. :style="{'background-image': 'url('+item.image+')'}">
  12. <view class="acea-row row-middle user-wrap">
  13. <image class="image" :src="userInfo.avatar"></image>
  14. <view class="user-msg">
  15. <view class="text">
  16. <view class="name">{{userInfo.nickname}}</view>
  17. <view class="level"
  18. :class="{'level-sty':item.grade > (levelInfo.grade || 0)}">
  19. {{$t(item.name)}}
  20. </view>
  21. </view>
  22. </view>
  23. <!-- <view v-if="item.grade === levelInfo.grade" class="state">当前等级</view>
  24. <view v-else-if="item.grade > levelInfo.grade" class="state">
  25. 暂未解锁
  26. </view> -->
  27. <view v-if="item.grade > (levelInfo.grade || 0)" class="state">
  28. <image class="lock" src="../static/lock.png" mode=""></image>
  29. </view>
  30. </view>
  31. <template>
  32. <view class="level-grow-wrap">
  33. <view class="level-info"
  34. :class="{'lock-sty':item.grade > (levelInfo.grade || 0)}">
  35. <view class="level-info-title">{{$t(`一级分佣上浮`)}}</view>
  36. <view class="num">{{item.one_brokerage}}
  37. <text class="percent">%</text>
  38. </view>
  39. </view>
  40. <view class="level-info"
  41. :class="{'lock-sty':item.grade > (levelInfo.grade || 0)}">
  42. <view class="level-info-title">{{$t(`二级分佣上浮`)}}</view>
  43. <view class="num">{{item.two_brokerage}}<text class="percent">%</text>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. </view>
  49. </swiper-item>
  50. </block>
  51. </swiper>
  52. </view>
  53. <view class="skill-section">
  54. <view class="section-hd acea-row row-between-wrapper">
  55. <view class="title">
  56. <view class="line-left">
  57. </view>
  58. <text>
  59. {{$t(`快速升级技巧`)}}
  60. </text>
  61. </view>
  62. <view class="task">
  63. <text class="task-num">
  64. {{ taskNum }}
  65. </text>
  66. <text>
  67. /{{ task.length}}
  68. </text>
  69. </view>
  70. </view>
  71. <view class="section-bd acea-row">
  72. <view class="item acea-row row-middle" v-for="(item,index) in task" :key='item.id'>
  73. <view class="text">
  74. <view class="title">
  75. <view class="name line2">
  76. {{$t(item.name)}}
  77. <text class="iconfont icon-wenti" @click="opHelp(index)"></text>
  78. </view>
  79. <text class="mark">{{item.finish?$t(`已完成`):$t(`未完成`)}}</text>
  80. </view>
  81. <view class="process">
  82. <view
  83. :style="{width: `${Math.floor((item.new_number / item.number) > 1 ? 100 : item.new_number / item.number* 100)}%`}"
  84. class="fill"></view>
  85. </view>
  86. <view class="info-box">
  87. <view class="info">{{item.finish ? '' : $t(item.task_type_title)}}</view>
  88. <view class="link" hover-class="none">
  89. <text class="new-number">{{item.new_number}}</text>
  90. /{{item.number}}
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <recommend v-if="hostProduct.length" :hostProduct="hostProduct"></recommend>
  98. <view class='growthValue' :class='growthValue==false?"on":""'>
  99. <text class='iconfont icon-guanbi3' @click='growthValue = true'></text>
  100. <view class='conter'>{{illustrate}}</view>
  101. </view>
  102. <view class='mask' :hidden='growthValue' @click='growthValueClose'></view>
  103. </view>
  104. </view>
  105. </template>
  106. <script>
  107. import {
  108. agentLevelList,
  109. agentLevelTaskList
  110. } from '@/api/user.js';
  111. import {
  112. getProductHot
  113. } from '@/api/store.js';
  114. import {
  115. toLogin
  116. } from '@/libs/login.js';
  117. import {
  118. mapGetters
  119. } from "vuex";
  120. import recommend from '@/components/recommend';
  121. import colors from '@/mixins/color.js';
  122. export default {
  123. components: {
  124. recommend
  125. },
  126. mixins: [colors],
  127. data() {
  128. return {
  129. reach_count: 0,
  130. distributionLevel: [],
  131. swiperIndex: 0,
  132. growthValue: true,
  133. task: [], //任务列表
  134. illustrate: '', //任务说明
  135. level_id: 0, //任务id,
  136. hostProduct: [],
  137. grade: 0,
  138. hotScroll: false,
  139. hotPage: 1,
  140. hotLimit: 10,
  141. level_title: '',
  142. level_discount: '',
  143. levelInfo: {},
  144. userInfo: {},
  145. taskInfo: {},
  146. taskNum: 0
  147. };
  148. },
  149. computed: mapGetters(['isLogin']),
  150. watch: {
  151. distributionLevel: function() {
  152. let that = this;
  153. if (that.distributionLevel.length > 0) {
  154. that.distributionLevel.forEach(function(item, index) {
  155. if (item.is_clear === false) {
  156. // that.swiper.slideTo(index);
  157. that.activeIndex = index;
  158. that.grade = item.grade;
  159. }
  160. });
  161. }
  162. },
  163. isLogin: {
  164. handler: function(newV, oldV) {
  165. if (newV) {
  166. this.get_host_product();
  167. }
  168. },
  169. deep: true
  170. }
  171. },
  172. onLoad() {
  173. if (this.isLogin) {
  174. this.agentLevelList();
  175. } else {
  176. toLogin();
  177. }
  178. this.get_host_product();
  179. },
  180. // 滚动监听
  181. onPageScroll(e) {
  182. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  183. uni.$emit('scroll');
  184. },
  185. methods: {
  186. agentLevelList: function() {
  187. agentLevelList().then(res => {
  188. const {
  189. level_info,
  190. level_list,
  191. task,
  192. user
  193. } = res.data;
  194. this.levelInfo = level_info;
  195. this.distributionLevel = level_list;
  196. this.userInfo = user;
  197. this.taskInfo = task;
  198. this.levelInfo.exp = parseFloat(this.levelInfo.exp);
  199. this.levelInfo.rate = Math.floor(this.levelInfo.exp / this.levelInfo.exp_num * 100);
  200. if (this.levelInfo.rate > 100) {
  201. this.levelInfo.rate = 100;
  202. }
  203. const index = level_list.findIndex((
  204. grade, v
  205. ) =>
  206. grade.id === user.agent_level
  207. );
  208. if (index !== -1) {
  209. this.swiperIndex = index === -1 ? 0 : index;
  210. }
  211. this.level_id = this.distributionLevel[index === -1 ? 0 : index].id || 0;
  212. this.getTask();
  213. });
  214. },
  215. /**
  216. * 获取我的推荐
  217. */
  218. get_host_product: function() {
  219. let that = this;
  220. if (that.hotScroll) return
  221. getProductHot(
  222. that.hotPage,
  223. that.hotLimit,
  224. ).then(res => {
  225. that.hotPage++
  226. that.hotScroll = res.data.length < that.hotLimit
  227. that.hostProduct = that.hostProduct.concat(res.data)
  228. });
  229. },
  230. /**
  231. * 会员切换
  232. *
  233. */
  234. swiperChange(e) {
  235. let index = e.detail.current;
  236. this.swiperIndex = index;
  237. this.level_id = this.distributionLevel[index].id || 0;
  238. this.level_title = this.distributionLevel[index].name || '';
  239. this.level_discount = this.distributionLevel[index].discount || '';
  240. // this.grade = this.distributionLevel[index].grade
  241. this.getTask();
  242. },
  243. /**
  244. * 关闭说明
  245. */
  246. growthValueClose: function() {
  247. this.growthValue = true;
  248. },
  249. /**
  250. * 打开说明
  251. */
  252. opHelp: function(index) {
  253. this.growthValue = false;
  254. this.illustrate = this.task[index].desc;
  255. },
  256. /**
  257. * 获取任务要求
  258. */
  259. getTask: function() {
  260. let that = this;
  261. that.taskNum = 0
  262. agentLevelTaskList(that.level_id).then(res => {
  263. that.task = res.data
  264. for (let i = 0; i < that.task.length; i++) {
  265. if (that.task[i].finish) {
  266. that.taskNum += 1
  267. }
  268. }
  269. });
  270. }
  271. },
  272. onReachBottom() {
  273. if (!this.hotScroll) {
  274. this.get_host_product();
  275. }
  276. }
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. .swiper {
  281. .swiper-item {
  282. height: 100%;
  283. border-radius: 6rpx;
  284. background: center/100% 100% no-repeat;
  285. transform: scale(0.9);
  286. transition: all 0.2s ease-in 0s;
  287. line-height: 1.1;
  288. &.on {
  289. transform: none;
  290. }
  291. }
  292. .user-wrap {
  293. padding-top: 20rpx;
  294. padding-left: 22rpx;
  295. line-height: 1.1;
  296. .image {
  297. width: 90rpx;
  298. height: 90rpx;
  299. border-radius: 50%;
  300. }
  301. .user-msg {
  302. margin-left: 14rpx;
  303. .text {
  304. flex: 1;
  305. display: flex;
  306. align-items: center;
  307. min-width: 0;
  308. font-size: 22rpx;
  309. color: #666666;
  310. .num {
  311. margin-right: 10rpx;
  312. margin-left: 10rpx;
  313. font-size: 30rpx;
  314. font-style: italic;
  315. }
  316. }
  317. }
  318. .name {
  319. flex: 1;
  320. overflow: hidden;
  321. white-space: nowrap;
  322. text-overflow: ellipsis;
  323. font-weight: bold;
  324. font-size: 28rpx;
  325. color: #fff;
  326. margin-right: 8rpx;
  327. }
  328. .state {
  329. position: absolute;
  330. top: 0rpx;
  331. right: 0;
  332. width: 70rpx;
  333. height: 70rpx;
  334. .lock {
  335. width: 100%;
  336. height: 100%;
  337. }
  338. }
  339. }
  340. .grow-wrap {
  341. padding-left: 34rpx;
  342. margin-top: 70rpx;
  343. font-size: 20rpx;
  344. color: #474747;
  345. display: flex;
  346. .num {
  347. margin-right: 8rpx;
  348. margin-left: 8rpx;
  349. font-size: 26rpx;
  350. }
  351. }
  352. .level {
  353. font-size: 24rpx;
  354. color: #fff;
  355. border-radius: 4rpx;
  356. border: 1px solid #fff;
  357. padding: 3rpx 8rpx;
  358. }
  359. }
  360. .skill-section {
  361. margin: 24rpx 30rpx 20rpx 30rpx;
  362. background-color: #FFF;
  363. border-radius: 8rpx;
  364. .section-hd {
  365. padding: 38rpx 36rpx 0 36rpx;
  366. font-weight: bold;
  367. font-size: 32rpx;
  368. color: #282828;
  369. .title {
  370. display: flex;
  371. align-items: center;
  372. font-size: 32rpx;
  373. .line-left {
  374. margin-right: 16rpx;
  375. width: 8rpx;
  376. height: 40rpx;
  377. border-radius: 4rpx;
  378. background-color: #E8B869;
  379. }
  380. }
  381. .task {
  382. color: #999999;
  383. font-size: 26rpx;
  384. font-weight: 400;
  385. }
  386. .task-num {
  387. color: #C6985C;
  388. }
  389. }
  390. .section-bd {
  391. padding: 30rpx;
  392. .item {
  393. width: 100%;
  394. // height: 140rpx;
  395. padding: 10px 25rpx;
  396. border-radius: 4rpx;
  397. background-color: #F8F8F8;
  398. box-shadow: 0 5rpx 10rpx 0 #F8F8F8;
  399. .name {
  400. font-size: 28rpx;
  401. }
  402. ~.item {
  403. margin-top: 24rpx;
  404. }
  405. }
  406. .text {
  407. flex: 1;
  408. }
  409. .title {
  410. font-weight: bold;
  411. font-size: 30rpx;
  412. color: #282828;
  413. display: flex;
  414. justify-content: space-between;
  415. .icon-wenti {
  416. color: #ccc;
  417. margin-left: 10rpx;
  418. }
  419. .mark {
  420. text-align: right;
  421. margin-left: 20rpx;
  422. font-weight: normal;
  423. font-size: 24rpx;
  424. color: #999999;
  425. white-space: nowrap;
  426. }
  427. }
  428. .process {
  429. height: 12rpx;
  430. border-radius: 6rpx;
  431. margin-top: 22rpx;
  432. background-color: #EEEEEE;
  433. .fill {
  434. height: 100%;
  435. border-radius: 6rpx;
  436. background-color: #E7B667;
  437. }
  438. }
  439. .info-box {
  440. display: flex;
  441. justify-content: space-between;
  442. align-items: center;
  443. margin-top: 18rpx;
  444. }
  445. .info {
  446. font-size: 22rpx;
  447. color: #999999;
  448. }
  449. .link {
  450. font-size: 26rpx;
  451. color: #999999;
  452. .new-number {
  453. color: #C6985C;
  454. }
  455. }
  456. }
  457. }
  458. .bag {
  459. position: absolute;
  460. width: 100%;
  461. height: 285rpx;
  462. }
  463. .member-center .header {
  464. // height: 470rpx;
  465. padding-top: 37rpx;
  466. }
  467. .member-center .header swiper {
  468. position: relative;
  469. // height: 330rpx;
  470. }
  471. .member-center .growthValue {
  472. background-color: #fff;
  473. border-radius: 16rpx;
  474. position: fixed;
  475. top: 266rpx;
  476. left: 50%;
  477. width: 560rpx;
  478. min-height: 440rpx;
  479. margin-left: -280rpx;
  480. z-index: 99;
  481. transform: translate3d(0, -200%, 0);
  482. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  483. }
  484. .member-center .growthValue.on {
  485. transform: translate3d(0, 0, 0);
  486. }
  487. .member-center .growthValue .pictrue {
  488. width: 100%;
  489. height: 257rpx;
  490. position: relative;
  491. }
  492. .member-center .growthValue .pictrue image {
  493. width: 100%;
  494. height: 100%;
  495. border-radius: 16rpx 16rpx 0 0;
  496. }
  497. .member-center .growthValue .conter {
  498. padding: 0 35rpx;
  499. font-size: 30rpx;
  500. color: #333;
  501. margin-top: 58rpx;
  502. line-height: 1.5;
  503. height: 350rpx;
  504. overflow: auto;
  505. }
  506. .member-center .growthValue .iconfont {
  507. position: absolute;
  508. font-size: 65rpx;
  509. color: #fff;
  510. bottom: -90rpx;
  511. left: 50%;
  512. transform: translateX(-50%);
  513. }
  514. .level-grow-wrap {
  515. position: absolute;
  516. display: flex;
  517. left: 30rpx;
  518. bottom: 39rpx;
  519. font-size: 20rpx;
  520. color: #474747;
  521. .level-info {
  522. display: flex;
  523. justify-content: center;
  524. flex-direction: column;
  525. margin-right: 40rpx;
  526. .level-info-title {
  527. font-size: 22rpx;
  528. color: #FFFFFF;
  529. opacity: 0.6;
  530. }
  531. .num {
  532. color: #fff;
  533. font-size: 40rpx;
  534. margin-top: 20rpx;
  535. .percent {
  536. font-size: 24rpx;
  537. }
  538. }
  539. }
  540. .lock-sty {
  541. opacity: 0.7;
  542. }
  543. }
  544. .swiper .level-sty {
  545. opacity: 0.7;
  546. }
  547. </style>