<script  name='handleExpertReview' setup>
import { onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import projectInfo from '../../../projectStoreManage/projectStore/projectDetail/components/projectInfo.vue'
import { getProjectDetail } from '@/http/apis/declareMange'
import { storeToRefs } from 'pinia'
import store from '@/store'
import { meetingBasicInfo } from '@/http/apis/expertManage/reviewMeeting'
// 项目详情
const userInfo = storeToRefs(store.userStore).userInfo || {},
  detailData = ref({}),
  router = useRouter(),
  route = useRoute(),
  getDetail = async () => {
    const res = await getProjectDetail({ id: route.query.projectId })
    detailData.value = res.data
  },
  toReviewComments = (type) => {
    router.push({ name: 'fillReviewComments', query: { ...route.query, type, regionCode: basicInfo.value.regionCode, projectCode: detailData.value.projectCode }})
  },
  // 获取会议详情
  basicInfo = ref(),
  getMeetingDetail = async () => {
    const res = await meetingBasicInfo(route.query.meetingId)
    basicInfo.value = res.data
  }
onMounted(() => {
  getDetail()
  getMeetingDetail()
})
</script>

<template>
  <div class="w-full footerCard handleExpertReview">
    <div
      v-waterMarker="{text:userInfo.realName+userInfo.phoneNo.substring(userInfo.phoneNo.length - 4)}"
      style="position: absolute;pointer-events: none;width:100%;height:100%"
    >
    </div>
    <project-info :detail-data="detailData" />
    <div class="footer">
      <template v-if="new Date().getTime()>=new Date(basicInfo?.startTime).getTime()&&route.query.type==='1'">
        <el-button
          v-if="route.query.reviewed==='0'"
          type="primary"
          @click="toReviewComments(1)"
        >填写评审意见</el-button>
        <el-button
          v-if="route.query.isHeadman==='true'&&route.query.reviewed==='1'"
          type="primary"
          @click="toReviewComments(2)"
        >填写最终意见</el-button>
      </template>
      <el-button
        plain
        @click="router.go(-1)"
      >返回</el-button>
    </div>
  </div>
</template>

<style lang='less'>
.handleExpertReview{
  padding-bottom: 56px;
}
</style>
