<template>
  <view class="body_content">
	<view class="login_text">
		<view class="example-title">修改交易密码</view>
		<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" style="border: none;">
			<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>
  </view>
</template>
<script type="text/javascript">
// import { show_us,attestation } from '@/api/user.js';
export default {
  data() {
    return {
	  username:'',
	  idCard:'',
	  phone:'',
	  vcode:''
    };
  },
  onLoad() {
  	// this.uid = uni.getStorageSync('uid');
  	// console.log(uni.getStorageSync('uid'),this.uid)
   //  this.loadData();
  },
  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);
	}
  }
};
</script>
<style lang="scss">
.login_text {
	width: 100%;
	// padding: 25rpx 0rpx;
	font-size: 28rpx !important;
	background: #1F2A4A;
	padding: 0rpx 25rpx;
}
.login_input {
	border-bottom: 1px solid #464755;
	padding: 35rpx;
}
.uploadText{
	padding: 47rpx 40rpx;
	color: #ffffff;
	
}
.imageBox{
	width: 100%;
	padding: 50rpx 15%;
}
.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;
}
.example-title {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 30rpx;
	color: #fff;
	padding: 30rpx 30rpx 30rpx 50rpx;
	position: relative;
	background-color: #1F2A4A;
	border-bottom: 1rpx solid #464755;
}
.example-title:after {
	content: '';
	position: absolute;
	left: 30rpx;
	margin: auto;
	top: 0;
	bottom: 0;
	width: 4rpx;
	height: 32rpx;
	background-color: #0C5AFA;
}
</style>
