|
@@ -1,5 +1,7 @@
|
|
|
"use client";
|
|
|
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, Badge } 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,9 +85,36 @@ 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) {
|
|
@@ -96,9 +126,17 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
}
|
|
|
Toast.show("领取失败!");
|
|
|
})
|
|
|
- // .catch((error) => {
|
|
|
- // Toast.show("领取失败!");
|
|
|
- // });
|
|
|
+ .catch((error) => {
|
|
|
+ Toast.show("领取失败!");
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const { getGameUrl } = useGame();
|
|
|
+ const goGame = () => {
|
|
|
+ const current = game.current;
|
|
|
+ getGameUrl(current!, { id: current?.id + "" });
|
|
|
+ tipsRef.current?.onClose();
|
|
|
+ gameModelRef.current?.onClose();
|
|
|
};
|
|
|
|
|
|
return (
|
|
@@ -123,6 +161,26 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
{/* 重玩币 */}
|
|
|
{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">
|
|
|
<div className={"coin_right_wallet"}>
|
|
|
<div
|