[SHOPTIME-3553] Search / Search Result / 가격이 있는 상품인데 Offer Info 가 노출되는 현상

[수정파일]

src/views/DetailPanel/UnableProduct/UnableOption.jsx

[원인]

API에서 price2 , price3 대신 priceInfo값으로 통일

[대책]
price2 === discountedPriceNum , price3 === originalPriceNum이기 때문에 해당 데이터로 교체
usePriceInfo에서 할인 전 금액이 할인 후 금액보다 크다면  discountedPriceNum값과 originalPriceNum값이 같은 값으로 할당되어 내려오기 떄문에
값이 같다면 노출하지 않도록 수정
This commit is contained in:
고동영
2024-11-14 15:57:49 +09:00
parent ad1f574a71
commit 234eb819e9

View File

@@ -44,16 +44,8 @@ export default function UnableOption({
);
const tooltipDes = $L("Scan for more information about the product.");
const {
price2,
price3,
price5,
priceInfo,
rewd,
offerInfo,
patncNm,
installmentMonths,
} = productInfo;
const { price5, priceInfo, rewd, offerInfo, patncNm, installmentMonths } =
productInfo;
const {
discountRate,
@@ -75,15 +67,15 @@ export default function UnableOption({
// price2 : 할인전 금액
// price3 : 할인후 금액
// price5 : 할부 금액
case1: price2 && !price3 && !price5,
case2: price2 && price3 && !price5,
case3: price2 && price3 && price5,
case4: price2 && !price3 && price5,
case5: price2 && !price3 && !price5,
case6: price2 && price3 && !price5,
case7: price2 && price3 && price5,
case8: price2 && !price3 && price5,
case9: !price2 && !price3 && !price5 && offerInfo,
case1: originalPrice && !discountedPrice && !price5,
case2: originalPrice && discountedPrice && !price5,
case3: originalPrice && discountedPrice && price5,
case4: originalPrice && !discountedPrice && price5,
case5: originalPrice && !discountedPrice && !price5,
case6: originalPrice && discountedPrice && !price5,
case7: originalPrice && discountedPrice && price5,
case8: originalPrice && !discountedPrice && price5,
case9: !originalPrice && !discountedPrice && !price5 && offerInfo,
};
useEffect(() => {
@@ -144,6 +136,14 @@ export default function UnableOption({
setFavoriteFlag(ev);
}, []);
const isDiscounted = useMemo(() => {
return discountedPrice !== originalPrice;
}, [discountedPrice, originalPrice]);
const isOriginalPriceEmpty = useMemo(() => {
return parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0;
}, []);
const renderPriceItem = useCallback(() => {
if (productInfo && !promotionCode) {
if (rewd) {
@@ -157,10 +157,10 @@ export default function UnableOption({
</span>
<span className={css.partnerPrc}>
{TYPE_CASE.case5 || TYPE_CASE.case8
? parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? isOriginalPriceEmpty
? offerInfo
: price2
: price3}
: originalPrice
: discountedPrice}
</span>
</div>
<div className={css.rewdBtmLayer}>
@@ -194,15 +194,12 @@ export default function UnableOption({
</span>
<div className={css.btmLayer}>
<span className={classNames(css.price, css.case01)}>
{parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2}
{isOriginalPriceEmpty ? offerInfo : originalPrice}
</span>
</div>
</div>
);
}
if (TYPE_CASE.case2) {
return (
<div className={css.wrapper}>
@@ -217,13 +214,14 @@ export default function UnableOption({
</span>
</div>
<div className={css.btmLayer}>
<span className={css.price}>{price3}</span>
<span className={css.discountedPrc}>
{originalPrice &&
parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2}
</span>
<span className={css.price}>{discountedPrice}</span>
{isDiscounted && (
<span className={css.discountedPrc}>
{originalPrice && isOriginalPriceEmpty
? offerInfo
: originalPrice}
</span>
)}
</div>
</div>
);
@@ -241,12 +239,14 @@ export default function UnableOption({
{discountRate && Number(discountRate.replace("%", "")) > 4 && (
<div className={css.rateTag}>{discountRate}</div>
)}
<span className={css.price}>{price3}</span>
<span className={css.discountedPrc}>
{parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2}
</span>
<span className={css.price}>{discountedPrice}</span>
{isDiscounted && (
<span className={css.discountedPrc}>
{originalPrice && isOriginalPriceEmpty
? offerInfo
: originalPrice}
</span>
)}
</div>
{/* 할부 */}
</div>
@@ -274,12 +274,13 @@ export default function UnableOption({
</div>
<div className={css.btmLayer}>
<span className={css.price}>{discountedPrice}</span>
<span className={css.discountedPrc}>
{originalPrice &&
parseFloat(originalPrice.replace(/[^0-9.-]+/g, "")) === 0
? offerInfo
: price2}
</span>
{discountedPrice !== originalPrice && (
<span className={css.discountedPrc}>
{originalPrice && isOriginalPriceEmpty
? offerInfo
: originalPrice}
</span>
)}
</div>
</div>
);