[checkout] confirmPanel 추가, checkoutOrderAmtDummy api 추가, qr코드 주소 변경, 결제 에러케이스 추가 및 결제 완료 시 confirmPanel 이동
This commit is contained in:
@@ -6,6 +6,7 @@ import { Job } from "@enact/core/util";
|
||||
import Spotlight from "@enact/spotlight";
|
||||
|
||||
import {
|
||||
getCheckoutTotalAmtDummy,
|
||||
getMyInfoCheckoutInfo,
|
||||
getTaxInfos,
|
||||
resetCheckoutData,
|
||||
@@ -45,18 +46,37 @@ export default function CheckOutPanel() {
|
||||
const infoForCheckoutData = useSelector(
|
||||
(state) => state.checkout?.infoForCheckoutData
|
||||
);
|
||||
const cardInfo = useSelector(
|
||||
(state) => state.checkout?.checkoutData.cardInfo
|
||||
const selectedCoupons = useSelector(
|
||||
(state) => state.checkout.selectedCoupons
|
||||
);
|
||||
const taxInfosData = useSelector((state) => state.checkout?.taxInfosData);
|
||||
|
||||
const [orderSideBarOpen, setOrderSideBarOpen] = useState(false);
|
||||
const [offerSideBarOpen, setOfferSideBarOpen] = useState(false);
|
||||
const [placeOrderPopup, setPlaceOrderPopup] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
const isMounted = useRef(true);
|
||||
|
||||
const { getScrollTo: getScrollToBody, scrollTop: scrollTopBody } =
|
||||
useScrollTo();
|
||||
const spotJob = useRef(new Job((func) => func(), 1000));
|
||||
|
||||
const spotJob = useRef(new Job((func) => func(), 0));
|
||||
|
||||
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());
|
||||
@@ -77,36 +97,64 @@ export default function CheckOutPanel() {
|
||||
);
|
||||
}, [dispatch, userNumber, checkoutPanelInfo]);
|
||||
|
||||
useEffect(() => {
|
||||
if (infoForCheckoutData && productData) {
|
||||
setLoading(false);
|
||||
|
||||
const orderProductCoupontUse = Object.keys(selectedCoupons).map(
|
||||
(productId) => {
|
||||
const {
|
||||
cpnAplyMaxDcAmt,
|
||||
cpnAplyMinProdAmt,
|
||||
cpnAplyMinPurcAmt,
|
||||
cpnCdCval,
|
||||
cpnCdSeq,
|
||||
cpnDctrt,
|
||||
cpnSno,
|
||||
dcAmt,
|
||||
mbrNo,
|
||||
prdtId,
|
||||
shptmCpnTpCd,
|
||||
shptmCpnTrgtCd,
|
||||
shptmDcTpCd,
|
||||
} = selectedCoupons[productId];
|
||||
|
||||
return {
|
||||
cpnAplyMaxDcAmt,
|
||||
cpnAplyMinProdAmt,
|
||||
cpnAplyMinPurcAmt,
|
||||
cpnCdCval,
|
||||
cpnCdSeq,
|
||||
cpnDctrt,
|
||||
cpnSno,
|
||||
dcAmt,
|
||||
mbrNo,
|
||||
prdtId,
|
||||
shptmCpnTpCd,
|
||||
shptmCpnTrgtCd,
|
||||
shptmDcTpCd,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
dispatch(
|
||||
getCheckoutTotalAmtDummy({
|
||||
mbrNo: userNumber,
|
||||
dirPurcSelYn: "Y",
|
||||
bilAddrSno: infoForCheckoutData?.bilAddrSno,
|
||||
dlvrAddrSno: infoForCheckoutData?.dlvrAddrSno,
|
||||
orderProductCoupontUse,
|
||||
})
|
||||
);
|
||||
}
|
||||
}, [dispatch, infoForCheckoutData, productData, userNumber, selectedCoupons]);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
dispatch(resetCheckoutData());
|
||||
};
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
if (infoForCheckoutData && productData) {
|
||||
dispatch(
|
||||
getTaxInfos({
|
||||
mbrNo: userNumber,
|
||||
bilAddrSno: infoForCheckoutData?.bilAddrSno,
|
||||
dlvrAddrSno: infoForCheckoutData?.dlvrAddrSno,
|
||||
reqCheckoutTaxInfoItemList: [
|
||||
{
|
||||
cpnSno: null,
|
||||
dcAmt: null,
|
||||
frgtTaxCd: productData?.[0].frgtTaxCd,
|
||||
patnrId: productData?.[0].patnrId,
|
||||
prdtId: productData?.[0].prdtId,
|
||||
prodPrc: productData?.[0].price3,
|
||||
prodQty: productData?.[0].prodQty,
|
||||
taxCd: productData?.[0].taxCd,
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
}
|
||||
}, [dispatch, infoForCheckoutData, productData, userNumber]);
|
||||
|
||||
useEffect(() => {
|
||||
spotJob.current.start(() => {
|
||||
Spotlight.focus("spotlightId_placeOrderBtn");
|
||||
|
||||
Reference in New Issue
Block a user