<template>
	<view>
		<view class="card">
			<input type="number" v-model="form.tel" placeholder="请输入账号" />
		</view>
		<view class="card">
			<input type="password" v-model="form.old_password" placeholder="请输入旧密码" />
		</view>
		<view class="card">
			<input type="password" v-model="form.new_password" placeholder="请输入新密码" />
		</view>
		<view class="card">
			<input type="password" v-model="form.algin_pasd" placeholder="请再次输入新密码" />
		</view>
		<view class="btn-div">
			 <button :disabled="form.old_password&&form.new_password&&form.algin_pasd?false:true" type="primary" @tap="subMitBtn()" >确认修改</button>
		</view>
		
	</view>
</template>

<script>
	import {modifyPassword} from "../../api/user.js"
	export default {
		data() {
			return {
				form:{
					old_password:'',
					new_password:'',
					algin_pasd:'',
					tel:''
				}
			};
		},methods:{
			subMitBtn(){
				if(this.form.new_password!=this.form.algin_pasd){
					this.$functions.error("两次密码不一致,请重新输入");
					this.form.new_password='';
					this.form.algin_pasd=''
					return false;
				}
				let parm={
					tel:this.form.tel,
					password:this.form.new_password
				}
				modifyPassword(parm).then(res=>{
					this.$functions.success("修改成功").then(()=>{
						uni.navigateTo({
							url: '../login/login',
							success: res => {},
							fail: () => {},
							complete: () => {}
						});
					})
				})
			}
		}
	}
</script>

<style lang="scss">
.card{
	@include wh(750upx,auto);
	padding-top: 30upx;
	padding-bottom: 30upx;
	background: white;
	border-bottom: 2upx solid #f5f5f5;
	input{
		margin-left: 30upx;
	}
}
.btn-div{
	width: 690upx;
	margin: auto;
	margin-top: 30upx;
	
}
</style>
