Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
366fe0ea
authored
Aug 22, 2024
by
papapatrick
Committed by
GitHub
Aug 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: invoice page refresh after apply (#2469)
* perf: 发票申请弹窗成功后刷新 * refactor: 组件内拿invoiceTab
parent
225554f2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
16 deletions
+35
-16
projects/app/src/pages/account/components/bill/ApplyInvoiceModal.tsx
+7
-1
projects/app/src/pages/account/components/bill/BillAndInvoice.tsx
+28
-14
projects/app/src/pages/account/index.tsx
+0
-1
No files found.
projects/app/src/pages/account/components/bill/ApplyInvoiceModal.tsx
View file @
366fe0ea
...
@@ -31,6 +31,7 @@ import { InvoiceHeaderSingleForm } from './InvoiceHeaderForm';
...
@@ -31,6 +31,7 @@ import { InvoiceHeaderSingleForm } from './InvoiceHeaderForm';
import
MyBox
from
'@fastgpt/web/components/common/MyBox'
;
import
MyBox
from
'@fastgpt/web/components/common/MyBox'
;
import
{
getTeamInvoiceHeader
}
from
'@/web/support/user/team/api'
;
import
{
getTeamInvoiceHeader
}
from
'@/web/support/user/team/api'
;
import
{
useToast
}
from
'@fastgpt/web/hooks/useToast'
;
import
{
useToast
}
from
'@fastgpt/web/hooks/useToast'
;
import
{
useRouter
}
from
'next/router'
;
type
chosenBillDataType
=
{
type
chosenBillDataType
=
{
_id
:
string
;
_id
:
string
;
price
:
number
;
price
:
number
;
...
@@ -50,6 +51,8 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -50,6 +51,8 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
needSpecialInvoice
:
undefined
,
needSpecialInvoice
:
undefined
,
emailAddress
:
''
emailAddress
:
''
});
});
const
router
=
useRouter
();
const
{
const
{
isOpen
:
isOpenSettleModal
,
isOpen
:
isOpenSettleModal
,
onOpen
:
onOpenSettleModal
,
onOpen
:
onOpenSettleModal
,
...
@@ -94,7 +97,10 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
...
@@ -94,7 +97,10 @@ const ApplyInvoiceModal = ({ onClose }: { onClose: () => void }) => {
manual
:
true
,
manual
:
true
,
successToast
:
t
(
'common:common.submit_success'
),
successToast
:
t
(
'common:common.submit_success'
),
errorToast
:
t
(
'common:common.Submit failed'
),
errorToast
:
t
(
'common:common.Submit failed'
),
onSuccess
:
()
=>
onClose
()
onSuccess
:
()
=>
{
onClose
();
router
.
reload
();
}
}
}
);
);
...
...
projects/app/src/pages/account/components/bill/BillAndInvoice.tsx
View file @
366fe0ea
...
@@ -4,19 +4,20 @@ import dynamic from 'next/dynamic';
...
@@ -4,19 +4,20 @@ import dynamic from 'next/dynamic';
import
{
useState
}
from
'react'
;
import
{
useState
}
from
'react'
;
import
{
useTranslation
}
from
'next-i18next'
;
import
{
useTranslation
}
from
'next-i18next'
;
import
ApplyInvoiceModal
from
'./ApplyInvoiceModal'
;
import
ApplyInvoiceModal
from
'./ApplyInvoiceModal'
;
import
{
useRouter
}
from
'next/router'
;
const
TabEnum
=
{
export
const
Invoice
TabEnum
=
{
bill
:
'bill'
,
bill
:
'bill'
,
invoice
:
'invoice'
,
invoice
:
'invoice'
,
invoiceHeader
:
'voiceHeader'
invoiceHeader
:
'
in
voiceHeader'
};
};
const
BillTable
=
dynamic
(()
=>
import
(
'./BillTable'
));
const
BillTable
=
dynamic
(()
=>
import
(
'./BillTable'
));
const
InvoiceHeaderForm
=
dynamic
(()
=>
import
(
'./InvoiceHeaderForm'
));
const
InvoiceHeaderForm
=
dynamic
(()
=>
import
(
'./InvoiceHeaderForm'
));
const
InvoiceTable
=
dynamic
(()
=>
import
(
'./InvoiceTable'
));
const
InvoiceTable
=
dynamic
(()
=>
import
(
'./InvoiceTable'
));
const
BillAndInvoice
=
()
=>
{
const
BillAndInvoice
=
()
=>
{
const
[
currentTab
,
setCurrentTab
]
=
useState
(
TabEnum
.
bill
);
const
[
isOpenInvoiceModal
,
setIsOpenInvoiceModal
]
=
useState
(
false
);
const
[
isOpenInvoiceModal
,
setIsOpenInvoiceModal
]
=
useState
(
false
);
const
router
=
useRouter
();
const
invoiceTab
=
(
router
.
query
.
invoiceTab
as
string
)
||
InvoiceTabEnum
.
bill
;
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
return
(
return
(
<>
<>
...
@@ -24,17 +25,24 @@ const BillAndInvoice = () => {
...
@@ -24,17 +25,24 @@ const BillAndInvoice = () => {
<
Flex
justifyContent=
{
'space-between'
}
alignItems=
{
'center'
}
pb=
{
'0.75rem'
}
>
<
Flex
justifyContent=
{
'space-between'
}
alignItems=
{
'center'
}
pb=
{
'0.75rem'
}
>
<
FillRowTabs
<
FillRowTabs
list=
{
[
list=
{
[
{
label
:
t
(
'common:support.wallet.bill_tag.bill'
),
value
:
TabEnum
.
bill
},
{
label
:
t
(
'common:support.wallet.bill_tag.bill'
),
value
:
Invoice
TabEnum
.
bill
},
{
label
:
t
(
'common:support.wallet.bill_tag.invoice'
),
value
:
TabEnum
.
invoice
},
{
label
:
t
(
'common:support.wallet.bill_tag.invoice'
),
value
:
Invoice
TabEnum
.
invoice
},
{
{
label
:
t
(
'common:support.wallet.bill_tag.default_header'
),
label
:
t
(
'common:support.wallet.bill_tag.default_header'
),
value
:
TabEnum
.
invoiceHeader
value
:
Invoice
TabEnum
.
invoiceHeader
}
}
]
}
]
}
value=
{
currentTab
}
value=
{
invoiceTab
}
onChange=
{
setCurrentTab
}
onChange=
{
(
e
)
=>
{
router
.
replace
({
query
:
{
currentTab
:
router
.
query
.
currentTab
,
invoiceTab
:
e
}
});
}
}
></
FillRowTabs
>
></
FillRowTabs
>
{
currentTab
!==
TabEnum
.
invoiceHeader
&&
(
{
invoiceTab
!==
Invoice
TabEnum
.
invoiceHeader
&&
(
<
Button
variant=
{
'primary'
}
px=
"0"
onClick=
{
()
=>
setIsOpenInvoiceModal
(
true
)
}
>
<
Button
variant=
{
'primary'
}
px=
"0"
onClick=
{
()
=>
setIsOpenInvoiceModal
(
true
)
}
>
<
Flex
alignItems=
{
'center'
}
px=
{
'20px'
}
>
<
Flex
alignItems=
{
'center'
}
px=
{
'20px'
}
>
<
Box
px=
{
'1.25rem'
}
py=
{
'0.5rem'
}
>
<
Box
px=
{
'1.25rem'
}
py=
{
'0.5rem'
}
>
...
@@ -45,11 +53,17 @@ const BillAndInvoice = () => {
...
@@ -45,11 +53,17 @@ const BillAndInvoice = () => {
)
}
)
}
</
Flex
>
</
Flex
>
<
Box
h=
{
'100%'
}
>
<
Box
h=
{
'100%'
}
>
{
currentTab
===
TabEnum
.
bill
&&
<
BillTable
/>
}
{
invoiceTab
===
Invoice
TabEnum
.
bill
&&
<
BillTable
/>
}
{
currentTab
===
TabEnum
.
invoice
&&
<
InvoiceTable
/>
}
{
invoiceTab
===
Invoice
TabEnum
.
invoice
&&
<
InvoiceTable
/>
}
{
currentTab
===
TabEnum
.
invoiceHeader
&&
<
InvoiceHeaderForm
/>
}
{
invoiceTab
===
Invoice
TabEnum
.
invoiceHeader
&&
<
InvoiceHeaderForm
/>
}
</
Box
>
</
Box
>
{
isOpenInvoiceModal
&&
<
ApplyInvoiceModal
onClose=
{
()
=>
setIsOpenInvoiceModal
(
false
)
}
/>
}
{
isOpenInvoiceModal
&&
(
<
ApplyInvoiceModal
onClose=
{
()
=>
{
setIsOpenInvoiceModal
(
false
);
}
}
/>
)
}
</
Box
>
</
Box
>
</>
</>
);
);
...
...
projects/app/src/pages/account/index.tsx
View file @
366fe0ea
...
@@ -20,7 +20,6 @@ const BillAndInvoice = dynamic(() => import('./components/bill/BillAndInvoice'))
...
@@ -20,7 +20,6 @@ const BillAndInvoice = dynamic(() => import('./components/bill/BillAndInvoice'))
const
InformTable
=
dynamic
(()
=>
import
(
'./components/InformTable'
));
const
InformTable
=
dynamic
(()
=>
import
(
'./components/InformTable'
));
const
ApiKeyTable
=
dynamic
(()
=>
import
(
'./components/ApiKeyTable'
));
const
ApiKeyTable
=
dynamic
(()
=>
import
(
'./components/ApiKeyTable'
));
const
Individuation
=
dynamic
(()
=>
import
(
'./components/Individuation'
));
const
Individuation
=
dynamic
(()
=>
import
(
'./components/Individuation'
));
enum
TabEnum
{
enum
TabEnum
{
'info'
=
'info'
,
'info'
=
'info'
,
'promotion'
=
'promotion'
,
'promotion'
=
'promotion'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment