From fa5ea853099e88be253fca4fb2b0c2b7af5f396e Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 09 十一月 2025 15:57:04 +0800
Subject: [PATCH] feat:微信登录

---
 app/pages/task/create-emergency.vue |  770 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 702 insertions(+), 68 deletions(-)

diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index 1810257..4ad6a63 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -4,7 +4,7 @@
       <view class="back-btn" @click="goBack">
         <uni-icons type="arrowleft" size="20"></uni-icons>
       </view>
-      <view class="title">鍒涘缓鎬ユ晳杞繍浠诲姟</view>
+      <view class="title">鍒涘缓杞繍浠诲姟</view>
     </view>
     
     <view class="form-section">
@@ -18,7 +18,7 @@
         </picker>
       </view>
         <view class="form-item">
-        <view class="form-label">褰掑睘鏈烘瀯</view>
+        <view class="form-label required">褰掑睘鏈烘瀯</view>
         <picker mode="selector" :range="organizations" @change="onOrganizationChange">
           <view class="form-input picker-input">
             {{ selectedOrganization || '璇烽�夋嫨褰掑睘鏈烘瀯' }}
@@ -78,7 +78,7 @@
     
       
       <view class="form-item">
-        <view class="form-label">杞繍鏃堕棿</view>
+        <view class="form-label required">杞繍鏃堕棿</view>
         <uni-datetime-picker 
           v-model="taskForm.transferTime" 
           type="datetime" 
@@ -189,7 +189,10 @@
               :key="hospital.hospId"
               @click="selectHospitalOut(hospital)"
             >
-              <view class="hospital-name">{{ hospital.hospName }}</view>
+              <view class="hospital-name">
+                {{ hospital.hospName }}
+                <text class="hospital-short" v-if="hospital.hospShort">{{ hospital.hospShort }}</text>
+              </view>
               <view class="hospital-address">{{ buildFullAddress(hospital) }}</view>
             </view>
           </view>
@@ -198,12 +201,21 @@
       
       <view class="form-item">
         <view class="form-label required">绉戝</view>
-        <picker mode="selector" :range="departmentOptions" range-key="text" @change="onHospitalOutDepartmentChange">
+        <picker 
+          v-if="taskForm.hospitalOut.name !== '瀹朵腑'"
+          mode="selector" 
+          :range="departmentOptions" 
+          range-key="text" 
+          @change="onHospitalOutDepartmentChange"
+        >
           <view class="form-input picker-input">
             {{ taskForm.hospitalOut.department || '璇烽�夋嫨绉戝' }}
             <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
           </view>
         </picker>
+        <view v-else class="form-input picker-input disabled">
+          鍏跺畠
+        </view>
       </view>
       
       <view class="form-item">
@@ -217,7 +229,26 @@
       
       <view class="form-item">
         <view class="form-label">杞嚭鍦板潃</view>
-        <view class="form-input picker-input disabled">
+        <view class="address-input-container" v-if="taskForm.hospitalOut.name === '瀹朵腑'">
+          <input 
+            class="form-input" 
+            placeholder="璇疯緭鍏ヨ缁嗗湴鍧�" 
+            v-model="taskForm.hospitalOut.address"
+            @input="onAddressOutInput"
+            @focus="onAddressOutFocus"
+          />
+          <view class="address-suggestions" v-if="showAddressOutSuggestions && addressOutSuggestions.length > 0">
+            <view 
+              class="address-suggestion-item" 
+              v-for="(item, index) in addressOutSuggestions" 
+              :key="index"
+              @click="selectAddressOut(item)">
+              <view class="suggestion-name">{{ item.name }}</view>
+              <view class="suggestion-address">{{ item.district }}{{ item.address }}</view>
+            </view>
+          </view>
+        </view>
+        <view v-else class="form-input picker-input disabled">
           {{ taskForm.hospitalOut.address || '閫夋嫨鍖婚櫌鍚庤嚜鍔ㄥ~鍏�' }}
         </view>
       </view>
@@ -240,7 +271,10 @@
               :key="hospital.hospId"
               @click="selectHospitalIn(hospital)"
             >
-              <view class="hospital-name">{{ hospital.hospName }}</view>
+              <view class="hospital-name">
+                {{ hospital.hospName }}
+                <text class="hospital-short" v-if="hospital.hospShort">{{ hospital.hospShort }}</text>
+              </view>
               <view class="hospital-address">{{ buildFullAddress(hospital) }}</view>
             </view>
           </view>
@@ -249,12 +283,21 @@
       
       <view class="form-item">
         <view class="form-label required">绉戝</view>
-        <picker mode="selector" :range="departmentOptions" range-key="text" @change="onHospitalInDepartmentChange">
+        <picker 
+          v-if="taskForm.hospitalIn.name !== '瀹朵腑'"
+          mode="selector" 
+          :range="departmentOptions" 
+          range-key="text" 
+          @change="onHospitalInDepartmentChange"
+        >
           <view class="form-input picker-input">
             {{ taskForm.hospitalIn.department || '璇烽�夋嫨绉戝' }}
             <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
           </view>
         </picker>
+        <view v-else class="form-input picker-input disabled">
+          鍏跺畠
+        </view>
       </view>
       
       <view class="form-item">
@@ -268,13 +311,32 @@
       
       <view class="form-item">
         <view class="form-label">杞叆鍦板潃</view>
-        <view class="form-input picker-input disabled">
+        <view class="address-input-container" v-if="taskForm.hospitalIn.name === '瀹朵腑'">
+          <input 
+            class="form-input" 
+            placeholder="璇疯緭鍏ヨ缁嗗湴鍧�" 
+            v-model="taskForm.hospitalIn.address"
+            @input="onAddressInInput"
+            @focus="onAddressInFocus"
+          />
+          <view class="address-suggestions" v-if="showAddressInSuggestions && addressInSuggestions.length > 0">
+            <view 
+              class="address-suggestion-item" 
+              v-for="(item, index) in addressInSuggestions" 
+              :key="index"
+              @click="selectAddressIn(item)">
+              <view class="suggestion-name">{{ item.name }}</view>
+              <view class="suggestion-address">{{ item.district }}{{ item.address }}</view>
+            </view>
+          </view>
+        </view>
+        <view v-else class="form-input picker-input disabled">
           {{ taskForm.hospitalIn.address || '閫夋嫨鍖婚櫌鍚庤嚜鍔ㄥ~鍏�' }}
         </view>
       </view>
       
       <view class="form-item">
