From a062db35a946c65352467a473990548987cd8b9e Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期二, 11 十一月 2025 09:59:25 +0800
Subject: [PATCH] fix:更新登录
---
app/pages/task/create-emergency.vue | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index 933ece3..a5876c9 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -342,6 +342,7 @@
type="digit"
placeholder="璇疯緭鍏ヨ浆杩愬叕閲屾暟"
v-model="taskForm.transferDistance"
+ @blur="onDistanceChange"
/>
</view>
@@ -509,6 +510,7 @@
import { searchHospitals, getFrequentOutHospitals, getFrequentInHospitals, searchHospitalsByDeptRegion } from "@/api/hospital"
import { listBranchUsers } from "@/api/system/user"
import { searchIcd10 } from "@/api/icd10"
+import { calculateTransferPrice } from "@/api/price"
import { getDicts } from "@/api/dict"
import { getServiceOrdAreaTypes, getServiceOrderTypes, getHospitalDepartments } from "@/api/dictionary"
@@ -1592,6 +1594,9 @@
console.log('璺濈璁$畻鎴愬姛:', distanceInKm, 'km')
this.$modal.showToast(`璺濈: ${distanceInKm}鍏噷`)
+
+ // 璺濈璁$畻鎴愬姛鍚庯紝鑷姩璁$畻鎴愪氦浠�
+ this.calculatePrice()
} else {
console.error('璺濈璁$畻澶辫触:', response.msg)
this.$modal.showToast('璺濈璁$畻澶辫触,璇锋墜鍔ㄨ緭鍏�')
@@ -1602,6 +1607,52 @@
console.error('璺濈璁$畻澶辫触:', error)
this.$modal.showToast('璺濈璁$畻澶辫触,璇锋墜鍔ㄨ緭鍏�')
})
+ },
+
+ // 璺濈杈撳叆妗嗗け鐒︽椂瑙﹀彂鎴愪氦浠疯绠�
+ onDistanceChange() {
+ this.calculatePrice()
+ },
+
+ // 璁$畻鎴愪氦浠�
+ calculatePrice() {
+ const fromAddress = this.taskForm.hospitalOut.address
+ const toAddress = this.taskForm.hospitalIn.address
+ const distance = this.taskForm.transferDistance
+
+ // 濡傛灉鍦板潃鎴栬窛绂讳笉瀹屾暣锛屼笉杩涜璁$畻
+ if (!fromAddress || !toAddress || !distance || parseFloat(distance) <= 0) {
+ console.log('鍦板潃鎴栬窛绂讳俊鎭笉瀹屾暣锛岃烦杩囨垚浜や环璁$畻')
+ return
+ }
+
+ console.log('寮�濮嬭绠楁垚浜や环:', fromAddress, '->', toAddress, '璺濈:', distance)
+
+ // 璋冪敤鎴愪氦浠疯绠楁帴鍙�
+ calculateTransferPrice({
+ fromAddress: fromAddress,
+ toAddress: toAddress,
+ distance: parseFloat(distance),
+ region: this.selectedRegion || ''
+ }).then(response => {
+ if (response.code === 200 && response.data) {
+ const price = response.data.price
+
+ // 鍙湁褰撹繑鍥炵殑浠锋牸澶т簬0鏃讹紝鎵嶈嚜鍔ㄥ~鍏呮垚浜や环
+ if (price && price > 0) {
+ this.taskForm.price = price.toFixed(2)
+ console.log('鎴愪氦浠疯绠楁垚鍔�:', price)
+ this.$modal.showToast(`鎴愪氦浠�: 楼${price.toFixed(2)}`)
+ } else {
+ console.log('鎴愪氦浠蜂负0锛屼笉鑷姩濉厖')
+ }
+ } else {
+ console.log('鎴愪氦浠疯绠楀け璐ワ紝淇濇寔鎵嬪姩杈撳叆')
+ }
+ }).catch(error => {
+ console.error('鎴愪氦浠疯绠楀け璐�:', error)
+ // 璁$畻澶辫触鏃朵笉鎻愮ず鐢ㄦ埛锛屽厑璁哥敤鎴锋墜鍔ㄨ緭鍏�
+ })
},
// ==================== 鐥呮儏閫夋嫨鐩稿叧鏂规硶 ====================
@@ -1954,6 +2005,9 @@
console.log('璺濈璁$畻鎴愬姛:', distanceInKm, 'km')
// this.$modal.showToast(`璺濈璁$畻鎴愬姛: ${distanceInKm}鍏噷`)
+
+ // 璺濈璁$畻鎴愬姛鍚庯紝鑷姩璁$畻鎴愪氦浠�
+ this.calculatePrice()
} else {
console.error('璺濈璁$畻澶辫触:', response.msg)
this.$modal.showToast('璺濈璁$畻澶辫触锛岃鎵嬪姩杈撳叆')
--
Gitblit v1.9.1