<template>
  <view>
	<view class="boxt">
		<view class="tit">
			<image :src="titimg"></image>基本信息
		</view>
		<view class="txt">统一社会信用代码：<text>{{qyinfo.creditCode}}</text></view>
		<view class="txt">企业类型：<text>{{qyinfo.enterpriseType}}</text></view>
		<view class="flexcw">
			<view class="txt">法人姓名：<text>{{qyinfo.legalName}}</text></view>
			<view class="txt">注册资金：<text>{{qyinfo.registeredCapital}}</text></view>
		</view>
		<view class="txt">成立日期：<text>{{qyinfo.establishData}}</text></view>
		<view class="txt">营业期限：<text>{{qyinfo.businessTerm}}</text></view>
		<view class="txt">行业类型：<text>{{datainfo.categoryType}}</text></view>
		<view class="flexcw">
			<view class="txt">是否制造业：<text>{{datainfo.isMake=='Y'?'是':'否'}}</text></view>
			<view class="txt">是否小微企业：<text>{{datainfo.isSmall=='Y'?'是':'否'}}</text></view>
			<view class="txt">是否免税：<text><block v-if="datainfo.isDuty">{{datainfo.isDuty=='Y'?'是':'否'}}</block></text></view>
		</view>
		<view class="txt">公司简介：<text>{{datainfo.companyIntroduction}}</text></view>
		<view class="txt flext" v-if="basicFj.gsjj&&basicFj.gsjj.length">
			<view class="flex0">公司简介：</view>
			<view class="flex1 over">
				<block v-if="basicFj.gsjj.length>1">
					<view v-for="(ite,idx) in basicFj.gsjj" class="filist over" @click="getDown(ite.url)">{{ite.name}}</view>
				</block>
				<text v-else class="txta" @click="getDown(basicFj.gsjj[0].url)">在线查看</text>
			</view>
		</view>
		<view class="txt flext">
			<view class="flex0">公司章程：</view>
			<view class="flex1 over">
				<block v-if="basicFj.gszc&&basicFj.gszc.length">
					<block v-if="basicFj.gszc.length>1">
						<view v-for="(ite,idx) in basicFj.gszc" class="filist over" @click="getDown(ite.url)">{{ite.name}}</view>
					</block>
					<text v-else class="txta" @click="getDown(basicFj.gszc[0].url)">在线查看</text>
				</block>
			</view>
		</view>
		<view class="txt flext">开户许可证：
			<view class="flex1 over">
				<block v-if="basicFj.khxkz&&basicFj.khxkz.length">
					<block v-if="basicFj.khxkz.length>1">
						<view v-for="(ite,idx) in basicFj.khxkz" class="filist over" @click="getDown(ite.url)">{{ite.name}}</view>
					</block>
					<text v-else class="txta" @click="getDown(basicFj.khxkz[0].url)">在线查看</text>
				</block>
			</view>
		</view>
	</view>
	<view class="boxt" v-if="datainfo.shareholderFjList&&datainfo.shareholderFjList.length">
		<view class="tit">
			<image :src="titimg"></image>全体股东身份及征信
		</view>
		<view class="flexcw" v-for="(ite,idx) in datainfo.shareholderFjList" :key="idx">
			<view class="txt" v-if="ite.shareholderFrontUrl||ite.shareholderBackUrl">股东{{Number(idx)+1}}身份证：<text class="txta" @click="getDownGd(ite)">在线查看</text></view>
			<view class="txt" >股东{{Number(idx)+1}}营业执照：
				<!-- 其他的营业执照 -->
				<block v-if="ite.shareholderBusinessUrl">
					<block v-for="(itea,idxa) in getYyzzFn(ite.shareholderBusinessUrl)">
						<text class="txtab" v-if="itea" @click="getDown(itea)">在线查看</text>
					</block>
				</block>
			</view>
			<view class="txt" >股东{{Number(idx)+1}}征信：
				<!-- 其他的征信 -->
				<block v-if="ite.shareholderZxUrl">
					<block v-for="(itea,idxa) in getFilteFn(ite.shareholderZxUrl)">
						<text class="txtab" v-if="itea" @click="getDown(itea)">在线查看</text>
					</block>
				</block>
				<text class="txta" v-if="ite.shareholderZxUrlPdf" @click="getDown(ite.shareholderZxUrlPdf.split(',')[0])">在线查看</text>
			</view>
		</view>
	</view>
	<view class="boxt">
		<view class="tit">
			<image :src="titimg"></image>企业征信
		</view>
		<view class="txt flext">申请企业：
			<view class="flex1 over">
				<block v-if="basicFj.sqqyzxbg&&basicFj.sqqyzxbg.length">
					<block v-if="basicFj.sqqyzxbg.length>1">
						<view v-for="(ite,idx) in basicFj.sqqyzxbg" class="filist over" @click="getDown(ite.url)">{{ite.name}}</view>
					</block>
					<text v-else class="txta" @click="getDown(basicFj.sqqyzxbg[0].url)">在线查看</text>
				</block>
			</view>
		</view>
		<view class="txt flext">关联企业：
			<view class="flex1 over">
				<block v-if="basicFj.glqyzxbg&&basicFj.glqyzxbg.length">
					<block v-if="basicFj.glqyzxbg.length>1">
						<view v-for="(ite,idx) in basicFj.glqyzxbg" class="filist over" @click="getDown(ite.url)">{{ite.name}}</view>
					</block>
					<text v-else class="txta" @click="getDown(basicFj.glqyzxbg[0].url)">在线查看</text>
				</block>
			</view>
		</view>
		<!-- <view class="txt">申请企业：<text class="txta" @click="getDown(a)">在线查看</text></view>
		<view class="txt">关联企业：<text class="txta" @click="getDown(a)">在线查看</text></view> -->
	</view>
	<view class="boxt">
		<view class="tit">
			<image :src="titimg"></image>企业法人及控股人征信
		</view>
		<view class="txt flext">企业法人：
			<view class="flex1 over">
				<block v-if="basicFj.qyfrzxbg&&basicFj.qyfrzxbg.length">
					<block v-if="basicFj.qyfrzxbg.length>1">
						<view v-for="(ite,idx) in basicFj.qyfrzxbg" class="filist over" @click="getDown(ite.url)">{{ite.name}}</view>
					</block>
					<text v-else class="txta" @click="getDown(basicFj.qyfrzxbg[0].url)">在线查看</text>
				</block>
			</view>
		</view>
		<view class="txt flext">实际控股人：
			<view class="flex1 over">
				<block v-if="basicFj.sjkgrzxbg&&basicFj.sjkgrzxbg.length">
					<block v-if="basicFj.sjkgrzxbg.length>1">
						<view v-for="(ite,idx) in basicFj.sjkgrzxbg" class="filist over" @click="getDown(ite.url)">{{ite.name}}</view>
					</block>
					<text v-else class="txta" @click="getDown(basicFj.sjkgrzxbg[0].url)">在线查看</text>
				</block>
			</view>
		</view>
		<view class="txt flext">配偶征信：
			<view class="flex1 over">
				<block v-if="basicFj.sjkgrpozxbg&&basicFj.sjkgrpozxbg.length">
					<block v-if="basicFj.sjkgrpozxbg.length>1">
						<view v-for="(ite,idx) in basicFj.sjkgrpozxbg" class="filist over" @click="getDown(ite.url)">{{ite.name}}</view>
					</block>
					<text v-else class="txta" @click="getDown(basicFj.sjkgrpozxbg[0].url)">在线查看</text>
				</block>
			</view>
		</view>
		<!-- <view class="txt">企业法人：<text class="txta" @click="getDown(a)">在线查看</text></view>
		<view class="flexcw">
			<view class="txt">实际控股人：<text class="txta" @click="getDown(a)">在线查看</text></view>
			<view class="txt">配偶征信：<text class="txta" @click="getDown(a)">在线查看</text></view>
		</view> -->
	</view>
  </view>