-        <view class="form-label">杞繍鍏噷鏁�</view>
+        <view class="form-label required">杞繍鍏噷鏁�</view>
         <input 
           class="form-input" 
           type="digit" 
@@ -284,7 +346,7 @@
       </view>
       
       <view class="form-item">
-        <view class="form-label">鎴愪氦浠�</view>
+        <view class="form-label required">鎴愪氦浠�</view>
         <input 
           class="form-input" 
           type="digit" 
@@ -443,14 +505,14 @@
 import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
 import { addTask } from "@/api/task"
 import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
-import { calculateDistance } from "@/api/map"
-import { searchHospitals } from "@/api/hospital"
+import { calculateDistance, baiduDistanceByAddress, baiduPlaceSuggestion } from "@/api/map"
+import { searchHospitals, getFrequentOutHospitals, getFrequentInHospitals } from "@/api/hospital"
 import { listUser } from "@/api/system/user"
 import { searchIcd10 } from "@/api/icd10"
 
 import { getDicts } from "@/api/dict"
 import { getServiceOrdAreaTypes, getServiceOrderTypes, getHospitalDepartments } from "@/api/dictionary"
-import { listBranchCompany } from "@/api/system/dept"
+import { listBranchCompany, getDept } from "@/api/system/dept"
 import MapSelector from '@/components/map-selector.vue'
 
 export default {
@@ -465,6 +527,7 @@
       selectedVehicleId: null,
       selectedOrganization: '',
       selectedOrganizationId: null, // 褰掑睘鏈烘瀯ID锛堥儴闂↖D锛�
+      selectedOrganizationServiceOrderClass: '', // 褰掑睘鏈烘瀯鐨勬湇鍔″崟缂栫爜
       selectedRegion: '', // 浠庡綊灞炴満鏋勪腑鎻愬彇鐨勫湴鍩熶俊鎭紙濡傦細骞垮窞銆佹繁鍦崇瓑锛�
       selectedEmergencyTaskType: '', // 閫変腑鐨勪换鍔$被鍨嬫枃鏈�
       selectedEmergencyTaskTypeId: null, // 閫変腑鐨勪换鍔$被鍨婭D
@@ -480,6 +543,12 @@
       showHospitalInResults: false,
       searchTimer: null,
       defaultHospitals: [], // 榛樿鐨�100鏉″尰闄㈡暟鎹�
+      // 鍦板潃鎼滅储鎻愮ず鐩稿叧
+      addressOutSuggestions: [], // 杞嚭鍦板潃鎻愮ず鍒楄〃
+      showAddressOutSuggestions: false,
+      addressInSuggestions: [], // 杞叆鍦板潃鎻愮ず鍒楄〃
+      showAddressInSuggestions: false,
+      addressSearchTimer: null, // 鍦板潃鎼滅储闃叉姈瀹氭椂鍣�
       // 浜哄憳閫夋嫨鐩稿叧
       selectedStaff: [], // 宸查�夋嫨鐨勪汉鍛樺垪琛�
       allStaffList: [], // 鎵�鏈変汉鍛樺垪琛�
@@ -560,6 +629,9 @@
     }
   },
   onLoad(options) {
+    // 璁剧疆榛樿杞繍鏃堕棿涓哄綋鍓嶆椂闂�
+    this.setDefaultTransferTime()
+    
     // 鍏堝姞杞借溅杈嗗垪琛紝鐒跺悗鍔犺浇缁戝畾杞﹁締淇℃伅
     this.getAvailableVehicles().then(() => {
       this.getUserBoundVehicleInfo()
@@ -615,17 +687,21 @@
     },
     
     getAvailableVehicles() {
-      const deptId = this.currentUser.deptId
-      return listAvailableVehicles(deptId, 'EMERGENCY').then(response => {
-        const vehicleList = response.data || response.rows || []
+      // 鏍规嵁鐢ㄦ埛鏈夋潈闄愮鐞嗙殑鍒嗗叕鍙革紝鏌ヨ鎵�鏈夊彲鐢ㄨ溅杈�
+      return listAvailableVehicles(null, 'EMERGENCY').then(response => {
+        const vehicleList = response.data || []
         this.vehicleOptions = vehicleList.map(vehicle => ({
           id: vehicle.vehicleId,
           name: vehicle.vehicleNo,
           type: vehicle.vehicleType,
-          status: vehicle.status
+          status: vehicle.status,
+          deptNames: vehicle.deptNames || [] // 杞﹁締褰掑睘鐨勫涓垎鍏徃
         }))
+        // 鍙樉绀鸿溅鐗屽彿锛屼笉鏄剧ず鍒嗗叕鍙�
         this.vehicles = this.vehicleOptions.map(v => v.name)
-      }).catch(() => {
+        console.log('鍔犺浇鍙敤杞﹁締鏁伴噺:', this.vehicles.length)
+      }).catch(error => {
+        console.error('鍔犺浇杞﹁締鍒楄〃澶辫触:', error)
         this.vehicles = []
       })
     },
@@ -641,8 +717,9 @@
       const selected = this.organizationOptions[index]
       this.selectedOrganization = selected.deptName
       this.selectedOrganizationId = selected.deptId // 淇濆瓨閮ㄩ棬ID
-      // 浠庡綊灞炴満鏋勪腑鎻愬彇鍦板煙鍏抽敭璇嶏紙鍘婚櫎"鍒嗗叕鍙�"鍚庣紑锛�
-      // 渚嬪锛�"骞垮窞鍒嗗叕鍙�" -> "骞垮窞"
+      this.selectedOrganizationServiceOrderClass = selected.serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
+      // 浠庡綊灞炴満鏋勪腑鎻愬彇鍦板煙鍏抽敭璇嶏紙鍘婚櫎鈥滃垎鍏徃鈥濆悗缂�锛�
+      // 渚嬪锛氣�滃箍宸炲垎鍏徃鈥� -> 鈥滃箍宸炩��
       this.selectedRegion = selected.deptName.replace(/鍒嗗叕鍙�$/g, '').trim()
       // 閲嶆柊鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
       this.loadDefaultHospitals()
@@ -665,9 +742,10 @@
           if (index !== -1) {
             this.selectedOrganization = this.currentUser.branchCompanyName
             this.selectedOrganizationId = this.organizationOptions[index].deptId // 淇濆瓨閮ㄩ棬ID
+            this.selectedOrganizationServiceOrderClass = this.organizationOptions[index].serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
             // 鎻愬彇鍦板煙鍏抽敭璇�
             this.selectedRegion = this.selectedOrganization.replace(/鍒嗗叕鍙�$/g, '').trim()
-            console.log('榛樿閫変腑褰掑睘鏈烘瀯:', this.selectedOrganization, '閮ㄩ棬ID:', this.selectedOrganizationId, '鍦板煙:', this.selectedRegion)
+            console.log('榛樿閫変腑褰掑睘鏈烘瀯:', this.selectedOrganization, '閮ㄩ棬ID:', this.selectedOrganizationId, '鏈嶅姟鍗曠紪鐮�:', this.selectedOrganizationServiceOrderClass, '鍦板煙:', this.selectedRegion)
             // 鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
             this.loadDefaultHospitals()
           }
@@ -785,25 +863,160 @@
       this.taskForm.hospitalIn.departmentId = selected.id  // 淇濆瓨绉戝ID
     },
     
-    // 鍔犺浇榛樿鍖洪櫌鍒楄〃锛堝墠100鏉★級
+    // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝父鐢ㄥ尰闄級
     loadDefaultHospitals() {
-      // 浼犲叆绌哄瓧绗︿覆鎴栫壒娈婃爣璇嗚幏鍙栧墠100鏉★紝鍚屾椂浼犲叆鍦板煙杩囨护
-      searchHospitals('', this.selectedRegion).then(response => {
-        this.defaultHospitals = response.data || []
-        // 鍚屾椂鍒濆鍖栦袱涓悳绱㈢粨鏋滀负榛樿鏁版嵁
-        this.hospitalOutResults = [...this.defaultHospitals]
-        this.hospitalInResults = [...this.defaultHospitals]
+      // 妫�鏌ユ槸鍚︽湁鏈嶅姟鍗曠紪鐮�
+      if (!this.selectedOrganizationServiceOrderClass) {
+        console.warn('鏈壘鍒版湇鍔″崟缂栫爜锛屾棤娉曞姞杞藉父鐢ㄥ尰闄�')
+        // 濡傛灉娌℃湁鏈嶅姟鍗曠紪鐮侊紝闄嶇骇涓烘櫘閫氭悳绱紙鎸夊湴鍩熻繃婊わ級
+        this.loadDefaultHospitalsByRegion()
+        return
+      }
+      
+      // 杞嚭鍖婚櫌锛氬姞杞藉綋鍓嶅垎鍏徃鐨勫父鐢ㄨ浆鍑哄尰闄�
+      getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
+        this.hospitalOutResults = response.data || []
+        console.log('鍔犺浇甯哥敤杞嚭鍖婚櫌锛�', this.selectedOrganizationServiceOrderClass, '鍦板煙:', this.selectedRegion, '鏁伴噺:', this.hospitalOutResults.length)
+        
+        // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+        if (this.hospitalOutResults.length === 0) {
+          console.log('鏈壘鍒板父鐢ㄨ浆鍑哄尰闄紝闄嶇骇涓哄湴鍩熸悳绱�')
+          searchHospitals('', this.selectedRegion).then(res => {
+            this.hospitalOutResults = res.data || []
+          })
+        }
       }).catch(error => {
-        console.error('鍔犺浇榛樿鍖洪櫌鍒楄〃澶辫触:', error)
-        this.defaultHospitals = []
+        console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
+        // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
+        searchHospitals('', this.selectedRegion).then(res => {
+          this.hospitalOutResults = res.data || []
+        })
       })
+      
+      // 杞叆鍖婚櫌锛氬姞杞藉綋鍓嶅垎鍏徃鐨勫父鐢ㄨ浆鍏ュ尰闄紙鏈湴鍖哄煙浼樺厛锛�
+      getFrequentInHospitals(this.selectedOrganizationServiceOrderClass, '').then(response => {
+        const allHospitals = response.data || []
+        // 灏嗗尰闄㈡寜鍦板煙鎺掑簭锛氭湰鍦板尯鍩熶紭鍏�
+        this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+        console.log('鍔犺浇甯哥敤杞叆鍖婚櫌锛�', this.selectedOrganizationServiceOrderClass, '鏁伴噺:', this.hospitalInResults.length)
+        
+        // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+        if (this.hospitalInResults.length === 0) {
+          console.log('鏈壘鍒板父鐢ㄨ浆鍏ュ尰闄紝闄嶇骇涓哄叏閮ㄥ尰闄�')
+          searchHospitals('', '').then(res => {
+            const allHospitals = res.data || []
+            this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+          })
+        }
+      }).catch(error => {
+        console.error('鍔犺浇甯哥敤杞叆鍖婚櫌澶辫触:', error)
+        // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
+        searchHospitals('', '').then(res => {
+          const allHospitals = res.data || []
+          this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+        })
+      })
+    },
+    
+    // 闄嶇骇鍔犺浇鍖婚櫌锛堟寜鍦板煙杩囨护锛�
+    loadDefaultHospitalsByRegion() {
+      // 杞嚭鍖婚櫌锛氬彧鍔犺浇褰撳墠鍖哄煙鐨勫尰闄紙甯﹀湴鍩熻繃婊わ級
+      searchHospitals('', this.selectedRegion).then(response => {
+        this.hospitalOutResults = response.data || []
+        console.log('鍔犺浇杞嚭鍖婚櫌锛堝綋鍓嶅尯鍩燂級:', this.selectedRegion, '鏁伴噺:', this.hospitalOutResults.length)
+      }).catch(error => {
+        console.error('鍔犺浇杞嚭鍖婚櫌鍒楄〃澶辫触:', error)
+        this.hospitalOutResults = []
+      })
+      
+      // 杞叆鍖婚櫌锛氬姞杞芥墍鏈夊尰闄紙涓嶅甫鍦板煙杩囨护锛屽悗缁細鎸夊湴鍩熸帓搴忥級
+      searchHospitals('', '').then(response => {
+        const allHospitals = response.data || []
+        // 灏嗗尰闄㈡寜鍦板煙鎺掑簭锛氭湰鍦板尯鍩熶紭鍏�
+        this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+        console.log('鍔犺浇杞叆鍖婚櫌锛堝叏閮ㄥ尯鍩燂級:', '鏁伴噺:', this.hospitalInResults.length)
+      }).catch(error => {
+        console.error('鍔犺浇杞叆鍖婚櫌鍒楄〃澶辫触:', error)
+        this.hospitalInResults = []
+      })
+    },
+    
+    // 鎸夊湴鍩熸帓搴忓尰闄細鏈湴鍖哄煙浼樺厛锛�"瀹朵腑"濮嬬粓鍦ㄦ渶鍓嶉潰
+    sortHospitalsByRegion(hospitals) {
+      if (!hospitals || hospitals.length === 0) {
+        return hospitals
+      }
+      
+      const region = this.selectedRegion
+      const homeHospital = []  // "瀹朵腑"
+      const localHospitals = []  // 鏈湴鍖婚櫌
+      const otherHospitals = []  // 鍏朵粬鍖婚櫌
+      
+      hospitals.forEach(hospital => {
+        // "瀹朵腑"浼樺厛澶勭悊锛屾斁鍦ㄦ渶鍓嶉潰
+        if (hospital.hospName === '瀹朵腑') {
+          homeHospital.push(hospital)
+          return
+        }
+        
+        // 鍒ゆ柇鍖婚櫌鏄惁鍦ㄦ湰鍦板尯鍩燂紙鐪併�佸競銆佸尯浠讳竴鍖呭惈鍦板煙鍏抽敭璇嶏級
+        const isLocal = region && (
+          (hospital.hopsProvince && hospital.hopsProvince.includes(region)) ||
+          (hospital.hopsCity && hospital.hopsCity.includes(region)) ||
+          (hospital.hopsArea && hospital.hopsArea.includes(region))
+        )
+        
+        if (isLocal) {
+          localHospitals.push(hospital)
+        } else {
+          otherHospitals.push(hospital)
+        }
+      })
+      
+      // "瀹朵腑"鍦ㄦ渶鍓嶏紝鏈湴鍖婚櫌鍏舵锛屽叾浠栧尰闄㈠湪鍚�
+      return [...homeHospital, ...localHospitals, ...otherHospitals]
     },
     
     // 杞嚭鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
     onHospitalOutFocus() {
-      // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず榛樿鐨�100鏉℃暟鎹�
+      // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず甯哥敤杞嚭鍖婚櫌
       if (!this.hospitalOutSearchKeyword || this.hospitalOutSearchKeyword.trim() === '') {
-        this.hospitalOutResults = [...this.defaultHospitals]
+        // 濡傛灉宸茬粡鍔犺浇杩囧父鐢ㄥ尰闄紝鐩存帴鏄剧ず
+        if (this.hospitalOutResults.length > 0) {
+          this.showHospitalOutResults = true
+          return
+        }
+        
+        // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
+        if (this.selectedOrganizationServiceOrderClass) {
+          getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
+            const hospitals = response.data || []
+            // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
+            this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
+            // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+            if (this.hospitalOutResults.length === 0) {
+              searchHospitals('', this.selectedRegion).then(res => {
+                const hospitals = res.data || []
+                this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
+              })
+            }
+          }).catch(error => {
+            console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
+            searchHospitals('', this.selectedRegion).then(res => {
+              const hospitals = res.data || []
+              this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
+            })
+          })
+        } else {
+          // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
+          searchHospitals('', this.selectedRegion).then(response => {
+            const hospitals = response.data || []
+            this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
+          }).catch(error => {
+            console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
+            this.hospitalOutResults = []
+          })
+        }
       }
       this.showHospitalOutResults = true
     },
