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

203 lines
3.3 KiB
Vue
Raw Permalink 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="handleClose">
<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 class="close" @click="handleClose">X</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: "",
},
description: {
type: String,
default: "此二维码 可直接检票",
},
},
data() {
return {
qrcodeOptions: {
errorCorrectLevel: "Q",
margin: 10,
areaColor: "#fff",
},
loading: false,
};
},
methods: {
handleClose() {
this.$emit("close");
},
},
};
</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;
}
.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;
}
.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>