<template>
	<view class='container'>
		<view class="mt-50">
			<view>
				<text style="color: #FF0000;">*</text><text style="color:#FFFFFF;">姓名</text>
			</view>
			<input placeholder="请输入姓名" v-model="userName" class="h-85 br-10 fs-24 plr-20 mt-24"
				style="background-color: white;color: #999999;" />

		</view>
		<view class="mt-50 ">
			<view>
				<text style="color: #FF0000;">*</text><text style="color:#FFFFFF;">身份证号</text>
			</view>
			<input placeholder="请输入身份证号" v-model="userNumber" class="h-85 br-10 fs-24 plr-20 mt-24"
				style="background-color: white;color: #999999;" maxlength="18" />
		</view>

		<view @click="onSubmit" class="btn">
			<text>提交</text>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex"
	export default {
		data() {
			return {
				userName: '',
				userNumber: ''
			};
		},
		onLoad(options) {
			console.log(options)
			if (!!options.realname) {
				this.userName = options.realname
				this.userNumber = options.realname
			}
		},
		methods: {
			onSubmit() {
				if (!this.userName) {
					return this.$u.toast('请输入真实姓名')
				}
				if (!this.userNumber) {
					return this.$u.toast('请输入身份证号')
				}
				if (!this.$wskj.testIdCard(this.userNumber)) {
					uni.showToast({
						title: '身份证号码格式不正确，请重新输入',
						icon: 'none'
					});
					return
				}
				const params = {
					url: '/system/member/validateRealname',
					loadingTip: '',
					data: {
						realname: this.userName,
						idNumber: this.userNumber
					}
				}
				this.$request(params).then(res => {
					this.$u.toast(res.msg || '修改成功')
					setTimeout(() => {
						this.$wskj.goBack(1)
					}, 600)
				})
			}
		},
	};
</script>

<style scoped>
	.container {
		height: 100%;
		padding: 30rpx 30rpx 0;
		background: #0F0F0F;
	}



	.user-input {
		text-indent: 20rpx;
	}

	.inp {
		width: 100%;
		height: 85rpx;
		background: #fff;
		display: flex;
		margin-top: 24rpx;
		align-items: center;
		border-radius: 10rpx;
	}

	.btn {
		width: 94%;
		height: 96rpx;
		text-align: center;
		line-height: 96rpx;
		position: absolute;
		bottom: 100rpx;
		left: 50%;
		margin-left: -47%;
		background-color: #FE42C2;
		color: #fff;
		font-size: 32rpx;
		border-radius: 50rpx;
	}
</style>