<template>
	<view>
		<view v-for='(item,index) in cardList' class="">
			{{item.certificateName}}
			<text v-if='item.personNo'>({{item.personNo1}})</text>
			<u-icon v-if='item.personNo' @click='clip(0,item)' name="file-text-fill" color="#2979ff" size="28"></u-icon>
			<text v-if='item.bankNo'>({{item.bankNo1}})</text>
			<u-icon v-if='item.bankNo' @click='clip(1,item)' name="file-text-fill" color="#2979ff" size="28"></u-icon>
			<view @click='imageOCR(item)'>{{text}}</view>
			<image  :src="item.certificateImage" mode=""></image>
		</view>
		<u-picker @cancel='show=false' @confirm='pickerConfirm' title='识别类型' :show="show" :columns="columns"></u-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cardList:[],
				show:false,
				currectData:{},
				text:'识别号码'
			}
		},
		onLoad(options) {
			this.cardList=options.cardList
		},
		methods: {
			imageOCR(item){
				this.currectData=item
				this.show=true
			},
			getCountdownTime(e) {
				this.countdownTime = 60
				let timer = setInterval(() => {
					this.countdownTime--;
					if (this.countdownTime < 1) {
						clearInterval(timer)
						this.countdownTime = 0
						uni.showLoading({
								title: '数据加载中',
								mask:true
							})
						var type='',type1=''
						if(e.value[0]=='识别身份证号'){
							type='admin.unimall.certificateManagementInfo'
							type1='personShibie'
						}else if(e.value[0]=='识别银行卡号'){
							type='admin.unimall.certificateManagementInfo'
							type1='bankShibie'
						}
						this.$request.baseRequest(type, type1,{certificateImage:this.currectData.certificateImage}, failres => {
							console.log('res+++++', failres.errmsg)
							this.$refs.uToast.show({
								type: 'error',
								message: failres.errmsg,
							})
							uni.hideLoading()
						}).then(res => {
							console.log(res.data)
							this.$refs.uToast.show({
								type: 'success',
								message: '识别成功',
							})
							uni.hideLoading()
							this.credentials=res.data
							this.credentialsShow=true
						})		
					}
				}, 1000)
			},
			pickerConfirm(e){
				
				this.show=false
				this.getCountdownTime(e)
				console.log(e)
				
			},
		}
	}
</script>

<style>

</style>
