<template>
	<view class="page flex-col">
		<view class="group_1 flex-row">
			<view class="block_2 flex-col" style="margin: 0px;">
				<!-- <view class="input_2 flex-col"><input class="text_3" disabled="" placeholder="请输入手机号码" v-model="data.mobilephone" /></view> -->
				<!-- <view class="text-wrapper_1 flex-col"><input class="text_4" password="true" type="safe-password" placeholder="请输入原密码" v-model="data.oldmobilepwd" /></view> -->
				<view class="text-wrapper_1 flex-col"><input class="text_4" password="true" type="safe-password" placeholder="请输入登录密码" v-model="data.mobilepwd" /></view>
				<!-- <view class="input_3 flex-col"><input class="text_5" password="true" type="safe-password" placeholder="请再输入一次新密码" v-model="data.mobilepwd1" /></view> -->
				<view class="input_3 flex-col"><input class="text_5" password="true" type="safe-password" placeholder="请输入支付密码" v-model="data.paypwd" /></view>
				<button class="button_1 flex-col" @click="onClick_1"><text class="text_6">提交</text></button>
			</view>
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			constants: {},
			data: {
				nick_name: '',
				mobilephone: '',
				oldmobilepwd:'',
				mobilepwd: '',
				mobilepwd1: '',
				paypwd: '',
				uid:0,
			},
			userinfo:{}
		};
	},
	onShow() {
		var user = this.$api.getUserinfo();
		if (user) {
			// console.log(user);
			this.userinfo = user;
			this.data.mobilephone=user.mobilephone;
			this.data.uid=user.id;
		} else {
			this.userinfo = null;
		}
	},
	onLoad(option) {
		
	},
	methods: {
		onClick_1() {
			var data = new Object();
			data.uid=this.data.uid;
			data.mm=this.data.mobilepwd;
			data.jymm=this.data.paypwd;
			if(data.mobilepwd!=data.mobilepwd1){
				uni.showToast({
					title: "2次登录密码不一致,请确认",
					icon: 'none'
				});
				return;
			}
			this.$api
				.MhPostModel(data,"user/anquan")
				.then(res => {
					// console.log('user/anquan信息', JSON.stringify(res));
					uni.showModal({
						title: '提示',
						content: res.data.msg,
						showCancel:false,
						success: function (res) {
							if (res.confirm) {
								if (res.data.code == 1) {
									setTimeout(function() {
									uni.navigateTo({
										url: '/pages/lanhu_login/index'
									});
									}, 2000);
								}
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});				
				})
				.catch(err => {
					// console.log('request fail', JSON.stringify(err));
				});
		},
		onClick_2() {
			alert('敬请期待');
		}
	}
};
</script>
<style lang="css">
@import '../common/common.css';
@import './assets/style/index.rpx.css';
</style>
