홈 화면 month api 수정

This commit is contained in:
focp212@naver.com
2025-10-20 17:54:41 +09:00
parent 948657db3f
commit 61c7e6c8f7
10 changed files with 385 additions and 119 deletions

View File

@@ -44,6 +44,7 @@ export const BoxContainer2 = () => {
let previousMonthAmount = rs.sales.previousMonthAmount; let previousMonthAmount = rs.sales.previousMonthAmount;
if(currentMonthAmount && previousMonthAmount){ if(currentMonthAmount && previousMonthAmount){
let increase = (currentMonthAmount - previousMonthAmount) / previousMonthAmount * 100; let increase = (currentMonthAmount - previousMonthAmount) / previousMonthAmount * 100;
increase = Math.round(increase * 100) / 100;
setSalesIncrease(increase); setSalesIncrease(increase);
} }
@@ -51,6 +52,7 @@ export const BoxContainer2 = () => {
let previousMonthSettlementAmount = rs.settlement.previousMonthSettlementAmount; let previousMonthSettlementAmount = rs.settlement.previousMonthSettlementAmount;
if(currentMonthSettlementAmount && previousMonthSettlementAmount){ if(currentMonthSettlementAmount && previousMonthSettlementAmount){
let increase = (currentMonthSettlementAmount - previousMonthSettlementAmount) / previousMonthSettlementAmount * 100; let increase = (currentMonthSettlementAmount - previousMonthSettlementAmount) / previousMonthSettlementAmount * 100;
increase = Math.round(increase * 100) / 100;
setSettlementIncrease(increase); setSettlementIncrease(increase);
} }
}); });
@@ -72,7 +74,7 @@ export const BoxContainer2 = () => {
}; };
useEffect(() => { useEffect(() => {
// callMonth(); callMonth();
callOverview(); callOverview();
}, []); }, []);

View File

