<template>
  <div class="main"> 
	<div class="nav" v-if="!info.confirm">
    <el-button  type="primary" class="fr mr20" @click="confirmCompany">
        审核通过
    </el-button>
  </div>
	<div class="tabheadtow clear"><h2 class="title">企业基本信息</h2></div>
	<TableGrid :info="info" :config="list1" ></TableGrid>
		
	<div class="tabheadtow clear"><h2 class="title">联系人信息</h2></div>
	<TableGrid :info="info" :config="list2" ></TableGrid>
	
	<div class="tabheadtow clear"><h2 class="title">合作信息</h2></div>
	<TableGrid :info="info" :config="list3" ></TableGrid>
	
	<div class="tabheadtow clear"><h2 class="title">业务信息</h2></div>
	<TableGrid :info="info" :config="list4" ></TableGrid>
	
	<div>
		<div class="tabheadtow clear"><h2 class="title">图片资料</h2></div>
		<el-row :gutter="40">
			<el-col :span="6" class="user-form-col">
				<img :src="info.card_img" width="200px" :onerror="errorImg" >
			</el-col>
			
			<el-col :span="6" class="user-form-col">
				<img :src="info.card_back_img" width="200px" :onerror="errorImg">
			</el-col>
				
			<el-col :span="6" class="user-form-col">
				<img :src="info.license_img" width="200px" :onerror="errorImg">
			</el-col>
				
			<el-col :span="6" class="user-form-col">
				<img :src="info.contract_img" width="200px" :onerror="errorImg">
			</el-col>	
		</el-row>
		
	</div>
	
  </div>
</template>

<script>
import {getCompanyInfo,confirmCompany} from "@/api/company.js";
import TableGrid from '@/components/grid/tableGrid.vue';

import config  from './config.js';

export default {
  name: "companyDetail",
  components:{TableGrid},
  data() {
    return {
	  id:0,
	  listLoading:false,
	  list1:config.companyDetail,
	  list2:config.companyContact,
	  list3:config.companyCooperation,
	  list4:config.companySign,
      info: {},
      logs: [],
	  errorImg:'this.src="' + require('@/assets/null.jpg') + '"'
    }
  },
  methods: {
	async getData(){
		if( !this.id ) return
		let param = {id: this.id}
		const res = await getCompanyInfo( param )
		if (res.code == 200){
		    this.info = res.data.info||{}
		}
	},
	confirmCompany( ){
        let param = {id: this.id};
        confirmCompany( param ).then(res=>{
            if(res.code == 200){
                this.info.confirm = 1
                this.$message.successMsg("审核通过", 1)
            }
        })
    }
  },
  filters: {
  },
  beforeMount() {
	this.id = +this.$route.params.id;
	this.getData( )
  }
};
</script>
<style scoped lang="scss">
.warning {
  color: #dc143c;
}
.th{line-height: 28px;}

</style>