Pārlūkot izejas kodu

修复7岁以下小朋友挂号费用不对的问题。

lighter 4 gadi atpakaļ
vecāks
revīzija
1a29548589

+ 21 - 9
src/views/hospital-service/appointment/AppointmentConfirm.vue

@@ -20,13 +20,7 @@
     <van-radio-group v-model="data.appointment.patientId">
       <van-cell-group>
         <div v-for="item in patientCards" :key="item.patientId">
-          <van-cell
-            center
-            icon="user-o"
-            :label="item.patientId"
-            clickable
-            @click="data.appointment.patientId = item.patientId"
-          >
+          <van-cell center icon="user-o" :label="item.patientId" clickable @click="changePatient(item.patientId)">
             <template #title>
               <span class="custom-title">{{ item.name }}</span>
               &nbsp;
@@ -70,6 +64,7 @@ import { computed, onMounted, reactive, ref, watchEffect } from 'vue'
 import Cookies from 'js-cookie'
 import { getGhFee, hasValidCovidAssessment } from '../../../api/appointment'
 import router from '../../../router'
+import { Toast } from 'vant'
 export default {
   name: 'AppointConfirm',
   setup() {
@@ -95,6 +90,10 @@ export default {
     const addCardText = computed(() => {
       return '还可添加' + (5 - patientCards.value.length) + '人'
     })
+    const changePatient = (patientId) => {
+      data.appointment.patientId = patientId
+      fetchGhFee()
+    }
     const confirmAppointment = () => {
       if (Cookies.get('appointmentDeptCode') !== '1260000') {
         hasValidCovidAssessment(data.appointment.patientId).then((res) => {
@@ -119,16 +118,28 @@ export default {
       router.push('/payAppointmentFee')
     }
     const disableGhBtn = ref(true)
-    onMounted(() => {
+
+    const fetchGhFee = () => {
       getGhFee(data.appointment)
         .then((res) => {
-          data.appointment.fee = res
+          data.appointment.fee = res.fee
           disableGhBtn.value = false
+          if (res.message) {
+            Toast({
+              message: res.message,
+              position: 'top',
+              duration: 3000,
+            })
+          }
         })
         .catch(() => {
           data.appointment.fee = '获取失败'
           disableGhBtn.value = true
         })
+    }
+
+    onMounted(() => {
+      fetchGhFee()
     })
     return {
       showCreatedCardMethod,
@@ -138,6 +149,7 @@ export default {
       addCardText,
       confirmAppointment,
       disableGhBtn,
+      changePatient,
     }
   },
 }