//
|
// PaymentOrderResultTopView.swift
|
// XQMuse
|
//
|
// Created by 无故事王国 on 2024/8/15.
|
//
|
|
import UIKit
|
import JQTools
|
import RxSwift
|
|
class PaymentOrderResultTopView: UIView,JQNibView{
|
|
@IBOutlet weak var label_price: UILabel!
|
@IBOutlet weak var btn_lookCourse: UIButton!
|
private var id:Int!
|
private var type:PaymentOrderVC.PaymentOrderType!
|
private let disposeBag = DisposeBag()
|
|
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
}
|
|
func setPrice(type:PaymentOrderVC.PaymentOrderType,id:Int,price:Double){
|
self.id = id
|
self.type = type
|
|
label_price.attributedText = AttributedStringbuilder.build().add(string: "疗愈币", withFont: .systemFont(ofSize: 18, weight: .semibold), withColor: UIColor(hexStr: "#FF9000"))
|
.add(string: String(format: "%.2lf", price), withFont: UIFont(name: "DIN Alternate", size: 30)!, withColor: UIColor(hexStr: "#FF9000")).mutableAttributedString
|
|
switch type {
|
case .course:btn_lookCourse.setTitle("查看课程", for: .normal)
|
case .muse:btn_lookCourse.setTitle("查看疗愈", for: .normal)
|
default:break
|
}
|
}
|
|
@IBAction func backRootAction(_ sender: UIButton) {
|
JQ_currentNavigationController().popToRootViewController(animated: true)
|
}
|
|
@IBAction func lookCourseAction(_ sender: UIButton) {
|
|
if type == .course{
|
Services.getCourseDetail(courseId: id).subscribe(onNext: {data in
|
if let m = data.data{
|
if m.isVip == .no && m.chargeType == .vipFree{
|
let vc = VIPCenterVC()
|
JQ_currentNavigationController().pushViewController(vc)
|
}else if m.courseType == .online{
|
let vc = CourseDetialVC(courseModel: m)
|
JQ_currentViewController().jq_push(vc: vc)
|
}else{
|
let vc = CourseDetialOfflineVC(courseId: m.id)
|
JQ_currentViewController().jq_push(vc: vc)
|
}
|
}
|
}).disposed(by: disposeBag)
|
}
|
|
if type == .muse{
|
Services.getMeditationDetail(id: id).subscribe(onNext: {data in
|
if let m = data.data{
|
let vc = HomeItemDetailVC(model: m)
|
JQ_currentViewController().jq_push(vc: vc)
|
}
|
}).disposed(by: disposeBag)
|
}
|
}
|
|
|
override func layoutSubviews() {
|
super.layoutSubviews()
|
btn_lookCourse.jq_gradientNibColor(colorArr: [UIColor(hexStr: "#8EA47A").cgColor,UIColor(hexStr: "#AFCA98").cgColor], cornerRadius: 20)
|
}
|
}
|