가맹점관리
This commit is contained in:
@@ -16,6 +16,4 @@ export interface MenuCategoryProps {
|
|||||||
setMenuOn?: (menuOn: boolean) => void;
|
setMenuOn?: (menuOn: boolean) => void;
|
||||||
editMode?: boolean;
|
editMode?: boolean;
|
||||||
setChangeMenuId: (menuId?: string) => void;
|
setChangeMenuId: (menuId?: string) => void;
|
||||||
buttonRef: any
|
|
||||||
btnRef?: any;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ export const MenuCategory = ({
|
|||||||
subMenu,
|
subMenu,
|
||||||
setMenuOn,
|
setMenuOn,
|
||||||
editMode,
|
editMode,
|
||||||
setChangeMenuId,
|
setChangeMenuId
|
||||||
buttonRef,btnRef
|
|
||||||
}: MenuCategoryProps) => {
|
}: MenuCategoryProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ export const MenuCategory = ({
|
|||||||
...userFavorite,
|
...userFavorite,
|
||||||
{
|
{
|
||||||
title: title,
|
title: title,
|
||||||
img: IMAGE_ROOT + '/ico_menu_0'+randomNum+'.svg',
|
img: `${IMAGE_ROOT}/ico_menu_0${randomNum}.svg`,
|
||||||
path: path,
|
path: path,
|
||||||
menuId: menuId
|
menuId: menuId
|
||||||
}
|
}
|
||||||
@@ -106,7 +105,6 @@ export const MenuCategory = ({
|
|||||||
<li
|
<li
|
||||||
key={ `menu-item-key-${i}` }
|
key={ `menu-item-key-${i}` }
|
||||||
onClick={ () => onClickToNavigate(subMenu[i]?.path) }
|
onClick={ () => onClickToNavigate(subMenu[i]?.path) }
|
||||||
|
|
||||||
>{ subMenu[i]?.menuName }</li>
|
>{ subMenu[i]?.menuName }</li>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -119,13 +117,8 @@ export const MenuCategory = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div className={`menu-category`}>
|
||||||
className={`menu-category ${btnRef? 'ok': 'no'}`}
|
<div className="category-header">
|
||||||
|
|
||||||
>
|
|
||||||
<div className="category-header"
|
|
||||||
ref={ btnRef || null }
|
|
||||||
>
|
|
||||||
<div className={ 'category-icon ' + menuIcon }></div>
|
<div className={ 'category-icon ' + menuIcon }></div>
|
||||||
<span>{ menuName }</span>
|
<span>{ menuName }</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export enum InfoWrapKeys {
|
|||||||
Escrow = 'Escrow'
|
Escrow = 'Escrow'
|
||||||
};
|
};
|
||||||
export interface MerchantMidParams {
|
export interface MerchantMidParams {
|
||||||
mid: string;
|
mid?: string;
|
||||||
};
|
};
|
||||||
export interface MerchantMidResponse {
|
export interface MerchantMidResponse {
|
||||||
memberCompanyId?: string;
|
memberCompanyId?: string;
|
||||||
@@ -82,7 +82,7 @@ export interface MerchantMidResponse {
|
|||||||
accountHolderName?: string;
|
accountHolderName?: string;
|
||||||
};
|
};
|
||||||
export interface MerchantMidStatusParams {
|
export interface MerchantMidStatusParams {
|
||||||
mid: string;
|
mid?: string;
|
||||||
};
|
};
|
||||||
export interface MerchantMidStatusResponse {
|
export interface MerchantMidStatusResponse {
|
||||||
onlineInfomation: OnlineInfomation;
|
onlineInfomation: OnlineInfomation;
|
||||||
|
|||||||
@@ -8,35 +8,51 @@ import {
|
|||||||
MerchantMidParams,
|
MerchantMidParams,
|
||||||
MerchantMidResponse
|
MerchantMidResponse
|
||||||
} from '../model/types';
|
} from '../model/types';
|
||||||
|
import { useStore } from '@/shared/model/store';
|
||||||
|
|
||||||
export const InfoWrap = () => {
|
export const InfoWrap = () => {
|
||||||
|
const userMids = useStore.getState().UserStore.userMids;
|
||||||
|
const midOptions = useStore.getState().UserStore.selectOptionsMids;
|
||||||
|
|
||||||
const [mid, setMid] = useState<string>('nictest00m');
|
const [mid, setMid] = useState<string | undefined>(userMids[0]);
|
||||||
const [data, setData] = useState<MerchantMidResponse>();
|
const [data, setData] = useState<MerchantMidResponse>();
|
||||||
|
|
||||||
const [openChild, setOpenChild] = useState<InfoWrapKeys | null>(null);
|
const [openChild, setOpenChild] = useState<InfoWrapKeys | null>(null);
|
||||||
|
|
||||||
const { mutateAsync: merchantMid } = useMerchantMidMutation();
|
const { mutateAsync: merchantMid } = useMerchantMidMutation();
|
||||||
|
|
||||||
const callInfo = () => {
|
const callInfo = (selectedMid?: string) => {
|
||||||
let params: MerchantMidParams = {
|
let params: MerchantMidParams = {
|
||||||
mid: mid,
|
mid: selectedMid || mid
|
||||||
};
|
};
|
||||||
merchantMid(params).then((rs: MerchantMidResponse) => {
|
merchantMid(params).then((rs: MerchantMidResponse) => {
|
||||||
setData(rs);
|
setData(rs);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onChangeMid = (value: string) => {
|
||||||
|
setMid(value);
|
||||||
|
callInfo(value);
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// callInfo();
|
callInfo();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="input-wrapper top-select mt-30">
|
<div className="input-wrapper top-select mt-30">
|
||||||
<select>
|
<select
|
||||||
<option value="1">nicetest00g</option>
|
onChange={ (e) => onChangeMid(e.target.value) }
|
||||||
<option value="2">nicetest00g</option>
|
>
|
||||||
<option value="3">nicetest00g</option>
|
{
|
||||||
|
midOptions.map((value, index) => (
|
||||||
|
<option
|
||||||
|
key={ value.value }
|
||||||
|
value={ value.value }
|
||||||
|
>{ value.name }</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ import {
|
|||||||
import { OnlineInfoWrap } from './info-wrap/online-info-wrap';
|
import { OnlineInfoWrap } from './info-wrap/online-info-wrap';
|
||||||
import { CardInfoWrap } from './info-wrap/card-info-wrap';
|
import { CardInfoWrap } from './info-wrap/card-info-wrap';
|
||||||
import { EscrowInfoWrap } from './info-wrap/escrow-info-wrap';
|
import { EscrowInfoWrap } from './info-wrap/escrow-info-wrap';
|
||||||
|
import { useStore } from '@/shared/model/store';
|
||||||
|
|
||||||
export const RegistrationStatusWrap = () => {
|
export const RegistrationStatusWrap = () => {
|
||||||
|
const userMids = useStore.getState().UserStore.userMids;
|
||||||
|
const midOptions = useStore.getState().UserStore.selectOptionsMids;
|
||||||
|
|
||||||
const [mid, setMid] = useState<string>('nictest00m');
|
const [mid, setMid] = useState<string | undefined>(userMids[0]);
|
||||||
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>>();
|
||||||
@@ -24,9 +27,9 @@ export const RegistrationStatusWrap = () => {
|
|||||||
const [openChild, setOpenChild] = useState<InfoWrapKeys | null>(null);
|
const [openChild, setOpenChild] = useState<InfoWrapKeys | null>(null);
|
||||||
const { mutateAsync: merchantMidStatus } = useMerchantMidStatusMutation();
|
const { mutateAsync: merchantMidStatus } = useMerchantMidStatusMutation();
|
||||||
|
|
||||||
const callInfo = () => {
|
const callInfo = (selectedMid?: string) => {
|
||||||
let params: MerchantMidStatusParams = {
|
let params: MerchantMidStatusParams = {
|
||||||
mid: mid
|
mid: selectedMid || mid
|
||||||
};
|
};
|
||||||
merchantMidStatus(params).then((rs: MerchantMidStatusResponse) => {
|
merchantMidStatus(params).then((rs: MerchantMidStatusResponse) => {
|
||||||
setOnlineInfomation(rs.onlineInfomation);
|
setOnlineInfomation(rs.onlineInfomation);
|
||||||
@@ -36,17 +39,29 @@ export const RegistrationStatusWrap = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onChangeMid = (value: string) => {
|
||||||
|
setMid(value);
|
||||||
|
callInfo(value);
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// callInfo();
|
callInfo();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="input-wrapper top-select mt-30">
|
<div className="input-wrapper top-select mt-30">
|
||||||
<select>
|
<select
|
||||||
<option value="1">nicetest00g</option>
|
onChange={ (e) => onChangeMid(e.target.value) }
|
||||||
<option value="2">nicetest00g</option>
|
>
|
||||||
<option value="3">nicetest00g</option>
|
{
|
||||||
|
midOptions.map((value, index) => (
|
||||||
|
<option
|
||||||
|
key={ value.value }
|
||||||
|
value={ value.value }
|
||||||
|
>{ value.name }</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="merchant-info">
|
<div className="merchant-info">
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const Menu = ({
|
|||||||
const [changeMenuId, setChangeMenuId] = useState<string | undefined>();
|
const [changeMenuId, setChangeMenuId] = useState<string | undefined>();
|
||||||
|
|
||||||
const buttonRefs = useRef<Array<HTMLDivElement>>([]);
|
const buttonRefs = useRef<Array<HTMLDivElement>>([]);
|
||||||
const btnRef = useRef<HTMLDivElement>(null);
|
const scrollRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const onClickToNavigate = (path: string) => {
|
const onClickToNavigate = (path: string) => {
|
||||||
onClickToMenuClose();
|
onClickToMenuClose();
|
||||||
@@ -42,21 +42,6 @@ export const Menu = ({
|
|||||||
behavior: 'smooth'
|
behavior: 'smooth'
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
if(index === 1){
|
|
||||||
/*
|
|
||||||
btnRef.current?.scrollTo({
|
|
||||||
top: 300,
|
|
||||||
behavior: "smooth"
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
btnRef.current?.scrollIntoView({
|
|
||||||
block: 'start',
|
|
||||||
behavior: 'smooth'
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
const onClickToMenuClose = () => {
|
const onClickToMenuClose = () => {
|
||||||
if(editMode){
|
if(editMode){
|
||||||
@@ -70,8 +55,7 @@ export const Menu = ({
|
|||||||
const getMenuCategory = () => {
|
const getMenuCategory = () => {
|
||||||
let rs = [];
|
let rs = [];
|
||||||
for(let i=0;i<MenuItems.length;i++){
|
for(let i=0;i<MenuItems.length;i++){
|
||||||
if(i===1){
|
rs.push(
|
||||||
rs.push(
|
|
||||||
<MenuCategory
|
<MenuCategory
|
||||||
key={ `menu-category-${i}` }
|
key={ `menu-category-${i}` }
|
||||||
menuId={ MenuItems[i]?.menuId }
|
menuId={ MenuItems[i]?.menuId }
|
||||||
@@ -81,28 +65,8 @@ export const Menu = ({
|
|||||||
setMenuOn={ setMenuOn }
|
setMenuOn={ setMenuOn }
|
||||||
editMode={ editMode }
|
editMode={ editMode }
|
||||||
setChangeMenuId= { setChangeMenuId }
|
setChangeMenuId= { setChangeMenuId }
|
||||||
buttonRef={ buttonRefs.current[i] }
|
|
||||||
btnRef={ btnRef }
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
else{
|
|
||||||
rs.push(
|
|
||||||
<MenuCategory
|
|
||||||
key={ `menu-category-${i}` }
|
|
||||||
menuId={ MenuItems[i]?.menuId }
|
|
||||||
menuIcon={ MenuItems[i]?.menuIcon }
|
|
||||||
menuName={ MenuItems[i]?.menuName }
|
|
||||||
subMenu={ MenuItems[i]?.subMenu }
|
|
||||||
setMenuOn={ setMenuOn }
|
|
||||||
editMode={ editMode }
|
|
||||||
setChangeMenuId= { setChangeMenuId }
|
|
||||||
buttonRef={ buttonRefs.current[i] }
|
|
||||||
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
@@ -121,12 +85,7 @@ export const Menu = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
shortBtnsSetting();
|
shortBtnsSetting();
|
||||||
const handleScroll = (e: Event) => {
|
|
||||||
// console.log(e, window.scrollY);
|
|
||||||
};
|
|
||||||
window.addEventListener('scroll', handleScroll);
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -194,7 +153,10 @@ export const Menu = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="full-menu-list">
|
<div
|
||||||
|
className="full-menu-list"
|
||||||
|
ref={ scrollRef }
|
||||||
|
>
|
||||||
{ getMenuCategory() }
|
{ getMenuCategory() }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user