mid 변경

This commit is contained in:
focp212@naver.com
2025-10-30 10:57:52 +09:00
parent e4e73dec72
commit 506f6c0acf
7 changed files with 56 additions and 14 deletions

View File

@@ -77,6 +77,7 @@ export interface HeaderNavigationProps {
setMenuOn: (menuOn: boolean) => void; setMenuOn: (menuOn: boolean) => void;
favoriteEdit?: boolean; favoriteEdit?: boolean;
loginSuccess: boolean; loginSuccess: boolean;
mid?: string;
setMid: (mid: string) => void; setMid: (mid: string) => void;
}; };

View File

@@ -15,8 +15,11 @@ export const InfoWrap = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids; const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const userMid = useStore.getState().UserStore.mid; const userMid = useStore.getState().UserStore.mid;
let midItem = midOptionsWithoutGids.filter((value, index) => {
return value.value === userMid;
});
const [mid, setMid] = useState<string>(userMid); const [mid, setMid] = useState<string>((midItem.length > 0)? userMid: '');
const [data, setData] = useState<MerchantMidResponse>(); const [data, setData] = useState<MerchantMidResponse>();
const [openChild, setOpenChild] = useState<SectionKeys | null>(null); const [openChild, setOpenChild] = useState<SectionKeys | null>(null);

View File

@@ -17,10 +17,13 @@ import { useStore } from '@/shared/model/store';
export const RegistrationStatusWrap = () => { export const RegistrationStatusWrap = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids; const midOptions = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const userMid = useStore.getState().UserStore.mid; const userMid = useStore.getState().UserStore.mid;
let midItem = midOptions.filter((value, index) => {
return value.value === userMid;
});
const [mid, setMid] = useState<string>(userMid); const [mid, setMid] = useState<string>((midItem.length > 0)? userMid: '');
const [onlineInfomation, setOnlineInfomation] = useState<OnlineInfomation>(); const [onlineInfomation, setOnlineInfomation] = useState<OnlineInfomation>();
const [offlineInfomation, setOfflineInfomation] = useState<OfflineInfomation>(); const [offlineInfomation, setOfflineInfomation] = useState<OfflineInfomation>();
const [cardApplications, setCardApplications] = useState<Array<CardApplications>>(); const [cardApplications, setCardApplications] = useState<Array<CardApplications>>();
@@ -55,7 +58,7 @@ export const RegistrationStatusWrap = () => {
onChange={ (e: ChangeEvent<HTMLSelectElement>) => setMid(e.target.value) } onChange={ (e: ChangeEvent<HTMLSelectElement>) => setMid(e.target.value) }
> >
{ {
midOptionsWithoutGids.map((value, index) => ( midOptions.map((value, index) => (
<option <option
key={ value.value } key={ value.value }
value={ value.value } value={ value.value }

View File

@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'; import { ChangeEvent, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { IMAGE_ROOT } from '@/shared/constants/common'; import { IMAGE_ROOT } from '@/shared/constants/common';
import { InfoItem } from './info-item'; import { InfoItem } from './info-item';
@@ -32,11 +32,17 @@ import {
import { usePaymentCardMutation } from '../api/use-payment-card-mutation'; import { usePaymentCardMutation } from '../api/use-payment-card-mutation';
import { usePaymentNonCardMutation } from '../api/use-payment-non-card-mutation'; import { usePaymentNonCardMutation } from '../api/use-payment-non-card-mutation';
import { usePaymentInstallmentMutation } from '../api/use-payment-installment-mutation'; import { usePaymentInstallmentMutation } from '../api/use-payment-installment-mutation';
import { useStore } from '@/shared/model/store';
export const InfoWrap = () => { export const InfoWrap = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const midOptions = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const userMid = useStore.getState().UserStore.mid;
let midItem = midOptions.filter((value, index) => {
return value.value === userMid;
});
const [mid, setMid] = useState<string>('nictest00g'); const [mid, setMid] = useState<string>((midItem.length > 0)? userMid: '');
const [noInterestInfoBottomSheetOn, setNoInterestInfoBottomSheetOn] = useState<boolean>(false); const [noInterestInfoBottomSheetOn, setNoInterestInfoBottomSheetOn] = useState<boolean>(false);
const [cardCommissionBottomSheetOn, setCardCommissionBottomSheetOn] = useState<boolean>(false); const [cardCommissionBottomSheetOn, setCardCommissionBottomSheetOn] = useState<boolean>(false);
@@ -203,16 +209,34 @@ export const InfoWrap = () => {
callPaymentIntallmentDetail(cardCompany); callPaymentIntallmentDetail(cardCompany);
}; };
useEffect(() => { useEffect(() => {
callPaymentCard(); if(mid){
callPaymentNonCard(); callPaymentCard();
callPaymentIntallment(); callPaymentNonCard();
callPaymentIntallment();
callPaymentIntallmentDetail(cardCompany); callPaymentIntallmentDetail(cardCompany);
}
}, []); }, [mid]);
return ( return (
<> <>
<div
className="input-wrapper top-select mt-30"
style={{ paddingBottom: 0}}
>
<select
value={ mid }
onChange={ (e: ChangeEvent<HTMLSelectElement>) => setMid(e.target.value) }
>
{
midOptions.map((value, index) => (
<option
key={ value.value }
value={ value.value }
>{ value.name }</option>
))
}
</select>
</div>
<div className="ing-list"> <div className="ing-list">
<div className="ing-title">{t('payment.serviceUsageCommissionAndSettlement')}</div> <div className="ing-title">{t('payment.serviceUsageCommissionAndSettlement')}</div>
<ul className="ing-card-list"> <ul className="ing-card-list">

View File

@@ -15,7 +15,15 @@ export const FilterSelectMid = ({
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids; const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
const userMid = useStore.getState().UserStore.mid; const userMid = useStore.getState().UserStore.mid;
const [filterMid, setFilterMid] = useState<string>(userMid); let options = midOptions;
if(showType === 'MID'){
options = midOptionsWithoutGids;
}
let midItem = options.filter((value, index) => {
return value.value === userMid;
});
const [filterMid, setFilterMid] = useState<string>((midItem.length > 0)? userMid: '');
const getSelectMidOptions = () => { const getSelectMidOptions = () => {
let rs = []; let rs = [];

View File

@@ -20,6 +20,7 @@ export const HeaderNavigation = ({
setMenuOn, setMenuOn,
favoriteEdit, favoriteEdit,
loginSuccess, loginSuccess,
mid,
setMid setMid
}: HeaderNavigationProps) => { }: HeaderNavigationProps) => {
const { mutateAsync: appAlarmUnreadCount } = useAppAlarmUnreadCountMutation(); const { mutateAsync: appAlarmUnreadCount } = useAppAlarmUnreadCountMutation();
@@ -111,6 +112,7 @@ export const HeaderNavigation = ({
<select <select
className="heading-select" className="heading-select"
onChange={ onChangeToMid } onChange={ onChangeToMid }
value={ mid }
> >
{ selectOptions && selectOptions.length > 0 && { selectOptions && selectOptions.length > 0 &&
selectOptions.map((value, index) => ( selectOptions.map((value, index) => (

View File

@@ -361,6 +361,7 @@ export const SubLayout = () => {
favoriteEdit={ favoriteEdit } favoriteEdit={ favoriteEdit }
key={ headerNavigationKey } key={ headerNavigationKey }
loginSuccess={ loginSuccess } loginSuccess={ loginSuccess }
mid={ mid }
setMid={ setMid } setMid={ setMid }
/> />
{ loginSuccess && { loginSuccess &&