diff --git a/projects/app/src/pages/account/components/bill/ApplyInvoiceModal.tsx b/projects/app/src/pages/account/components/bill/ApplyInvoiceModal.tsx index 2d313e39fb..d820bf1792 100644 --- a/projects/app/src/pages/account/components/bill/ApplyInvoiceModal.tsx +++ b/projects/app/src/pages/account/components/bill/ApplyInvoiceModal.tsx @@ -31,6 +31,7 @@ import { InvoiceHeaderSingleForm } from './InvoiceHeaderForm'; import MyBox from '@fastgpt/web/components/common/MyBox'; import { getTeamInvoiceHeader } from '@/web/support/user/team/api'; import { useToast } from '@fastgpt/web/hooks/useToast'; +import { useRouter } from 'next/router'; type chosenBillDataType = { _id: string; price: number; @@ -50,6 +51,8 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => { needSpecialInvoice: undefined, emailAddress: '' }); + + const router = useRouter(); const { isOpen: isOpenSettleModal, onOpen: onOpenSettleModal, @@ -94,7 +97,10 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => { manual: true, successToast: t('common:common.submit_success'), errorToast: t('common:common.Submit failed'), - onSuccess: () => onClose() + onSuccess: () => { + onClose(); + router.reload(); + } } ); diff --git a/projects/app/src/pages/account/components/bill/BillAndInvoice.tsx b/projects/app/src/pages/account/components/bill/BillAndInvoice.tsx index 7f0c2d58c3..5b04ce9d27 100644 --- a/projects/app/src/pages/account/components/bill/BillAndInvoice.tsx +++ b/projects/app/src/pages/account/components/bill/BillAndInvoice.tsx @@ -4,19 +4,20 @@ import dynamic from 'next/dynamic'; import { useState } from 'react'; import { useTranslation } from 'next-i18next'; import ApplyInvoiceModal from './ApplyInvoiceModal'; +import { useRouter } from 'next/router'; -const TabEnum = { +export const InvoiceTabEnum = { bill: 'bill', invoice: 'invoice', - invoiceHeader: 'voiceHeader' + invoiceHeader: 'invoiceHeader' }; const BillTable = dynamic(() => import('./BillTable')); const InvoiceHeaderForm = dynamic(() => import('./InvoiceHeaderForm')); const InvoiceTable = dynamic(() => import('./InvoiceTable')); const BillAndInvoice = () => { - const [currentTab, setCurrentTab] = useState(TabEnum.bill); const [isOpenInvoiceModal, setIsOpenInvoiceModal] = useState(false); - + const router = useRouter(); + const invoiceTab = (router.query.invoiceTab as string) || InvoiceTabEnum.bill; const { t } = useTranslation(); return ( <> @@ -24,17 +25,24 @@ const BillAndInvoice = () => { { + router.replace({ + query: { + currentTab: router.query.currentTab, + invoiceTab: e + } + }); + }} > - {currentTab !== TabEnum.invoiceHeader && ( + {invoiceTab !== InvoiceTabEnum.invoiceHeader && (