year 3 giorni fa
parent
commit
04dca039e4
1 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. 7 7
      src/app/[locale]/(navbar)/vip/VipCard.tsx

+ 7 - 7
src/app/[locale]/(navbar)/vip/VipCard.tsx

@@ -55,8 +55,8 @@ const VipCard: React.FC<Props> = ({ actKey = 0, onChange, vipInfo }) => {
             onChange(curIdx);
         }
     };
-    const getNextVip = (curId: number) => {
-        const nextId = curId + 1;
+    const getCurVip = (curId: number) => {
+        const nextId = curId;
         let result = vipInfo?.level_info.find((item) => item.id === nextId);
 
         if (!result) {
@@ -80,9 +80,9 @@ const VipCard: React.FC<Props> = ({ actKey = 0, onChange, vipInfo }) => {
                 {!!vipInfo?.level_info?.length &&
                     vipInfo.level_info.map((item) => {
                         const curVipCfg = VipProgressMap.get(item?.id || 0) as VipItem;
-                        const nextVip = getNextVip(item.id);
-                        const payPercent = (vipInfo.vip_pay_exp / (nextVip?.pay || 1)) * 100;
-                        const betPercent = (vipInfo.vip_exp / (nextVip?.bet || 1)) * 100;
+                        const curVip = getCurVip(item.id);
+                        const payPercent = (vipInfo.vip_pay_exp / (curVip?.pay || 1)) * 100;
+                        const betPercent = (vipInfo.vip_exp / (curVip?.bet || 1)) * 100;
                         return (
                             <SwiperSlide key={item.id}>
                                 <div
@@ -107,7 +107,7 @@ const VipCard: React.FC<Props> = ({ actKey = 0, onChange, vipInfo }) => {
                                                         </span>
                                                         <span className="text-[var(--textColor1)]">
                                                             &nbsp;/&nbsp;
-                                                            {formatAmount(nextVip?.pay || 0)}
+                                                            {formatAmount(curVip?.pay || 0)}
                                                         </span>
                                                     </div>
                                                 </div>
@@ -155,7 +155,7 @@ const VipCard: React.FC<Props> = ({ actKey = 0, onChange, vipInfo }) => {
                                                         </span>
                                                         <span className="text-[var(--textColor1)]">
                                                             &nbsp;/&nbsp;
-                                                            {formatAmount(nextVip?.bet || 0)}
+                                                            {formatAmount(curVip?.bet || 0)}
                                                         </span>
                                                     </div>
                                                 </div>