<template>
	<!-- 设置 -->
	<view class="page">
		<far-bottom></far-bottom>
		<view class="container padding-box-all">
			<view class="content-box b-f m-btm20 dis-flex flex-x-between flex-y-center padding-box-all bor-radius-10upx" @click="goSet">
				<view class="f-28 col-3">{{languageStatus!=1?'个人资料':'개인정보'}}</view>
				<view class="content-box-iconRight iconfont icon-right"></view>
			</view>
			<view class="content-box b-f m-btm20 dis-flex flex-x-between flex-y-center padding-box-all bor-radius-10upx" @click="goXgmm">
				<view class="f-28 col-3">{{languageStatus!=1?'修改密码':'비밀번호 수정'}}</view>
				<view class="content-box-iconRight iconfont icon-right"></view>
			</view>
			<view class="content-box b-f m-btm20 dis-flex flex-x-between flex-y-center padding-box-all bor-radius-10upx" @click="paw" v-if="TextSubstitution.flag074 == 1">
				<view class="f-28 col-3">修改支付密码</view>
				<view class="content-box-iconRight iconfont icon-right"></view>
			</view>
			<view class="content-box b-f m-btm20 dis-flex flex-x-between flex-y-center padding-box-all bor-radius-10upx" @click="phoneS">
				<view class="f-28 col-3">{{languageStatus!=1?'修改手机号码':'핸드폰번호 수정'}}</view>
				<view class="content-box-iconRight iconfont icon-right"></view>
			</view>
			<view class="content-box b-f m-btm20 dis-flex flex-x-between flex-y-center padding-box-all bor-radius-10upx" @click="skipagreement(1)">
				<view class="f-28 col-3">{{languageStatus!=1?'用户协议':'고객협의'}}</view>
				<view class="content-box-iconRight iconfont icon-right"></view>
			</view>
			<view class="content-box b-f m-btm20 dis-flex flex-x-between flex-y-center padding-box-all bor-radius-10upx" @click="skipagreement(2)">
				<view class="f-28 col-3">{{languageStatus!=1?'隐私协议':'개인정보 협의'}}</view>
				<view class="content-box-iconRight iconfont icon-right"></view>
			</view>
			<!-- #ifndef H5 -->
			<view class="content-box b-f m-btm20 dis-flex flex-x-between flex-y-center padding-box-all bor-radius-10upx" @click="subscription">
				<view class="f-28 col-3">{{languageStatus!=1?'订阅消息':'구독정보'}}</view>
				<view class="content-box-iconRight iconfont icon-right"></view>
			</view>
			<!-- #endif -->
			
			<view class="content-box b-f padding-box-all bor-radius-10upx f-28 t-c" @click="clearToken">{{languageStatus!=1?'退出登录':'로그아웃'}}</view>
		</view>
		<view style="color: gray;width: 300rpx;text-align: center;position: fixed;
			bottom: 30rpx;left: 50%;margin-left: -150rpx;font-size: 23rpx;">当前版本号:1.0.17</view>
		<!-- <bindPhone :phoneShow="phoneShow" @clickmask="closePop" @mobileBulr="mobileBulr"></bindPhone> -->
			<PhoneMask :show1="show1" @clickmask1="closePop1"></PhoneMask>
		<PopManager :show="show2" @clickmask="closeshow">
			<view class="popView">
				<view class="popViewTitle textC font28 color333333">
					<span>修改支付密码</span>
				</view>
				
				<view class="wid400 backFAFAFA  bor10 overHidden height60 marT20Auto">
					<input v-if="show2" placeholder="请输入支付密码" class="font26 color333333 disInline wid360 pL20 height60" v-model="password" type="password" />
				</view>
				<view class="dis-flex inputbox marT20Auto" style="margin-top: 40upx;">
					<!-- <view class="f-28 col-9">
						
					</view> -->
					<input v-if="show2" class="inputclass" placeholder="请输入验证码" v-model="smsCode"  maxlength="11" type="number" value="" />
					<view class="f-28 col-f4" v-if="min>0">
						请等待{{min}}s
					</view>
					<view class="f-28 col-f4" v-else @click="PIN()">
						发送验证码
					</view>
				</view>
				<view class="submitButtom textC">
					<span class="font28 line80 colorW" @click="showTips">提交</span>
				</view>
			</view>
		</PopManager>
	</view>
</template>

