style1.php 4.9 KB

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