| | |
| | | |
| | | private var result:PaymentResult! |
| | | private var objType:PaymentObjType! |
| | | private var courseConfigId:Int? |
| | | private var handleVC:UIViewController? |
| | | |
| | | required init(result:PaymentResult,objType:PaymentObjType,handleVC:UIViewController? = nil) { |
| | | private var models = [CourseCouponModel]() |
| | | |
| | | required init(result:PaymentResult,objType:PaymentObjType,handleVC:UIViewController? = nil,courseConfigId:Int? = nil) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.result = result |
| | | self.objType = objType |
| | | self.handleVC = handleVC |
| | | self.courseConfigId = courseConfigId |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | |
| | | case .none:break |
| | | } |
| | | case .courseApply: |
| | | //课时购买 |
| | | btn_backHome.isHidden = true |
| | | collectionView.isHidden = true |
| | | if let id = courseConfigId{ |
| | | Services.paymentCourseCouponList(id: id).subscribe(onNext: { data in |
| | | if let models = data.data{ |
| | | self.models = models |
| | | self.collectionView.reloadData() |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | } |
| | | switch result { |
| | | case .fail(let str): |
| | | btn_again.setTitle("再次支付", for: .normal) |
| | |
| | | |
| | | switch str{ |
| | | case "查看预约": |
| | | dismiss(animated:true) {[weak self] in |
| | | dismiss(animated:true){ [weak self] in |
| | | let vc = YardBookingListVC() |
| | | self?.handleVC?.navigationController?.pushViewController(vc) |
| | | } |
| | | case "立即预约": |
| | | handleVC?.navigationController?.tabBarController?.selectedIndex = 1 |
| | | handleVC?.navigationController?.popToRootViewController(animated: true) |
| | | dismiss(animated:true) |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | |
| | | @IBAction func backAction(_ sender: UIButton) { |
| | | dismiss(animated: true) { |
| | | self.navigationController?.popToRootViewController(animated: true) |
| | | if let handleVC{ |
| | | handleVC.navigationController?.popToRootViewController(animated: true) |
| | | } |
| | | |
| | | dismiss(animated: true) |
| | | } |
| | | } |
| | | |
| | | 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) |
| | | } |
| | | } |
| | | |
| | | extension PaymentResultVC:UICollectionViewDataSource{ |
| | | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { |
| | | return 5 |
| | | 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] |
| | | cell.courseCouponModel = model |
| | | return cell |
| | | } |
| | | |