From 5f2ee03958a1a16dc27195c76ea7cffb422c95d1 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 19 十二月 2025 22:40:34 +0800
Subject: [PATCH] feat: 任务修改接口,删除一些不要的字段同步

---
 app/pagesTask/edit-emergency.vue |   63 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/app/pagesTask/edit-emergency.vue b/app/pagesTask/edit-emergency.vue
index 4790118..24f3a97 100644
--- a/app/pagesTask/edit-emergency.vue
+++ b/app/pagesTask/edit-emergency.vue
@@ -231,7 +231,7 @@
 import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
 import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
 import { getTask, updateTask } from "@/api/task"
-import { baiduDistanceByAddress } from "@/api/map"
+import { tiandituDistanceByAddress } from "@/api/map"
 import { calculateTransferPrice } from "@/api/price"
 import MapSelector from './components/map-selector.vue'
 import VehicleSelector from './components/VehicleSelector.vue'
@@ -569,6 +569,7 @@
         this.taskForm.hospitalOut.department = '鍏跺畠'
         this.taskForm.hospitalOut.departmentId = null
       }
+      // 娉ㄦ剰锛氶�夋嫨鏂扮殑鍖婚櫌鏃讹紝涓嶈嚜鍔ㄦ洿鏂扮瀹や俊鎭紝淇濇寔鐢ㄦ埛宸查�夋嫨鐨勭瀹�
       
       // 濡傛灉杞叆鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalIn.address) {
@@ -599,6 +600,7 @@
         this.taskForm.hospitalIn.department = '鍏跺畠'
         this.taskForm.hospitalIn.departmentId = null
       }
+      // 娉ㄦ剰锛氶�夋嫨鏂扮殑鍖婚櫌鏃讹紝涓嶈嚜鍔ㄦ洿鏂扮瀹や俊鎭紝淇濇寔鐢ㄦ埛宸查�夋嫨鐨勭瀹�
       
       // 濡傛灉杞嚭鍦板潃宸插~鍐�,鑷姩璁$畻璺濈
       if (this.taskForm.hospitalOut.address) {
@@ -621,6 +623,7 @@
     
     // 杞嚭绉戝鍙樺寲
     onHospitalOutDepartmentChange(data) {
+      console.log('杞嚭绉戝鍙樺寲:', data)
       if (data && typeof data === 'object') {
         this.taskForm.hospitalOut.department = data.department
         this.taskForm.hospitalOut.departmentId = data.departmentId
@@ -632,6 +635,7 @@
     
     // 杞叆绉戝鍙樺寲
     onHospitalInDepartmentChange(data) {
+      console.log('杞叆绉戝鍙樺寲:', data)
       if (data && typeof data === 'object') {
         this.taskForm.hospitalIn.department = data.department
         this.taskForm.hospitalIn.departmentId = data.departmentId
@@ -826,6 +830,12 @@
         return false
       }
       
+      // 楠岃瘉鑱旂郴鐢佃瘽鏍煎紡
+      if (this.taskForm.patient.phone && !/^1[3-9]\d{9}$/.test(this.taskForm.patient.phone)) {
+        this.$modal.showToast('璇疯緭鍏ユ纭殑鎵嬫満鍙风爜')
+        return false
+      }
+      
       if (!this.taskForm.hospitalOut.name) {
         this.$modal.showToast('璇疯緭鍏ヨ浆鍑哄尰闄㈠悕绉�')
         return false
@@ -836,6 +846,11 @@
         return false
       }
       
+      if (!this.taskForm.hospitalOut.department) {
+        this.$modal.showToast('璇烽�夋嫨杞嚭绉戝')
+        return false
+      }
+      
       if (!this.taskForm.hospitalIn.name) {
         this.$modal.showToast('璇疯緭鍏ヨ浆鍏ュ尰闄㈠悕绉�')
         return false
@@ -843,6 +858,46 @@
       
       if (!this.taskForm.hospitalIn.address) {
         this.$modal.showToast('璇烽�夋嫨杞叆鍖婚櫌鍦板潃')
+        return false
+      }
+      
+      if (!this.taskForm.hospitalIn.department) {
+        this.$modal.showToast('璇烽�夋嫨杞叆绉戝')
+        return false
+      }
+      
+      // 楠岃瘉鎴愪氦浠峰繀濉�
+      if (!this.taskForm.price || this.taskForm.price.trim() === '') {
+        this.$modal.showToast('璇疯緭鍏ユ垚浜や环')
+        return false
+      }
+      
+      // 楠岃瘉鎴愪氦浠锋牸寮忥紙蹇呴』鏄暟瀛楋級
+      if (isNaN(this.taskForm.price) || parseFloat(this.taskForm.price) < 0) {
+        this.$modal.showToast('璇疯緭鍏ユ湁鏁堢殑鎴愪氦浠�')
+        return false
+      }
+      
+      // 楠岃瘉鎮h�呰韩浠借瘉鏍煎紡锛堝鏋滃~鍐欎簡锛�
+      if (this.taskForm.patient.idCard && this.taskForm.patient.idCard.trim() !== '') {
+        const idCard = this.taskForm.patient.idCard.trim()
+        // 绠�鍗曢獙璇�18浣嶈韩浠借瘉
+        if (!/^\d{17}[\dXx]$/.test(idCard)) {
+          this.$modal.showToast('璇疯緭鍏ユ纭殑18浣嶈韩浠借瘉鍙风爜')
+          return false
+        }
+      }
+      
+      // 楠岃瘉鐥呮儏鑷冲皯閫夋嫨涓�椤规垨濉啓鍏朵粬鎻忚堪
+      if ((!this.selectedDiseases || this.selectedDiseases.length === 0) && 
+          (!this.taskForm.patient.otherCondition || this.taskForm.patient.otherCondition.trim() === '')) {
+        this.$modal.showToast('璇烽�夋嫨鐥呮儏鎴栧~鍐欏叾浠栫梾鎯呮弿杩�')
+        return false
+      }
+      
+      // 楠岃瘉鎵ц浜哄憳鑷冲皯閫夋嫨涓�涓�
+      if (!this.selectedStaff || this.selectedStaff.length === 0) {
+        this.$modal.showToast('璇疯嚦灏戦�夋嫨涓�涓墽琛屼汉鍛�')
         return false
       }
       
@@ -1008,7 +1063,8 @@
       
       // 璋冪敤鐧惧害鍦板浘API璁$畻璺濈
       const region = this.selectedRegion || '骞垮窞'
-      baiduDistanceByAddress(fromAddress, region, toAddress, region)
+      //baiduDistanceByAddress(fromAddress, region, toAddress, region)
+      tiandituDistanceByAddress(fromAddress,toAddress)
         .then(response => {
           uni.hideLoading()
           
@@ -1333,5 +1389,4 @@
       }
     }
   }
-}
-</style>
\ No newline at end of file
+}
\ No newline at end of file

--
Gitblit v1.9.1