From 858bd6df13a6a6415d12d8e60141575574646f58 Mon Sep 17 00:00:00 2001 From: younger_times <841720330@qq.com> Date: 星期一, 24 七月 2023 18:23:48 +0800 Subject: [PATCH] 新增 --- WanPai/Root/Search/VC/SearchStoreDetailVC.swift | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 51 insertions(+), 3 deletions(-) diff --git a/WanPai/Root/Search/VC/SearchStoreDetailVC.swift b/WanPai/Root/Search/VC/SearchStoreDetailVC.swift index 041a755..4b87647 100644 --- a/WanPai/Root/Search/VC/SearchStoreDetailVC.swift +++ b/WanPai/Root/Search/VC/SearchStoreDetailVC.swift @@ -10,6 +10,15 @@ import QMUIKit class SearchStoreDetailVC: BaseVC { + private var id:Int! + private var searchStoreDetailModel:SearchStoreDetailModel?{ + didSet{ + if let m = searchStoreDetailModel{ + headView.searchStoreDetailModel = m + tableView.reloadData() + } + } + } lazy private var tableView:UITableView = { let table = UITableView(frame: .zero, style: .grouped) @@ -23,6 +32,15 @@ private let headView = SearchStoreDetailHeadView.jq_loadNibView() + init(id:Int) { + super.init(nibName: nil, bundle: nil) + self.id = id + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + override func viewDidLoad() { super.viewDidLoad() title = "门店详情" @@ -35,6 +53,12 @@ self.tableView.tableHeaderView = self.headView } + Services.exploreStoreDetail(storeId: id).subscribe(onNext: {[weak self] data in + if let model = data.data{ + self?.searchStoreDetailModel = model + } + }).disposed(by: disposeBag) + } override func setUI() { @@ -46,16 +70,28 @@ tableView.layoutIfNeeded() tableView.tableHeaderView = headView } + + @objc func moreAction(btn:UIButton){ + if btn.tag == 10{ + let vc = YardListVC() + push(vc: vc) + }else{ + let vc = CourseListVC() + push(vc: vc) + } + } } extension SearchStoreDetailVC:UITableViewDelegate{ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.section == 0{ - let vc = YardListVC() + let model = searchStoreDetailModel!.venueList[indexPath.row] + let vc = YardDetailVC(id: model.siteId) push(vc: vc) }else{ - let vc = CourseDetailVC(id: 0) + let model = searchStoreDetailModel!.courseVoList[indexPath.row] + let vc = CourseDetailVC(id: model.courseId) push(vc: vc) } } @@ -104,11 +140,13 @@ let morebtn = QMUIButton(type: .custom) morebtn.setTitle("查看更多", for: .normal) + morebtn.tag = 10+section morebtn.titleLabel?.font = UIFont.systemFont(ofSize: 12, weight: .medium) morebtn.setTitleColor(UIColor(hexStr: "#0048FF"), for: .normal) morebtn.setImage(UIImage(named: "btn_more"), for: .normal) morebtn.imagePosition = .right morebtn.spacingBetweenImageAndTitle = 3 + morebtn.addTarget(self, action: #selector(moreAction), for: .touchUpInside) footView?.contentView.addSubview(morebtn) morebtn.snp.makeConstraints { make in @@ -116,13 +154,18 @@ } } + return footView } } extension SearchStoreDetailVC:UITableViewDataSource{ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return 10 + if section == 0{ + return searchStoreDetailModel?.venueList.count ?? 0 + }else{ + return searchStoreDetailModel?.courseVoList.count ?? 0 + } } func numberOfSections(in tableView: UITableView) -> Int { @@ -132,9 +175,14 @@ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.section == 0{ let cell = tableView.dequeueReusableCell(withIdentifier: "_YardTCell") as! YardTCell + let model = searchStoreDetailModel!.venueList[indexPath.row] + cell.venueModel = model + cell.label_distance.isHidden = true return cell }else { let cell = tableView.dequeueReusableCell(withIdentifier: "_SearchStoreDetail_1_TCell") as! SearchStoreDetail_1_TCell + let model = searchStoreDetailModel!.courseVoList[indexPath.row] + cell.detailCourseModel = model return cell } } -- Gitblit v1.7.1