无故事王国
2023-10-20 6382df7f214503697f041631bd7fdbc5db2c6149
WanPai/Root/Course/TCell/CourseTCell.swift
@@ -23,9 +23,6 @@
   
    var courseItemModel:CourseItemModel!{
        didSet{
            label_originPrice.isHidden = courseItemModel.originalPrice == nil
            label_vipPrice.text = "会员价:\(courseItemModel.vipPrice.currency())"
         stackView_vipPrice.isHidden = courseItemModel.vipPrice == 0
            img_cover.sd_setImage(with: URL(string: courseItemModel.coverDrawing),placeholderImage: UIImage(named: "placeholder_1"))
            label_title.text = String(format: "%@(%@)", courseItemModel.name,courseItemModel.storeName)
         label_teachTime.text = String(format: "上课时间:%@", courseItemModel.classStartTime.jq_max(size: 2).joined(separator: "|"))
@@ -33,15 +30,29 @@
            label_distance.text = String(format: "%.2lfkm", courseItemModel.distance)
         stack_teachTime.isHidden = courseItemModel.classStartTime.count == 0
         if courseItemModel.paymentPrice != 0{
            label_price.text = courseItemModel.paymentPrice.currency()
         }else{
         if courseItemModel.payType == .coin || (courseItemModel.originalPrice == 0 && courseItemModel.paymentPrice == 0 && courseItemModel.vipPrice == 0){
            label_price.text = "玩湃币 " + "\(courseItemModel.playPaiCoin)"
            stackView_vipPrice.isHidden = true
            label_originPrice.isHidden = true
         }else{
            if UserInfoModel.get()?.isVip == 1{
               stackView_vipPrice.isHidden = true
               label_price.text = courseItemModel.vipPrice.currency()
               label_originPrice.attributedText = AttributedStringbuilder.build().add(string: courseItemModel.paymentPrice.currency() , withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#C6C6C6")).delLine(color: UIColor(hexStr: "#C6C6C6")).mutableAttributedString
               label_originPrice.isHidden = courseItemModel.paymentPrice == 0
            }else{
               stackView_vipPrice.isHidden = courseItemModel.vipPrice == 0 || (courseItemModel.paymentPrice == courseItemModel.vipPrice)
               label_price.text = courseItemModel.paymentPrice.currency()
               label_vipPrice.text = "会员价:\(courseItemModel.vipPrice.currency())"
               label_originPrice.attributedText = AttributedStringbuilder.build().add(string: courseItemModel.paymentPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#C6C6C6")).delLine(color: UIColor(hexStr: "#C6C6C6")).mutableAttributedString
               //容错:原价 == 支付价 | 原价 == 0 -> 原价隐藏
               label_originPrice.isHidden = courseItemModel.originalPrice == 0 || courseItemModel.paymentPrice <= courseItemModel.originalPrice
            }
         }
            label_originPrice.attributedText = AttributedStringbuilder.build().add(string: courseItemModel.originalPrice?.currency() ?? "", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#C6C6C6")).delLine(color: UIColor(hexStr: "#C6C6C6")).mutableAttributedString
        }
    }
@@ -49,6 +60,4 @@
        super.awakeFromNib()
        selectionStyle = .none
    }
}