review-book.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view class="book-audit" @click="playGlobalSound">
  3. <view class="bg-white flex flex-a-c" style="padding: 20rpx; border-radius: 10rpx">
  4. <image :src="detail.cover" mode="aspectFill" style="width: 80px; height: 100px"></image>
  5. <view class="flex flex-d flex-1 ml-20">
  6. <text class="common-title mb-20">{{ detail.bookName }}</text>
  7. <text class="text-sm">ISBN: <text class="color-primary">{{ detail.isbn }}</text>
  8. </text>
  9. <text class="text-sm mt-6">作者: <text>{{ detail.author }}</text>
  10. </text>
  11. <text class="text-sm mt-6">出版社: <text>{{ detail.publish }}</text>
  12. </text>
  13. </view>
  14. </view>
  15. <view class="mt-20 bg-white price-info" style="border-radius: 10rpx">
  16. <view class="flex">
  17. <view class="flex flex-a-c flex-1">
  18. <text class="label">定价</text>
  19. <text class="content">¥{{ detail.price }}</text>
  20. </view>
  21. <view class="flex flex-a-c flex-1">
  22. <text class="label">回收折扣</text>
  23. <text class="content">{{ detail.recycleDiscount }}折</text>
  24. </view>
  25. </view>
  26. <view class="flex flex-a-c">
  27. <view class="flex flex-a-c flex-1">
  28. <text class="label">预估金额</text>
  29. <text class="content">¥{{ detail.expectPrice }}</text>
  30. </view>
  31. <view class="flex flex-a-c flex-1">
  32. <text class="label">审核金额</text>
  33. <text class="content">¥0.00</text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="mt-20">
  38. <ReviewInfo :detail="reviewInfo" ref="reviewInfoRef" />
  39. </view>
  40. <view class="fixed-bottom">
  41. <u-button type="primary" size="large" @click="handleAudit">确定</u-button>
  42. </view>
  43. </view>
  44. </template>
  45. <script setup>
  46. import { ref, nextTick, onUnmounted } from "vue";
  47. import { onLoad, onShow } from "@dcloudio/uni-app";
  48. import ReviewInfo from "./components/ReviewInfo.vue";
  49. const detail = ref({});
  50. function playGlobalSound() {
  51. uni.$u.playClickSound()
  52. }
  53. // 获取图书详情 /app/book/getSimpleBookInfoByIsbn/{isbn}
  54. const getBookInfo = (isbn) => {
  55. uni.$u.http.get(`/app/book/getBookByIsbn/${isbn}`).then((res) => {
  56. if (res.code == 200) {
  57. detail.value = res.data;
  58. }
  59. });
  60. };
  61. //获取图书信息和审核信息
  62. const reviewInfo = ref({});
  63. const getBookInfoAndAuditInfo = (opts) => {
  64. uni.$u.http.get(`/app/orderreview/getBookReviewInfo?isbn=${opts.isbn}&&orderId=${opts.orderId}&index=${opts.index}`).then((res) => {
  65. if (res.code == 200) {
  66. reviewInfo.value = res.data;
  67. }
  68. });
  69. };
  70. //复审
  71. const reviewInfoRef = ref(null)
  72. const handleAudit = () => {
  73. let form = reviewInfoRef.value.form
  74. if(form.reviewImg && form.reviewImg.length == 0){
  75. uni.$u.toast("请上传复审图片");
  76. return;
  77. }
  78. if (!form.reviewAuditSts) {
  79. uni.$u.toast("请选择复审状态");
  80. return;
  81. }
  82. if(form.reviewAuditSts == 3 && !form.reviewAudit){
  83. uni.$u.toast("请输入复审原因");
  84. return;
  85. }
  86. uni.$u.http
  87. .post("/app/orderreview/reviewBook", {
  88. auditReviewId: auditReviewId.value,
  89. ...form
  90. })
  91. .then((res) => {
  92. if (res.code == 200) {
  93. uni.showToast({ title: "复审成功", icon: "none" });
  94. uni.$u.ttsModule.speak("复审成功");
  95. uni.navigateBack();
  96. } else {
  97. uni.$u.toast(res.msg);
  98. }
  99. });
  100. };
  101. const auditReviewId = ref();
  102. const index = ref();
  103. let isbnScan = ref("");
  104. onLoad((options) => {
  105. options.isbn && getBookInfo(options.isbn);
  106. isbnScan.value = options.isbn;
  107. auditReviewId.value = options.auditReviewId;
  108. index.value = options.index;
  109. getBookInfoAndAuditInfo(options);
  110. });
  111. </script>
  112. <style lang="scss" scoped>
  113. .book-audit {
  114. padding: 20rpx;
  115. box-sizing: border-box;
  116. padding-bottom: 140rpx;
  117. .price-info {
  118. border-radius: 10rpx;
  119. .label {
  120. width: 150rpx;
  121. background-color: #cecece;
  122. padding: 16rpx 10rpx;
  123. text-align: center;
  124. border: 1rpx solid #e6e6e6;
  125. }
  126. .content {
  127. flex: 1;
  128. text-align: center;
  129. padding: 16rpx 10rpx;
  130. border: 1rpx solid #e6e6e6;
  131. }
  132. }
  133. }
  134. </style>