From 42dff75a0c3fff2e7d8189f6d16eef924f6dea4f Mon Sep 17 00:00:00 2001 From: Rallenson Date: Tue, 20 Dec 2022 13:35:17 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20p=C3=A1gina=20de=20pagamento=20finaliza?= =?UTF-8?q?da?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- checkout/src/arquivos/js/components/app.js | 135 +++++++++++++++++++-- 1 file changed, 125 insertions(+), 10 deletions(-) diff --git a/checkout/src/arquivos/js/components/app.js b/checkout/src/arquivos/js/components/app.js index 91dfc48..786ed7b 100644 --- a/checkout/src/arquivos/js/components/app.js +++ b/checkout/src/arquivos/js/components/app.js @@ -47,6 +47,7 @@ export default class Footer { this.tbody = await waitElement(".accordion-inner"); this.LapisAzul = await waitElement(".icon-edit"); this.btnCep = await waitElement("#shipping-calculate-link"); + this.Dados_profile_payment_wrapper = await waitElement("#payment-data"); this.Dados_profile = document.querySelectorAll(".accordion-group")[1]; this.Dados_profile_payment = document.querySelectorAll(".accordion-group")[3]; this.safeP = document.createElement("p"); @@ -75,6 +76,7 @@ export default class Footer { } } async TextTransfer(){ + const payment_group = this.Dados_profile_payment_wrapper; const dadosProfile =this.Dados_profile.children[0].children[0].children[1] const Dados_profile_payment =this.Dados_profile_payment.children[0] const tbodywrapper = this.wrapper; @@ -85,13 +87,56 @@ export default class Footer { tbodywrapper.appendChild(this.more) tbodywrapper.appendChild(this.Finalizar_btn) tbody.appendChild(tbodywrapper) - console.log(this.Dados_profileAll,"Todos os conteiners de pagamento") - console.log(Dados_profile_payment,"Todos os conteiners de pagamento") + // console.log(this.Dados_profileAll,"Todos os conteiners de pagamento") + // console.log(Dados_profile_payment,"Todos os conteiners de pagamento") const IconDev = document.querySelector(".footerCheckout__developedBy") if(window.location.href == "https://m3academy.myvtex.com/checkout/#/payment"){ - this.Dados_profile_payment.children[0].appendChild(this.safeP) + Dados_profile_payment.appendChild(this.safeP) } + payment_group + .children[0] + .children[1] + .children[0] + .children[1] + .children[4] + .children[0] + .children[1] + .children[3] + .children[2] + .children[0] + .innerHTML =` + Cartão de Débito + ` + payment_group + .children[0] + .children[1] + .children[0] + .children[1] + .children[4] + .children[0] + .children[1] + .children[3] + .children[9] + .children[0] + .innerHTML = + ` + Boleto à Vista + ` + payment_group + .children[0] + .children[1] + .children[0] + .children[1] + .children[4] + .children[0] + .children[1] + .children[3] + .children[10] + .children[0] + .innerHTML =` + Boleto Faturado + ` this.Finalizar_btn.innerHTML =` FINALIZAR COMPRA ` @@ -174,8 +219,11 @@ export default class Footer { ` } async onUpdate() { - const target = this.Dados_profile_payment; - const safeP = this.safeP; + const target = this.Dados_profile_payment_wrapper; + const safeP = document.createElement("p"); + safeP.innerHTML =` + Solicitamos apenas informações necessárias para realização da sua compra, sem compromenter seus dados + ` let config = { childList: false, attributes: true, @@ -188,14 +236,81 @@ export default class Footer { mutations.forEach(function (mutation) { console.log("mutation is ->",mutation.type, mutation.attributeName,mutation.oldValue); if(window.location.href == "https://m3academy.myvtex.com/checkout/#/payment"){ + console.log("o pai está aberto",mutation.oldValue) console.log(mutation) - if(mutation.oldValue == "step accordion-group store-country-BRA active"){ - console.log("o pai está aberto",mutation.oldValue) - console.log(target) - } + console.log(target) + target.children[0].children[0].appendChild(safeP) + target + .children[0] + .children[1] + .children[0] + .children[1] + .children[4] + .children[0] + .children[1] + .children[3] + .children[2] + .children[0] + .innerHTML =` + Cartão de Débito + ` + target + .children[0] + .children[1] + .children[0] + .children[1] + .children[4] + .children[0] + .children[1] + .children[3] + .children[9] + .children[0] + .innerHTML =` + Boleto à Vista + ` + target + .children[0] + .children[1] + .children[0] + .children[1] + .children[4] + .children[0] + .children[1] + .children[3] + .children[10] + .children[0] + .innerHTML =` + Boleto Faturado + ` + console.log(target + .children[0] + .children[1] + .children[0] + .children[1] + .children[4] + .children[0] + .children[1] + .children[3] + .children[10] + .children[0] + ) } else{ - console.log("o pai está fechado") + console.log("o pai está fechado",mutation.oldValue); + console.log(mutation) + console.log(target) + console.log(target + .children[0] + .children[1] + .children[0] + .children[1] + .children[4] + .children[0] + .children[1] + .children[3] + .children[10] + .children[0] + ) } }); });