index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='member-center'>
  4. <image class="bag" src="../static/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. {{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">一级分佣上浮</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">二级分佣上浮</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. 快速升级技巧
  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. {{item.name}}
  77. <text class="iconfont icon-wenti" @click="opHelp(index)"></text>
  78. </view>
  79. <text class="mark">{{item.finish?'已完成':'未完成'}}</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 ? '' : 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. onShow() {
  181. uni.removeStorageSync('form_type_cart');
  182. },
  183. methods: {
  184. agentLevelList: function() {
  185. agentLevelList().then(res => {
  186. const {
  187. level_info,
  188. level_list,
  189. task,
  190. user
  191. } = res.data;
  192. this.levelInfo = level_info;
  193. this.distributionLevel = level_list;
  194. this.userInfo = user;
  195. this.taskInfo = task;
  196. this.levelInfo.exp = parseFloat(this.levelInfo.exp);
  197. this.levelInfo.rate = Math.floor(this.levelInfo.exp / this.levelInfo.exp_num * 100);
  198. if (this.levelInfo.rate > 100) {
  199. this.levelInfo.rate = 100;
  200. }
  201. console.log(level_info, level_list)
  202. const index = level_list.findIndex((
  203. grade, v
  204. ) =>
  205. grade.id === user.agent_level
  206. );
  207. if (index !== -1) {
  208. this.swiperIndex = index === -1 ? 0 : (index + 1);
  209. }
  210. this.level_id = this.distributionLevel[index === -1 ? 0 : (index + 1)].id || 0;
  211. this.getTask();
  212. });
  213. },
  214. /**
  215. * 获取我的推荐
  216. */
  217. get_host_product: function() {
  218. let that = this;
  219. if (that.hotScroll) return
  220. getProductHot(
  221. that.hotPage,
  222. that.hotLimit,
  223. ).then(res => {
  224. that.hotPage++
  225. that.hotScroll = res.data.length < that.hotLimit
  226. that.hostProduct = that.hostProduct.concat(res.data)
  227. });
  228. },
  229. /**
  230. * 会员切换
  231. *
  232. */
  233. swiperChange(e) {
  234. let index = e.detail.current;
  235. this.swiperIndex = index;
  236. this.level_id = this.distributionLevel[index].id || 0;
  237. this.level_title = this.distributionLevel[index].name || '';
  238. this.level_discount = this.distributionLevel[index].discount || '';
  239. // this.grade = this.distributionLevel[index].grade
  240. this.getTask();
  241. },
  242. /**
  243. * 关闭说明
  244. */
  245. growthValueClose: function() {
  246. this.growthValue = true;
  247. },
  248. /**
  249. * 打开说明
  250. */
  251. opHelp: function(index) {
  252. this.growthValue = false;
  253. this.illustrate = this.task[index].desc;
  254. },
  255. /**
  256. * 获取任务要求
  257. */
  258. getTask: function() {
  259. let that = this;
  260. that.taskNum = 0
  261. agentLevelTaskList(that.level_id).then(res => {
  262. that.task = res.data.list
  263. for (let i = 0; i < that.task.length; i++) {
  264. if (that.task[i].finish) {
  265. that.taskNum += 1
  266. }
  267. }
  268. });
  269. }
  270. },
  271. onReachBottom() {
  272. if (!that.hotScroll) {
  273. this.get_host_product();
  274. }
  275. }
  276. }
  277. </script>
  278. <style lang="scss" scoped>
  279. .swiper {
  280. .swiper-item {
  281. height: 100%;
  282. border-radius: 6rpx;
  283. background: center/100% 100% no-repeat;
  284. transform: scale(0.9);
  285. transition: all 0.2s ease-in 0s;
  286. line-height: 1.1;
  287. &.on {
  288. transform: none;
  289. }
  290. }
  291. .user-wrap {
  292. padding-top: 20rpx;
  293. padding-left: 22rpx;
  294. line-height: 1.1;
  295. .image {
  296. width: 90rpx;
  297. height: 90rpx;
  298. border-radius: 50%;
  299. }
  300. .user-msg {
  301. margin-left: 14rpx;
  302. .text {
  303. flex: 1;
  304. display: flex;
  305. align-items: center;
  306. min-width: 0;
  307. font-size: 22rpx;
  308. color: #666666;
  309. .num {
  310. margin-right: 10rpx;
  311. margin-left: 10rpx;
  312. font-size: 30rpx;
  313. font-style: italic;
  314. }
  315. }
  316. }
  317. .name {
  318. flex: 1;
  319. overflow: hidden;
  320. white-space: nowrap;
  321. text-overflow: ellipsis;
  322. font-weight: bold;
  323. font-size: 28rpx;
  324. color: #fff;
  325. margin-right: 8rpx;
  326. }
  327. .state {
  328. position: absolute;
  329. top: 0rpx;
  330. right: 0;
  331. width: 70rpx;
  332. height: 70rpx;
  333. .lock {
  334. width: 100%;
  335. height: 100%;
  336. }
  337. }
  338. }
  339. .grow-wrap {
  340. padding-left: 34rpx;
  341. margin-top: 70rpx;
  342. font-size: 20rpx;
  343. color: #474747;
  344. display: flex;
  345. .num {
  346. margin-right: 8rpx;
  347. margin-left: 8rpx;
  348. font-size: 26rpx;
  349. }
  350. }
  351. .level {
  352. font-size: 24rpx;
  353. color: #fff;
  354. border-radius: 4rpx;
  355. border: 1px solid #fff;
  356. padding: 3rpx 8rpx;
  357. }
  358. }
  359. .skill-section {
  360. margin: 24rpx 30rpx 20rpx 30rpx;
  361. background-color: #FFF;
  362. border-radius: 8rpx;
  363. .section-hd {
  364. padding: 38rpx 36rpx 0 36rpx;
  365. font-weight: bold;
  366. font-size: 32rpx;
  367. color: #282828;
  368. .title {
  369. display: flex;
  370. align-items: center;
  371. font-size: 32rpx;
  372. .line-left {
  373. margin-right: 16rpx;
  374. width: 8rpx;
  375. height: 40rpx;
  376. border-radius: 4rpx;
  377. background-color: #E8B869;
  378. }
  379. }
  380. .task {
  381. color: #999999;
  382. font-size: 26rpx;
  383. font-weight: 400;
  384. }
  385. .task-num {
  386. color: #C6985C;
  387. }
  388. }
  389. .section-bd {
  390. padding: 30rpx;
  391. .item {
  392. width: 100%;
  393. // height: 140rpx;
  394. padding: 10px 25rpx;
  395. border-radius: 4rpx;
  396. background-color: #F8F8F8;
  397. box-shadow: 0 5rpx 10rpx 0 #F8F8F8;
  398. .name {
  399. font-size: 28rpx;
  400. }
  401. ~.item {
  402. margin-top: 24rpx;
  403. }
  404. }
  405. .text {
  406. flex: 1;
  407. }
  408. .title {
  409. font-weight: bold;
  410. font-size: 30rpx;
  411. color: #282828;
  412. display: flex;
  413. justify-content: space-between;
  414. .icon-wenti {
  415. color: #999;
  416. margin-left: 10rpx;
  417. }
  418. .mark {
  419. text-align: right;
  420. margin-left: 20rpx;
  421. font-weight: normal;
  422. font-size: 24rpx;
  423. color: #999999;
  424. white-space: nowrap;
  425. }
  426. }
  427. .process {
  428. height: 12rpx;
  429. border-radius: 6rpx;
  430. margin-top: 22rpx;
  431. background-color: #EEEEEE;
  432. .fill {
  433. height: 100%;
  434. border-radius: 6rpx;
  435. background-color: #E7B667;
  436. }
  437. }
  438. .info-box {
  439. display: flex;
  440. justify-content: space-between;
  441. align-items: center;
  442. margin-top: 18rpx;
  443. }
  444. .info {
  445. font-size: 22rpx;
  446. color: #999999;
  447. }
  448. .link {
  449. font-size: 26rpx;
  450. color: #999999;
  451. .new-number {
  452. color: #C6985C;
  453. }
  454. }
  455. }
  456. }
  457. .bag {
  458. position: absolute;
  459. width: 100%;
  460. height: 285rpx;
  461. }
  462. .member-center .header {
  463. // height: 470rpx;
  464. padding-top: 37rpx;
  465. }
  466. .member-center .header swiper {
  467. position: relative;
  468. // height: 330rpx;
  469. }
  470. .member-center .growthValue {
  471. background-color: #fff;
  472. border-radius: 16rpx;
  473. position: fixed;
  474. top: 266rpx;
  475. left: 50%;
  476. width: 560rpx;
  477. min-height: 440rpx;
  478. margin-left: -280rpx;
  479. z-index: 99;
  480. transform: translate3d(0, -200%, 0);
  481. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  482. }
  483. .member-center .growthValue.on {
  484. transform: translate3d(0, 0, 0);
  485. }
  486. .member-center .growthValue .pictrue {
  487. width: 100%;
  488. height: 257rpx;
  489. position: relative;
  490. }
  491. .member-center .growthValue .pictrue image {
  492. width: 100%;
  493. height: 100%;
  494. border-radius: 16rpx 16rpx 0 0;
  495. }
  496. .member-center .growthValue .conter {
  497. padding: 0 35rpx;
  498. font-size: 30rpx;
  499. color: #333;
  500. margin-top: 58rpx;
  501. line-height: 1.5;
  502. height: 350rpx;
  503. overflow: auto;
  504. }
  505. .member-center .growthValue .iconfont {
  506. position: absolute;
  507. font-size: 65rpx;
  508. color: #fff;
  509. bottom: -90rpx;
  510. left: 50%;
  511. transform: translateX(-50%);
  512. }
  513. .level-grow-wrap {
  514. position: absolute;
  515. display: flex;
  516. left: 30rpx;
  517. bottom: 39rpx;
  518. font-size: 20rpx;
  519. color: #474747;
  520. .level-info {
  521. display: flex;
  522. justify-content: center;
  523. flex-direction: column;
  524. margin-right: 40rpx;
  525. .level-info-title {
  526. font-size: 22rpx;
  527. color: #FFFFFF;
  528. opacity: 0.6;
  529. }
  530. .num {
  531. color: #fff;
  532. font-size: 40rpx;
  533. margin-top: 20rpx;
  534. .percent {
  535. font-size: 24rpx;
  536. }
  537. }
  538. }
  539. .lock-sty {
  540. opacity: 0.7;
  541. }
  542. }
  543. .swiper .level-sty {
  544. opacity: 0.7;
  545. }
  546. </style>