developer #4
@ -12,26 +12,29 @@ const MOCK_ATIVO = true
|
||||
const PAGAMENTOS_MOCK = [
|
||||
{
|
||||
id: 101,
|
||||
idContaCorrente: 201,
|
||||
descricao: 'IPTU 2024 — Parcela 1/3',
|
||||
referencia: '202401',
|
||||
dataPagamento: '2024-02-05',
|
||||
formaPagamento: 'BOLETO',
|
||||
formaPagamento: 'GUIA',
|
||||
valor: 382.50,
|
||||
},
|
||||
{
|
||||
id: 102,
|
||||
idContaCorrente: 202,
|
||||
descricao: 'Taxa de Licença de Funcionamento',
|
||||
referencia: '202403',
|
||||
dataPagamento: '2024-03-20',
|
||||
formaPagamento: 'PIX',
|
||||
formaPagamento: 'GUIA',
|
||||
valor: 215.00,
|
||||
},
|
||||
{
|
||||
id: 103,
|
||||
idContaCorrente: null,
|
||||
descricao: 'ISSQN 2023 — 4º Trimestre',
|
||||
referencia: '202312',
|
||||
dataPagamento: '2024-01-10',
|
||||
formaPagamento: 'BOLETO',
|
||||
formaPagamento: 'DIRETO',
|
||||
valor: 540.00,
|
||||
},
|
||||
]
|
||||
@ -70,15 +73,19 @@ async function carregar() {
|
||||
async function baixarComprovante(pag) {
|
||||
carregandoComprovante.value = pag.id
|
||||
try {
|
||||
const buf = await portalService.getComprovante(pag.id)
|
||||
const url = URL.createObjectURL(new Blob([buf], { type: 'application/pdf' }))
|
||||
const buf = await portalService.getComprovante(pag.idContaCorrente)
|
||||
const blob = new Blob([buf], { type: 'application/pdf' })
|
||||
const url = URL.createObjectURL(blob)
|
||||
const janela = window.open(url, '_blank')
|
||||
if (!janela) {
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = `comprovante-${pag.id}.pdf`
|
||||
a.download = `comprovante-${pag.idContaCorrente}.pdf`
|
||||
a.click()
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
setTimeout(() => URL.revokeObjectURL(url), 60000)
|
||||
} catch {
|
||||
mensagemErro.value = 'Erro ao baixar o comprovante.'
|
||||
mensagemErro.value = 'Erro ao gerar o comprovante.'
|
||||
} finally {
|
||||
carregandoComprovante.value = null
|
||||
}
|
||||
@ -170,12 +177,12 @@ const formaPagMap = {
|
||||
</p>
|
||||
<div class="w-28 flex justify-end">
|
||||
<Button
|
||||
icon="pi pi-download"
|
||||
icon="pi pi-print"
|
||||
label="Comprovante"
|
||||
size="small"
|
||||
text
|
||||
:loading="carregandoComprovante === pag.id"
|
||||
:disabled="!!carregandoComprovante"
|
||||
:disabled="!!carregandoComprovante || !pag.idContaCorrente"
|
||||
@click="baixarComprovante(pag)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -19,7 +19,8 @@ const RESUMO_MOCK = {
|
||||
totalDebitos: 1250.90,
|
||||
certidoesAtivas: 2,
|
||||
alvarasAndamento: 2,
|
||||
ultimoPagamento: 430.00,
|
||||
ultimoPagamento: '2025-05-15',
|
||||
valorUltimoPagamento: 430.00,
|
||||
debitosVencidos: 1,
|
||||
}
|
||||
const ATIVIDADES_MOCK = [
|
||||
@ -72,6 +73,11 @@ function formatarMoeda(valor) {
|
||||
return new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(Number.isNaN(n) ? 0 : n)
|
||||
}
|
||||
|
||||
function formatarData(data) {
|
||||
if (!data) return ''
|
||||
return new Date(data + 'T00:00:00').toLocaleDateString('pt-BR')
|
||||
}
|
||||
|
||||
const iconeAtividade = {
|
||||
DEBITO: 'pi-receipt',
|
||||
CERTIDAO: 'pi-file-check',
|
||||
@ -150,9 +156,14 @@ const iconeAtividade = {
|
||||
<div>
|
||||
<p class="text-2xl font-bold text-slate-800 dark:text-slate-100">
|
||||
<span v-if="carregando" class="inline-block w-16 h-7 bg-slate-200 dark:bg-slate-700 rounded animate-pulse" />
|
||||
<template v-else>{{ formatarMoeda(resumo?.ultimoPagamento) }}</template>
|
||||
<template v-else>{{ formatarMoeda(resumo?.valorUltimoPagamento) }}</template>
|
||||
</p>
|
||||
<p class="text-xs text-slate-500 dark:text-slate-400 mt-0.5">
|
||||
Último pagamento
|
||||
<template v-if="!carregando && resumo?.ultimoPagamento">
|
||||
· {{ formatarData(resumo.ultimoPagamento) }}
|
||||
</template>
|
||||
</p>
|
||||
<p class="text-xs text-slate-500 dark:text-slate-400 mt-0.5">Último pagamento</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user