<script>
	import App from '@/common/js/app.js'
	import PhoneMask from '@/components/template/PhoneMask'
	import PopManager from '@/components/template/PopManager'
	export default {
		components: {
			PhoneMask,
			PopManager
		},
		data() {
			return {
				phoneShow: false,
				show1: false,
				show2:false,
				TextSubstitution:{},
				min:0,
				smsCode:'',
				phone:'',
				password:''
			}
		},
		onLoad(e) {
			this.TextSubstitution = uni.getStorageSync('TextSubstitution');
			this.phone = uni.getStorageSync('userinfo').truemobile;
		},
		methods: {
			showTips(){
				let _this = this;
				let data = {
					pwd: _this.password,
					code:_this.smsCode
				};
				App._post_form('&p=member&do=integralpwd', data, res => {
					uni.showToast({
						title:'操作成功'
					})
				});
			},
			PIN() {
				let _this = this;
				let data = {
					phone: _this.phone,
					type: 2,
					code:'',
					time:''
				};
				App._post_form('&do=PIN', data, res => {
					_this.getSmsCode = res.data.code;
					_this.min = 60;
					_this.sendcode();
				});
			},
			sendcode(){
				let _this = this;
				if(_this.min != 0){
					_this.min--;
					setTimeout(()=>{
						_this.sendcode()
					},1000)
				}
			},
			closeshow(){
				this.show2 = false;
			},
			paw(){
				this.show2 = true;
			},
			phoneS(){
				this.show1 = true
			},
			mobileBulr(data) {
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 0
				});
			},
			goXgmm() {
				App.navigationTo({
					url: 'pages/subPages/forgetPassword/forgetPassword?type=' + 1
				})
			},
			subscription(){
				App.navigationTo({
					url: 'pages/subPages2/subscription/subscription'
				})
			},
			skipagreement(type) {
				App.navigationTo({
					url: 'pages/mainPages/agreement/agreement?agremType=user&type=' + type
				})
			},
			// 退出
			clearToken() {
				uni.removeStorage({
					key: 'weliam_user_token',
					success: function(res) {
						App.showSuccess('退出成功', () => {
							
							// App.navigationTo({
							// 	url: 'pages/mainPages/login/login'
							// })pages/mainPages/userCenter/userCenter
							uni.navigateBack({
								delta: 1
							})
						})
					}
				});
			},
			goSet() {
				App.navigationTo({
					url: 'pages/subPages2/userInfo/userInfo'
				})
			},
			closePop() {
				let _this = this
				_this.phoneShow = false
			},
			closePop1() {
				let _this = this
				_this.show1 = false
			},
		},
	}
</script>

<style lang="scss">
	.submitButtom {
		width: 360upx;
		height: 80upx;
		background: rgba(255, 68, 68, 1);
		border-radius: 40upx;
		margin: 60upx auto 0;
	}

	.marT20upx {
		margin-top: 20upx;
	}

	.pL20 {
		padding: 0 20upx;
	}

	page {
		background-color: #F5F5F5;
	}

	.content-box-iconRight {
		font-size: 28upx;
	}

	.popView {
		width: 500upx;
		height: 460upx;
		background: rgba(255, 255, 255, 1);
		border-radius: 10upx;
	}
	
	.inputbox{
		// border-bottom: 1upx solid #cccccc;
		height: 60upx;
		width: 400upx;
		line-height: 60upx;
		background: #FAFAFA;
		.inputclass{
			flex: 1;
			text-align: left;
			height: 60upx;
			line-height: 60upx;
			font-size: 28upx;
			padding-left: 20upx;
		}
	}
	
	.popViewTitle {
		padding: 30upx;
	}

	.textC {
		text-align: center;
	}

	.font28 {
		font-size: 28upx;
	}

	.font26 {
		font-size: 26upx;
	}

	.color333333 {
		color: #333333;
	}

	.disInline {
		display: inline-block;
	}

	.wid400 {
		width: 400upx;
	}

	.wid500 {
		width: 500upx;
	}

	.backFAFAFA {
		background: #FAFAFA;
	}

	.marAuto {
		margin: auto;
	}

	.bor10 {
		border-radius: 10upx;
	}

	.overHidden {
		overflow: hidden;
	}

	.wid360 {
		width: 360upx;
	}

	.height60 {
		height: 60upx;
	}

	.marT20Auto {
		margin: 10upx auto 0 auto;
	}

	.marT30Auto {
		margin: 20upx auto 0 auto;
	}

	.line80 {
		line-height: 80upx;
	}

	.colorW {
		color: rgba(255, 255, 255, 1);
	}
</style>
