checkout, detailPanel singleOption change logic
This commit is contained in:
@@ -45,7 +45,6 @@ export default function CheckOutPanel() {
|
||||
const checkoutPanelInfo = panels.find(
|
||||
(panel) => panel.name === "checkoutpanel"
|
||||
)?.panelInfo;
|
||||
const checkoutData = useSelector((state) => state.checkout?.checkoutData);
|
||||
|
||||
const productData = useSelector(
|
||||
(state) => state.checkout?.checkoutData.productList
|
||||
@@ -60,13 +59,11 @@ export default function CheckOutPanel() {
|
||||
const { popupVisible, activePopup } = useSelector(
|
||||
(state) => state.common.popup
|
||||
);
|
||||
const { billingAddressList, shippingAddressList, cardInfo } =
|
||||
checkoutData || {};
|
||||
const { currSign, currSignLoc } = productData?.[0] || {};
|
||||
|
||||
const [orderSideBarOpen, setOrderSideBarOpen] = useState(false);
|
||||
const [offerSideBarOpen, setOfferSideBarOpen] = useState(false);
|
||||
const [placeOrderPopup, setPlaceOrderPopup] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [currentTerms, setCurrentTerms] = useState(null);
|
||||
const [tabList, setTabList] = useState([]);
|
||||
const [selectedTabIndex, setSelectedTabIndex] = useState(0);
|
||||
@@ -82,42 +79,17 @@ export default function CheckOutPanel() {
|
||||
useEffect(() => {
|
||||
isMounted.current = true;
|
||||
|
||||
dispatch(
|
||||
changeAppStatus({ showLoadingPanel: { show: true, type: "wait" } })
|
||||
);
|
||||
|
||||
if (!loading) {
|
||||
dispatch(changeAppStatus({ showLoadingPanel: { show: false } }));
|
||||
}
|
||||
|
||||
return () => {
|
||||
isMounted.current = false;
|
||||
};
|
||||
}, [loading, dispatch]);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getShoptimeTerms());
|
||||
|
||||
dispatch(
|
||||
getMyInfoCheckoutInfo({
|
||||
mbrNo: userNumber,
|
||||
dirPurcSelYn: "Y",
|
||||
cartList: [
|
||||
{
|
||||
patnrId: checkoutPanelInfo.cartList.patnrId,
|
||||
prdtId: checkoutPanelInfo.cartList.prdtId,
|
||||
prodOptCdCval: checkoutPanelInfo.cartList.prodOptCdCval,
|
||||
prodQty: checkoutPanelInfo.cartList.prodQty,
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
}, [dispatch, userNumber, checkoutPanelInfo]);
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
if (infoForCheckoutData && productData) {
|
||||
setLoading(false);
|
||||
|
||||
const orderProductCoupontUse = Object.keys(selectedCoupons).map(
|
||||
(productId) => {
|
||||
const { cpnCdSeq, cpnSno, prdtId } = selectedCoupons[productId];
|
||||
@@ -148,21 +120,8 @@ export default function CheckOutPanel() {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (!billingAddressList || !shippingAddressList || !cardInfo) {
|
||||
dispatch(setShowPopup(Config.ACTIVE_POPUP.qrPopup2));
|
||||
}
|
||||
}
|
||||
}, [
|
||||
dispatch,
|
||||
infoForCheckoutData,
|
||||
productData,
|
||||
userNumber,
|
||||
selectedCoupons,
|
||||
billingAddressList,
|
||||
shippingAddressList,
|
||||
cardInfo,
|
||||
]);
|
||||
}, [dispatch, infoForCheckoutData, productData, userNumber, selectedCoupons]);
|
||||
|
||||
useEffect(() => {
|
||||
const newTabList = [];
|
||||
@@ -218,11 +177,6 @@ export default function CheckOutPanel() {
|
||||
dispatch(setHidePopup());
|
||||
}, [dispatch]);
|
||||
|
||||
const onCloseQRPopup = useCallback(() => {
|
||||
dispatch(setHidePopup());
|
||||
dispatch(popPanel());
|
||||
}, []);
|
||||
|
||||
const handleTermsClick = useCallback(
|
||||
(termsID) => {
|
||||
if (empTermsData) {
|
||||
@@ -284,6 +238,8 @@ export default function CheckOutPanel() {
|
||||
setPlaceOrderPopup={setPlaceOrderPopup}
|
||||
empTermsData={empTermsData}
|
||||
handleTermsClick={handleTermsClick}
|
||||
currSign={currSign}
|
||||
currSignLoc={currSignLoc}
|
||||
/>
|
||||
<InformationContainer
|
||||
toggleOrderSideBar={toggleOrderSideBar}
|
||||
@@ -340,33 +296,6 @@ export default function CheckOutPanel() {
|
||||
</TPopUp>
|
||||
)}
|
||||
|
||||
{activePopup === Config.ACTIVE_POPUP.qrPopup2 && (
|
||||
<TPopUp kind="qrPopup" open={popupVisible} onClose={onCloseQRPopup}>
|
||||
<div className={css.popupContainer}>
|
||||
<div className={css.header}>
|
||||
<h3>{$L("QR CODE")}</h3>
|
||||
</div>
|
||||
<div className={css.qrcodeContainer}>
|
||||
<div className={css.qrcode}>
|
||||
<TQRCode text="http://google.com" width="360" height="360" />
|
||||
</div>
|
||||
<h3>
|
||||
{$L(
|
||||
"If you want to add or edit your address and payment information, please scan the QR CODE."
|
||||
)}
|
||||
</h3>
|
||||
<TButton
|
||||
className={css.popupBtn}
|
||||
onClick={onCloseQRPopup}
|
||||
spotlightId="checkoutCloseButton"
|
||||
>
|
||||
{$L("CLOSE")}
|
||||
</TButton>
|
||||
</div>
|
||||
</div>
|
||||
</TPopUp>
|
||||
)}
|
||||
|
||||
<TFullPopup
|
||||
open={placeOrderPopup}
|
||||
className={css.pinCodePopup}
|
||||
|
||||
Reference in New Issue
Block a user