@@ -818,27 +1031,37 @@
         clearTimeout(this.searchTimer)
       }
       
-      // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず榛樿100鏉�
+      // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず褰撳墠鍖哄煙鐨勫尰闄�
       if (!keyword || keyword.trim() === '') {
-        this.hospitalOutResults = [...this.defaultHospitals]
+        searchHospitals('', this.selectedRegion).then(response => {
+          const hospitals = response.data || []
+          // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
+          this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
+        }).catch(error => {
+          console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
+          this.hospitalOutResults = []
+        })
         this.showHospitalOutResults = true
         return
       }
       
-      // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储
+      // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储锛堜粎闄愬綋鍓嶅尯鍩燂級
       this.searchTimer = setTimeout(() => {
         this.searchHospitalOut(keyword)
       }, 300)
     },
     
-    // 鎼滅储杞嚭鍖婚櫌
+    // 鎼滅储杞嚭鍖婚櫌锛堜粎闄愬綋鍓嶅尯鍩燂級
     searchHospitalOut(keyword) {
-      // 浼犲叆鍏抽敭璇嶅拰鍦板煙杩囨护
+      // 浼犲叆鍏抽敭璇嶅拰鍦板煙杩囨护锛屽彧鎼滅储褰撳墠鍖哄煙鐨勫尰闄�
       searchHospitals(keyword, this.selectedRegion).then(response => {
-        this.hospitalOutResults = response.data || []
+        const hospitals = response.data || []
+        // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
+        this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
         this.showHospitalOutResults = true
+        console.log('鎼滅储杞嚭鍖婚櫌:', keyword, '鍖哄煙:', this.selectedRegion, '缁撴灉鏁�:', this.hospitalOutResults.length)
       }).catch(error => {
-        console.error('鎼滅储鍖婚櫌澶辫触:', error)
+        console.error('鎼滅储杞嚭鍖婚櫌澶辫触:', error)
         this.hospitalOutResults = []
       })
     },
