无故事王国
2023-10-17 77041c81c325c0bc88c94dc28d732f656cc4c885
WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -19,7 +19,7 @@
    @IBOutlet weak var cons_tableHei: NSLayoutConstraint!
    @IBOutlet weak var btn_coupon: TapBtn!
    @IBOutlet weak var img_cover: UIImageView!
   @IBOutlet weak var view_banner: CommonBannerView!
    @IBOutlet weak var label_title: UILabel!
    @IBOutlet weak var label_listenWeek: UILabel!
    @IBOutlet weak var label_listenTime: UILabel!
@@ -55,7 +55,10 @@
        title = "课程详情"
        if let m = detailModel{
            img_cover.sd_setImage(with: URL(string: m.detailDrawing))
         view_banner.setImages(images: m.detailDrawing.components(separatedBy: ","), type: .URL) { index in
         }
            label_title.text = m.name
            label_listenWeek.text = "每" + m.weeks.joined(separator: "、")
         label_listenTime.text = m.times.joined(separator: "|")
@@ -89,6 +92,8 @@
            changePrice(selectClassIndex)
        }
      btn_addStudent.isHidden = isExtend
      if isExtend{
         btn_handleBtn.setTitle("续课", for: .normal)
      }else{
@@ -161,7 +166,7 @@
    
    @IBAction func paymentAction(_ sender: UIButton) {
        guard detailModel != nil else {return}
        guard studentModels.count != 0 else {alertError(msg: "请选择学员");return}
        guard studentModels.count != 0 else {alertError(msg: "请选择运动营成员");return}
        StoresInfoView.show(detailModel!) { [weak self] status in
            guard let weakSelf = self else { return }
            if status{
@@ -183,7 +188,7 @@
                    let coin = (model.playPaiCoin ?? 0) * weakSelf.studentModels.count
                    PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil)) { [weak self] payType in
                    PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil,integral:nil)) { [weak self] payType in
                        guard let weakSelf = self else { return }
                  var paymentPrice:Double = 0
@@ -192,7 +197,7 @@
                        paymentPrice = discountPrice
                     case .coin:
                        paymentPrice = Double(coin)
                     case .courseNum:break
                     case .courseNum,.integral:break
                  }
                        Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: paymentPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in
@@ -221,11 +226,25 @@
                              let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id)
                              vc.modalPresentationStyle = .fullScreen
                              self?.present(vc, animated: true)
                                    case .courseNum:break
                           case .courseNum,.integral:break
                                }
                            }else{
                                alertError(msg: data.msg)
                            }
                  },onError: { error in
                     if let er = error as? NetworkRequest.NetRequestError{
                        switch er {
                           case .Other(_,let string):
                              let vc = PaymentResultVC(result: .fail(string), objType: .courseApply,handleVC: nil)
                              vc.modalPresentationStyle = .fullScreen
                              weakSelf.present(vc, animated: true)
                           default:
                              let vc = PaymentResultVC(result: .fail("支付失败"), objType: .courseApply,handleVC: nil)
                              vc.modalPresentationStyle = .fullScreen
                              weakSelf.present(vc, animated: true)
                        }
                     }
                        }).disposed(by: weakSelf.disposeBag)
                    }
                }
@@ -327,7 +346,6 @@
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_Common_1_CCell", for: indexPath) as! Common_1_CCell
        cell.isSelected = indexPath.row == selectClassIndex
        cell.courseDetailListModel = m
        return cell
    }
    
@@ -371,10 +389,10 @@
            tableView.reloadData()
            weakSelf.changePrice(weakSelf.selectClassIndex)
         }else{
            alert(msg: "至少选择一位学员")
            alert(msg: "至少选择一位运动营成员")
         }
        }
      cell.btn_handle.isHidden = isExtend
        return cell
    }
}