<template>
  <div class="main"> 
    <div class="nav" v-if="!info.confirm">
        <el-button  type="primary" class="fr mr20" @click="confirmPass">
            审核通过
        </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>
		<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" class="detail-img" :onerror="errorImg" alt="" >
        <ImgView v-model="info.card_img" :src="info.card_img" button="身份证正面"/>
			</el-col>
			
			<el-col :span="6" class="user-form-col">
				<img :src="info.card_back_img+'?'" class="detail-img" alt="" :onerror="errorImg">
        <ImgView v-model="info.card_back_img" :src="info.card_back_img" button="身份证背面"/>
			</el-col>
				
			<el-col :span="6" class="user-form-col">
				<img :src="info.band_img" class="detail-img" alt="" :onerror="errorImg">
         <ImgView v-model="info.band_img" :src="info.band_img" button="银行卡"/>
			</el-col>
				
			<el-col :span="6" class="user-form-col">
				<img :src="info.contract_img" class="detail-img" alt="" :onerror="errorImg">
        <ImgView v-model="info.contract_img" :src="info.contract_img" button="合同"/>
			</el-col>	
		</el-row>
		
	</div>
	
  </div>
</template>

<script>
import {getMakerInfo, confirmMaker} from "@/api/maker.js";
import TableGrid from '@/components/grid/tableGrid.vue';
import ImgView from '@/components/customPic/imgView.vue';

import config  from './config.js';

export default {
  name: "companyDetail",
  components:{TableGrid, ImgView},
  data() {
    return {
	  id:0,
	  listLoading:false,
	  list1:config.makerDetail,
	  list2:config.makerFee,
	  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 getMakerInfo( param )
		if (res.code == 200){
		    this.info = res.data.info||{}
		}
	},
    confirmPass(){
        if( !this.info.identify ){
            this.$message.errorMsg("还未实名认证", 1)
            return;
        }
        let param = {id: this.id};
        confirmMaker( 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;}

.detail-img{
    width: 200px;
    height: 300px;
    overflow:hidden;
}
</style>