[SHOPTIME-3553] 구매불가상품 price 원복

This commit is contained in:
고동영
2024-10-23 15:26:05 +09:00
parent 9e02a661b6
commit c19ee2ea02
2 changed files with 44 additions and 32 deletions

View File

@@ -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;

View File

@@ -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") + " "}
</span>
<span className={css.partnerPrc}>
{originalPrice !== discountedPrice
? originalPrice
: discountedPrice}
{TYPE_CASE.case5 || TYPE_CASE.case8
? parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2
: price3}
</span>
</div>
<div className={css.rewdBtmLayer}>
<span className={css.rewdNm}>{$L("Shop Time Price")}</span>
<div className={css.btmPrc}>
{/* TODO : rewd data*/}
{/* 분할금액 조건문처리 케이스별로 */}
<span className={css.rewdRate}>{discountedPrice} </span>
{discountRate && discountAmount && (
{/* 리워드 금액 */}
{(TYPE_CASE.case7 ||
TYPE_CASE.case5 ||
TYPE_CASE.case6 ||
TYPE_CASE.case8) && (
<span className={css.rewdPrc}>
{$L("Save") + discountAmount + discountRate}
</span>
@@ -170,7 +184,6 @@ export default function UnableOption({
</div>
);
} else {
// case1 또는 case4
if (TYPE_CASE.case1 || TYPE_CASE.case4) {
return (
<div className={css.wrapper}>
@@ -181,16 +194,15 @@ export default function UnableOption({
</span>
<div className={css.btmLayer}>
<span className={classNames(css.price, css.case01)}>
{originalPrice !== discountedPrice
? originalPrice
: discountedPrice}
{parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2}
</span>
</div>
</div>
);
}
// case2
if (TYPE_CASE.case2) {
return (
<div className={css.wrapper}>
@@ -205,16 +217,18 @@ export default function UnableOption({
</span>
</div>
<div className={css.btmLayer}>
<span className={css.price}>{discountedPrice}</span>
{originalPrice !== discountedPrice && (
<span className={css.discountedPrc}>{originalPrice}</span>
)}
<span className={css.price}>{price3}</span>
<span className={css.discountedPrc}>
{originalPrice &&
parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2}
</span>
</div>
</div>
);
}
// case3
if (TYPE_CASE.case3) {
return (
<div className={css.wrapper}>
@@ -227,11 +241,14 @@ export default function UnableOption({
{discountRate && Number(discountRate.replace("%", "")) > 4 && (
<div className={css.rateTag}>{discountRate}</div>
)}
<span className={css.price}>{discountedPrice}</span>
{originalPrice !== discountedPrice && (
<span className={css.discountedPrc}>{originalPrice}</span>
)}
<span className={css.price}>{price3}</span>
<span className={css.discountedPrc}>
{parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2}
</span>
</div>
{/* 할부 */}
</div>
);
}
@@ -257,23 +274,18 @@ export default function UnableOption({
</div>
<div className={css.btmLayer}>
<span className={css.price}>{discountedPrice}</span>
{originalPrice !== discountedPrice && (
<span className={css.discountedPrc}>{originalPrice}</span>
)}
<span className={css.discountedPrc}>
{originalPrice &&
parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2}
</span>
</div>
</div>
);
}
}
}, [
patnrName,
productInfo,
originalPrice,
discountedPrice,
discountRate,
discountAmount,
promotionCode,
]);
}, [patnrName, productInfo]);
return (
<div className={css.priceContainer}>