select-book-item.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="book-item">
  3. <view class="book-info">
  4. <image class="book-cover" :src="book.cover" mode="aspectFill" />
  5. <view class="book-detail">
  6. <view class="top-info">
  7. <view class="book-title">{{ book.bookName }}</view>
  8. <view class="book-tags">
  9. <text class="tzs tag-text" v-if="book.suit == 1">套装书</text>
  10. <text class="kmdb tag-text" v-if="book.maxNum > 1">可卖多本</text>
  11. </view>
  12. <view class="flex flex-j-b flex-a-c mt-20">
  13. <view class="book-price">预估价: ¥{{ book.expectMoney }}</view>
  14. </view>
  15. </view>
  16. <view v-if="isReturn" class="book-price">退回信息</view>
  17. <template v-else>
  18. <view class="book-price" v-if="book.auditCommentList && book.auditCommentList.length">审核信息</view>
  19. <view v-else class="book-price">暂无审核信息</view>
  20. </template>
  21. </view>
  22. <view class="delete-btn">
  23. <text>×{{ book.auditCommentList.length }}</text>
  24. </view>
  25. </view>
  26. <view class="mt-10" style="padding-left: 150rpx;">
  27. <view class="audit-info" v-if="isReturn">
  28. <view class="audit-item" v-for="(audit, index) in book.auditCommentList" :key="index">
  29. <view class="audit-reason" v-if="audit.com">
  30. 原因:{{ audit.com }}
  31. </view>
  32. </view>
  33. </view>
  34. <template v-else>
  35. <view class="audit-info" v-if="book.auditCommentList && book.auditCommentList.length">
  36. <view class="audit-item" v-for="(audit, index) in book.auditCommentList" :key="index">
  37. <view class="flex-a w100">
  38. <view class="flex-a flex-1">
  39. <view class="common-text-2 mr-16">第{{ index + 1 }}本</view>
  40. <view class="audit-status" :class="audit.sts == 1 ? 'status-good' : 'status-bad'">
  41. {{ audit.com }}
  42. </view>
  43. </view>
  44. <view class="audit-price">
  45. <u-checkbox shape="circle" :name="book.isbn + '-' + index"
  46. v-model="checkboxValue[index]"
  47. @change="(e) => handleSelect(e, { index, isbn: book.isbn })"></u-checkbox>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import commonDialog from '@/components/common-dialog.vue';
  58. export default {
  59. components: {
  60. commonDialog
  61. },
  62. props: {
  63. book: {
  64. type: Object,
  65. required: true
  66. },
  67. isReturn: {
  68. type: Boolean,
  69. default: false
  70. },
  71. modelValue: {
  72. type: Boolean,
  73. default: false
  74. }
  75. },
  76. data() {
  77. return {
  78. checkboxValue: {}
  79. }
  80. },
  81. watch: {
  82. 'book.auditCommentList': {
  83. immediate: true,
  84. handler(newVal) {
  85. if (newVal) {
  86. newVal.forEach((audit, index) => {
  87. this.$set(this.checkboxValue, index, audit.isSelected || false);
  88. });
  89. }
  90. }
  91. }
  92. },
  93. methods: {
  94. handleSelect(e, { index, isbn }) {
  95. // 更新本地状态
  96. this.$set(this.checkboxValue, index, e.value);
  97. // 触发父组件更新
  98. this.$emit('select', { checked: e.value, index, isbn });
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .book-item {
  105. background: #FFFFFF;
  106. margin-bottom: 30rpx;
  107. border-radius: 10rpx;
  108. .tag-text {
  109. font-family: Source Han Sans CN;
  110. font-weight: 400;
  111. font-size: 24rpx;
  112. color: #FFFFFF;
  113. }
  114. .tzs {
  115. width: 91rpx;
  116. height: 30rpx;
  117. background: linear-gradient(263deg, #98E05F, #0DE3AC);
  118. border-radius: 2rpx;
  119. padding: 4rpx 10rpx;
  120. margin-right: 10rpx;
  121. }
  122. .kmdb {
  123. width: 117rpx;
  124. height: 30rpx;
  125. background: linear-gradient(263deg, #F7CB6B, #FBA980);
  126. border-radius: 2rpx;
  127. padding: 4rpx 10rpx;
  128. margin-right: 10rpx;
  129. }
  130. .book-info {
  131. display: flex;
  132. position: relative;
  133. .book-cover {
  134. width: 140rpx;
  135. height: 196rpx;
  136. border-radius: 8rpx;
  137. }
  138. .book-detail {
  139. flex: 1;
  140. margin-left: 20rpx;
  141. display: flex;
  142. flex-direction: column;
  143. justify-content: space-between;
  144. :v-deep .u-number-input {
  145. background: #F9F9F9 !important;
  146. border-radius: 6rpx;
  147. }
  148. .book-title {
  149. max-width: 400rpx;
  150. font-size: 28rpx;
  151. color: #333;
  152. line-height: 1.4;
  153. margin-bottom: 20rpx;
  154. display: -webkit-box;
  155. -webkit-box-orient: vertical;
  156. -webkit-line-clamp: 2;
  157. overflow: hidden;
  158. font-family: Source Han Sans CN;
  159. font-weight: 400;
  160. }
  161. .book-price {
  162. font-family: Source Han Sans CN;
  163. font-weight: 400;
  164. font-size: 24rpx;
  165. color: #999999;
  166. }
  167. }
  168. .delete-btn {
  169. position: absolute;
  170. right: 0;
  171. top: -10rpx;
  172. padding: 10rpx;
  173. }
  174. }
  175. .audit-info {
  176. min-height: 60rpx;
  177. background: #FAFAFA;
  178. border-radius: 10rpx;
  179. padding: 12rpx 20rpx;
  180. box-sizing: border-box;
  181. .audit-item {
  182. margin-bottom: 6rpx;
  183. font-size: 24rpx;
  184. line-height: 42rpx;
  185. }
  186. .audit-status {
  187. margin-right: 20rpx;
  188. &.status-good {
  189. color: #67C23A;
  190. }
  191. &.status-bad {
  192. color: #F56C6C;
  193. }
  194. }
  195. .audit-price {
  196. color: #F56C6C;
  197. }
  198. .audit-reason {
  199. font-size: 26rpx;
  200. color: #999;
  201. font-weight: 400;
  202. font-family: PingFang SC;
  203. margin-top: 6rpx;
  204. }
  205. }
  206. }
  207. </style>