Commit 9d273a8d by LJM

京东卡

parent b9a93418
......@@ -127,6 +127,11 @@
border-radius: 10rpx;
text-indent: 15rpx;
font-size: 26rpx;
border: 1px solid transparent;
&:focus-within {
border: 1px solid #1969f9;
background-color: #ffffff;
}
}
.code-pic {
width: 160rpx;
......@@ -139,6 +144,14 @@
font-size: 26rpx;
color: #1969f9;
}
.code-text {
margin-left: 30rpx;
font-size: 26rpx;
color: #1969f9;
&.disabled {
color: #919399;
}
}
}
}
......
......@@ -90,9 +90,12 @@
text-indent: 23rpx;
font-size: 26rpx;
}
.code {
.code-text {
font-size: 26rpx;
color: #1969f9;
&.disabled {
color: #919399;
}
}
}
&.pwd {
......
<template>
<view class="page-userCoupdz">
<navElement title="京东卡"></navElement>
<view class="list">
<view class="box" v-for="(item, index) in 5" :key="index" :class="{ curr: index == 0 }">
<view class="list" v-if="list.length > 0">
<view class="box" v-for="(item, index) in list" :key="item.id">
<view class="p1 row bothSide verCenter">
<text class="t1">常规新客12月奖励</text>
<text class="t1">{{ item.name }}</text>
<view class="row verCenter">
<text class="iconfont icon-juxing"></text>
<text class="t2" @click="open()">查看</text>
......@@ -12,17 +12,17 @@
</view>
<view class="p2 row verCenter">
<text class="t1">卡号:</text>
<text class="t2">jdvd210264522</text>
<text class="t2">{{ item.card_number }}</text>
<text class="iconfont icon-juxing3" style="margin-right: 57rpx;"></text>
<text class="t1">密钥:</text>
<text class="t2">852157</text>
<text class="t2">{{ item.card_password }}</text>
<text class="iconfont icon-juxing3"></text>
</view>
<view class="p3">有效期:2023.01.26-2023.06.26</view>
<view class="p4">创建时间:2023.01.26-2023.06.26</view>
<view class="p3">有效期:{{ item.period_validity }}</view>
<view class="p4">创建时间:{{ item.allocate_time_format }}</view>
</view>
</view>
<view class="no-data column rowCenter verCenter">
<view class="no-data column rowCenter verCenter" v-else>
<image src="../../static/nodate.png"></image>
<text class="tt">暂无京东卡信息</text>
</view>
......@@ -35,17 +35,17 @@
</view>
<view class="show-input row verCenter" style="margin-bottom: 24rpx;">
<text class="t1">手机号:</text>
<text class="t2">13800138000</text>
<text class="t2">{{ formParams.account }}</text>
</view>
<view class="input-box row" style="margin-bottom: 16rpx;">
<view class="input-box row verCenter" style="margin-bottom: 16rpx;" v-if="verify_flag">
<text class="t1">图形验证码:</text>
<input type="text" placeholder="" class="uni-input" />
<image src="" mode="aspectFill" class="code-pic"></image>
<input type="text" placeholder="" class="uni-input" v-model="formParams.verify" />
<image :src="url" class="code-pic" @click="refresh()"></image>
</view>
<view class="input-box row" style="margin-bottom: 32rpx;">
<view class="input-box row verCenter" style="margin-bottom: 32rpx;">
<text class="t1">短信验证码:</text>
<input type="text" placeholder="" class="uni-input" />
<text class="text">发送验证码</text>
<input type="number" inputmode="numeric" placeholder="" class="uni-input" v-model="formParams.sms_verify" />
<text class="code-text" @click="countdownChange()" :class="{ disabled: code_disabled }">{{ code_text }}</text>
</view>
<view class="btn row rowCenter verCenter">提 交</view>
</view>
......@@ -54,18 +54,122 @@
</template>
<script>
import { Api_Url } from '@/util/api.js';
import { Api_Url, Code_Url } from '@/util/api.js';
import navElement from '@/components/nav.vue';
import { setCookie, delCookie, getCookie, startCountdown } from '@/util/util.js';
export default {
components: {
navElement
},
data() {
return {};
return {
code_text: '获取验证码',
code_disabled: false,
verify_flag: false, //是否显示图形验证码
list: [],
url: Code_Url + '?pf=2', //图形验证码地址
searchForams: {
page: 1,
limit: 1000
},
formParams: {
account: '',
verify: '',
sms_verify: ''
}
};
},
onShow() {
this.getData();
},
onLoad() {},
methods: {
getData() {
this.request(Api_Url + '/user/getUserType', 'POST', {}, true, true).then(res => {
if (res.err_code === 0) {
this.formParams.account = res.data.user_info.mobile;
} else if (res.err_code === 11012) {
uni.navigateTo({
url: '/login'
});
}
});
this.request(Api_Url + '/voucher/getVoucherList', 'GET', this.searchForams, true, true).then(res => {
if (res.err_code === 0) {
this.list = res.data.list;
}
});
},
/**
* 刷新验证码
*/
refresh() {
var Yo4teW_gid = getCookie('Yo4teW_gid');
var Yo4teW_csrf = getCookie('Yo4teW_csrf');
var Yo4teW_uid = getCookie('Yo4teW_uid');
this.url = Code_Url + '?time=' + new Date().getTime() + '&pf=2&Yo4teW_gid=' + Yo4teW_gid + '&Yo4teW_csrf=' + Yo4teW_csrf + '&Yo4teW_uid=' + Yo4teW_uid + '&id=2';
},
/**
* 手机验证码
*/
countdownChange() {
var reg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/;
if (!this.formParams.account) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return false;
}
if (!reg.test(this.formParams.account)) {
uni.showToast({
title: '手机格式错误',
icon: 'none'
});
return false;
}
this.request(Api_Url + '/public/smsVerify', 'POST', { mobile: this.formParams.account, verify: this.formParams.verify }, true, true).then(res => {
if (res.err_code === 0) {
if (!this.code_disabled) {
const countdown = startCountdown({
duration: 60,
onTick: remainingTime => {
this.code_disabled = true;
this.code_text = `重新发送${remainingTime}S`;
},
onComplete: () => {
this.code_disabled = false;
this.code_text = `获取验证码`;
}
});
countdown.start();
}
} else if (res.err_code === 10001 || res.err_code === 10002) {
uni.showModal({
itle: '提示',
content: res.err_msg,
showCancel: false,
success: res => {
if (res.confirm) {
this.verify_flag = true;
this.refresh(); //刷新验证码
} else if (res.cancel) {
}
}
});
} else {
this.verify_flag = false;
uni.showModal({
itle: '提示',
content: res.err_msg,
showCancel: false
});
}
});
},
open() {
this.$refs.popup.open('center');
},
......
......@@ -30,7 +30,7 @@
</view>
<view class="input-box code row bothSide verCenter" style="margin-bottom: 40rpx;">
<input type="number" placeholder="请输入验证码" placeholder-style="color:#919399;" class="uni-input" v-model="formParams.sms_verify" />
<text class="code" @click="countdownChange()" :class="{ disabled: code_disabled }">{{ code_text }}</text>
<text class="code-text" @click="countdownChange()" :class="{ disabled: code_disabled }">{{ code_text }}</text>
</view>
<view class="btn row rowCenter verCenter" @click="submit(1)">提交</view>
</template>
......@@ -75,10 +75,10 @@ export default {
index: 0,
array: ['0086', '00886', '00853', '00852'],
textArr: ['身份验证', '重置密码', '完成'],
verify_flag: false, //是否显示验证码
verify_flag: false, //是否显示图形验证码
pwd_flag: true,
curr: 0,
url: Code_Url + '?pf=2',
url: Code_Url + '?pf=2', //图形验证码地址
formParams: {
password: '',
sms_verify: '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment