diff --git a/src/pages/portal/pagamentos.vue b/src/pages/portal/pagamentos.vue index 5d2811b..450e5d6 100644 --- a/src/pages/portal/pagamentos.vue +++ b/src/pages/portal/pagamentos.vue @@ -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 a = document.createElement('a') - a.href = url - a.download = `comprovante-${pag.id}.pdf` - a.click() - URL.revokeObjectURL(url) + 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.idContaCorrente}.pdf` + a.click() + } + 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 = {
- {{ formatarMoeda(resumo?.ultimoPagamento) }} + {{ formatarMoeda(resumo?.valorUltimoPagamento) }} +
++ Último pagamento + + · {{ formatarData(resumo.ultimoPagamento) }} +
-Último pagamento