style2.php 5.4 KB

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