Bladeren bron

未评价的情况下,自动提交默认评价

lighter 1 jaar geleden
bovenliggende
commit
947cabc000
1 gewijzigde bestanden met toevoegingen van 21 en 8 verwijderingen
  1. 21 8
      src/views/public-pages/PaymentSuccess.vue

+ 21 - 8
src/views/public-pages/PaymentSuccess.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="payment-success">
-    <van-nav-bar title="支付完成" @click-right="closePage">
+    <van-nav-bar title="支付完成" @click-right="autoSubmit(closePage)">
       <template #right>
         <van-icon name="close" size="18" /><span class="nav-bar-text">关闭</span>
       </template>
@@ -99,10 +99,11 @@
             type="warning"
             round
             style="width:120px;margin-left: 12px"
-            @click="toHome"
+            @click="autoSubmit(toHome)"
         >
           回到首页
         </van-button>
+
       </div>
     </div>
 
@@ -147,7 +148,7 @@
               plain
               :disabled="disableSubmitComment"
               style="width: 120px"
-              @click="submitComment"
+              @click="submitComment(null)"
           >
             提交
           </van-button>
@@ -183,6 +184,14 @@ function closePage() {
   WeixinJSBridge.call('closeWindow')
 }
 
+function autoSubmit(callback) {
+  if (createOrderRequest.orderType === 2 && !disableSubmitComment.value) {
+    submitComment(callback)
+  } else {
+    callback()
+  }
+}
+
 const comment = reactive({
   commentLevel: 5,
   commentContent: '',
@@ -213,7 +222,7 @@ function checkMyOrder() {
 }
 
 const disableSubmitComment = ref(false)
-function submitComment() {
+function submitComment(callback) {
   comment.doctorCode = createOrderRequest.doctorCode
   comment.doctorName = createOrderRequest.doctorName
   comment.hisOrdNum = createOrderRequest.hisOrdNum
@@ -221,10 +230,14 @@ function submitComment() {
   comment.patientName = createOrderRequest.patientName
   commitNewComment(comment).then(res => {
     disableSubmitComment.value = true
-    showDialog({
-      type: 'success',
-      message: '提交成功,感谢您的评价!',
-    })
+    if (null === callback) {
+      showDialog({
+        type: 'success',
+        message: '提交成功,感谢您的评价!',
+      })
+    } else {
+      callback()
+    }
   })
 }
 </script>