<template>
	<div>
		<cu-custom bgColor="bg-gradual-pink" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">薪资查询</block>
		</cu-custom>
		<br>
		<view class="cu-form-group" >
		    <view ><image src="../../static/cards.png" class="imgs"></image></view>
		    <view style="margin-left: 10px;">{{cardName}}****</view>
			<input placeholder="请输入身份证后6位" v-model="name" ></input>
		</view>
		<!-- <div class="dt">
			<ul style="margin-left: -45px;">
				<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">
				<li >
					<view class="cu-form-group" >
					    <view class="title" style="margin-top: 10px;"><image src="../../static/eml.png" class="imgs"></image></view>
					    <input placeholder="请输入邮箱" v-model="name" ></input>
					</view>
					<div style="width: 100%; height: 1px; border-top: solid #ACC0D8 1px;"></div>
				</li>
				</view>
				<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<li >
					<view class="cu-form-group" >
					    <view class="title" style="margin-top: 10px;"><image src="../../static/yzm.png" class="imgs"></image></view>
					    <input placeholder="邮箱验证码" v-model="code" ></input>
						<button class='cu-btn bg-blue shadow'@click="getCode" v-if="show">验证码</button>
						
						<span v-if="!show" style="color: #D7D9E0;float: right;font-size: 15px;">已发送({{ times }})</span>
					</view>
					<div style="width: 100%; height: 1px; border-top: solid #ACC0D8 1px;"></div>
				</li>
				</view>
				
				
			</ul>
		</div> -->
		<br>
		<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">
		<button style="background-color: #3C7AD8;color: #FFFFFF; width: 90%;" @click="save()">确定</button>
		<br>
		</view>
		</div>
</template>

<script>
	export default {
		data() {
			return {
				name: null,
				code: null,
				times: 60,
				show: true,
				cardName:"",
				userUrl: '/sys/user/sendEamilCode',
				emlCode: '/sys/user/GetEamilCode'
			}
		},
		created() {
			this.getCode()
			// var bankCode=uni.getStorageSync('bankCode');
			// if(bankCode!=null&&bankCode!=""){
			// 	this.$router.push({
			// 		name: 'wagesdetails'
			// 	});
			// }else{
			// 	this.getCode()
			// }
			
		},
		methods: {
			getCode() {
				
				var userid=this.$store.getters.userid;
				this.$http.get(this.userUrl, {
					params: {
						userid: userid
					}
				}).then(res => {
					if (res.data!=""&&res.data!=null) {
						this.cardName=res.data;
					} else {
						this.$tip.alert('暂无身份证信息!')
					}
				}).catch(err => {
					console.log(err);
				});

			},
			save() {
				if (this.name == "" || this.name == null) {
					this.$tip.alert("身份证不能为空");
					return false;
				}
				var userid=this.$store.getters.userid;
				this.$http.get(this.emlCode, {
					params: {
						userid: userid,
						card: this.name
					}
				}).then(res => {
					console.log(res)
					if (res.data == "ok") {
						uni.setStorageSync('bankCode',this.name);
						this.$router.push({
							name: 'wagesdetails'
						});
						
					}else{
						this.$tip.alert('身份证后6位错误!')
					}

				}).catch(err => {
					console.log(err);
				});
			}

		}
	}
</script>

<style>
	.dt{
		background-color: #FFFFFF;
		width: 90%;
		margin: 0 auto;
		margin-top: 20px;
		
	}
	.top {
		background-color: #5677AC;
		width: 100%;
		height: 40px;

	}

	ul li {
		list-style-type: none;

	}

	/* .img {
		width: 25px;
		height: 25px;
		background-size: 100% 100%;
	} */
	
	.img{
		width: 25px;
		height: 25px;
		background-size:100% 100%; 
	}
	.imgs{
		width: 20px;
		height: 20px;
		background-size:100% 100%; 
	}
</style>
