Files
ysdH5/pages/giftPack/superRed.vue
2023-09-28 14:35:28 +08:00

392 lines
10 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content">
<image class="superRed-back" src="https://card.ysd-bs.com/storage/materials/2023/08/08/视频权益包2.png" mode="widthFix"></image>
<view class="superRed-cont">
<view class="superRed-img">
<image src="https://card.ysd-bs.com/storage/materials/2023/08/08/img.png" mode="widthFix"></image>
</view>
<view class="superRed-see">
<form action="" @submit="forgetlogin">
<view class="superRed-white">
<view class="packetText-form">
<view class="packetText-label">
<label>手机号码</label>
<input class="inputs-input" type="text" placeholder="请输入办理业务的手机号" @input="getNameValue"
:value="mobile"></input>
</view>
<view class="packetText-label">
<label>验证码</label>
<input class="inputs-input" placeholder="请输入验证码" @input="getCodeValue" :value="code"></input>
<button class="packetText-code" @click="codeBind" hover-class="none" :disabled="disabled">{{codename}}</button>
</view>
<view class="packetText-label">
<label>账户</label>
<input class="inputs-input" type="text" placeholder="消费金使用账户【微信关联手机号码】" @input="getMobileValue"
:value="getMobile"></input>
</view>
</view>
</view>
<view class="packetText-btn">
<button type="default" form-type="submit"><image src="https://card.ysd-bs.com/storage/materials/2023/08/08/45ffe3c74b6ab4fb2a303d19a714d15c.png" mode="widthFix"></image></button>
</view>
</form>
</view>
<view class="packetText-cozy">
<image src="https://card.ysd-bs.com/storage/materials/2023/08/08/视频权益包2_07.png" mode="widthFix"></image>
<!-- <view class="packetText-cozy-name">温馨提示</view>
<text>1.消费金仅限本系统使用</text>
<text>2.消费金当月有效当月权益请在当月使用</text>
<text>3.如消费金兑换成电子券后请按电子券有效期使用如逾期未用视为放弃使用资格平台将不予补发不予延期</text> -->
</view>
</view>
<view class="popBack" :class="{active : popContHide}"></view>
<view class="popCont" :class="{active : popContHide}">
<image class="popCont-img" src="https://card.ysd-bs.com/storage/materials/2021/09/01/receive.png" mode="widthFix"></image>
<view class="popCont-text">
<!-- <view class="popCont-name">领取成功,共领取<text>{{popData}}</text>,可在账户中查看</view> -->
<view class="popCont-name">恭喜您已成功领取消费金在使用时请您链接消费金使用界面用微信关联手机号重新注册登录</view>
<view class="popCont-btn" @click="popClick">我知道了 <text v-if="countDownNum > 0">({{countDownNum}})</text></view>
</view>
</view>
</view>
</template>
<script>
import { send } from '@/apis/interfaces/auth'
import { monthsPacket } from '@/apis/interfaces/giftPack'
export default {
data() {
return {
mobile : '', //手机号码
code : '',
getMobile : '',
iscode : null, //用于存放验证码接口里获取到的code
codename : '获取验证码',
countDownNum: '',
popContHide : false, //领取成功弹出
popData : '', //领取金额
disabled : false
}
},
// 生命周期函数--监听页面显示
onShow() {
// 存储环境-月兑活动
getApp().globalData.envType = 'giftPEnv'
},
methods: {
// 获取手机号码
getNameValue(e) {
this.mobile = e.detail.value
},
// 获取验证码
getCodeValue(e) {
this.code = e.detail.value
},
// 获取领取红包的手机号
getMobileValue(e) {
this.getMobile = e.detail.value
},
// code发送
codeBind(e){
this.disabled = true
let mobile = this.mobile,
myreg = /^(14[0-9]|13[0-9]|15[0-9]|17[0-9]|18[0-9])\d{8}$$/
var _this = this
if (mobile == "") {
uni.showToast({
title : '手机号不能为空',
icon : 'none',
duration : 1000
})
return false;
}else if (!myreg.test(mobile)) {
uni.showToast({
title : '请输入正确的手机号',
icon : 'none',
duration : 1000
})
return false;
}else{
send({
mobile : mobile,
channel :'DEFAULT',
type : 'month'
}).then(res=>{
uni.showToast({
title : '发送成功',
icon : 'success',
duration: 2000
})
var num = 61;
var timer = setInterval(function () {
num--;
if (num <= 0) {
clearInterval(timer);
_this.codename = '重新发送',
_this.disabled = false
} else {
_this.codename = num + "s后重新获取",
_this.disabled = true
}
}, 1000)
}).catch(err => {
_this.disabled = false
uni.showToast({
icon: 'none',
title: err.message
})
})
}
},
// 立即领取
forgetlogin(e) {
let mobile = this.mobile,
getmobile = this.getMobile,
code = this.code,
that = this,
countDownNum = 5 //获取倒计时初始值
that.countDownNum = countDownNum
monthsPacket({
mobile : mobile,
get_mobile: getmobile,
channel : 'DEFAULT',
code : code
}).then(res=>{
that.popContHide = !this.popContHide
that.popData = res
var timerPop = setInterval(function () {
countDownNum--;
that.countDownNum = countDownNum
if (countDownNum <= 0) {
clearInterval(timerPop);
that.countDownNum = 0
uni.switchTab({
url: '/pages/giftPack/user'
})
}
}, 1000)
}).catch(err=>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 关闭弹窗
popClick() {
this.popContHide = !this.popContHide
// 跳转
// uni.redirectTo({
// url: '/pages/giftPack/index'
// })
}
}
}
</script>
<style lang="scss" scoped>
.content {
height: 100vh;
overflow-y: scroll;
position: relative;
}
.superRed-back {
width: 100%;
position: absolute;
}
.superRed-cont {
padding-top: 120rpx;
top: 0;
position: absolute;
.superRed-img {
width: 100%;
padding: 30rpx;
box-sizing: border-box;
image {
width: 100%;
}
}
.superRed-see {
padding: 0 30rpx 30rpx;
box-sizing: border-box;
.superRed-white {
position: relative;
background-color: #ffffff;
border-radius: 20rpx;
padding: 30rpx 15rpx;
box-sizing: border-box;
.superRed-title {
width: 100%;
position: absolute;
text-align: center;
top: -38rpx;
left: 0;
text {
display: inline-block;
background-color: #f95433;
box-shadow: 0 8rpx 5rpx rgba(249, 84, 51, .4);
border: 4rpx solid #ffeca0;
line-height: 76rpx;
padding: 0 50rpx;
border-radius: 80rpx;
color: #ffffff;
font-weight: 600;
font-size: 40rpx;
}
}
}
}
}
.packetText-title {
display: flex;
color: #f25448;
line-height: 48rpx;
.packetText-title-name {
font-weight: 600;
font-size: 32rpx;
}
text{
font-size: 26rpx;
}
}
.packetText-label {
height: 90rpx;
line-height: 90rpx;
margin-bottom: 40rpx;
background-color: #ffffff;
border-radius: 80rpx;
padding: 0 20rpx;
box-sizing: border-box;
display: flex;
font-size: 32rpx;
label {
color: #1444d9;
font-weight: 600;
}
.inputs-input {
display: inline-block;
height: 100%;
flex: 1;
font-size: 28rpx;
border: 4rpx solid #000000;
border-radius: 10rpx;
padding: 0 20rpx;
box-sizing: border-box;
}
.packetText-code {
line-height: 90rpx;
background-color: #1444d9;
border: none;
width: auto !important;
padding: 0 25rpx;
font-weight: normal;
font-size: 28rpx;
color: #ffffff;
margin-left: 20rpx;
&::after {
display: none;
}
&[disabled]{
color: #C8C7CC;
}
}
}
.packetText-cozy {
color: #f25448;
font-size: 26rpx;
padding: 0 10rpx;
box-sizing: border-box;
image {
width: 100%;
}
}
.packetText-btn {
text-align: center;
padding: 60rpx 30rpx 0;
box-sizing: border-box;
button {
background-color: transparent;
border: none;
image {
width: 100%;
}
&::after {
display: none;
}
}
}
/* 弹出 */
.popBack {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, .8);
z-index: 8;
display: none;
}
.popCont {
position: fixed;
z-index: 9;
width: 100vw;
height: 100vh;
text-align: center;
display: none;
}
.popCont-text {
padding: 0 10rpx;
box-sizing: border-box;
position: absolute;
z-index: 10;
left: 20%;
top: 340px;
width: 60%;
}
.popBack.active,
.popCont.active {
display: block;
}
.popCont-name {
margin-bottom: 50rpx;
font-size: 30rpx;
}
.popCont-name text {
font-size: 40rpx;
color: #fd5238;
padding: 0 10rpx;
}
.popCont-btn {
background-color: #ffea37;
color: #ff3900;
display: inline-block;
border-radius: 80rpx;
padding: 20rpx 70rpx;
box-shadow: 0 10rpx 10rpx rgba(196, 160, 0, 0.4);
}
</style>