import { Wallet, cleanBounsApi, getUserMoneyApi, toggleUserBounsApi } from "@/api/user"; import { useWalletStore } from "@/stores/useWalletStore"; import { percentage } from "@/utils/methods"; import { Dialog, ProgressBar, Switch, Toast } from "antd-mobile"; import { useTranslations } from "next-intl"; import React from "react"; import "./style.scss"; const Progress = ({ percent, textColor = "#fff" }: { percent: number; textColor?: string }) => { return (
{percent.toFixed(2)}%
); }; export const WalletContent = ({ percentage, type, difference, current, textColor = "#fff", }: { percentage: number; type: string; difference: number; current: number; textColor?: string; }) => { const t = useTranslations("ProfilePage"); return (
{type} R$ {current}
{t("modalBottomTips")} {difference.toFixed(2)}
); }; // 现金 export const BalanceContent = (props: { wallet: Wallet }) => { const { wallet } = props; const t = useTranslations("ProfilePage"); return ( <> ); }; export const BonusContent = (props: { wallet: Wallet; handleAcquire?: any }) => { const { wallet, handleAcquire } = props; const [switchValue, setSwitchValue] = React.useState( wallet.is_open_no_bonus === 1 || false ); const [isLoading, setIsLoading] = React.useState(false); const { setWallet } = useWalletStore((state) => ({ setWallet: state.setWallet })); const t = useTranslations("ProfilePage"); const changeValue = async (value: boolean) => { const confirmRes = await Dialog.confirm({ content: (
{value ? t("switchOpen") : t("switchClose")}
), confirmText: t("sure"), cancelText: t("cancel"), bodyStyle: { backgroundColor: "#373737", color: "#fff", }, bodyClassName: "customConfirm", }); if (!confirmRes) return; setIsLoading(true); try { const res = await toggleUserBounsApi(value ? 1 : 0); if (!(res?.code && res?.data?.code === 0)) { throw new Error("error"); } setSwitchValue(value); } finally { setIsLoading(false); } }; const doHandle = async () => { const confirmRes = await Dialog.confirm({ content:
{t("clean")}
, confirmText: t("sure"), cancelText: t("cancel"), bodyStyle: { backgroundColor: "#373737", color: "#fff", }, bodyClassName: "customConfirm", }); if (!confirmRes) return; 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 (

{t("bonusArticle")}

  • {t("bonusDesc1")}
  • {t("bonusDesc2")}
  • {t("bonusDesc3")}
{t("bounsTitle1")}
  • {t("bonusDesc4")}
  • {t("bonusDesc5")}
  • {t("bonusDesc6")}
{handleAcquire && ( handleAcquire(2, wallet.is_point_transfer)} > {t("carteira")} )}
); }; export const FreeContent = ({ wallet, handleAcquire, textColor = "#fff", }: { wallet: Wallet; handleAcquire?: any; textColor?: string; }) => { // const { wallet, handleAcquire } = props; const t = useTranslations("ProfilePage"); return (

{t("freeArticle")}

  • {t("freeDesc1")}
  • {t("freeDesc2")}
  • {t("freeDesc3")} {wallet?.free_transfer_ratio}:1
  • {t("freeDesc4", { n: wallet.free_transfer_max ?? 0 })}
{handleAcquire && ( = (wallet?.free_transfer_min || 0) ? "active" : ""}`} onClick={() => handleAcquire(3, wallet.is_free_transfer)} > {t("carteira")} )}

Valor minimo de transferência de {wallet?.free_transfer_min}

); }; export const ReplayContent = ({ wallet, handleAcquire, textColor = "#fff", }: { wallet: Wallet; handleAcquire?: any; textColor?: string; }) => { const t = useTranslations("ProfilePage"); return (

{t("replayArticle")}

  • {t("replayDesc1")}
  • {t("replayDesc2")}
  • {t("replayDesc3")} {wallet?.lose_transfer_ratio}:1
  • {t("replayDesc4", { n: wallet.lose_transfer_max ?? 0 })}
{handleAcquire && ( = (wallet?.lose_transfer_min || 0) ? "active" : ""}`} onClick={() => handleAcquire(4, wallet.is_lose_transfer)} > {t("carteira")} )}

Valor minimo de transferência de {wallet?.lose_transfer_min}

); }; // const WalletDescribeModal = () => { // const [tipsStatus, setTipsStatus] = useState("Bonus"); // const tipsRef = useRef(null); // const wallet: any = {}; // const t = useTranslations("ProfilePage"); // // return ( // // // {t("modalTitle")} // // } // > // {/*现金*/} // {tipsStatus === WalletEnum.Balance ? : null} // {/* 彩金*/} // {tipsStatus === WalletEnum.Bonus ? : null} // {/* 免费币 */} // {tipsStatus === WalletEnum.Free ? : null} // {/* 重玩币 */} // {tipsStatus === WalletEnum.Replay ? : null} // // ); // }; // export default WalletDescribeModal;