style1.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template id="happiness-store-goods-style1">
  2. <div class="happiness-store-goods-style" :style="{background: bgColor}">
  3. <div :style="[groupBox]">
  4. <div class="happiness-goods-title" :style="[titleStyle]" v-if="showTitle">{{ title || '为您推荐' }}</div>
  5. <div class="happiness-store-goods-list" flex="main:justify wrap:wrap">
  6. <div class="happiness-goods-column" v-for="(it, i) in goodsList" :key="i" :style="[goodsStyle]">
  7. <div class="column-imgs">
  8. <el-image style="width: 100%;height: 171px;" class="goods-image" :src="it.cover_pic"></el-image>
  9. </div>
  10. <div class="goods-content">
  11. <div class="goods-name over2">{{ it.goods_name }}</div>
  12. <div class="goods-tags-item" flex="cross:center">
  13. <div class="goods-save">下单可获得¥{{ it.sheng }}养老金</div>
  14. </div>
  15. <div class="goods-price">¥{{ it.group_buy_price }}</div>
  16. </div>
  17. <div class="goods-btn" :style="[btnStyle]">+</div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. /**
  25. * @descriptions
  26. * 1. 组件名字必须对应模板形式 - 递归组件name
  27. * 2. 样式内容方法尽量内部维护 - 前端方便通用
  28. * 3. 父级组件会传预览数据 - activeItem
  29. */
  30. Vue.component('happiness-store-goods-style1', {
  31. name: "happiness-store-goods-style1",
  32. props: {
  33. activeItem: {
  34. type: Object,
  35. default () {
  36. return {}
  37. }
  38. },
  39. goodsList: {
  40. type: Array,
  41. default: () => []
  42. },
  43. showTitle: { // 是否展示标题
  44. type: Number,
  45. default: 0
  46. },
  47. title: { // 标题
  48. type: String,
  49. default: ''
  50. },
  51. titleStyle: { // 标题的样式
  52. type: Object,
  53. default: () => {}
  54. },
  55. groupBox: { // 最外层样式
  56. type: Object,
  57. default: () => {}
  58. },
  59. goodsStyle: { // 商品的样式
  60. type: Object,
  61. default: () => {}
  62. },
  63. btnStyle: { // 按钮的样式
  64. type: Object,
  65. default: () => {}
  66. },
  67. bgColor: {
  68. type: String,
  69. default: ''
  70. }
  71. },
  72. template: '#happiness-store-goods-style1',
  73. data() {
  74. return {
  75. imgUrl: '/resources/img/decorate/happiness/',
  76. defaultImg: '/resources/img/decorate/default_picture.png'
  77. }
  78. },
  79. });
  80. </script>
  81. <style>
  82. .happiness-store-goods-style {
  83. position: relative;
  84. overflow: hidden;
  85. }
  86. .happiness-store-goods-list {
  87. margin-left: 10px;
  88. margin-right: 10px;
  89. background-color: transparent;
  90. }
  91. .happiness-goods-column {
  92. position: relative;
  93. width: calc((100% - 8px) / 2);
  94. margin-bottom: 8px;
  95. border-radius: 8px;
  96. overflow: hidden;
  97. background-color: #fff;
  98. }
  99. .column-imgs {
  100. position: relative;
  101. width: 100%;
  102. height: 171px;
  103. border-radius: 0 0 8px 8px;
  104. overflow: hidden;
  105. }
  106. .happiness-store-goods-list .goods-time {
  107. position: absolute;
  108. bottom: 0;
  109. left: 0;
  110. background-color: rgba(12, 12, 12, 0.4);
  111. color: #fff;
  112. font-size: 11px;
  113. padding: 8px 12px;
  114. }
  115. .happiness-store-goods-list .goods-content {
  116. padding: 8px;
  117. }
  118. .happiness-store-goods-list .goods-name {
  119. font-size: 13px;
  120. color: #0C0C0C;
  121. padding-top: 6px;
  122. min-height: 40px;
  123. }
  124. .happiness-store-goods-list .goods-tags-item {
  125. font-size: 10px;
  126. padding-top: 4px;
  127. }
  128. .happiness-store-goods-list .goods-people {
  129. min-width: 50px;
  130. padding: 2px 0;
  131. text-align: center;
  132. /* padding: 2px 8px; */
  133. color: #F69E19;
  134. border-radius: 16px;
  135. }
  136. .happiness-store-goods-list .goods-save {
  137. color: #DB0505;
  138. border-radius: 5px;
  139. overflow: hidden;
  140. padding: 2px 8px;
  141. white-space: nowrap;
  142. border:1px solid #DB0505;
  143. }
  144. .happiness-store-goods-list .goods-origin {
  145. font-size: 11px;
  146. color: #707070;
  147. padding-top: 12px;
  148. }
  149. .happiness-store-goods-list .goods-price {
  150. color: #DB0505;
  151. font-size: 16px;
  152. margin-top: 10px;
  153. }
  154. .happiness-store-goods-list .goods-btn {
  155. position: absolute;
  156. bottom: 5px;
  157. right: 12px;
  158. width: 25px;
  159. height: 25px;
  160. background: linear-gradient(32deg, #DB0505 0%, #EF5E1E 100%);
  161. border-radius:50px;
  162. text-align: center;
  163. line-height: 25px;
  164. color: #FEF8F8;
  165. font-size: 12px;
  166. }
  167. </style>