feat: 新增预约二维码弹窗功能
This commit is contained in:
+12
-1
@@ -6,7 +6,9 @@ Page({
|
||||
data: {
|
||||
isLoggedIn: false,
|
||||
loginFailed: false,
|
||||
latestRecord: null
|
||||
latestRecord: null,
|
||||
qrcodeVisible: false,
|
||||
qrcodeId: ''
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
@@ -77,5 +79,14 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: '/pages/records/records'
|
||||
})
|
||||
},
|
||||
|
||||
showQrcode(e) {
|
||||
const id = e.currentTarget.dataset.id
|
||||
this.setData({ qrcodeVisible: true, qrcodeId: id })
|
||||
},
|
||||
|
||||
hideQrcode() {
|
||||
this.setData({ qrcodeVisible: false, qrcodeId: '' })
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"usingComponents": {
|
||||
"qrcode-modal": "/components/qrcode-modal/qrcode-modal"
|
||||
},
|
||||
"navigationBarTitleText": "访客预约系统"
|
||||
}
|
||||
|
||||
+12
-3
@@ -45,8 +45,14 @@
|
||||
<!-- 最新预约摘要 -->
|
||||
<view class="latest-card" wx:if="{{latestRecord}}">
|
||||
<view class="latest-header">
|
||||
<text class="latest-title">最新预约</text>
|
||||
<view class="status-tag status-{{latestRecord.status}}">{{latestRecord.statusText}}</view>
|
||||
<view style="display: flex; align-items: center;">
|
||||
<text style="margin-right: 10px;" class="latest-title"> 最新预约</text>
|
||||
<view wx:if="{{latestRecord.status === 'approved'}}" class="qrcode-btn" catchtap="showQrcode" data-id="{{latestRecord._id}}">出示凭证</view>
|
||||
</view>
|
||||
<view class="latest-header-right">
|
||||
|
||||
<view class="status-tag status-{{latestRecord.status}}">{{latestRecord.statusText}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="latest-body">
|
||||
<view class="latest-row">
|
||||
@@ -75,4 +81,7 @@
|
||||
<view class="footer">
|
||||
<text class="footer-text">协能工厂 · 访客管理</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 二维码弹窗 -->
|
||||
<qrcode-modal visible="{{qrcodeVisible}}" qrcode-id="{{qrcodeId}}" bind:close="hideQrcode" />
|
||||
</view>
|
||||
@@ -177,6 +177,25 @@ page {
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.latest-header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.qrcode-btn {
|
||||
font-size: 22rpx;
|
||||
color: #52c41a;
|
||||
background: rgba(82, 196, 26, 0.1);
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 20rpx;
|
||||
border: 1rpx solid rgba(82, 196, 26, 0.3);
|
||||
}
|
||||
|
||||
.qrcode-btn:active {
|
||||
background: rgba(82, 196, 26, 0.2);
|
||||
}
|
||||
|
||||
.latest-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
@@ -188,6 +207,7 @@ page {
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 16rpx;
|
||||
font-weight: 500;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
@@ -251,3 +271,5 @@ page {
|
||||
font-size: 24rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ Page({
|
||||
records: [],
|
||||
filteredRecords: [],
|
||||
currentTab: 'all',
|
||||
loading: true
|
||||
loading: true,
|
||||
qrcodeVisible: false,
|
||||
qrcodeId: ''
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
@@ -81,5 +83,14 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: '/pages/appointment/appointment'
|
||||
})
|
||||
},
|
||||
|
||||
showQrcode(e) {
|
||||
const id = e.currentTarget.dataset.id
|
||||
this.setData({ qrcodeVisible: true, qrcodeId: id })
|
||||
},
|
||||
|
||||
hideQrcode() {
|
||||
this.setData({ qrcodeVisible: false, qrcodeId: '' })
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"usingComponents": {
|
||||
"qrcode-modal": "/components/qrcode-modal/qrcode-modal"
|
||||
},
|
||||
"navigationBarTitleText": "预约记录"
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
<view class="record-list" wx:if="{{!loading && filteredRecords.length > 0}}">
|
||||
<view class="record-card" wx:for="{{filteredRecords}}" wx:key="_id">
|
||||
<view class="record-header">
|
||||
<text class="record-id">{{item._id}}</text>
|
||||
<view wx:if="{{item.status === 'approved'}}" class="qrcode-btn" bindtap="showQrcode" data-id="{{item._id}}">
|
||||
出示凭证
|
||||
</view>
|
||||
<view class="status-tag status-{{item.status}}">
|
||||
{{item.statusText}}
|
||||
</view>
|
||||
@@ -74,4 +76,7 @@
|
||||
<text class="empty-text">暂无预约记录</text>
|
||||
<view class="empty-btn" bindtap="goAppointment">去预约</view>
|
||||
</view>
|
||||
|
||||
<!-- 二维码弹窗 -->
|
||||
<qrcode-modal visible="{{qrcodeVisible}}" qrcode-id="{{qrcodeId}}" bind:close="hideQrcode" />
|
||||
</view>
|
||||
|
||||
@@ -72,11 +72,25 @@ page {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.qrcode-btn {
|
||||
font-size: 24rpx;
|
||||
color: #52c41a;
|
||||
background: rgba(82, 196, 26, 0.1);
|
||||
padding: 8rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
border: 1rpx solid rgba(82, 196, 26, 0.3);
|
||||
}
|
||||
|
||||
.qrcode-btn:active {
|
||||
background: rgba(82, 196, 26, 0.2);
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
font-size: 24rpx;
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 20rpx;
|
||||
font-weight: 500;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
@@ -172,3 +186,5 @@ page {
|
||||
.empty-btn:active {
|
||||
background: #096dd9;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user