diff --git a/app.json b/app.json index 25c4d0b..d6face0 100644 --- a/app.json +++ b/app.json @@ -17,6 +17,7 @@ "pages/myBookingsList/index", "pages/myEnters/index", "pages/myEnterList/index", + "pages/currentEnter/index", "pages/myMembershipCard/index", "pages/notice/index", "pages/questions/index", diff --git a/images/reload.png b/images/reload.png new file mode 100644 index 0000000..e286103 Binary files /dev/null and b/images/reload.png differ diff --git a/pages/basketballGym/index.js b/pages/basketballGym/index.js index 251119d..effc592 100644 --- a/pages/basketballGym/index.js +++ b/pages/basketballGym/index.js @@ -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({ diff --git a/pages/basketballGym/index.wxml b/pages/basketballGym/index.wxml index 5c7cd4e..3081f11 100644 --- a/pages/basketballGym/index.wxml +++ b/pages/basketballGym/index.wxml @@ -89,10 +89,15 @@ - 扫码开门 + 二维码超时 + 扫码开门 - - + + + 点击刷新 + + + diff --git a/pages/basketballGym/index.wxss b/pages/basketballGym/index.wxss index 7d28aec..442a474 100644 --- a/pages/basketballGym/index.wxss +++ b/pages/basketballGym/index.wxss @@ -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; +} diff --git a/pages/currentEnter/index.js b/pages/currentEnter/index.js new file mode 100644 index 0000000..af21931 --- /dev/null +++ b/pages/currentEnter/index.js @@ -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, + }) + } + +}) diff --git a/pages/currentEnter/index.json b/pages/currentEnter/index.json new file mode 100644 index 0000000..a9cf9b1 --- /dev/null +++ b/pages/currentEnter/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "篮球订单", + "usingComponents": { + "confirm-dialog": "/component/confirmDialog/confirmDialog", + "header": "/component/header/header" + } +} diff --git a/pages/currentEnter/index.wxml b/pages/currentEnter/index.wxml new file mode 100644 index 0000000..8709866 --- /dev/null +++ b/pages/currentEnter/index.wxml @@ -0,0 +1,44 @@ + +
+ + + + 扫码成功 + + + + + {{memberEnterDetail.lessonName}} + + + 使用中 + 待结算 + 已结算 + + + + 开始时间 + {{memberEnterDetail.startTime}} + + + + 出场时间 + {{memberEnterDetail.endTime}} + + + + 运动时长 + {{memberEnterDetail.lessonCount}} + + + + 费用 + ¥{{memberEnterDetail.price}} + + + + 退款金额 + ¥{{memberEnterDetail.payMoney}} + + + diff --git a/pages/currentEnter/index.wxss b/pages/currentEnter/index.wxss new file mode 100644 index 0000000..2b5a120 --- /dev/null +++ b/pages/currentEnter/index.wxss @@ -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; +} diff --git a/pages/withdrawal/index.js b/pages/withdrawal/index.js index 79261b2..e608efc 100644 --- a/pages/withdrawal/index.js +++ b/pages/withdrawal/index.js @@ -95,7 +95,7 @@ Page({ this.data.money = e.detail.value; }, - // 确认提现 + // 确认提现 withdrawalClick(e) { if (!this.data.cardholder) { wx.showToast({ @@ -111,9 +111,9 @@ Page({ }) return; } - if (this.data.bankCard.length != 16) { + if (this.data.bankCard.length < 13 || this.data.bankCard.length > 19) { wx.showToast({ - title: '请输入16位银行卡号', + title: '请输入正确银行卡号', icon: 'none', }) return; @@ -175,4 +175,4 @@ Page({ }) } -}) \ No newline at end of file +}) diff --git a/utils/api.js b/utils/api.js index b0c68cb..7118fa0 100644 --- a/utils/api.js +++ b/utils/api.js @@ -313,6 +313,10 @@ export default { memberIsPayed(params) { return fetchPost('/member/isPayed', params, true); }, + // 判断数据是否 + memberBarcodeIsUsed(params) { + return fetchPost('/member/barcode/isUsed', params, true); + }, /** * 个人中心