From c19ee2ea0207cc78fd9ea5550c3a7c2d53e1a276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B3=A0=EB=8F=99=EC=98=81?= Date: Wed, 23 Oct 2024 15:26:05 +0900 Subject: [PATCH] =?UTF-8?q?[SHOPTIME-3553]=20=EA=B5=AC=EB=A7=A4=EB=B6=88?= =?UTF-8?q?=EA=B0=80=EC=83=81=ED=92=88=20price=20=EC=9B=90=EB=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/hooks/usePriceInfo.js | 2 +- .../UnableProduct/UnableOption.jsx | 74 +++++++++++-------- 2 files changed, 44 insertions(+), 32 deletions(-) diff --git a/com.twin.app.shoptime/src/hooks/usePriceInfo.js b/com.twin.app.shoptime/src/hooks/usePriceInfo.js index 0a149cbb..eec064dc 100644 --- a/com.twin.app.shoptime/src/hooks/usePriceInfo.js +++ b/com.twin.app.shoptime/src/hooks/usePriceInfo.js @@ -46,7 +46,7 @@ export default function usePriceInfo(priceInfo) { ); let discountRateNumeric = parseFloat(discountRate.replace("%", "")); - if (originalPriceNum === 0 || discountedPriceNum >= originalPriceNum) { + if (discountedPriceNum >= originalPriceNum) { originalPrice = discountedPrice; discountRateNumeric = null; discountRate = null; diff --git a/com.twin.app.shoptime/src/views/DetailPanel/UnableProduct/UnableOption.jsx b/com.twin.app.shoptime/src/views/DetailPanel/UnableProduct/UnableOption.jsx index fa33904b..41944eca 100644 --- a/com.twin.app.shoptime/src/views/DetailPanel/UnableProduct/UnableOption.jsx +++ b/com.twin.app.shoptime/src/views/DetailPanel/UnableProduct/UnableOption.jsx @@ -68,8 +68,13 @@ export default function UnableOption({ "popupVisible", (state) => state.common.popup?.popupVisible ); + const TYPE_CASE = { // (기획서참고) 상품 상세 가격 노출 유형 + + // price2 : 할인전 금액 + // price3 : 할인후 금액 + // price5 : 할부 금액 case1: price2 && !price3 && !price5, case2: price2 && price3 && !price5, case3: price2 && price3 && price5, @@ -151,16 +156,25 @@ export default function UnableOption({ : patnrName + " " + $L("Price") + " "} - {originalPrice !== discountedPrice - ? originalPrice - : discountedPrice} + {TYPE_CASE.case5 || TYPE_CASE.case8 + ? parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0 + ? offerInfo + : price2 + : price3}
{$L("Shop Time Price")}
- {discountedPrice} - {discountRate && discountAmount && ( + {/* TODO : rewd data*/} + {/* 분할금액 조건문처리 케이스별로 */} + + {discountedPrice} + {/* 리워드 금액 */} + {(TYPE_CASE.case7 || + TYPE_CASE.case5 || + TYPE_CASE.case6 || + TYPE_CASE.case8) && ( {$L("Save") + discountAmount + discountRate} @@ -170,7 +184,6 @@ export default function UnableOption({
); } else { - // case1 또는 case4 if (TYPE_CASE.case1 || TYPE_CASE.case4) { return (
@@ -181,16 +194,15 @@ export default function UnableOption({
- {originalPrice !== discountedPrice - ? originalPrice - : discountedPrice} + {parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0 + ? offerInfo + : price2}
); } - // case2 if (TYPE_CASE.case2) { return (
@@ -205,16 +217,18 @@ export default function UnableOption({
- {discountedPrice} - {originalPrice !== discountedPrice && ( - {originalPrice} - )} + {price3} + + {originalPrice && + parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0 + ? offerInfo + : price2} +
); } - // case3 if (TYPE_CASE.case3) { return (
@@ -227,11 +241,14 @@ export default function UnableOption({ {discountRate && Number(discountRate.replace("%", "")) > 4 && (
{discountRate}
)} - {discountedPrice} - {originalPrice !== discountedPrice && ( - {originalPrice} - )} + {price3} + + {parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0 + ? offerInfo + : price2} +
+ {/* 할부 */} ); } @@ -257,23 +274,18 @@ export default function UnableOption({
{discountedPrice} - {originalPrice !== discountedPrice && ( - {originalPrice} - )} + + {originalPrice && + parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0 + ? offerInfo + : price2} +
); } } - }, [ - patnrName, - productInfo, - originalPrice, - discountedPrice, - discountRate, - discountAmount, - promotionCode, - ]); + }, [patnrName, productInfo]); return (