| | |
| | | import JQTools |
| | | |
| | | class PaymentResultVC: BaseVC { |
| | | |
| | | enum PaymentResult:Equatable{ |
| | | case success |
| | | case fail(String,Int) |
| | | } |
| | | enum PaymentObjType{ |
| | | case member //会员 |
| | | case courseApply //运动营报名 |
| | | case courseSUPApply //运动营报名[体验] |
| | | case activityApply //活动报名 |
| | | case yard //场地预约 |
| | | case games //游戏 |
| | | case exchange //替换 |
| | | case recharge //充值 |
| | | } |
| | | |
| | | |
| | | @IBOutlet weak var img_paymentState: UIImageView! |
| | | @IBOutlet weak var label_content: UILabel! |
| | | @IBOutlet weak var collectionView: UICollectionView! |
| | | @IBOutlet weak var btn_backHome: UIButton! |
| | | @IBOutlet weak var btn_again: UIButton! |
| | | @IBOutlet weak var btn_back: UIButton! |
| | | |
| | | private var result:PaymentResult! |
| | | private var objType:PaymentObjType! |
| | | private var courseConfigId:Int? |
| | | private var handleVC:UIViewController? |
| | | private var models = [Any]() //CouponInfoModel ,CourseCouponModel |
| | | private var againClouse:(()->Void)? |
| | | |
| | | var isExtend:Bool = false |
| | | var otherInfo:Dictionary<String,Any>? |
| | | |
| | | required init(result:PaymentResult,objType:PaymentObjType,handleVC:UIViewController? = nil,courseConfigId:Int? = nil,againClouse:(()->Void)? = nil) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.result = result |
| | | self.objType = objType |
| | | self.handleVC = handleVC |
| | | self.againClouse = againClouse |
| | | self.courseConfigId = courseConfigId |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | if result == .success{ |
| | | title = "支付成功" |
| | | img_paymentState.image = UIImage(named: "icon_success") |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil, userInfo: nil) |
| | | }else{ |
| | | title = "支付失败" |
| | | img_paymentState.image = UIImage(named: "icon_fail") |
| | | } |
| | | |
| | | switch objType{ |
| | | case .recharge: |
| | | btn_backHome.isHidden = true |
| | | switch result { |
| | | case .success: |
| | | label_content.text = "充值成功!" |
| | | self.btn_back.setTitle("返回首页", for: .normal) |
| | | self.btn_again.setTitle("查看详情", for: .normal) |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | |
| | | case .fail(let string, let code): |
| | | self.btn_back.setTitle("返回", for: .normal) |
| | | self.btn_again.setTitle("再次支付", for: .normal) |
| | | label_content.text = string |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | |
| | | case .none:break |
| | | enum PaymentResult:Equatable{ |
| | | case success |
| | | case fail(String,Int) |
| | | } |
| | | case .member: |
| | | btn_again.isHidden = result == .success |
| | | btn_back.isHidden = result == .success |
| | | btn_backHome.isHidden = result != .success |
| | | collectionView.isHidden = result != .success |
| | | switch result { |
| | | case .fail(let str, _): |
| | | label_content.text = str |
| | | case .success: |
| | | label_content.text = "支付成功,恭喜您成为玩湃会员!" |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | case .none:break |
| | | } |
| | | Services.queryMemberCoupon(menthod: 2).subscribe(onNext: {[weak self] data in |
| | | if let models = data.data{ |
| | | self?.models = models |
| | | if models.count > 0{ |
| | | self?.label_content.text = "支付成功,恭喜您成为玩湃会员!并获得优惠券!" |
| | | } |
| | | self?.collectionView.reloadData() |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | |
| | | case .courseApply: |
| | | //课时购买 |
| | | btn_backHome.isHidden = true |
| | | if let id = courseConfigId{ |
| | | Services.paymentCourseCouponList(id: id).subscribe(onNext: {[weak self] data in |
| | | if let models = data.data{ |
| | | self?.models = models |
| | | self?.collectionView.reloadData() |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | } |
| | | switch result { |
| | | case .fail(let str,let code): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = str |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | btn_again.setTitle("立即预约", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | label_content.text = "报名成功,请及时预约运动营上课!" |
| | | if isExtend{ |
| | | btn_back.isHidden = true |
| | | btn_again.setTitle("返回", for: .normal) |
| | | label_content.text = "续课成功!" |
| | | } |
| | | case .none:break |
| | | } |
| | | |
| | | case .courseSUPApply: |
| | | //课时购买 |
| | | btn_backHome.isHidden = true |
| | | switch result { |
| | | case .fail(let str,let code): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = str |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | btn_again.setTitle("立即预约", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | label_content.text = "报名成功,请及时预约运动营上课!" |
| | | case .none:break |
| | | enum PaymentObjType{ |
| | | case member //会员 |
| | | case courseApply //运动营报名 |
| | | case courseSUPApply //运动营报名[体验] |
| | | case activityApply //活动报名 |
| | | case worldCup |
| | | case yard //场地预约 |
| | | case games //游戏 |
| | | case exchange //替换 |
| | | case recharge //充值 |
| | | } |
| | | |
| | | case .activityApply: |
| | | btn_backHome.isHidden = true |
| | | collectionView.isHidden = true |
| | | switch result { |
| | | case .fail(let str, let code): |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = str |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | btn_again.setTitle("查看报名", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | label_content.text = "报名成功,请注意活动开始时间!" |
| | | case .none:break |
| | | } |
| | | |
| | | case .yard: |
| | | btn_backHome.isHidden = true |
| | | collectionView.isHidden = true |
| | | switch result { |
| | | case .fail(let str,let code): |
| | | label_content.text = str |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | btn_again.setTitle("查看预约", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | label_content.text = "预约成功,请注意预约开始时间!" |
| | | case .none:break |
| | | @IBOutlet weak var img_paymentState: UIImageView! |
| | | @IBOutlet weak var label_content: UILabel! |
| | | @IBOutlet weak var collectionView: UICollectionView! |
| | | @IBOutlet weak var btn_backHome: UIButton! |
| | | @IBOutlet weak var btn_again: UIButton! |
| | | @IBOutlet weak var btn_back: UIButton! |
| | | |
| | | private var result:PaymentResult! |
| | | private var objType:PaymentObjType! |
| | | private var courseConfigId:Int? |
| | | private var handleVC:UIViewController? |
| | | private var models = [Any]() //CouponInfoModel ,CourseCouponModel |
| | | private var againClouse:(()->Void)? |
| | | |
| | | var isExtend:Bool = false |
| | | var otherInfo:Dictionary<String,Any>? |
| | | |
| | | required init(result:PaymentResult,objType:PaymentObjType,handleVC:UIViewController? = nil,courseConfigId:Int? = nil,againClouse:(()->Void)? = nil) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.result = result |
| | | self.objType = objType |
| | | self.handleVC = handleVC |
| | | self.againClouse = againClouse |
| | | self.courseConfigId = courseConfigId |
| | | } |
| | | |
| | | case .games: |
| | | btn_backHome.isHidden = true |
| | | collectionView.isHidden = true |
| | | switch result { |
| | | case .fail(let str,let code): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = str |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | btn_again.isHidden = true |
| | | btn_back.setTitleColor(.white, for: .normal) |
| | | btn_back.backgroundColor = Def_ThemeColor |
| | | btn_back.setTitle("我的数据", for: .normal) |
| | | label_content.text = "支付成功" |
| | | case .none:break |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | |
| | | } |
| | | |
| | | case .exchange: |
| | | switch result { |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | label_content.text = "兑换成功" |
| | | btn_again.setTitle("查看详情", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | btn_backHome.isHidden = true |
| | | case .fail(let msg, let code): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = msg |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | case .none:break |
| | | } |
| | | case .none:break |
| | | } |
| | | |
| | | |
| | | collectionView.delegate = self |
| | | collectionView.dataSource = self |
| | | collectionView.contentInset = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14) |
| | | collectionView.register(UINib(nibName: "CouponCCell", bundle: nil), forCellWithReuseIdentifier: "_CouponCCell") |
| | | } |
| | | |
| | | @IBAction func paymentAgainAction(_ sender: UIButton) { |
| | | let str = sender.titleLabel?.text ?? "" |
| | | if result == .success{ |
| | | title = "支付成功" |
| | | img_paymentState.image = UIImage(named: "icon_success") |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil, userInfo: nil) |
| | | }else{ |
| | | title = "支付失败" |
| | | img_paymentState.image = UIImage(named: "icon_fail") |
| | | } |
| | | |
| | | switch str{ |
| | | case "查看预约": |
| | | let vc = YardBookingListVC() |
| | | jumpAndRemoveSelfVC(vc) |
| | | case "立即预约": |
| | | navigationController?.qmui_popToRootViewController(animated: true, completion: { () in |
| | | JQ_currentViewController().tabBarController?.selectedIndex = 1 |
| | | }) |
| | | NotificationCenter.default.post(name: UpdateCurrentStore_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | case "查看报名": |
| | | let vc = ActivitySignupListVC() |
| | | jumpAndRemoveSelfVC(vc) |
| | | case "再次支付": |
| | | if objType == .courseApply{ |
| | | navigationController?.popViewController(animated: true, {[weak self] in |
| | | self?.againClouse?() |
| | | }) |
| | | switch objType{ |
| | | |
| | | case.worldCup: |
| | | btn_backHome.isHidden = true |
| | | switch result { |
| | | case .success: |
| | | label_content.text = "报名成功,请等待平台通知具体开赛时间" |
| | | self.btn_back.setTitle("返回首页", for: .normal) |
| | | self.btn_again.setTitle("查看排名", for: .normal) |
| | | |
| | | case .fail(let string, let code): |
| | | self.btn_back.setTitle("返回", for: .normal) |
| | | self.btn_again.setTitle("再次支付", for: .normal) |
| | | label_content.text = string |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .none:break |
| | | } |
| | | case .recharge: |
| | | btn_backHome.isHidden = true |
| | | switch result { |
| | | case .success: |
| | | label_content.text = "充值成功!" |
| | | self.btn_back.setTitle("返回首页", for: .normal) |
| | | self.btn_again.setTitle("查看详情", for: .normal) |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | |
| | | case .fail(let string, let code): |
| | | self.btn_back.setTitle("返回", for: .normal) |
| | | self.btn_again.setTitle("再次支付", for: .normal) |
| | | label_content.text = string |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | |
| | | case .none:break |
| | | } |
| | | case .member: |
| | | btn_again.isHidden = result == .success |
| | | btn_back.isHidden = result == .success |
| | | btn_backHome.isHidden = result != .success |
| | | collectionView.isHidden = result != .success |
| | | switch result { |
| | | case .fail(let str, _): |
| | | label_content.text = str |
| | | case .success: |
| | | label_content.text = "支付成功,恭喜您成为玩湃会员!" |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | case .none:break |
| | | } |
| | | Services.queryMemberCoupon(menthod: 2).subscribe(onNext: {[weak self] data in |
| | | if let models = data.data{ |
| | | self?.models = models |
| | | if models.count > 0{ |
| | | self?.label_content.text = "支付成功,恭喜您成为玩湃会员!并获得优惠券!" |
| | | } |
| | | self?.collectionView.reloadData() |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | |
| | | case .courseApply: |
| | | //课时购买 |
| | | btn_backHome.isHidden = true |
| | | if let id = courseConfigId{ |
| | | Services.paymentCourseCouponList(id: id).subscribe(onNext: {[weak self] data in |
| | | if let models = data.data{ |
| | | self?.models = models |
| | | self?.collectionView.reloadData() |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | } |
| | | switch result { |
| | | case .fail(let str,let code): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = str |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | btn_again.setTitle("立即预约", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | label_content.text = "报名成功,请及时预约运动营上课!" |
| | | if isExtend{ |
| | | btn_back.isHidden = true |
| | | btn_again.setTitle("返回", for: .normal) |
| | | label_content.text = "续课成功!" |
| | | } |
| | | case .none:break |
| | | } |
| | | |
| | | case .courseSUPApply: |
| | | //课时购买 |
| | | btn_backHome.isHidden = true |
| | | switch result { |
| | | case .fail(let str,let code): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = str |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | btn_again.setTitle("立即预约", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | label_content.text = "报名成功,请及时预约运动营上课!" |
| | | case .none:break |
| | | } |
| | | |
| | | case .activityApply: |
| | | btn_backHome.isHidden = true |
| | | collectionView.isHidden = true |
| | | switch result { |
| | | case .fail(let str, let code): |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = str |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | btn_again.setTitle("查看报名", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | label_content.text = "报名成功,请注意活动开始时间!" |
| | | case .none:break |
| | | } |
| | | |
| | | case .yard: |
| | | btn_backHome.isHidden = true |
| | | collectionView.isHidden = true |
| | | switch result { |
| | | case .fail(let str,let code): |
| | | label_content.text = str |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | btn_again.setTitle("查看预约", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | label_content.text = "预约成功,请注意预约开始时间!" |
| | | case .none:break |
| | | } |
| | | |
| | | case .games: |
| | | btn_backHome.isHidden = true |
| | | collectionView.isHidden = true |
| | | switch result { |
| | | case .fail(let str,let code): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = str |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | btn_again.isHidden = true |
| | | btn_back.setTitleColor(.white, for: .normal) |
| | | btn_back.backgroundColor = Def_ThemeColor |
| | | btn_back.setTitle("我的数据", for: .normal) |
| | | label_content.text = "支付成功" |
| | | case .none:break |
| | | } |
| | | |
| | | case .exchange: |
| | | switch result { |
| | | case .success: |
| | | NotificationCenter.default.post(name: UpdateWelfare_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | label_content.text = "兑换成功" |
| | | btn_again.setTitle("查看详情", for: .normal) |
| | | btn_back.setTitle("返回首页", for: .normal) |
| | | btn_backHome.isHidden = true |
| | | case .fail(let msg, let code): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | | btn_back.setTitle("返回", for: .normal) |
| | | label_content.text = msg |
| | | if code == 2{btn_again.setTitle("去充值", for: .normal)} |
| | | |
| | | case .none:break |
| | | } |
| | | case .none:break |
| | | } |
| | | |
| | | |
| | | collectionView.delegate = self |
| | | collectionView.dataSource = self |
| | | collectionView.contentInset = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14) |
| | | collectionView.register(UINib(nibName: "CouponCCell", bundle: nil), forCellWithReuseIdentifier: "_CouponCCell") |
| | | } |
| | | |
| | | if objType == .recharge || objType == .yard{ |
| | | navigationController?.popViewController() |
| | | @IBAction func paymentAgainAction(_ sender: UIButton) { |
| | | let str = sender.titleLabel?.text ?? "" |
| | | |
| | | switch str{ |
| | | case "查看预约": |
| | | let vc = YardBookingListVC() |
| | | jumpAndRemoveSelfVC(vc) |
| | | case "立即预约": |
| | | navigationController?.qmui_popToRootViewController(animated: true, completion: { () in |
| | | JQ_currentViewController().tabBarController?.selectedIndex = 1 |
| | | }) |
| | | NotificationCenter.default.post(name: UpdateCurrentStore_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | case "查看报名": |
| | | let vc = ActivitySignupListVC() |
| | | jumpAndRemoveSelfVC(vc) |
| | | case "再次支付": |
| | | if objType == .courseApply{ |
| | | navigationController?.popViewController(animated: true, {[weak self] in |
| | | self?.againClouse?() |
| | | }) |
| | | } |
| | | |
| | | if objType == .recharge || objType == .yard{ |
| | | navigationController?.popViewController() |
| | | } |
| | | |
| | | case "去充值": |
| | | let vc = RechargeCenterVC() |
| | | jumpAndRemoveSelfVC(vc) |
| | | case "返回": |
| | | navigationController?.popViewController(animated: true, {() in |
| | | |
| | | }) |
| | | |
| | | case "查看详情": |
| | | if objType == .exchange{ |
| | | let vc = WelfareExchangeRecordListVC(pageIndex: 1) |
| | | jumpAndRemoveSelfVC(vc) |
| | | } |
| | | |
| | | if objType == .recharge{ |
| | | for (_,vc) in navigationController!.viewControllers.enumerated(){ |
| | | if vc is RechargeRecordVC{ |
| | | navigationController?.popToViewController(vc, animated: true) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | case "去充值": |
| | | let vc = RechargeCenterVC() |
| | | jumpAndRemoveSelfVC(vc) |
| | | case "返回": |
| | | navigationController?.popViewController(animated: true, {() in |
| | | |
| | | }) |
| | | |
| | | case "查看详情": |
| | | if objType == .exchange{ |
| | | let vc = WelfareExchangeRecordListVC(pageIndex: 1) |
| | | jumpAndRemoveSelfVC(vc) |
| | | private func jumpAndRemoveSelfVC(_ vc:UIViewController){ |
| | | JQ_currentViewController().navigationController?.pushViewController(vc, completion: { |
| | | for (index,subVC) in (JQ_currentViewController().navigationController?.viewControllers ?? []).enumerated(){ |
| | | if subVC is PaymentResultVC{ |
| | | JQ_currentViewController().navigationController?.viewControllers.remove(at: index) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if objType == .recharge{ |
| | | for (_,vc) in navigationController!.viewControllers.enumerated(){ |
| | | if vc is RechargeRecordVC{ |
| | | navigationController?.popToViewController(vc, animated: true) |
| | | break |
| | | } |
| | | } |
| | | |
| | | @IBAction func backAction(_ sender: UIButton) { |
| | | |
| | | if sender.titleLabel?.text == "返回首页"{ |
| | | navigationController?.qmui_popToRootViewController(animated: true, completion: { |
| | | JQ_currentViewController().tabBarController?.selectedIndex = 0 |
| | | }) |
| | | } |
| | | |
| | | if sender.titleLabel?.text == "返回"{ |
| | | navigationController?.popViewController(animated: true, {() in |
| | | |
| | | }) |
| | | } |
| | | |
| | | if sender.titleLabel?.text == "我的数据"{ |
| | | let vc = GamesDataSourceVC() |
| | | jumpAndRemoveSelfVC(vc) |
| | | } |
| | | } |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | private func jumpAndRemoveSelfVC(_ vc:UIViewController){ |
| | | JQ_currentViewController().navigationController?.pushViewController(vc, completion: { |
| | | for (index,subVC) in (JQ_currentViewController().navigationController?.viewControllers ?? []).enumerated(){ |
| | | if subVC is PaymentResultVC{ |
| | | JQ_currentViewController().navigationController?.viewControllers.remove(at: index) |
| | | override var preferredStatusBarStyle: UIStatusBarStyle{ |
| | | return .lightContent |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | @IBAction func backAction(_ sender: UIButton) { |
| | | |
| | | if sender.titleLabel?.text == "返回首页"{ |
| | | navigationController?.qmui_popToRootViewController(animated: true, completion: { |
| | | JQ_currentViewController().tabBarController?.selectedIndex = 0 |
| | | }) |
| | | } |
| | | |
| | | if sender.titleLabel?.text == "返回"{ |
| | | navigationController?.popViewController(animated: true, {() in |
| | | |
| | | }) |
| | | } |
| | | |
| | | if sender.titleLabel?.text == "我的数据"{ |
| | | let vc = GamesDataSourceVC() |
| | | jumpAndRemoveSelfVC(vc) |
| | | } |
| | | } |
| | | |
| | | override var preferredStatusBarStyle: UIStatusBarStyle{ |
| | | return .lightContent |
| | | } |
| | | } |
| | | |
| | | extension PaymentResultVC:UICollectionViewDelegate{ |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | dismiss(animated: true) |
| | | handleVC?.navigationController?.popToRootViewController(animated: false) |
| | | let vc = WelfareCouponsListVC() |
| | | vc.hidesBottomBarWhenPushed = true |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | } |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | dismiss(animated: true) |
| | | handleVC?.navigationController?.popToRootViewController(animated: false) |
| | | let vc = WelfareCouponsListVC() |
| | | vc.hidesBottomBarWhenPushed = true |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | } |
| | | } |
| | | |
| | | extension PaymentResultVC:UICollectionViewDataSource{ |
| | | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { |
| | | return models.count |
| | | } |
| | | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { |
| | | return models.count |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_CouponCCell", for: indexPath) as! CouponCCell |
| | | let model = models[indexPath.row] |
| | | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_CouponCCell", for: indexPath) as! CouponCCell |
| | | let model = models[indexPath.row] |
| | | |
| | | if let m = model as? CourseCouponModel{ |
| | | cell.courseCouponModel = m |
| | | } |
| | | if let m = model as? CourseCouponModel{ |
| | | cell.courseCouponModel = m |
| | | } |
| | | |
| | | if let m = model as? CouponInfo_1_Model{ |
| | | cell.couponInfoModel = m |
| | | } |
| | | if let m = model as? CouponInfo_1_Model{ |
| | | cell.couponInfoModel = m |
| | | } |
| | | |
| | | cell.showDetailClouse = {[weak self] () in |
| | | self?.dismiss(animated:true){ [weak self] in |
| | | let vc = WelfareCouponsListVC() |
| | | self?.handleVC?.navigationController?.pushViewController(vc) |
| | | } |
| | | } |
| | | return cell |
| | | } |
| | | |
| | | cell.showDetailClouse = {[weak self] () in |
| | | self?.dismiss(animated:true){ [weak self] in |
| | | let vc = WelfareCouponsListVC() |
| | | self?.handleVC?.navigationController?.pushViewController(vc) |
| | | } |
| | | } |
| | | return cell |
| | | } |
| | | |
| | | } |
| | | |
| | | extension PaymentResultVC:UICollectionViewDelegateFlowLayout{ |
| | | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { |
| | | return 0 |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { |
| | | return 0 |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { |
| | | return CGSize(width: JQ_ScreenW, height: 120) |
| | | } |
| | | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { |
| | | return 0 |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { |
| | | return 0 |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { |
| | | return CGSize(width: JQ_ScreenW, height: 120) |
| | | } |
| | | } |