[구매 및 장바구니 관련수정]
- buyoption : ,로 인해서 잘리는 부분수정. - mock데이터 말고 정식 상품이 바로 구매로 넘어올떄 관련 부분 수정. - 장바구니 금액 노출부분 수정 및 스타일 수정 - 구매 과정중 금액 노출및 정상적이지 않는 스타일에 대한수정 - 갯수 관련 수정
This commit is contained in:
@@ -2,8 +2,8 @@ import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
|
||||
import {
|
||||
@@ -16,7 +16,6 @@ import SpotlightContainerDecorator
|
||||
from '@enact/spotlight/SpotlightContainerDecorator';
|
||||
|
||||
import { addToCart } from '../../../actions/cartActions';
|
||||
import { addToMockCart } from '../../../actions/mockCartActions';
|
||||
import { getMyInfoCheckoutInfo } from '../../../actions/checkoutActions';
|
||||
import {
|
||||
changeAppStatus,
|
||||
@@ -25,12 +24,12 @@ import {
|
||||
showError,
|
||||
} from '../../../actions/commonActions';
|
||||
import { getProductCouponSearch } from '../../../actions/couponActions';
|
||||
import { getSafeProductPrice } from '../../../utils/mockDataSafetyUtils';
|
||||
import {
|
||||
sendLogPaymentEntry,
|
||||
sendLogTotalRecommend,
|
||||
} from '../../../actions/logActions';
|
||||
import { finishMediaPreview } from '../../../actions/mediaActions';
|
||||
import { addToMockCart } from '../../../actions/mockCartActions';
|
||||
import {
|
||||
popPanel,
|
||||
pushPanel,
|
||||
@@ -43,10 +42,13 @@ import {
|
||||
import { clearAllToasts } from '../../../actions/toastActions';
|
||||
import TButton from '../../../components/TButton/TButton';
|
||||
import TPopUp from '../../../components/TPopUp/TPopUp';
|
||||
import { BUYNOW_CONFIG } from '../../../utils/BuyNowConfig';
|
||||
import {
|
||||
createMockProductOptionData,
|
||||
} from '../../../utils/BuyNowDataManipulator';
|
||||
import * as Config from '../../../utils/Config';
|
||||
import { $L } from '../../../utils/helperMethods';
|
||||
import { BUYNOW_CONFIG } from '../../../utils/BuyNowConfig';
|
||||
import { createMockProductOptionData } from '../../../utils/BuyNowDataManipulator';
|
||||
import { getSafeProductPrice } from '../../../utils/mockDataSafetyUtils';
|
||||
import FavoriteBtn from '../components/FavoriteBtn';
|
||||
import styles from './BuyOption.module.less';
|
||||
import BuyOptionPriceBlock from './BuyOptionPriceBlock';
|
||||
@@ -556,23 +558,24 @@ const BuyOption = ({
|
||||
const extractNumericPrice = (priceStr) => {
|
||||
if (typeof priceStr === 'number') return priceStr;
|
||||
if (typeof priceStr === 'string') {
|
||||
const numMatch = priceStr.match(/[\d.]+/);
|
||||
const cleanedValue = priceStr.replace(/,/g, '');
|
||||
const numMatch = cleanedValue.match(/[\d.]+/);
|
||||
return numMatch ? parseFloat(numMatch[0]) : 0;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
const price2Value = extractNumericPrice(productInfo?.price2);
|
||||
const price3Value = extractNumericPrice(productInfo?.price3 ? productInfo?.price3 : productInfo?.price2);
|
||||
const price5Value = extractNumericPrice(productInfo?.price5);
|
||||
|
||||
console.log('[BuyOption] handleClickOrder - productInfo.price2:', productInfo?.price2, '-> extracted:', price2Value);
|
||||
console.log('[BuyOption] handleClickOrder - productInfo.price2:', productInfo?.price3, '-> extracted:', price3Value);
|
||||
console.log('[BuyOption] handleClickOrder - productInfo.price5:', productInfo?.price5, '-> extracted:', price5Value);
|
||||
|
||||
// 가격 계산:
|
||||
// discountPrice = price2 (상품 가격)
|
||||
// regularPrice = price2 + price5 (상품 가격 + 할인액 = 원래 가격)
|
||||
let discountPrice = price2Value > 0 ? price2Value : 0;
|
||||
let regularPrice = price2Value + price5Value; // price2 + price5 = 원래 가격
|
||||
let discountPrice = price3Value > 0 ? price3Value : 0;
|
||||
let regularPrice = price3Value + price5Value; // price2 + price5 = 원래 가격
|
||||
|
||||
const discountRate = priceInfo?.split('|')[4];
|
||||
|
||||
@@ -688,12 +691,13 @@ const BuyOption = ({
|
||||
patncNm: patncNm || 'Mock Partner',
|
||||
// calculateOrderSummaryFromProductInfo 함수가 필요한 필드들
|
||||
// productInfo에서 직접 추출한 값을 전달
|
||||
price2: price2Value, // Items (상품 가격)
|
||||
price2: price3Value, // Items (상품 가격)
|
||||
price5: price5Value, // Coupon Savings (할인액)
|
||||
finalPrice: discountPrice,
|
||||
discount: price5Value,
|
||||
origPrice: regularPrice,
|
||||
discountPrice: discountPrice,
|
||||
prodQty:quantity,
|
||||
// 추가 가격 필드들 (fallback용)
|
||||
price: discountPrice,
|
||||
originalPrice: regularPrice,
|
||||
@@ -701,7 +705,8 @@ const BuyOption = ({
|
||||
...(productInfo.imgList && { imgList: productInfo.imgList }),
|
||||
...(productInfo.thumbnailUrl && { thumbnailUrl: productInfo.thumbnailUrl }),
|
||||
...(productInfo.imgUrls && { imgUrls: productInfo.imgUrls }),
|
||||
shippingCharge: 0, // 배송비
|
||||
shippingCharge: productInfo?.shippingFee || '12.99', // 배송비
|
||||
shippingFee: productInfo?.shippingFee || '12.99',
|
||||
currSign: '$',
|
||||
currSignLoc: 'left',
|
||||
},
|
||||
@@ -709,7 +714,7 @@ const BuyOption = ({
|
||||
};
|
||||
|
||||
console.log('[BuyOption] Mock Mode - checkoutPanelInfo.productInfo price fields:', {
|
||||
price2: price2Value,
|
||||
price2: price3Value,
|
||||
price5: price5Value,
|
||||
finalPrice: discountPrice,
|
||||
origPrice: regularPrice,
|
||||
@@ -884,12 +889,13 @@ const BuyOption = ({
|
||||
const extractNumericPrice = (value) => {
|
||||
if (typeof value === 'number') return value;
|
||||
if (typeof value === 'string') {
|
||||
const numMatch = value.match(/[\d.]+/);
|
||||
const cleanedValue = value.replace(/,/g, '');
|
||||
const numMatch = cleanedValue.match(/[\d.]+/);
|
||||
return numMatch ? parseFloat(numMatch[0]) : 0;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
const price2Value = extractNumericPrice(productInfo?.price2);
|
||||
const price5Value = extractNumericPrice(productInfo?.price5);
|
||||
|
||||
@@ -1001,7 +1007,8 @@ const BuyOption = ({
|
||||
const extractNumericPrice = (value) => {
|
||||
if (typeof value === 'number') return value;
|
||||
if (typeof value === 'string') {
|
||||
const numMatch = value.match(/[\d.]+/);
|
||||
const cleanedValue = value.replace(/,/g, '');
|
||||
const numMatch = cleanedValue.match(/[\d.]+/);
|
||||
return numMatch ? parseFloat(numMatch[0]) : 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user