index.vue 12 KB

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