| | |
| | | @IBOutlet weak var label_wpCoin: UILabel! |
| | | @IBOutlet weak var label_coin: UILabel! |
| | | @IBOutlet weak var btn_becomeVIP: UIButton! |
| | | var benefitHomeModel:BenefitHomeModel? |
| | | @IBOutlet weak var view_top: UIView! |
| | | @IBOutlet weak var coinCollectionView: UICollectionView! |
| | | @IBOutlet weak var btn_coupon: UIButton! |
| | | @IBOutlet weak var btn_shopping: UIButton! |
| | | var benefitHomeModel:BenefitHomeModel? |
| | | private var models = [StartClouseExploreModel]() |
| | | |
| | | // private var items = ["我的二维码","我的订场","社区世界杯","已报名活动","我的运动营","人员管理","我的券包","兑换记录","消费记录","积分明细","我的玩湃币"] |
| | | private var items = ["我的二维码","我的订场","社区世界杯","已报名活动","我的运动营","人员管理","我的券包","兑换记录","消费记录","积分明细"] |
| | | private var items = ["我的二维码","我的订场","社区世界杯","已报名活动","我的运动营","人员管理","我的券包","兑换记录","消费记录","积分明细","玩湃惠民卡"] |
| | | // private var itemsImg = ["me_code","me_yard","me_wordCup","me_activity","me_camp","me_peoples","me_coupons","me_withdrawRec","me_consume","me_coin","me_payCoin","me_judge"] |
| | | private var itemsImg = ["me_code","me_yard","me_wordCup","me_activity","me_camp","me_peoples","me_coupons","me_withdrawRec","me_consume","me_coin"] |
| | | private var itemsImg = ["me_code","me_yard","me_wordCup","me_activity","me_camp","me_peoples","me_coupons","me_withdrawRec","me_consume","me_coin","me_card"] |
| | | |
| | | override func viewDidDisappear(_ animated: Bool) { |
| | | super.viewDidDisappear(animated) |
| | |
| | | override func viewDidAppear(_ animated: Bool) { |
| | | super.viewDidAppear(animated) |
| | | getData() |
| | | // navigationController?.isNavigationBarHidden = true |
| | | } |
| | | |
| | | override func setUI() { |
| | | banner_collectionView.delegate = self |
| | | banner_collectionView.dataSource = self |
| | | banner_collectionView.register(UINib(nibName: "SearchBannerCCell", bundle: nil), forCellWithReuseIdentifier: "_SearchBannerCCell") |
| | | banner_collectionView.contentInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20) |
| | | func_collectionView.delegate = self |
| | | func_collectionView.dataSource = self |
| | | func_collectionView.register(UINib(nibName: "FindItemCCell", bundle: nil), forCellWithReuseIdentifier: "_FindItemCCell") |
| | | func_collectionView.contentInset = UIEdgeInsets(top: 25, left: 0, bottom: 25, right: 0) |
| | | |
| | | coinCollectionView.delegate = self |
| | | coinCollectionView.dataSource = self |
| | | coinCollectionView.register(UINib(nibName: "WelfareCoinCCell", bundle: nil), forCellWithReuseIdentifier: "_WelfareCoinCCell") |
| | | |
| | | |
| | | //临时隐藏会员功能按钮 |
| | |
| | | img_vipMedal.isHidden = true |
| | | btn_becomeVIP.isEnabled = false |
| | | //临时隐藏会员功能按钮 |
| | | let rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "btn_s_setting"), style: .plain, target: self, action: #selector(settingAction)) |
| | | rightBarButtonItem.tintColor = .white |
| | | navigationItem.rightBarButtonItem = rightBarButtonItem |
| | | } |
| | | |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | view_top.jq_addShadows(shadowColor: .black.withAlphaComponent(0.1), corner: 10, radius: 5, offset: CGSize(width: 10, height: 0), opacity: 1) |
| | | } |
| | | |
| | | private func getData(){ |
| | |
| | | //临时隐藏会员功能按钮 |
| | | |
| | | |
| | | if let coupon = model.image?.myConpons{ |
| | | self?.btn_coupon.sd_setImage(with: URL(string: coupon), for: .normal, placeholderImage: nil,context: nil) |
| | | } |
| | | |
| | | if let onlineShop = model.image?.onlineShop{ |
| | | self?.btn_shopping.sd_setImage(with: URL(string: onlineShop), for: .normal, placeholderImage: nil,context: nil) |
| | | } |
| | | |
| | | if model.referee == 1{ |
| | | if !weakSelf.items.contains(where: {$0 == "裁判入口"}){ |
| | | self?.items.append("裁判入口") |
| | |
| | | self?.func_collectionView.reloadData() |
| | | } |
| | | } |
| | | self?.coinCollectionView.reloadData() |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | |
| | | // Services.benefitHome().subscribe(onNext: {[weak self] data in |
| | | // if let model = data.data{ |
| | | // self?.benefitHomeModel = model |
| | | // |
| | | // } |
| | | // }) { error in |
| | | // |
| | | // }.disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | @IBAction func shoppingAction(_ sender: UIButton) { |
| | | CommonAlertView.show(title: "提示", content: "即将打开京东,是否继续?") { status in |
| | | if status{ |
| | | |
| | | if UIApplication.shared.canOpenURL(URL(string: "openApp.jdMobile://")!){ |
| | | let url = "openApp.jdMobile://virtual?params={\"category\":\"jump\",\"des\":\"jshopMain\",\"shopId\":\"15995015\",\"sourceType\":\"APP\",\"sourceValue\":\"1000\",\"landPageId\":\"iOS\"}" |
| | | UIApplication.shared.open(URL(string: url)!) |
| | | }else{ |
| | | let url = "https://shop.m.jd.com/shop/home?shopId=15995015" |
| | | UIApplication.shared.open(URL(string: url)!) |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @IBAction func couponsAction(_ sender: UIButton) { |
| | | let vc = WelfareCouponsListVC() |
| | | push(vc: vc) |
| | | } |
| | | |
| | | @IBAction func becomeVIPAction(_ sender: Any) { |
| | | let vc = JoinMemberIntroduceVC() |
| | | push(vc: vc) |
| | |
| | | case "我的玩湃币": |
| | | let vc = RechargeRecordVC(coin: benefitHomeModel?.wpCoin ?? 0,subtype: .coin) |
| | | push(vc: vc) |
| | | case "玩湃惠民卡": |
| | | let vc = MyCardListVC() |
| | | self.push(vc: vc) |
| | | case "裁判入口": |
| | | let vc = JudgeListVC() |
| | | push(vc: vc) |
| | |
| | | if collectionView == func_collectionView{ |
| | | return items.count |
| | | } |
| | | |
| | | if collectionView == coinCollectionView{ |
| | | return benefitHomeModel?.commodities.count ?? 0 |
| | | } |
| | | |
| | | return models.count |
| | | } |
| | | |
| | |
| | | cell.img_avar.image = UIImage(named: itemsImg[indexPath.row]) |
| | | return cell |
| | | } |
| | | |
| | | if collectionView == coinCollectionView{ |
| | | let model = benefitHomeModel!.commodities[indexPath.row] |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_WelfareCoinCCell", for: indexPath) as! WelfareCoinCCell |
| | | cell.label_name.text = model.commodityName |
| | | |
| | | switch model.redemptionMethod { |
| | | case 1: //积分 |
| | | cell.label_price.text = "\(model.integral)积分" |
| | | case 2: //现金+积分 |
| | | cell.label_price.text = "\(model.integral)积分+\(model.commodityPrice.currency())" |
| | | case 3://现金 |
| | | cell.label_price.text = "\(model.commodityPrice.currency())" |
| | | default: |
| | | cell.label_price.text = "" |
| | | } |
| | | |
| | | |
| | | cell.img_cover.sd_setImage(with: URL(string: model.commodityImg), placeholderImage: nil) |
| | | return cell |
| | | } |
| | | |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_SearchBannerCCell", for: indexPath) as! SearchBannerCCell |
| | | let model = models[indexPath.row] |
| | |
| | | if collectionView == func_collectionView{ |
| | | return 0 |
| | | } |
| | | return 0 |
| | | if collectionView == coinCollectionView{ |
| | | return 0 |
| | | } |
| | | return 14 |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { |
| | | if collectionView == func_collectionView{ |
| | | return 0 |
| | | } |
| | | return 0 |
| | | if collectionView == coinCollectionView{ |
| | | return 0 |
| | | } |
| | | return 14 |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { |
| | | if collectionView == func_collectionView{ |
| | | return CGSize(width: JQ_ScreenW/4, height: 120) |
| | | } |
| | | return CGSize(width: JQ_ScreenW, height: JQ_ScreenW * 0.6541) |
| | | if collectionView == coinCollectionView{ |
| | | return CGSize(width: 144.0, height: 178) |
| | | } |
| | | return CGSize(width: JQ_ScreenW * 0.743, height: JQ_ScreenW * 0.743 * 0.931) |
| | | } |
| | | } |
| | | |