| | |
| | | |
| | | class ActivitySignupDetailVC: BaseVC { |
| | | |
| | | private var id:Int! |
| | | @IBOutlet weak var view_banner: CommonBannerView! |
| | | // @IBOutlet weak var img_profile: UIImageView! |
| | | // @IBOutlet weak var label_storeNames: UILabel! |
| | | @IBOutlet weak var label_title: UILabel! |
| | | @IBOutlet weak var label_joinCondition: UILabel! |
| | | @IBOutlet weak var label_address: UILabel! |
| | | @IBOutlet weak var label_duetime: UILabel! |
| | | @IBOutlet weak var label_starttime: UILabel! |
| | | @IBOutlet weak var label_endtime: UILabel! |
| | | @IBOutlet weak var label_ageScope: UILabel! |
| | | @IBOutlet weak var label_city: UILabel! |
| | | @IBOutlet weak var label_money: UILabel! |
| | | @IBOutlet weak var label_totalMoney: UILabel! |
| | | @IBOutlet weak var label_introducion: UILabel! |
| | | @IBOutlet weak var img_enrollRequired: UIImageView! |
| | | @IBOutlet weak var cons_imgEnrollHei: NSLayoutConstraint! |
| | | @IBOutlet weak var btn_cancel: QMUIButton! |
| | | @IBOutlet weak var tableView: UITableView! |
| | | @IBOutlet weak var cons_tableHei: NSLayoutConstraint! |
| | | @IBOutlet weak var label_matchStore: UILabel! |
| | | @IBOutlet weak var btn_moreMatchStore: UIButton! |
| | | |
| | | var activityDetailModel:ActivityDetailModel?{ |
| | | didSet{ |
| | | private var id:Int! |
| | | @IBOutlet weak var view_banner: CommonBannerView! |
| | | // @IBOutlet weak var img_profile: UIImageView! |
| | | // @IBOutlet weak var label_storeNames: UILabel! |
| | | @IBOutlet weak var label_title: UILabel! |
| | | @IBOutlet weak var label_joinCondition: UILabel! |
| | | @IBOutlet weak var label_address: UILabel! |
| | | @IBOutlet weak var label_duetime: UILabel! |
| | | @IBOutlet weak var label_starttime: UILabel! |
| | | @IBOutlet weak var label_endtime: UILabel! |
| | | @IBOutlet weak var label_ageScope: UILabel! |
| | | @IBOutlet weak var label_city: UILabel! |
| | | @IBOutlet weak var label_money: UILabel! |
| | | @IBOutlet weak var label_totalMoney: UILabel! |
| | | @IBOutlet weak var label_introducion: UILabel! |
| | | @IBOutlet weak var img_enrollRequired: UIImageView! |
| | | @IBOutlet weak var cons_imgEnrollHei: NSLayoutConstraint! |
| | | @IBOutlet weak var btn_cancel: QMUIButton! |
| | | @IBOutlet weak var tableView: UITableView! |
| | | @IBOutlet weak var cons_tableHei: NSLayoutConstraint! |
| | | @IBOutlet weak var label_matchStore: UILabel! |
| | | @IBOutlet weak var btn_moreMatchStore: UIButton! |
| | | |
| | | guard let m = activityDetailModel else {return} |
| | | var activityDetailModel:ActivityDetailModel?{ |
| | | didSet{ |
| | | |
| | | guard let m = activityDetailModel else {return} |
| | | |
| | | |
| | | let imgs = m.imgs.components(separatedBy: ",") |
| | | var items = [CommonBannerModel]() |
| | | for (index,img) in imgs.enumerated(){ |
| | | items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl)) |
| | | } |
| | | view_banner.setItems(items: items) |
| | | let imgs = m.imgs.components(separatedBy: ",") |
| | | var items = [CommonBannerModel]() |
| | | for (index,img) in imgs.enumerated(){ |
| | | items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl)) |
| | | } |
| | | view_banner.setItems(items: items) |
| | | |
| | | label_title.text = m.name |
| | | label_joinCondition.text = m.registerCondition.strTitle + "参与" |
| | | label_address.text = m.address |
| | | label_duetime.text = m.registerEndTime |
| | | label_starttime.text = m.startTime |
| | | label_endtime.text = m.endTime |
| | | label_ageScope.text = m.age + "岁" |
| | | label_introducion.text = m.introduction |
| | | label_city.isHidden = m.province.isEmpty || m.city.isEmpty |
| | | label_city.text = m.province + "|" + m.city |
| | | label_matchStore.text = m.storeInfos.map({$0.name}).joined(separator: ",") |
| | | btn_moreMatchStore.isHidden = (label_matchStore.text?.count ?? 0) < 50 |
| | | label_title.text = m.name |
| | | label_joinCondition.text = m.registerCondition.strTitle + "参与" |
| | | label_address.text = m.address |
| | | label_duetime.text = m.registerEndTime |
| | | label_starttime.text = m.startTime |
| | | label_endtime.text = m.endTime |
| | | label_ageScope.text = m.age + "岁" |
| | | label_introducion.text = m.introduction |
| | | label_city.isHidden = m.province.isEmpty || m.city.isEmpty |
| | | label_city.text = m.province + "|" + m.city |
| | | label_matchStore.text = m.storeInfos.map({$0.name}).joined(separator: ",") |
| | | btn_moreMatchStore.isHidden = (label_matchStore.text?.count ?? 0) < 50 |
| | | |
| | | img_enrollRequired.sd_setImage(with: URL(string: m.registrationNotes)) {[weak self] image, error, type, url in |
| | | guard let img = image else { |
| | | self?.cons_imgEnrollHei.constant = 0;return |
| | | img_enrollRequired.sd_setImage(with: URL(string: m.registrationNotes)) {[weak self] image, error, type, url in |
| | | guard let img = image else { |
| | | self?.cons_imgEnrollHei.constant = 0;return |
| | | } |
| | | |
| | | let radio = img.size.width / img.size.height |
| | | self?.cons_imgEnrollHei.constant = JQ_ScreenW / radio |
| | | } |
| | | |
| | | switch m.payType { |
| | | case .wechat,.aliPay: |
| | | label_money.text = String(format: "%@/人", m.cashPrice.currency()) |
| | | label_totalMoney.text = String(format: "合计:%@", (m.cashPrice * Double(m.participant.count)).currency()) |
| | | case .coin: |
| | | label_money.text = String(format: "%ld币/人", m.playPaiCoin) |
| | | label_totalMoney.text = String(format: "合计:%ld币", (m.playPaiCoin * m.participant.count)) |
| | | case .courseNum: |
| | | label_money.text = String(format: "%ld课时/人", m.classPrice) |
| | | label_totalMoney.text = String(format: "合计:%ld课时", (m.classPrice * m.participant.count)) |
| | | default: |
| | | label_money.text = "未知" |
| | | label_totalMoney.text = "未知" |
| | | } |
| | | |
| | | cons_tableHei.constant = Double(m.participant.count) * 100 |
| | | tableView.reloadData() |
| | | |
| | | switch m.status { |
| | | case .prepare: |
| | | let name = m.apply == 1 ? "取消":"已取消" |
| | | let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") |
| | | btn_cancel.isUserInteractionEnabled = m.apply == 1 |
| | | btn_cancel.setTitle(name, for: .normal) |
| | | btn_cancel.backgroundColor = color |
| | | |
| | | if m.apply == 1{ |
| | | btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) |
| | | } |
| | | |
| | | case .ongoing: |
| | | let endTime = Date.jq_StringToTimeInterval(m.registerEndTime, "yyyy-MM-dd HH:mm") |
| | | let a = Date.jq_CalByDays(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)) |
| | | if Date.jq_CalByEnum(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)).minute > 0{ |
| | | let name = m.apply == 1 ? "取消":"已取消" |
| | | let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") |
| | | btn_cancel.isUserInteractionEnabled = m.apply == 1 |
| | | btn_cancel.setTitle(name, for: .normal) |
| | | btn_cancel.backgroundColor = color |
| | | if m.apply == 1{ |
| | | btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) |
| | | } |
| | | }else{ |
| | | btn_cancel.setTitle("进行中", for: .normal) |
| | | btn_cancel.isUserInteractionEnabled = false |
| | | btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") |
| | | } |
| | | |
| | | case .over: |
| | | btn_cancel.setTitle("已结束", for: .normal) |
| | | btn_cancel.isUserInteractionEnabled = false |
| | | btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") |
| | | case .cancel: |
| | | btn_cancel.setTitle("已取消", for: .normal) |
| | | btn_cancel.isUserInteractionEnabled = false |
| | | btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") |
| | | default:break |
| | | } |
| | | } |
| | | } |
| | | |
| | | let radio = img.size.width / img.size.height |
| | | self?.cons_imgEnrollHei.constant = JQ_ScreenW / radio |
| | | } |
| | | required init(id: Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.id = id |
| | | } |
| | | |
| | | switch m.payType { |
| | | case .wechat,.aliPay: |
| | | label_money.text = String(format: "%@/人", m.cashPrice.currency()) |
| | | label_totalMoney.text = String(format: "合计:%@", (m.cashPrice * Double(m.participant.count)).currency()) |
| | | case .coin: |
| | | label_money.text = String(format: "%ld币/人", m.playPaiCoin) |
| | | label_totalMoney.text = String(format: "合计:%ld币", (m.playPaiCoin * m.participant.count)) |
| | | case .courseNum: |
| | | label_money.text = String(format: "%ld课时/人", m.classPrice) |
| | | label_totalMoney.text = String(format: "合计:%ld课时", (m.classPrice * m.participant.count)) |
| | | default: |
| | | label_money.text = "未知" |
| | | label_totalMoney.text = "未知" |
| | | } |
| | | |
| | | cons_tableHei.constant = Double(m.participant.count) * 100 |
| | | tableView.reloadData() |
| | | |
| | | switch m.status { |
| | | case .prepare: |
| | | let name = m.apply == 1 ? "取消":"已取消" |
| | | let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") |
| | | btn_cancel.isUserInteractionEnabled = m.apply == 1 |
| | | btn_cancel.setTitle(name, for: .normal) |
| | | btn_cancel.backgroundColor = color |
| | | |
| | | if m.apply == 1{ |
| | | btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) |
| | | } |
| | | |
| | | case .ongoing: |
| | | let endTime = Date.jq_StringToTimeInterval(m.registerEndTime, "yyyy-MM-dd HH:mm") |
| | | let a = Date.jq_CalByDays(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)) |
| | | if Date.jq_CalByEnum(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)).minute > 0{ |
| | | let name = m.apply == 1 ? "取消":"已取消" |
| | | let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") |
| | | btn_cancel.isUserInteractionEnabled = m.apply == 1 |
| | | btn_cancel.setTitle(name, for: .normal) |
| | | btn_cancel.backgroundColor = color |
| | | if m.apply == 1{ |
| | | btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) |
| | | } |
| | | }else{ |
| | | btn_cancel.setTitle("进行中", for: .normal) |
| | | btn_cancel.isUserInteractionEnabled = false |
| | | btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") |
| | | } |
| | | |
| | | case .over: |
| | | btn_cancel.setTitle("已结束", for: .normal) |
| | | btn_cancel.isUserInteractionEnabled = false |
| | | btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") |
| | | case .cancel: |
| | | btn_cancel.setTitle("已取消", for: .normal) |
| | | btn_cancel.isUserInteractionEnabled = false |
| | | btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") |
| | | default:break |
| | | } |
| | | } |
| | | } |
| | | |
| | | required init(id: Int) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.id = id |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "活动详情" |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "活动详情" |
| | | |
| | | Services.queryMyCompetitionInfo(id: id).subscribe(onNext: {data in |
| | | self.activityDetailModel = data.data |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | Services.queryMyCompetitionInfo(id: id).subscribe(onNext: {data in |
| | | self.activityDetailModel = data.data |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | override func setUI() { |
| | | btn_cancel.imagePosition = .left |
| | | btn_cancel.spacingBetweenImageAndTitle = 12 |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "StudentInfo_2_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_2_TCell") |
| | | let moreBtnAttributeding = AttributedStringbuilder.build().add(string: "查看更多", withFont: UIFont.systemFont(ofSize: 12, weight: .medium), withColor: Def_ThemeColor).underLine(color: Def_ThemeColor).mutableAttributedString |
| | | btn_moreMatchStore.setAttributedTitle(moreBtnAttributeding, for: .normal) |
| | | } |
| | | override func setUI() { |
| | | btn_cancel.imagePosition = .left |
| | | btn_cancel.spacingBetweenImageAndTitle = 12 |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "StudentInfo_2_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_2_TCell") |
| | | let moreBtnAttributeding = AttributedStringbuilder.build().add(string: "查看更多", withFont: UIFont.systemFont(ofSize: 12, weight: .medium), withColor: Def_ThemeColor).underLine(color: Def_ThemeColor).mutableAttributedString |
| | | btn_moreMatchStore.setAttributedTitle(moreBtnAttributeding, for: .normal) |
| | | } |
| | | |
| | | @IBAction func matchStoreAction(_ sender: UIButton) { |
| | | if let content = activityDetailModel?.storeInfos.map({$0.name}).joined(separator: ","){ |
| | | AgreentView.show(type: .matchStore, content: content) |
| | | } |
| | | } |
| | | @IBAction func matchStoreAction(_ sender: UIButton) { |
| | | if let content = activityDetailModel?.storeInfos.map({$0.name}).joined(separator: ","){ |
| | | AgreentView.show(type: .matchStore, content: content) |
| | | } |
| | | } |
| | | |
| | | @IBAction func operationAction(_ sender: UIButton) { |
| | | CommonAlertView.show(title: "提示", content: "确认取消吗?取消后相关费用将会退还到原支付账户!") { [weak self]status in |
| | | guard let weakSelf = self else { return } |
| | | if status{ |
| | | Services.cancelMyCOmpetition(id: weakSelf.id).subscribe(onNext: { data in |
| | | alertSuccess(msg: "取消成功") |
| | | self?.btn_cancel.setTitle("已取消", for: .normal) |
| | | self?.btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") |
| | | NotificationCenter.default.post(name: CancelActivitySingup_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | } |
| | | } |
| | | @IBAction func operationAction(_ sender: UIButton) { |
| | | CommonAlertView.show(title: "提示", content: "确认取消吗?取消后相关费用将会退还到原支付账户!") { [weak self]status in |
| | | guard let weakSelf = self else { return } |
| | | if status{ |
| | | Services.cancelMyCOmpetition(id: weakSelf.id).subscribe(onNext: { data in |
| | | alertSuccess(msg: "取消成功") |
| | | self?.btn_cancel.setTitle("已取消", for: .normal) |
| | | self?.btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") |
| | | NotificationCenter.default.post(name: CancelActivitySingup_Noti, object: nil) |
| | | NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | extension ActivitySignupDetailVC:UITableViewDataSource{ |
| | | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| | | let student = activityDetailModel!.participant[indexPath.row] |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfo_2_TCell") as! StudentInfo_2_TCell |
| | | cell.indexPath = indexPath |
| | | cell.activityDetailPartModel = student |
| | | cell.btn_edit.isHidden = true |
| | | cell.img_radio.isHidden = true |
| | | cell.btn_delete.isHidden = true |
| | | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| | | let student = activityDetailModel!.participant[indexPath.row] |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfo_2_TCell") as! StudentInfo_2_TCell |
| | | cell.indexPath = indexPath |
| | | cell.activityDetailPartModel = student |
| | | cell.btn_edit.isHidden = true |
| | | cell.img_radio.isHidden = true |
| | | cell.btn_delete.isHidden = true |
| | | |
| | | return cell |
| | | } |
| | | return cell |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| | | return activityDetailModel?.participant.count ?? 0 |
| | | } |
| | | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| | | return activityDetailModel?.participant.count ?? 0 |
| | | } |
| | | } |
| | | |