Browse Source

修复无号也能挂号的问题

lighter 6 months ago
parent
commit
d51a0dbc3c
2 changed files with 58 additions and 9 deletions
  1. 2 0
      src/App.vue
  2. 56 9
      src/views/hospital-service/appointment/DoctorArrangement.vue

+ 2 - 0
src/App.vue

@@ -17,6 +17,8 @@ const loading = computed(() => {
   return store.state.loading
 })
 
+// Cookies.set('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcGVuaWQiOiJvYW82ZjAzUm1nVk5xUXVqSEhkRGpINXFiRHpvIiwiY29tcGFueUxvZ28iOiJjc3RoeXkiLCJleHBpcmVfdGltZSI6MH0.qrB2lhaV0EszGic9wx9SyzOholw722ky0YeaXt6TtYI')
+
 function getScreenSize() {
   const w = window.innerWidth
   const h = window.innerHeight

+ 56 - 9
src/views/hospital-service/appointment/DoctorArrangement.vue

@@ -69,7 +69,11 @@
               </van-grid>
             </van-collapse-item>
           </van-collapse>
-          <div v-for="item in data.arrangements" :key="item.mzyRequestId" @click="beforeConfirmAppointment(item)">
+          <div
+              v-for="item in data.arrangements"
+              :key="item.mzyRequestId"
+              @click="beforeConfirmAppointment(item)"
+          >
             <van-cell center :title="item.ampm" is-link>
               <template #label>
                 <span v-html="hasLeftNum(item.leftNum)"></span>
@@ -93,19 +97,33 @@
     <van-empty :image="empty" v-show="data.arrangements.length === 0" description="暂未获取到医生排班信息" />
     <van-action-sheet v-model:show="showTimeSections" title="请选择">
       <div style="padding: 16px 16px 30px">
-        <van-radio-group v-model="currentAppointmentItem.apTime">
+        <van-radio-group
+            v-model="currentAppointmentItem.apTime"
+            @change="handleSelectAmPm"
+        >
           <van-cell-group inset>
-            <van-cell v-for="obj in timeSections" :title="'时段:' + obj.apValue" :value="'余号:' + obj.apLeftNum" clickable
-                      @click="currentAppointmentItem.apTime = obj.apTime;currentAppointmentItem.apValue = obj.apValue"
-                      value-class="need-padding">
+            <van-cell
+                v-for="obj in timeSections" :title="'时段:' + obj.apValue"
+                :value="'余号:' + obj.apLeftNum"
+                value-class="need-padding">
               <template #right-icon>
-                <van-radio :name="obj.apTime" :disabled="obj.apLeftNum === '0'"/>
+                <van-radio
+                    :name="obj.apTime"
+                    :disabled="obj.apLeftNum === 0 || obj.apLeftNum === '0' "
+                />
               </template>
             </van-cell>
           </van-cell-group>
         </van-radio-group>
-        <van-button style="margin-top: 20px" block type="primary" @click="toConfirmAppointment"
-                    :disabled="!currentAppointmentItem.apTime">确认</van-button>
+        <van-button
+            style="margin-top: 20px"
+            block
+            type="primary"
+            @click="toConfirmAppointment"
+            :disabled="!currentAppointmentItem.apTime"
+        >
+          确认
+        </van-button>
       </div>
     </van-action-sheet>
 
@@ -223,8 +241,32 @@ const pmSectionLabel = [
   {apTime: 'p6', apValue: '16:30-17:00'},
   {apTime: 'p7', apValue: '17:00-17:30'},
 ]
+const apValMap = {
+  a1: '08:00-08:30',
+  a2: '08:30-09:00',
+  a3: '09:00-09:30',
+  a4: '09:30-10:00',
+  a5: '10:00-10:30',
+  a6: '10:30-11:00',
+  a7: '11:00-11:30',
+  a8: '11:30-12:00',
+  p1: '14:00-14:30',
+  p2: '14:30-15:00',
+  p3: '15:00-15:30',
+  p4: '15:30-16:00',
+  p5: '16:00-16:30',
+  p6: '16:30-17:00',
+  p7: '17:00-17:30',
+}
 const beforeConfirmAppointment = (item) => {
-  currentAppointmentItem.value = item
+  if (item.leftNum === 0) {
+    showToast({
+      position: 'top',
+      message: '当前号段无号,请选择其他号段。'
+    })
+    return
+  }
+  currentAppointmentItem.value = item;
   currentAppointmentItem.value.deptCode = Cookies.get('appointmentDeptCode')
   currentAppointmentItem.value.deptName = Cookies.get('appointmentDeptName')
   currentAppointmentItem.value.date = data.date
@@ -244,6 +286,11 @@ const beforeConfirmAppointment = (item) => {
   }
 }
 
+function handleSelectAmPm(apTime) {
+  currentAppointmentItem.value.apTime = apTime;
+  currentAppointmentItem.value.apValue = apValMap[apTime]
+}
+
 const toConfirmAppointment = () => {
   store.dispatch({
     type: 'storeAppointmentInfo',