style2.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template id="group-goods-style2">
  2. <div class="group-goods-style" :style="{background: bgColor}">
  3. <div :style="[groupBox]">
  4. <div class="group-goods-title" :style="[titleStyle]" v-if="showTitle">{{ title || '商品拼团' }}</div>
  5. <div class="group-goods-box" :style="[goodsStyle]" v-for="(it, i) in goodsList" :key="i">
  6. <div flex>
  7. <el-image style="width: 106px; height: 106px; border-radius: 8px;" :src="it.cover_pic"></el-image>
  8. <div class="group-content" flex="dir:top main:justify">
  9. <div class="goods-name over2">{{ it.goods_name }}</div>
  10. <div>
  11. <div class="goods-time" flex>
  12. <div>活动时间:</div>
  13. <div style="flex: 1;">{{ it.start_at | dateTimeFormat('Y-m-d H:i:s') }} - {{ it.end_at | dateTimeFormat('Y-m-d H:i:s') }}</div>
  14. </div>
  15. <div class="goods-origin">¥{{ it.price }}</div>
  16. <div class="goods-price" flex>
  17. <span>¥{{ it.group_buy_price }}</span>
  18. <div class="price-save">节省了¥{{ it.sheng }}</div>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="goods-buy-card" flex="cross:center">
  24. <div class="goods-buy-img">
  25. <el-image style="width: 100%; height: 100%;" :src="imgUrl + 'buy_packagesl.png'"></el-image>
  26. </div>
  27. <div class="goods-buy-desc">
  28. <span class="text-color">{{it.group_size}}人</span>拼团,已团<span class="text-color">{{ it.total_num }}件</span>
  29. </div>
  30. <div class="goods-buy-btn" flex="cross:center main:center">
  31. <div class="btn-text">立即参团</div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. /**
  40. * @descriptions
  41. * 1. 组件名字必须对应模板形式 - 递归组件name
  42. * 2. 样式内容方法尽量内部维护 - 前端方便通用
  43. * 3. 父级组件会传预览数据 - activeItem
  44. */
  45. Vue.component('group-goods-style2', {
  46. name: "group-goods-style2",
  47. props: {
  48. activeItem: {
  49. type: Object,
  50. default () {
  51. return {}
  52. }
  53. },
  54. goodsList: {
  55. type: Array,
  56. default: () => []
  57. },
  58. showTitle: { // 是否展示标题
  59. type: Number,
  60. default: 0
  61. },
  62. title: { // 标题
  63. type: String,
  64. default: ''
  65. },
  66. titleStyle: { // 标题的样式
  67. type: Object,
  68. default: () => {}
  69. },
  70. groupBox: { // 最外层样式
  71. type: Object,
  72. default: () => {}
  73. },
  74. goodsStyle: { // 商品的样式
  75. type: Object,
  76. default: () => {}
  77. },
  78. btnStyle: { // 按钮的样式
  79. type: Object,
  80. default: () => {}
  81. },
  82. bgColor: {
  83. type: String,
  84. default: ''
  85. }
  86. },
  87. template: '#group-goods-style2',
  88. data() {
  89. return {
  90. imgUrl: '/resources/img/decorate/group-goods/'
  91. }
  92. }
  93. });
  94. </script>
  95. <style>
  96. .group-goods-style {
  97. position: relative;
  98. overflow: hidden;
  99. }
  100. .group-goods-box {
  101. position: relative;
  102. background-color: #fff;
  103. border-radius: 8px;
  104. overflow: hidden;
  105. padding: 10px;
  106. }
  107. .group-content {
  108. flex: 1;
  109. padding-left: 8px;
  110. }
  111. .goods-time {
  112. color: #6D6A6A;
  113. font-size: 11px;
  114. padding: 6px 0;
  115. }
  116. .goods-origin {
  117. font-size: 11px;
  118. color: #707070;
  119. }
  120. .goods-price {
  121. padding-top: 2px;
  122. font-size: 16px;
  123. color: #DB0505;
  124. }
  125. .price-save {
  126. background: rgba(219, 5, 5, 0.08);
  127. border-radius: 20px;
  128. padding: 3px 8px;
  129. color: #DB0505;
  130. font-size: 11px;
  131. margin-left: 10px;
  132. }
  133. .price-origin {
  134. font-size: 11px;
  135. color: #707070;
  136. }
  137. .goods-buy-card {
  138. width: 100%;
  139. height: 52px;
  140. background-color: rgba(219, 5, 5, 0.08);
  141. border-radius: 8px;
  142. margin-top: 12px;
  143. }
  144. .goods-buy-img {
  145. width: 36px;
  146. height: 36px;
  147. margin-left: 8px;
  148. }
  149. .goods-buy-desc {
  150. font-size: 13px;
  151. padding-left: 5px;
  152. flex: 1;
  153. }
  154. .text-color {
  155. color: #DB0505;
  156. }
  157. .goods-buy-btn {
  158. width: 112px;
  159. height: 52px;
  160. background: url('/resources/img/decorate/group-goods/buy_btn.png') no-repeat;
  161. background-size: 100% 100%;
  162. color: #fff;
  163. }
  164. .btn-text {
  165. padding-left: 10px;
  166. }
  167. </style>