feat: página de pagamento finalizada

This commit is contained in:
Gustavo Rallenson Gonçalves Da Silva 2022-12-20 13:35:17 -03:00
parent 2a58a51b26
commit 42dff75a0c

View File

@ -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]
)
}
});
});