cm-floor-template.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="floor-template">
  3. <cm-floor-title title="楼层名称"></cm-floor-title>
  4. <!-- banner区域 -->
  5. <view class="floor-banner-area" :class="'template-' + 7">
  6. <view
  7. class="banner-item"
  8. :class="'banner-item-' + (index + 1)"
  9. v-for="(item, index) in bannerList"
  10. :key="index"
  11. >
  12. <image :src="item.image" class="banner"></image>
  13. </view>
  14. </view>
  15. <!-- 商品区域 -->
  16. <view class="floor-product-area">
  17. <!-- <view class="product-list default-list">
  18. <view class="product-item" v-for="(item, index) in productList" :key="index">
  19. <cm-product :data="item"></cm-product>
  20. </view>
  21. </view> -->
  22. <view class="simple-swiper">
  23. <cm-simple-swiper
  24. @change="onChange"
  25. :current="current"
  26. :circular="true"
  27. :swiperHeight="940"
  28. :data="productList"
  29. :columns="3"
  30. :rows="2"
  31. :gapX="16"
  32. :gapY="16"
  33. padding="0 8rpx"
  34. :autoplay="false"
  35. >
  36. <template v-slot:slide="{ row }">
  37. <div class="product-list">
  38. <view class="product-item"><cm-product :data="row"></cm-product></view>
  39. </div>
  40. </template>
  41. </cm-simple-swiper>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. props: {
  49. floorData: {
  50. type: Object,
  51. default: () => {}
  52. }
  53. },
  54. data() {
  55. return {
  56. // banner区域
  57. templateType: 1,
  58. bannerList: [
  59. {
  60. image: ''
  61. },
  62. {
  63. image: ''
  64. },
  65. {
  66. image: ''
  67. },
  68. {
  69. image: ''
  70. },
  71. {
  72. image: ''
  73. }
  74. ],
  75. // 商品区域
  76. current: 0,
  77. product: {
  78. activeStatus: 0,
  79. clubTaxPoint: 10,
  80. collageProduct: null,
  81. collageStatus: 0,
  82. couponsLogo: true,
  83. includedTax: '1',
  84. invoiceType: '2',
  85. mainImage: 'https://img-b.caimei365.com/group1/M00/03/20/Cmgy62BHH8aAFiGIAAGHr5DovGA124.jpg',
  86. name: '【测试用】Dermaheal HSR 德玛莉肌活丝蕴凝颜精华液',
  87. normalPrice: null,
  88. price: 2,
  89. productId: 6419,
  90. recommend: '0',
  91. unit: '片'
  92. }
  93. }
  94. },
  95. computed: {
  96. productList() {
  97. let list = []
  98. for (let i = 0; i < 10; i++) {
  99. list.push(this.product)
  100. }
  101. return list
  102. }
  103. },
  104. methods: {
  105. onChange(e) {
  106. console.log(e)
  107. this.current = e.current
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .floor-template {
  114. background-color: #f7f7f7;
  115. }
  116. // 轮播图尺寸
  117. .size-type-1 {
  118. width: 702rpx;
  119. height: 240rpx;
  120. }
  121. .size-type-2 {
  122. width: 343rpx;
  123. height: 524rpx;
  124. }
  125. .size-type-3 {
  126. width: 343rpx;
  127. height: 254rpx;
  128. }
  129. // banner 区域
  130. .floor-banner-area {
  131. padding: 0 16rpx;
  132. &::after {
  133. display: block;
  134. content: '';
  135. clear: both;
  136. }
  137. .banner-item {
  138. float: left;
  139. padding: 8rpx;
  140. .banner {
  141. width: 100%;
  142. height: 100%;
  143. display: block;
  144. background: pink;
  145. border-radius: 16rpx;
  146. }
  147. }
  148. &.template-1 {
  149. .banner-item-1 {
  150. @extend .size-type-1;
  151. }
  152. }
  153. &.template-2 {
  154. .banner-item-1 {
  155. @extend .size-type-1;
  156. }
  157. .banner-item-2 {
  158. @extend .size-type-2;
  159. }
  160. .banner-item-3 {
  161. @extend .size-type-2;
  162. }
  163. }
  164. &.template-3 {
  165. .banner-item-1 {
  166. @extend .size-type-2;
  167. }
  168. .banner-item-2 {
  169. @extend .size-type-2;
  170. }
  171. }
  172. &.template-4 {
  173. }
  174. &.template-5 {
  175. }
  176. &.template-6 {
  177. .banner-item-1 {
  178. @extend .size-type-2;
  179. }
  180. .banner-item-2 {
  181. @extend .size-type-3;
  182. }
  183. .banner-item-3 {
  184. @extend .size-type-3;
  185. }
  186. }
  187. &.template-7 {
  188. .banner-item-1 {
  189. @extend .size-type-2;
  190. }
  191. .banner-item-2 {
  192. @extend .size-type-3;
  193. }
  194. .banner-item-3 {
  195. @extend .size-type-3;
  196. }
  197. .banner-item-4 {
  198. @extend .size-type-3;
  199. }
  200. .banner-item-5 {
  201. @extend .size-type-3;
  202. }
  203. }
  204. &.template-8 {
  205. .banner-item-1 {
  206. @extend .size-type-1;
  207. }
  208. }
  209. &.template-9 {
  210. }
  211. }
  212. // 商品区域样式
  213. .floor-product-area {
  214. padding: 0 16rpx;
  215. .product-list {
  216. @extend .cm-flex-between;
  217. flex-wrap: wrap;
  218. padding: 0 8rpx;
  219. .product-item {
  220. padding: 8rpx 0;
  221. }
  222. }
  223. .simple-swiper {
  224. padding-top: 8rpx;
  225. }
  226. }
  227. </style>