Kaynağa Gözat

fix:修改首充文本显示

Before 8 ay önce
ebeveyn
işleme
c4f2100376

+ 12 - 2
src/app/[locale]/(TabBar)/deposit/DepositData.tsx

@@ -25,8 +25,7 @@ const RewardsText: FC<RewardsProps> = (props) => {
     const t = useTranslations();
     const calcRewards = rewards
         .map((item) => {
-            // 设置基础奖励文本
-            let text = item.ratio > 0 ? `${item.reward}%` : `${item.reward}`;
+            // let text = item.ratio > 0 ? `${item.ratio}%` : `${item.reward}`;
             // 根据coin_type添加后缀
             const suffixes = {
                 1: t("ProfilePage.Saldo"),
@@ -34,6 +33,17 @@ const RewardsText: FC<RewardsProps> = (props) => {
                 3: t("ProfilePage.free"),
                 4: t("ProfilePage.replay"),
             };
+            let text = "";
+            // 设置基础奖励文本
+            if (item.ratio > 0) {
+                text = `${item.ratio}`;
+            } else {
+                text = `${item.reward}`;
+            }
+            if (item.ratio > 0 && item.reward > 0) {
+                text = `${item.ratio}%${suffixes[item.coin_type]}, ${item.reward}`;
+            }
+
             // 如果coin_type在suffixes中存在,则添加相应的后缀
             if (suffixes.hasOwnProperty(item.coin_type)) {
                 text += suffixes[item.coin_type];

+ 15 - 5
src/app/[locale]/(navbar)/doings/discount/DepositData.tsx

@@ -25,8 +25,6 @@ const RewardsText: FC<RewardsProps> = (props) => {
     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"),
@@ -34,6 +32,17 @@ const RewardsText: FC<RewardsProps> = (props) => {
                 3: t("ProfilePage.free"),
                 4: t("ProfilePage.replay"),
             };
+            let text = "";
+            // 设置基础奖励文本
+            if (item.ratio > 0) {
+                text = `${item.ratio}`;
+            } else {
+                text = `${item.reward}`;
+            }
+            if (item.ratio > 0 && item.reward > 0) {
+                text = `${item.ratio}%${suffixes[item.coin_type]}, ${item.reward}`;
+            }
+
             // 如果coin_type在suffixes中存在,则添加相应的后缀
             if (suffixes.hasOwnProperty(item.coin_type)) {
                 text += suffixes[item.coin_type];
@@ -45,8 +54,7 @@ const RewardsText: FC<RewardsProps> = (props) => {
 
     return (
         <div className={"flex flex-1 flex-wrap break-all"}>
-            <span className="amountTips">+</span>
-            <span className="amountTips">{calcRewards} </span>
+            <span className="amountTips">+ {calcRewards} </span>
         </div>
     );
 };
@@ -211,7 +219,9 @@ const DepositData: FC<Props> = (props) => {
                                                 <span> {item.amount}</span>
                                             </div>
                                             <div className={"flex"}>
-                                                <RewardsText rewards={item.rewards} />
+                                                {item.rewards && (
+                                                    <RewardsText rewards={item.rewards} />
+                                                )}
                                             </div>
 
                                             {/*<span className="amountTips">*/}