<!--
  @description:招标-招标公告-新版招标公告(邀请)详情
  @Modifier: 张慢慢
  @routerPath: /bidding/projectDrive/invitation/newTenderInvitation-detail
  @date: 2021/05/25-13:16
-->
<template>
  <div>
    <div class="main mb10">
      <table class="tableData">
        <tr>
          <td>
            公告标题
          </td>
          <td colspan="3">
            {{ formData.title }}
          </td>
        </tr>
        <!--isPack===01 分包-->
        <!-- <tr>
          <td>
            标段划分情况
          </td>
          <td colspan="3">
            <span v-if="tenderBase.isPack==='01'">本项目有{{ formData.projectPackageNum }}个标段（包）</span>
            <span v-else>本项未划分标段（包）</span>
          </td>
        </tr> -->
        <!--标段划分情况-->
        <!-- <tr v-if="tenderBase.isPack==='01'">
          <td>
            本次招标标段
          </td>
          <td colspan="3">
            {{ filterDictText(publishMethodList,formData.invitationPublishMethod) }}
          </td>
        </tr> -->
        <!--
          选择标段（包）
          按标段发布时展示 invitationPublishMethod==='01'
        -->
        <tr v-if="formData.invitationPublishMethod==='01'">
          <td>
            标段包
          </td>
          <td colspan="3">
            <!--已选中的标包列表-->
            <el-tag
              v-for="(pack, index) in seletPackList"
              :key="index"
              size="medium"
              type="info"
            >
              【{{ pack.packNo }}】{{ pack.packName }}
            </el-tag>
          </td>
        </tr>

        <tr>
          <!--项目资金-->
          <td>
            项目资金（元）
          </td>
          <td>
            {{ formData.projectMoney }}
          </td>
          <td>
            {{ dict.tenderDocumentReceiveTimeLabel }}
          </td>
          <!--标书获取时间-->
          <td class="tenderDocumentReceiveTime">
            {{ $Moment(formData.tenderDocumentReceiveStartTime).format(momentDateTime) }}
            至
            {{ $Moment(formData.tenderDocumentReceiveEndTime).format(momentDateTime) }}
            <span style="padding-left: 10px;">共
              <span v-if="tenderDocumentReceiveDays===''" style="padding-left: 16px" />
              <span style="padding: 0 4px">{{ tenderDocumentReceiveDays }}</span>天
            </span>
          </td>
        </tr>
        <tr>
          <td>
            接收答疑截止时间
          </td>
          <td colspan="">
            {{ $Moment(formData.acceptAnsweringQuestionsEndTime).format(momentDateTime) }}
            <!-- {{ formData.acceptAnsweringQuestionsEndTime }} -->
          </td>
          <td>
            {{ dict.submitEndTimeLabel }}
          </td>
          <td colspan="">
            {{ $Moment(formData.submitEndTime).format(momentDateTime) }}
            <!-- {{ formData.submitEndTime }} -->
          </td>
        </tr>
        <tr>
          <!--标书解密方式-->
          <td>
            {{ dict.bidDocumentDecryptionMethodLabel }}
          </td>
          <td>
            {{ filterDictText(decryptionMethodList,formData.bidDocumentDecryptionMethod) }}
          </td>
          <!--开标方式-->
          <!--tenderBase.stageType 00资审 01后审-->
          <td v-if="tenderBase.stageType==='01'">
            开标方式
          </td>
          <td v-if="tenderBase.stageType==='01'">
            {{ filterDictText(openingMethodList,formData.isTwoBidOpening) }}
          </td>
        </tr>
        <tr v-if="formData.isTwoBidOpening==='00'">
          <td>
            {{ dict.kbsj }}
          </td>
          <td>
            {{ $Moment(formData.openBidStartTime).format(momentDateTime) }}
          </td>
          <td />
          <td />
        </tr>
        <tr v-if="formData.isTwoBidOpening==='01'">
          <td>
            <!--第一阶段投标规则-->
            第一阶段投标规则
          </td>
          <td>
            {{ filterDictText(isSubmitBidPriceList,formData.isSubmitBidPrice) }}
          </td>
          <td>
            <!--商务技术开标时间-->
            商务技术开标时间
          </td>
          <td>
            {{ $Moment(formData.technicalOpenBidStartTime).format(momentDateTime) }}
          </td>
        </tr>
        <tr>
          <td>
            <!--标书获取方式-->
            {{ dict.tenderDocumentReceiveMethodLabel }}
          </td>
          <td>
            {{ filterDictText(receiveMethodList,formData.tenderDocumentReceiveMethod) }}
          </td>
          <td>
            支付方式
          </td>
          <td>
            {{ filterDictText(paytypeList,formData.payModeCode) }}
          </td>
        </tr>
        <tr>
          <td>
            {{ dict.tenderDocumentSaleMethodLabel }}
          </td>
          <td>
            {{ filterDictText(documentMethodList,formData.tenderDocumentSaleMethod) }}
            <span v-if="formData.tenderDocumentSaleMethod==='01'">{{ formData.documentPrice }}</span>
          </td>
          <td>
            发布媒介
          </td>
          <td>
            {{ filterDictText(mediaPartnersList,formData.mediaPartners) }}
          </td>
        </tr>
        <!--保证金收取方式-->
        <tr>
          <td>
            保证金收取方式
          </td>
          <td>
            {{ filterDictText(bailPriceModeList,formData.bailCollectMode) }}
          </td>
          <td>
            保证金设置
          </td>
          <td>
            {{ filterDictText(bailPriceMethodList,formData.receiveBailPriceMethod) }}
            <span v-if="formData.receiveBailPriceMethod==='01'">{{ formData.bailPrice }}</span>
          </td>
        </tr>
        <tr>
          <template v-if="formData.tenderDocumentSaleMethod==='00'">
            <td>
              标书费列表
            </td>
            <td>
              <el-button type="primary" @click="lookTableList('01')">
                查看标书费
              </el-button>
            </td>
          </template>
          <template v-if="formData.receiveBailPriceMethod==='00'">
            <td>
              保证金列表
            </td>
            <td>
              <el-button type="primary" @click="lookTableList('02')">
                查看保证金
              </el-button>
            </td>
          </template>
        </tr>
        <!-- <tr v-if="formData.tenderDocumentSaleMethod==='00'" style="width: 100%">
          <td colspan="4" style="background: #fff;border: none;padding: 0">
            <div class="form_item_table table_packPrice">
              <el-table :data="formData.tenderDocumentPriceInfoVo">
                <el-table-column type="index" label="序号" width="60" align="center" />
                <el-table-column header-align="center" width="200px" label="标段编号" prop="packNo" align="center" />
                <el-table-column header-align="center" label="标段名称" prop="packName" />
                <el-table-column header-align="center" width="220px" prop="documentPrice" :label="dict.documentPriceTitle">
                  <template slot-scope="scope">
                    {{ scope.row.documentPrice }}
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </td>
        </tr>

        <tr style="width: 100%">
          <td colspan="4" style="background: #fff;border-left: none;border-right: none;padding: 0">
            <div v-if="formData.receiveBailPriceMethod==='00'" class="form_item_table table_method">
              <el-table :data="formData.tenderBailPriceInfoVo">
                <el-table-column type="index" label="序号" width="60" align="center" />
                <el-table-column header-align="center" width="200px" label="标段编号" prop="packNo" align="center" />
                <el-table-column header-align="center" label="标段名称" prop="packName" />
                <el-table-column header-align="center" width="220px" label="保证金（元）" prop="bailPrice">
                  <template slot-scope="scope">
                    {{ scope.row.bailPrice }}
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </td>
        </tr> -->
        <tr>
          <td>
            邀请函
          </td>
          <td colspan="3">
            <el-button type="primary" @click="viewPdf">
              查看邀请函
            </el-button>
          </td>
        </tr>
      </table>
      <!--邀请-->
      <dl class="projectInfoDetail mt10">
        <dt>
          <p class="projectInfoDetail_icon">
            <i class="iconfont icon-xiangmujibenxinxi" />
          </p>
          已选投标人
        </dt>
        <dd>
          <!--不分包详情 isPack 00 不分包 01 分包-->
          <noPackageSupplierInvitationDetail v-if="tenderBase.isPack === '00'" />
          <!--分包详情-->
          <packageSupplierInvitationDetail v-if="tenderBase.isPack === '01'" />
        </dd>
      </dl>
      <!-- <p style="padding-top:10px;font-weight:600">

      </p>
       -->
    </div>
    <!-- 预览pdf -->
    <!-- <makeTenderingInvitationPdfDetail /> -->
    <!-- 标书费、保证金弹框 -->
    <newTenderInvitationListDialog ref="newTenderInvitationList" />
  </div>
