From b30c1ebb0e46e734e70f8731484764f449f48818 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期三, 24 十二月 2025 00:04:30 +0800
Subject: [PATCH] feat:已完成时,增加知情同意书的上传判断

---
 app/pagesTask/detail.vue |  179 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 136 insertions(+), 43 deletions(-)

diff --git a/app/pagesTask/detail.vue b/app/pagesTask/detail.vue
index c84acb7..6e0fdee 100644
--- a/app/pagesTask/detail.vue
+++ b/app/pagesTask/detail.vue
@@ -12,7 +12,11 @@
         <view class="section-title">鍩烘湰淇℃伅</view>
         <view class="info-item">
           <view class="label">浠诲姟缂栧彿</view>
-          <view class="value">{{ taskDetail.taskCode }}</view>
+          <view class="value">
+            {{ taskDetail.showTaskCode }}
+            <text v-if="taskDetail.emergencyInfo && taskDetail.emergencyInfo.serviceOrdVip === '1'" class="vip-tag">VIP</text>
+            <text v-if="taskDetail.emergencyInfo && taskDetail.emergencyInfo.fromHq2Is === '1'" class="hq-tag">骞挎��</text>
+          </view>
         </view>
         <view class="info-item">
           <view class="label">浠诲姟绫诲瀷</view>
@@ -37,7 +41,7 @@
           <view 
             class="assignee-item" 
             v-for="(assignee, index) in taskDetail.assignees" 
-            :key="'assignee-' + (assignee.userId || assignee.userName || index)"
+            :key="getAssigneeKey(assignee, index)"
           >
             <view class="assignee-index">{{ index + 1 }}</view>
             <view class="assignee-info">
@@ -51,21 +55,12 @@
               <view class="assignee-role">
                 <view 
                   class="role-tag"
-                  :class="{
-                    'role-driver': assignee.userType === 'driver',
-                    'role-doctor': assignee.userType === 'doctor',
-                    'role-nurse': assignee.userType === 'nurse'
-                  }"
-                >
+                  :class="{'role-driver': assignee.userType === 'driver','role-doctor': assignee.userType === 'doctor','role-nurse': assignee.userType === 'nurse'}">
                   {{ getUserTypeLabel(assignee.userType) }}
                 </view>
                 <view 
                   class="ready-badge"
-                  :class="{
-                    'ready': isAssigneeReady(assignee),
-                    'unready': !isAssigneeReady(assignee)
-                  }"
-                >
+                  :class="{'ready': isAssigneeReady(assignee),'unready': !isAssigneeReady(assignee)}">
                   {{ isAssigneeReady(assignee) ? '宸插氨缁�' : '鏈氨缁�' }}
                 </view>
               </view>
@@ -102,13 +97,13 @@
         <view class="section-title">浣嶇疆淇℃伅</view>
         <!-- 杞繍浠诲姟锛氭樉绀鸿浆鍑�/杞叆鍖婚櫌鍦板潃 -->
         <template v-if="taskDetail.taskType === 'EMERGENCY_TRANSFER' && taskDetail.emergencyInfo">
-          <view class="info-item" v-if="taskDetail.emergencyInfo.hospitalOutAddress">
+          <view class="info-item" v-if="taskDetail.emergencyInfo.hospitalOutName">
             <view class="label">杞嚭鍖婚櫌</view>
-            <view class="value">{{ taskDetail.emergencyInfo.hospitalOutAddress }}</view>
+            <view class="value">{{ taskDetail.emergencyInfo.hospitalOutName }}</view>
           </view>
-          <view class="info-item" v-if="taskDetail.emergencyInfo.hospitalInAddress">
+          <view class="info-item" v-if="taskDetail.emergencyInfo.hospitalInName">
             <view class="label">杞叆鍖婚櫌</view>
