无故事王国
2023-09-20 2834569133090d46dd3f28a30100fa74661ef1e1
WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -25,13 +25,18 @@
   @IBOutlet weak var label_courseType: UILabel!
   @IBOutlet weak var label_vaildTime: UILabel!
   @IBOutlet weak var view_vaildTime: UIView!
   @IBOutlet weak var view_handle: UIView!
   
    @IBOutlet weak var label_price: UILabel!
    @IBOutlet weak var label_originPrice: UILabel!
    @IBOutlet weak var label_vipPrice: UILabel!
    @IBOutlet weak var label_coin: UILabel!
   @IBOutlet weak var cons_handleHei: NSLayoutConstraint!
   @IBOutlet weak var btn_enroll: UIButton!
    private var id = 0
   private var signUpCourseModel:SignUpCourseItemDetailModel?
    private var detailModel:CourseDetailModel!{
        didSet{
            img_cover.sd_setImage(with: URL(string: detailModel.coverDrawing))
@@ -92,12 +97,33 @@
            label_originPrice.isHidden = true
            label_vipPrice.isHidden = true
         }
         //体验课,假期课不展示
         if detailModel.type != .normal && signUpCourseModel != nil{
            view_handle.isHidden = true
            cons_handleHei.constant = 0
         }
         if let m = signUpCourseModel{
            label_originPrice.isHidden = true
            label_vipPrice.isHidden = true
            let coinAttribute = AttributedStringbuilder.build()
               .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
               .add(string: "\(m.wpGold)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
            label_coin.attributedText = coinAttribute.mutableAttributedString
            label_price.text = m.amount.currency()
            label_coin.alpha = m.wpGold == 0 ? 0:1
         }
        }
    }
    required init(id:Int) {
   required init(id:Int,signUpCourseModel:SignUpCourseItemDetailModel? = nil) {
        super.init(nibName: nil, bundle: nil)
        self.id = id
      self.signUpCourseModel = signUpCourseModel
    }
    required init?(coder: NSCoder) {
@@ -107,6 +133,12 @@
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "课程详情"
      if signUpCourseModel?.payStatus == 1{
         btn_enroll.setTitle("待支付", for: .normal)
      }else if signUpCourseModel?.payStatus == 2{
         btn_enroll.setTitle("续课", for: .normal)
      }
        Services.queryCourseInfo(id: id).subscribe(onNext: { data in
            if let m = data.data{
@@ -125,8 +157,17 @@
      label_type.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: 58, height: 25)
   }
    @IBAction func applyAction(_ sender: UIButton) {
        if let m = detailModel{
   @IBAction func applyAction(_ sender: UIButton) {
      //待支付订单
      if let m = signUpCourseModel,m.payStatus == 1{
         return
      }
      if let m = detailModel{
            let vc = CourseDetailApplyVC(detailModel: m)
           push(vc: vc)
        }