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

321 lines
8.9 KiB

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