小程序端工程代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

208 lines
6.4 KiB

  1. <template>
  2. <view class="member-center">
  3. <view class="header">
  4. <view class="slider-banner banner">
  5. <swiper indicatorDots="true" @change="swiperChange">
  6. <block v-for="(item, vipListIndex) in vipList" :key="vipListIndex">
  7. <swiper-item>
  8. <view class="swiper-slide" :style="{ backgroundImage: 'url(' + item.image + ')' }">
  9. <!-- <image :src="item.icon" />-->
  10. <view class="name">{{ item.name }}</view>
  11. <view class="discount">
  12. 可享受商品折扣: {{ item.discount / 10 }}
  13. <text class="iconfont icon-zhekou"></text>
  14. </view>
  15. <view class="nav acea-row" v-if="item.grade == grade">
  16. <view class="item" v-for="(val, indexn) in vipComplete" :key="indexn">
  17. <view class="num">{{ val.newNumber }}</view>
  18. <view>{{ val.realName }}</view>
  19. </view>
  20. </view>
  21. <view class="lock" v-if="item.grade > grade">
  22. <text class="iconfont icon-quanxianguanlisuozi"></text>该会员等级尚未解锁
  23. </view>
  24. <view class="lock" v-if="item.grade < grade">
  25. <text class="iconfont icon-xuanzhong1"></text>已解锁更高等级
  26. </view>
  27. </view>
  28. </swiper-item>
  29. </block>
  30. </swiper>
  31. </view>
  32. </view>
  33. <view class="wrapper">
  34. <view class="title acea-row row-between-wrapper">
  35. <view>
  36. <text class="iconfont icon-jingyanzhi"></text>会员升级要求
  37. </view>
  38. <view class="num">
  39. <text class="current">{{ taskCount }}</text>
  40. /{{ vipRequire.length }}
  41. </view>
  42. </view>
  43. <view class="list">
  44. <view class="item" v-for="(item, vipCompleteIndex) in vipComplete" :key="vipCompleteIndex">
  45. <view class="top acea-row row-between-wrapper">
  46. <view class="name">
  47. {{ item.name}}
  48. <text class="iconfont icon-wenti" v-if="item.illustrate" @click="showGrow(item)"></text>
  49. </view>
  50. <view>{{ item.finish ? "已满足条件" : "未满足条件" }}</view>
  51. </view>
  52. <view class="cu-progress">
  53. <view class="bg-red" :style="{ width: item.speed + '%' }"></view>
  54. </view>
  55. <view class="experience acea-row row-between-wrapper">
  56. <view>{{ item.taskTypeTitle }}</view>
  57. <view>
  58. <text class="num">{{ item.newNumber }}</text>
  59. /{{ item.number }}
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <Recommend></Recommend>
  66. <view class="growthValue" :class="growthValue === false ? 'on' : ''">
  67. <view class="pictrue">
  68. <image :src="`${$VUE_APP_RESOURCES_URL}/images/value.jpg`" />
  69. <text class="iconfont icon-guanbi3" @click="growthTap"></text>
  70. </view>
  71. <view class="conter">{{ illustrate }}</view>
  72. </view>
  73. <view class="mask" :hidden="growthValue" @click="growthTap"></view>
  74. </view>
  75. </template>
  76. <script>
  77. // import { swiper, swiperSlide } from "vue-awesome-swiper";
  78. import Recommend from "@/components/Recommend";
  79. import { getVipInfo, getVipTask, setDetection } from "@/api/user";
  80. export default {
  81. name: "Poster",
  82. components: {
  83. // swiper,
  84. // swiperSlide,
  85. Recommend
  86. },
  87. props: {},
  88. data: function() {
  89. return {
  90. vipList: [], //等级列表
  91. vipRequire: [], //等级要求
  92. vipComplete: [], //完成情况
  93. taskCount: 0, //任务数
  94. grade: 0, //当前会员等级
  95. swiperVip: {
  96. speed: 1000,
  97. effect: "coverflow",
  98. slidesPerView: "auto",
  99. centeredSlides: true,
  100. // loop: true,
  101. coverflowEffect: {
  102. rotate: 0, // 旋转的角度
  103. stretch: -20, // 拉伸 图片间左右的间距和密集度
  104. depth: 100, // 深度 切换图片间上下的间距和密集度
  105. modifier: 2, // 修正值 该值越大前面的效果越明显
  106. slideShadows: false // 页面阴影效果
  107. },
  108. observer: true,
  109. observeParents: true
  110. },
  111. loading: false,
  112. growthValue: true,
  113. illustrate: "",
  114. activeIndex: 0
  115. };
  116. },
  117. watch: {
  118. vipList: function() {
  119. let that = this;
  120. if (that.vipList.length > 0) {
  121. that.vipList.forEach(function(item, index) {
  122. if (item.isClear === false) {
  123. // that.swiper.slideTo(index);
  124. that.activeIndex = index;
  125. that.grade = item.grade;
  126. }
  127. });
  128. }
  129. }
  130. },
  131. computed: {
  132. swiper() {
  133. // return this.$refs.mySwiper.swiper;
  134. }
  135. },
  136. mounted: function() {
  137. let that = this;
  138. setDetection();
  139. that.getInfo();
  140. // that.swiper.on("slideChange", function() {
  141. // that.activeIndex = that.swiper.activeIndex;
  142. // that.getTask();
  143. // });
  144. },
  145. methods: {
  146. swiperChange: function(e) {
  147. let that = this;
  148. that.activeIndex = e.mp.detail.current;
  149. that.getTask();
  150. },
  151. growthTap: function() {
  152. this.growthValue = true;
  153. },
  154. getInfo: function() {
  155. let that = this;
  156. getVipInfo().then(
  157. res => {
  158. that.vipList = res.data.list;
  159. that.vipRequire = res.data.task.list;
  160. that.vipComplete = res.data.task.task;
  161. that.taskCount = res.data.task.reachCount;
  162. },
  163. err => {
  164. uni.showToast({
  165. title:
  166. err.msg || err.response.data.msg || err.response.data.message,
  167. icon: "none",
  168. duration: 2000
  169. });
  170. }
  171. );
  172. },
  173. getTask: function() {
  174. let that = this;
  175. getVipTask(that.vipList[that.activeIndex].id).then(
  176. res => {
  177. that.vipRequire = res.data.list;
  178. that.vipComplete = res.data.task;
  179. that.taskCount = res.data.reachCount;
  180. },
  181. err => {
  182. uni.showToast({
  183. title:
  184. err.msg || err.response.data.msg || err.response.data.message,
  185. icon: "none",
  186. duration: 2000
  187. });
  188. }
  189. );
  190. },
  191. showGrow: function(item) {
  192. if (this.illustrate != item.illustrate) this.illustrate = item.illustrate;
  193. this.growthValue = false;
  194. }
  195. }
  196. };
  197. </script>
  198. <style lang="less">
  199. .banner swiper {
  200. height: 328rpx;
  201. }
  202. .swiper-slide {
  203. margin: 0 auto;
  204. }
  205. </style>