<template>
  <div class="app-container">
    <van-nav-bar
      title="招标结果"
      left-arrow
      fixed
      placeholder
      @click-left="onClickLeft"
    />
<!--    <p class="title">{{attestationDetail.projectName}}</p>-->

    <van-cell title="项目名称" :value="attestationDetail.projectName" />
    <van-cell title="招标方名称" :value="attestationDetail.tenderName" />
    <div v-if="attestationDetail.dealType == '成功'">
    <van-cell title="中标人" :value="attestationDetail.assignee" />
    <van-cell title="建设单位" :value="attestationDetail.bulidPart" />
    <van-cell title="项目负责人" :value="attestationDetail.partLinkman" />
    <van-cell title="中标金额(元)" :value="attestationDetail.price" />

    <van-cell title="竟价方式" :value="attestationDetail.biddingType" />
    <van-cell v-if="attestationDetail.biddingType == '单价'" title="中标单价(元)" :value="attestationDetail.transactionPrice" />
    <van-cell v-if="attestationDetail.biddingType == '单价'" title="数量/面积" :value="attestationDetail.areaCount" />
    <van-cell v-if="attestationDetail.biddingType == '单价'" title="数量单位" :value="attestationDetail.priceUnit" />

    <van-cell title="中标日期" :value="attestationDetail.dealTime" />
    <van-cell title="公示开始日期" :value="attestationDetail.startTime" />
    <van-cell title="公示结束日期" :value="attestationDetail.stopTime" />
    <van-divider>附件</van-divider>

      <van-cell :title="item.fileName" :url="'/api'+item.fileUrl" is-link v-for="(item,index) in attachmentQueryList">
        <!-- 使用 right-icon 插槽来自定义右侧图标 -->
        <template #icon>
          <img src="../../assets/images/file_icon.png" style="display: block;width: 24px;margin-right: 5px;" alt="">
        </template>
      </van-cell>
    </div>
    <div v-else>
      <van-cell title="中标情况" :value="attestationDetail.dealType" />
      <van-cell title="未中标原因" :value="attestationDetail.dealFailReason" />
      <van-cell title="备注" :value="attestationDetail.dealRemark" />
    </div>
  </div>
</template>

<script>
  import {attachmentQuery, tenderDetail, tenderWinDetail} from "@/api/notice/index";
export default {
  name: "noticeDetail",
  data() {
    return {
      attestationDetail:'',
      attachmentQueryList:[]
    };
  },
  created() {
    this.getDetail();
  },
  methods: {
    //成交公告集合
    getDetail(){
      console.log(this.$route.query.id)
      tenderWinDetail(this.$route.query.id,{translate_dict:1}).then(response => {
        this.attestationDetail = response.data;
        tenderDetail(response.data.tenderId,{translate_dict:1}).then(response2 => {
          this.getDicts("tenderbid_type").then(res => {
            this.$set(this.attestationDetail,'biddingType',this.selectDictLabel(res.data,response2.data.biddingType))
          });
          this.getDicts("tender_deal_type").then(res => {
            this.$set(this.attestationDetail,'dealType',this.selectDictLabel(res.data,response2.data.dealType))
          });
          this.getDicts("deal_fail_reason").then(res => {
            this.$set(this.attestationDetail,'dealFailReason',this.selectDictLabel(res.data,response2.data.dealFailReason))
          });
        });
      });
      let query = {
        tableName: 't_transaction_tender_win',
        bizPath: 'transaction',
        tableId:this.$route.query.id
      }
      attachmentQuery(query).then(response => {
        this.attachmentQueryList = response.rows;
      });
    },

  },
};
</script>

<style scoped lang="scss">
.app-container {
  padding: 0 0 0.5rem;
  background: #ffffff;
}
.title{
  font-size: 0.5rem;
  margin-bottom: 0.5rem;
}
.van-row{
  margin-bottom: 0.4rem;
}
.van-col{
  font-size: 0.4rem;
  color: #666666;
}
  /deep/ .van-cell__title{
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    word-break: break-all;
    overflow: hidden;
  }
</style>
