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 |   72 ++++++++++++++++++++++++++++-------
 1 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/app/pagesTask/detail.vue b/app/pagesTask/detail.vue
index 771094a..6e0fdee 100644
--- a/app/pagesTask/detail.vue
+++ b/app/pagesTask/detail.vue
@@ -464,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'
@@ -535,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
       },
@@ -547,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
       },
@@ -559,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
       },
@@ -571,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
       }
@@ -948,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(() => {});
+        }
       },
       
       // 鑾峰彇浣嶇疆淇℃伅骞舵洿鏂扮姸鎬�

--
Gitblit v1.9.1