<template>
	<page-meta :page-style="themeColor"></page-meta>
	<div class="setPayPassword" v-if="show==0">
		<div class="title">请输入账号密码</div>
		<div class="input">
			<!-- <u-code-input v-model="valueone" @change="change"  dot focus size="48"></u-code-input> -->
			<u-input class="inputarr" v-model="valueone" @change="change"></u-input>
		</div>
		<div class="tisp">注：请输入登录密码</div>
		
		<div class="btn" @click="btn">
			保存
		</div>
	</div>
	<!--  -->
	<div class="setPayPassword" v-if="show==1">
		<div class="title">请输入支付密码</div>
		<div class="input">
			<u-code-input v-model="valuetwo" @change="changeone"  dot focus size="48"></u-code-input>
		</div>
		<div class="tisp">注：不能是登录密码或连续数字</div>
		<div class="btn" @click="btnone">
			保存
		</div>
	</div>
</template>

<script>
	export default{
		data(){
			return {
				valueone:'',
				valuetwo:'',
				value:'',//账号登录密码
				valuetwo:'',//支付密码
				show:0,
			}
		},
		onShow() {
			// this.$api.sendRequest({
			// 	url:'/api/salasman/info',
			// 	data:{},
			// 	success:res=>{
			// 		console.log(res,'会员信息');
			// 	}
			// })
		},
		methods:{
			change(value){
				console.log(value,'值');
				this.value=value
			},
			changeone(value){
				console.log(value);
				this.valuetwo=value
			},
			btn(){
				//支付六位数
				if(!this.value.length>0){
					this.$util.showToast({
						title: '请输入密码'
					});
					return
				}
				//跳支付密码
				this.show=1
			},
			btnone(){
				if(this.value==this.valuetwo){
					this.$util.showToast({
						title: '登录密码不能和支付密码相同'
					});
					this.show=0
					this.valueone=''
					this.valuetwo=''
					return
				}
				this.$api.sendRequest({
					url:'/api/salasman/setpaypassword',
					data:{
						password:this.value,
						pay_password:this.valuetwo
					},
					success:res=>{
						this.$util.showToast({
							title: '支付密码设置成功'
						});
						uni.navigateTo({
							url: '/page_salesman_index/userCenter/paySet'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.setPayPassword{
		padding: 58rpx 32rpx;
		.input{
			margin: 50rpx 0;
			display: flex;
			align-items: center;
			justify-content: center;
			::v-deep{
				.u-code-input__item{
					background-color: #F6F6F6 !important;
					border-radius: 8rpx;
					border: none !important;
				}
			}
			.inputarr{
				border: none;
				border-bottom: 2rpx solid #ccc;
			}
		}
		.title{
			font-size: 36rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #333333;
			line-height: 50rpx;
		}
		.tisp{
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #999999;
			
		}
		.btn {
			margin-top: 80rpx;
			height: 80rpx;
			background: $base-color;
			border-radius: 50rpx;
			font-size: 28rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 600;
			color: #FFFFFF;
			text-align: center;
			line-height: 80rpx;
		}
	}
</style>