[251102] fix: CartPanel mock-1
🕐 커밋 시간: 2025. 11. 02. 08:49:45 📊 변경 통계: • 총 파일: 12개 • 추가: +686줄 • 삭제: -88줄 📁 추가된 파일: + com.twin.app.shoptime/src/reducers/mockCartReducer.js 📝 수정된 파일: ~ com.twin.app.shoptime/src/components/VideoPlayer/TReactPlayer.jsx ~ com.twin.app.shoptime/src/store/store.js ~ com.twin.app.shoptime/src/utils/BuyNowDataManipulator.js ~ com.twin.app.shoptime/src/utils/Config.js ~ com.twin.app.shoptime/src/utils/mockDataSafetyUtils.js ~ com.twin.app.shoptime/src/views/CartPanel/CartPanel.jsx ~ com.twin.app.shoptime/src/views/CartPanel/CartProduct.jsx ~ com.twin.app.shoptime/src/views/CartPanel/CartProductBar.jsx ~ com.twin.app.shoptime/src/views/CartPanel/CartSidebar.jsx ~ com.twin.app.shoptime/src/views/DetailPanel/components/BuyOption.jsx ~ com.twin.app.shoptime/src/views/MainView/MainView.jsx 🔧 주요 변경 내용: • UI 컴포넌트 아키텍처 개선 • 핵심 비즈니스 로직 개선 • 공통 유틸리티 함수 최적화 • 대규모 기능 개발 • 모듈 구조 개선
This commit is contained in:
@@ -16,6 +16,7 @@ import SpotlightContainerDecorator
|
||||
from '@enact/spotlight/SpotlightContainerDecorator';
|
||||
|
||||
import { addToCart } from '../../../actions/cartActions';
|
||||
import { addToMockCart } from '../../../actions/mockCartActions';
|
||||
import { getMyInfoCheckoutInfo } from '../../../actions/checkoutActions';
|
||||
import {
|
||||
changeAppStatus,
|
||||
@@ -792,7 +793,7 @@ const BuyOption = ({
|
||||
// })
|
||||
// );
|
||||
|
||||
// Mock Mode: API 호출 스킵
|
||||
// API Mode: 실제 API 호출 후 CartPanel로 이동
|
||||
if (!BUYNOW_CONFIG.isMockMode()) {
|
||||
// 장바구니에 추가
|
||||
dispatch(
|
||||
@@ -811,17 +812,138 @@ const BuyOption = ({
|
||||
}
|
||||
})
|
||||
);
|
||||
} else {
|
||||
// Mock Mode: 로컬 장바구니 데이터 생성 후 CartPanel로 이동
|
||||
console.log('[BuyOption] Mock Mode - Adding to cart (Mock)');
|
||||
}
|
||||
|
||||
// CartPanel로 이동
|
||||
dispatch(
|
||||
pushPanel({
|
||||
name: Config.panel_names.CART_PANEL,
|
||||
})
|
||||
);
|
||||
// CartPanel로 이동 (productInfo 포함) - API에서는 이미 addToCart 호출됨
|
||||
// 이미지 URL 구성 (CheckOutPanel과 동일한 방식)
|
||||
// ✅ 이미지 URL 추출 (ProductAllSection의 고품질 이미지 우선)
|
||||
const imgUrl = productInfo?.imgUrls600?.[0] || // ✅ ProductAllSection에서 사용하는 고품질 이미지
|
||||
productInfo?.thumbnailUrl960 || // ✅ 960px 썸네일
|
||||
productInfo?.imgList?.[0]?.imgUrl ||
|
||||
productInfo?.thumbnailUrl ||
|
||||
productInfo?.patncLogPath ||
|
||||
'/assets/images/img-thumb-empty-144@3x.png';
|
||||
|
||||
// 가격 정보 구성
|
||||
const regularPrice = productInfo?.regularPrice || 299.99;
|
||||
const discountPrice = productInfo?.discountPrice || regularPrice;
|
||||
|
||||
const productInfoForCart = {
|
||||
// 기본 정보
|
||||
prdtId: selectedPrdtId,
|
||||
prdtNm: productInfo?.prdtNm || 'Product',
|
||||
patnrId: selectedPatnrId,
|
||||
patncNm: productInfo?.patncNm || 'Partner',
|
||||
patncLogPath: productInfo?.patncLogPath || '',
|
||||
|
||||
// ✅ 이미지 정보 (ProductAllSection의 고품질 이미지 포함)
|
||||
imgUrl: imgUrl,
|
||||
thumbnailUrl: productInfo?.thumbnailUrl960 || imgUrl,
|
||||
thumbnailUrl960: productInfo?.thumbnailUrl960,
|
||||
imgList: productInfo?.imgList || [{ imgUrl: imgUrl }],
|
||||
imgUrls: productInfo?.imgUrls || [{ imgUrl: imgUrl }], // imgUrls 배열 구조 추가 (CheckOutPanel 호환성)
|
||||
imgUrls600: productInfo?.imgUrls600, // ✅ 고품질 이미지 배열 포함
|
||||
|
||||
// 가격 정보 (문자열 형식으로)
|
||||
price2: regularPrice.toFixed(2), // 원가
|
||||
price3: discountPrice.toFixed(2), // 할인가/판매가
|
||||
|
||||
// 수량 정보
|
||||
prodQty: quantity,
|
||||
|
||||
// 옵션 정보
|
||||
optNm: productOptionInfos[0]?.optNm || '',
|
||||
|
||||
// 배송비 정보
|
||||
shippingCharge: productInfo?.shippingFee || '12.99',
|
||||
|
||||
// 기타 정보
|
||||
soldoutFlag: productInfo?.soldoutFlag || 'N',
|
||||
};
|
||||
|
||||
const optionInfoForCart = {
|
||||
name: productOptionInfos[0]?.optNm || '',
|
||||
price: productOptionInfos[0]?.prdtOptDtl[0]?.optPrc || '0.00'
|
||||
};
|
||||
|
||||
dispatch(
|
||||
pushPanel({
|
||||
name: Config.panel_names.CART_PANEL,
|
||||
panelInfo: {
|
||||
productInfo: productInfoForCart,
|
||||
optionInfo: optionInfoForCart,
|
||||
quantity: quantity
|
||||
}
|
||||
})
|
||||
);
|
||||
} else {
|
||||
// Mock Mode: Mock 장바구니에 상품 추가 후 CartPanel로 이동
|
||||
console.log('[BuyOption] Mock Mode - Adding to cart (Mock)');
|
||||
|
||||
// ✅ 이미지 URL 구성 (ProductAllSection의 고품질 이미지 우선)
|
||||
const imgUrl = productInfo?.imgUrls600?.[0] || // ✅ ProductAllSection에서 사용하는 고품질 이미지
|
||||
productInfo?.thumbnailUrl960 || // ✅ 960px 썸네일
|
||||
productInfo?.imgList?.[0]?.imgUrl ||
|
||||
productInfo?.thumbnailUrl ||
|
||||
productInfo?.patncLogPath ||
|
||||
'/assets/images/img-thumb-empty-144@3x.png';
|
||||
|
||||
// 가격 정보 구성 (CheckOutPanel과 동일한 방식)
|
||||
const regularPrice = productInfo?.regularPrice || 299.99;
|
||||
const discountPrice = productInfo?.discountPrice || regularPrice;
|
||||
|
||||
// Mock 상품 정보 구성 (CheckOutPanel 구조 참고)
|
||||
const mockProductInfo = {
|
||||
// 기본 정보
|
||||
prdtId: selectedPrdtId,
|
||||
prdtNm: productInfo?.prdtNm || 'Mock Product',
|
||||
patnrId: selectedPatnrId,
|
||||
patncNm: productInfo?.patncNm || 'Mock Partner',
|
||||
patncLogPath: productInfo?.patncLogPath || '',
|
||||
|
||||
// ✅ 이미지 정보 (ProductAllSection의 고품질 이미지 포함)
|
||||
imgUrl: imgUrl,
|
||||
thumbnailUrl: productInfo?.thumbnailUrl960 || imgUrl,
|
||||
thumbnailUrl960: productInfo?.thumbnailUrl960,
|
||||
imgList: productInfo?.imgList || [{ imgUrl: imgUrl }], // imgList 배열 구조 추가
|
||||
imgUrls: productInfo?.imgUrls || [{ imgUrl: imgUrl }], // imgUrls 배열 구조 추가 (CheckOutPanel 호환성)
|
||||
imgUrls600: productInfo?.imgUrls600, // ✅ 고품질 이미지 배열 포함
|
||||
|
||||
// 가격 정보 (문자열 형식으로)
|
||||
price2: regularPrice.toFixed(2), // 원가
|
||||
price3: discountPrice.toFixed(2), // 할인가/판매가
|
||||
|
||||
// 수량 정보
|
||||
prodQty: quantity,
|
||||
|
||||
// 옵션 정보 (필요시)
|
||||
optNm: productOptionInfos[0]?.optNm || 'Default Option',
|
||||
|
||||
// 배송비 정보
|
||||
shippingCharge: productInfo?.shippingFee || '12.99',
|
||||
shippingFee: productInfo?.shippingFee || '12.99',
|
||||
|
||||
// 기타 정보
|
||||
soldoutFlag: productInfo?.soldoutFlag || 'N',
|
||||
};
|
||||
|
||||
// 옵션 정보 구성
|
||||
const optionInfo = {
|
||||
name: productOptionInfos[0]?.optNm || 'Default Option',
|
||||
price: productOptionInfos[0]?.prdtOptDtl[0]?.optPrc || '0.00'
|
||||
};
|
||||
|
||||
// CartPanel로 이동 (productInfo 포함) - CartPanel에서 직접 상품 추가
|
||||
dispatch(
|
||||
pushPanel({
|
||||
name: Config.panel_names.CART_PANEL,
|
||||
panelInfo: {
|
||||
productInfo: mockProductInfo,
|
||||
optionInfo: optionInfo,
|
||||
quantity: quantity
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
dispatch(clearAllToasts());
|
||||
|
||||
Reference in New Issue
Block a user