无故事王国
2023-11-14 2a7b12af07d814030c1326f56fec6ebf0d11619f
WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -73,7 +73,7 @@
                     label_price.isHidden = true
                     label_originPrice.isHidden = true
                     label_vipPrice.isHidden = true
                     label_coin.isHidden = false
                     //玩湃币
                     label_coin.attributedText = AttributedStringbuilder.build()
                        .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
@@ -87,6 +87,7 @@
                     }else{
                        label_originPrice.isHidden = false
                     }
                     label_coin.isHidden = false
                        //玩湃币
                     label_coin.attributedText = AttributedStringbuilder.build()
                        .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
@@ -97,50 +98,59 @@
                     label_originPrice.attributedText = attribute.mutableAttributedString
                     if UserInfoModel.get()?.isVip == 1{
                           //会员
                        label_vipPrice.isHidden = true
                        //优惠价比会员价更优惠
                        if subM.paymentPrice < subM.vipPrice && subM.paymentPrice != 0{
                           label_price.text = subM.paymentPrice.currency()
                        }
                        //会员价比优惠价更优惠
                        else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{
                           label_price.text = subM.vipPrice.currency()
                        }else if subM.vipPrice != 0 && subM.paymentPrice != 0{
                           //会员价和优惠价一样
                           label_price.text = min(subM.vipPrice,subM.paymentPrice).currency()
                        }else{
                           label_price.text = subM.paymentPrice.currency()
                        if subM.payType != .coin{
                              //会员
                           label_vipPrice.isHidden = true
                              //优惠价比会员价更优惠
                           if subM.paymentPrice < subM.vipPrice && subM.paymentPrice != 0{
                              label_price.text = subM.paymentPrice.currency()
                           }
                              //会员价比优惠价更优惠
                           else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{
                              label_price.text = subM.vipPrice.currency()
                           }else if subM.vipPrice != 0 && subM.paymentPrice != 0{
                                 //会员价和优惠价一样
                              label_price.text = min(subM.vipPrice,subM.paymentPrice).currency()
                           }else{
                              label_price.text = subM.paymentPrice.currency()
                           }
                        }
                     }else{
                           //非会员
                        label_vipPrice.isHidden = subM.vipPrice == 0 || subM.vipPrice == subM.paymentPrice
                        let vipAttribute = AttributedStringbuilder.build()
                           .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                           .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                        label_vipPrice.attributedText = vipAttribute.mutableAttributedString
                        if subM.payType != .coin{
                              //非会员
                           label_vipPrice.isHidden = subM.vipPrice == 0 || subM.vipPrice == subM.paymentPrice
                           let vipAttribute = AttributedStringbuilder.build()
                              .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
                              .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                           label_vipPrice.attributedText = vipAttribute.mutableAttributedString
                        if subM.originalPrice != 0 && subM.paymentPrice == 0{
                           label_price.text = subM.originalPrice.currency()
                        }else if subM.originalPrice == 0 && subM.paymentPrice != 0{
                           label_price.text = subM.paymentPrice.currency()
                        }else if subM.originalPrice != 0 && subM.paymentPrice != 0{
                           label_price.text = min(subM.originalPrice,subM.paymentPrice).currency()
                        }else{
                           label_price.text = subM.originalPrice.currency()
                           if subM.originalPrice != 0 && subM.paymentPrice == 0{
                              label_price.text = subM.originalPrice.currency()
                           }else if subM.originalPrice == 0 && subM.paymentPrice != 0{
                              label_price.text = subM.paymentPrice.currency()
                           }else if subM.originalPrice != 0 && subM.paymentPrice != 0{
                              label_price.text = min(subM.originalPrice,subM.paymentPrice).currency()
                           }else{
                              label_price.text = subM.originalPrice.currency()
                           }
                        }
                     }
               }
            }
            if m.type == .experience{
               label_price.text = (m.list.first?.paymentPrice ?? 0).currency()
               if  m.list.first?.paymentPrice != 0{
                  label_price.text = (m.list.first!.paymentPrice).currency()
                  label_price.isHidden = false
               }
               label_vaildTime.text = "购买当天有效"
               label_originPrice.isHidden = true
               label_vipPrice.isHidden = true
               view_listen.isHidden = true
               label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0
//               label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0
            }
               //体验课,假期课不展示
@@ -149,9 +159,9 @@
               cons_handleHei.constant = 0
            }
            if label_originPrice.isHidden && label_vipPrice.isHidden && label_coin.isHidden{
               label_coin.alpha = 0
            }
//            if label_originPrice.isHidden && label_vipPrice.isHidden && label_coin.isHidden{
//               label_coin.alpha = 0
//            }
         }
        }
    }