liveh5-nuxt/app/pages/payment/qrcode/index.client.vue

43 lines
1.1 KiB
Vue
Raw Normal View History

2025-04-18 08:42:40 +00:00
<template>
<div class="w-[100vw] h-screen-nav bg-[url('@/static/images/3532@2x.png')] bg-cover flex-grow-1 flex flex-col items-center pt-183px px-30px">
<div class="text-#000 text-16px mb-25px">等待销售员确认</div>
<img :src="qrCodeUrl" alt="" class="mb-10px">
<div class="text-#848484 text-14px">已生成订单确认二维码</div>
</div>
</template>
<script setup>
import QRCode from 'qrcode';
import { ref } from 'vue';
import {authStore} from "~/stores/auth/index.js";
const {payment}= authStore()
definePageMeta({
i18n: 'payment.title'
})
const qrCodeUrl=ref('')
async function generateQRCodeURL(text) {
try {
const url = await QRCode.toDataURL(text, {
width: 283,
margin: 1,
errorCorrectionLevel: 'H',
color: {
dark: '#2B53AC', // 深色部分使用蓝色
light: '#ffffff' // 浅色部分使用白色
},
rendererOpts: {
quality: 1.0
}
});
return url;
} catch (err) {
console.error(err);
}
}
qrCodeUrl.value = await generateQRCodeURL(JSON.stringify({
type:'auction-order',
buyUid: payment.value.buyUid,
payUid:payment.value.payUid
}))
</script>