|
@@ -1,5 +1,7 @@
|
|
|
"use client";
|
|
|
-import { UserInfoRep, UserVipInfo, Wallet } from "@/api/user";
|
|
|
+import { UserInfoRep, UserVipInfo, Wallet, getUserTransferApi } from "@/api/user";
|
|
|
+import { userInfoApi } from "@/api/login";
|
|
|
+import { GameListRep } from "@/api/home";
|
|
|
import {
|
|
|
BalanceContent,
|
|
|
BonusContent,
|
|
@@ -12,10 +14,11 @@ import { useWalletStore } from "@/stores/useWalletStore";
|
|
|
import { WalletEnum } from "@/types";
|
|
|
import { vipImages } from "@/utils/constant";
|
|
|
import { flatPoint, percentage } from "@/utils/methods";
|
|
|
-import { ProgressBar, Toast } from "antd-mobile";
|
|
|
+import { ProgressBar, Toast, Badge, Button } 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;
|
|
@@ -82,6 +85,58 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
tipsRef.current?.onOpen();
|
|
|
};
|
|
|
|
|
|
+ // 未完成游戏
|
|
|
+ const gameModelRef = useRef<ModalProps>(null);
|
|
|
+ const game = useRef<GameListRep | null>(null);
|
|
|
+
|
|
|
+ // 彩金、免费币、重玩币提现到钱包操作
|
|
|
+ const handleAcquire = async (wallet_type: number, transfer: boolean) => {
|
|
|
+ if(!transfer) return;
|
|
|
+
|
|
|
+ // 先判断是否有未完成的游戏
|
|
|
+ const { data }: any = await userInfoApi();
|
|
|
+
|
|
|
+ // 如果有未完成游戏 彩金游戏-2、免费游戏-3、重玩游戏-4
|
|
|
+ if (wallet_type === 2 && data.play_list && data.play_list.length > 0) {
|
|
|
+ game.current = data.play_list[0];
|
|
|
+ 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();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wallet_type === 4 && data.lose_game_list && data.lose_game_list.length > 0) {
|
|
|
+ game.current = data.lose_game_list[0];
|
|
|
+ gameModelRef.current?.onOpen();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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}`));
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const { getGameUrl } = useGame();
|
|
|
+ const goGame = () => {
|
|
|
+ const current = game.current;
|
|
|
+ getGameUrl(current!, { id: current?.id + "" });
|
|
|
+ tipsRef.current?.onClose();
|
|
|
+ gameModelRef.current?.onClose();
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<TipsModal
|
|
@@ -98,91 +153,127 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
{/*现金*/}
|
|
|
{tipsStatus === WalletEnum.Balance ? <BalanceContent wallet={userMoney} /> : null}
|
|
|
{/* 彩金*/}
|
|
|
- {tipsStatus === WalletEnum.Bonus ? <BonusContent wallet={userMoney} /> : null}
|
|
|
+ {tipsStatus === WalletEnum.Bonus ? <BonusContent wallet={userMoney} handleAcquire={handleAcquire}/> : null}
|
|
|
{/* 免费币 */}
|
|
|
- {tipsStatus === WalletEnum.Free ? <FreeContent wallet={userMoney} /> : null}
|
|
|
+ {tipsStatus === WalletEnum.Free ? <FreeContent wallet={userMoney} handleAcquire={handleAcquire}/> : null}
|
|
|
{/* 重玩币 */}
|
|
|
- {tipsStatus === WalletEnum.Replay ? <ReplayContent wallet={userMoney} /> : null}
|
|
|
+ {tipsStatus === WalletEnum.Replay ? <ReplayContent wallet={userMoney} handleAcquire={handleAcquire}/> : null}
|
|
|
+ </TipsModal>
|
|
|
+ {/* 提现拦截 */}
|
|
|
+ <TipsModal title={"Tips"} ref={gameModelRef}>
|
|
|
+ <p className={"text-left text-[0.12rem] font-medium text-[#666]"}>
|
|
|
+ Existem jogos de bônus pendentes que não podem iniciar a retirada.
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <div className={"mt-[0.0694rem] flex justify-center"}>
|
|
|
+ <Button
|
|
|
+ color={"primary"}
|
|
|
+ className={"mx-auto"}
|
|
|
+ style={{
|
|
|
+ "--background-color": "var(--primary-color)",
|
|
|
+ "--border-color": "var(--primary-color)",
|
|
|
+ }}
|
|
|
+ onClick={goGame}
|
|
|
+ >
|
|
|
+ para jogos
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
</TipsModal>
|
|
|
<div className="coin">
|
|
|
- <span className="coin_left__icon iconfont icon-icon-wallet"></span>
|
|
|
<div className={"coin_right_wallet"}>
|
|
|
<div
|
|
|
className={"wallet_left_border"}
|
|
|
onClick={() => modalHandler(WalletEnum.Balance)}
|
|
|
>
|
|
|
- <div className={"wallet_header"}>
|
|
|
- <span>{t("balance")}</span>
|
|
|
- <Image
|
|
|
- className="wallet_header__icon"
|
|
|
- src="/img/a.png"
|
|
|
- alt="question"
|
|
|
- width={15}
|
|
|
- height={15}
|
|
|
- />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className="num">
|
|
|
- <span className="uppercase">brl </span>
|
|
|
- <span>{userMoney.score || 0.0}</span>
|
|
|
- </div>
|
|
|
+ <span className="coin_left__icon iconfont icon-qianbao3"></span>
|
|
|
+ <section>
|
|
|
+ <div className={"wallet_header"}>
|
|
|
+ <span>{t("balance")}</span>
|
|
|
+ <Image
|
|
|
+ className="wallet_header__icon"
|
|
|
+ src="/img/a.png"
|
|
|
+ alt="question"
|
|
|
+ width={15}
|
|
|
+ height={15}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div className="num">
|
|
|
+ <span className="uppercase">brl </span>
|
|
|
+ <span>{userMoney.score || 0.0}</span>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
</div>
|
|
|
<div
|
|
|
className={"wallet_right_content"}
|
|
|
onClick={() => modalHandler(WalletEnum.Bonus)}
|
|
|
>
|
|
|
- <div className={"wallet_header"}>
|
|
|
- {t("bonus")}
|
|
|
- <Image
|
|
|
- className="wallet_header__icon"
|
|
|
- src="/img/a.png"
|
|
|
- alt="question"
|
|
|
- width={15}
|
|
|
- height={15}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div className="num">
|
|
|
- <span className="uppercase">brl </span>
|
|
|
- <span>{userMoney.point || 0.0}</span>
|
|
|
- </div>
|
|
|
+ <Badge content={userMoney.is_point_transfer ? Badge.dot : null} style={{right: "10px"}}>
|
|
|
+ <span className="coin_left__icon iconfont icon-qianbao3"></span>
|
|
|
+ </Badge>
|
|
|
+ <section>
|
|
|
+ <div className={"wallet_header"}>
|
|
|
+ {t("bonus")}
|
|
|
+ <Image
|
|
|
+ className="wallet_header__icon"
|
|
|
+ src="/img/a.png"
|
|
|
+ alt="question"
|
|
|
+ width={15}
|
|
|
+ height={15}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div className="num">
|
|
|
+ <span className="uppercase">brl </span>
|
|
|
+ <span>{userMoney.point || 0.0}</span>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
</div>
|
|
|
<div
|
|
|
className={"wallet_left_border"}
|
|
|
onClick={() => modalHandler(WalletEnum.Free)}
|
|
|
- >
|
|
|
- <div className={"wallet_header"}>
|
|
|
- {t("free")}
|
|
|
- <Image
|
|
|
- className="wallet_header__icon"
|
|
|
- src="/img/a.png"
|
|
|
- alt="question"
|
|
|
- width={15}
|
|
|
- height={15}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div className="num">
|
|
|
- <span className="uppercase">brl </span>
|
|
|
- <span>{userMoney.free_score || 0.0}</span>
|
|
|
- </div>
|
|
|
+ >
|
|
|
+ <Badge content={userMoney.is_free_transfer ? Badge.dot : null} style={{right: "10px"}}>
|
|
|
+ <span className="coin_left__icon iconfont icon-qianbao3"></span>
|
|
|
+ </Badge>
|
|
|
+ <section>
|
|
|
+ <div className={"wallet_header"}>
|
|
|
+ {t("free")}
|
|
|
+ <Image
|
|
|
+ className="wallet_header__icon"
|
|
|
+ src="/img/a.png"
|
|
|
+ alt="question"
|
|
|
+ width={15}
|
|
|
+ height={15}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div className="num">
|
|
|
+ <span className="uppercase">brl </span>
|
|
|
+ <span>{userMoney.free_score || 0.0}</span>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
</div>
|
|
|
<div
|
|
|
className={"wallet_right_content"}
|
|
|
onClick={() => modalHandler(WalletEnum.Replay)}
|
|
|
>
|
|
|
- <div className={"wallet_header"}>
|
|
|
- {t("replay")}
|
|
|
- <Image
|
|
|
- className="wallet_header__icon"
|
|
|
- src="/img/a.png"
|
|
|
- alt="question"
|
|
|
- width={15}
|
|
|
- height={15}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div className="num">
|
|
|
- <span className="uppercase">brl </span>
|
|
|
- <span>{userMoney.lose_score || 0.0}</span>
|
|
|
- </div>
|
|
|
+ <Badge content={userMoney.is_lose_transfer ? Badge.dot : null} style={{right: "10px"}}>
|
|
|
+ <span className="coin_left__icon iconfont icon-qianbao3"></span>
|
|
|
+ </Badge>
|
|
|
+ <section>
|
|
|
+ <div className={"wallet_header"}>
|
|
|
+ {t("replay")}
|
|
|
+ <Image
|
|
|
+ className="wallet_header__icon"
|
|
|
+ src="/img/a.png"
|
|
|
+ alt="question"
|
|
|
+ width={15}
|
|
|
+ height={15}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div className="num">
|
|
|
+ <span className="uppercase">brl </span>
|
|
|
+ <span>{userMoney.lose_score || 0.0}</span>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|