index.vue 13 KB

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