| | |
| | | @IBOutlet weak var label_originPrice: UILabel! |
| | | @IBOutlet weak var label_vipPrice: UILabel! |
| | | @IBOutlet weak var label_coin: UILabel! |
| | | @IBOutlet weak var btn_hasCoupon: TapBtn! |
| | | // @IBOutlet weak var btn_hasCoupon: TapBtn! |
| | | @IBOutlet weak var btn_couponInfo: UIButton! |
| | | @IBOutlet weak var label_courseType: UILabel! |
| | | |
| | |
| | | cons_tableHei.constant = CGFloat(studentModels.count * 87) |
| | | tableView.reloadData() |
| | | |
| | | queryCouponInfo {[weak self] () in |
| | | guard let weakSelf = self else { return } |
| | | self?.changePrice(weakSelf.selectClassIndex) |
| | | } |
| | | |
| | | let imgs = m.detailDrawing.components(separatedBy: ",") |
| | | var items = [CommonBannerModel]() |
| | | for (index,img) in imgs.enumerated(){ |
| | |
| | | view_banner.setItems(items: items) |
| | | } |
| | | |
| | | if var m = signUpModel{ |
| | | if let m = signUpModel{ |
| | | classHours = m.chooseHours |
| | | detailModel?.list = m.list.filter({$0.classHours == classHours}) |
| | | |
| | | if m.payStatus == .unPayment{ |
| | | btn_handleBtn.setTitle("待支付", for: .normal) |
| | | btn_addStudent.isHidden = true |
| | | btn_coupon.isHidden = true |
| | | |
| | | studentModels.removeAll() |
| | | Services.queryStudentList().subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let students = data.data{ |
| | | for stu in students{ |
| | | if m.stuIds.contains(where: {$0 == stu.id}){ |
| | | weakSelf.studentModels.append(stu) |
| | | weakSelf.cons_tableHei.constant = CGFloat(weakSelf.studentModels.count * 87) |
| | | weakSelf.tableView.reloadData() |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | if m.payStatus == .paymented{ |
| | |
| | | btn_addStudent.isHidden = true |
| | | } |
| | | } |
| | | |
| | | queryCouponInfo {[weak self] () in |
| | | guard let weakSelf = self else { return } |
| | | self?.changePrice(weakSelf.selectClassIndex) |
| | | } |
| | | } |
| | | |
| | | override func setUI() { |
| | | |
| | | btn_hasCoupon.isHidden = true |
| | | btn_coupon.isHidden = true |
| | | CellW = (JQ_ScreenW - 155) / 3.0 |
| | | CellH = CellW * 0.439 |
| | | |
| | |
| | | price = model.paymentPrice |
| | | } |
| | | |
| | | //计算人数总价 |
| | | //计算人数总价 |
| | | price = price * Double(weakSelf.studentModels.count) |
| | | |
| | | //减去优惠 |
| | | let discountPrice = price - (weakSelf.selectCouponModel?.favorable ?? 0) |
| | | let coin = model.playPaiCoin * weakSelf.studentModels.count |
| | | //减去优惠 |
| | | var discountPrice = price - (weakSelf.selectCouponModel?.favorable ?? 0) |
| | | var coin = model.playPaiCoin * weakSelf.studentModels.count |
| | | |
| | | //待支付订单 ,取最终订单金额 |
| | | if weakSelf.signUpModel?.payStatus == .unPayment{ |
| | | discountPrice = weakSelf.signUpModel?.payPrice ?? 0 |
| | | coin = weakSelf.signUpModel?.coinPrice ?? 0 |
| | | } |
| | | |
| | | PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil,integral:nil)) { [weak self] payType in |
| | | guard let weakSelf = self else { return } |
| | |
| | | switch payType { |
| | | case .aliPay,.wechat: |
| | | resultPayPrice = price |
| | | |
| | | //待支付订单单独处理 |
| | | if weakSelf.signUpModel?.payStatus == .unPayment{ |
| | | resultPayPrice = weakSelf.signUpModel?.payPrice ?? 0 |
| | | } |
| | | |
| | | case .coin: |
| | | resultPayPrice = Double(coin) |
| | | case .courseNum,.integral:break |
| | | } |
| | | |
| | | Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: resultPayPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in |
| | | Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: resultPayPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id}),orderId: weakSelf.signUpModel?.coursePayId).subscribe(onNext: { data in |
| | | if data.code == 200{ |
| | | switch payType { |
| | | case .aliPay: |
| | |
| | | |
| | | //计算价格 |
| | | private func changePrice(_ index:Int){ |
| | | |
| | | //待支付订单,终止后续 |
| | | if signUpModel?.payStatus == .unPayment{ |
| | | |
| | | label_price.isHidden = true |
| | | label_originPrice.isHidden = signUpModel!.payPrice == signUpModel!.orinPrice |
| | | label_vipPrice.isHidden = true |
| | | label_coin.isHidden = true |
| | | |
| | | let originPrice = signUpModel!.orinPrice - signUpModel!.payPrice |
| | | label_originPrice.attributedText = AttributedStringbuilder.build().add(string: originPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).delLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).mutableAttributedString |
| | | |
| | | |
| | | if signUpModel?.coinPrice != 0{ |
| | | label_coin.isHidden = false |
| | | label_coin.attributedText = AttributedStringbuilder.build() |
| | | .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) |
| | | .add(string: "\(signUpModel!.coinPrice)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")).mutableAttributedString |
| | | } |
| | | |
| | | if signUpModel?.payPrice != 0{ |
| | | label_price.isHidden = false |
| | | label_price.text = (signUpModel!.payPrice).currency() |
| | | } |
| | | return |
| | | } |
| | | |
| | | |
| | | if let subM = detailModel?.list[index]{ |
| | | |
| | | var studentCount:Int = 0 |
| | |
| | | label_vipPrice.isHidden = true |
| | | label_coin.isHidden = false |
| | | //纯玩湃币没有优惠券项 |
| | | btn_hasCoupon.isHidden = true |
| | | btn_coupon.isHidden = true |
| | | label_coin.isHidden = false |
| | | //玩湃币 |
| | | label_coin.attributedText = AttributedStringbuilder.build() |
| | |
| | | //玩湃币 |
| | | 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 |
| | | |
| | | //原价 |
| | | 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)) |
| | |
| | | |
| | | Services.queryAvaiableCopons(id: detailModel!.id, price: price!).subscribe(onNext: { [weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | self?.btn_hasCoupon.isHidden = (data.data?.count ?? 0) == 0 |
| | | self?.btn_coupon.isHidden = (data.data?.count ?? 0) == 0 || weakSelf.signUpModel?.payStatus == .unPayment |
| | | self?.couponModels = data.data ?? [] |
| | | self?.label_couponInfo.isHidden = (data.data?.count ?? 0) == 0 |
| | | |