GYS_HZ_Vc.swift 3.06 KB
//
//  GYS_HZ_Vc.swift
//  GeliBusinessPlatform
//
//  Created by junye lu on 2020/11/3.
//  Copyright © 2020 junye lu. All rights reserved.
//

import UIKit

class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_GuanLi_CellDelegate{
   
    func GYS_GuanLi_CellStopAction(idx:Int) {
        print("target = ",idx)
    }
    var keyword = ""
    func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
        print("点击搜索进行--")
        searchBar.resignFirstResponder()
        keyword = searchBar.text!
        
    }
    //MARK:--取消搜索代理
    func clearSearchAction() {
        print("取消搜索代理了--")
    }
    func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
        print("编辑即将结束了--")
        if searchBar.text?.count == 0 && keyword.count != 0{
            keyword = searchBar.text!
        }
        print("key - ",searchBar.text!)
    }
    func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
        print("调起搜索后添加个蒙版本")
        
        return true
    }
    var title_str = ""
    weak var searchV: SearchBarView? = nil
    @IBOutlet weak var search_view: UIView!
    @IBOutlet weak var home_list_tbv: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()
        
        SetTopFrame(view: search_view, height: 44)
        
        navbar.title = title_str
        self.view.addSubview(navbar)
        
        let searchBr = SearchBarView.init()
        searchV = searchBr
         
        var holder_str = "请输入供应商名称"
        if title_str == "分销商管理" {
            navbar.rightTitle = "新增店铺"
//            holder_str = "请输入供应商名称"
        }
        
        searchBr.placeholderStr = holder_str
        self.search_view.addSubview(searchBr)
        searchV?.changecornerRadius(cornerRadius: 35*0.5)
        searchBr.delegate = self
        searchBr.delegateL = self
        searchBr.snp.makeConstraints { (make) in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.centerY.equalToSuperview()
            make.height.equalTo(35)
        }
        
        home_list_tbv.register(UINib(nibName: "GYS_GuanLi_Cell", bundle: nil), forCellReuseIdentifier: "GYS_GuanLi_Cell")
        home_list_tbv.separatorStyle = .none
        // Do any additional setup after loading the view.
    }

//MARK: - tableview_delegate
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 3
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_GuanLi_Cell") as! GYS_GuanLi_Cell
        cell.delegate = self
        if title_str == "分销商管理" {
            cell.isFenXiaoShang = true
        }
        cell.tag = indexPath.row
        return cell
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 148
    }
}