<!--
  @description:  专家-完善基本信息-content
  @Modifier: qrf
  @routerPath: /expertInfo/expertEssentialInfo
  @date: 2020/10/13-15:56
-->
<template>
  <div class="main p0-16">
    <template v-if="auditStatus==='03'">
      <!--标题-->
      <div class="title title_border p0-16">
        <i class="el-icon-s-home" />申请变更
      </div>
    </template>

    <!-- 完善基本信息-新增 -->
    <bidProjectStep v-if="!auditStatus" :page-type="type" />
    <!-- 审报材料-查看 -->
    <template v-if="auditStatus==='00' || auditStatus==='01' || auditStatus==='02'">
      <!--标题-->
      <div class="title title_border p0-16">
        <i class="el-icon-s-home" />完善基本信息
      </div>
      <expertQuitAudit :audit-status="auditStatus" />
    </template>
  </div>
</template>
<script>
/* 接口*/
// import { queryExpertBaseInfo } from '@/api/expert/expertInfo'// 获取用户基本信息 提交
import { queryTBExpertInfoHistoryByApplyId } from '@/api/expert/expertChange'// 申请变更基本信息
/* 组件 */
import bidProjectStep from '@/views/expert/expertInfo/expertStep/expertStep' // 专家步骤条
// import expertBaseInfoDetail from '@/views/expert/experImprovetBaseInfo/expertBaseInfo/expertBaseInfo-detail.vue'
import expertQuitAudit from '@/views/expert/expertQuit/expertQuitAuditContent/expertQuitAudit-detail' // 专家审核查看
export default {
  name: 'EditorDeclarationContent',
  components: {
    bidProjectStep, // 审报材料-新增
    expertQuitAudit
  },
  data() {
    return {
      auditStatus: '', // 空null临时,00审核中,02驳回,01通过
      type: this.$route.query.type || this.$route.params.type, // 页面类型
      applyId: this.$route.query.applyId // 变更id
    }
  },
  watch: {
    $route: {
      handler() {
        this.initData() // 获取基本信息-判断是否已提交
      },
      deep: true
    }
  },
  created() {
    this.initData()// 获取基本信息-判断是否已提交
  },
  methods: {
    // 初始化数据
    initData() {
      this.type = this.$route.query.type // 页面类型
      this.applyId = this.type === 'declarationChange' ? this.$route.query.applyId : ''
      this.auditStatus = this.$route.query.auditStatus
      const data = {
        expertId: this.$route.query.expertId, // 专家id
        applyId: this.applyId
      }
      if (this.type !== 'declarationChange') {
        // queryExpertBaseInfo(data).then(res => {
        //   this.auditStatus = res.data.returnData.auditStatus
        // }).catch(() => {})
      } else {
        queryTBExpertInfoHistoryByApplyId(data).then(res => {
          this.auditStatus = res.data.returnData.auditStatus
        }).catch(() => {})
      }
    }
    // initData() {
    //   this.type = this.$route.query.type | this.$route.params.type // 页面类型
    //   this.applyId = this.type === 'declarationChange' ? this.$route.params.applyId : ''
    //   const data = {
    //     expertId: '', // 专家id
    //     applyId: this.applyId
    //   }
    //   // 判断参数接收方式 params ｜ query
    //   if (this.$route.params.expertId) {
    //     data.expertId = this.$route.params.expertId
    //   } else if (this.$route.query.expertId) {
    //     data.expertId = this.$route.query.expertId
    //   }
    //   if (this.type !== 'declarationChange') {
    //     // 如果id存在调用获取详情接口
    //     if (data.expertId) {
    //       queryExpertBaseInfo(data).then(res => {
    //         this.auditStatus = res.data.returnData.auditStatus
    //       }).catch(() => {})
    //     }
    //   } else {
    //     queryTBExpertInfoHistoryByApplyId(data).then(res => {
    //       this.auditStatus = res.data.returnData.auditStatus
    //     }).catch(() => {})
    //   }
    // }
  }
}
</script>

<style lang="less" scoped>
</style>