-            <view class="value">{{ taskDetail.emergencyInfo.hospitalInAddress }}</view>
+            <view class="value">{{ taskDetail.emergencyInfo.hospitalInName }}</view>
           </view>
         </template>
         <!-- 绂忕杞︿换鍔★細鏄剧ず鎺ラ��/鐩殑鍦板潃 -->
@@ -260,7 +255,7 @@
         <view 
           class="payment-record-item" 
           v-for="(payment, index) in paymentInfo.paidPayments" 
-          :key="'payment-' + (payment.id || index)"
+          :key="getPaymentKey(payment, index)"
         >
           <view class="payment-header">
             <view 
@@ -469,7 +464,7 @@
 </template>
 
 <script>
-  import { getTask, changeTaskStatus, setAssigneeReady } from '@/api/task'
+  import { getTask, changeTaskStatus, setAssigneeReady, checkTaskConsentAttachment } from '@/api/task'
   import { checkVehicleActiveTasks } from '@/api/task'
   import { getPaymentInfo } from '@/api/payment'
   import { formatDateTime } from '@/utils/common'
@@ -496,7 +491,19 @@
         }
         return ['COMPLETED', 'CANCELLED'].includes(this.taskDetail.taskStatus)
       },
-      // 鏄剧ず浠诲姟绫诲瀷
+      
+      // 鐢熸垚鎵ц浜哄憳瑙掕壊鏍囩鐨勭被鍚�
+      getRoleTagClass() {
+        return (userType) => {
+          const baseClass = 'role-tag'
+          const roleClasses = {
+            'driver': 'role-driver',
+            'doctor': 'role-doctor',
+            'nurse': 'role-nurse'
+          }
+          return [baseClass, roleClasses[userType] || '']
+        }
+      },      // 鏄剧ず浠诲姟绫诲瀷
       displayTaskType() {
         if (!this.taskDetail || !this.taskDetail.taskType) {
           return '鏈缃�'
@@ -528,9 +535,9 @@
           return '鏈缃�'
         }
         const formatted = formatDateTime(this.taskDetail.plannedStartTime, 'YYYY-MM-DD HH:mm')
-        // 濡傛灉骞翠唤鏄�1900,琛ㄧず鏃犳晥鏃ユ湡,鏄剧ず涓烘湭璁剧疆
-        if (formatted && formatted.startsWith('1900')) {
-          return '鏈缃�'
+        // 濡傛灉骞翠唤鏄�1900鎴�1970,琛ㄧず鏃犳晥鏃ユ湡,鏄剧ず涓烘湭鍒嗛厤鏃堕棿
+        if (formatted && (formatted.startsWith('1900') || formatted.startsWith('1970'))) {
+          return '鏈垎閰嶆椂闂�'
         }
         return formatted
       },
@@ -540,9 +547,9 @@
           return '鏈缃�'
         }
         const formatted = formatDateTime(this.taskDetail.plannedEndTime, 'YYYY-MM-DD HH:mm')
-        // 濡傛灉骞翠唤鏄�1900,琛ㄧず鏃犳晥鏃ユ湡,鏄剧ず涓烘湭璁剧疆
-        if (formatted && formatted.startsWith('1900')) {
-          return '鏈缃�'
+        // 濡傛灉骞翠唤鏄�1900鎴�1970,琛ㄧず鏃犳晥鏃ユ湡,鏄剧ず涓烘湭鍒嗛厤鏃堕棿
+        if (formatted && (formatted.startsWith('1900') || formatted.startsWith('1970'))) {
+          return '鏈垎閰嶆椂闂�'
         }
         return formatted
       },
@@ -552,9 +559,9 @@
           return '鏈缃�'
         }
         const formatted = formatDateTime(this.taskDetail.actualStartTime, 'YYYY-MM-DD HH:mm')
