| | |
| | | |
| | | //减去优惠 |
| | | let discountPrice = price - (weakSelf.selectCouponModel?.favorable ?? 0) |
| | | |
| | | let coin = (model.playPaiCoin ?? 0) * weakSelf.studentModels.count |
| | | let coin = model.playPaiCoin * weakSelf.studentModels.count |
| | | |
| | | PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil,integral:nil)) { [weak self] payType in |
| | | guard let weakSelf = self else { return } |
| | |
| | | switch result { |
| | | case .success: |
| | | let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id) |
| | | vc.isExtend = self?.isExtend ?? false |
| | | self?.push(vc: vc) |
| | | case .cancel: |
| | | alert(msg: "已取消") |
| | |
| | | case .coin: |
| | | // self?.navigationController?.popViewController(animated: false) |
| | | let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id) |
| | | vc.isExtend = self?.isExtend ?? false |
| | | self?.push(vc: vc) |
| | | case .courseNum,.integral:break |
| | | } |
| | |
| | | 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 == 0 |
| | | |
| | | //原价 |
| | | if let originPrice = subM.originalPrice{ |
| | | let attribute = AttributedStringbuilder.build().add(string: (originPrice * 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 |
| | | } |
| | | switch subM.payType { |
| | | case .coin: |
| | | label_price.text = "" |
| | | label_price.isHidden = true |
| | | label_originPrice.isHidden = true |
| | | label_vipPrice.isHidden = true |
| | | |
| | | //玩湃币 |
| | | if let paiCoin = subM.playPaiCoin{ |
| | | let coinAttribute = AttributedStringbuilder.build() |
| | | .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) |
| | | .add(string: "\(paiCoin * studentModels.count)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) |
| | | label_coin.attributedText = coinAttribute.mutableAttributedString |
| | | } |
| | | //玩湃币 |
| | | 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 |
| | | |
| | | //会员价 |
| | | if subM.vipPrice != 0{ |
| | | 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")) |
| | | label_vipPrice.attributedText = vipAttribute.mutableAttributedString |
| | | } |
| | | case .cash: |
| | | label_coin.isHidden = true;fallthrough |
| | | case .cashCoin: |
| | | if subM.originalPrice == 0{label_originPrice.isHidden = true} |
| | | |
| | | //玩湃币 |
| | | 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 |
| | | |
| | | //原价 |
| | | 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)) |
| | | 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() |
| | | }else{ |
| | | label_price.text = (subM.vipPrice * studentCount - (selectCouponModel?.favorable ?? 0)).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 * 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() |
| | | }else if subM.originalPrice == 0 && subM.paymentPrice != 0{ |
| | | label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency() |
| | | }else{ |
| | | var money = min(subM.originalPrice,subM.paymentPrice) |
| | | money = money - (selectCouponModel?.favorable ?? 0) |
| | | label_price.text = (money * studentCount).currency() |
| | | } |
| | | } |
| | | } |
| | | |
| | | if detailModel?.type == .experience{ |
| | | label_price.text = subM.paymentPrice.currency() |
| | |
| | | var price:Double? |
| | | switch subM.payType{ |
| | | case .cash: |
| | | price = subM.originalPrice == nil ? subM.vipPrice : subM.originalPrice |
| | | price = subM.originalPrice == 0 ? subM.vipPrice : subM.originalPrice |
| | | case .coin: |
| | | if let coin = subM.playPaiCoin{price = Double(coin)} |
| | | } |
| | | price = Double(subM.playPaiCoin) |
| | | case .cashCoin:break |
| | | } |
| | | |
| | | guard price != nil else { |
| | | LogError("会员优惠价格出现问题:nil");return |