wupengfei
2 天以前 f8e2cf155c7385c4c412e4b3c0eee2ea8070c693
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
  <LoadingLayout :loading="isLoading" :error="isError" :loadError="refetch">
    <ContentScrollView style="background-color: #fff">
      <div class="personal-info-wrapper">
        <TaskCheckPersonalView
          :avatarUrl="setOSSLink(detail?.enterpriseEmployeeUser?.avatar)"
          :name="detail?.enterpriseEmployeeUser?.name"
          :isReal="detail?.enterpriseEmployeeUser?.isReal"
          :contactPhoneNumber="detail?.enterpriseEmployeeUser?.contactPhoneNumber"
        />
      </div>
      <div class="taskCheckFileCard-status-title">验收照片</div>
      <TaskCheckFileCard
        :created-time="detail?.createdTime"
        :files="detail?.files?.map((x) => setOSSLink(x))"
      ></TaskCheckFileCard>
    </ContentScrollView>
    <PageFooter>
      <PageFooterBtn
        type="primary"
        :color="Colors.Info"
        class="dark-btn"
        @click="checkReceiveTask(EnumTaskUserSubmitCheckReceiveStatus.Fail)"
        >验收未通过</PageFooterBtn
      >
      <PageFooterBtn
        type="primary"
        @click="checkReceiveTask(EnumTaskUserSubmitCheckReceiveStatus.Success)"
        >验收通过</PageFooterBtn
      >
    </PageFooter>
  </LoadingLayout>
</template>
 
<script setup lang="ts">
import Taro from '@tarojs/taro';
import { useQuery } from '@tanstack/vue-query';
import * as taskCheckReceiveServices from '@12333/services/apiV2/taskCheckReceive';
import TaskCheckPersonalView from '../components/TaskCheckPersonalView.vue';
import { TaskCheckFileCard } from '@12333/components';
import { Colors, EnumTaskUserSubmitCheckReceiveStatus } from '@12333/constants';
import { Message, setOSSLink } from '@12333/utils';
import dayjs from 'dayjs';
import { goBack } from '@/utils';
 
defineOptions({
  name: 'InnerPage',
});
 
const router = Taro.useRouter();
const id = router.params?.id ?? '';
const date = router.params?.date ?? '';
 
const {
  isLoading,
  isError,
  data: detail,
  refetch,
} = useQuery({
  queryKey: ['flexWorkerServices/getOrdeForDetail', id, date],
  queryFn: async () => {
    return await taskCheckReceiveServices.getCheckReceiveTaskUserSubmit(
      { taskInfoUserId: id, date: dayjs(date).format('YYYY-MM-DD') },
      {
        showLoading: false,
      }
    );
  },
  placeholderData: () => ({} as API.GetCheckReceiveTaskUserSubmitQueryResult),
});
 
async function checkReceiveTask(checkReceiveStatus: EnumTaskUserSubmitCheckReceiveStatus) {
  try {
    let params: API.CheckReceiveTaskCommand = {
      id: detail.value?.id,
      checkReceiveStatus: checkReceiveStatus,
    };
    let res = await taskCheckReceiveServices.checkReceiveTask(params);
    if (res) {
      Message.success('提交成功', {
        onClosed() {
          goBack();
        },
      });
    }
  } catch (error) {}
}
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
 
.taskHandleCheckDetail-page-wrapper {
  .taskCheckFileCard-status-title {
    font-weight: 600;
    font-size: 28px;
    line-height: 32px;
    margin-bottom: 16px;
    color: boleGetCssVar('text-color', 'primary');
  }
 
  .personal-info-wrapper {
    padding-top: 52px;
    padding-bottom: 36px;
    border-bottom: 1px solid #d9d9d9;
    margin-bottom: 22px;
  }
}
</style>