</template>

<script>
	import config from '@/config'
	const baseUrl = config.baseUrl
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	import { selectValue } from '@/utils/common.js';
	import noData from "@/components/nodata/nodata.vue"
  export default {
	props:{
		datainfo: {
			type: Object,
			default () {
				return {}
			}
		},
		qyinfo:{
			type: Object,
			default () {
				return {}
			}
		},
		basicFj:{
			type: Object,
			default () {
				return {}
			}
		}
	},
	components:{
		noData
	},
	data(){
		return{
			titimg:require('@/work/static/images/infotit.png'),
		}
	},
	onLoad: function() {
	},
	methods:{
		checkPermi, checkRole,
		kaType(ite){
			return selectValue(this.tajdlist, ite);
		},
		getDown(url){
			this.$emit('getDown',url)
		},
		getDownGd(ite){
			var url=[]
			if(ite.shareholderFrontUrl){
				var urla=baseUrl+ite.shareholderFrontUrl;
				url.push(urla)
			}
			if(ite.shareholderBackUrl){
				var urlb=baseUrl+ite.shareholderBackUrl;
				url.push(urlb)
			}
			uni.previewImage({
				current: 0,
				urls: url,
			});
		},
		// 营业执照
		getYyzzFn(url){
			var list=url.split(',')
			return list
		},
		//征信报表
		getFilteFn(url){
			var list=url.split(',')
			list=list.filter((ite) => {
				return this.getFilterFj(ite);
			})
			return list
		},
		// 数据处理
		getFilterFj(url){
			let index1 = url.lastIndexOf("."); // 得到一个索引值
			let index2 = url.length;
			let type = url.substring(index1, index2);
			if ((type.indexOf('jpg') >-1 || type.indexOf('jpeg') > -1 || type.indexOf('png') > -1)) {
				return false
			}else{
				return true
			}
		},
	},
	
  }
</script>

<style lang="scss" scoped>
.boxt{padding: 0 16rpx;border-top: 2rpx solid #E6E6E6;}
.tit{font-weight: bold;font-size: 30rpx;color: $com-cd3;display: flex;align-items: center;padding-top: 44rpx;margin-bottom: 50rpx;padding-left: 20rpx;
	image{width: 30rpx;height: 30rpx;margin-right: 14rpx;}
}
.txt{font-weight: bold;font-size: 30rpx;color: #222327;margin-bottom: 44rpx;padding-left: 20rpx;
	text{color: #666666;font-weight: 500;
		&.txta{color: #28C529;}
	}
	.txtab{color: #28C529;font-weight: 500;margin-right: 24rpx;margin-bottom: 12rpx;display: inline-block;}
	.filist{font-weight: 500;
		color: #28C529;margin-bottom: 8rpx;
	}
}
.flexcw{display: flex;
	.txt{min-width: 50%;}
}
</style>
