index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="component-wrapper u000242" :style="wrapper_style">
  3. <view class="seckill_top">
  4. <view class="seckill_top_left">
  5. <u-icon name="bag-fill" size="28"></u-icon>
  6. <view class="expenditures">爆款秒杀</view>
  7. <view>一件也是批发价</view>
  8. </view>
  9. <view class="more">
  10. 查看更多
  11. <u-icon name="arrow-right" size="18"></u-icon>
  12. </view>
  13. </view>
  14. <view class="seckill_bottom">
  15. <view class="item" v-for="item in list" :key="item.id">
  16. <image class="img" :src="emptyImage||item.img"></image>
  17. <view class="remaining">
  18. <view>仅剩</view>
  19. <view>{{item.remaining}}</view>
  20. </view>
  21. <view class="info">
  22. <view class="public_info">{{item.name}}</view>
  23. <view class="info_a">
  24. <view>省</view>
  25. <view>立省{{item.originalprice-item.price}}元</view>
  26. </view>
  27. <view class="price2">
  28. <view class="price">
  29. <view :style="price_style">¥{{item.price}}</view>
  30. <view>¥{{item.originalprice}}</view>
  31. </view>
  32. <view class="buybtn" :style="btn_style">
  33. 去抢购
  34. <u-icon :color="datas.text_color" name="arrow-right" size="17"></u-icon>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. props: ['styles', 'datas'],
  45. data() {
  46. let siteinfo = getApp().globalData.siteinfo;
  47. return {
  48. settingFile: siteinfo,
  49. emptyImage: siteinfo.root_img + '/static/app/image.png',
  50. }
  51. },
  52. computed: {
  53. /** 样式 */
  54. wrapper_style() {
  55. const {
  56. bg_color,
  57. padding_top,
  58. padding_bottom,
  59. padding_left,
  60. padding_right,
  61. } = this.datas;
  62. return `
  63. min-height: 40px;
  64. padding: ${padding_top}px ${padding_right}px ${padding_bottom}px ${padding_left}px;
  65. background-color: ${bg_color};
  66. background-size: 100% auto;
  67. bakcground-position: center;
  68. `;
  69. },
  70. list() {
  71. let list = this.datas.list || [];
  72. return list
  73. },
  74. //价格颜色
  75. price_style() {
  76. const { price_color } = this.datas
  77. return `
  78. color:${price_color};
  79. font-size:20px;
  80. font-weight:500;
  81. margin-right:5px;
  82. `;
  83. },
  84. //按钮及文字颜色
  85. btn_style() {
  86. const { button_color, text_color } = this.datas
  87. return `
  88. width: 80px;
  89. background-color: ${button_color};
  90. text-align: center;
  91. color:${text_color};
  92. border-radius: 90px;
  93. line-height:30px;
  94. `;
  95. },
  96. },
  97. mounted() {
  98. this.$emit('loaded');
  99. }
  100. };
  101. </script>
  102. <style lang="less" scoped>
  103. .component-wrapper {
  104. display: block;
  105. max-width: 100%;
  106. // text-align: center;
  107. margin-left: auto;
  108. margin-right: auto;
  109. overflow: hidden;
  110. text-decoration: none;
  111. align-items: center;
  112. .seckill_top {
  113. display: flex;
  114. justify-content: space-between;
  115. align-items: center;
  116. .seckill_top_left {
  117. display: flex;
  118. align-items: center;
  119. .expenditures {
  120. margin: 0 10px;
  121. font-size: 16px;
  122. font-weight: 600;
  123. }
  124. view:last-child{
  125. font-size: 12px;
  126. }
  127. }
  128. .more {
  129. display: flex;
  130. align-items: center;
  131. }
  132. }
  133. .seckill_bottom {
  134. margin-top: 10px;
  135. padding: 0;
  136. .item {
  137. display: flex;
  138. justify-content: space-between;
  139. align-items: center;
  140. margin-bottom: 10px;
  141. background-color: #fff;
  142. padding: 10px;
  143. border-radius: 10px;
  144. position: relative;
  145. .img {
  146. width: 100px;
  147. height: 100px;
  148. border-radius: 5px;
  149. margin-right: 10px;
  150. }
  151. .remaining {
  152. color: #fff;
  153. width: 45px;
  154. height: 45px;
  155. border-radius: 50%;
  156. position: absolute;
  157. top: 5px;
  158. right: 10px;
  159. background-color: red;
  160. text-align: center;
  161. font-size: 12px;
  162. line-height: 20px;
  163. view:last-child {
  164. font-size: 18px;
  165. line-height: 25px;
  166. }
  167. }
  168. .info {
  169. overflow: hidden;
  170. width: 80%;
  171. .public_info {
  172. width: 70%;
  173. height: 40px;
  174. display: -webkit-box;
  175. -webkit-box-orient: vertical;
  176. -webkit-line-clamp: 2;
  177. overflow: hidden;
  178. font-size: 16px;
  179. font-weight: 600;
  180. line-height: 20px;
  181. }
  182. .info_a {
  183. font-size: 10px;
  184. color: #F26914;
  185. width: 100px;
  186. display: flex;
  187. border-radius: 50px;
  188. border: 1px solid red;
  189. overflow: hidden;
  190. margin: 5px 0;
  191. view:first-child {
  192. width: 25%;
  193. border-right: 1px solid #F26914;
  194. text-align: center;
  195. background-color: #FBD2D2;
  196. }
  197. view:last-child {
  198. width: 75%;
  199. text-align: center;
  200. }
  201. }
  202. .price2 {
  203. display: flex;
  204. align-items: center;
  205. justify-content: space-between;
  206. .price {
  207. line-height: 20px;
  208. display: flex;
  209. view:last-child {
  210. text-decoration: line-through;
  211. color: #999;
  212. }
  213. }
  214. }
  215. .buybtn {
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. }
  220. }
  221. }
  222. }
  223. }
  224. </style>