BookItem.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="book-item" :class="{ disabled: book.status != 1 }">
  3. <view class="book-info">
  4. <view class="book-image-container">
  5. <image class="book-cover" :src="book.cover" mode="aspectFill" />
  6. <view class="no-recycle" v-if="book.status != 1">
  7. <text>已收满</text>
  8. </view>
  9. </view>
  10. <view class="book-detail">
  11. <view class="top-info">
  12. <view class="book-title">{{ book.bookName }}</view>
  13. <view class="upsell-info">
  14. <view class="book-tags">
  15. <text class="tzs tag-text" v-if="book.suit == 1">套装书</text>
  16. <text class="kmdb tag-text" v-if="book.maxNum > 1">可卖多本</text>
  17. </view>
  18. <text class="has-upsell" v-if="book.currUpsellMoney">已加价 {{ book.currUpsellMoney }} 元</text>
  19. </view>
  20. </view>
  21. <view class="flex flex-j-b flex-a-c">
  22. <view class="book-price">预估价: ¥{{ book.recycleMoney }}</view>
  23. </view>
  24. </view>
  25. <view class="delete-btn">
  26. <text>×{{ book.num }}</text>
  27. </view>
  28. </view>
  29. <common-dialog ref="deleteDialog" title="温馨提示" @confirm="confirmDelete">
  30. <text>确定删除这本图书吗?</text>
  31. </common-dialog>
  32. </view>
  33. </template>
  34. <script>
  35. import commonDialog from "@/components/common-dialog.vue";
  36. export default {
  37. components: {
  38. commonDialog,
  39. },
  40. props: {
  41. book: {
  42. type: Object,
  43. required: true,
  44. },
  45. },
  46. data() {
  47. return {};
  48. },
  49. methods: {},
  50. };
  51. </script>
  52. <style lang="scss" scoped>
  53. .book-item {
  54. background: #ffffff;
  55. padding: 20rpx;
  56. margin-top: 20rpx;
  57. border-radius: 10rpx;
  58. &.disabled {
  59. background: #f9ccc9;
  60. }
  61. .tag-text {
  62. font-family: Source Han Sans CN;
  63. font-weight: 400;
  64. font-size: 24rpx;
  65. color: #ffffff;
  66. }
  67. .tzs {
  68. width: 91rpx;
  69. height: 30rpx;
  70. background: linear-gradient(263deg, #98e05f, #0de3ac);
  71. border-radius: 2rpx;
  72. padding: 4rpx 10rpx;
  73. margin-right: 10rpx;
  74. }
  75. .kmdb {
  76. width: 117rpx;
  77. height: 30rpx;
  78. background: linear-gradient(263deg, #f7cb6b, #fba980);
  79. border-radius: 2rpx;
  80. padding: 4rpx 10rpx;
  81. margin-right: 10rpx;
  82. }
  83. .book-info {
  84. display: flex;
  85. position: relative;
  86. .book-image-container {
  87. position: relative;
  88. .book-cover {
  89. width: 140rpx;
  90. height: 196rpx;
  91. border-radius: 8rpx;
  92. }
  93. .no-recycle {
  94. position: absolute;
  95. bottom: 0;
  96. left: 50%;
  97. transform: translateX(-50%);
  98. background-color: #ff5252;
  99. color: #ffffff;
  100. padding: 4rpx 10rpx;
  101. border-radius: 4rpx 4rpx 0 0;
  102. font-size: 24rpx;
  103. text-align: center;
  104. width: 100%;
  105. }
  106. }
  107. .book-detail {
  108. flex: 1;
  109. margin-left: 20rpx;
  110. display: flex;
  111. flex-direction: column;
  112. justify-content: space-between;
  113. :v-deep .u-number-input {
  114. background: #f9f9f9 !important;
  115. border-radius: 6rpx;
  116. }
  117. .upsell-info{
  118. display: flex;
  119. align-items: center;
  120. justify-content: space-between;
  121. }
  122. .has-upsell {
  123. font-size: 22rpx;
  124. padding: 2rpx 10rpx;
  125. border-radius: 4rpx;
  126. margin-right: 10rpx;
  127. display: inline-flex;
  128. align-items: center;
  129. color: #276f1e;
  130. background-color: #a8dda2;
  131. }
  132. .book-title {
  133. max-width: 400rpx;
  134. font-size: 28rpx;
  135. color: #333;
  136. line-height: 1.4;
  137. margin-bottom: 20rpx;
  138. display: -webkit-box;
  139. -webkit-box-orient: vertical;
  140. -webkit-line-clamp: 2;
  141. overflow: hidden;
  142. font-family: Source Han Sans CN;
  143. font-weight: 400;
  144. }
  145. .book-price {
  146. font-family: Source Han Sans CN;
  147. font-weight: 400;
  148. font-size: 24rpx;
  149. color: #999999;
  150. }
  151. }
  152. .delete-btn {
  153. position: absolute;
  154. right: 0;
  155. top: -10rpx;
  156. padding: 10rpx;
  157. }
  158. }
  159. }
  160. </style>