From ee1df7fee0e251ae10a3cb86c05009767f6b23b7 Mon Sep 17 00:00:00 2001 From: sidharth Date: Wed, 26 Jan 2022 11:02:28 +0530 Subject: [PATCH] Added upc in ui --- src/components/retailer/cart-product/CartProductList.vue | 8 ++++++++ src/services/util.service.js | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/retailer/cart-product/CartProductList.vue b/src/components/retailer/cart-product/CartProductList.vue index 2a04d42..534552f 100644 --- a/src/components/retailer/cart-product/CartProductList.vue +++ b/src/components/retailer/cart-product/CartProductList.vue @@ -310,6 +310,14 @@ Sku {{ product.sku }}

+ +

+ UPC {{ product.customAttributes.upc }} +

+

${{ priceFormatter(product.price) }} diff --git a/src/services/util.service.js b/src/services/util.service.js index 81e91b9..6d699dc 100644 --- a/src/services/util.service.js +++ b/src/services/util.service.js @@ -700,7 +700,7 @@ export const checkEncodeURI = (str) => { } } export const priceFormatter = (price, pdp) => { - if (price != undefined) { + if (price != undefined) { price = price.toString(); let decimals = (price.split("."))[1]; if ((!Number(decimals) || isNaN(decimals)) || decimals.length == 1) //if 2 or 2.1 @@ -708,7 +708,7 @@ export const priceFormatter = (price, pdp) => { if (decimals.length == 2 && pdp) //if 2 or 2.1 return price; else if (decimals.length > 1) // if 2.34 or 2.56565 - return Number(price.match(/^-?\d+(?:\.\d{0,2})?/)[0]); + return Number(price.match(/^-?\d+(?:\.\d{0,4})?/)[0]); } }