微信二维码扫描后跳转页面,或者提示超时 & 余额提现取消校验规则

This commit is contained in:
2024-01-16 00:06:57 +08:00
parent 2378a99f57
commit c98f43a92d
11 changed files with 414 additions and 10 deletions

View File

@@ -17,6 +17,7 @@
"pages/myBookingsList/index", "pages/myBookingsList/index",
"pages/myEnters/index", "pages/myEnters/index",
"pages/myEnterList/index", "pages/myEnterList/index",
"pages/currentEnter/index",
"pages/myMembershipCard/index", "pages/myMembershipCard/index",
"pages/notice/index", "pages/notice/index",
"pages/questions/index", "pages/questions/index",

BIN
images/reload.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -20,10 +20,13 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
barcodeClock: null,
clockTime: 0,
venues: {}, venues: {},
// isShowBuyVip: false, // isShowBuyVip: false,
// buyVipObj: {}, // buyVipObj: {},
showUnclickMask: false, showUnclickMask: false,
barcodeTimeOut: false,
// showCardMask: false, // showCardMask: false,
orderSn: '000', orderSn: '000',
payMoney: 0, payMoney: 0,
@@ -66,7 +69,6 @@ Page({
showUnclickMask: false showUnclickMask: false
// flg: 100 // flg: 100
}) })
this.initPage() this.initPage()
}, },
@@ -74,14 +76,14 @@ Page({
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function() { onHide: function() {
this.endInter()
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function() { 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) { checkIsPayed(orderSn) {
this.setData({ this.setData({
flg: 777, flg: 777,
@@ -284,6 +337,7 @@ Page({
this.setData({ this.setData({
flg: 100 flg: 100
}) })
this.endInter()
this.initPage() this.initPage()
}, },
@@ -393,6 +447,13 @@ Page({
}, },
showBarcode(orderSn) { showBarcode(orderSn) {
this.setData({
barcodeTimeOut: false
})
wx.showLoading({
title: '加载中...',
mask: true,
})
app.$api.generateBarcode({ app.$api.generateBarcode({
venueId: this.data.venues.id, venueId: this.data.venues.id,
enterFlag: this.data.venues.enterFlag, enterFlag: this.data.venues.enterFlag,
@@ -411,6 +472,7 @@ Page({
typeNumber: 10, typeNumber: 10,
text: res.barcode text: res.barcode
}) })
this.startInter(res.barcode)
}, err => { }, err => {
console.log(err) console.log(err)
this.setData({ this.setData({

View File

@@ -89,10 +89,15 @@
</view> </view>
<view class='center'> <view class='center'>
<view class='item'> <view class='item'>
<view class='step'>扫码开门</view> <view wx:if="{{barcodeTimeOut}}" class='step'>二维码超时</view>
<view wx:else class='step'>扫码开门</view>
<view class='barcode'> <view class='barcode'>
<canvas class="barcode-canvas" style="width: 200px; height: 200px;" canvas-id="myQrcode"></canvas> <view wx:if="{{barcodeTimeOut}}" class="timeout" bindtap="reloadBarcode">
<!-- <canvas type="2d" class='title' canvas-id="myQrcode" style="width: 400rpx; height: 400rpx"></canvas>--> <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>
</view> </view>
<image src='../../images/22@3x.png'></image> <image src='../../images/22@3x.png'></image>

View File

@@ -436,3 +436,12 @@
height: 200rpx; height: 200rpx;
margin-top: -200rpx; margin-top: -200rpx;
} }
.timeout {
display: flex;
flex-direction: column;
align-items: center;
color: #1a191e;
padding: 20rpx;
font-size: 28rpx;
}

133
pages/currentEnter/index.js Normal file
View File

@@ -0,0 +1,133 @@
// pages/currentEnter/index.js
const app = getApp();
let enterId = ""
Page({
/**
* 页面的初始数据
*/
data: {
isSignIn: false,
memberEnterDetail: {},
showDeleteDialog: false,
isGoHome: false,
endDate: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
enterId = options.id;
this.getData();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
let pages = getCurrentPages();
this.setData({
isGoHome: pages.length == 1
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
return {
title: '智慧云馆'
}
},
// 获取数据
getData() {
app.$api.memberEntersDetail({
enterId: enterId
}).then(res => {
if (!res.memberEnterDetail) {
wx.navigateBack({
delta: 1,
})
}
this.setData({
memberEnterDetail: res.memberEnterDetail
})
}, err => {
})
},
// 取消弹框
cancelDeleteDialog() {
this.setData({
showDeleteDialog: false
})
},
// // 确认删除
// confirmDeleteDialog() {
// app.$api.memberEnterDetailsCancel({
// orderSn: this.data.memberEnterDetail.orderSn
// }).then(res => {
// wx.showToast({
// title: '取消成功',
// })
// this.setData({
// showDeleteDialog: false
// })
// this.getData();
// }, err => {
// this.setData({
// showDeleteDialog: false
// })
// });
// },
// 打开导航,
opnGPS() {
wx.openLocation({
latitude: Number(this.data.memberEnterDetail.latitude),
longitude: Number(this.data.memberEnterDetail.longitude),
name: this.data.memberEnterDetail.lessonName,
address: this.data.memberEnterDetail.address,
})
}
})

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "篮球订单",
"usingComponents": {
"confirm-dialog": "/component/confirmDialog/confirmDialog",
"header": "/component/header/header"
}
}

View File

@@ -0,0 +1,44 @@
<!--pages/currentEnter/index.wxml-->
<header title="篮球订单" isGoHome="{{isGoHome}}"></header>
<view class='container'>
<view class='newplot'>
<image src='../../images/4@3x.png'></image>
<text>扫码成功</text>
</view>
<view class='cell-box'>
<view class='cell'>
<view class='title'>
<text>{{memberEnterDetail.lessonName}}</text>
</view>
<!-- <view class='state'>{{memberEnterDetail.status == 0 ? "已预约" : (memberEnterDetail.status == 1 ? "已完成" : "已取消")}}</view> -->
<view class='state' wx:if="{{memberEnterDetail.status == 0}}">使用中</view>
<view class='state' wx:if="{{memberEnterDetail.status == 1}}">待结算</view>
<view class='state' wx:if="{{memberEnterDetail.status == 2}}">已结算</view>
</view>
<view class='cell'>
<image src='../../images/42@3x.png' mode='aspectFit'></image>
<text>开始时间</text>
<view class='cell-right-white'>{{memberEnterDetail.startTime}}</view>
</view>
<view class='cell'>
<image src='../../images/42@3x.png' mode='aspectFit'></image>
<text>出场时间</text>
<view class='cell-right-white'>{{memberEnterDetail.endTime}}</view>
</view>
<view class='cell'>
<image src='../../images/42@3x.png' mode='aspectFit'></image>
<text>运动时长</text>
<view class='cell-right-white'>{{memberEnterDetail.lessonCount}}</view>
</view>
<view class='cell'>
<image src='../../images/33@3x.png' mode='aspectFit'></image>
<text>费用</text>
<view class='cell-right-white'>¥{{memberEnterDetail.price}}</view>
</view>
<view class='cell' wx:if="{{memberEnterDetail.status == 2 && memberEnterDetail.payMoney > 0}}">
<image src='../../images/33@3x.png' mode='aspectFit'></image>
<text>退款金额</text>
<view class='cell-right-white'>¥{{memberEnterDetail.payMoney}}</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,139 @@
/* pages/currentEnter/index.wxss */
.container {
min-height: calc(100vh - 290rpx);
padding: 160rpx 30rpx 130rpx 30rpx;
}
.cell-box {
background: #1a191e;
border-radius: 10rpx;
margin-top: 250rpx;
}
.cell-box .cell {
display: flex;
justify-content: space-between;
align-items: center;
height: 90rpx;
padding: 0 20rpx;
border-bottom: 2rpx solid #212025;
}
.cell-box .cell.unline {
border: none;
}
.cell-box .cell>image {
width: 34rpx;
height: 34rpx;
margin-right: 26rpx;
}
.cell-box .cell>text {
flex: 1;
font-size: 24rpx;
color: rgba(255, 255, 255, 0.6);
}
.cell-box .cell .title {
flex: 1;
display: flex;
align-items: center;
color: #fff;
font-size: 26rpx;
}
.cell-box .cell .cell-right {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: rgba(255, 255, 255, 0.6);
font-size: 20rpx;
}
.cell-box .cell .cell-right .gps-img {
width: 50rpx;
height: 50rpx;
border-radius: 50%;
}
.cell-box .cell .cell-right>text {
height: 20rpx;
margin-top: 6rpx;
line-height: 20rpx;
}
.cell-box .cell .state {
font-size: 22rpx;
color: #ffda2e;
}
.cell-box .cell .cell-right-white {
color: #fff;
font-size: 24rpx;
}
.cell-box .qrCode-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 300rpx;
}
.cell-box .qrCode-box>image {
width: 200rpx;
height: 200rpx;
}
.cell-box .qrCode-box>text {
margin-top: 20rpx;
font-size: 22rpx;
line-height: 22rpx;
color: rgba(255, 255, 255, 0.6);
}
.footer-box {
position: fixed;
bottom: 0;
left: 0;
display: flex;
width: 100%;
height: 100rpx;
}
.footer-btn {
flex: 1;
background: #767578;
color: #1a191e;
font-size: 32rpx;
text-align: center;
line-height: 100rpx;
}
.footer-btn.isActive {
background: #ffda2e;
}
.newplot {
position: fixed;
top: 200rpx;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
align-items: center;
color: #FFF;
font-size: 28rpx;
}
.newplot>image {
width: 100rpx;
height: 100rpx;
}
.newplot>text {
margin-top: 20rpx;
}

View File

@@ -95,7 +95,7 @@ Page({
this.data.money = e.detail.value; this.data.money = e.detail.value;
}, },
// 确认提现 // 确认提现
withdrawalClick(e) { withdrawalClick(e) {
if (!this.data.cardholder) { if (!this.data.cardholder) {
wx.showToast({ wx.showToast({
@@ -111,9 +111,9 @@ Page({
}) })
return; return;
} }
if (this.data.bankCard.length != 16) { if (this.data.bankCard.length < 13 || this.data.bankCard.length > 19) {
wx.showToast({ wx.showToast({
title: '请输入16位银行卡号', title: '请输入正确银行卡号',
icon: 'none', icon: 'none',
}) })
return; return;
@@ -175,4 +175,4 @@ Page({
}) })
} }
}) })

View File

@@ -313,6 +313,10 @@ export default {
memberIsPayed(params) { memberIsPayed(params) {
return fetchPost('/member/isPayed', params, true); return fetchPost('/member/isPayed', params, true);
}, },
// 判断数据是否
memberBarcodeIsUsed(params) {
return fetchPost('/member/barcode/isUsed', params, true);
},
/** /**
* 个人中心 * 个人中心