1.首页充值

This commit is contained in:
qyy
2025-10-15 10:07:02 +08:00
committed by 梁小江
parent 99bc57a2f0
commit e7b1ab75df
20 changed files with 269 additions and 54 deletions

View File

@@ -855,6 +855,24 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
private void heavenGiftDialog(){
HeavenGiftDialog heavenGiftDialog = new HeavenGiftDialog(this);
heavenGiftDialog.show();
heavenGiftDialog.setOnFirstChargeListener(new HeavenGiftDialog.OnFirstChargeListener() {
@Override
public void onFirstChargeConfirmed(HeavenGiftBean giftBean, int type) {
String giftId="";
String money="";
if (giftBean.getGift_list().size()!=0) {
giftId = giftBean.getGift_bag_id()+"";
money = giftBean.getMoney();
}
RechargeDialogFragment.show(null, money, getSupportFragmentManager(),giftId,type+"");
}
@Override
public void onFirstChargeCancelled() {
}
});
}
// TODO: 2025/10/12 新人好礼
@@ -871,23 +889,36 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
newPeopleDialog.setOnFirstChargeListener(new NewPeopleDialog.OnFirstChargeListener() {
@Override
public void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type) {
String s = null;
if (type == 1) {
s = giftBean.getGift_bag().get(0).getMoney();
// 初始化默认值
String money = "";
String giftBagId = "";
List<FirstChargeGiftBean.GiftBag> giftBags = giftBean != null ? giftBean.getGift_bag() : null;
} else if (type == 2) {
s = giftBean.getGift_bag().get(1).getMoney();
} else if (type == 3) {
s = giftBean.getGift_bag().get(2).getMoney();
}else if (type==4){
s = giftBean.getGift_bag().get(3).getMoney();
}
if (s == null) {
// 校验数据有效性
if (giftBags == null || giftBags.isEmpty()) {
ToastUtils.showShort("暂无礼物");
return;
}
RechargeDialogFragment.show(null, s, getSupportFragmentManager());
// 计算索引type从1开始对应索引0
int index = type - 1;
// 索引安全校验 + 数据获取
if (index >= 0 && index < giftBags.size()) {
FirstChargeGiftBean.GiftBag currentGift = giftBags.get(index);
money = currentGift.getMoney();
giftBagId = currentGift.getGift_bag_id();
}
// 最终数据校验
if (money == null) {
ToastUtils.showShort("暂无礼物");
return;
}
// 显示对话框
RechargeDialogFragment.show(null, money, getSupportFragmentManager(), giftBagId, "3");
}
@Override
@@ -914,21 +945,18 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
firstChargeDialog.setOnFirstChargeListener(new FirstChargeDialog.OnFirstChargeListener() {
@Override
public void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type) {
String s = null;
if (type == 1) {
String s = "";
String gift_bag_id= "";
if (giftBean.getGift_bag().size()!=0) {
gift_bag_id = giftBean.getGift_bag().get(0).getGift_bag_id();
s = giftBean.getGift_bag().get(0).getMoney();
} else if (type == 2) {
s = giftBean.getGift_bag().get(1).getMoney();
} else if (type == 3) {
s = giftBean.getGift_bag().get(2).getMoney();
}
if (s == null) {
ToastUtils.showShort("暂无礼物");
return;
}
RechargeDialogFragment.show(null, s, getSupportFragmentManager());
RechargeDialogFragment.show(null, s, getSupportFragmentManager(),gift_bag_id,"1");
}
@Override