| | |
| | | |
| | | |
| | | @IBOutlet weak var view_banner: UIView! |
| | | @IBOutlet weak var label_storeName: UILabel! |
| | | @IBOutlet weak var label_storeNames: UILabel! |
| | | @IBOutlet weak var label_title: UILabel! |
| | | @IBOutlet weak var label_joinCondition: UILabel! |
| | | @IBOutlet weak var label_address: UILabel! |
| | |
| | | super.viewDidLoad() |
| | | title = "活动详情" |
| | | |
| | | label_storeName.text = activityDetailModel.storeName + "(\(activityDetailModel.storeAddress))" |
| | | label_storeNames.text = activityDetailModel.storeInfos.map({$0.name}).joined(separator: ",") |
| | | btn_moreMatchStore.isHidden = (label_storeNames.text?.count ?? 0) < 50 |
| | | |
| | | label_title.text = activityDetailModel.name |
| | | label_joinCondition.text = activityDetailModel.registerCondition.strTitle |
| | | label_address.text = activityDetailModel.address |
| | |
| | | } |
| | | |
| | | @IBAction func matchStoreAction(_ sender: UIButton) { |
| | | AgreentView.show(type: .matchStore, content: "-------------") |
| | | let text = activityDetailModel.storeInfos.map({$0.name}).joined(separator: ",") |
| | | AgreentView.show(type: .matchStore, content: text) |
| | | } |
| | | |
| | | @IBAction func addStudentAction(_ sender: QMUIButton) { |
| | |
| | | if status{ |
| | | PaymentView.show(money: (ali:price,wx:price,coin:coin,course:course)) { [weak self] type in |
| | | guard let weakSelf = self else { return } |
| | | let ids = weakSelf.students.map({"\($0.id)"}).joined(separator: ",") |
| | | Services.paymentCompetition(id: weakSelf.activityDetailModel.id, userIds: ids, payType: type).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | switch type { |
| | | case .aliPay: |
| | | let req = YYAlipayRequest(orderString: m.orderString) |
| | | YYPaymentManager.shared.sendPaymentRequest(req) { result in |
| | | switch result { |
| | | case .success: |
| | | let vc = PaymentResultVC(result: .success, objType: .activityApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | weakSelf.present(vc, animated: true) |
| | | weakSelf.btn_enroll.setTitle("已报名", for: .normal) |
| | | weakSelf.btn_enroll.backgroundColor = UIColor.gray.withAlphaComponent(0.5) |
| | | case .cancel: |
| | | alert(msg: "已取消") |
| | | case .failure(let error): |
| | | let vc = PaymentResultVC(result: .fail(error.localizedDescription), objType: .activityApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | weakSelf.present(vc, animated: true) |
| | | } |
| | | } |
| | | case .wechat:break |
| | | case .coin,.courseNum: |
| | | if type == .courseNum{ |
| | | PaymentCourseView.show(id: weakSelf.activityDetailModel.id,number:course) { id in |
| | | weakSelf.payment(type: type,paymentId: id) |
| | | } |
| | | }else{ |
| | | weakSelf.payment(type: type) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private func payment(type:PayType,paymentId:Int? = nil){ |
| | | let ids = students.map({"\($0.id)"}).joined(separator: ",") |
| | | Services.paymentCompetition(id: activityDetailModel.id, userIds: ids, payType: type,coursePaymentId: paymentId).subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data{ |
| | | switch type { |
| | | case .aliPay: |
| | | let req = YYAlipayRequest(orderString: m.orderString) |
| | | YYPaymentManager.shared.sendPaymentRequest(req) { result in |
| | | switch result { |
| | | case .success: |
| | | let vc = PaymentResultVC(result: .success, objType: .activityApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | weakSelf.present(vc, animated: true) |
| | | weakSelf.btn_enroll.setTitle("已报名", for: .normal) |
| | | weakSelf.btn_enroll.backgroundColor = UIColor.gray.withAlphaComponent(0.5) |
| | | } |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | case .cancel: |
| | | alert(msg: "已取消") |
| | | case .failure(let error): |
| | | let vc = PaymentResultVC(result: .fail(error.localizedDescription), objType: .activityApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | weakSelf.present(vc, animated: true) |
| | | } |
| | | } |
| | | case .wechat:break |
| | | case .coin: |
| | | let vc = PaymentResultVC(result: .success, objType: .activityApply) |
| | | vc.modalPresentationStyle = .fullScreen |
| | | weakSelf.present(vc, animated: true) |
| | | weakSelf.btn_enroll.setTitle("已报名", for: .normal) |
| | | weakSelf.btn_enroll.backgroundColor = UIColor.gray.withAlphaComponent(0.5) |
| | | default:break |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | |
| | | extension ActivityDetailApplyVC:UITableViewDelegate{ |