buddhism/components/qrcode-modal/qrcode-modal.vue
2025-08-27 11:36:35 +08:00

195 lines
3.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view v-if="visible" class="qrcode-modal-overlay" @click="handleOverlayClick">
<view class="qrcode-modal" @click.stop>
<view class="modal-content">
<view class="qrcode-container">
<uv-qrcode
:options="qrcodeOptions"
:value="ticketNumber"
size="500rpx"
></uv-qrcode>
</view>
<view class="qrcode-info">
<text class="subscribe-id">票号: {{ ticketNumber }}</text>
<text class="info-text">{{ description }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "QRCodeModal",
props: {
visible: {
type: Boolean,
default: false,
},
// 二维码内容值
value: {
type: String,
default: "",
},
// 预约ID兼容旧版本
subscribeId: {
type: String,
default: "",
},
// 票号
ticketNumber: {
type: String,
default: "",
},
title: {
type: String,
default: "核销验证码",
},
description: {
type: String,
default: "此二维码可直接检票",
},
},
data() {
return {
qrcodeOptions: {
errorCorrectLevel: "Q",
margin: 10,
areaColor: "#fff",
},
loading: false,
};
},
methods: {
handleOverlayClick() {
this.handleClose();
},
handleClose() {
this.$emit("close");
},
},
};
</script>
<style lang="scss" scoped>
.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;
}
.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;
}
.subscribe-id {
display: block;
font-size: 28rpx;
font-weight: 400;
color: #7f7f7f;
font-family: monospace;
padding-bottom: 10rpx;
}
.info-text {
display: block;
font-size: 28rpx;
color: #522510;
margin-bottom: 20rpx;
}
.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 {
background-color: #48893b;
color: #fff;
}
</style>