From 2fb64c583a71f7d378c6b7d86fa155f3906a1aa4 Mon Sep 17 00:00:00 2001 From: Rafael Sampaio Date: Mon, 30 Jan 2023 11:44:56 -0300 Subject: [PATCH] feat: substitui ponto por virgula valor pix --- react/components/PixPrice/PixPrice.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/react/components/PixPrice/PixPrice.tsx b/react/components/PixPrice/PixPrice.tsx index 9336129..0dae1c6 100644 --- a/react/components/PixPrice/PixPrice.tsx +++ b/react/components/PixPrice/PixPrice.tsx @@ -1,15 +1,15 @@ -import React from "react"; +import React, { useEffect } from "react"; import { useProduct } from "vtex.product-context"; import styles from "./styles.module.css"; const PixPrice = () => { - // useEffect(() => { - // const inputCep = document.querySelectorAll(".vtex-address-form-4-x-input"); + useEffect(() => { + const inputCep = document.querySelectorAll(".vtex-address-form-4-x-input"); - // // inputCep.setAttribute('placeholder', 'Digite seu CEP'); + // inputCep.setAttribute('placeholder', 'Digite seu CEP'); - // console.log(inputCep); - // }); + console.log(inputCep); + }); const productContextValue = useProduct(); @@ -18,7 +18,7 @@ const PixPrice = () => { const descount = (Number(productPrice) * 10) / 100; - const total = Number(productPrice) - Number(descount.toFixed(2)); + const total = Number(productPrice) - Number(descount); return (
@@ -30,7 +30,9 @@ const PixPrice = () => { />
-

R$ {total.toFixed(2)}

+

+ R$ {total.toFixed(2).replace(".", ",")} +

10 % de desconto