杨锴
2024-11-25 b0222c34dcbc7ae27949a605fb4c7cea473844b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
//  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)
                }
}