goodsCard.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="card" @click="$emit('toDetail', itemInfo)">
  3. <image class="goods-img" :src="itemInfo.goods.image" mode=""></image>
  4. <view class="describe">
  5. {{ itemInfo.goods.name_cn }}
  6. </view>
  7. <view class="price-sale">
  8. <view class="price">
  9. <text style="font-size: 20rpx">¥</text>
  10. <text>{{ itemInfo.goods.price.split(".")[0] }}</text
  11. >.
  12. <text style="font-size: 20rpx">{{
  13. itemInfo.goods.price.split(".")[1]
  14. }}</text>
  15. </view>
  16. <view class="sale"> 销量 {{ itemInfo.goods.sale_num }} </view>
  17. </view>
  18. <view class="evaluate">
  19. <view style="margin-right: 12rpx">
  20. {{ itemInfo.goods.comment_num }}评价
  21. </view>
  22. <view> {{ itemInfo.goods.comment_good_rapporto }}%好评 </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. props: {
  29. itemInfo: {
  30. typeof: Object,
  31. default: () => {
  32. return {};
  33. },
  34. },
  35. },
  36. data() {
  37. return {};
  38. },
  39. };
  40. </script>
  41. <style scoped lang="scss">
  42. .card {
  43. width: 324rpx;
  44. margin-bottom: 20rpx;
  45. .goods-img {
  46. width: 324rpx;
  47. height: 324rpx;
  48. border-radius: 16rpx;
  49. }
  50. .describe {
  51. font-size: 28rpx;
  52. color: #333;
  53. font-weight: 600;
  54. width: 100%;
  55. white-space: normal;
  56. overflow: hidden;
  57. text-overflow: ellipsis;
  58. display: -webkit-box;
  59. -webkit-line-clamp: 2;
  60. -webkit-box-orient: vertical;
  61. margin-top: 20rpx;
  62. }
  63. .price-sale {
  64. display: flex;
  65. margin-top: 16rpx;
  66. align-items: flex-end;
  67. .price {
  68. color: #f83224;
  69. font-weight: 600;
  70. }
  71. .sale {
  72. font-size: 20rpx;
  73. color: #333;
  74. opacity: 0.8;
  75. margin-bottom: 4rpx;
  76. margin-left: 10rpx;
  77. }
  78. }
  79. .evaluate {
  80. display: flex;
  81. align-items: center;
  82. font-size: 24rpx;
  83. color: #777;
  84. margin-top: 16rpx;
  85. }
  86. }
  87. </style>