无故事王国
2023-09-20 2834569133090d46dd3f28a30100fa74661ef1e1
WanPai/Root/Other/VC/PaymentResultVC.swift
@@ -32,13 +32,16 @@
    
    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) {
@@ -66,8 +69,18 @@
            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)
@@ -150,34 +163,46 @@
      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
    }