index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view class="hot-item">
  3. <!-- Rank -->
  4. <view class="rank-col">
  5. <image v-if="rank === 1" src="/pages-sell/static/hot/icon-first.png" class="rank-icon" mode="widthFix"></image>
  6. <image v-else-if="rank === 2" src="/pages-sell/static/hot/icon-second.png" class="rank-icon" mode="widthFix"></image>
  7. <image v-else-if="rank === 3" src="/pages-sell/static/hot/icon-third.png" class="rank-icon" mode="widthFix"></image>
  8. <text v-else class="rank-text">{{ rank < 10 ? '0' + rank : rank }}</text>
  9. </view>
  10. <!-- Book Info -->
  11. <view class="book-info">
  12. <image :src="item.cover" class="book-cover" mode="aspectFill"></image>
  13. <view class="info-right">
  14. <text class="title">{{ item.title }}</text>
  15. <text class="author">{{ item.author }}</text>
  16. <view class="bottom-row">
  17. <view class="price-box">
  18. <text class="currency">¥</text>
  19. <text class="price">{{ item.price }}</text>
  20. <text class="original">¥{{ item.originalPrice }}</text>
  21. </view>
  22. <view class="cart-btn">
  23. <text>加入购物车</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. name: 'HotSellItem',
  33. props: {
  34. rank: {
  35. type: Number,
  36. required: true
  37. },
  38. item: {
  39. type: Object,
  40. required: true
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. .hot-item {
  47. display: flex;
  48. align-items: center;
  49. padding: 30rpx 0;
  50. border-bottom: 1rpx solid #f6f7f8;
  51. .rank-col {
  52. width: 80rpx;
  53. display: flex;
  54. justify-content: center;
  55. margin-right: 10rpx;
  56. .rank-icon {
  57. width: 60rpx;
  58. height: 60rpx;
  59. }
  60. .rank-text {
  61. font-family: Arial-BoldItalicMT;
  62. font-size: 36rpx;
  63. color: #706F6D;
  64. font-style: italic;
  65. font-weight: bold;
  66. }
  67. }
  68. .book-info {
  69. flex: 1;
  70. display: flex;
  71. align-items: center;
  72. .book-cover {
  73. width: 140rpx;
  74. height: 180rpx;
  75. border-radius: 4rpx;
  76. background-color: #f5f5f5;
  77. margin-right: 24rpx;
  78. flex-shrink: 0;
  79. }
  80. .info-right {
  81. flex: 1;
  82. height: 190rpx;
  83. display: flex;
  84. flex-direction: column;
  85. justify-content: space-between;
  86. padding: 10rpx 0;
  87. .title {
  88. font-size: 36rpx;
  89. color: #303030;
  90. font-weight: bold;
  91. line-height: 1.2;
  92. overflow: hidden;
  93. text-overflow: ellipsis;
  94. display: -webkit-box;
  95. -webkit-line-clamp: 2;
  96. -webkit-box-orient: vertical;
  97. }
  98. .author {
  99. font-size: 24rpx;
  100. color: #999999;
  101. }
  102. .bottom-row {
  103. display: flex;
  104. justify-content: space-between;
  105. align-items: flex-end;
  106. .price-box {
  107. display: flex;
  108. align-items: baseline;
  109. .currency {
  110. font-size: 36rpx;
  111. color: #D81A00;
  112. font-weight: bold;
  113. margin-right: 6rpx;
  114. }
  115. .price {
  116. font-size: 36rpx;
  117. color: #D81A00;
  118. font-weight: bold;
  119. margin-right: 12rpx;
  120. }
  121. .original {
  122. font-size: 24rpx;
  123. color: #999999;
  124. text-decoration: line-through;
  125. }
  126. }
  127. .cart-btn {
  128. width: 160rpx;
  129. height: 56rpx;
  130. background: linear-gradient(90deg, #4ED964 0%, #38C248 100%);
  131. border-radius: 28rpx;
  132. display: flex;
  133. align-items: center;
  134. justify-content: center;
  135. text {
  136. font-size: 24rpx;
  137. color: #fff;
  138. font-weight: 500;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. </style>