-        // 濡傛灉骞翠唤鏄�1900,琛ㄧず鏃犳晥鏃ユ湡,鏄剧ず涓烘湭璁剧疆
-        if (formatted && formatted.startsWith('1900')) {
-          return '鏈缃�'
+        // 濡傛灉骞翠唤鏄�1900鎴�1970,琛ㄧず鏃犳晥鏃ユ湡,鏄剧ず涓烘湭鍒嗛厤鏃堕棿
+        if (formatted && (formatted.startsWith('1900') || formatted.startsWith('1970'))) {
+          return '鏈垎閰嶆椂闂�'
         }
         return formatted
       },
@@ -564,9 +571,9 @@
           return '鏈缃�'
         }
         const formatted = formatDateTime(this.taskDetail.actualEndTime, 'YYYY-MM-DD HH:mm')
-        // 濡傛灉骞翠唤鏄�1900,琛ㄧず鏃犳晥鏃ユ湡,鏄剧ず涓烘湭璁剧疆
-        if (formatted && formatted.startsWith('1900')) {
-          return '鏈缃�'
+        // 濡傛灉骞翠唤鏄�1900鎴�1970,琛ㄧず鏃犳晥鏃ユ湡,鏄剧ず涓烘湭鍒嗛厤鏃堕棿
+        if (formatted && (formatted.startsWith('1900') || formatted.startsWith('1970'))) {
+          return '鏈垎閰嶆椂闂�'
         }
         return formatted
       }
