Browse Source

feat: 订单预览每次点击重新调用接口

cuiyalong 2 months ago
parent
commit
9dcc6f0d47
1 changed files with 16 additions and 3 deletions
  1. 16 3
      src/views/order/components/OrderReviewDialog.vue

+ 16 - 3
src/views/order/components/OrderReviewDialog.vue

@@ -9,7 +9,7 @@
     :visible="value"
     :visible="value"
     @update:visible="visibleUpdate"
     @update:visible="visibleUpdate"
     >
     >
-    <OrderReviewCard ref="reviewCard" :orderCode="orderCode" />
+    <OrderReviewCard ref="reviewCard" :orderCode="orderCode" :key="orderReviewKey" />
     <div class="footer-container" slot="footer" v-if="showReviewModule">
     <div class="footer-container" slot="footer" v-if="showReviewModule">
       <div class="review-form-container">
       <div class="review-form-container">
         <el-form ref="form" label-width="110px">
         <el-form ref="form" label-width="110px">
@@ -84,6 +84,10 @@ export default {
       type: String,
       type: String,
       default: '',
       default: '',
     },
     },
+    cacheContent: {
+      type: Boolean,
+      default: false
+    }
   },
   },
   data() {
   data() {
     return {
     return {
@@ -100,10 +104,18 @@ export default {
       orderReview: {
       orderReview: {
         pass: 1,
         pass: 1,
         reason: '',
         reason: '',
-      }
+      },
+      refreshTimestamp: 0,
     }
     }
   },
   },
   computed: {
   computed: {
+    orderReviewKey() {
+      if (this.cacheContent) {
+        return this.orderCode
+      } else {
+        return this.orderCode + this.refreshTimestamp
+      }
+    },
     confirmDisabled() {
     confirmDisabled() {
       return (this.orderReview.pass === -1 && !this.orderReview.reason) || this.submitLoading
       return (this.orderReview.pass === -1 && !this.orderReview.reason) || this.submitLoading
     },
     },
@@ -115,8 +127,9 @@ export default {
     value(n) {
     value(n) {
       if (n) {
       if (n) {
         this.resetReview()
         this.resetReview()
+        this.refreshTimestamp = Date.now()
       }
       }
-    }
+    },
   },
   },
   methods: {
   methods: {
     visibleUpdate(e) {
     visibleUpdate(e) {