style3.php 5.2 KB

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