| | |
| | | @IBOutlet weak var studentTableView: UITableView! |
| | | @IBOutlet weak var view_packageList: UIView! |
| | | @IBOutlet weak var btn_handleBtn: UIButton! |
| | | @IBOutlet weak var view_teach: UIView! |
| | | |
| | | private var detailModel:CourseDetailModel? |
| | | private var selectClassIndex:Int = 0 |
| | |
| | | img_cover.sd_setImage(with: URL(string: m.coverDrawing)) |
| | | label_title.text = m.name |
| | | label_listenWeek.text = m.weeks.joined(separator: "、") |
| | | label_listenTime.text = m.times.joined(separator: "|") |
| | | label_listenTime.text = m.times.joined(separator: "|") |
| | | label_store.text = m.storeName |
| | | label_address.text = m.storeAddress |
| | | label_vaild.text = m.time |
| | |
| | | view_vaildTime.isHidden = true |
| | | } |
| | | |
| | | if let stu = m.student{studentModels.append(stu)} |
| | | if m.student?.id != 0{ |
| | | studentModels.append(m.student!) |
| | | } |
| | | |
| | | cons_collHei.constant = ceil(Double(m.list.count) / 3.0) * CellH + floor(Double(m.list.count) / 3.0) * 21.0 |
| | | collectionView.reloadData() |
| | |
| | | } |
| | | |
| | | Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: paymentPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in |
| | | if let m = data.data{ |
| | | if data.code == 200{ |
| | | switch payType { |
| | | case .aliPay: |
| | | YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: m.orderString)) { [weak self] result in |
| | | YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: data.data!.orderString)) { [weak self] result in |
| | | switch result { |
| | | case .success: |
| | | // self?.navigationController?.popViewController(animated: false) |
| | |
| | | |
| | | private func changePrice(_ index:Int){ |
| | | if let subM = detailModel?.list[index]{ |
| | | label_price.text = (subM.paymentPrice * Double(studentModels.count) - (selectCouponModel?.favorable ?? 0)).currency() |
| | | |
| | | var studentCount:Double = 0 |
| | | if studentModels.count == 0{ |
| | | studentCount = 1 |
| | | }else{ |
| | | studentCount = Double(studentModels.count) |
| | | } |
| | | |
| | | 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 |
| | | |
| | | //原价 |
| | | if let originPrice = subM.originalPrice{ |
| | | let attribute = AttributedStringbuilder.build().add(string: (originPrice * Double(studentModels.count)).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: (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 |
| | | } |
| | | |
| | |
| | | if let vipPrice = subM.vipPrice{ |
| | | let vipAttribute = AttributedStringbuilder.build() |
| | | .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) |
| | | .add(string: (vipPrice * Double(studentModels.count)).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) |
| | | .add(string: (vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) |
| | | label_vipPrice.attributedText = vipAttribute.mutableAttributedString |
| | | } |
| | | |
| | | if detailModel?.type == .experience{ |
| | | label_price.text = (subM.originalPrice ?? 0).currency() |
| | | label_price.text = subM.paymentPrice.currency() |
| | | view_teach.isHidden = true |
| | | label_originPrice.isHidden = true |
| | | label_vipPrice.isHidden = true |
| | | } |