index.vue 13 KB

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