order-detail.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <!-- 编辑弹窗 -->
  2. <template>
  3. <ele-modal
  4. form
  5. :width="1560"
  6. v-model="visible"
  7. title="订单详情"
  8. @open="handleOpen"
  9. :body-style="{
  10. maxHeight: '84vh',
  11. position: 'relative',
  12. overflow: 'auto',
  13. background: '#f8f8f8',
  14. padding: '0'
  15. }"
  16. position="center"
  17. class="order-detail-modal"
  18. >
  19. <userDetail
  20. :detail="orderDetail"
  21. @refresh="getOrderDetail"
  22. ref="userDetailRef"
  23. @close="handleCancel"
  24. />
  25. <template #footer>
  26. <div style="display: flex; justify-content: space-between">
  27. <div style="margin-left: 10px"></div>
  28. <el-button @click="handleCancel" type="danger">关闭弹窗</el-button>
  29. <div style="display: flex">
  30. <el-button
  31. type="primary"
  32. @click="handleOtherAuditGood"
  33. v-if="orderDetail.status == 9 || orderDetail.status == 8"
  34. >其余审核良好</el-button
  35. >
  36. <el-button
  37. type="warning"
  38. @click="handleFirstCheck"
  39. v-if="orderDetail.status == 2"
  40. >初步审核</el-button
  41. >
  42. <el-button
  43. type="success"
  44. @click="handleConfirmReceipt"
  45. v-if="orderDetail.status == 6"
  46. >确认收货</el-button
  47. >
  48. <el-button
  49. color="#bd3124"
  50. @click="handleCompleteAudit"
  51. v-if="orderDetail.status == 9 || orderDetail.status == 8"
  52. >完成审核</el-button
  53. >
  54. <el-button
  55. color="#a16222"
  56. @click="handleBatchPayment"
  57. v-if="orderDetail.status == 10"
  58. >支付书款</el-button
  59. >
  60. </div>
  61. </div>
  62. </template>
  63. </ele-modal>
  64. <!-- 初审弹窗 -->
  65. <firstCheckModal ref="firstCheckRef" @success="handleSuccess" />
  66. </template>
  67. <script setup>
  68. import { ref, reactive, nextTick, getCurrentInstance } from 'vue';
  69. import userDetail from '@/views/recycleOrder/detail/index.vue';
  70. import request from '@/utils/request';
  71. import { ElMessageBox } from 'element-plus/es';
  72. import { EleMessage } from 'ele-admin-plus/es';
  73. import firstCheckModal from '@/views/recycleOrder/components/first-check-modal.vue';
  74. const { proxy } = getCurrentInstance();
  75. const emit = defineEmits(['refresh']);
  76. /** 弹窗是否打开 */
  77. const visible = defineModel({ type: Boolean });
  78. /** 关闭弹窗 */
  79. const handleCancel = () => {
  80. visible.value = false;
  81. };
  82. /** 弹窗打开事件 */
  83. let orderId = ref('');
  84. const handleOpen = (data) => {
  85. visible.value = true;
  86. nextTick(() => {
  87. if (data && data.orderId) {
  88. orderId.value = data.orderId;
  89. console.log(data, orderId.value, 'xxxx');
  90. getOrderDetail();
  91. }
  92. resetScrollPosition();
  93. });
  94. };
  95. // 重置滚动条位置
  96. const resetScrollPosition = () => {
  97. nextTick(() => {
  98. setTimeout(() => {
  99. const modalBody = document.querySelectorAll('.order-detail-modal .ele-modal-body');
  100. if (modalBody) {
  101. modalBody[modalBody.length - 1].scrollTop = 0;
  102. }
  103. }, 100);
  104. });
  105. };
  106. //其余审核良好
  107. const userDetailRef = ref();
  108. function handleOtherAuditGood() {
  109. userDetailRef.value?.handleOtherAuditGood();
  110. }
  111. //获取订单详情
  112. const orderDetail = ref({});
  113. const getOrderDetail = () => {
  114. request.get(`/order/orderInfo/getInfo/${orderId.value}`).then((res) => {
  115. if (res.data.code === 200) {
  116. orderDetail.value = res.data.data;
  117. }
  118. });
  119. };
  120. //弹窗确认操作
  121. function messageBoxConfirm({ message, fetch }) {
  122. ElMessageBox.confirm(message, '提示', {
  123. confirmButtonText: '确定',
  124. cancelButtonText: '关闭',
  125. type: 'warning'
  126. }).then(() => {
  127. fetch().then((res) => {
  128. if (res.data.code === 200) {
  129. EleMessage.success('操作成功');
  130. handleCancel();
  131. emit('refresh');
  132. } else {
  133. EleMessage.error(res.data.msg);
  134. }
  135. });
  136. });
  137. }
  138. //初审
  139. const firstCheckRef = ref(null);
  140. function handleFirstCheck() {
  141. firstCheckRef.value?.handleOpen(orderDetail.value.orderId);
  142. }
  143. //确认收货
  144. function handleConfirmReceipt() {
  145. messageBoxConfirm({
  146. message: '确认收货?',
  147. fetch: () =>
  148. proxy.$http.post('/order/orderInfo/adminConfirm', {
  149. orderIds: [orderId.value]
  150. })
  151. });
  152. }
  153. //完成审核
  154. function handleCompleteAudit() {
  155. // /order/orderInfo/adminCheckFinish
  156. messageBoxConfirm({
  157. message: '确认完成审核?',
  158. fetch: () =>
  159. proxy.$http.post('/order/orderInfo/adminCheckFinish', {
  160. orderId: orderId.value
  161. })
  162. });
  163. }
  164. //支付书款
  165. function handleBatchPayment() {
  166. messageBoxConfirm({
  167. message: '确认支付书款?',
  168. fetch: () =>
  169. proxy.$http.post('/order/orderInfo/payout', {
  170. orderIds: [orderId.value]
  171. })
  172. });
  173. }
  174. //初审成功
  175. function handleSuccess() {
  176. handleCancel();
  177. emit('refresh');
  178. }
  179. defineExpose({
  180. handleOpen
  181. });
  182. </script>