@@ -847,30 +1070,82 @@
     selectHospitalOut(hospital) {
       this.taskForm.hospitalOut.id = hospital.hospId  // 淇濆瓨鍖婚櫌ID
       this.taskForm.hospitalOut.name = hospital.hospName
-      // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
-      const fullAddress = this.buildFullAddress(hospital)
-      this.taskForm.hospitalOut.address = fullAddress
+      // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛屾竻绌哄湴鍧�璁╃敤鎴锋墜鍔ㄨ緭鍏ワ紱鍚﹀垯鑷姩濉厖鍦板潃
+      if (hospital.hospName === '瀹朵腑') {
+        this.taskForm.hospitalOut.address = ''
+        // 绉戝鑷姩璁剧疆涓�"鍏跺畠"
+        this.taskForm.hospitalOut.department = '鍏跺畠'
+        this.taskForm.hospitalOut.departmentId = null
+      } else {
+        // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
+        const fullAddress = this.buildFullAddress(hospital)
+        this.taskForm.hospitalOut.address = fullAddress
+        // 娓呯┖绉戝锛岃鐢ㄦ埛閲嶆柊閫夋嫨
+        if (this.taskForm.hospitalOut.department === '鍏跺畠') {
+          this.taskForm.hospitalOut.department = ''
+          this.taskForm.hospitalOut.departmentId = null
+        }
+      }
       this.hospitalOutSearchKeyword = hospital.hospName
       this.showHospitalOutResults = false
       this.hospitalOutResults = []
       
-      // 濡傛灉鏈塆PS鍧愭爣锛屼繚瀛樹笅鏉�
-      // 娉ㄦ剰锛欻ospData琛ㄤ腑鍙兘娌℃湁GPS鍧愭爣锛岄渶瑕佹牴鎹湴鍧�杩涜鍦扮悊缂栫爜
-      // 杩欓噷鍏堢疆涓簄ull锛屽悗缁彲浠ラ�氳繃鍦板潃瑙f瀽鑾峰彇
-      this.addressCoordinates.hospitalOutAddress = null
+      // 淇濆瓨杞嚭鍖婚櫌鐨勫煄甯備俊鎭�
+      this.taskForm.hospitalOut.city = hospital.hopsCity || ''
       
-      // 濡傛灉涓や釜鍖婚櫌閮藉凡閫夋嫨锛岃嚜鍔ㄨ绠楄窛绂�
+      // 濡傛灉杞叆鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalIn.address) {
-        // 杩欓噷鍙互璋冪敤鍦板潃瑙f瀽鍜岃窛绂昏绠�
-        // 鏆傛椂鐣欑┖锛岀敱鐢ㄦ埛鎵嬪姩杈撳叆璺濈
+        // 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
+        if (hospital.hospName !== '瀹朵腑' && this.taskForm.hospitalIn.name !== '瀹朵腑') {
+          this.calculateHospitalDistance()
+        } else {
+          // 鏈変竴涓槸"瀹朵腑",浣跨敤鍦板潃璁$畻
+          this.calculateDistanceByManualAddress()
+        }
       }
     },
     
     // 杞叆鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
     onHospitalInFocus() {
-      // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず榛樿鐨�100鏉℃暟鎹�
+      // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず甯哥敤杞叆鍖婚櫌
       if (!this.hospitalInSearchKeyword || this.hospitalInSearchKeyword.trim() === '') {
-        this.hospitalInResults = [...this.defaultHospitals]
+        // 濡傛灉宸茬粡鍔犺浇杩囧父鐢ㄥ尰闄紝鐩存帴鏄剧ず
+        if (this.hospitalInResults.length > 0) {
+          this.showHospitalInResults = true
+          return
+        }
+        
+        // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
+        if (this.selectedOrganizationServiceOrderClass) {
+          getFrequentInHospitals(this.selectedOrganizationServiceOrderClass, '').then(response => {
+            const allHospitals = response.data || []
+            // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+            this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+            // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+            if (this.hospitalInResults.length === 0) {
+              searchHospitals('', '').then(res => {
+                const allHospitals = res.data || []
+                this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+              })
+            }
+          }).catch(error => {
+            console.error('鍔犺浇甯哥敤杞叆鍖婚櫌澶辫触:', error)
+            searchHospitals('', '').then(res => {
+              const allHospitals = res.data || []
+              this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+            })
+          })
+        } else {
+          // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
+          searchHospitals('', '').then(response => {
+            const allHospitals = response.data || []
+            // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+            this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+          }).catch(error => {
+            console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
+            this.hospitalInResults = []
+          })
+        }
       }
       this.showHospitalInResults = true
     },
