buy-book-item.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="book-item">
  3. <view class="book-info">
  4. <view class="book-image-container">
  5. <image class="book-cover" :src="book.cover" mode="aspectFill" />
  6. </view>
  7. <view class="book-detail">
  8. <view class="top-info">
  9. <view class="book-title">{{ book.bookName }}</view>
  10. <view class="upsell-info" v-if="book.reducePrice > 0">
  11. <text class="has-upsell">已降 ¥{{ book.reducePrice }}</text>
  12. </view>
  13. </view>
  14. <!-- <view class="flex flex-j-b flex-a-c">
  15. <view class="book-quality">品相:{{ book.conditionName || '中等' }}</view>
  16. </view> -->
  17. <view class="flex flex-j-b flex-a-c mt-10">
  18. <view class="book-price">
  19. <text class="price">¥{{ book.price }}</text>
  20. <text class="original-price ml-10" v-if="book.originalPrice">¥{{ book.originalPrice }}</text>
  21. </view>
  22. <view class="book-num">× {{ book.quantity }}</view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. book: {
  32. type: Object,
  33. required: true
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. .book-item {
  40. padding: 24rpx;
  41. border-bottom: 1rpx solid #f5f5f5;
  42. .book-info {
  43. display: flex;
  44. .book-image-container {
  45. .book-cover {
  46. width: 154rpx;
  47. height: 196rpx;
  48. border-radius: 8rpx;
  49. background-color: #eee;
  50. }
  51. }
  52. .book-detail {
  53. flex: 1;
  54. margin-left: 20rpx;
  55. display: flex;
  56. flex-direction: column;
  57. justify-content: space-between;
  58. .book-title {
  59. font-size: 28rpx;
  60. color: #333;
  61. line-height: 1.4;
  62. margin-bottom: 10rpx;
  63. display: -webkit-box;
  64. -webkit-box-orient: vertical;
  65. -webkit-line-clamp: 2;
  66. overflow: hidden;
  67. }
  68. .upsell-info {
  69. margin-bottom: 10rpx;
  70. .has-upsell {
  71. font-size: 24rpx;
  72. color: #38C148;
  73. background-color: #e9f6eb;
  74. padding: 4rpx 10rpx;
  75. border-radius: 4rpx;
  76. }
  77. .can-upsell {
  78. font-size: 24rpx;
  79. color: #38C148;
  80. background-color: #e9f6eb;
  81. padding: 4rpx 10rpx;
  82. border-radius: 4rpx;
  83. }
  84. }
  85. .book-quality {
  86. font-size: 24rpx;
  87. color: #999;
  88. }
  89. .book-price {
  90. .price {
  91. font-size: 32rpx;
  92. color: #ff4500;
  93. font-weight: bold;
  94. }
  95. .original-price {
  96. font-size: 24rpx;
  97. color: #999;
  98. text-decoration: line-through;
  99. }
  100. }
  101. .book-num {
  102. font-size: 28rpx;
  103. color: #333;
  104. }
  105. }
  106. }
  107. }
  108. </style>