feat: substitui ponto por virgula valor pix

This commit is contained in:
Rafael Sampaio de Oliveira 2023-01-30 11:44:56 -03:00
parent 12e33f81fb
commit 2fb64c583a

View File

@ -1,15 +1,15 @@
import React from "react"; import React, { useEffect } from "react";
import { useProduct } from "vtex.product-context"; import { useProduct } from "vtex.product-context";
import styles from "./styles.module.css"; import styles from "./styles.module.css";
const PixPrice = () => { const PixPrice = () => {
// useEffect(() => { useEffect(() => {
// const inputCep = document.querySelectorAll(".vtex-address-form-4-x-input"); 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(); const productContextValue = useProduct();
@ -18,7 +18,7 @@ const PixPrice = () => {
const descount = (Number(productPrice) * 10) / 100; const descount = (Number(productPrice) * 10) / 100;
const total = Number(productPrice) - Number(descount.toFixed(2)); const total = Number(productPrice) - Number(descount);
return ( return (
<div className={styles["pixPrice-container"]}> <div className={styles["pixPrice-container"]}>
@ -30,7 +30,9 @@ const PixPrice = () => {
/> />
</div> </div>
<div className={styles["pixPrice-descount"]}> <div className={styles["pixPrice-descount"]}>
<p className={styles["pixPrice-value"]}>R$ {total.toFixed(2)}</p> <p className={styles["pixPrice-value"]}>
R$ {total.toFixed(2).replace(".", ",")}
</p>
<p className={styles["pixPrice-text"]}>10 % de desconto</p> <p className={styles["pixPrice-text"]}>10 % de desconto</p>
</div> </div>
</div> </div>