Ver Fonte

feat: 修改nobouns

year há 1 mês atrás
pai
commit
93782a8e14

+ 2 - 1
messages/br.json

@@ -190,7 +190,8 @@
         "switchClose": "Desligue o modo sem bônus ou não? ",
         "bouns6001": "Condições não satisfeitas",
         "bouns6002": "No Bouns está aberto, não é possível receber",
-        "success": "Sucesso"
+        "success": "Sucesso",
+        "depositeWarn": "Você está no modo sem bônus. Continuar?"
     },
     "DepositPage": {
         "Montante": "Montante",

BIN
public/warn_top.png


+ 2 - 0
src/api/user.ts

@@ -282,6 +282,8 @@ export interface Wallet {
      * 重玩币最小提现金额
      */
     lose_transfer_max?: number;
+
+    no_bonus_config?: number;
 }
 // 前台用户获取金额信息
 export const getUserMoneyApi = () => {

+ 24 - 9
src/app/[locale]/(TabBar)/deposit/DepositData.tsx

@@ -1,24 +1,24 @@
 "use client";
 import { DepositsTypes, RewardsType } from "@/api/depositsApi";
 import { getUserMoneyApi, getUserRechargeApi } from "@/api/user";
+import actions from "@/app/[locale]/(TabBar)/deposit/actions";
 import Box from "@/components/Box";
 import ButtonOwn from "@/components/ButtonOwn";
-import TipsModal, { ModalProps } from "@/components/TipsModal";
-import { useUserInfoStore } from "@/stores/useUserInfoStore";
-import { neReg } from "@/utils";
-import { Button, Form, Input, Toast } from "antd-mobile";
-import { FormInstance } from "antd-mobile/es/components/form";
-import { useTranslations } from "next-intl";
-import { FC, useLayoutEffect, useRef, useState } from "react";
-
-import actions from "@/app/[locale]/(TabBar)/deposit/actions";
 import Empty from "@/components/Empty";
+import TipsModal, { ModalProps } from "@/components/TipsModal";
 import { useEventPoint } from "@/hooks/useEventPoint";
 import { useRouter } from "@/i18n/routing";
 import { useSystemStore } from "@/stores/useSystemStore";
+import { useUserInfoStore } from "@/stores/useUserInfoStore";
+import { useWalletStore } from "@/stores/useWalletStore";
 import "@/styles/deposit.scss";
+import { neReg } from "@/utils";
 import { server } from "@/utils/client";
+import { Button, Dialog, Form, Input, Toast } from "antd-mobile";
+import { FormInstance } from "antd-mobile/es/components/form";
 import clsx from "clsx";
+import { useTranslations } from "next-intl";
+import { FC, useLayoutEffect, useRef, useState } from "react";
 import { Swiper, SwiperSlide } from "swiper/react";
 interface Props {}
 
@@ -82,6 +82,7 @@ const DepositData: FC<Props> = (props) => {
     const t = useTranslations();
     const router = useRouter();
     const userInfo = useUserInfoStore((state) => state.userInfo);
+    const wallet = useWalletStore((state) => state.wallet);
     const { eventInitiate } = useEventPoint();
 
     const isStrictMode = useSystemStore((state) => state.identity_verify.deposit === 1);
@@ -102,6 +103,20 @@ const DepositData: FC<Props> = (props) => {
     const tipModelRef = useRef<ModalProps>(null); // 充值清空打码量弹窗
     const [formData, setFormData] = useState<any>({}); // 存放表单数据
     const onFinish = async (values: any) => {
+        if (wallet?.is_open_no_bonus) {
+            const confirmRes = await Dialog.confirm({
+                content: <div className="text-[#fff]">{t(`ProfilePage.depositeWarn`)}</div>,
+                confirmText: t("ProfilePage.sure"),
+                cancelText: t("ProfilePage.cancel"),
+                bodyStyle: {
+                    backgroundColor: "#373737",
+                    color: "#fff",
+                },
+                bodyClassName: "customConfirm",
+            });
+            if (!confirmRes) return;
+        }
+
         const params = { ...values, channel_id: activeType.id, amount: +values.amount };
         const res = await getUserMoneyApi();
         if (res.data?.tips_reset_rollover) {

+ 98 - 4
src/app/[locale]/(TabBar)/profile/ProfileHeader.tsx

@@ -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>
         </>
     );
 };

+ 17 - 0
src/app/globals.scss

@@ -229,3 +229,20 @@ input[type="number"] {
         font-size: 144px;
     }
 }
+.customConfirm {
+    background-color: #373737 !important;
+    .adm-dialog-action-row {
+        flex-direction: row-reverse;
+        border-top: 0.5px solid #8f8f8f !important;
+        button {
+            color: #fff !important;
+            &:nth-child(1) {
+                border-right: none !important;
+                border-left: 0.5px solid #8f8f8f !important;
+                color: red !important;
+            }
+        }
+    }
+    .adm-dialog-footer {
+    }
+}

+ 0 - 17
src/components/ModalPopup/WalletDescribeModal/style.scss

@@ -70,20 +70,3 @@
         }
     }
 }
-.customConfirm {
-    background-color: #373737 !important;
-    .adm-dialog-action-row {
-        flex-direction: row-reverse;
-        border-top: 0.5px solid #8f8f8f !important;
-        button {
-            color: #fff !important;
-            &:nth-child(1) {
-                border-right: none !important;
-                border-left: 0.5px solid #8f8f8f !important;
-                color: red !important;
-            }
-        }
-    }
-    .adm-dialog-footer {
-    }
-}

+ 4 - 3
src/stores/useWalletStore.ts

@@ -39,12 +39,13 @@ const initialState: State = {
         total_red_packet: 0,
         total_score_rollover: 0,
         user_name: "",
-
+        no_bonus_config: 0,
         notice: {
             lose_score: 0,
         },
-      free_transfer_max: 0,
-      lose_transfer_max: 0,
+
+        free_transfer_max: 0,
+        lose_transfer_max: 0,
     },
     score: undefined,
 };