통합거래내역 거래 취소
This commit is contained in:
@@ -20,9 +20,11 @@ import {
|
||||
} 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';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
|
||||
export const AllTransactionCancelPage = () => {
|
||||
const location = useLocation();
|
||||
const userInfo = useStore.getState().UserStore.userInfo;
|
||||
const tid = location.state.tid;
|
||||
const serviceCode = location.state.serviceCode;
|
||||
|
||||
@@ -32,16 +34,26 @@ export const AllTransactionCancelPage = () => {
|
||||
|
||||
// all or part
|
||||
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 [debtPreventionCancelDisplayInfo, setDebtPreventionCancelDisplayInfo] = useState<DebtPreventionCancelDisplayInfo | null | undefined>(null);
|
||||
const [debtPreventionCancelRequestInfo, setDebtPreventionCancelRequestInfo] = useState<DebtPreventionCancelRequestInfo | null | undefined>(null);
|
||||
const [goodsVat, setGoodsVat] = useState<number | null>(null);
|
||||
const [taxFreeAmount, setTaxFreeAmount] = useState<number | null>(null);
|
||||
const [isCompoundTax, setIsCompoundTax] = useState<boolean>(false);
|
||||
const [isConditionalVatAutoCalcMerchant, setIsConditionalVatAutoCalcMerchant] = useState<boolean>(false);
|
||||
const [isNpg, setIsNpg] = useState<boolean>(false);
|
||||
const [isVatAutoCalcMerchant, setIsVatAutoCalcMerchant] = useState<boolean>(false);
|
||||
const [isVatDisplayed, setIsVatDisplayed] = useState<boolean>(false);
|
||||
const [partCancelCl, setPartCancelCl] = useState<boolean>(false);
|
||||
const [remainAmount, setRemainAmount] = useState<number>(0);
|
||||
const [serviceAmount, setServiceAmount] = useState<number | null>(null);
|
||||
const [debtPreventionCancelDisplayInfo, setDebtPreventionCancelDisplayInfo] = useState<DebtPreventionCancelDisplayInfo | null>(null);
|
||||
const [debtPreventionCancelRequestInfo, setDebtPreventionCancelRequestInfo] = useState<DebtPreventionCancelRequestInfo | null>(null);
|
||||
const [supplyAmount, setSupplyAmount] = useState<number | null>(null);
|
||||
const [taxFreeAmount, setTaxFreeAmount] = useState<number | null>(null);
|
||||
const [vatAutoCalcSummary, setVatAutoCalcSummary] = useState<number>(0);
|
||||
const [totalCancelAmount, setTotalCancelAmount] = useState<number>(0);
|
||||
const [cancelPassword, setCancelPassword] = useState<string>('');
|
||||
|
||||
const [bankCode, setBankCode] = useState<string>('');
|
||||
const [accountNo, setAccountNo] = useState<string>('');
|
||||
const [accountHolder, setAccountHolder] = useState<string>('');
|
||||
|
||||
const { mutateAsync: transactionCancel } = useAllTransactioCancleMutation();
|
||||
const { mutateAsync: allTransactionCancelInfo } = useAllTransactioCancleInfoMutation();
|
||||
@@ -52,16 +64,21 @@ export const AllTransactionCancelPage = () => {
|
||||
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);
|
||||
|
||||
setGoodsVat(rs.goodsVat);
|
||||
setIsCompoundTax(rs.isCompoundTax);
|
||||
setIsConditionalVatAutoCalcMerchant(rs.isConditionalVatAutoCalcMerchant);
|
||||
setIsNpg(rs.isNpg);
|
||||
setIsVatAutoCalcMerchant(rs.isVatAutoCalcMerchant);
|
||||
setIsVatDisplayed(rs.isVatDisplayed);
|
||||
setPartCancelCl(rs.partCancelCl);
|
||||
setRemainAmount(rs.remainAmount);
|
||||
setServiceAmount(rs.serviceAmount);
|
||||
setSupplyAmount(rs.supplyAmount);
|
||||
setTaxFreeAmount(rs.taxFreeAmount);
|
||||
setVatAutoCalcSummary(rs.vatAutoCalcSummary);
|
||||
|
||||
if(!partCancelCl){
|
||||
setTotalCancelAmount(rs.remainAmount);
|
||||
}
|
||||
@@ -82,16 +99,20 @@ export const AllTransactionCancelPage = () => {
|
||||
|
||||
const callTransactionCancel = () => {
|
||||
let transactionCancelParams: AllTransactionCancelParams = {
|
||||
tid: location?.state.tid,
|
||||
cancelAmount: 0,
|
||||
cancelPassword: "string",
|
||||
bankCode: "string",
|
||||
accountNo: "string",
|
||||
accountHolder: "string",
|
||||
supplyAmount: 0,
|
||||
goodsVatAmount: 0,
|
||||
taxFreeAmount: 0,
|
||||
serviceAmount: 0
|
||||
tid: tid,
|
||||
cancelAmount: totalCancelAmount,
|
||||
cancelPassword: cancelPassword,
|
||||
bankCode: bankCode,
|
||||
accountNo: accountNo,
|
||||
accountHolder: accountHolder,
|
||||
supplyAmount: supplyAmount,
|
||||
goodsVatAmount: goodsVat,
|
||||
taxFreeAmount: taxFreeAmount,
|
||||
serviceAmount: serviceAmount,
|
||||
clientIp: userInfo.clientAddressIP,
|
||||
partCancelCl: partCancelCl,
|
||||
isNpg: isNpg,
|
||||
serviceCode: serviceCode
|
||||
};
|
||||
transactionCancel(transactionCancelParams).then((rs: AllTransactionCancelResponse) => {
|
||||
console.log(rs);
|
||||
@@ -150,29 +171,55 @@ export const AllTransactionCancelPage = () => {
|
||||
{ (tabAction === CancelTabKeys.All) &&
|
||||
<AllTransactionAllCancel
|
||||
serviceCode={ serviceCode }
|
||||
remainAmount={ remainAmount }
|
||||
partCancelCl={ partCancelCl }
|
||||
isCompoundTax={ isCompoundTax }
|
||||
supplyAmount={ supplyAmount }
|
||||
goodsVat={ goodsVat }
|
||||
taxFreeAmount={ taxFreeAmount }
|
||||
serviceAmount={ serviceAmount }
|
||||
debtPreventionCancelDisplayInfo={ debtPreventionCancelDisplayInfo }
|
||||
debtPreventionCancelRequestInfo={ debtPreventionCancelRequestInfo }
|
||||
goodsVat={ goodsVat }
|
||||
isCompoundTax={ isCompoundTax }
|
||||
isConditionalVatAutoCalcMerchant={ isConditionalVatAutoCalcMerchant }
|
||||
isNpg={ isNpg }
|
||||
isVatAutoCalcMerchant={ isVatAutoCalcMerchant }
|
||||
isVatDisplayed={ isVatDisplayed }
|
||||
partCancelCl={ partCancelCl }
|
||||
remainAmount={ remainAmount }
|
||||
serviceAmount={ serviceAmount }
|
||||
supplyAmount={ supplyAmount }
|
||||
taxFreeAmount={ taxFreeAmount }
|
||||
vatAutoCalcSummary={ vatAutoCalcSummary }
|
||||
cancelPassword={ cancelPassword }
|
||||
setCancelPassword={ setCancelPassword }
|
||||
bankCode={ bankCode }
|
||||
setBankCode={ setBankCode }
|
||||
accountNo={ accountNo }
|
||||
setAccountNo={ setAccountNo }
|
||||
accountHolder={ accountHolder }
|
||||
setAccountHolder={ setAccountHolder }
|
||||
></AllTransactionAllCancel>
|
||||
}
|
||||
{ partCancelCl && (tabAction === CancelTabKeys.Part) &&
|
||||
<AllTransactionPartCancel
|
||||
serviceCode={ serviceCode }
|
||||
remainAmount={ remainAmount }
|
||||
partCancelCl={ partCancelCl }
|
||||
isCompoundTax={ isCompoundTax }
|
||||
supplyAmount={ supplyAmount }
|
||||
goodsVat={ goodsVat }
|
||||
taxFreeAmount={ taxFreeAmount }
|
||||
serviceAmount={ serviceAmount }
|
||||
debtPreventionCancelDisplayInfo={ debtPreventionCancelDisplayInfo }
|
||||
debtPreventionCancelRequestInfo={ debtPreventionCancelRequestInfo }
|
||||
goodsVat={ goodsVat }
|
||||
isCompoundTax={ isCompoundTax }
|
||||
isConditionalVatAutoCalcMerchant={ isConditionalVatAutoCalcMerchant }
|
||||
isNpg={ isNpg }
|
||||
isVatAutoCalcMerchant={ isVatAutoCalcMerchant }
|
||||
isVatDisplayed={ isVatDisplayed }
|
||||
partCancelCl={ partCancelCl }
|
||||
remainAmount={ remainAmount }
|
||||
serviceAmount={ serviceAmount }
|
||||
supplyAmount={ supplyAmount }
|
||||
taxFreeAmount={ taxFreeAmount }
|
||||
vatAutoCalcSummary={ vatAutoCalcSummary }
|
||||
cancelPassword={ cancelPassword }
|
||||
setCancelPassword={ setCancelPassword }
|
||||
bankCode={ bankCode }
|
||||
setBankCode={ setBankCode }
|
||||
accountNo={ accountNo }
|
||||
setAccountNo={ setAccountNo }
|
||||
accountHolder={ accountHolder }
|
||||
setAccountHolder={ setAccountHolder }
|
||||
></AllTransactionPartCancel>
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user