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 |  442 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 409 insertions(+), 33 deletions(-)

diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index 094a808..4ad6a63 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -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,7 +311,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.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>
@@ -443,7 +505,7 @@
 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, baiduDistanceByAddress } from "@/api/map"
+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"
@@ -481,6 +543,12 @@
       showHospitalInResults: false,
       searchTimer: null,
       defaultHospitals: [], // 榛樿鐨�100鏉″尰闄㈡暟鎹�
+      // 鍦板潃鎼滅储鎻愮ず鐩稿叧
+      addressOutSuggestions: [], // 杞嚭鍦板潃鎻愮ず鍒楄〃
+      showAddressOutSuggestions: false,
+      addressInSuggestions: [], // 杞叆鍦板潃鎻愮ず鍒楄〃
+      showAddressInSuggestions: false,
+      addressSearchTimer: null, // 鍦板潃鎼滅储闃叉姈瀹氭椂鍣�
       // 浜哄憳閫夋嫨鐩稿叧
       selectedStaff: [], // 宸查�夋嫨鐨勪汉鍛樺垪琛�
       allStaffList: [], // 鎵�鏈変汉鍛樺垪琛�
@@ -873,22 +941,30 @@
       })
     },
     
-    // 鎸夊湴鍩熸帓搴忓尰闄細鏈湴鍖哄煙浼樺厛
+    // 鎸夊湴鍩熸帓搴忓尰闄細鏈湴鍖哄煙浼樺厛锛�"瀹朵腑"濮嬬粓鍦ㄦ渶鍓嶉潰
     sortHospitalsByRegion(hospitals) {
-      if (!this.selectedRegion || !hospitals || hospitals.length === 0) {
+      if (!hospitals || hospitals.length === 0) {
         return hospitals
       }
       
       const region = this.selectedRegion
-      const localHospitals = []
-      const otherHospitals = []
+      const homeHospital = []  // "瀹朵腑"
+      const localHospitals = []  // 鏈湴鍖婚櫌
+      const otherHospitals = []  // 鍏朵粬鍖婚櫌
       
       hospitals.forEach(hospital => {
+        // "瀹朵腑"浼樺厛澶勭悊锛屾斁鍦ㄦ渶鍓嶉潰
+        if (hospital.hospName === '瀹朵腑') {
+          homeHospital.push(hospital)
+          return
+        }
+        
         // 鍒ゆ柇鍖婚櫌鏄惁鍦ㄦ湰鍦板尯鍩燂紙鐪併�佸競銆佸尯浠讳竴鍖呭惈鍦板煙鍏抽敭璇嶏級
-        const isLocal = 
+        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)
@@ -897,8 +973,8 @@
         }
       })
       
-      // 鏈湴鍖婚櫌鍦ㄥ墠锛屽叾浠栧尰闄㈠湪鍚�
-      return [...localHospitals, ...otherHospitals]
+      // "瀹朵腑"鍦ㄦ渶鍓嶏紝鏈湴鍖婚櫌鍏舵锛屽叾浠栧尰闄㈠湪鍚�
+      return [...homeHospital, ...localHospitals, ...otherHospitals]
     },
     
     // 杞嚭鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
