package com.zxhl.cms.utils;

import android.content.Intent;
import android.util.Log;

import com.zxhl.cms.AppContext;
import com.zxhl.cms.router.RounterApi;
import com.zxhl.cms.router.RounterBus;

/**
 * Created by gaoleichao on 2019/3/12
 */
public class JumpUtils {

    public static void activityJump(Intent intent) {
        try {
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void loginJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentLogin();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void RightsDetailJump(String brandName, String brandUrl) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentRightsDetail(brandName, brandUrl);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    //零元购
    public static void ZeroBuyJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentZeroBuyList();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    //tb商品详情
    public static void TbGoodsDetailJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentTbGoodsDetail();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    //开会员订单
    public static void MemberOrderJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentMemberOrder();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    //开会员
    public static void OpenMember() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentOpenMember();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void AfterLoginJump(String boxid, String needprice, String type, String onePrice, String fivePrice, String newPeople, String page) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentAfterLogin(boxid, needprice, type, onePrice, fivePrice, newPeople, page);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void AfterLoginJump(String boxid, String needprice, String type, String onePrice, String fivePrice, String newPeople, String page, int selectNum, Double selectPrice) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentAfterLogin(boxid, needprice, type, onePrice, fivePrice, newPeople, page, selectNum + "", selectPrice + "");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void videoClipsJump(int pos) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityVideoClips(pos + "");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void memberJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityMembers();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void payJump(String boxid, String needprice, String type, String onePrice, String fivePrice, String newPeople, String page) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityPay(boxid, needprice, type, onePrice, fivePrice, newPeople, page);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void payJump(String boxid, String needprice, String type, String onePrice, String fivePrice, String newPeople, String page, int selectNum, Double selectPrice) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityPay(boxid, needprice, type, onePrice, fivePrice, newPeople, page, selectNum + "", selectPrice + "");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void goodsDetailJump(String boxid) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityGoodsDetail(boxid);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void lotteryBoxJump(String boxid, String type, String price) {
        try {
            if (boxid != null) {
                return;
            }
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityLotteryBoxJump(boxid, type, price, "");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void lotteryBoxJump(String boxid, String type, String price, String depotIds) {
        try {
            if (boxid != null) {
                return;
            }
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityLotteryBoxJump(boxid, type, price, depotIds);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void lotteryReslutJump(String boxid, String type, String price, String depotIds) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityLotteryReslutJump(boxid, type, price, depotIds);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void ReceiveAddressReslutJump(String isDefault) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityReceiveAddressJump(isDefault);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void EditAddressReslutJump(String id, String username, String mobile, String region, String address, String defaultAddress) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityEditAddressJump(id, username, mobile, region, address, defaultAddress);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void OrderDetailJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityOrderDetail();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void OrderSuccessJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityOrderSuccess();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void ShipmentSuccessJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityShipmentSuccess();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void LogisticsJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityLogistics();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void MyOrderJump(String type) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityMyOrder(type);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void MyMagicCoinJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityMyMagicCoin();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void WareHouseJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityWareHouse();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void SubmitJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivitySubmit();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void WeekAchieveJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityWeekAchieve();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void SettingJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivitySetting();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void YfsDetailJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentYfsDetail();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void SelectBoxDetailJump(String boxId) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentSelectBoxDetail(boxId);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void BoxResultDetailJump(String boxName, String boxId, String characterId, String uid) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentBoxResultDetail(boxName, boxId, characterId, uid);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }


    public static void videoResultJump(String url) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityVideoResult(url);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void webJump(String title, String url) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityWeb(title, url);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void h5Jump(String url) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityH5(url);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void CardVoucherJump(String brand) {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentCardVoucher(brand);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void CardDetailJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentCardDetail();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void FlashSaleJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentFlashSale();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void WithdrawalJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentWithdrawal();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void BuyMemberJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentBuyMember();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void ConfigBuyJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentConfigBuy();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }

    public static void AbuoutUsJump() {
        try {
            Intent intent = RounterBus.getRounter(RounterApi.class).getIntentAboutUs();
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            AppContext.get().startActivity(intent);
        } catch (Exception e) {
            Utils.showToast(AppContext.get(), "该版本暂不支持，请更新版本！");
        }
    }
}
