BookItem.vue 4.1 KB

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