@@ -885,27 +1160,37 @@
         clearTimeout(this.searchTimer)
       }
       
-      // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず榛樿100鏉�
+      // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず鎵�鏈夊尰闄紙鏈湴鍖哄煙浼樺厛锛�
       if (!keyword || keyword.trim() === '') {
-        this.hospitalInResults = [...this.defaultHospitals]
+        searchHospitals('', '').then(response => {
+          const allHospitals = response.data || []
+          // 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
+          this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+        }).catch(error => {
+          console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
+          this.hospitalInResults = []
+        })
         this.showHospitalInResults = true
         return
       }
       
-      // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储
+      // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储锛堜笉闄愬尯鍩燂紝浣嗙粨鏋滄寜鍦板煙鎺掑簭锛�
       this.searchTimer = setTimeout(() => {
         this.searchHospitalIn(keyword)
       }, 300)
     },
     
-    // 鎼滅储杞叆鍖婚櫌
+    // 鎼滅储杞叆鍖婚櫌锛堜笉闄愬尯鍩燂紝浣嗘湰鍦板尯鍩熶紭鍏堬級
     searchHospitalIn(keyword) {
-      // 浼犲叆鍏抽敭璇嶅拰鍦板煙杩囨护
-      searchHospitals(keyword, this.selectedRegion).then(response => {
-        this.hospitalInResults = response.data || []
+      // 浼犲叆鍏抽敭璇嶏紝涓嶄紶鍦板煙杩囨护锛堟悳绱㈡墍鏈夊尯鍩燂級
+      searchHospitals(keyword, '').then(response => {
+        const allHospitals = response.data || []
+        // 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
+        this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
         this.showHospitalInResults = true
+        console.log('鎼滅储杞叆鍖婚櫌:', keyword, '缁撴灉鏁�:', this.hospitalInResults.length)
       }).catch(error => {
-        console.error('鎼滅储鍖婚櫌澶辫触:', error)
+        console.error('鎼滅储杞叆鍖婚櫌澶辫触:', error)
         this.hospitalInResults = []
       })
     },
@@ -914,20 +1199,38 @@
     selectHospitalIn(hospital) {
       this.taskForm.hospitalIn.id = hospital.hospId  // 淇濆瓨鍖婚櫌ID
       this.taskForm.hospitalIn.name = hospital.hospName
-      // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
-      const fullAddress = this.buildFullAddress(hospital)
-      this.taskForm.hospitalIn.address = fullAddress
+      // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛屾竻绌哄湴鍧�璁╃敤鎴锋墜鍔ㄨ緭鍏ワ紱鍚﹀垯鑷姩濉厖鍦板潃
+      if (hospital.hospName === '瀹朵腑') {
+        this.taskForm.hospitalIn.address = ''
+        // 绉戝鑷姩璁剧疆涓�"鍏跺畠"
+        this.taskForm.hospitalIn.department = '鍏跺畠'
+        this.taskForm.hospitalIn.departmentId = null
+      } else {
+        // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
+        const fullAddress = this.buildFullAddress(hospital)
+        this.taskForm.hospitalIn.address = fullAddress
+        // 娓呯┖绉戝锛岃鐢ㄦ埛閲嶆柊閫夋嫨
+        if (this.taskForm.hospitalIn.department === '鍏跺畠') {
+          this.taskForm.hospitalIn.department = ''
+          this.taskForm.hospitalIn.departmentId = null
+        }
+      }
       this.hospitalInSearchKeyword = hospital.hospName
       this.showHospitalInResults = false
       this.hospitalInResults = []
       
-      // 濡傛灉鏈塆PS鍧愭爣锛屼繚瀛樹笅鏉�
-      this.addressCoordinates.hospitalInAddress = null
+      // 淇濆瓨杞叆鍖婚櫌鐨勫煄甯備俊鎭�
+      this.taskForm.hospitalIn.city = hospital.hopsCity || ''
       
-      // 濡傛灉涓や釜鍖婚櫌閮藉凡閫夋嫨锛岃嚜鍔ㄨ绠楄窛绂�
+      // 濡傛灉杞嚭鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalOut.address) {
-        // 杩欓噷鍙互璋冪敤鍦板潃瑙f瀽鍜岃窛绂昏绠�
-        // 鏆傛椂鐣欑┖锛岀敱鐢ㄦ埛鎵嬪姩杈撳叆璺濈
+        // 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
+        if (hospital.hospName !== '瀹朵腑' && this.taskForm.hospitalOut.name !== '瀹朵腑') {
+          this.calculateHospitalDistance()
+        } else {
+          // 鏈変竴涓槸"瀹朵腑",浣跨敤鍦板潃璁$畻
+          this.calculateDistanceByManualAddress()
+        }
       }
     },
     
@@ -1107,6 +1410,208 @@
       this.showStaffSelector()
     },
     
