| | |
| | | if let m = detailModel{ |
| | | img_cover.sd_setImage(with: URL(string: m.coverDrawing)) |
| | | label_title.text = m.name |
| | | label_listenWeek.text = m.weeks.joined(separator: "、") |
| | | label_listenWeek.text = "每" + m.weeks.joined(separator: "、") |
| | | label_listenTime.text = m.times.joined(separator: "|") |
| | | label_store.text = m.storeName |
| | | label_address.text = m.storeAddress |
| | |
| | | guard let weakSelf = self else { return } |
| | | if status{ |
| | | if let model = weakSelf.detailModel?.list[weakSelf.selectClassIndex]{ |
| | | let price = (model.vipPrice == nil ? (model.originalPrice ?? 0) : model.vipPrice!) * Double(weakSelf.studentModels.count) |
| | | |
| | | var price:Double = 0 |
| | | //是否是会员 |
| | | if weakSelf.detailModel?.isVip == 1 && model.vipPrice != 0{ |
| | | price = model.vipPrice |
| | | }else{ |
| | | price = model.paymentPrice |
| | | } |
| | | |
| | | //计算人数总价 |
| | | price = price * Double(weakSelf.studentModels.count) |
| | | |
| | | //减去优惠 |
| | | let discountPrice = price - (weakSelf.selectCouponModel?.favorable ?? 0) |
| | | |
| | | let coin = (model.playPaiCoin ?? 0) * weakSelf.studentModels.count |
| | | |
| | | PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil)) { [weak self] payType in |
| | |
| | | studentCount = Double(studentModels.count) |
| | | } |
| | | |
| | | label_price.isHidden = subM.paymentPrice == 0 |
| | | label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | label_originPrice.isHidden = subM.originalPrice == nil || subM.originalPrice == 0 |
| | | label_coin.isHidden = subM.playPaiCoin == nil || subM.playPaiCoin == 0 |
| | | label_vipPrice.isHidden = subM.vipPrice == nil || subM.vipPrice == 0 |
| | | label_vipPrice.isHidden = subM.vipPrice == 0 |
| | | |
| | | //原价 |
| | | if let originPrice = subM.originalPrice{ |
| | |
| | | } |
| | | |
| | | //会员价 |
| | | if let vipPrice = subM.vipPrice{ |
| | | if subM.vipPrice != 0{ |
| | | let vipAttribute = AttributedStringbuilder.build() |
| | | .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) |
| | | .add(string: (vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) |
| | | .add(string: (subM.vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) |
| | | label_vipPrice.attributedText = vipAttribute.mutableAttributedString |
| | | } |
| | | |
| | |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | label_courseType.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: 58, height: 25) |
| | | let w = String.jq_getWidth(text: detailModel?.type.strTitle ?? "", height: 25, font: 14) + 16 |
| | | label_courseType.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: w, height: 25) |
| | | } |
| | | } |
| | | |