index.vue 12 KB

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