微信二维码扫描后跳转页面,或者提示超时 & 余额提现取消校验规则
This commit is contained in:
@@ -20,10 +20,13 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
barcodeClock: null,
|
||||
clockTime: 0,
|
||||
venues: {},
|
||||
// isShowBuyVip: false,
|
||||
// buyVipObj: {},
|
||||
showUnclickMask: false,
|
||||
barcodeTimeOut: false,
|
||||
// showCardMask: false,
|
||||
orderSn: '000',
|
||||
payMoney: 0,
|
||||
@@ -66,7 +69,6 @@ Page({
|
||||
showUnclickMask: false
|
||||
// flg: 100
|
||||
})
|
||||
|
||||
this.initPage()
|
||||
},
|
||||
|
||||
@@ -74,14 +76,14 @@ Page({
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
this.endInter()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
this.endInter()
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -98,6 +100,46 @@ Page({
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 启动定时器
|
||||
*/
|
||||
startInter : function(barcode){
|
||||
var that = this;
|
||||
that.data.barcodeClock= setInterval(
|
||||
function () {
|
||||
console.log('setInterval 每过500毫秒执行一次任务' + that.data.clockTime)
|
||||
app.$api.memberBarcodeIsUsed({
|
||||
barcode: barcode
|
||||
}).then(res => {
|
||||
if (res) {
|
||||
// 二维码被使用过了
|
||||
if (res.barcodeDTO.used){
|
||||
that.closeInStep()
|
||||
wx.navigateTo({
|
||||
url: `/pages/currentEnter/index?id=${res.barcodeDTO.enterId}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
that.setData({
|
||||
clockTime: that.data.clockTime+1
|
||||
})
|
||||
if (that.data.clockTime > 10){
|
||||
that.showTimeOutBarcode();
|
||||
}
|
||||
}, 2000);
|
||||
},
|
||||
/**
|
||||
* 结束定时器
|
||||
*/
|
||||
endInter: function(){
|
||||
if (this.data.barcodeClock) {
|
||||
clearInterval(this.data.barcodeClock)
|
||||
this.setData({
|
||||
clockTime: 0
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
@@ -125,6 +167,17 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
showTimeOutBarcode() {
|
||||
this.endInter()
|
||||
this.setData({
|
||||
barcodeTimeOut: true
|
||||
})
|
||||
},
|
||||
|
||||
reloadBarcode() {
|
||||
this.showBarcode('000')
|
||||
},
|
||||
|
||||
checkIsPayed(orderSn) {
|
||||
this.setData({
|
||||
flg: 777,
|
||||
@@ -284,6 +337,7 @@ Page({
|
||||
this.setData({
|
||||
flg: 100
|
||||
})
|
||||
this.endInter()
|
||||
this.initPage()
|
||||
},
|
||||
|
||||
@@ -393,6 +447,13 @@ Page({
|
||||
},
|
||||
|
||||
showBarcode(orderSn) {
|
||||
this.setData({
|
||||
barcodeTimeOut: false
|
||||
})
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
app.$api.generateBarcode({
|
||||
venueId: this.data.venues.id,
|
||||
enterFlag: this.data.venues.enterFlag,
|
||||
@@ -411,6 +472,7 @@ Page({
|
||||
typeNumber: 10,
|
||||
text: res.barcode
|
||||
})
|
||||
this.startInter(res.barcode)
|
||||
}, err => {
|
||||
console.log(err)
|
||||
this.setData({
|
||||
|
||||
@@ -89,10 +89,15 @@
|
||||
</view>
|
||||
<view class='center'>
|
||||
<view class='item'>
|
||||
<view class='step'>扫码开门</view>
|
||||
<view wx:if="{{barcodeTimeOut}}" class='step'>二维码超时</view>
|
||||
<view wx:else class='step'>扫码开门</view>
|
||||
<view class='barcode'>
|
||||
<canvas class="barcode-canvas" style="width: 200px; height: 200px;" canvas-id="myQrcode"></canvas>
|
||||
<!-- <canvas type="2d" class='title' canvas-id="myQrcode" style="width: 400rpx; height: 400rpx"></canvas>-->
|
||||
<view wx:if="{{barcodeTimeOut}}" class="timeout" bindtap="reloadBarcode">
|
||||
<image src="../../images/reload.png" style="width: 160px; height: 178px;"></image>
|
||||
<text>点击刷新</text>
|
||||
</view>
|
||||
<canvas wx:else class="barcode-canvas" style="width: 200px; height: 200px;" canvas-id="myQrcode"></canvas>
|
||||
<!-- <canvas type="2d" class='title' canvas-id="myQrcode" style="width: 400rpx; height: 400rpx"></canvas>-->
|
||||
</view>
|
||||
</view>
|
||||
<image src='../../images/22@3x.png'></image>
|
||||
|
||||
@@ -436,3 +436,12 @@
|
||||
height: 200rpx;
|
||||
margin-top: -200rpx;
|
||||
}
|
||||
|
||||
.timeout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #1a191e;
|
||||
padding: 20rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user