|
@@ -1,7 +1,7 @@
|
|
|
"use client";
|
|
|
-import { UserInfoRep, UserVipInfo, Wallet, getUserTransferApi } from "@/api/user";
|
|
|
-import { userInfoApi } from "@/api/login";
|
|
|
import { GameListRep } from "@/api/home";
|
|
|
+import { userInfoApi } from "@/api/login";
|
|
|
+import { UserInfoRep, UserVipInfo, Wallet, getUserTransferApi } from "@/api/user";
|
|
|
import {
|
|
|
BalanceContent,
|
|
|
BonusContent,
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
ReplayContent,
|
|
|
} from "@/components/ModalPopup/WalletDescribeModal";
|
|
|
import TipsModal, { ModalProps } from "@/components/TipsModal";
|
|
|
+import useGame from "@/hooks/useGame";
|
|
|
import { Link, useRouter } from "@/i18n/routing";
|
|
|
import { useWalletStore } from "@/stores/useWalletStore";
|
|
|
import { WalletEnum } from "@/types";
|
|
|
import { vipImages } from "@/utils/constant";
|
|
|
import { flatPoint, percentage } from "@/utils/methods";
|
|
|
-import { ProgressBar, Toast, Badge, Button } from "antd-mobile";
|
|
|
+import { Badge, Button, ProgressBar, Toast } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import Image from "next/image";
|
|
|
import { Fragment, useRef, useState } from "react";
|
|
|
-import useGame from "@/hooks/useGame";
|
|
|
|
|
|
type Props = {
|
|
|
userInfo: UserInfoRep;
|
|
@@ -76,6 +76,7 @@ const VipCard = (props: { userVip: UserVipInfo }) => {
|
|
|
const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
const { userMoney } = props;
|
|
|
const t = useTranslations("ProfilePage");
|
|
|
+ const tcdoe = useTranslations();
|
|
|
|
|
|
const tipsRef = useRef<ModalProps>(null);
|
|
|
const [tipsStatus, setTipsStatus] = useState<keyof typeof WalletEnum>("Bonus");
|
|
@@ -91,7 +92,7 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
|
|
|
// 彩金、免费币、重玩币提现到钱包操作
|
|
|
const handleAcquire = async (wallet_type: number, transfer: boolean) => {
|
|
|
- if(!transfer) return;
|
|
|
+ if (!transfer) return;
|
|
|
|
|
|
// 先判断是否有未完成的游戏
|
|
|
const { data }: any = await userInfoApi();
|
|
@@ -102,7 +103,7 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
gameModelRef.current?.onOpen();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (wallet_type === 3 && data.free_game_list && data.free_game_list.length > 0) {
|
|
|
game.current = data.free_game_list[0];
|
|
|
gameModelRef.current?.onOpen();
|
|
@@ -116,17 +117,17 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
}
|
|
|
|
|
|
getUserTransferApi({ wallet_type })
|
|
|
- .then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- Toast.show(t("code.200"));
|
|
|
- setTimeout(() => {
|
|
|
- tipsRef.current?.onClose();
|
|
|
- }, 1000)
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- Toast.show(t(`code.${error.data.code}`));
|
|
|
- });
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ Toast.show(tcdoe("code.200"));
|
|
|
+ setTimeout(() => {
|
|
|
+ tipsRef.current?.onClose();
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ Toast.show(tcdoe(`code.${error.data.code}`));
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const { getGameUrl } = useGame();
|
|
@@ -153,11 +154,17 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
{/*现金*/}
|
|
|
{tipsStatus === WalletEnum.Balance ? <BalanceContent wallet={userMoney} /> : null}
|
|
|
{/* 彩金*/}
|
|
|
- {tipsStatus === WalletEnum.Bonus ? <BonusContent wallet={userMoney} handleAcquire={handleAcquire}/> : null}
|
|
|
+ {tipsStatus === WalletEnum.Bonus ? (
|
|
|
+ <BonusContent wallet={userMoney} handleAcquire={handleAcquire} />
|
|
|
+ ) : null}
|
|
|
{/* 免费币 */}
|
|
|
- {tipsStatus === WalletEnum.Free ? <FreeContent wallet={userMoney} handleAcquire={handleAcquire}/> : null}
|
|
|
+ {tipsStatus === WalletEnum.Free ? (
|
|
|
+ <FreeContent wallet={userMoney} handleAcquire={handleAcquire} />
|
|
|
+ ) : null}
|
|
|
{/* 重玩币 */}
|
|
|
- {tipsStatus === WalletEnum.Replay ? <ReplayContent wallet={userMoney} handleAcquire={handleAcquire}/> : null}
|
|
|
+ {tipsStatus === WalletEnum.Replay ? (
|
|
|
+ <ReplayContent wallet={userMoney} handleAcquire={handleAcquire} />
|
|
|
+ ) : null}
|
|
|
</TipsModal>
|
|
|
{/* 提现拦截 */}
|
|
|
<TipsModal title={"Tips"} ref={gameModelRef}>
|
|
@@ -207,7 +214,10 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
className={"wallet_right_content"}
|
|
|
onClick={() => modalHandler(WalletEnum.Bonus)}
|
|
|
>
|
|
|
- <Badge content={userMoney.is_point_transfer ? Badge.dot : null} style={{right: "10px"}}>
|
|
|
+ <Badge
|
|
|
+ content={userMoney.is_point_transfer ? Badge.dot : null}
|
|
|
+ style={{ right: "10px" }}
|
|
|
+ >
|
|
|
<span className="coin_left__icon iconfont icon-qianbao3"></span>
|
|
|
</Badge>
|
|
|
<section>
|
|
@@ -230,8 +240,11 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
<div
|
|
|
className={"wallet_left_border"}
|
|
|
onClick={() => modalHandler(WalletEnum.Free)}
|
|
|
- >
|
|
|
- <Badge content={userMoney.is_free_transfer ? Badge.dot : null} style={{right: "10px"}}>
|
|
|
+ >
|
|
|
+ <Badge
|
|
|
+ content={userMoney.is_free_transfer ? Badge.dot : null}
|
|
|
+ style={{ right: "10px" }}
|
|
|
+ >
|
|
|
<span className="coin_left__icon iconfont icon-qianbao3"></span>
|
|
|
</Badge>
|
|
|
<section>
|
|
@@ -255,7 +268,10 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
className={"wallet_right_content"}
|
|
|
onClick={() => modalHandler(WalletEnum.Replay)}
|
|
|
>
|
|
|
- <Badge content={userMoney.is_lose_transfer ? Badge.dot : null} style={{right: "10px"}}>
|
|
|
+ <Badge
|
|
|
+ content={userMoney.is_lose_transfer ? Badge.dot : null}
|
|
|
+ style={{ right: "10px" }}
|
|
|
+ >
|
|
|
<span className="coin_left__icon iconfont icon-qianbao3"></span>
|
|
|
</Badge>
|
|
|
<section>
|