<template>
  <view class="body_content">
	<view class="login_text">
		<view class="login_input flex" style="padding-top: 45rpx;"> 
			<view class="login_name">姓名</view>
			<view class="login_name"><input class="uni-input" type="text" v-model="username" placeholder="请输入真实姓名" /></view>
		</view>
		<view class="login_input flex">
			<view class="login_name"><text>身份证号</text></view>
			<view class="login_name"><input class="uni-input" type="idcard" v-model="idCard" placeholder="请输入身份证号" /></view>
		</view>
		<view class="login_input flex">
			<view class="login_name"><text>手机号</text></view>
			<view class="login_name"><input class="uni-input" type="number" v-model="phone" placeholder="请输入手机号" /></view>
		</view>
		<view class="login_input flex">
			<view class="login_name"><text>验证码</text></view>
			<view class="login_name flex_item">
				<input style="width: 310rpx;" class="uni-input" type="number" v-model="vcode" placeholder="请输入验证码" />
				<view class="" style="font-size: 26rpx;color: #0C5AFA;">获取验证码</view>
			</view>
		</view>
	</view>
	<view class="submission"><button class="golden" type="golden" hover-class="none" @click="submission">确认提交</button></view>
	<view class="">身份证照片(正反两面）</view>
	<view class="flex upLoadBox">
		<view class="">
			<image src="../../static/img/add.png" style="width: 180rpx;" mode="widthFix"></image>
			<image src="../../static/img/add.png" style="width: 180rpx;" mode="widthFix"></image>
		</view>
	</view>
	<!-- <view class="example-title"><text>资金账户</text></view>
	<view class="login_text">
		<view class="login_input flex" style="padding-top: 45rpx;"> 
			<view class="login_img"><text>保证金余额</text></view>
			<view class="login_name"><text>2514. 00U</text></view>
		</view>
		<view class="login_input flex">
			<view class="login_img"><text>奖励金额</text></view>
			<view class="login_name"><text>1254.00U</text></view>
		</view>
		<view class="login_input flex">
			<view class="login_img"><text>佣金费率</text></view>
			<view class="login_name"><text>1.6</text></view>
		</view>
		<view class="login_input flex">
			<view class="login_img"><text>已收款金额</text></view>
			<view class="login_name"><text>54500U</text></view>
		</view> -->
	</view>
  </view>
</template>
<script type="text/javascript">
import { show_us,attestation } from '@/api/user.js';
export default {
  data() {
    return {
	  username:'',
	  idCard:'',
	  phone:'',
	  vcode:''
    };
  },
  methods: {
    //获取数据
    loadData() {
      show_us({
		  uid:this.uid
	  })
        .then(data => {
		  let obj = this;
          obj.list = data.data;
		  if(data.data.card == null){
			  obj.number = "";
		  }else{
			   obj.number = data.data.card;
		  }
		 if(data.data.email == null){
			obj.mail = ""; 
		 }else{
			 obj.mail = data.data.email;
		 }
		 if( data.data.name == null){
			 obj.username = '';
		 }else{
			 obj.username = data.data.name;
		 }
		  
        })
        .catch(err => {
          console.log(err);
        });
    },
	// 提交
	submission() {
		if (this.mail == '') {
			this.$api.msg('请输入电子邮箱');
			return;
		}
		if (this.username == '') {
			this.$api.msg('请输入真实姓名');
			return;
		}
		if (this.number == '') {
			this.$api.msg('请输入身份证号');
			return;
		}
		attestation({
			uid:this.uid,
			email: this.mail,
			name: this.username,
			card: this.number,
		})
			.then(function(e) {
				uni.showToast({
					title: e.message,
					duration: 1500,
					mask: false,
					icon: 'none'
				});
			})
			.catch(function(e) {
				console.log(e);
			});
	},
	//下拉刷新
	onPullDownRefresh() {
		let obj = this;
		//监听下拉刷新动作的执行方法，每次手动下拉刷新都会执行一次
		setTimeout(function() {
			obj.loadData();
			uni.stopPullDownRefresh(); //停止下拉刷新动画
		}, 1000);
	}
  },
  onLoad() {
	this.uid = uni.getStorageSync('uid');
	console.log(uni.getStorageSync('uid'),this.uid)
    this.loadData();
  },
};
</script>
<style lang="scss">
.login_text {
	width: 100%;
	// padding: 25rpx 0rpx;
	font-size: 28rpx !important;
	padding: 0rpx 25rpx;
}
.login_input {
	border-bottom: 1px solid #464755;
	padding: 35rpx;
}
.uni-input{
	width:450rpx;
	text-align: left !important;
	font-size: 26rpx;
}
.width {
	width: 265rpx !important;
}
.code {
	color: #EEC680;
	font-size: 23rpx;
	border-left: 1px solid #85858E;
	padding-left: 25rpx;
}
.submission{
	padding: 80rpx 25rpx;
	.golden{
		background: #0C5AFA;
		color: #ffffff;
	}
}
.login_name {
	color: #ffffff;
}
</style>
