|
@@ -1,5 +1,5 @@
|
|
|
"use client";
|
|
|
-import { DepositsTypes } from "@/api/depositsApi";
|
|
|
+import { DepositsTypes, RewardsType } from "@/api/depositsApi";
|
|
|
import { getUserRechargeApi } from "@/api/user";
|
|
|
import Box from "@/components/Box";
|
|
|
import { useUserInfoStore } from "@/stores/useUserInfoStore";
|
|
@@ -15,12 +15,47 @@ import Image from "next/image";
|
|
|
interface Props {
|
|
|
deposits: DepositsTypes[];
|
|
|
}
|
|
|
+
|
|
|
+interface RewardsProps {
|
|
|
+ rewards: RewardsType[];
|
|
|
+}
|
|
|
+const RewardsText: FC<RewardsProps> = (props) => {
|
|
|
+ const { rewards } = props;
|
|
|
+ // {/*1现金2彩金3免费币4重玩币*/}
|
|
|
+ const t = useTranslations();
|
|
|
+ const calcRewards = rewards
|
|
|
+ .map((item) => {
|
|
|
+ // 设置基础奖励文本
|
|
|
+ let text = item.ratio > 0 ? `${item.reward}%` : `${item.reward}`;
|
|
|
+ // 根据coin_type添加后缀
|
|
|
+ const suffixes = {
|
|
|
+ 1: t("ProfilePage.Saldo"),
|
|
|
+ 2: t("ProfilePage.Saldo"),
|
|
|
+ 3: t("ProfilePage.free"),
|
|
|
+ 4: t("ProfilePage.replay"),
|
|
|
+ };
|
|
|
+ // 如果coin_type在suffixes中存在,则添加相应的后缀
|
|
|
+ if (suffixes.hasOwnProperty(item.coin_type)) {
|
|
|
+ text += suffixes[item.coin_type];
|
|
|
+ }
|
|
|
+
|
|
|
+ return text;
|
|
|
+ })
|
|
|
+ .join(",");
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div className={"flex flex-1 flex-wrap break-all"}>
|
|
|
+ <span className="amountTips">+</span>
|
|
|
+ <span className="amountTips">{calcRewards} </span>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
const DepositData: FC<Props> = (props) => {
|
|
|
const { deposits } = props;
|
|
|
const t = useTranslations();
|
|
|
const userInfo = useUserInfoStore((state) => state.userInfo);
|
|
|
|
|
|
- const count = 2;
|
|
|
+ const count = 3;
|
|
|
// 选中类型
|
|
|
const [activeType, setActiveType] = useState<DepositsTypes>(deposits[0]);
|
|
|
|
|
@@ -175,9 +210,13 @@ const DepositData: FC<Props> = (props) => {
|
|
|
<span className="iconfont">R$</span>
|
|
|
<span> {item.amount}</span>
|
|
|
</div>
|
|
|
- <span className="amountTips">
|
|
|
- {t("DepositPage.Oferecer")} 100%
|
|
|
- </span>
|
|
|
+ <div className={"flex"}>
|
|
|
+ <RewardsText rewards={item.rewards} />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/*<span className="amountTips">*/}
|
|
|
+ {/* {t("DepositPage.Oferecer")} 100%*/}
|
|
|
+ {/*</span>*/}
|
|
|
</li>
|
|
|
))}
|
|
|
</ul>
|