@@ -591,13 +598,7 @@
         
         getTask(this.taskId).then(response => {
           this.taskDetail = response.data || response
-          // 璋冭瘯锛氭墦鍗拌繑鍥炵殑鏁版嵁
-          // console.log('浠诲姟璇︽儏瀹屾暣鏁版嵁:', JSON.stringify(this.taskDetail, null, 2))
-          // console.log('浠诲姟绫诲瀷瀛楁鍊�:', this.taskDetail.taskType)
-          // console.log('浠诲姟鐘舵�佸瓧娈靛��:', this.taskDetail.taskStatus)
-          // console.log('鍑哄彂鍦板潃:', this.taskDetail.departureAddress)
-          // console.log('鐩殑鍦板潃:', this.taskDetail.destinationAddress)
-          // console.log('杞繍浠诲姟淇℃伅 (emergencyInfo):', this.taskDetail.emergencyInfo)
+         
           
           // 濡傛灉鏄浆杩愪换鍔★紝鍔犺浇鏀粯淇℃伅
           if (this.taskDetail.taskType === 'EMERGENCY_TRANSFER') {
@@ -702,7 +703,16 @@
       
       // 杩斿洖涓婁竴椤�
       goBack() {
-        uni.navigateBack()
+        // 妫�鏌ユ槸鍚︽湁椤甸潰鍙互杩斿洖
+        uni.navigateBack({
+          delta: 1,
+          fail: () => {
+            // 濡傛灉鏃犳硶杩斿洖锛屽垯璺宠浆鍒颁换鍔″垪琛ㄩ〉闈�
+            uni.switchTab({
+              url: '/pages/task/index'
+            })
+          }
+        })
       },
       
       // 澶勭悊缂栬緫鎸夐挳
@@ -938,8 +948,50 @@
       
       // 鏇存柊浠诲姟鐘舵��
       updateTaskStatus(status, remark) {
-        // 鑾峰彇GPS浣嶇疆淇℃伅
-        this.getLocationAndUpdateStatus(status, remark)
+        // 濡傛灉鏄畬鎴愮姸鎬侊紝闇�瑕佹鏌ユ槸鍚︿笂浼犱簡鐭ユ儏鍚屾剰涔�
+        if (status === 'COMPLETED') {
+          this.checkConsentAttachmentAndThen(status, remark);
+        } else {
+          // 鑾峰彇GPS浣嶇疆淇℃伅
+          this.getLocationAndUpdateStatus(status, remark);
+        }
+      },
+      
+      // 妫�鏌ョ煡鎯呭悓鎰忎功闄勪欢骞舵洿鏂扮姸鎬�
+      async checkConsentAttachmentAndThen(status, remark) {
+        try {
+          uni.showLoading({
+            title: '妫�鏌ラ檮浠�...'
+          });
+          
+          const response = await checkTaskConsentAttachment(this.taskId);
+          
+          uni.hideLoading();
+          
+          if (response.code === 200) {
+            // 宸蹭笂浼犵煡鎯呭悓鎰忎功锛岀户缁洿鏂扮姸鎬�
+            this.getLocationAndUpdateStatus(status, remark);
+          } else {
+            // 鏈笂浼犵煡鎯呭悓鎰忎功锛屾樉绀烘彁绀�
+            this.$modal.confirm('浠诲姟鏈笂浼犵煡鎯呭悓鎰忎功锛屾棤娉曞畬鎴愪换鍔°�傛槸鍚︾幇鍦ㄥ幓涓婁紶锛�').then(() => {
+              // 婊氬姩鍒伴檮浠朵笂浼犲尯鍩�
+              this.$nextTick(() => {
+                uni.pageScrollTo({
+                  scrollTop: 9999, // 婊氬姩鍒板簳閮�
+                  duration: 300
+                });
+              });
+            }).catch(() => {});
+          }
+        } catch (error) {
+          uni.hideLoading();
+          console.error('妫�鏌ラ檮浠跺け璐�:', error);
+          
+          // 濡傛灉妫�鏌ュけ璐ワ紝璇㈤棶鐢ㄦ埛鏄惁缁х画
+          this.$modal.confirm('妫�鏌ラ檮浠剁姸鎬佸け璐ワ紝鏄惁缁х画瀹屾垚浠诲姟锛�').then(() => {
+            this.getLocationAndUpdateStatus(status, remark);
+          }).catch(() => {});
+        }
       },
       
       // 鑾峰彇浣嶇疆淇℃伅骞舵洿鏂扮姸鎬�
@@ -1398,7 +1450,26 @@
       // 鍑哄彂鍓嶄繚璇佸氨缁紙淇濈暀鍚戝悗鍏煎锛�
       async ensureReadyThenDepart() {
         this.handleDepartAction()
-      }
+      },
+
+      // 鑾峰彇鎵ц浜哄憳鐨刱ey鍊�
+      getAssigneeKey(assignee, index) {
+        // 纭繚杩斿洖鏈夋晥鐨勫瓧绗︿覆key
+        if (!assignee) return 'assignee-' + index;
+        // 浼樺厛浣跨敤userId锛屽叾娆℃槸userName锛屾渶鍚庝娇鐢╥ndex
+        const key = assignee.userId || assignee.userName || index;
+        return 'assignee-' + (key !== null && key !== undefined ? key : index);
+      },
+      
+      // 鑾峰彇鏀粯璁板綍鐨刱ey鍊�
+      getPaymentKey(payment, index) {
+        // 纭繚杩斿洖鏈夋晥鐨勫瓧绗︿覆key
+        if (!payment) return 'payment-' + index;
+        // 浼樺厛浣跨敤id锛屽叾娆′娇鐢╥ndex
+        const key = payment.id || index;
+        return 'payment-' + (key !== null && key !== undefined ? key : index);
+      },
+      
     }
   }
 </script>
@@ -1774,5 +1845,27 @@
         }
       }
     }
+    
+    .vip-tag {
+      display: inline-block;
+      padding: 2rpx 8rpx;
+      font-size: 20rpx;
+      color: #fff;
+      background-color: #ff0000;
+      border-radius: 4rpx;
+      margin-left: 10rpx;
+      vertical-align: middle;
+    }
+    
+    .hq-tag {
+      display: inline-block;
+      padding: 2rpx 8rpx;
+      font-size: 20rpx;
+      color: #fff;
+      background-color: #5856d6;
+      border-radius: 4rpx;
+      margin-left: 10rpx;
+      vertical-align: middle;
+    }
   }
 </style>
\ No newline at end of file

--
Gitblit v1.9.1