<template>
  <div>
    <div class="content-head">
      <dataBreadcrumb :breads="breads"></dataBreadcrumb>
      <h3>澄清确认函</h3>
      <h5>投标方向招标方发送澄清确认函</h5>
    </div>
    <div class="content flex-center">
      <div>
        <h3>{{bidCompanyName}}</h3>
        <h5>我单位已收到贵公司发出的项目{{projectName}}澄清标题为{{title}}的澄清文件，特此回执</h5>
		<div class="flex">
			<h4 class='adjustment'><span>*</span>回执文件</h4>
			<singleUpload :limit="1" accept=".jpg,.jpeg,.gif,.png,.bmp"  :max="10"  tip="请下载澄清回执模板后，打印、盖章，再上传扫描件，单个文件不能超过10M，文件个数为1个，文件格式为图片。" @input="getfile"></singleUpload>
		</div>
        <div class="flex-center" style="margin-top:100px">
          <el-button @click="back">返回</el-button>
		  <el-button @click="submitData">发送</el-button>
        </div>	
      </div>
	
    </div>
  </div>
</template>

<script>
import {affirm} from '@api/supply/bid'
import dataBreadcrumb from '@components/dataBreadcrumb.vue'
import singleUpload from '@components/Upload/Upload.vue'
export default {
  components: {
    dataBreadcrumb,
	singleUpload
  },
  data() {
    return {
		title:"",
		projectName:"",
		bidCompanyName:"",
      breads: ['招标管理', '招标项目管理', '工作台'],
	  file:[],
    }
  },
  methods: {
    back() {
      this.$router.go(-1)
    },
	 getfile(val){
		 this.file=val
	 },
	  async submitData() {
	       try {
			   let file=this.file;
			   if(file.length==0){
			   	this.$message.error("请上传回执文件")
			   }else{
				   let data={}
				   data.accessoryUrl=file[0].fileUrl
				    data.fileName=file[0].fileName
					data.noticeId=this.noticeId
					data.companyId=localStorage.getItem("companyId")
				  const {
				    msg,
				    code
				  } = await affirm(data)  
				  if(code==200){
					   this.$message({
					                message: msg,
					                type: 'success',
					  			  duration:1500
					              })
					  			setTimeout(()=>{
					  				 this.$router.go(-1)
					  			},1500)
				  }else{
					  this.$message.error(msg)
				  }
			   }
	       } catch (e) {
	         console.log(e)
	       }
	     }
  },
  created() {
  	this.bidCompanyName=this.$route.query.bidCompanyName;
	this.projectName=localStorage.getItem("projectName");
	this.title=this.$route.query.title;
	this.noticeId=this.$route.query.noticeId
  }
}
</script>


<style scoped>
	.content {
		height: 70%;
	}

	.content h5 {
		margin: 50px 0 80px
	}

	.content h3,
	.content h4 {
		margin-left: -50px;
	}
	span{
		color:#B21F2D
	}
</style>
