mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-16 05:11:10 -05:00
✨ feat(user): Add 'gift_amount' field and update related references in user services and components
This commit is contained in:
parent
a4e9d5da59
commit
b13c77e9b7
4
apps/admin/services/admin/typings.d.ts
vendored
4
apps/admin/services/admin/typings.d.ts
vendored
@ -192,6 +192,8 @@ declare namespace API {
|
|||||||
referer_user: string;
|
referer_user: string;
|
||||||
refer_code: string;
|
refer_code: string;
|
||||||
balance: number;
|
balance: number;
|
||||||
|
commission: number;
|
||||||
|
gift_amount: number;
|
||||||
is_admin: boolean;
|
is_admin: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -989,6 +991,8 @@ declare namespace API {
|
|||||||
password: string;
|
password: string;
|
||||||
avatar: string;
|
avatar: string;
|
||||||
balance: number;
|
balance: number;
|
||||||
|
commission: number;
|
||||||
|
gift_amount: number;
|
||||||
telegram: number;
|
telegram: number;
|
||||||
refer_code: string;
|
refer_code: string;
|
||||||
referer_id: number;
|
referer_id: number;
|
||||||
|
|||||||
@ -29,14 +29,14 @@ import StripePayment from './stripe';
|
|||||||
export default function Page() {
|
export default function Page() {
|
||||||
const t = useTranslations('order');
|
const t = useTranslations('order');
|
||||||
const { getUserInfo } = useGlobalStore();
|
const { getUserInfo } = useGlobalStore();
|
||||||
const [order_no, setOrderNo] = useState<string>();
|
const [orderNo, setOrderNo] = useState<string>();
|
||||||
const [enabled, setEnabled] = useState<boolean>(false);
|
const [enabled, setEnabled] = useState<boolean>(false);
|
||||||
|
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
queryKey: ['queryOrderDetail', order_no],
|
queryKey: ['queryOrderDetail', orderNo],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await queryOrderDetail({ order_no: order_no! });
|
const { data } = await queryOrderDetail({ order_no: orderNo! });
|
||||||
if (data?.data?.status !== 1) {
|
if (data?.data?.status !== 1) {
|
||||||
getUserInfo();
|
getUserInfo();
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
@ -47,10 +47,10 @@ export default function Page() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { data: payment } = useQuery({
|
const { data: payment } = useQuery({
|
||||||
enabled: !!order_no && data?.status === 1,
|
enabled: !!orderNo && data?.status === 1,
|
||||||
queryKey: ['checkoutOrder', order_no],
|
queryKey: ['checkoutOrder', orderNo],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await checkoutOrder({ orderNo: order_no! });
|
const { data } = await checkoutOrder({ orderNo: orderNo! });
|
||||||
return data?.data;
|
return data?.data;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export function SidebarRight({ ...props }: React.ComponentProps<typeof Sidebar>)
|
|||||||
<CardTitle className='text-sm font-medium'>{t('giftAmount')}</CardTitle>
|
<CardTitle className='text-sm font-medium'>{t('giftAmount')}</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className='p-3 text-2xl font-bold'>
|
<CardContent className='p-3 text-2xl font-bold'>
|
||||||
<Display type='currency' value={user?.deduction} />
|
<Display type='currency' value={user?.gift_amount} />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
<Card>
|
<Card>
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export default function Page() {
|
|||||||
const t = useTranslations('wallet');
|
const t = useTranslations('wallet');
|
||||||
const { user } = useGlobalStore();
|
const { user } = useGlobalStore();
|
||||||
const ref = useRef<ProListActions>(null);
|
const ref = useRef<ProListActions>(null);
|
||||||
const totalAssets = (user?.balance || 0) + (user?.commission || 0) + (user?.deduction || 0);
|
const totalAssets = (user?.balance || 0) + (user?.commission || 0) + (user?.gift_amount || 0);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card className='mb-4'>
|
<Card className='mb-4'>
|
||||||
@ -47,7 +47,7 @@ export default function Page() {
|
|||||||
{t('giftAmount')}
|
{t('giftAmount')}
|
||||||
</p>
|
</p>
|
||||||
<p className='text-secondary-foreground text-2xl font-bold'>
|
<p className='text-secondary-foreground text-2xl font-bold'>
|
||||||
<Display type='currency' value={user?.deduction} />
|
<Display type='currency' value={user?.gift_amount} />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className='bg-secondary rounded-lg p-4 shadow-sm transition-all duration-300 hover:shadow-md'>
|
<div className='bg-secondary rounded-lg p-4 shadow-sm transition-all duration-300 hover:shadow-md'>
|
||||||
|
|||||||
@ -27,7 +27,7 @@ interface UnsubscribeProps {
|
|||||||
export default function Unsubscribe({ id, allowDeduction }: Readonly<UnsubscribeProps>) {
|
export default function Unsubscribe({ id, allowDeduction }: Readonly<UnsubscribeProps>) {
|
||||||
const t = useTranslations('subscribe.unsubscribe');
|
const t = useTranslations('subscribe.unsubscribe');
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { common } = useGlobalStore();
|
const { common, getUserInfo } = useGlobalStore();
|
||||||
const single_model = common.subscribe.single_model;
|
const single_model = common.subscribe.single_model;
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
@ -51,6 +51,7 @@ export default function Unsubscribe({ id, allowDeduction }: Readonly<Unsubscribe
|
|||||||
);
|
);
|
||||||
toast.success(t('success'));
|
toast.success(t('success'));
|
||||||
router.refresh();
|
router.refresh();
|
||||||
|
await getUserInfo();
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(t('failed'));
|
toast.error(t('failed'));
|
||||||
|
|||||||
1
apps/user/services/user/typings.d.ts
vendored
1
apps/user/services/user/typings.d.ts
vendored
@ -611,6 +611,7 @@ declare namespace API {
|
|||||||
balance: number;
|
balance: number;
|
||||||
commission: number;
|
commission: number;
|
||||||
deduction: number;
|
deduction: number;
|
||||||
|
gift_amount: number;
|
||||||
telegram: number;
|
telegram: number;
|
||||||
refer_code: string;
|
refer_code: string;
|
||||||
referer_id: number;
|
referer_id: number;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user