+    // ==================== 鍦板潃杈撳叆鑱旀兂鐩稿叧鏂规硶 ====================
+    
+    // 杞嚭鍦板潃杈撳叆鐩戝惉
+    onAddressOutInput(e) {
+      const query = e.detail.value
+      this.taskForm.hospitalOut.address = query
+      
+      // 闃叉姈澶勭悊
+      if (this.addressSearchTimer) {
+        clearTimeout(this.addressSearchTimer)
+      }
+      
+      // 濡傛灉杈撳叆涓虹┖锛岄殣钘忔彁绀哄垪琛�
+      if (!query || query.trim() === '') {
+        this.showAddressOutSuggestions = false
+        this.addressOutSuggestions = []
+        return
+      }
+      
+      // 杈撳叆闀垮害澶т簬2鎵嶅紑濮嬫悳绱�
+      if (query.trim().length < 2) {
+        this.showAddressOutSuggestions = false
+        return
+      }
+      
+      // 寤惰繜300ms鎼滅储
+      this.addressSearchTimer = setTimeout(() => {
+        this.searchAddressOut(query)
+      }, 300)
+    },
+    
+    // 杞嚭鍦板潃杈撳叆妗嗚幏寰楃劍鐐�
+    onAddressOutFocus() {
+      // 濡傛灉鏈夊湴鍧�涓旀湁鎼滅储缁撴灉锛屾樉绀烘彁绀哄垪琛�
+      if (this.taskForm.hospitalOut.address && this.addressOutSuggestions.length > 0) {
+        this.showAddressOutSuggestions = true
+      }
+    },
+    
+    // 鎼滅储杞嚭鍦板潃
+    searchAddressOut(query) {
+      // 鑾峰彇褰撳墠鍖哄煙锛堜紭鍏堜娇鐢ㄥ綊灞炴満鏋勭殑鍖哄煙锛�
+      const region = this.selectedRegion || '骞垮窞'
+      
+      baiduPlaceSuggestion(query, region).then(response => {
+        if (response.code === 200 && response.data) {
+          this.addressOutSuggestions = response.data
+          this.showAddressOutSuggestions = true
+        } else {
+          this.addressOutSuggestions = []
+          this.showAddressOutSuggestions = false
+        }
+      }).catch(error => {
+        console.error('鎼滅储杞嚭鍦板潃澶辫触:', error)
+        this.addressOutSuggestions = []
+        this.showAddressOutSuggestions = false
+      })
+    },
+    
+    // 閫夋嫨杞嚭鍦板潃
+    selectAddressOut(item) {
+      // 濉厖瀹屾暣鍦板潃
+      const fullAddress = item.district + item.address
+      this.taskForm.hospitalOut.address = fullAddress
+      
+      // 淇濆瓨缁忕含搴︼紙濡傛灉鏈夛級
+      if (item.location) {
+        this.taskForm.hospitalOut.latitude = item.location.lat
+        this.taskForm.hospitalOut.longitude = item.location.lng
+      }
+      
+      // 闅愯棌鎻愮ず鍒楄〃
+      this.showAddressOutSuggestions = false
+      this.addressOutSuggestions = []
+      
+      // 濡傛灉杞叆鍦板潃涔熷凡濉啓,鑷姩璁$畻璺濈
+      if (this.taskForm.hospitalIn.address) {
+        this.calculateDistanceByManualAddress()
+      }
+    },
+    
+    // 杞叆鍦板潃杈撳叆鐩戝惉
+    onAddressInInput(e) {
+      const query = e.detail.value
+      this.taskForm.hospitalIn.address = query
+      
+      // 闃叉姈澶勭悊
+      if (this.addressSearchTimer) {
+        clearTimeout(this.addressSearchTimer)
+      }
+      
+      // 濡傛灉杈撳叆涓虹┖锛岄殣钘忔彁绀哄垪琛�
+      if (!query || query.trim() === '') {
+        this.showAddressInSuggestions = false
+        this.addressInSuggestions = []
+        return
+      }
+      
+      // 杈撳叆闀垮害澶т簬2鎵嶅紑濮嬫悳绱�
+      if (query.trim().length < 2) {
+        this.showAddressInSuggestions = false
+        return
+      }
+      
+      // 寤惰繜300ms鎼滅储
+      this.addressSearchTimer = setTimeout(() => {
+        this.searchAddressIn(query)
+      }, 300)
+    },
+    
+    // 杞叆鍦板潃杈撳叆妗嗚幏寰楃劍鐐�
+    onAddressInFocus() {
+      // 濡傛灉鏈夊湴鍧�涓旀湁鎼滅储缁撴灉锛屾樉绀烘彁绀哄垪琛�
+      if (this.taskForm.hospitalIn.address && this.addressInSuggestions.length > 0) {
+        this.showAddressInSuggestions = true
+      }
+    },
+    
+    // 鎼滅储杞叆鍦板潃
+    searchAddressIn(query) {
+      // 鑾峰彇褰撳墠鍖哄煙锛堜紭鍏堜娇鐢ㄥ綊灞炴満鏋勭殑鍖哄煙锛�
+      const region = this.selectedRegion || '骞垮窞'
+      
+      baiduPlaceSuggestion(query, region).then(response => {
+        if (response.code === 200 && response.data) {
+          this.addressInSuggestions = response.data
+          this.showAddressInSuggestions = true
+        } else {
+          this.addressInSuggestions = []
+          this.showAddressInSuggestions = false
+        }
+      }).catch(error => {
+        console.error('鎼滅储杞叆鍦板潃澶辫触:', error)
+        this.addressInSuggestions = []
+        this.showAddressInSuggestions = false
+      })
+    },
+    
+    // 閫夋嫨杞叆鍦板潃
+    selectAddressIn(item) {
+      // 濉厖瀹屾暣鍦板潃
+      const fullAddress = item.district + item.address
+      this.taskForm.hospitalIn.address = fullAddress
+      
+      // 淇濆瓨缁忕含搴︼紙濡傛灉鏈夛級
+      if (item.location) {
+        this.taskForm.hospitalIn.latitude = item.location.lat
+        this.taskForm.hospitalIn.longitude = item.location.lng
+      }
+      
+      // 闅愯棌鎻愮ず鍒楄〃
+      this.showAddressInSuggestions = false
+      this.addressInSuggestions = []
+      
+      // 濡傛灉杞嚭鍦板潃涔熷凡濉啓,鑷姩璁$畻璺濈
+      if (this.taskForm.hospitalOut.address) {
+        this.calculateDistanceByManualAddress()
+      }
+    },
+    
+    // 鎵嬪姩杈撳叆鍦板潃鏃惰绠楄窛绂�
+    calculateDistanceByManualAddress() {
+      const fromAddress = this.taskForm.hospitalOut.address
+      const toAddress = this.taskForm.hospitalIn.address
+      
+      if (!fromAddress || !toAddress) {
+        return
+      }
+      
+      console.log('璁$畻鎵嬪姩杈撳叆鍦板潃璺濈:', fromAddress, '->', toAddress)
+      
+      // 鏄剧ず鍔犺浇鎻愮ず
+      uni.showLoading({
+        title: '璁$畻璺濈涓�...'
+      })
+      
+      // 璋冪敤鐧惧害鍦板浘API璁$畻璺濈
+      const region = this.selectedRegion || '骞垮窞'
+      baiduDistanceByAddress(fromAddress, region, toAddress, region)
+        .then(response => {
+          uni.hideLoading()
+          
+          if (response.code === 200 && response.data) {
+            const distanceInMeters = response.data.distance
+            // 杞崲涓哄叕閲岋紝淇濈枡1浣嶅皬鏁�
+            const distanceInKm = (distanceInMeters / 1000).toFixed(1)
+            this.taskForm.transferDistance = distanceInKm
+            
+            console.log('璺濈璁$畻鎴愬姛:', distanceInKm, 'km')
+            this.$modal.showToast(`璺濈: ${distanceInKm}鍏噷`)
+          } else {
+            console.error('璺濈璁$畻澶辫触:', response.msg)
+            this.$modal.showToast('璺濈璁$畻澶辫触,璇锋墜鍔ㄨ緭鍏�')
+          }
+        })
+        .catch(error => {
+          uni.hideLoading()
+          console.error('璺濈璁$畻澶辫触:', error)
+          this.$modal.showToast('璺濈璁$畻澶辫触,璇锋墜鍔ㄨ緭鍏�')
+        })
+    },
+    
     // ==================== 鐥呮儏閫夋嫨鐩稿叧鏂规硶 ====================
     
     // 鏄剧ず鐥呮儏閫夋嫨寮圭獥