@@ -18,7 +18,7 @@ export const allTransactionCancelInfo = (params: AllTransactionCancelInfoParams)
); );
}; };
export const useTransactioCancleInfonMutation = (options?: UseMutationOptions<AllTransactionCancelInfoResponse, CBDCAxiosError, AllTransactionCancelInfoParams>) => { export const useAllTransactioCancleInfoMutation = (options?: UseMutationOptions<AllTransactionCancelInfoResponse, CBDCAxiosError, AllTransactionCancelInfoParams>) => {
const mutation = useMutation<AllTransactionCancelInfoResponse, CBDCAxiosError, AllTransactionCancelInfoParams>({ const mutation = useMutation<AllTransactionCancelInfoResponse, CBDCAxiosError, AllTransactionCancelInfoParams>({
...options, ...options,
mutationFn: (params: AllTransactionCancelInfoParams) => allTransactionCancelInfo(params), mutationFn: (params: AllTransactionCancelInfoParams) => allTransactionCancelInfo(params),

View File

@@ -488,16 +488,54 @@ export interface AllTransactionCancelResponse {
}; };
export interface AllTransactionCancelInfoParams { export interface AllTransactionCancelInfoParams {
serviceCode: string;
tid: string; tid: string;
}; };
export interface AllTransactionCancelInfoResponse { export interface AllTransactionCancelInfoResponse {
remainAmount: number; remainAmount: number;
partCancelCl: boolean; partCancelCl: boolean;
isCompoundTax: boolean; isCompoundTax: boolean;
supplyAmount: number; supplyAmount: number | null;
goodsVatAmount: number; goodsVat: number | null;
taxFreeAmount: number; taxFreeAmount: number | null;
serviceAmount: number; serviceAmount: number | null;
debtPreventionCancelDisplayInfo: DebtPreventionCancelDisplayInfo | null;
debtPreventionCancelRequestInfo: DebtPreventionCancelRequestInfo | null;
};
export interface DebtPreventionCancelDisplayInfo {
isCancel: boolean;
serviceCode: string;
approvalDate: string;
approvalNo: string;
amount: number;
totalCancelAmount: number;
depositRequestAmount: number;
bankName: string;
accountNo: string;
accountName: string;
};
export interface DebtPreventionCancelRequestInfo {
tid: string;
mid: string;
gid: string;
aid: string;
corpNo: string;
corpName: string;
serviceCode: string;
serviceProductCode: string;
approvalDate: string;
approvalNo: string;
goodsAmount: number;
cancelRequestAmount: number;
depositRequestAmount: number;
bankName: string;
accountNo: string;
depositName: string;
hourCount: 0,
totalCancelCount: number;
autoTaxCalcCl: string;
approvalVatMark: string;
}; };
export interface FilterProps { export interface FilterProps {
filterOn: boolean; filterOn: boolean;

View File

@@ -1,58 +1,32 @@
import { IMAGE_ROOT } from '@/shared/constants/common'; import { IMAGE_ROOT } from '@/shared/constants/common';
import { AllTransactionCancelInfoResponse } from '../model/types';
import { AllTransactionCancelSectionPasswordGroup } from './section/all-transaction-cancel-section-password-group';
import { AllTransactionCancelSectionBankGroup } from './section/all-transaction-cancel-section-bank-group';
export const AllTransactionAllCancel = () => { export interface AllTransactionAllCancelProps extends AllTransactionCancelInfoResponse {
serviceCode: string;
};
export const AllTransactionAllCancel = ({
serviceCode,
remainAmount,
partCancelCl,
isCompoundTax,
supplyAmount,
goodsVat,
taxFreeAmount,
serviceAmount,
debtPreventionCancelDisplayInfo,
debtPreventionCancelRequestInfo
}: AllTransactionAllCancelProps) => {
console.log(serviceCode)
return ( return (
<> <>
<div className="form-section"> <div className="form-section">
<div className="form-group"> <AllTransactionCancelSectionPasswordGroup></AllTransactionCancelSectionPasswordGroup>
<label className="form-label"> </label> { serviceCode === '03' &&
<div className="input-wrapper wid-100 error"> <AllTransactionCancelSectionBankGroup></AllTransactionCancelSectionBankGroup>
<input }
className="wid-100 align-right"
type="password"
value="2736356352"
/>
</div>
</div>
<div className="error-msg"> </div>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<select className="wid-100 align-right">
<option></option>
<option>KB국민은행</option>
<option>22323213123</option>
</select>
</div>
</div>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<input
className="form-input wid-100"
type="text"
placeholder=""
/>
</div>
</div>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<input
className="form-input wid-100"
type="text"
placeholder=""
/>
</div>
</div>
<div className="notice-text wid-100">
<p> .<br /> .</p>
</div>
</div> </div>
</> </>
); );

View File

@@ -0,0 +1,100 @@
import { IMAGE_ROOT } from '@/shared/constants/common';
import { motion } from 'framer-motion';
export interface AllTransactionCancelPreventBondProps {
preventBondOn: boolean;
setCancelPreventBondOn: (preventBondOn: boolean) => void;
};
export const AllTransactionCancelPreventBond = ({
preventBondOn,
setCancelPreventBondOn
}: AllTransactionCancelPreventBondProps) => {
const onClickToClose = () => {
setCancelPreventBondOn(false);
};
return (
<>
<motion.div>
<div className="full-menu-container">
<div className="full-menu-header">
<div className="full-menu-title center">( )</div>
<div className="full-menu-actions">
<button
id="closeFullMenu"
className="full-menu-close"
>
<img
src={ IMAGE_ROOT + '/ico_close.svg' }
alt="닫기"
onClick={ () => onClickToClose() }
/>
</button>
</div>
</div>
<div className="option-list pt-16">
<div className="txn-divider minus"></div>
<div className="summary-section pt-30">
<div className="summary-extend">
<div> </div>
<ul className="summary-amount-list">
<li className="summary-amount-item">
<span className="label"></span>
<span className="value"></span>
</li>
<li className="summary-amount-item">
<span className="label"></span>
<span className="value"></span>
</li>
<li className="summary-amount-item">
<span className="label"></span>
<span className="value"></span>
</li>
<li className="summary-amount-item">
<span className="label"> </span>
<span className="value"></span>
</li>
<li className="summary-amount-item">
<span className="label"></span>
<span className="value"></span>
</li>
</ul>
</div>
<div className="summary-extend">
<div> </div>
<ul className="summary-amount-list">
<li className="summary-amount-item">
<span className="label"></span>
<span className="value"></span>
</li>
<li className="summary-amount-item">
<span className="label"></span>
<span className="value"></span>
</li>
<li className="summary-amount-item">
<span className="label"></span>
<span className="value"></span>
</li>
<li className="summary-amount-item">
<span className="label"> </span>
<span className="value"></span>
</li>
</ul>
</div>
<div>
<div>[] .</div>
<div> .</div>
<div> .</div>
<div> 3 .</div>
<div> </div>
<div> - - - </div>
<div> </div>
<div>service@nicepay.co.kr .( 2 )</div>
</div>
</div>
</div>
</div>
</motion.div>
</>
);
};

View File

@@ -1,11 +1,30 @@
import { IMAGE_ROOT } from '@/shared/constants/common'; import { IMAGE_ROOT } from '@/shared/constants/common';
import { AllTransactionCancelInfoResponse } from '../model/types';
import { NumericFormat } from 'react-number-format';
import { AllTransactionCancelSectionPasswordGroup } from './section/all-transaction-cancel-section-password-group';
import { AllTransactionCancelSectionBankGroup } from './section/all-transaction-cancel-section-bank-group';
export interface AllTransactionPartCancelProps extends AllTransactionCancelInfoResponse {
serviceCode: string;
};
export const AllTransactionPartCancel = () => { export const AllTransactionPartCancel = ({
serviceCode,
remainAmount,
partCancelCl,
isCompoundTax,
supplyAmount,
goodsVat,
taxFreeAmount,
serviceAmount,
debtPreventionCancelDisplayInfo,
debtPreventionCancelRequestInfo
}: AllTransactionPartCancelProps) => {
return ( return (
<> <>
{ !!isCompoundTax &&
<div className="tb_both"> <div className="tb_both">
<table className="partial-cancel-table"> <table className="partial-cancel-table">
<colgroup> <colgroup>
@@ -23,7 +42,13 @@ export const AllTransactionPartCancel = () => {
<tbody> <tbody>
<tr> <tr>
<td className="row-label"></td> <td className="row-label"></td>
<td className="row-balance">555,550,000</td> <td className="row-balance">
<NumericFormat
value={ supplyAmount }
thousandSeparator
displayType="text"
></NumericFormat>
</td>
<td className="row-cancel"> <td className="row-cancel">
<input <input
className="cancel-input" className="cancel-input"
@@ -34,7 +59,13 @@ export const AllTransactionPartCancel = () => {
</tr> </tr>
<tr> <tr>
<td className="row-label"></td> <td className="row-label"></td>
<td className="row-balance">50,000</td> <td className="row-balance">
<NumericFormat
value={ goodsVat }
thousandSeparator
displayType="text"
></NumericFormat>
</td>
<td className="row-cancel"> <td className="row-cancel">
<input <input
className="cancel-input" className="cancel-input"
@@ -45,7 +76,13 @@ export const AllTransactionPartCancel = () => {
</tr> </tr>
<tr> <tr>
<td className="row-label"></td> <td className="row-label"></td>
<td className="row-balance">50,000</td> <td className="row-balance">
<NumericFormat
value={ taxFreeAmount }
thousandSeparator
displayType="text"
></NumericFormat>
</td>
<td className="row-cancel"> <td className="row-cancel">
<input <input
className="cancel-input" className="cancel-input"
@@ -56,7 +93,13 @@ export const AllTransactionPartCancel = () => {
</tr> </tr>
<tr> <tr>
<td className="row-label"></td> <td className="row-label"></td>
<td className="row-balance">50,000</td> <td className="row-balance">
<NumericFormat
value={ serviceAmount }
thousandSeparator
displayType="text"
></NumericFormat>
</td>
<td className="row-cancel"> <td className="row-cancel">
<input <input
className="cancel-input" className="cancel-input"
@@ -68,56 +111,13 @@ export const AllTransactionPartCancel = () => {
</tbody> </tbody>
</table> </table>
</div> </div>
}
<div className="form-section"> <div className="form-section">
<div className="form-group"> <AllTransactionCancelSectionPasswordGroup></AllTransactionCancelSectionPasswordGroup>
<label className="form-label"> </label> { serviceCode === '03' &&
<div className="input-wrapper wid-100 error"> <AllTransactionCancelSectionBankGroup></AllTransactionCancelSectionBankGroup>
<input }
className="wid-100 align-right"
type="password"
value=""
/>
</div>
</div>
<div className="error-msg"> </div>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<select className="wid-100 align-right">
<option></option>
<option>KB국민은행</option>
<option>22323213123</option>
</select>
</div>
</div>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<input
className="form-input wid-100"
type="text"
placeholder=""
/>
</div>
</div>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<input
className="form-input wid-100"
type="text"
placeholder=""
/>
</div>
</div>
<div className="notice-text wid-100">
<p> .<br /> .</p>
</div>
</div> </div>
</> </>
); );

View File

@@ -0,0 +1,43 @@
export const AllTransactionCancelSectionBankGroup = () => {
return (
<>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<select className="wid-100 align-right">
<option></option>
<option>KB국민은행</option>
<option>22323213123</option>
</select>
</div>
</div>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<input
className="form-input wid-100"
type="text"
placeholder=""
/>
</div>
</div>
<div className="form-group">
<label className="form-label"></label>
<div className="input-wrapper wid-100">
<input
className="form-input wid-100"
type="text"
placeholder=""
/>
</div>
</div>
<div className="notice-text wid-100">
<p> .<br /> .</p>
</div>
</>
);
}

View File

@@ -0,0 +1,18 @@
export const AllTransactionCancelSectionPasswordGroup = () => {
return (
<>
<div className="form-group">
<label className="form-label"> </label>
<div className="input-wrapper wid-100 error">
<input
className="wid-100 align-right"
type="password"
value="2736356352"
/>
</div>
</div>
<div className="error-msg"> </div>
</>
);
}

View File

@@ -5,18 +5,26 @@ import { AllTransactionPartCancel } from '@/entities/transaction/ui/all-transact
import { useAllTransactioCancleMutation } from '@/entities/transaction/api/use-all-transaction-cancel-mutation'; import { useAllTransactioCancleMutation } from '@/entities/transaction/api/use-all-transaction-cancel-mutation';
import { HeaderType } from '@/entities/common/model/types'; import { HeaderType } from '@/entities/common/model/types';
import { import {
AllTransactionCancelInfoParams,
AllTransactionCancelInfoResponse,
AllTransactionCancelParams, AllTransactionCancelParams,
AllTransactionCancelResponse, AllTransactionCancelResponse,
CancelTabKeys CancelTabKeys,
DebtPreventionCancelDisplayInfo,
DebtPreventionCancelRequestInfo
} from '@/entities/transaction/model/types'; } from '@/entities/transaction/model/types';
import { import {
useSetHeaderTitle, useSetHeaderTitle,
useSetHeaderType, useSetHeaderType,
useSetFooterMode useSetFooterMode
} from '@/widgets/sub-layout/use-sub-layout'; } from '@/widgets/sub-layout/use-sub-layout';
import { useAllTransactioCancleInfoMutation } from '@/entities/transaction/api/use-all-transaction-cancel-info-mutation';
import { NumericFormat } from 'react-number-format';
export const AllTransactionCancelPage = () => { export const AllTransactionCancelPage = () => {
const location = useLocation(); const location = useLocation();
const tid = location.state.tid;
const serviceCode = location.state.serviceCode;
useSetHeaderTitle('거래 취소'); useSetHeaderTitle('거래 취소');
useSetHeaderType(HeaderType.RightClose); useSetHeaderType(HeaderType.RightClose);
@@ -24,8 +32,53 @@ export const AllTransactionCancelPage = () => {
// all or part // all or part
const [tabAction, setTabAction] = useState<CancelTabKeys>(CancelTabKeys.All); const [tabAction, setTabAction] = useState<CancelTabKeys>(CancelTabKeys.All);
const [remainAmount, setRemainAmount] = useState<number>(0);
const [totalCancelAmount, setTotalCancelAmount] = useState<number>(0);
const [partCancelCl, setPartCancelCl] = useState<boolean>(false);
const [isCompoundTax, setIsCompoundTax] = useState<boolean>(false);
const [supplyAmount, setSupplyAmount] = useState<number | null>(null);
const [goodsVat, setGoodsVat] = useState<number | null>(null);
const [taxFreeAmount, setTaxFreeAmount] = useState<number | null>(null);
const [serviceAmount, setServiceAmount] = useState<number | null>(null);
const [debtPreventionCancelDisplayInfo, setDebtPreventionCancelDisplayInfo] = useState<DebtPreventionCancelDisplayInfo | null>(null);
const [debtPreventionCancelRequestInfo, setDebtPreventionCancelRequestInfo] = useState<DebtPreventionCancelRequestInfo | null>(null);
const { mutateAsync: transactionCancel } = useAllTransactioCancleMutation(); const { mutateAsync: transactionCancel } = useAllTransactioCancleMutation();
const { mutateAsync: allTransactionCancelInfo } = useAllTransactioCancleInfoMutation();
const callCancelInfo = () => {
let params: AllTransactionCancelInfoParams = {
serviceCode: serviceCode,
tid: tid
};
allTransactionCancelInfo(params).then((rs: AllTransactionCancelInfoResponse) => {
setRemainAmount(rs.remainAmount);
setPartCancelCl(rs.partCancelCl);
setIsCompoundTax(rs.isCompoundTax);
setSupplyAmount(rs.supplyAmount);
setGoodsVat(rs.goodsVat);
setTaxFreeAmount(rs.taxFreeAmount);
setServiceAmount(rs.serviceAmount);
setDebtPreventionCancelDisplayInfo(rs.debtPreventionCancelDisplayInfo);
setDebtPreventionCancelRequestInfo(rs.debtPreventionCancelRequestInfo);
if(!partCancelCl){
setTotalCancelAmount(rs.remainAmount);
}
else{
setTotalCancelAmount(0);
}
// partCancelCl == true ==> 부분취소 버튼 활성화
// isCompoundTax == true ==> 부분취소의 복합과세 노출
// debtPreventionCancelDisplayInfo != null => 입금 후 취소 페이지 노출
// [취소신청]버튼 클릭시
// debtPreventionCancelDisplayInfo.isCancel == true => 취소api호출
// debtPreventionCancelRequestInfo 이 값 통쨰로 변조없이 그대로 api에 전달
// debtPreventionCancelDisplayInfo.isCancel == false => 얼럿만 띄우고 취소요청하면안됨
});
};
const callTransactionCancel = () => { const callTransactionCancel = () => {
let transactionCancelParams: AllTransactionCancelParams = { let transactionCancelParams: AllTransactionCancelParams = {
@@ -45,7 +98,7 @@ export const AllTransactionCancelPage = () => {
}); });
}; };
useEffect(() => { useEffect(() => {
callCancelInfo();
}, []); }, []);
const onClickToChangeTab = (tab: CancelTabKeys) => { const onClickToChangeTab = (tab: CancelTabKeys) => {
@@ -55,36 +108,72 @@ export const AllTransactionCancelPage = () => {
<> <>
<main> <main>
<div className="tab-content"> <div className="tab-content">
<div className="tab-pane sub active"> <div className="tab-pane pt-46 active">
<div className="option-list-nopadding"> <div className="option-list-nopadding">
<div className="subTab"> <div className="subTab">
<button <button
className={ `subtab-btn ${(tabAction === CancelTabKeys.All)? 'active': ''}` } className={ `subtab-btn ${(tabAction === CancelTabKeys.All)? 'active': ''}` }
onClick={ () => onClickToChangeTab(CancelTabKeys.All) } onClick={ () => onClickToChangeTab(CancelTabKeys.All) }
> </button> > </button>
{ !!partCancelCl &&
<button <button
className={ `subtab-btn ${(tabAction === CancelTabKeys.Part)? 'active': ''}` } className={ `subtab-btn ${(tabAction === CancelTabKeys.Part)? 'active': ''}` }
onClick={ () => onClickToChangeTab(CancelTabKeys.Part) } onClick={ () => onClickToChangeTab(CancelTabKeys.Part) }
> </button> > </button>
}
</div> </div>
<div className="cancel-list"> <div className="cancel-list pt-30">
<div className="amount-info"> <div className="amount-info">
<ul className="amount-list"> <ul className="amount-list">
<li className="amount-item"> <li className="amount-item">
<span className="label">·&nbsp;&nbsp; </span> <span className="label">·&nbsp;&nbsp; </span>
<span className="value">500,000,000</span> <span className="value">
<NumericFormat
value={ remainAmount }
thousandSeparator
displayType="text"
></NumericFormat>
</span>
</li> </li>
<li className="amount-item"> <li className="amount-item">
<span className="label">·&nbsp;&nbsp; </span> <span className="label">·&nbsp;&nbsp; </span>
<span className="value">500,000,000</span> <span className="value">
<NumericFormat
value={ totalCancelAmount }
thousandSeparator
displayType="text"
></NumericFormat>
</span>
</li> </li>
</ul> </ul>
</div> </div>
{ (tabAction === CancelTabKeys.All) && { (tabAction === CancelTabKeys.All) &&
<AllTransactionAllCancel></AllTransactionAllCancel> <AllTransactionAllCancel
serviceCode={ serviceCode }
remainAmount={ remainAmount }
partCancelCl={ partCancelCl }
isCompoundTax={ isCompoundTax }
supplyAmount={ supplyAmount }
goodsVat={ goodsVat }
taxFreeAmount={ taxFreeAmount }
serviceAmount={ serviceAmount }
debtPreventionCancelDisplayInfo={ debtPreventionCancelDisplayInfo }
debtPreventionCancelRequestInfo={ debtPreventionCancelRequestInfo }
></AllTransactionAllCancel>
} }
{ (tabAction === CancelTabKeys.Part) && { partCancelCl && (tabAction === CancelTabKeys.Part) &&
<AllTransactionPartCancel></AllTransactionPartCancel> <AllTransactionPartCancel
serviceCode={ serviceCode }
remainAmount={ remainAmount }
partCancelCl={ partCancelCl }
isCompoundTax={ isCompoundTax }
supplyAmount={ supplyAmount }
goodsVat={ goodsVat }
taxFreeAmount={ taxFreeAmount }
serviceAmount={ serviceAmount }
debtPreventionCancelDisplayInfo={ debtPreventionCancelDisplayInfo }
debtPreventionCancelRequestInfo={ debtPreventionCancelRequestInfo }
></AllTransactionPartCancel>
} }
</div> </div>
</div> </div>

View File

@@ -81,6 +81,7 @@ export const AllTransactionDetailPage = () => {
clearTimeout(timeout); clearTimeout(timeout);
navigate(PATHS.transaction.allTransaction.cancel, { navigate(PATHS.transaction.allTransaction.cancel, {
state: { state: {
serviceCode: serviceCode,
tid: tid tid: tid
} }
}); });
@@ -101,6 +102,7 @@ export const AllTransactionDetailPage = () => {
open={ isOpen } open={ isOpen }
onClose={ close } onClose={ close }
onConfirmClick={ () => onClickToNavigate(PATHS.transaction.allTransaction.cancel) } onConfirmClick={ () => onClickToNavigate(PATHS.transaction.allTransaction.cancel) }
// onConfirmClick={ () => callCancelInfo() }
message={ msg } message={ msg }
buttonLabel={['취소', '확인']} buttonLabel={['취소', '확인']}
/> />