多租户商城-商户小程序端
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.

319 lines
8.7 KiB

2 years ago
  1. <template>
  2. <div class="vip">
  3. <div class="vip-card">
  4. <div class="vip-title">
  5. <!-- #ifdef MP-WEIXIN -->
  6. <img class="title-img" src="../../../static/images/vip/img-title.png" alt="会员专区" mode="widthFix"/>
  7. <!-- #endif -->
  8. <!-- #ifdef H5 || APP-PLUS -->
  9. <image class="title-img" src="../../../static/images/vip/img-title.png" alt="会员专区" mode="widthFix"/>
  10. <!-- #endif -->
  11. <a v-show="componentContent.showMore" class="btn-more a-link" @click="jumpVip">更多<i class="iconfont icon-arrow-right"></i></a>
  12. </div>
  13. <div>
  14. <div v-if="productData.length > 2">
  15. <swiper class="swiper vip-list" :circular="true" :indicator-dots="false" :autoplay="true" @change="swiperChange">
  16. <swiper-item class="vip-item-warp" v-for="(itemJ,indexJ) in listTemp" :key="indexJ">
  17. <div class="vip-item" v-for="(item,index) in itemJ" :key="index" @click="jumpProductDetail(item)">
  18. <div class="vip-item-img">
  19. <image class="img default-img" :src="item.image"></image>
  20. </div>
  21. <div class="vip-item-info">
  22. <h3 class="name">
  23. {{item.productName}}
  24. </h3>
  25. <div class="stock">
  26. 还剩{{item.stockNumber}}
  27. </div>
  28. <div class="original-price">
  29. ¥ {{item.originalPrice}}
  30. </div>
  31. <div class="price-warp">
  32. <div class="flag">
  33. <!-- #ifdef MP-WEIXIN -->
  34. <img src="../../../static/images/vip/flag-vip.png" alt="会员价" class="flagImg"/>
  35. <!-- #endif -->
  36. <!-- #ifdef H5 || APP-PLUS -->
  37. <image class="flagImg" src="../../../static/images/vip/flag-vip.png" alt="会员专区" mode="widthFix"/>
  38. <!-- #endif -->
  39. </div>
  40. <div class="price">
  41. ¥ {{item.price}}
  42. </div>
  43. </div>
  44. <div class="btn-buy">
  45. <span>去购买</span>
  46. <div class="progress">
  47. <i></i>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </swiper-item>
  53. </swiper>
  54. <view class="swiper-dots" v-if="listTemp && listTemp.length > 1">
  55. <text class="dot" :class="swiperCurrent === index && 'dot-active'" v-for="(dot, index) in listTemp.length"
  56. :key="index"></text>
  57. </view>
  58. </div>
  59. <div class="swiper vip-list" v-else>
  60. <div class="vip-item-warp" v-for="(itemJ,indexJ) in listTemp" :key="indexJ">
  61. <div class="vip-item" v-for="(item,index) in itemJ" :key="index" @click="jumpProductDetail(item)">
  62. <div class="vip-item-img">
  63. <img class="img default-img" :src="item.image">
  64. </div>
  65. <div class="vip-item-info">
  66. <h3 class="name">
  67. {{item.productName}}
  68. </h3>
  69. <div class="stock">
  70. 还剩{{item.stockNumber}}
  71. </div>
  72. <div class="original-price">
  73. ¥ {{item.originalPrice}}
  74. </div>
  75. <div class="price-warp">
  76. <div class="flag">
  77. <!-- #ifdef MP-WEIXIN -->
  78. <img src="../../../static/images/vip/flag-vip.png" alt="会员价" class="flagImg"/>
  79. <!-- #endif -->
  80. <!-- #ifdef H5 || APP-PLUS -->
  81. <image class="flagImg" src="../../../static/images/vip/flag-vip.png" alt="会员专区" mode="widthFix"/>
  82. <!-- #endif -->
  83. </div>
  84. <div class="price">
  85. ¥ {{item.price}}
  86. </div>
  87. </div>
  88. <div class="btn-buy">
  89. <span>去购买</span>
  90. <div class="progress">
  91. <i></i>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <!-- <div class="pagination vip-pagination"></div>-->
  99. </div>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. import {commonMixin} from '../mixin'
  105. export default {
  106. mixins: [commonMixin],
  107. data () {
  108. return {
  109. swiperCurrent: 0,
  110. }
  111. },
  112. computed: {
  113. listTemp: function () {
  114. var list = this.productData;
  115. var arrTemp = [];
  116. var index = -1;
  117. var count = 2; // 每组多少条
  118. for (var i = 0; i < list.length; i++) {
  119. if (i % count==0) {
  120. arrTemp.push([]);
  121. index ++
  122. }
  123. arrTemp[index].push(list[i]);
  124. }
  125. return arrTemp;
  126. }
  127. },
  128. methods:{
  129. swiperChange(e) {
  130. this.swiperCurrent = e.detail.current;
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .vip{
  137. &-card{
  138. background: #333333;
  139. padding: 0 20upx 20upx;
  140. position: relative;
  141. }
  142. &-title{
  143. padding: 42upx 0 28upx 30upx;
  144. position: relative;
  145. .title-img{
  146. display: block;
  147. width: 197upx;
  148. }
  149. .btn-more{
  150. position: absolute;
  151. right: 8upx;
  152. top: 40upx;
  153. line-height: 33upx;
  154. padding-right: 25upx;
  155. font-size: 24upx;
  156. color: #FFEBC4;
  157. .iconfont{
  158. content: '';
  159. font-size: 26upx;
  160. position: absolute;
  161. right: 0;
  162. top: 0;
  163. }
  164. }
  165. }
  166. &-list{
  167. height: 562upx;
  168. }
  169. &-item{
  170. display: flex;
  171. background-color: #fff;
  172. margin-top: 20upx;
  173. &:first-child{
  174. margin-top: 0upx;
  175. }
  176. &-img{
  177. width: 260upx;
  178. height: 260upx;
  179. margin-right: 20upx;
  180. background-color: #ececec;
  181. .img {
  182. width: 100%;
  183. height: 100%;
  184. object-fit: contain;
  185. display: block;
  186. }
  187. }
  188. &-info{
  189. flex: 1;
  190. position: relative;
  191. .name{
  192. font-size: 28upx;
  193. //height: 75rpx;
  194. line-height: 40upx;
  195. color: #333333;
  196. margin: 30upx 0 10upx;
  197. overflow:hidden;
  198. text-overflow:ellipsis;
  199. display:-webkit-box;
  200. -webkit-box-orient:vertical;
  201. -webkit-line-clamp:1;
  202. }
  203. // #ifdef H5 || APP-PLUS
  204. .name{
  205. height: 40rpx;
  206. }
  207. // #endif
  208. .stock{
  209. color: #C5AA7B;
  210. font-size: 20upx;
  211. border: 2upx solid #E4E5E6;
  212. line-height: 40upx;
  213. padding: 0 5upx;
  214. display: inline-block;
  215. margin-bottom: 30upx;
  216. }
  217. .original-price{
  218. font-size: 24upx;
  219. line-height: 34upx;
  220. color: #CCCCCC;
  221. text-decoration: line-through;
  222. }
  223. .flag{
  224. float: left;
  225. padding: 12upx 10upx 0 0;
  226. .flagImg {
  227. width: 58upx;
  228. height: 36upx;
  229. display: block;
  230. }
  231. }
  232. .price{
  233. font-size: 40upx;
  234. font-weight: bold;
  235. line-height: 56upx;
  236. color: #C83732;
  237. }
  238. .btn-buy{
  239. position: absolute;
  240. right: 20upx;
  241. bottom: 20upx;
  242. width: 160upx;
  243. height: 84upx;
  244. background: linear-gradient(90deg, #C83732 0%, #E25C44 100%);
  245. box-shadow: 0px 6upx 12upx rgba(233, 0, 0, 0.3);
  246. border-radius: 10upx;
  247. text-align: center;
  248. padding: 16upx 20upx 0;
  249. span{
  250. font-size: 24upx;
  251. line-height: 34upx;
  252. color: #FFFFFF;
  253. margin-bottom: 10upx;
  254. display: block;
  255. }
  256. .progress{
  257. height: 8upx;
  258. background: rgba(255,255,255,0.5);
  259. border-radius: 4upx;
  260. position: relative;
  261. i{
  262. position: absolute;
  263. left: 0;
  264. top: 0;
  265. width: 50%;
  266. height: 8upx;
  267. background-color: #fff;
  268. border-radius: 4upx;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. .vip-item-info {
  275. .price-warp {
  276. display: flex;
  277. align-items: center;
  278. }
  279. }
  280. .swiper-dots {
  281. display: flex;
  282. position: absolute;
  283. left: 50%;
  284. transform: translateX(-50%);
  285. bottom: 15upx;
  286. z-index: 66;
  287. .dot {
  288. width: 24upx;
  289. height: 4upx;
  290. background: #fff;
  291. opacity: 0.5;
  292. border-radius: 2upx;
  293. margin: 0 10upx;
  294. }
  295. .dot-active {
  296. opacity: 1;
  297. }
  298. }
  299. //.pagination{
  300. // display: flex;
  301. // justify-content: center;
  302. // padding-top:20upx;
  303. // ::v-deep .swiper-pagination-bullet{
  304. // width: 24upx;
  305. // height: 4upx;
  306. // background: #fff;
  307. // opacity: 0.5;
  308. // border-radius: 2upx;
  309. // margin: 0 5upx;
  310. // }
  311. // ::v-deep .swiper-pagination-bullet-active{
  312. // opacity: 1;
  313. // }
  314. //}
  315. }
  316. </style>