| | |
| | | @IBOutlet weak var tf_phone: QMUITextField! |
| | | @IBOutlet weak var label_walletBalance: UILabel! |
| | | @IBOutlet weak var btn_isreadAgreement: UIButton! |
| | | private var id:Int! |
| | | private var museItemModel:MeditationModel? |
| | | private var courseItemModel:CourseModel? |
| | | private var giftUserId:Int? |
| | | private var giftToOther:Bool! |
| | | private var courseModel:CourseModel? |
| | |
| | | private var balance:Double = 0 |
| | | private var type:PaymentOrderType! |
| | | |
| | | init(id:Int,type:PaymentOrderType,giftToOther:Bool = false) { |
| | | init(museItemModel:MeditationModel? = nil,courseItemModel:CourseModel? = nil,type:PaymentOrderType,giftToOther:Bool = false) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.id = id |
| | | self.museItemModel = museItemModel |
| | | self.courseItemModel = courseItemModel |
| | | self.giftToOther = giftToOther |
| | | self.type = type |
| | | } |
| | |
| | | getBalance() |
| | | |
| | | if type == .course{ |
| | | Services.getCourseDetail(courseId: id).subscribe(onNext: {data in |
| | | Services.getCourseDetail(courseId: courseItemModel!.id).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | self.courseModel = m |
| | | self.image_cover.sd_setImage(with: URL(string: m.coverUrl)) |
| | | self.image_cover.sd_setImage(with: URL(string: m.coverUrl.jq_urlEncoded())) |
| | | self.label_courseName.text = m.courseTitle |
| | | self.label_price.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | self.label_price.text = "愈疗币\(m.iosPrice.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)" |
| | | self.label_orderPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)" |
| | | self.label_totalPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)" |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | if type == .muse{ |
| | | Services.getMeditationDetail(id: id).subscribe(onNext: {data in |
| | | Services.getMeditationDetail(id: museItemModel!.id).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | self.museModel = m |
| | | self.image_cover.sd_setImage(with: URL(string: m.coverUrl)) |
| | | self.image_cover.sd_setImage(with: URL(string: m.coverUrl.jq_urlEncoded())) |
| | | self.label_courseName.text = m.meditationTitle |
| | | self.label_price.text = "愈疗币\(m.generalPrice.jq_formatFloat)" |
| | | self.label_price.text = "愈疗币\(m.iosPrice.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)" |
| | | self.label_orderPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)" |
| | | self.label_totalPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)" |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | var id:Int = 0 |
| | | |
| | | if let m = courseModel{ |
| | | money = m.generalPrice |
| | | money = m.iosPrice |
| | | id = m.id |
| | | } |
| | | |
| | | if let m = museModel{ |
| | | money = m.generalPrice |
| | | money = m.iosPrice |
| | | id = m.id |
| | | } |
| | | |
| | |
| | | |
| | | Services.gvieCourse(orderForm: type, targetId: id,receiverId: giftUserId).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | self?.museItemModel?.isBuy = .yes |
| | | self?.courseItemModel?.isBuy = .yes |
| | | self?.museModel?.isBuy = .yes |
| | | self?.courseModel?.isBuy = .yes |
| | | let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: money) |
| | | self?.push(vc: vc) |
| | | }).disposed(by: disposeBag) |