product-item.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="product-item-container">
  3. <view class="is-collect"></view>
  4. <image :src="product.cover" class="w-328rpx" mode="widthFix"></image>
  5. <view class="product-name">{{ product.name }}</view>
  6. <view class="sell-rate">
  7. <view v-format="'number'" class="rate">
  8. {{ product.rate }}
  9. <image src="@/static/images/rate.svg" class="w-28rpx ml-8rpx" mode="widthFix"></image>
  10. </view>
  11. <view class="sold">{{ product.sold }} Sold</view>
  12. </view>
  13. <view class="price-cart">
  14. <view class="price">USD {{ product.price }}</view>
  15. <view class="cart">
  16. <image src="@/static/images/cart.svg" class="w-32rpx" mode="widthFix"></image>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script lang="ts" setup>
  22. import { ProductSimpleType } from '@/types/product-type'
  23. defineOptions({
  24. name: 'ProductItem',
  25. })
  26. const { product } = defineProps<{ product: ProductSimpleType }>()
  27. </script>
  28. <style lang="scss" scoped>
  29. .product-item-container {
  30. position: relative;
  31. width: 328rpx;
  32. margin-bottom: 26rpx;
  33. &:nth-last-child(1),
  34. &:nth-last-child(2) {
  35. margin-bottom: 0;
  36. }
  37. .is-collect {
  38. position: absolute;
  39. display: flex;
  40. align-items: center;
  41. justify-content: center;
  42. width: 64rpx;
  43. height: 64rpx;
  44. background-color: $shop-white;
  45. }
  46. .product-name {
  47. height: 30rpx;
  48. margin-top: 16rpx;
  49. overflow: hidden;
  50. font-family: 'PingFang SC';
  51. font-size: 28rpx;
  52. font-style: normal;
  53. font-weight: 600;
  54. line-height: 30rpx;
  55. color: $shop-text-3;
  56. white-space: nowrap;
  57. }
  58. .sell-rate {
  59. display: flex;
  60. align-items: center;
  61. margin-top: 16rpx;
  62. font-family: 'PingFang SC';
  63. font-size: 24rpx;
  64. font-style: normal;
  65. font-weight: 400;
  66. line-height: 28rpx;
  67. color: $shop-text-9;
  68. .rate {
  69. display: flex;
  70. margin-right: 16rpx;
  71. }
  72. .sold {
  73. box-sizing: border-box;
  74. padding-left: 16rpx;
  75. border-left: 2rpx solid $shop-bg-line;
  76. }
  77. }
  78. .price-cart {
  79. display: flex;
  80. align-items: center;
  81. justify-content: space-between;
  82. font-family: 'PingFang SC';
  83. font-size: 28rpx;
  84. font-style: normal;
  85. font-weight: 600;
  86. line-height: 48rpx; /* 157.143% */
  87. color: $shop-primary;
  88. .cart {
  89. display: flex;
  90. align-items: center;
  91. justify-content: center;
  92. width: 48rpx;
  93. height: 48rpx;
  94. background-color: $shop-primary;
  95. border-radius: 50%;
  96. }
  97. }
  98. }
  99. </style>