| | |
| | | if detailModel.registrationClosingTime != nil{ |
| | | label_duetime.text = detailModel.registrationClosingTime |
| | | }else{ |
| | | label_duetime.text = "无截止时间" |
| | | label_duetime.text = detailModel.endTime |
| | | } |
| | | |
| | | |
| | |
| | | alert(msg: "请选择参赛人员");return |
| | | } |
| | | |
| | | |
| | | StoresInfoView.show(detailModel.storeInfos.first ?? ActivityDetailStoreModel(),type: .worldCup) {[weak self] status in |
| | | guard let weakSelf = self else { return } |
| | | if status{ |
| | | var result = [Dictionary<String,Int>]() |
| | | for v in weakSelf.students{ |
| | | result.append(["id":v.id,"isStudent":v.isStudent]) |
| | | } |
| | | |
| | | var money:Double = 0 |
| | | var paiCoin:Int = 0 |
| | | var classHour:Int = 0 |
| | | |
| | | money = weakSelf.detailModel.cash * Double(weakSelf.students.count) |
| | | paiCoin = weakSelf.detailModel.paiCoin * weakSelf.students.count |
| | | classHour = weakSelf.detailModel.classHour * weakSelf.students.count |
| | | |
| | | if money == 0 && paiCoin == 0 && classHour == 0{ |
| | | weakSelf.payment(payType: .free, result: result) |
| | | if detailModel.storeInfos.count == 1{ |
| | | StoresInfoView.show(detailModel.storeInfos.first ?? ActivityDetailStoreModel(),type: .worldCup) {[weak self] status in |
| | | if status{ |
| | | self?.showPaymentView() |
| | | }else{ |
| | | PaymentView.show(enumType: .worldCup, money: (ali: money, wx: money, coin: paiCoin, course:classHour, integral: nil)) {[weak self] payType in |
| | | guard let weakSelf = self else { return } |
| | | weakSelf.payment(payType: payType, result: result) |
| | | } |
| | | self?.navigationController?.popToRootViewController(animated: true) |
| | | NotificationCenter.default.post(name: ChooseHomeStore_Noti, object: nil) |
| | | } |
| | | }else{ |
| | | weakSelf.navigationController?.popToRootViewController(animated: true) |
| | | NotificationCenter.default.post(name: ChooseHomeStore_Noti, object: nil) |
| | | } |
| | | }else{ |
| | | let stores = detailModel.storeInfos.map({$0.name}) |
| | | StoresInfo_2_View.show(stores) {[weak self] status in |
| | | if status{ |
| | | self?.showPaymentView() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private func showPaymentView(){ |
| | | var result = [Dictionary<String,Int>]() |
| | | for v in students{ |
| | | result.append(["id":v.id,"isStudent":v.isStudent]) |
| | | } |
| | | |
| | | var money:Double = 0 |
| | | var paiCoin:Int = 0 |
| | | var classHour:Int = 0 |
| | | |
| | | //选中有非学员,显示课时支付灰色 |
| | | let hasNotStudent = students.filter({$0.isStudent == 0}).count > 0 |
| | | |
| | | money = detailModel.cash * Double(students.count) |
| | | paiCoin = detailModel.paiCoin * students.count |
| | | classHour = detailModel.classHour * students.count |
| | | |
| | | if money == 0 && paiCoin == 0 && classHour == 0{ |
| | | payment(payType: .free, result: result) |
| | | }else{ |
| | | PaymentView.show(enumType: .worldCup, money: (ali: money, wx: money, coin: paiCoin, course:classHour, integral: nil),hasNotStudent: hasNotStudent) {[weak self] payType in |
| | | guard let weakSelf = self else { return } |
| | | weakSelf.payment(payType: payType, result: result) |
| | | } |
| | | } |
| | | } |
| | |
| | | case .cancel: |
| | | alert(msg: "交易取消") |
| | | case .failure(_): |
| | | let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .worldCup) |
| | | let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .worldCup){[weak self] () in |
| | | self?.showPaymentView() |
| | | } |
| | | self?.push(vc: vc) |
| | | } |
| | | } |
| | |
| | | if let er = error as? NetworkRequest.NetRequestError{ |
| | | switch er { |
| | | case .Other(let code,let string): |
| | | let vc = PaymentResultVC(result: .fail(string,code), objType: .worldCup) |
| | | let vc = PaymentResultVC(result: .fail(string,code), objType: .worldCup) {[weak self] () in |
| | | self?.showPaymentView() |
| | | } |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | default: |
| | | let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .worldCup) |
| | | let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .worldCup){[weak self] () in |
| | | self?.showPaymentView() |
| | | } |
| | | JQ_currentViewController().jq_push(vc: vc) |
| | | } |
| | | } |