<template>
	<view class="pages">
		<u-navbar title="实名认证" :border-bottom="false" :background="bgc" back-icon-color="#3D3D3D" title-color='#3D3D3D'
			title-size='36' height='44'></u-navbar>
        <view class="listval">
        	<view class="tit"> 真实姓名</view>
        	<view class="but"> <input type="text" placeholder="请输入真实姓名" v-model="name" /> </view>
        </view>
		<view class="listval">
			<view class="tit"> 身份证号</view>
			<view class="but"> <input type="text" placeholder="请输入身份证号" v-model="names" /> </view>
		</view>
		 <view class="listval">
		 	<view class="tit"> 手机号</view>
		 	<view class="but"> <input type="text" placeholder="请输入手机号" v-model="tel" /> </view>
		 </view>
		 <view class="baocun" v-if="flag">
		 	提交
		 </view>
		<view class="baocun" @click="btncreat" v-else>
			提交
		</view>
		 
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bgc: {
					// backgroundColor: "#8883f0",
				}, 
				name:'',
				names:'',
				tel:'',
				flag:false
			}
		},
		onLoad() {

		},
		// 分享到好友(会话)
		onShareAppMessage: function() {
			return {
				title: '创亿康',
				path: '/pages/index/index'
			}
		},

		// 分享到朋友圈  
		onShareTimeline: function() {
			return {
				title: '创亿康',
				query: '',
				path: '/pages/index/index'
			}
		},
		methods: {
            btncreat(){
				this.flag = true
				let data = {
					realName:this.name,
					realIdCard:this.names,
					realPhone:this.tel
				}
				this.$u.put('/app/user/realName',data).then(res => {
					if(res.code == 200){
						uni.showToast({
						  title: res.msg,
						  icon: 'success',
						  duration: 1500
						})
						setTimeout(()=>{
							this.flag = false
							uni.reLaunch({
								url:'/page_user/homepage'
							})
						},1500)
					}else{
						uni.showToast({
						  title:res.msg,
						  icon: 'none',
						  duration: 2000
						})
						this.flag = false
					}
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	/deep/ .u-title {
		padding-bottom: 15rpx;
	}

	/deep/ .u-icon__icon {
		padding-bottom: 15rpx;
	}

	.pages {
		background-color: #F7FAFE !important;
		height: 100vh;
		width: 100%;
		padding: 0 50rpx;
		box-sizing: border-box;
		.baocun {
			width: 584rpx;
			height: 90rpx;
			background: linear-gradient(90deg, #8883F0 0%, #A29EFF 100%);
			border-radius: 54rpx 54rpx 54rpx 54rpx;
			margin: auto;
			text-align: center;
			line-height: 90rpx;
			position: fixed;
			left: 50%;
			transform: translateX(-50%);
			bottom: 60rpx;
			font-weight: 500;
			font-size: 40rpx;
			color: #FFFFFF;
		}
		
		.listval {
			width: 100%;
			display: flex;
			justify-content: space-between;
			margin-top: 34rpx;
		
			.tit {
				margin-top: 12rpx;
				font-size: 32rpx;
				color: #3D3D3D;
			}
		
			.but {
				width: 462rpx;
				height: 70rpx;
				background: #F0F0F0;
				border-radius: 12rpx 12rpx 12rpx 12rpx;
		
				input {
					height: 70rpx;
					line-height: 70rpx;
					padding-left: 22rpx;
				}
			}
		}
	}

</style>