<template>
|
<div class="loan-info-box">
|
<x-header slot="header"
|
style="width:100%;height:46px;background-color: #ec6758"
|
title="重置交易密码"
|
:left-options="{backText: ''}"></x-header>
|
<div v-if="step===1">
|
<div class="Code_ls">
|
<h4>为了您的账户安全,需要进行短信验证</h4>
|
<span>手机号码</span><span>{{userPhone}}</span>
|
</div>
|
<div id="code" class="code_input">
|
<x-input placeholder="请输入短信验证码"
|
:max="6"
|
:min="6"
|
type="tel"
|
v-model.trim="code"
|
@input.native="inputChange"
|
>
|
</x-input>
|
<span v-if="codeSecond===-1" @click="getCode">获取验证码</span>
|
<span v-else class="count">{{codeSecond}}秒后重发</span>
|
</div>
|
</div>
|
<div v-else>
|
<group class="personInfo xInput">
|
<x-input text-align="right" v-model.trim="newPwd" type="password" title="交易密码" :min="6" :max="6"
|
placeholder="请输入6位数字"
|
required @on-blur="checkNewPwd"></x-input>
|
<x-input text-align="right" v-model.trim="confirmPwd" type="password" title="确认交易密码" :min="6" :max="6"
|
placeholder="请再次输入密码"
|
required @on-blur="checkConfirmPwd"></x-input>
|
</group>
|
</div>
|
<div style="height: 20px"></div>
|
<box gap="0 15px">
|
<x-button type="primary" @click.native="handleUpStep">返回</x-button>
|
<x-button v-if="step===1" type="primary" @click.native="loanCheckCode">下一步</x-button>
|
<x-button v-else type="primary" @click.native="resetPwd">重置密码</x-button>
|
</box>
|
<div style="height: 20px"></div>
|
</div>
|
</template>
|
|
<script>
|
import {XHeader, Group, XInput, XButton, Box, md5} from 'vux';
|
import validate from '../../../tool/validator';
|
import fToast from '../../../tool/fToast';
|
import SysApi from '../../../api/api'
|
import statusCodeManage from '../../../api/statusCodeManage';
|
|
export default {
|
name: 'loanMessage',
|
components: {XHeader, Group, XInput, XButton, Box},
|
data() {
|
return {
|
code: '',//输入的验证码
|
codeSecond: -1,//验证码倒计时
|
step: 1,//当前步骤
|
newPwd: '',//新交易密码
|
confirmPwd: '',//确认交易密码
|
token: ''//验证码校验成功返回token
|
};
|
},
|
computed: {
|
userPhone() {
|
return validate.formatPhone(sessionStorage.newPhoneNum)
|
},
|
canClick() {
|
return this.newPwd.length === 6 && this.confirmPwd.length === 6
|
}
|
},
|
methods: {
|
//返回跳转
|
handleUpStep() {
|
this.codeSecond = -1;
|
this.$router.back()
|
},
|
//验证码输入框input事件
|
inputChange() {
|
setTimeout(() => {
|
if (this.code) {
|
this.code = this.code.replace(/[^\d]/g, '');
|
}
|
}, 1);
|
},
|
//发送验证码,验证码倒计时
|
getCode() {
|
this.codeSecond = 60;
|
let timer = setInterval(() => this.codeSecond === -1 ? clearInterval(timer) : this.codeSecond--, 1000);
|
//调用发送验证码接口
|
SysApi.loanSendCode({prodId: sessionStorage.prodId}).then(res => {
|
}, err => {
|
statusCodeManage.showTipOfStatusCode(err);
|
this.codeSecond = -1
|
})
|
},
|
//下一步按钮事件
|
loanCheckCode() {
|
if (validate.checkValEmpty(this.code)) {
|
fToast.toast('请输入验证码');
|
return false;
|
}
|
//调用发送验证码接口
|
SysApi.loanCheckCode({
|
prodId: sessionStorage.prodId,
|
code: this.code,
|
}).then(res => {
|
this.token = res.body.token;
|
this.step = 2;
|
}, err => {
|
statusCodeManage.showTipOfStatusCode(err)
|
})
|
},
|
//验证密码是否为纯6位数字
|
checkPwd(pwd = this.oldPwd) {
|
if (validate.checkValEmpty(pwd)) {
|
fToast.toast('请输入密码');
|
return false;
|
} else {
|
let res = validate.checkVerifyCode(pwd);
|
if (!res) fToast.toast('请输入6位数字');
|
return res
|
}
|
},
|
//检查新密码是否与确认密码相等
|
checkConfirmPwd() {
|
if (this.checkPwd(this.confirmPwd)) {
|
if (this.confirmPwd.length === 6 && this.newPwd !== this.confirmPwd) {
|
fToast.toast('确认密码不一致');
|
return true;
|
} else return false
|
} else return true
|
},
|
// 确认修改按钮
|
resetPwd() {
|
if (this.checkConfirmPwd()) return;
|
SysApi.resetPwd({
|
prodId: sessionStorage.prodId,
|
token: this.token,
|
newPwd: md5(sessionStorage.newPhoneNum + this.newPwd),
|
confirmPwd: md5(sessionStorage.newPhoneNum + this.confirmPwd),
|
}).then(res => {
|
this.$router.push({path: '/bnd/loan/resetSuccess'});
|
}, err => {
|
statusCodeManage.showTipOfStatusCode(err)
|
})
|
}
|
},
|
activated() {
|
this.step = 1;
|
this.code = '';
|
this.newPwd = '';
|
this.confirmPwd = '';
|
this.getCode();
|
}
|
};
|
</script>
|
|
<style lang="less">
|
@import "../../../style/mixin.less";
|
|
.loan-info-box {
|
background-color: @color-background-default;
|
.vux-header {
|
.color-linear-gradient(@color-primary-light, @color-primary, 90deg);
|
.vux-header-left {
|
.left-arrow:before {
|
border: solid 1px @color-white;
|
border-width: 2px 0 0 2px;
|
}
|
}
|
}
|
}
|
|
.weui-wepay-flow {
|
background-color: @color-white;
|
}
|
|
.left-arrow:before {
|
border-color: @color-white;
|
}
|
|
.weui-cells__title {
|
margin: 0 !important;
|
font-size: 16PX !important;
|
}
|
|
.weui-input, .weui-cell__bd {
|
font-size: @font-size-base;
|
}
|
|
.weui-label {
|
font-size: @font-size-base;
|
}
|
|
.personInfo ::-webkit-input-placeholder { /* WebKit browsers */
|
color: #bfbfbf;
|
}
|
|
.personInfo :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
|
color: #bfbfbf;
|
}
|
|
.personInfo ::-moz-placeholder { /* Mozilla Firefox 19+ */
|
color: #bfbfbf;
|
}
|
|
.personInfo :-ms-input-placeholder { /* Internet Explorer 10+ */
|
color: #bfbfbf;
|
}
|
|
.xInput {
|
.weui-cell {
|
height: 24px;
|
.weui-cell__ft {
|
font-size: 10px;
|
}
|
}
|
}
|
|
.header-space {
|
height: 46px;
|
}
|
|
.loan-info-box .weui-cell_select .weui-select {
|
padding-right: 2.5rem;
|
direction: rtl;
|
}
|
|
.loan-info-box .weui-input {
|
text-align: right;
|
}
|
|
.loan-info-box .weui-btn_primary {
|
.color-linear-gradient(@color-primary-light, @color-primary, 90deg);
|
}
|
|
.loan-info-box .weui-btn_primary:not(.weui-btn_disabled):active {
|
color: rgba(255, 255, 255, 0.6);
|
background-color: rgb(241, 95, 79);;
|
}
|
|
/*------------------------------*/
|
.Code_ls {
|
padding: 0.25rem 1.25rem;
|
h4 {
|
padding-bottom: 1.2rem;
|
padding-top: 1rem;
|
font-size: @font-size-medium;
|
font-weight: normal;
|
color: @color-text-primary;
|
}
|
span {
|
color: @color-text-third;
|
display: inline-block;
|
}
|
span:last-child {
|
margin-left: 0.5rem;
|
}
|
}
|
|
.vux-no-group-title {
|
margin-top: 0.77rem !important;
|
}
|
|
.loan-info-box .currentStep .weui-wepay-flow__state {
|
background-color: @color-primary;
|
color: @color-white !important;
|
line-height: 1rem;
|
}
|
|
.weui-wepay-flow__li.weui-wepay-flow__li .weui-wepay-flow__state {
|
width: 1.33333rem;
|
height: 1.33333rem;
|
border-radius: 1.58333rem;
|
color: @color-text-third;
|
line-height: 1.33333rem;
|
}
|
|
.loan-info-box .weui-input {
|
text-align: left;
|
}
|
|
.porcolor p {
|
color: @color-primary;
|
}
|
|
#code.code_input {
|
padding: 1rem 1.25rem;
|
background-color: @color-white !important;
|
font-size: @font-size-medium;
|
overflow: hidden;
|
.weui-cell {
|
margin: 0px;
|
padding: 0px;
|
width: 69%;
|
height: 24px;
|
float: left;
|
.weui-cell__bd {
|
width: 70%;
|
display: inline-block;
|
}
|
.weui-cell__ft {
|
display: inline-block;
|
}
|
}
|
input {
|
border: none;
|
width: 100%;
|
text-align: left !important;
|
outline: none;
|
font-size: @font-size-medium;
|
}
|
span {
|
display: inline-block;
|
font-size: @font-size-medium;
|
color: @color-text-third;
|
padding: 0.25rem 0;
|
border-left: 1px solid @color-text-third;
|
text-align: center;
|
width: 30%;
|
float: left;
|
}
|
|
}
|
|
.weui-cell__ft button {
|
background-color: @color-white !important;
|
}
|
|
.weui-btn:after {
|
border: none !important;
|
}
|
|
.weui-btn {
|
font-size: @font-size-primary !important;
|
}
|
</style>
|