product-item.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view :class="type==='swiper'?'product-swiper-item':'product-list-item'" class="product-item" @tap="openDetails">
  3. <image class="image" :src="image" mode="scaleToFill"></image>
  4. <view class="row row-1">
  5. <text class="title"><text class="sxzg-icon">省心直供</text>{{title}}</text>
  6. </view>
  7. <view class="row row-2">
  8. <text class="org-price">¥{{orgPrice}}</text>
  9. <text class="sales">月销15.8万</text>
  10. </view>
  11. <view class="row row-3">
  12. <text class="sxj-icon">省心价</text>
  13. <text class="price">¥{{price}}</text>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. };
  22. },
  23. props: {
  24. id: {
  25. type: [String, Number],
  26. default: 0
  27. },
  28. title: {
  29. type: String,
  30. default: "【工厂直营】加厚款手提垃圾袋加厚款手提垃圾袋加厚款手提垃圾袋加厚款手提垃圾袋*50支"
  31. },
  32. image: {
  33. type: String,
  34. default: ""
  35. },
  36. type: {
  37. type: String,
  38. default: "list"
  39. },
  40. sales: {
  41. type: [String, Number],
  42. default: 0
  43. },
  44. orgPrice: {
  45. type: [String, Number],
  46. default: 0
  47. },
  48. price: {
  49. type: [String, Number],
  50. default: 0
  51. }
  52. },
  53. methods: {
  54. openDetails() {
  55. uni.navigateTo({
  56. url: "/pages/product/product-details?id=" + this.id
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. .product-item {
  64. overflow: hidden;
  65. border-radius: 18rpx;
  66. background: white;
  67. box-shadow: 0 0 10rpx #EEEEEE;
  68. padding-bottom: 10upx;
  69. display: inline-block;
  70. }
  71. .product-list-item {
  72. width: 350rpx;
  73. .image {
  74. width: 350rpx;
  75. height: 300rpx;
  76. }
  77. }
  78. .product-swiper-item {
  79. width: 288rpx;
  80. // height: 268rpx;
  81. .image {
  82. width: 288rpx;
  83. height: 288rpx;
  84. }
  85. }
  86. .sxzg-icon {
  87. color: $primary-color;
  88. font-size: 16rpx;
  89. width: 80rpx;
  90. text-align: center;
  91. line-height: normal;
  92. border: 2rpx solid $primary-color;
  93. border-radius: 20rpx;
  94. display: inline-block;
  95. position: relative;
  96. top: -4rpx;
  97. margin-right: 10upx;
  98. // transform: scale(0.9);
  99. }
  100. .title {
  101. font-size: 24rpx;
  102. display: inline-block;
  103. white-space: normal;
  104. display: -webkit-box;
  105. -webkit-box-orient: vertical;
  106. -webkit-line-clamp: 2;
  107. overflow: hidden;
  108. height: 68upx;
  109. }
  110. .row {
  111. padding: 0 10upx;
  112. }
  113. .row-2 {
  114. display: flex;
  115. justify-content: space-between;
  116. }
  117. .org-price,
  118. .sales {
  119. font-size: 22rpx;
  120. color: #cccccc;
  121. }
  122. .org-price {
  123. text-decoration: line-through;
  124. }
  125. .sxj-icon {
  126. background: $primary-color;
  127. color: white;
  128. font-size: 20upx;
  129. padding: 0 5upx;
  130. border-radius: 5upx;
  131. vertical-align: middle;
  132. }
  133. .price {
  134. font-size: 24rpx;
  135. color: $primary-color;
  136. font-weight: bold;
  137. }
  138. </style>