| | |
| | | // |
| | | // WelfareWeeklyDetailVC.swift |
| | | // WanPai |
| | | // |
| | | // Created by 无故事王国 on 2023/6/21. |
| | | // |
| | | // |
| | | // WelfareWeeklyDetailVC.swift |
| | | // WanPai |
| | | // |
| | | // Created by 无故事王国 on 2023/6/21. |
| | | // |
| | | |
| | | import UIKit |
| | | import QMUIKit |
| | | import JQTools |
| | | import SDWebImage |
| | | |
| | | class WelfareWeeklyDetailVC: BaseVC { |
| | | @IBOutlet weak var img_cover: UIImageView! |
| | | @IBOutlet weak var label_name: UILabel! |
| | | @IBOutlet weak var btn_address: QMUIButton! |
| | | @IBOutlet weak var label_distance: UILabel! |
| | | @IBOutlet weak var label_courseNum: UILabel! |
| | | @IBOutlet weak var label_giftCourseNum: UILabel! |
| | | @IBOutlet weak var view_giftCourseNum: UIView! |
| | | @IBOutlet weak var label_attendWeeks: UILabel! |
| | | @IBOutlet weak var label_datetime: UILabel! |
| | | @IBOutlet weak var img_intro: UIImageView! |
| | | @IBOutlet weak var cons_imgIntroHei: NSLayoutConstraint! |
| | | |
| | | |
| | | @IBOutlet weak var img_intro2: UIImageView! |
| | | @IBOutlet weak var cons_imgIntro2Hei: NSLayoutConstraint! |
| | | |
| | | @IBOutlet weak var label_price: UILabel! |
| | | @IBOutlet weak var label_originPrice: UILabel! |
| | | @IBOutlet weak var label_coin: UILabel! |
| | | @IBOutlet weak var label_vip: UILabel! |
| | | @IBOutlet weak var btn_handle: UIButton! |
| | | |
| | | private var id:Int! |
| | | |
| | | required init(id:Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.id = id |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "课程详情" |
| | | |
| | | Services.weekBenefitDetail(id: id).subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let model = data.data{ |
| | | weakSelf.img_cover.sd_setImage(with: URL(string: model.coverDrawing)) |
| | | weakSelf.label_name.text = model.coursePackageName |
| | | weakSelf.btn_address.setTitle(model.storeNameAddr, for: .normal) |
| | | weakSelf.label_courseNum.text = "\(model.classHours)课时" |
| | | weakSelf.label_giftCourseNum.text = "\(model.freeClassHours)课时" |
| | | weakSelf.view_giftCourseNum.isHidden = model.freeClassHours == 0 |
| | | weakSelf.label_attendWeeks.text = model.weekTime |
| | | weakSelf.label_datetime.text = model.time |
| | | weakSelf.label_distance.text = String(format: "%.2lfkm", model.distance) |
| | | |
| | | weakSelf.label_vip.isHidden = model.discountPrice == 0 |
| | | weakSelf.label_coin.isHidden = model.wanpaiGold == 0 |
| | | weakSelf.label_originPrice.isHidden = model.costPrice == 0 |
| | | |
| | | |
| | | if model.discountPrice > 0{ |
| | | weakSelf.label_price.text = model.discountPrice.currency() |
| | | weakSelf.label_originPrice.attributedText = AttributedStringbuilder.build().add(string: model.costPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#C6C6C6")) |
| | | .delLine(color: UIColor(hexStr: "#C6C6C6")).mutableAttributedString |
| | | }else{ |
| | | weakSelf.label_price.text = model.costPrice.currency() |
| | | } |
| | | |
| | | weakSelf.label_vip.attributedText = AttributedStringbuilder.build().add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")).add(string: model.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString |
| | | |
| | | weakSelf.label_coin.attributedText = AttributedStringbuilder.build().add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")).add(string: "\(model.wanpaiGold)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString |
| | | |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: model.introduceDrawing)) { [weak self] image, data, error, status in |
| | | if let img = image{ |
| | | self?.img_intro.image = img |
| | | let radio = img.size.width / img.size.height |
| | | self?.cons_imgIntroHei.constant = JQ_ScreenW * radio |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | } |
| | | @IBAction func applyAction(_ sender: UIButton) { |
| | | let vc = CourseDetailApplyVC(detailModel: CourseDetailModel()) |
| | | push(vc: vc) |
| | | Services.queryCourseInfo(id: id).subscribe(onNext: {[weak self] data in |
| | | if let m = data.data{ |
| | | let vc = CourseDetailApplyVC(detailModel: m) |
| | | self?.push(vc: vc) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |