|
@@ -1,7 +1,14 @@
|
|
|
"use client";
|
|
|
import { GameListRep, GameRequest } from "@/api/home";
|
|
|
import { userInfoApi } from "@/api/login";
|
|
|
-import { UserInfoRep, UserVipInfo, Wallet, getUserTransferApi } from "@/api/user";
|
|
|
+import {
|
|
|
+ UserInfoRep,
|
|
|
+ UserVipInfo,
|
|
|
+ Wallet,
|
|
|
+ cleanBounsApi,
|
|
|
+ getUserMoneyApi,
|
|
|
+ getUserTransferApi,
|
|
|
+} from "@/api/user";
|
|
|
import {
|
|
|
BalanceContent,
|
|
|
BonusContent,
|
|
@@ -15,10 +22,10 @@ import { useWalletStore } from "@/stores/useWalletStore";
|
|
|
import { WalletEnum } from "@/types";
|
|
|
import { vipImages } from "@/utils/constant";
|
|
|
import { flatPoint, percentage } from "@/utils/methods";
|
|
|
-import { Badge, Button, ProgressBar, Toast } from "antd-mobile";
|
|
|
+import { Badge, Button, Mask, ProgressBar, Toast } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import Image from "next/image";
|
|
|
-import { Fragment, useRef, useState } from "react";
|
|
|
+import { Fragment, useEffect, useRef, useState } from "react";
|
|
|
|
|
|
type Props = {
|
|
|
userInfo: UserInfoRep;
|
|
@@ -305,12 +312,71 @@ const WalletCard = (props: { userMoney: Wallet }) => {
|
|
|
</>
|
|
|
);
|
|
|
};
|
|
|
+const NoBounsWarn = ({ visible, onClose, onConfirm }: any) => {
|
|
|
+ const doClose = () => {
|
|
|
+ if (typeof onClose === "function") onClose();
|
|
|
+ };
|
|
|
+ const doConfirm = () => {
|
|
|
+ if (typeof onConfirm === "function") onConfirm();
|
|
|
+ };
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Mask visible={visible} onMaskClick={doClose}>
|
|
|
+ <div className="absolute left-[50%] top-[40%] w-[80%] translate-x-[-50%]">
|
|
|
+ <div className="relative rounded-[.1rem] border-[1px] border-[#e541ff] bg-gradient-to-b from-[#254cc5] to-[#4b179a] px-[.15rem] pb-[.15rem] pt-[0px] shadow-[0_-10px_15px_#7619b6_inset]">
|
|
|
+ <div className="h-[.5rem] text-center">
|
|
|
+ <img
|
|
|
+ src="/warn_top.png"
|
|
|
+ alt=""
|
|
|
+ className="relative -top-[.3rem] inline-block w-[.9rem]"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div className="text-center text-[.12rem]">
|
|
|
+ A demanda atual de fluxo de retirada de bônus é excessiva,Se esvaziar o
|
|
|
+ bônus e retirar a demanda de água corrente?
|
|
|
+ </div>
|
|
|
+ <div className="mt-[.2rem] flex items-center justify-between px-[.1rem]">
|
|
|
+ <button
|
|
|
+ onClick={doConfirm}
|
|
|
+ className="mr-[.1rem] h-[.35rem] flex-1 rounded-[60px] border border-[#e746ff] bg-[#703dc3] text-[.14rem] font-bold text-[#00f6ff] shadow-[0_10px_5px_#8f42d2_inset]"
|
|
|
+ >
|
|
|
+ A certeza
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ onClick={doClose}
|
|
|
+ className="h-[.35rem] flex-1 rounded-[60px] border border-[#46e3ff] bg-[#6c3bc1] text-[.14rem] font-bold text-[#00f6ff] shadow-[0_-10px_5px_#4d4ebf_inset]"
|
|
|
+ >
|
|
|
+ Cancelar
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <i
|
|
|
+ className="iconfont icon-guanbi absolute right-[.1rem] top-[.1rem]"
|
|
|
+ onClick={doClose}
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Mask>
|
|
|
+ );
|
|
|
+};
|
|
|
export const ProfileHeader = (props: Props) => {
|
|
|
const { userInfo, userVip } = props;
|
|
|
const t = useTranslations("ProfilePage");
|
|
|
|
|
|
- const wallet = useWalletStore((state) => state.wallet);
|
|
|
+ const { wallet, setWallet } = useWalletStore((state) => ({
|
|
|
+ wallet: state.wallet,
|
|
|
+ setWallet: state.setWallet,
|
|
|
+ }));
|
|
|
const router = useRouter();
|
|
|
+ const [isShowNoBounsWarn, setIsShowNoBounsWarn] = useState(false);
|
|
|
+ const [isShowed, setIsShowed] = useState(false);
|
|
|
+ useEffect(() => {
|
|
|
+ const curMul = wallet.target_point_rollover / ((wallet?.score || 0) + (wallet.point || 0));
|
|
|
+ const config = wallet.no_bonus_config;
|
|
|
+ if (curMul >= (config || 0) && !isShowed) {
|
|
|
+ setIsShowNoBounsWarn(true);
|
|
|
+ setIsShowed(true);
|
|
|
+ }
|
|
|
+ }, [wallet]);
|
|
|
|
|
|
const handler = () => {
|
|
|
if (!!wallet.score) {
|
|
@@ -319,6 +385,29 @@ export const ProfileHeader = (props: Props) => {
|
|
|
Toast.show("no money ");
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ const doConfirm = async () => {
|
|
|
+ Toast.show({
|
|
|
+ icon: "loading",
|
|
|
+ maskClickable: false,
|
|
|
+ });
|
|
|
+ setIsShowNoBounsWarn(false);
|
|
|
+ const res = await cleanBounsApi(1);
|
|
|
+ if (res?.code && [6001, 6002].includes(res?.data?.code)) {
|
|
|
+ const str = t(`bouns${res?.data?.code}`);
|
|
|
+ Toast.show({
|
|
|
+ content: str,
|
|
|
+ icon: "fail",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ Toast.show({
|
|
|
+ content: t("success"),
|
|
|
+ icon: "success",
|
|
|
+ });
|
|
|
+ const walletRes = await getUserMoneyApi();
|
|
|
+ setWallet(walletRes?.data);
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<div className={"userContent"}>
|
|
@@ -360,6 +449,11 @@ export const ProfileHeader = (props: Props) => {
|
|
|
<span>{t("Sacar")}</span>
|
|
|
</p>
|
|
|
</div>
|
|
|
+ <NoBounsWarn
|
|
|
+ visible={isShowNoBounsWarn} // 控制是否显示遮罩层,true 显示,false 不显示
|
|
|
+ onClose={() => setIsShowNoBounsWarn(false)}
|
|
|
+ onConfirm={doConfirm}
|
|
|
+ ></NoBounsWarn>
|
|
|
</>
|
|
|
);
|
|
|
};
|