index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <template>
  2. <view>
  3. <view class='member-center'>
  4. <view class='header'>
  5. <swiper :indicator-dots="indicatorDots" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration"
  6. @change="bindchange" previous-margin="30px" next-margin="30px">
  7. <block v-for="(item,index) in VipList" :key="index">
  8. <swiper-item>
  9. <view class="memberBg" :class="swiperIndex == index ? 'active' : 'quiet'" :style='"background-image:url("+item.image+")"'
  10. mode='aspectFill'>
  11. <view class='name'>{{item.name}}</view>
  12. <view class='discount'>可享受商品折扣:{{item.discount}}折<text class='iconfont icon-zhekou'></text></view>
  13. <view class='lock' v-if="item.grade < grade"><text class='iconfont icon-xuanzhong1'></text>已解锁更高等级</view>
  14. <view class='lock' v-if="item.grade > grade"><text class='iconfont icon-quanxianguanlisuozi'></text>该会员等级尚未解锁</view>
  15. <view class='nav acea-row' v-if="grade==item.grade">
  16. <view class='item' v-if="indexn <= 3" v-for="(itemn,indexn) in item.task_list" :key="indexn">
  17. <view class='num'>{{itemn.number}}</view>
  18. <view>{{itemn.real_name}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. </swiper-item>
  23. </block>
  24. </swiper>
  25. </view>
  26. <view class='wrapper'>
  27. <view class='title acea-row row-between-wrapper'>
  28. <view><text class='iconfont icon-jingyanzhi'></text>会员升级要求</view>
  29. <view class='num'><text class='current'>{{reach_count || 0}}</text>/{{task.length || 0}}</view>
  30. </view>
  31. <view class='list'>
  32. <view class='item' v-for="(item,index) in task" :key="index">
  33. <view class='top acea-row row-between-wrapper'>
  34. <view class='name' @click='opHelp(index)'>{{item.name}}<text v-if="item.illustrate" class='iconfont icon-wenti'></text></view>
  35. <view v-if="item.finish">已满足条件</view>
  36. <view v-else>未满足条件</view>
  37. </view>
  38. <view class="cu-progress">
  39. <view class='bg-red' :style="'width:'+item.speed+'%;'"></view>
  40. </view>
  41. <view class='experience acea-row row-between-wrapper'>
  42. <view>{{item.task_type_title}}</view>
  43. <view><text class='num'>{{item.new_number || 0}}</text>/{{item.number || 0}}</view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <recommend :hostProduct="hostProduct"></recommend>
  49. <view class='growthValue' :class='growthValue==false?"on":""'>
  50. <view class='pictrue'>
  51. <image src='../../../static/images/value.jpg'></image><text class='iconfont icon-guanbi3' @click='growthValue'></text>
  52. </view>
  53. <view class='conter'>{{illustrate}}</view>
  54. </view>
  55. <view class='mask' :hidden='growthValue' @click='growthValueClose'></view>
  56. </view>
  57. <!-- #ifdef MP -->
  58. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  59. <!-- #endif -->
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. userLevelGrade,
  65. userLevelTask,
  66. userLevelDetection
  67. } from '@/api/user.js';
  68. import {
  69. getProductHot
  70. } from '@/api/store.js';
  71. import {
  72. toLogin
  73. } from '@/libs/login.js';
  74. import {
  75. mapGetters
  76. } from "vuex";
  77. // #ifdef MP
  78. import authorize from '@/components/Authorize';
  79. // #endif
  80. import recommend from '@/components/recommend';
  81. export default {
  82. components: {
  83. recommend,
  84. // #ifdef MP
  85. authorize
  86. // #endif
  87. },
  88. data() {
  89. return {
  90. reach_count:0,
  91. VipList: [],
  92. indicatorDots: false,
  93. circular: true,
  94. autoplay: false,
  95. interval: 3000,
  96. duration: 500,
  97. swiperIndex: 0,
  98. growthValue: true,
  99. task: [], //任务列表
  100. illustrate: '', //任务说明
  101. level_id: 0, //任务id,
  102. hostProduct: [],
  103. grade: 0,
  104. isAuto: false, //没有授权的不会自动授权
  105. isShowAuth: false ,//是否隐藏授权
  106. hotScroll:false,
  107. hotPage:1,
  108. hotLimit:10
  109. };
  110. },
  111. computed: mapGetters(['isLogin']),
  112. watch: {
  113. VipList: function() {
  114. console.log('观察')
  115. let that = this;
  116. if (that.VipList.length > 0) {
  117. that.VipList.forEach(function(item, index) {
  118. if (item.is_clear === false) {
  119. // that.swiper.slideTo(index);
  120. that.activeIndex = index;
  121. that.grade = item.grade;
  122. }
  123. });
  124. }
  125. }
  126. },
  127. onLoad() {
  128. if (this.isLogin) {
  129. this.setLeveLComplete();
  130. this.get_host_product();
  131. } else {
  132. // #ifdef H5 || APP-PLUS
  133. toLogin();
  134. // #endif
  135. // #ifdef MP
  136. this.isAuto = true;
  137. this.$set(this, 'isShowAuth', true)
  138. // #endif
  139. }
  140. let that = this;
  141. setTimeout(function() {
  142. that.loading = true
  143. }, 500)
  144. },
  145. methods: {
  146. onLoadFun: function() {
  147. this.setLeveLComplete();
  148. this.get_host_product();
  149. },
  150. // 授权关闭
  151. authColse: function(e) {
  152. this.isShowAuth = e
  153. },
  154. /**
  155. * 获取我的推荐
  156. */
  157. get_host_product: function() {
  158. let that = this;
  159. getProductHot().then(res => {
  160. let that = this;
  161. if(that.hotScroll) return
  162. getProductHot(
  163. that.hotPage,
  164. that.hotLimit,
  165. ).then(res => {
  166. that.hotPage++
  167. that.hotScroll = res.data.length<that.hotLimit
  168. that.hostProduct = that.hostProduct.concat(res.data)
  169. });
  170. });
  171. },
  172. /**
  173. * 会员切换
  174. *
  175. */
  176. bindchange(e) {
  177. let index = e.detail.current;
  178. this.swiperIndex = index;
  179. this.level_id = this.VipList[index].id || 0;
  180. // this.grade = this.VipList[index].grade
  181. this.getTask();
  182. },
  183. /**
  184. * 关闭说明
  185. */
  186. growthValueClose: function() {
  187. this.growthValue = true;
  188. },
  189. /**
  190. * 打开说明
  191. */
  192. opHelp: function(index) {
  193. this.growthValue = false;
  194. this.illustrate = this.task[index].illustrate;
  195. },
  196. /**
  197. * 设置会员
  198. */
  199. setLeveLComplete: function() {
  200. let that = this;
  201. userLevelDetection().then(res => {
  202. that.getVipList();
  203. });
  204. },
  205. /**
  206. * 获取会员等级
  207. *
  208. */
  209. getVipList: function() {
  210. let that = this;
  211. userLevelGrade().then(res => {
  212. that.$set(that, 'VipList', res.data.list);
  213. that.task = res.data.task.task;
  214. that.reach_count = res.data.task.reach_count;
  215. that.level_id = res.data.list[0] ? res.data.list[0].id : 0;
  216. let arr = [];
  217. // res.data.list.forEach(function(item, index) {
  218. // if (item.is_clear == false) {
  219. // arr.push(item.grade);
  220. // }
  221. // })
  222. // that.grade = arr[0] || 0;
  223. // that.grade = res.data.list[0].grade
  224. });
  225. },
  226. /**
  227. * 获取任务要求
  228. */
  229. getTask: function() {
  230. let that = this;
  231. userLevelTask(that.level_id).then(res => {
  232. that.task = res.data.task;
  233. that.reach_count = res.data.reach_count;
  234. });
  235. }
  236. },
  237. onReachBottom() {
  238. this.get_host_product();
  239. }
  240. }
  241. </script>
  242. <style scoped lang="scss">
  243. .member-center .header {
  244. background-color: #232323;
  245. width: 100%;
  246. padding: 50rpx 0;
  247. }
  248. .member-center .header swiper {
  249. width: 100%;
  250. height: 328rpx;
  251. position: relative;
  252. }
  253. .member-center .header swiper-item .memberBg.active {
  254. transform: none;
  255. transition: all 0.2s ease-in 0s;
  256. }
  257. .member-center .header swiper-item .memberBg.quiet {
  258. transform: scale(0.9);
  259. transition: all 0.2s ease-in 0s;
  260. }
  261. .member-center .header swiper-item .memberBg {
  262. width: 100%;
  263. height: 328rpx;
  264. border-radius: 16rpx;
  265. color: #fff;
  266. position: relative;
  267. background-size: 100% 100%
  268. }
  269. .member-center .header swiper-item .memberBg image {
  270. width: 89rpx;
  271. height: 108rpx;
  272. display: block;
  273. position: absolute;
  274. right: 60rpx;
  275. }
  276. .member-center .header swiper-item .memberBg .name {
  277. font-size: 46rpx;
  278. font-weight: bold;
  279. padding: 40rpx 0 0 35rpx;
  280. }
  281. .member-center .header swiper-item .memberBg .discount {
  282. font-size: 28rpx;
  283. font-weight: bold;
  284. margin: 15rpx 0 0 35rpx;
  285. }
  286. .member-center .header swiper-item .memberBg .discount .iconfont {
  287. margin-left: 10rpx;
  288. font-size: 30rpx;
  289. }
  290. .member-center .header swiper-item .memberBg .nav {
  291. margin-top: 55rpx;
  292. }
  293. .member-center .header swiper-item .memberBg .nav .item {
  294. flex: 1;
  295. text-align: center;
  296. color: rgba(255, 255, 255, 0.6);
  297. position: relative;
  298. }
  299. .member-center .header swiper-item .memberBg .nav .item .num {
  300. font-size: 40rpx;
  301. color: #fff;
  302. font-family: 'Guildford Pro';
  303. }
  304. .member-center .header swiper-item .memberBg .nav .item~.item::before {
  305. position: absolute;
  306. width: 2rpx;
  307. height: 32rpx;
  308. background-color: rgba(255, 255, 255, 0.6);
  309. content: '';
  310. left: 0;
  311. top: 50%;
  312. transform: translateY(-50%);
  313. }
  314. .member-center .header swiper-item .memberBg .lock {
  315. font-size: 26rpx;
  316. margin: 73rpx 0 0 35rpx;
  317. }
  318. .member-center .header swiper-item .memberBg .lock .iconfont {
  319. font-size: 37rpx;
  320. margin-right: 15rpx;
  321. vertical-align: -4rpx;
  322. }
  323. .member-center .wrapper {
  324. background-color: #fff;
  325. padding-bottom: 16rpx;
  326. margin-bottom: 20rpx;
  327. }
  328. .member-center .wrapper .title {
  329. height: 98rpx;
  330. padding: 0 30rpx;
  331. font-size: 30rpx;
  332. font-weight: bold;
  333. color: #282828;
  334. }
  335. .member-center .wrapper .title .iconfont {
  336. color: #ffae06;
  337. font-weight: normal;
  338. font-size: 40rpx;
  339. margin-right: 12rpx;
  340. vertical-align: -2rpx;
  341. }
  342. .member-center .wrapper .title .num {
  343. font-size: 28rpx;
  344. color: #999;
  345. }
  346. .member-center .wrapper .title .num .current {
  347. color: #ffae06;
  348. }
  349. .member-center .wrapper .list .item {
  350. width: 690rpx;
  351. height: 184rpx;
  352. background-color: #f9f9f9;
  353. margin: 0 auto 20rpx auto;
  354. padding: 27rpx 0 22rpx 0;
  355. border-radius: 12rpx;
  356. box-sizing: border-box;
  357. }
  358. .member-center .wrapper .list .item .top {
  359. padding-right: 27rpx;
  360. font-size: 26rpx;
  361. color: #999;
  362. }
  363. .member-center .wrapper .list .item .top .name {
  364. border-left: 6rpx solid #ffae06;
  365. padding-left: 20rpx;
  366. font-size: 28rpx;
  367. color: #282828;
  368. font-weight: bold;
  369. }
  370. .member-center .wrapper .list .item .top .name .iconfont {
  371. color: #999;
  372. font-size: 30rpx;
  373. vertical-align: -2rpx;
  374. margin-left: 10rpx;
  375. }
  376. .member-center .wrapper .list .item .cu-progress {
  377. overflow: hidden;
  378. height: 12rpx;
  379. background-color: #eee;
  380. width: 636rpx;
  381. border-radius: 20rpx;
  382. margin: 35rpx auto 0 auto;
  383. }
  384. .member-center .wrapper .list .item .cu-progress .bg-red {
  385. width: 0;
  386. height: 100%;
  387. transition: width 0.6s ease;
  388. background-color: #ffaa29;
  389. border-radius: 20rpx;
  390. }
  391. .member-center .wrapper .list .item .experience {
  392. margin-top: 17rpx;
  393. padding: 0 27rpx;
  394. font-size: 24rpx;
  395. color: #999;
  396. }
  397. .member-center .wrapper .list .item .experience .num {
  398. color: #ffad07;
  399. }
  400. .member-center .growthValue {
  401. background-color: #fff;
  402. border-radius: 16rpx;
  403. position: fixed;
  404. top: 266rpx;
  405. left: 50%;
  406. width: 560rpx;
  407. height: 740rpx;
  408. margin-left: -280rpx;
  409. z-index: 99;
  410. transform: translate3d(0, -200%, 0);
  411. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  412. }
  413. .member-center .growthValue.on {
  414. transform: translate3d(0, 0, 0);
  415. }
  416. .member-center .growthValue .pictrue {
  417. width: 100%;
  418. height: 257rpx;
  419. position: relative;
  420. }
  421. .member-center .growthValue .pictrue image {
  422. width: 100%;
  423. height: 100%;
  424. border-radius: 16rpx 16rpx 0 0;
  425. }
  426. .member-center .growthValue .conter {
  427. padding: 0 35rpx;
  428. font-size: 30rpx;
  429. color: #333;
  430. margin-top: 58rpx;
  431. line-height: 1.5;
  432. height: 350rpx;
  433. overflow: auto;
  434. }
  435. .member-center .growthValue .pictrue .iconfont {
  436. position: absolute;
  437. font-size: 65rpx;
  438. color: #fff;
  439. top: 775rpx;
  440. left: 50%;
  441. transform: translateX(-50%);
  442. }
  443. </style>