223 lines
5.2 KiB
Vue
223 lines
5.2 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view v-if="isPwd == 0">
|
|
<view class="contenttext flex-center">
|
|
{{form.password.length == 6?'请再次确认支付密码':"请设置新密码,用于支付验证"}}
|
|
</view>
|
|
<view class="contentbox flex-between">
|
|
<view class="contentboxitem flex-colum">
|
|
{{consumeFee.slice(0,1)}}
|
|
</view>
|
|
<view class="contentboxitem flex-colum">
|
|
{{consumeFee.slice(1,2)}}
|
|
</view>
|
|
<view class="contentboxitem flex-colum">
|
|
{{consumeFee.slice(2,3)}}
|
|
</view>
|
|
<view class="contentboxitem flex-colum">
|
|
{{consumeFee.slice(3,4)}}
|
|
</view>
|
|
<view class="contentboxitem flex-colum">
|
|
{{consumeFee.slice(4,5)}}
|
|
</view>
|
|
<view class="contentboxitem flex-colum">
|
|
{{consumeFee.slice(5,6)}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="" v-else>
|
|
|
|
</view>
|
|
<cwx-keyboard ref="keyboard" v-if="isPwd == 0" @confirmEvent="confirmEvent"
|
|
:money.sync="consumeFee"></cwx-keyboard>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import cwxKeyboard from '@/components/cwx-keyboard/cwx-keyboard';
|
|
export default {
|
|
components: {
|
|
cwxKeyboard
|
|
},
|
|
data() {
|
|
return {
|
|
isPwd: uni.cache.get('userInfo').isPwd,
|
|
form: {
|
|
mobile: uni.cache.get('userInfo').telephone,
|
|
password: '', //密码
|
|
payPassword: '', //二次密码
|
|
checkCode: ''
|
|
},
|
|
passwords: false,
|
|
payPasswords: false,
|
|
// 注册定时器 初始值
|
|
second: 60,
|
|
showText: true,
|
|
Recapture: '发送验证码',
|
|
consumeFee: '', //第一遍
|
|
consumeFees: '', //第二遍
|
|
money: ''
|
|
};
|
|
},
|
|
onLoad() {
|
|
if (uni.cache.get('userInfo').isPwd != 0) {
|
|
uni.setNavigationBarTitle({
|
|
title: '忘记支付密码', // 标题文本,必须是字符串
|
|
});
|
|
}
|
|
},
|
|
watch: {
|
|
consumeFee(newVal, oldVal) {
|
|
if (this.form.password.length == 6) {
|
|
this.form.payPassword = newVal
|
|
if (this.form.payPassword.length == 6) {
|
|
this.userInfosavePayPassword()
|
|
}
|
|
} else {
|
|
this.form.password = newVal
|
|
if (this.form.password.length == 6) {
|
|
this.$refs.keyboard._handleClearKey() //清空
|
|
}
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
confirmEvent(e) {
|
|
console.log(e)
|
|
},
|
|
async CodeRegister() {
|
|
const res = await this.api.phoneValidateCode({
|
|
// post 手机验证码
|
|
phone: this.form.mobile
|
|
});
|
|
if (res) {
|
|
uni.showToast({
|
|
title: '验证码获取成功',
|
|
icon: 'none'
|
|
});
|
|
// 定时器
|
|
this.showText = false;
|
|
this.Recapture = '重新获取';
|
|
var interval = setInterval(() => {
|
|
let times = --this.second;
|
|
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
|
|
}, 1000);
|
|
setTimeout(() => {
|
|
clearInterval(interval);
|
|
this.second = 60;
|
|
this.showText = true;
|
|
}, 60000);
|
|
}
|
|
},
|
|
async loginwxuserInfo() {
|
|
let res = await this.api.loginwxuserInfo({
|
|
userId: uni.getStorageSync('userInfo').id,
|
|
})
|
|
if (res.code == 0) {
|
|
uni.cache.set('userInfo', res.data);
|
|
}
|
|
},
|
|
async userInfosavePayPassword() {
|
|
if (this.form.mobile.length != 11 && this.isPwd == 0) {
|
|
uni.showToast({
|
|
title: '手机号必须是11位',
|
|
icon: 'none'
|
|
});
|
|
return false;
|
|
}
|
|
if (this.form.password == null || this.form.password == '') {
|
|
uni.showToast({
|
|
title: '请输入密码',
|
|
icon: 'none'
|
|
});
|
|
return false;
|
|
}
|
|
if (this.form.payPassword == null || this.form.payPassword == '') {
|
|
uni.showToast({
|
|
title: '请输入确认密码',
|
|
icon: 'none'
|
|
});
|
|
return false;
|
|
}
|
|
if (this.form.password.length != 6 || this.form.payPassword.length != 6) {
|
|
uni.showToast({
|
|
title: '密码必须是6位',
|
|
icon: 'none'
|
|
});
|
|
return false;
|
|
}
|
|
if (this.form.payPassword != this.form.password) {
|
|
this.$refs.keyboard._handleClearKey() //清空
|
|
this.form.payPassword = ''
|
|
this.form.password = ''
|
|
uni.showToast({
|
|
title: '密码和确认密码不一致',
|
|
icon: 'none'
|
|
});
|
|
return false;
|
|
}
|
|
if (this.form.checkCode == null || this.form.checkCode == '') {
|
|
uni.showToast({
|
|
title: '请输入验证码',
|
|
icon: 'none'
|
|
});
|
|
return false;
|
|
}
|
|
let res = await this.api.loginresetPwd({
|
|
pwd: this.form.password,
|
|
code: this.form.checkCode
|
|
})
|
|
|
|
if (res.code == 0) {
|
|
if (uni.cache.get('userInfo').isPwd != 0) {
|
|
uni.showToast({
|
|
title: '修改成功',
|
|
icon: 'none'
|
|
});
|
|
} else {
|
|
uni.showToast({
|
|
title: '设置成功',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
// 获取用户信息
|
|
this.loginwxuserInfo()
|
|
setTimeout(() => {
|
|
uni.navigateBack();
|
|
}, 1000);
|
|
} else {
|
|
this.$refs.keyboard._handleClearKey() //清空
|
|
this.form.payPassword = ''
|
|
this.form.password = ''
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.content {
|
|
height: 100%;
|
|
background: #FFFFFF;
|
|
|
|
.contenttext {
|
|
padding: 48rpx 0;
|
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
font-weight: 500;
|
|
font-size: 40rpx;
|
|
color: #333333;
|
|
}
|
|
|
|
.contentbox {
|
|
margin-top: 48rpx;
|
|
padding: 0 56rpx;
|
|
|
|
.contentboxitem {
|
|
width: 88rpx;
|
|
height: 88rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
|
border: 2rpx solid #999999;
|
|
}
|
|
}
|
|
}
|
|
</style> |