buddhism/components/qrcode-modal/qrcode-modal.vue

203 lines
3.3 KiB
Vue
Raw Normal View History

2025-08-15 16:54:57 +08:00
<template>
<view v-if="visible" class="qrcode-modal-overlay" @click="handleClose">
2025-08-15 16:54:57 +08:00
<view class="qrcode-modal" @click.stop>
<view class="modal-content">
<view class="qrcode-container">
2025-08-27 11:36:35 +08:00
<uv-qrcode
:options="qrcodeOptions"
:value="ticketNumber"
size="500rpx"
></uv-qrcode>
2025-08-15 16:54:57 +08:00
</view>
2025-08-27 11:36:35 +08:00
2025-08-15 16:54:57 +08:00
<view class="qrcode-info">
<text class="subscribe-id">票号: {{ ticketNumber }}</text>
2025-08-27 11:36:35 +08:00
<text class="info-text">{{ description }}</text>
2025-08-15 16:54:57 +08:00
</view>
</view>
</view>
<view class="close" @click="handleClose">X</view>
2025-08-15 16:54:57 +08:00
</view>
</template>
<script>
export default {
2025-08-27 11:36:35 +08:00
name: "QRCodeModal",
2025-08-15 16:54:57 +08:00
props: {
visible: {
type: Boolean,
2025-08-27 11:36:35 +08:00
default: false,
2025-08-15 16:54:57 +08:00
},
// 二维码内容值
value: {
type: String,
2025-08-27 11:36:35 +08:00
default: "",
},
// 预约ID兼容旧版本
2025-08-15 16:54:57 +08:00
subscribeId: {
type: String,
2025-08-27 11:36:35 +08:00
default: "",
},
// 票号
ticketNumber: {
type: String,
2025-08-27 11:36:35 +08:00
default: "",
2025-08-15 16:54:57 +08:00
},
2025-08-15 16:54:57 +08:00
description: {
type: String,
default: "此二维码 可直接检票",
2025-08-27 11:36:35 +08:00
},
2025-08-15 16:54:57 +08:00
},
data() {
return {
2025-08-27 11:36:35 +08:00
qrcodeOptions: {
errorCorrectLevel: "Q",
margin: 10,
areaColor: "#fff",
},
loading: false,
};
2025-08-15 16:54:57 +08:00
},
2025-08-27 11:36:35 +08:00
2025-08-15 16:54:57 +08:00
methods: {
handleClose() {
2025-08-27 11:36:35 +08:00
this.$emit("close");
2025-08-15 16:54:57 +08:00
},
2025-08-27 11:36:35 +08:00
},
};
2025-08-15 16:54:57 +08:00
</script>
<style lang="scss" scoped>
.close {
margin-top: 30rpx;
width: 80rpx;
height: 80rpx;
font-size: 60rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 999rpx;
border: white solid 1px;
}
2025-08-15 16:54:57 +08:00
.qrcode-modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
flex-direction: column;
2025-08-15 16:54:57 +08:00
}
.qrcode-modal {
width: 600rpx;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.3);
}
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx;
border-bottom: 1rpx solid #eee;
}
.modal-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.modal-close {
font-size: 40rpx;
color: #999;
padding: 10rpx;
cursor: pointer;
}
.modal-content {
padding: 40rpx;
}
.qrcode-container {
display: flex;
justify-content: center;
margin-bottom: 30rpx;
}
.qrcode-image {
width: 300rpx;
height: 300rpx;
border: 1rpx solid #eee;
border-radius: 10rpx;
}
.qrcode-loading {
width: 300rpx;
height: 300rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #f5f5f5;
border-radius: 10rpx;
color: #999;
}
.qrcode-info {
text-align: center;
}
2025-08-27 11:36:35 +08:00
.subscribe-id {
2025-08-15 16:54:57 +08:00
display: block;
font-size: 28rpx;
2025-08-27 11:36:35 +08:00
font-weight: 400;
color: #7f7f7f;
font-family: monospace;
padding-bottom: 10rpx;
2025-08-15 16:54:57 +08:00
}
2025-08-27 11:36:35 +08:00
.info-text {
2025-08-15 16:54:57 +08:00
display: block;
2025-08-27 11:36:35 +08:00
font-size: 28rpx;
color: #522510;
margin-bottom: 20rpx;
2025-08-15 16:54:57 +08:00
}
.modal-footer {
display: flex;
padding: 30rpx;
border-top: 1rpx solid #eee;
gap: 20rpx;
}
.btn-secondary,
.btn-primary {
flex: 1;
height: 80rpx;
border-radius: 40rpx;
font-size: 28rpx;
border: none;
cursor: pointer;
}
.btn-secondary {
background-color: #f5f5f5;
color: #666;
}
.btn-primary {
2025-08-27 11:36:35 +08:00
background-color: #48893b;
2025-08-15 16:54:57 +08:00
color: #fff;
}
2025-08-27 11:36:35 +08:00
</style>