فهرست منبع

获取挂号费用失败后禁用确认挂号按钮。

lighter 4 سال پیش
والد
کامیت
041bbb1c45
1فایلهای تغییر یافته به همراه12 افزوده شده و 10 حذف شده
  1. 12 10
      src/views/hospital-service/appointment/AppointmentConfirm.vue

+ 12 - 10
src/views/hospital-service/appointment/AppointmentConfirm.vue

@@ -48,7 +48,7 @@
       @click="showCreatedCardMethod = true"
     ></van-cell>
     <div style="height: 10px"></div>
-    <van-button type="primary" block @click="confirmAppointment">确认挂号</van-button>
+    <van-button type="primary" block @click="confirmAppointment" :disabled="disableGhBtn">确认挂号</van-button>
     <van-dialog
       v-model:show="showCreatedCardMethod"
       title="请选择绑定方式"
@@ -112,16 +112,17 @@ export default {
         }
       })
     }
+    const disableGhBtn = ref(true)
     onMounted(() => {
-      getGhFee(data.appointment).then((res) => {
-        data.appointment.fee = res.data
-        if (res.message) {
-          Dialog.alert({
-            title: '提示',
-            message: response.data.message,
-          })
-        }
-      })
+      getGhFee(data.appointment)
+        .then((res) => {
+          data.appointment.fee = res
+          disableGhBtn.value = false
+        })
+        .catch(() => {
+          data.appointment.fee = '获取失败'
+          disableGhBtn.value = true
+        })
     })
     return {
       showCreatedCardMethod,
@@ -130,6 +131,7 @@ export default {
       showAddCard,
       addCardText,
       confirmAppointment,
+      disableGhBtn,
     }
   },
 }