From 37e6ed1a122f6791b77fe8574fa2ff3ad1079b68 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期三, 13 八月 2025 09:18:21 +0800
Subject: [PATCH] feat: 接口对接

---
 apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue |   99 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 95 insertions(+), 4 deletions(-)

diff --git a/apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue b/apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue
index 1e83219..f66686a 100644
--- a/apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue
+++ b/apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue
@@ -6,6 +6,7 @@
           <img
             :src="detail.isCollected ? IconAttentioActive : IconAttention"
             class="taskDetail-attention-icon"
+            @click="handleAttention"
           />
         </template>
         <div class="taskDetail-time">
@@ -100,9 +101,44 @@
         :isFlex="false"
         openType="share"
       ></PageFooterAction>
-      <PageFooterAction :icon="IconPhone" text="鎵嬫満" :isFlex="false"></PageFooterAction>
-      <PageFooterBtn v-if="detail.releaseStatus === EnumTaskReleaseStatus.InProcess" type="primary"
-        >鎶ュ悕锛坽{ detail.applyCount }}浜哄凡鎶ュ悕锛�</PageFooterBtn
+      <PageFooterAction
+        :icon="IconPhone"
+        text="鎵嬫満"
+        :isFlex="false"
+        @click="handleCall"
+      ></PageFooterAction>
+      <PageFooterBtn
+        v-if="showApplyBtn"
+        type="primary"
+        @click="handleApply"
+        :disabled="detail?.hireStatus === EnumTaskUserHireStatus.Wait"
+        >{{ `鎶ュ悕锛�${detail?.applyCount ?? 0}浜哄凡鎶ュ悕锛塦 }}</PageFooterBtn
+      >
+      <PageFooterBtn
+        v-if="detail.applyButton === GetTaskInfoQueryResultApplyButton.WaitHire"
+        color="#999999"
+        disabled
+        >寰呯‘璁�</PageFooterBtn
+      >
+      <!-- <PageFooterBtn
+        v-if="detail.applyButton === GetTaskInfoQueryResultApplyButton.WaitSignContract"
+        >鍘荤绾�</PageFooterBtn
+      > -->
+      <PageFooterBtn
+        v-if="detail.hireButton === GetTaskInfoQueryResultHireButton.InProcess"
+        color="#999999"
+        disabled
+        >杩涜涓�</PageFooterBtn
+      >
+      <!-- <PageFooterBtn
+        v-if="detail.hireButton === GetTaskInfoQueryResultHireButton.ApplyCheckReceive"
+        >鐢宠楠屾敹</PageFooterBtn
+      > -->
+      <PageFooterBtn
+        v-if="detail.hireButton === GetTaskInfoQueryResultHireButton.Completed"
+        color="#999999"
+        disabled
+        >宸插畬鎴�</PageFooterBtn
       >
       <PageFooterBtn v-if="detail.releaseStatus === EnumTaskReleaseStatus.Stopped" color="#999999"
         >宸插仠姝�</PageFooterBtn
@@ -115,6 +151,7 @@
 import Taro from '@tarojs/taro';
 import { useQuery } from '@tanstack/vue-query';
 import * as taskServices from '@12333/services/apiV2/task';
+import * as taskUserServices from '@12333/services/apiV2/taskUser';
 import { useToggle } from 'senin-mini/hooks';
 import { TaskPrice, TaskDetailWelfareItem } from '@12333/components';
 import IconAttention from '@/assets/task/icon-attention.png';
@@ -127,11 +164,14 @@
 import './taskDetail.scss';
 import CompanyDesc from '../components/CompanyDesc.vue';
 import dayjs from 'dayjs';
-import { TaskUtils, toThousand, setOSSLink } from '@12333/utils';
+import { TaskUtils, toThousand, setOSSLink, Message } from '@12333/utils';
 import {
   EnumSettlementCycleText,
   BillingMethodEnumUnit,
   EnumTaskReleaseStatus,
+  EnumTaskUserHireStatus,
+  GetTaskInfoQueryResultApplyButton,
+  GetTaskInfoQueryResultHireButton,
 } from '@12333/constants';
 import { useAccessLogin } from '@/hooks';
 
@@ -145,6 +185,13 @@
 
 const router = Taro.useRouter();
 const taskId = router.params?.id ?? '';
+
+const showApplyBtn = computed(() => {
+  return (
+    detail.value?.releaseStatus === EnumTaskReleaseStatus.InProcess &&
+    (detail.value?.hireStatus === EnumTaskUserHireStatus.Wait || !detail.value?.hireStatus)
+  );
+});
 
 const {
   isLoading,
@@ -182,4 +229,48 @@
     });
   }
 });
+
+const handleApply = useAccessLogin(async () => {
+  try {
+    let params: API.ApplyTaskCommand = {
+      ids: [taskId],
+    };
+    let res = await taskUserServices.applyTask(params);
+    if (res) {
+      Message.success('鎶ュ悕鎴愬姛', {
+        onClosed() {
+          refetch({ type: 'inactive' });
+        },
+      });
+    }
+  } catch (error) {}
+});
+
+const handleAttention = useAccessLogin(async () => {
+  try {
+    await Message.confirm({
+      message: `纭畾${detail.value?.isCollected ? '鍙栨秷鏀惰棌' : '鏀惰棌'}鍚楋紵`,
+    });
+    let params: API.CollectTaskCommand = {
+      ids: [taskId],
+      isCollect: !detail.value?.isCollected,
+    };
+    let res = await taskUserServices.collectTask(params);
+    if (res) {
+      Message.success('鎿嶄綔鎴愬姛', {
+        onClosed() {
+          refetch({ type: 'inactive' });
+        },
+      });
+    }
+  } catch (error) {}
+});
+
+const handleCall = useAccessLogin(() => {
+  if (detail.value.contactPhoneNumber) {
+    Taro.makePhoneCall({
+      phoneNumber: detail.value.contactPhoneNumber,
+    });
+  }
+});
 </script>

--
Gitblit v1.9.1