buy-book-item.vue 3.6 KB

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