@@ -1206,9 +1711,28 @@
       this.selectedDiseases.splice(index, 1)
     },
     
+    // 璁剧疆榛樿杞繍鏃堕棿涓哄綋鍓嶆椂闂�
+    setDefaultTransferTime() {
+      const now = new Date()
+      const year = now.getFullYear()
+      const month = String(now.getMonth() + 1).padStart(2, '0')
+      const day = String(now.getDate()).padStart(2, '0')
+      const hours = String(now.getHours()).padStart(2, '0')
+      const minutes = String(now.getMinutes()).padStart(2, '0')
+      const seconds = String(now.getSeconds()).padStart(2, '0')
+      
+      // 鏍煎紡鍖栦负 YYYY-MM-DD HH:mm:ss
+      this.taskForm.transferTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
+    },
+    
     validateForm() {
       if (!this.selectedVehicleId) {
         this.$modal.showToast('璇烽�夋嫨浠诲姟杞﹁締')
+        return false
+      }
+      
+      if (!this.selectedOrganizationId) {
+        this.$modal.showToast('璇烽�夋嫨褰掑睘鏈烘瀯')
         return false
       }
       
@@ -1219,6 +1743,11 @@
       
       if (!this.selectedDocumentType) {
         this.$modal.showToast('璇烽�夋嫨鍗曟嵁绫诲瀷')
+        return false
+      }
+      
+      if (!this.taskForm.transferTime) {
+        this.$modal.showToast('璇烽�夋嫨杞繍鏃堕棿')
         return false
       }
       
@@ -1254,6 +1783,16 @@
       
       if (!this.taskForm.hospitalIn.department) {
         this.$modal.showToast('璇烽�夋嫨杞叆鍖婚櫌绉戝')
+        return false
+      }
+      
+      if (!this.taskForm.transferDistance) {
+        this.$modal.showToast('璇疯緭鍏ヨ浆杩愬叕閲屾暟')
+        return false
+      }
+      
+      if (!this.taskForm.price) {
+        this.$modal.showToast('璇疯緭鍏ユ垚浜や环')
         return false
       }
       
@@ -1382,6 +1921,50 @@
         parts.push(hospital.hospAddress)
       }
       return parts.join('')
