<template>
|
<view style="min-height: 100vh;background: #F7F7F7">
|
|
<view class="content">
|
<uv-form style="background: white" :labelStyle='lstyle' labelPosition="left" :model="userInfo" ref="form" labelWidth="100">
|
|
<uv-form-item class="item" label="手机号" prop="bankPhoneNo" borderBottom>
|
<uv-input maxlength="11" disabled disabled-color="none" inputAlign="right" v-model="userInfo.bankPhoneNo" border="none" placeholder="请输入手机号"></uv-input>
|
</uv-form-item>
|
|
<uv-form-item class="item" label="短信码" prop="needVerify" >
|
<uv-input maxlength="6" inputAlign="right" v-model="userInfo.needVerify" border="none" placeholder="请输入验证码">
|
<template #suffix>
|
<button class="code" @click="getCode">{{ isCounting ? countText : '获取验证码' }}</button>
|
</template>
|
</uv-input>
|
</uv-form-item>
|
|
|
</uv-form>
|
<view style="margin: 40rpx;">
|
<uv-button :disabled="disabled" @click="submit" :custom-style="customStyle" type="primary" Color="#2865F2" shape="circle">确认提交</uv-button>
|
|
</view>
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
|
|
import throttle from '@/uni_modules/uv-ui-tools/libs/function/throttle.js';
|
import {bankcardExchange, bankcardSmsverify, xinheyuanSmsSend} from "@/api/modules/user";
|
|
export default {
|
computed: {
|
customStyle() {
|
return {
|
height: '100rpx',
|
background: '#4766FE',
|
color: '#fff',
|
borderRadius: '50rpx' ,
|
fontSize:'34rpx'
|
}
|
}
|
},
|
data() {
|
return {
|
index:null,
|
disabled:false,
|
lstyle:{
|
color:'#252938',
|
fontSize:'28rpx',
|
fontWeight:'800'
|
},
|
userInfo:{
|
needVerify:null,
|
bankPhoneNo:null,
|
},
|
isCounting: false,
|
countText: '',
|
code:'',
|
queryType:null,
|
cardNo:null,
|
}
|
},
|
onLoad(params) {
|
|
this.userInfo.bankPhoneNo = params.bankPhoneNo || uni.getStorageSync('phone');
|
this.index = params.index;
|
this.code = params.code;
|
this.queryType = params.queryType;
|
this.cardNo = params.cardNo;
|
this.bankCode = params.bankCode;
|
this.bankName = params.bankName;
|
this.bankId = params.bankId;
|
if(params.queryType==1){
|
uni.setNavigationBarTitle({
|
title: '还款'
|
});
|
};
|
const rpVip_sendCode_time = uni.getStorageSync(`rpVip_sendCode_time_${this.code}`);
|
|
if(!rpVip_sendCode_time){
|
this.smsSend()
|
}
|
},
|
onShow() {
|
const rpVip_sendCode_time = uni.getStorageSync(`rpVip_sendCode_time_${this.code}`);
|
if (rpVip_sendCode_time) {
|
const currTime = new Date().getTime()
|
const jgTime = parseInt((currTime - rpVip_sendCode_time) / 1000)
|
|
console.log("间隔时间", jgTime)
|
|
if(jgTime > 60) {
|
this.smsSend()
|
|
}
|
else {
|
this.isCounting = true
|
let count = 60 - jgTime;
|
this.$set(this, 'countText', `${count}秒后重新获取`);
|
const timer = setInterval(() => {
|
count--;
|
if (count <= 0) {
|
clearInterval(timer);
|
this.$set(this, 'isCounting', false);
|
} else {
|
this.$set(this, 'isCounting', true);
|
this.$set(this, 'countText', `${count}秒后重新获取`);
|
}
|
}, 1000);
|
|
}
|
}
|
},
|
|
methods: {
|
|
getCode() {
|
if(this.isCounting){
|
return;
|
}
|
|
|
|
this.smsSend()
|
},
|
submit(){
|
|
if(!this.userInfo.needVerify){
|
uni.showToast({
|
title: '请输入短信码',
|
icon: 'none'
|
});
|
return;
|
}
|
|
this.disabled = true
|
bankcardSmsverify(
|
{
|
customerBankcardId: uni.getStorageSync('customerBankcardId'),
|
fundCode:this.code,
|
scene: this.queryType == 1? "03" : null,
|
codeLoan:this.userInfo.needVerify
|
}
|
).then(res=>{
|
if(res){
|
let page = getCurrentPages();
|
let currPage = page[page.length - 2];
|
currPage.$vm.changeFlag(this.index);
|
uni.navigateBack({delta: 1})
|
} else {
|
uni.showToast({
|
title: "银行款卡校验失败",
|
icon: "none",
|
});
|
}
|
|
}).finally(()=>{
|
this.disabled = false;
|
})
|
|
|
|
|
},
|
|
|
//
|
smsSend(){
|
let pro = {
|
customerBankcardId: uni.getStorageSync('customerBankcardId'),
|
fundCode:this.code,
|
scene: this.queryType == 1? "03" : null
|
}
|
throttle(async ()=>{
|
if(this.queryType==1){
|
await bankcardExchange({
|
customerId: uni.getStorageSync('customerZcyId'),
|
cardNo:this.cardNo,
|
bankPhoneNo:this.userInfo.bankPhoneNo,
|
bankCode: this.bankCode,
|
bankName:this.bankName,
|
bankId:this.bankId,
|
})
|
}
|
|
|
|
|
await xinheyuanSmsSend(pro).then(res=>{
|
uni.setStorageSync(`rpVip_sendCode_time_${this.code}`, new Date().getTime());
|
|
uni.showToast({
|
title: '验证码已发送',
|
icon: 'none'
|
});
|
|
// 设置倒计时功能
|
let count = 60;
|
const timer = setInterval(() => {
|
count--;
|
if (count <= 0) {
|
clearInterval(timer);
|
this.$set(this, 'isCounting', false);
|
} else {
|
this.$set(this, 'isCounting', true);
|
this.$set(this, 'countText', `${count}秒后重新获取`);
|
}
|
}, 1000);
|
|
}) })
|
|
}
|
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
page{
|
background: #F7F7F7;
|
}
|
.content{
|
.item{
|
padding:0 30rpx;
|
}
|
.line{
|
height: 20rpx;
|
background: #F7F7F7;
|
}
|
.code{
|
margin-left: 40rpx;
|
font-size: 24rpx;
|
color: #4766FE;
|
background: none;
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
border: 2rpx solid #4766FE;
|
}
|
|
.but{
|
margin: auto;
|
margin-top: 40rpx;
|
color: white;
|
width: 100%;
|
height: 100rpx;
|
background: #2865F2;
|
border-radius: 50rpx 50rpx 50rpx 50rpx;
|
}
|
.tips{
|
margin-top: 40rpx;
|
color: #EE2626;
|
font-size: 24rpx;
|
}
|
.hover-bu1t{
|
background: linear-gradient( 270deg, #4766FE 0%, #7D9FFF 100%), linear-gradient( 104deg, #6D89FF 0%, #2865F2 100%) !important;
|
|
opacity: 0.5;
|
}
|
}
|
</style>
|