| | |
| | | |
| | | class PaymentOrderVC: BaseVC { |
| | | |
| | | enum PaymentOrderType { |
| | | case course |
| | | case muse |
| | | } |
| | | |
| | | @IBOutlet weak var image_cover: UIImageView! |
| | | @IBOutlet weak var label_price: UILabel! |
| | | @IBOutlet weak var label_teacher: UILabel! |
| | |
| | | @IBOutlet weak var tf_phone: QMUITextField! |
| | | @IBOutlet weak var label_walletBalance: UILabel! |
| | | @IBOutlet weak var btn_isreadAgreement: UIButton! |
| | | private var courseId:Int! |
| | | private var id:Int! |
| | | private var giftUserId:Int? |
| | | private var giftToOther:Bool! |
| | | private var courseModel:CourseModel? |
| | | private var museModel:MeditationModel? |
| | | private var balance:Double = 0 |
| | | private var type:PaymentOrderType! |
| | | |
| | | init(courseId:Int,giftToOther:Bool = false) { |
| | | init(id:Int,type:PaymentOrderType,giftToOther:Bool = false) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.courseId = courseId |
| | | self.id = id |
| | | self.giftToOther = giftToOther |
| | | self.type = type |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | |
| | | |
| | | getBalance() |
| | | |
| | | Services.getCourseDetail(courseId: courseId).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | self.courseModel = m |
| | | self.image_cover.sd_setImage(with: URL(string: m.coverUrl)) |
| | | self.label_courseName.text = m.courseTitle |
| | | self.label_price.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | self.label_teacher.text = "导师\(m.tutor)" |
| | | self.label_paymentCount.text = "x\(m.count)" |
| | | self.label_orderPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | self.label_totalPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | if type == .course{ |
| | | Services.getCourseDetail(courseId: id).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | self.courseModel = m |
| | | self.image_cover.sd_setImage(with: URL(string: m.coverUrl)) |
| | | self.label_courseName.text = m.courseTitle |
| | | self.label_price.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | self.label_teacher.text = "导师\(m.tutor)" |
| | | self.label_paymentCount.text = "x\(m.count)" |
| | | self.label_orderPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | self.label_totalPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | if type == .muse{ |
| | | Services.getMeditationDetail(id: id).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | self.museModel = m |
| | | self.image_cover.sd_setImage(with: URL(string: m.coverUrl)) |
| | | self.label_courseName.text = m.meditationTitle |
| | | self.label_price.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | self.label_teacher.text = "" |
| | | self.label_paymentCount.text = "x1" |
| | | self.label_orderPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | self.label_totalPrice.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | return |
| | | } |
| | | |
| | | let vc = PaymentOrderResultVC(courseId: courseId, price: m.generalPrice) |
| | | let vc = PaymentOrderResultVC(courseId: id, price: m.generalPrice) |
| | | push(vc: vc) |
| | | } |
| | | } |