@@ -914,23 +990,28 @@
         // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
         if (this.selectedOrganizationServiceOrderClass) {
           getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
-            this.hospitalOutResults = response.data || []
+            const hospitals = response.data || []
+            // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
+            this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
             // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
             if (this.hospitalOutResults.length === 0) {
               searchHospitals('', this.selectedRegion).then(res => {
-                this.hospitalOutResults = res.data || []
+                const hospitals = res.data || []
+                this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
               })
             }
           }).catch(error => {
             console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
             searchHospitals('', this.selectedRegion).then(res => {
-              this.hospitalOutResults = res.data || []
+              const hospitals = res.data || []
+              this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
             })
           })
         } else {
           // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
           searchHospitals('', this.selectedRegion).then(response => {
-            this.hospitalOutResults = response.data || []
+            const hospitals = response.data || []
+            this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
           }).catch(error => {
             console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
             this.hospitalOutResults = []
@@ -950,10 +1031,12 @@
         clearTimeout(this.searchTimer)
       }
       
-      // 濡傛灉鍏抽敭璇嶄负绌猴紝鍙樉绀哄綋鍓嶅尯鍩熺殑鍖婚櫌
+      // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず褰撳墠鍖哄煙鐨勫尰闄�
       if (!keyword || keyword.trim() === '') {
         searchHospitals('', this.selectedRegion).then(response => {
-          this.hospitalOutResults = response.data || []
+          const hospitals = response.data || []
+          // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
+          this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
         }).catch(error => {
           console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
           this.hospitalOutResults = []
@@ -972,7 +1055,9 @@
     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 => {
@@ -985,9 +1070,22 @@
     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 = []
@@ -995,9 +1093,15 @@
       // 淇濆瓨杞嚭鍖婚櫌鐨勫煄甯備俊鎭�
       this.taskForm.hospitalOut.city = hospital.hopsCity || ''
       
-      // 濡傛灉涓や釜鍖婚櫌閮藉凡閫夋嫨锛岃嚜鍔ㄨ绠楄窛绂�
+      // 濡傛灉杞叆鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalIn.address) {
-        this.calculateHospitalDistance()
+        // 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
+        if (hospital.hospName !== '瀹朵腑' && this.taskForm.hospitalIn.name !== '瀹朵腑') {
+          this.calculateHospitalDistance()
+        } else {
+          // 鏈変竴涓槸"瀹朵腑",浣跨敤鍦板潃璁$畻
+          this.calculateDistanceByManualAddress()
+        }
       }
     },
     
@@ -1060,7 +1164,7 @@
       if (!keyword || keyword.trim() === '') {
         searchHospitals('', '').then(response => {
           const allHospitals = response.data || []
-          // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+          // 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
           this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
         }).catch(error => {
           console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
@@ -1081,7 +1185,7 @@
       // 浼犲叆鍏抽敭璇嶏紝涓嶄紶鍦板煙杩囨护锛堟悳绱㈡墍鏈夊尯鍩燂級
       searchHospitals(keyword, '').then(response => {
         const allHospitals = response.data || []
-        // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+        // 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
         this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
         this.showHospitalInResults = true
         console.log('鎼滅储杞叆鍖婚櫌:', keyword, '缁撴灉鏁�:', this.hospitalInResults.length)
@@ -1095,9 +1199,22 @@
     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 = []
@@ -1105,9 +1222,15 @@
       // 淇濆瓨杞叆鍖婚櫌鐨勫煄甯備俊鎭�
       this.taskForm.hospitalIn.city = hospital.hopsCity || ''
       
-      // 濡傛灉涓や釜鍖婚櫌閮藉凡閫夋嫨锛岃嚜鍔ㄨ绠楄窛绂�
+      // 濡傛灉杞嚭鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalOut.address) {
-        this.calculateHospitalDistance()
+        // 濡傛灉涓や釜閮戒笉鏄�"瀹朵腑",浣跨敤鍖婚櫌璺濈璁$畻
+        if (hospital.hospName !== '瀹朵腑' && this.taskForm.hospitalOut.name !== '瀹朵腑') {
+          this.calculateHospitalDistance()
+        } else {
+          // 鏈変竴涓槸"瀹朵腑",浣跨敤鍦板潃璁$畻
+          this.calculateDistanceByManualAddress()
+        }
       }
     },
     
@@ -1285,6 +1408,208 @@
     
     addStaff() {
       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('璺濈璁$畻澶辫触,璇锋墜鍔ㄨ緭鍏�')
+        })
     },
     
     // ==================== 鐥呮儏閫夋嫨鐩稿叧鏂规硶 ====================
@@ -1738,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 {
@@ -1748,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