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 (