</template>
<script>
/* api*/
import {
  queryBaseTenderInvitationSimpleInfo // 获取详情信息
} from '@/api/bidding/bidInvitation'
/* 混合开发方法-参数字段*/
import { tenderInvitationInitGroupMixin } from './../mixins/tenderInvitationInitGroupMixin'// 字典信息
import { newTenderInvitationInitGroupMixin } from './../mixins/newTenderInvitationInitGroupMixin' // 新版获取字典信息
import { openInfoDecryptMethodConfig } from '@/views/bidding/bulletin/mixins/openInfoDecryptMethodConfig.js' // 解密方式配置
import { filterDictText } from '@/assets/js/utils'
/* 组件 */
import noPackageSupplierInvitationDetail from '../tenderInvitationSupplier/noPackageSupplierInvitation-detail' // 不分包详情
import packageSupplierInvitationDetail from '../tenderInvitationSupplier/packageSupplierInvitation-detail' // 分包详情
import makeTenderingInvitationPdfDetail from '../tenderInvitation/makeTenderingInvitationPdf-detail' // 邀请公告查看pdf
import newTenderInvitationListDialog from './tenderInvitationList-dialog' // 标书费、保证金弹框
export default {
  name: 'TenderInvitationDetail',
  components: {
    noPackageSupplierInvitationDetail,
    packageSupplierInvitationDetail,
    makeTenderingInvitationPdfDetail,
    newTenderInvitationListDialog
  },
  mixins: [tenderInvitationInitGroupMixin, newTenderInvitationInitGroupMixin, openInfoDecryptMethodConfig],
  data() {
    return {
      confirmLoading: false, // 暂存Loding
      /* 字典信息-start */
      bidTypeList: [], // 招标方式
      /* 字典信息-end */
      tenderBase: this.$store.getters.tenderBase, // 项目信息
      tenderId: this.$route.query.id, // 项目Id
      invitationId: this.$route.query.invitationId, // 邀请函Id
      tenderDocumentReceiveDays: '', // 标书获取开始时间-标书获取截止时间时间差 天数
      formData: {
        title: '', // 公告标题
        projectPackageNum: '', // 项目标段数量
        bulletinPublishMethod: '', // 本次招标标段  00:按项目发布 01:按标段发布
        bulletinPublishMethodChange: '', // 本次招标标段是否可以修改 01 可以修改 00 不可以修改
        projectMoney: '', // 项目资金
        tenderDocumentReceiveStartTime: '', // 标书获取开始时间
        tenderDocumentReceiveEndTime: '', // 标书获取截止时间
        acceptAnsweringQuestionsEndTime: '', // 接收答疑截止时间
        bidDocumentDecryptionMethod: '', // 标书解密方式 00 投标人解密 01 服务器集中解密
        submitEndTime: '', // 投标截止时间
        isTwoBidOpening: '', // 开标方式 00 一步开标法 01两步开标法
        isSubmitBidPrice: '', // 第一阶段投标规则 00 需要投标报价 01 不需要投标报价
        openBidStartTime: '', // 开标时间
        technicalOpenBidStartTime: '', // 商务技术开标时间
        economicOpenBidStartTime: '', // 经济开标时间
        tenderDocumentReceiveMethod: '', // 标书获取方式 00 电子招标 01 线下招标
        payModeCode: '', // 支付方式编码信息
        tenderDocumentSaleMethod: '', // 标书金额设置 00 按标段售卖 01 按项目售卖
        documentPrice: '', // 按項目售卖金额-标书费
        mediaPartners: [], // 发布媒介 00 门户网站 01 中国公共服务平台 全选
        receiveBailPriceMethod: '' // 保证金设置 00 按标段售卖 01 按项目售卖
      },
      seletPackList: [] // 获取的已选择的标段（包）
    }
  },
  watch: {
  },
  created() {
    this.getInvitationAllDictionariesInitInfo() // 所有字典信息
    this.initData() // 加载数据
  },
  methods: {
    filterDictText,
    // 加载数据
    initData() {
      if (!this.invitationId) return
      const data = {
        invitationType: this.tenderBase.invitationType, // 邀请函类型
        tenderId: this.tenderId, // 项目Id
        invitationId: this.invitationId, // 邀请函Id
        requestSource: '' // 来源 00:资审公告 01:招标公告 02:资格预审通知书 03:资审邀请函 04:后审邀请函
      }
      // 通过资审和后审判断来源
      if (this.tenderBase.stageType === '00') {
        data.requestSource = '03'// 资审邀请函
      } else if (this.tenderBase.stageType === '01') {
        data.requestSource = '04'// 后审邀请函
      }
      queryBaseTenderInvitationSimpleInfo(data).then((res) => {
        this.formData = res.data
        this.tenderDocumentReceiveDays = this.momentDiff('days', this.formData.tenderDocumentReceiveStartTime, this.formData.tenderDocumentReceiveEndTime)// 时间差
        this.seletPackList = this.formData.listMarkedInvitationPackage || []// 获取的已选择的标段（包）
      })
    },
    // 查看标书费、保证金列表
    lookTableList(type) {
      const data = {
        type: type
      }
      // 01标书费，02保证金
      if (type === '01') {
        data.list = this.formData.tenderDocumentPriceInfoVo // 标书费
      } else if (type === '02') {
        data.list = this.formData.tenderBailPriceInfoVo // 保证金
      }
      this.$refs.newTenderInvitationList.open(data)
    },
    // 查看公告
    viewPdf() {
      // 路由跳转
      const path = '/bidding/projectDrive/invitation/newTenderInvitationPdf'// 路由地址
      const query = {
        ...this.$route.query
      }
      this.$router.push({ path: path,
        query: {
          ...query
          // bulletinPageType: '01' // 当前页面从哪进来的 00 驱动内新增页 01 驱动内列表页 02 驱动内直接展示详情页
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
.el-table th.gutter {
  display: table-cell !important;
}
/deep/.show-word-limit-padding{
  .el-input__inner{
    padding-right: 70px;
  }
}
/deep/.tenderDocumentReceiveTime {
  .el-input{
    width: auto;
    display:inline-block;
  }
  .defaultTimeDateTime{
    margin-left: 5px;
  }
}
.textAlign-center{
  text-align: center !important;
}
.fontBlod{
  font-weight: bold !important;
}
.bgW{
  background: #fff !important;
}
.bg-F5F7F9{
  background-color: #F5F7F9 !important;
}
/deep/.tableData{
  .el-tag {
    margin-right:10px;
  }
  .table_method{
    .el-table--border{
      border-top: none;
    }
    tr:last-child{
      td{
        border-bottom:none;
      }
    }
  }
  .table_packPrice{
    .el-table--border{
      border-top: none;
    }
    tr:last-child{
      td{
        border-bottom:none;
      }
    }
  }
  .form_item_table{
    .el-table::before{
      height: 0;
    }
  }
  .form_item_table td{
    border-right: none;
    border-top: none;
    background-color: #fff !important;
  }
}
/deep/.from_table{
  .form_item_table td{
    border-right: none;
    border-top: none;
    background-clor: #fff !important;
  }
}
/deep/.tableData{
  .form_item_table th{
    border-top: none;
  }
}
/deep/.from_table{
  .form_item_table th{
    border-top: none;
  }
}
/deep/.from_table{
  .form_item_table td:first-child{
    border-left: none;
  }
}
/deep/.tableData{
  .form_item_table td:first-child{
    border-left: none;
  }
}
</style>

