| | |
| | | private func changePrice(_ index:Int){ |
| | | if let subM = detailModel?.list[index]{ |
| | | |
| | | var studentCount:Double = 0 |
| | | var studentCount:Int = 0 |
| | | if studentModels.count == 0{ |
| | | studentCount = 1 |
| | | }else{ |
| | | studentCount = Double(studentModels.count) |
| | | studentCount = studentModels.count |
| | | } |
| | | |
| | | |
| | |
| | | //玩湃币 |
| | | label_coin.attributedText = AttributedStringbuilder.build() |
| | | .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) |
| | | .add(string: "\(subM.playPaiCoin * studentModels.count)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString |
| | | .add(string: "\(subM.playPaiCoin * studentCount)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString |
| | | |
| | | case .cash: |
| | | label_coin.isHidden = true;fallthrough |
| | |
| | | .add(string: "\(subM.playPaiCoin * studentModels.count)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString |
| | | |
| | | //原价 |
| | | let attribute = AttributedStringbuilder.build().add(string: (subM.originalPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).delLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)) |
| | | let attribute = AttributedStringbuilder.build().add(string: (subM.originalPrice * Double(studentCount)).currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).delLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)) |
| | | 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 * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_price.text = (subM.paymentPrice * Double(studentCount) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | }else if subM.vipPrice < subM.paymentPrice && subM.vipPrice != 0{ |
| | | label_price.text = (subM.vipPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_price.text = (subM.vipPrice * Double(studentCount) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | }else if subM.vipPrice != 0 && subM.paymentPrice != 0{ |
| | | let price = min(subM.vipPrice, subM.paymentPrice) |
| | | label_price.text = (price * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_price.text = (price * Double(studentCount) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | }else{ |
| | | label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_price.text = (subM.paymentPrice * Double(studentCount) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | } |
| | | } |
| | | |
| | |
| | | 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 * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) |
| | | .add(string: (subM.vipPrice * Double(studentCount)).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 * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_price.text = (subM.originalPrice * Double(studentCount) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | }else if subM.originalPrice == 0 && subM.paymentPrice != 0{ |
| | | label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_price.text = (subM.paymentPrice * Double(studentCount) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | }else if subM.originalPrice != 0 && subM.paymentPrice != 0{ |
| | | var money = min(subM.originalPrice,subM.paymentPrice) |
| | | money = money - (selectCouponModel?.favorable ?? 0) |
| | | label_price.text = (money * studentCount).currency() |
| | | label_price.text = (money * Double(studentCount)).currency() |
| | | }else{ |
| | | label_price.text = (subM.originalPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_price.text = (subM.originalPrice * Double(studentCount) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | } |
| | | } |
| | | } |