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/pages/task/index.vue |   49 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/app/pages/task/index.vue b/app/pages/task/index.vue
index 4a9c45c..a0432b3 100644
--- a/app/pages/task/index.vue
+++ b/app/pages/task/index.vue
@@ -275,7 +275,7 @@
 
 <script>
 import uniDatetimePicker from "@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue";
-import { listTask, changeTaskStatus } from "@/api/task";
+import { listTask, changeTaskStatus, checkTaskConsentAttachment } from "@/api/task";
 import { mapState } from "vuex";
 import { formatDateTime } from "@/utils/common";
 import { checkTaskCanDepart } from "@/utils/taskValidator";
@@ -825,12 +825,8 @@
 
         case "complete":
           // 宸插畬鎴� -> 鐘舵�佸彉涓哄凡瀹屾垚
-          this.$modal
-            .confirm("纭浠诲姟宸插畬鎴愶紵")
-            .then(() => {
-              this.updateTaskStatus(task.taskId, "COMPLETED", "浠诲姟宸插畬鎴�");
-            })
-            .catch(() => {});
+          // 闇�瑕佹鏌ユ槸鍚︿笂浼犱簡鐭ユ儏鍚屾剰涔�
+          this.checkConsentAttachmentAndThen(task.taskId, "COMPLETED", "浠诲姟宸插畬鎴�");
           break;
       }
     },
@@ -840,6 +836,45 @@
       // 鑾峰彇GPS浣嶇疆淇℃伅
       this.getLocationAndUpdateStatus(taskId, status, remark);
     },
+    
+    // 妫�鏌ョ煡鎯呭悓鎰忎功闄勪欢骞舵洿鏂扮姸鎬�
+    async checkConsentAttachmentAndThen(taskId, status, remark) {
+      try {
+        uni.showLoading({
+          title: '妫�鏌ラ檮浠�...'
+        });
+        
+        const response = await checkTaskConsentAttachment(taskId);
+        
+        uni.hideLoading();
+        
+        if (response.code === 200) {
+          // 宸蹭笂浼犵煡鎯呭悓鎰忎功锛岀户缁洿鏂扮姸鎬�
+          this.$modal
+            .confirm("纭浠诲姟宸插畬鎴愶紵")
+            .then(() => {
+              this.updateTaskStatus(taskId, status, remark);
+            })
+            .catch(() => {});
+        } else {
+          // 鏈笂浼犵煡鎯呭悓鎰忎功锛屾樉绀烘彁绀�
+          this.$modal.confirm('浠诲姟鏈笂浼犵煡鎯呭悓鎰忎功锛屾棤娉曞畬鎴愪换鍔°�傛槸鍚︾幇鍦ㄥ幓涓婁紶锛�').then(() => {
+            // 璺宠浆鍒颁换鍔¤鎯呴〉涓婁紶闄勪欢
+            uni.navigateTo({
+              url: `/pagesTask/detail?id=${taskId}`
+            });
+          }).catch(() => {});
+        }
+      } catch (error) {
+        uni.hideLoading();
+        console.error('妫�鏌ラ檮浠跺け璐�:', error);
+        
+        // 濡傛灉妫�鏌ュけ璐ワ紝璇㈤棶鐢ㄦ埛鏄惁缁х画
+        this.$modal.confirm('妫�鏌ラ檮浠剁姸鎬佸け璐ワ紝鏄惁缁х画瀹屾垚浠诲姟锛�').then(() => {
+          this.updateTaskStatus(taskId, status, remark);
+        }).catch(() => {});
+      }
+    },
 
     // 鑾峰彇浣嶇疆淇℃伅骞舵洿鏂扮姸鎬�
     getLocationAndUpdateStatus(taskId, status, remark) {

--
Gitblit v1.9.1