| | |
| | | class PaymentOrderResultVC: BaseVC { |
| | | |
| | | var collectionView:UICollectionView! |
| | | private let topView = PaymentOrderResultTopView.jq_loadNibView() |
| | | // private let shadowView = UIView() |
| | | private let topView = PaymentOrderResultTopView.jq_loadNibView() |
| | | private var courseId:Int! |
| | | private var price:Double! |
| | | private var models = [CourseModel]() |
| | | |
| | | init(courseId:Int,price:Double) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.courseId = courseId |
| | | self.price = price |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "支付结果" |
| | | |
| | | NotificationCenter.default.post(name: CourseRefresh_Noti, object: nil) |
| | | |
| | | yy_popBlock = { [weak self] () in |
| | | var toVC:UIViewController? |
| | | for v in self?.navigationController?.viewControllers ?? []{ |
| | | if v is CourseDetialVC{ |
| | | toVC = v;break |
| | | } |
| | | } |
| | | if toVC != nil{ |
| | | self?.navigationController?.popToViewController(toVC!, animated: true) |
| | | }else{ |
| | | self?.navigationController?.popToRootViewController(animated: true) |
| | | } |
| | | } |
| | | |
| | | topView.setPrice(price) |
| | | |
| | | Services.paymentSuccess(courseId: courseId).subscribe(onNext: {data in |
| | | self.models = data.data ?? [] |
| | | self.collectionView.reloadData() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | extension PaymentOrderResultVC:UIScrollViewDelegate{ |
| | | func scrollViewDidScroll(_ scrollView: UIScrollView) { |
| | | let v = (scrollView.contentOffset.y) + 298 |
| | | topView.y = -v |
| | | navigationController?.navigationBar.standardAppearance.backgroundColor = .white |
| | | } |
| | | } |
| | | |
| | | extension PaymentOrderResultVC:UICollectionViewDelegate & UICollectionViewDataSource{ |
| | | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { |
| | | return 50 |
| | | return models.count |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | // let vc = HomeItemDetailVC() |
| | | // push(vc: vc) |
| | | |
| | | let model = models[indexPath.row] |
| | | let vc = CourseDetialVC(courseId: model.id) |
| | | push(vc: vc) |
| | | } |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { |