sendMobile 로직 수정

This commit is contained in:
고동영
2024-04-19 09:52:05 +09:00
parent 844b697e39
commit ca2f707a47
10 changed files with 113 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
import { URLS } from '../api/apiConfig';
import { TAxios } from '../api/TAxios';
import { types } from './actionTypes';
import { URLS } from "../api/apiConfig";
import { TAxios } from "../api/TAxios";
import { types } from "./actionTypes";
export const addMainIndex = (index) => ({
type: types.ADD_MAIN_INDEX,
@@ -11,9 +11,21 @@ export const addMainIndex = (index) => ({
export const sendSms = (params) => (dispatch, getState) => {
console.log("#params", params);
const { mbphNo, smsTpCd, patnrId, evntId, prdtId, smsText, curationId } =
params;
const {
mbphNo,
smsTpCd,
patnrId,
evntId,
prdtId,
smsText,
curationId,
hotelId,
hotelNm,
hotelDtlUrl,
dvcIndex,
} = params;
console.log("#params", params);
const onSuccess = (response) => {
console.log("sendSms onSuccess ", response.data);
dispatch({
@@ -33,7 +45,19 @@ export const sendSms = (params) => (dispatch, getState) => {
"post",
URLS.SEND_SMS,
{},
{ mbphNo, smsTpCd, patnrId, evntId, prdtId, smsText, curationId },
{
dvcIndex,
mbphNo,
smsTpCd,
patnrId,
evntId,
prdtId,
smsText,
curationId,
hotelId,
hotelNm,
hotelDtlUrl,
},
onSuccess,
onFail
);

View File

@@ -41,6 +41,9 @@ export default function MobileSendPopUp({
evntId,
evntTpCd,
isCurationEvnt,
hotelId,
hotelNm,
hotelDtlUrl,
}) {
const deviceInfo = useSelector((state) => state.device.deviceInfo);
const [mobileNumber, setMobileNumber] = useState("");
@@ -93,18 +96,25 @@ export default function MobileSendPopUp({
);
}
if (deviceInfo && smsTpCd) {
dispatch(
sendSms({
dvcIndex: deviceInfo.dvcIndex,
mbphNo: mobileNumber,
smsTpCd,
patnrId: patnrId,
evntId,
prdtId: prdtId,
smsText,
curationId,
})
);
let params = {
dvcIndex: deviceInfo.dvcIndex,
mbphNo: mobileNumber,
smsTpCd,
patnrId,
evntId,
prdtId,
smsText,
curationId,
};
// 호텔일 경우 날려야 하는 경우
if (smsTpCd === "APP00205") {
params = { ...params, hotelId, hotelNm, hotelDtlUrl, curationId };
}
if (smsTpCd === "APP00205") {
params = { ...params, curationId };
}
dispatch(sendSms(params));
} else {
dispatch(
registerDeviceInfo({

View File

@@ -42,6 +42,7 @@ export default function ItemDetail() {
const dispatch = useDispatch();
console.log("#panels", panels);
const getPanelInfo = () => {
if (panels) {
for (let i = 0; i < panels.length; i++) {
@@ -196,7 +197,6 @@ export default function ItemDetail() {
setSelectedIndex={setSelectedIndex}
/>
)}
{/* 테마그룹상품 영역*/}
{selectedCurationId && (
<ThemeProduct

View File

@@ -49,6 +49,7 @@ export default function GroupProduct({
productInfo={productData}
thumbnailUrl={productData.imgUrls600[0]}
isFullOption
isMobile
/>
</div>
<div>

View File

@@ -39,6 +39,7 @@ export default function SingleProduct({
selectedPatnrId={selectedPatnrId}
selectedPrdtId={selectedPrdtId}
isFullOption
isMobile
/>
</div>
<div>

View File

@@ -103,6 +103,7 @@ export default function HotelOption({
Spotlight.focus("seemore_Btn");
}, [hotelInfos]);
console.log("#hotelInfo", hotelInfos[selectedIndex]);
return (
<>
<div>
@@ -188,8 +189,10 @@ export default function HotelOption({
productPrice={Price()}
curationId={selectedCurationId}
patnrId={selectedPatnrId}
hotelId={hotelInfos[selectedIndex]?.hotelId}
hotelNm={hotelInfos[selectedIndex]?.hotelNm}
hotelDtlUrl={hotelInfos[selectedIndex]?.hotelDtlUrl}
smsTpCd={"APP00205"}
//APP00204
/>
)}

View File

@@ -3,7 +3,11 @@ import React from "react";
import ProductOption from "../../components/ProductOption";
import UnableOption from "../../UnableProduct/UnableOption";
export default function ThemeUnableOption({ productInfo, productData }) {
export default function ThemeUnableOption({
productInfo,
productData,
selectedCurationId,
}) {
return (
<>
<ProductOption
@@ -15,6 +19,7 @@ export default function ThemeUnableOption({ productInfo, productData }) {
selectedPrdtId={productInfo.prdtId}
productInfo={productInfo}
patnrName={productData?.themeInfo[0]?.patncNm}
selectedCurationId={selectedCurationId}
/>
</ProductOption>
</>

View File

@@ -8,7 +8,11 @@ import ShowSingleOption from "./ShowOptions/ShowSingleOption";
import ShowUnableOption from "./ShowOptions/ShowUnableOption";
import css from "./ShowProduct.module.less";
export default function ShowOption({ selectedIndex, setSelectedIndex }) {
export default function ShowOption({
selectedIndex,
setSelectedIndex,
selectedCurationId,
}) {
const productInfo = useSelector(
(state) => state.home.themeCurationDetailInfoData
);
@@ -27,6 +31,8 @@ export default function ShowOption({ selectedIndex, setSelectedIndex }) {
};
const isSoldout = isProductSoldOut();
console.log("#selectedCurationId", selectedCurationId);
return (
<>
<div className={css.indicatorContainer}>
@@ -60,6 +66,7 @@ export default function ShowOption({ selectedIndex, setSelectedIndex }) {
setSelectedIndex={setSelectedIndex}
productInfo={productInfo[selectedIndex]}
productData={productData}
selectedCurationId={selectedCurationId}
/>
)}
</div>

View File

@@ -1,23 +1,35 @@
import React, { useCallback, useEffect } from "react";
import classNames from "classnames";
import { useSelector } from "react-redux";
import { useDispatch, useSelector } from "react-redux";
import Spotlight from "@enact/spotlight";
import { setHidePopup, setShowPopup } from "../../../actions/commonActions";
import MobileSendPopUp from "../../../components/MobileSend/MobileSendPopUp";
import TButton from "../../../components/TButton/TButton";
import TQRCode from "../../../components/TQRCode/TQRCode";
import usePriceInfo from "../../../hooks/usePriceInfo";
import * as Config from "../../../utils/Config";
import { $L } from "../../../utils/helperMethods";
import FavoriteBtn from "../components/FavoriteBtn";
import css from "./UnableOption.module.less";
export default function UnableOption({
selectedCurationId,
selectedPatnrId,
selectedPrdtId,
productInfo,
patnrName,
}) {
const dispatch = useDispatch();
const productInfos = useSelector(
(state) => state.home.themeCurationDetailInfoData
);
const { popupVisible, activePopup } = useSelector(
(state) => state.common.popup
);
const tooltipDes = $L(
` Please check for\nmore detailed information\nabout the product.`
);
@@ -58,6 +70,14 @@ export default function UnableOption({
Spotlight.focus("shopbymobile_Btn");
}, [productInfo]);
const handleSMSClick = useCallback(() => {
dispatch(setShowPopup(Config.ACTIVE_POPUP.smsPopup));
}, [popupVisible]);
const handleSMSonClose = () => {
dispatch(setHidePopup());
};
console.log("#productInfos", productInfos);
const renderPriceItem = useCallback(() => {
if (productInfo) {
if (rewd) {
@@ -156,8 +176,6 @@ export default function UnableOption({
}
}, [patnrName, productInfo]);
const handleSMSClick = useCallback(() => {});
return (
<div className={css.priceContainer}>
<div>
@@ -193,6 +211,23 @@ export default function UnableOption({
selectedPrdtId={selectedPrdtId}
/>
</div>
{/* MobileSendPopUp */}
{activePopup === Config.ACTIVE_POPUP.smsPopup && (
<MobileSendPopUp
open={popupVisible}
onClose={handleSMSonClose}
title={productInfo?.prdtNm}
productPrice={discountedPrice}
productImg={
productInfo?.thumbnailUrl
? productInfo?.thumbnailUrl
: productInfo?.imgUrls600[0]
}
patnrId={selectedPatnrId}
curationId={selectedCurationId}
smsTpCd={"APP00204"}
/>
)}
</div>
);
}

View File

@@ -29,6 +29,7 @@ export default function IndicatorOptions({
selectedPrdtId,
isDescription,
isCall,
isMobile,
}) {
const [opened, setOpened] = useState(false);
const [tabLabel, setTabLabel] = useState("");
@@ -174,7 +175,7 @@ export default function IndicatorOptions({
</>
)}
{/* MobileSendPopUp */}
{activePopup === Config.ACTIVE_POPUP.smsPopup && (
{isMobile && activePopup === Config.ACTIVE_POPUP.smsPopup && (
<MobileSendPopUp
open={popupVisible}
onClose={handleSMSonClose}