+    },
+    
+    // 鑷姩璁$畻涓や釜鍖婚櫌涔嬮棿鐨勮窛绂�
+    calculateHospitalDistance() {
+      const fromAddress = this.taskForm.hospitalOut.address
+      const fromCity = this.taskForm.hospitalOut.city
+      const toAddress = this.taskForm.hospitalIn.address
+      const toCity = this.taskForm.hospitalIn.city
+      
+      if (!fromAddress || !toAddress) {
+        console.log('鍦板潃淇℃伅涓嶅畬鏁达紝鏃犳硶璁$畻璺濈')
+        return
+      }
+      
+      console.log('寮�濮嬭绠楄窛绂�:', fromAddress, '->', toAddress)
+      
+      // 鏄剧ず鍔犺浇鎻愮ず
+      uni.showLoading({
+        title: '璁$畻璺濈涓�...'
+      })
+      
+      // 璋冪敤鐧惧害鍦板浘API璁$畻璺濈
+      baiduDistanceByAddress(fromAddress, fromCity, toAddress, toCity)
+        .then(response => {
+          uni.hideLoading()
+          
+          if (response.code === 200 && response.data) {
+            const distanceInMeters = response.data.distance
+            // 杞崲涓哄叕閲岋紝淇濈暀1浣嶅皬鏁�
+            const distanceInKm = (distanceInMeters / 1000).toFixed(1)
+            this.taskForm.transferDistance = distanceInKm
+            
+            console.log('璺濈璁$畻鎴愬姛:', distanceInKm, 'km')
+            // this.$modal.showToast(`璺濈璁$畻鎴愬姛: ${distanceInKm}鍏噷`)
+          } else {
+            console.error('璺濈璁$畻澶辫触:', response.msg)
+            this.$modal.showToast('璺濈璁$畻澶辫触锛岃鎵嬪姩杈撳叆')
+          }
+        })
+        .catch(error => {
+          uni.hideLoading()
+          console.error('璺濈璁$畻澶辫触:', error)
+          this.$modal.showToast('璺濈璁$畻澶辫触锛岃鎵嬪姩杈撳叆')
+        })
     }
   }
 }
@@ -1480,6 +2063,14 @@
               color: #333;
               font-weight: bold;
               margin-bottom: 8rpx;
+              
+              .hospital-short {
+                display: block;
+                font-size: 22rpx;
+                color: #999;
+                font-weight: normal;
+                margin-top: 6rpx;
+              }
             }
             
             .hospital-address {
@@ -1490,6 +2081,49 @@
         }
       }
       
+      .address-input-container {
+        position: relative;
+        
+        .address-suggestions {
+          position: absolute;
+          top: 75rpx;
+          left: 0;
+          right: 0;
+          max-height: 400rpx;
+          background-color: white;
+          border: 1rpx solid #eee;
+          border-radius: 10rpx;
+          box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
+          z-index: 100;
+          overflow-y: auto;
+          
+          .address-suggestion-item {
+            padding: 20rpx 30rpx;
+            border-bottom: 1rpx solid #f0f0f0;
+            
+            &:last-child {
+              border-bottom: none;
+            }
+            
+            &:active {
+              background-color: #f5f5f5;
+            }
+            
+            .suggestion-name {
+              font-size: 28rpx;
+              color: #333;
+              font-weight: bold;
+              margin-bottom: 8rpx;
+            }
+            
+            .suggestion-address {
+              font-size: 24rpx;
+              color: #999;
+            }
+          }
+        }
+      }
+      
       .form-input {
         height: 70rpx;
         padding: 0 20rpx;

--
Gitblit v1.9.1