|
|
@@ -0,0 +1,213 @@
|
|
|
+<template>
|
|
|
+ <q-dialog ref="dialogRef" persistent maximized transition-show="slide-up" transition-hide="slide-down">
|
|
|
+ <div class="bg-page full-height column">
|
|
|
+
|
|
|
+ <div class="row items-center q-px-md q-pt-md q-pb-sm bg-surface shadow-header">
|
|
|
+ <q-btn icon="mdi-chevron-left" flat round dense color="primary" @click="onDialogCancel" />
|
|
|
+ <q-space />
|
|
|
+ <span class="text-subtitle1 text-weight-bold text-primary">
|
|
|
+ {{ $t('payment.pix_title') }}
|
|
|
+ </span>
|
|
|
+ <q-space />
|
|
|
+ <div style="width: 32px" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="col scroll q-px-lg q-pt-lg q-pb-xl column">
|
|
|
+
|
|
|
+ <div class="row items-center justify-between q-mb-sm">
|
|
|
+ <span class="pix-label">{{ $t('payment.pix_total') }}</span>
|
|
|
+ <span class="pix-value text-primary">{{ formatCurrency(total) }}</span>
|
|
|
+ </div>
|
|
|
+ <q-separator />
|
|
|
+
|
|
|
+ <div class="row items-center justify-between q-mt-sm q-mb-lg">
|
|
|
+ <span class="pix-label">{{ $t('payment.pix_expires') }}</span>
|
|
|
+ <span class="pix-value text-primary">{{ countdown }}</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="flex flex-center q-mb-md">
|
|
|
+ <q-icon name="mdi-cash-fast" size="48px" color="teal" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="flex flex-center q-mb-md">
|
|
|
+ <div class="qrcode-wrapper">
|
|
|
+ <svg viewBox="0 0 200 200" width="180" height="180" xmlns="http://www.w3.org/2000/svg">
|
|
|
+ <rect x="10" y="10" width="60" height="60" rx="4" fill="none" stroke="#000" stroke-width="6"/>
|
|
|
+ <rect x="22" y="22" width="36" height="36" rx="2" fill="#000"/>
|
|
|
+ <rect x="130" y="10" width="60" height="60" rx="4" fill="none" stroke="#000" stroke-width="6"/>
|
|
|
+ <rect x="142" y="22" width="36" height="36" rx="2" fill="#000"/>
|
|
|
+ <rect x="10" y="130" width="60" height="60" rx="4" fill="none" stroke="#000" stroke-width="6"/>
|
|
|
+ <rect x="22" y="142" width="36" height="36" rx="2" fill="#000"/>
|
|
|
+ <g fill="#000">
|
|
|
+ <rect x="85" y="10" width="8" height="8"/>
|
|
|
+ <rect x="100" y="10" width="8" height="8"/>
|
|
|
+ <rect x="85" y="24" width="8" height="8"/>
|
|
|
+ <rect x="108" y="24" width="8" height="8"/>
|
|
|
+ <rect x="85" y="38" width="16" height="8"/>
|
|
|
+ <rect x="85" y="52" width="8" height="8"/>
|
|
|
+ <rect x="100" y="52" width="16" height="8"/>
|
|
|
+ <rect x="10" y="85" width="8" height="8"/>
|
|
|
+ <rect x="24" y="85" width="16" height="8"/>
|
|
|
+ <rect x="48" y="85" width="8" height="8"/>
|
|
|
+ <rect x="62" y="85" width="8" height="8"/>
|
|
|
+ <rect x="10" y="99" width="16" height="8"/>
|
|
|
+ <rect x="34" y="99" width="8" height="8"/>
|
|
|
+ <rect x="54" y="99" width="16" height="8"/>
|
|
|
+ <rect x="10" y="113" width="8" height="8"/>
|
|
|
+ <rect x="26" y="113" width="16" height="8"/>
|
|
|
+ <rect x="56" y="113" width="8" height="8"/>
|
|
|
+ <rect x="85" y="85" width="8" height="8"/>
|
|
|
+ <rect x="100" y="85" width="16" height="8"/>
|
|
|
+ <rect x="124" y="85" width="8" height="8"/>
|
|
|
+ <rect x="140" y="85" width="16" height="8"/>
|
|
|
+ <rect x="166" y="85" width="8" height="8"/>
|
|
|
+ <rect x="85" y="100" width="16" height="8"/>
|
|
|
+ <rect x="108" y="100" width="8" height="8"/>
|
|
|
+ <rect x="130" y="100" width="16" height="8"/>
|
|
|
+ <rect x="154" y="100" width="8" height="8"/>
|
|
|
+ <rect x="170" y="100" width="8" height="8"/>
|
|
|
+ <rect x="85" y="115" width="8" height="8"/>
|
|
|
+ <rect x="100" y="115" width="8" height="8"/>
|
|
|
+ <rect x="116" y="115" width="16" height="8"/>
|
|
|
+ <rect x="140" y="115" width="8" height="8"/>
|
|
|
+ <rect x="156" y="115" width="16" height="8"/>
|
|
|
+ <rect x="85" y="130" width="16" height="8"/>
|
|
|
+ <rect x="108" y="130" width="8" height="8"/>
|
|
|
+ <rect x="124" y="130" width="16" height="8"/>
|
|
|
+ <rect x="148" y="130" width="8" height="8"/>
|
|
|
+ <rect x="164" y="130" width="8" height="8"/>
|
|
|
+ <rect x="85" y="144" width="8" height="8"/>
|
|
|
+ <rect x="100" y="144" width="16" height="8"/>
|
|
|
+ <rect x="124" y="144" width="8" height="8"/>
|
|
|
+ <rect x="140" y="144" width="16" height="8"/>
|
|
|
+ <rect x="166" y="144" width="8" height="8"/>
|
|
|
+ <rect x="85" y="158" width="16" height="8"/>
|
|
|
+ <rect x="110" y="158" width="8" height="8"/>
|
|
|
+ <rect x="126" y="158" width="8" height="8"/>
|
|
|
+ <rect x="144" y="158" width="8" height="8"/>
|
|
|
+ <rect x="160" y="158" width="16" height="8"/>
|
|
|
+ <rect x="85" y="172" width="8" height="8"/>
|
|
|
+ <rect x="100" y="172" width="8" height="8"/>
|
|
|
+ <rect x="116" y="172" width="16" height="8"/>
|
|
|
+ <rect x="142" y="172" width="8" height="8"/>
|
|
|
+ <rect x="158" y="172" width="8" height="8"/>
|
|
|
+ <rect x="174" y="172" width="8" height="8"/>
|
|
|
+ </g>
|
|
|
+ </svg>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="pix-code-text q-mb-md">{{ pixCode }}</div>
|
|
|
+
|
|
|
+ <q-btn
|
|
|
+ unelevated
|
|
|
+ rounded
|
|
|
+ no-caps
|
|
|
+ color="primary"
|
|
|
+ class="full-width copy-btn q-mb-lg"
|
|
|
+ :label="$t('payment.pix_copy_btn')"
|
|
|
+ @click="copyCode"
|
|
|
+ />
|
|
|
+
|
|
|
+ <p class="pix-instructions-text q-mb-sm">
|
|
|
+ <strong>{{ $t('payment.pix_instructions') }}</strong>
|
|
|
+ </p>
|
|
|
+ <p class="pix-instructions-text text-grey-6">
|
|
|
+ {{ $t('payment.pix_email_note') }}
|
|
|
+ </p>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </q-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ref, onMounted, onUnmounted } from 'vue'
|
|
|
+import { useDialogPluginComponent, useQuasar, copyToClipboard } from 'quasar'
|
|
|
+import { formatCurrency } from 'src/helpers/utils'
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ schedule: { type: Object, required: true },
|
|
|
+ total: { type: Number, required: true },
|
|
|
+})
|
|
|
+
|
|
|
+defineEmits([...useDialogPluginComponent.emits])
|
|
|
+
|
|
|
+const { dialogRef, onDialogCancel } = useDialogPluginComponent()
|
|
|
+const $q = useQuasar()
|
|
|
+
|
|
|
+const pixCode = `00020126580014br.gov.bcb.pix0136sfp-diaria-${props.schedule.id}-${props.schedule.provider_id}5204000053039865406${(props.total * 100).toFixed(0).padStart(8, '0')}5802BR5913Diaria App6009SAO PAULO62070503***6304ABCD`
|
|
|
+
|
|
|
+const copyCode = () => {
|
|
|
+ copyToClipboard(pixCode)
|
|
|
+ .then(() => $q.notify({ type: 'positive', message: 'Código copiado!' }))
|
|
|
+ .catch(() => $q.notify({ type: 'negative', message: 'Erro ao copiar.' }))
|
|
|
+}
|
|
|
+
|
|
|
+const totalSeconds = ref(20 * 60)
|
|
|
+const countdown = ref('')
|
|
|
+let timer = null
|
|
|
+
|
|
|
+const updateCountdown = () => {
|
|
|
+ const m = Math.floor(totalSeconds.value / 60)
|
|
|
+ const s = totalSeconds.value % 60
|
|
|
+ countdown.value = `${m} min, ${String(s).padStart(2, '0')} seg`
|
|
|
+ if (totalSeconds.value > 0) totalSeconds.value--
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ updateCountdown()
|
|
|
+ timer = setInterval(updateCountdown, 1000)
|
|
|
+})
|
|
|
+
|
|
|
+onUnmounted(() => {
|
|
|
+ clearInterval(timer)
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.shadow-header {
|
|
|
+ box-shadow: 0px 1px 8px rgba(0, 0, 0, 0.1);
|
|
|
+}
|
|
|
+
|
|
|
+.pix-label {
|
|
|
+ font-size: 15px;
|
|
|
+ color: #3a3a4a;
|
|
|
+ font-weight: 500;
|
|
|
+}
|
|
|
+
|
|
|
+.pix-value {
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 700;
|
|
|
+}
|
|
|
+
|
|
|
+.qrcode-wrapper {
|
|
|
+ background: #fff;
|
|
|
+ border: 1px solid #e0e0e0;
|
|
|
+ border-radius: 12px;
|
|
|
+ padding: 12px;
|
|
|
+}
|
|
|
+
|
|
|
+.pix-code-text {
|
|
|
+ font-size: 11px;
|
|
|
+ color: #5a5a6a;
|
|
|
+ text-align: center;
|
|
|
+ word-break: break-all;
|
|
|
+ line-height: 1.5;
|
|
|
+ background: #f5f5f8;
|
|
|
+ border-radius: 8px;
|
|
|
+ padding: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.copy-btn {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 700;
|
|
|
+ height: 52px;
|
|
|
+}
|
|
|
+
|
|
|
+.pix-instructions-text {
|
|
|
+ font-size: 13px;
|
|
|
+ line-height: 1.5;
|
|
|
+ color: #3a3a4a;
|
|
|
+}
|
|
|
+</style>
|