|
@@ -1,4 +1,6 @@
|
|
|
"use client";
|
|
|
+import { GameListRep } from "@/api/home";
|
|
|
+import { userInfoApi } from "@/api/login";
|
|
|
import { Wallet } from "@/api/user";
|
|
|
import { ChannelType, getWithDrawApi, WithDrawType } from "@/api/withdraw";
|
|
|
import { clearWallet } from "@/app/[locale]/(navbar)/withdraw/actions";
|
|
@@ -6,6 +8,7 @@ import Box from "@/components/Box";
|
|
|
import ButtonOwn from "@/components/ButtonOwn";
|
|
|
import Empty from "@/components/Empty";
|
|
|
import TipsModal, { ModalProps } from "@/components/TipsModal";
|
|
|
+import useGame from "@/hooks/useGame";
|
|
|
import { useUserInfoStore } from "@/stores/useUserInfoStore";
|
|
|
import { useWalletStore } from "@/stores/useWalletStore";
|
|
|
import { isEmail } from "@/utils";
|
|
@@ -21,6 +24,7 @@ import "./page.scss";
|
|
|
interface Props {
|
|
|
channels: WithDrawType[];
|
|
|
wallet: Wallet;
|
|
|
+ playlist?: GameListRep[];
|
|
|
}
|
|
|
|
|
|
export enum ChannelEnum {
|
|
@@ -107,12 +111,16 @@ const MobileField: FC<MobileFieldProps> = (props) => {
|
|
|
const WithdrawWidget: FC<Props> = (props) => {
|
|
|
const t = useTranslations();
|
|
|
const { channels, wallet } = props;
|
|
|
+ const { getGameUrl } = useGame();
|
|
|
|
|
|
const score = useWalletStore((state) => state.score)!;
|
|
|
|
|
|
const withdrawRef = useRef<ModalProps>(null);
|
|
|
// 积分
|
|
|
const scoreRef = useRef<ModalProps>(null);
|
|
|
+ // 未完成游戏
|
|
|
+ const gameModelRef = useRef<ModalProps>(null);
|
|
|
+ const game = useRef<GameListRep | null>(null);
|
|
|
// 表单
|
|
|
const formRef = useRef<FormInstance>(null);
|
|
|
|
|
@@ -178,8 +186,14 @@ const WithdrawWidget: FC<Props> = (props) => {
|
|
|
|
|
|
const onFinish = async (value: any) => {
|
|
|
const params = { ...value, ...value.channel, amount: +value.amount };
|
|
|
- // const result = await getUserInfoApi();
|
|
|
- // console.log(`🚀🚀🚀🚀🚀-> in WithdrawWidget.tsx on 183`, result);
|
|
|
+
|
|
|
+ const { data } = await userInfoApi();
|
|
|
+
|
|
|
+ if (data.play_list && data.play_list.length > 0) {
|
|
|
+ game.current = data.play_list[0];
|
|
|
+ gameModelRef.current?.onOpen();
|
|
|
+ return;
|
|
|
+ }
|
|
|
paramsTarget.current = params;
|
|
|
if (
|
|
|
flatPoint(wallet.target_point_rollover - wallet.current_point_rollover) !== 0 &&
|
|
@@ -189,7 +203,6 @@ const WithdrawWidget: FC<Props> = (props) => {
|
|
|
setIsPay(true);
|
|
|
return;
|
|
|
}
|
|
|
- console.log(`🚀🚀🚀🚀🚀-> in WithdrawWidget.tsx on 185`, value);
|
|
|
const withResult = await getWithDrawApi(params).catch((error) => {
|
|
|
Toast.show(t(`code.${error.data.code}`));
|
|
|
});
|
|
@@ -199,10 +212,10 @@ const WithdrawWidget: FC<Props> = (props) => {
|
|
|
await clearWallet();
|
|
|
};
|
|
|
|
|
|
- const currentPoint =
|
|
|
- percentage(wallet.current_point_rollover, wallet.target_point_rollover) !== 100
|
|
|
- ? 0
|
|
|
- : wallet.point;
|
|
|
+ const goGame = () => {
|
|
|
+ const current = game.current;
|
|
|
+ getGameUrl(current!, { id: current?.id + "" });
|
|
|
+ };
|
|
|
|
|
|
if (!activeWallet) return <Empty />;
|
|
|
|
|
@@ -517,6 +530,26 @@ const WithdrawWidget: FC<Props> = (props) => {
|
|
|
</li>
|
|
|
</ul>
|
|
|
</TipsModal>
|
|
|
+ {/* 提现拦截 */}
|
|
|
+ <TipsModal title={"Tips"} ref={gameModelRef}>
|
|
|
+ <p className={"text-left text-[0.12rem] font-medium text-[#666]"}>
|
|
|
+ Atualmente, existem jogos de bônus inacabados que não podem iniciar saques.
|
|
|
+ </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>
|
|
|
</>
|
|
|
);
|
|
|
};
|