Commit e574e7d7 authored by lujunye's avatar lujunye

sdfsadfasdf323234234

parent 11aa1dd7
...@@ -300,7 +300,7 @@ class getVehicleTypeData_model: Mappable { ...@@ -300,7 +300,7 @@ class getVehicleTypeData_model: Mappable {
var truckVolume : String? //体积 var truckVolume : String? //体积
var img :String?//图片 var img :String?//图片
var truckWeight:Float?//载重 var truckWeight:String?//载重
var name : String? var name : String?
var istailplate :Int? //是否有尾板车型0没有尾板1有尾板 var istailplate :Int? //是否有尾板车型0没有尾板1有尾板
......
...@@ -198,6 +198,81 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -198,6 +198,81 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
@IBOutlet weak var YuGuPriceLbl: UILabel! @IBOutlet weak var YuGuPriceLbl: UILabel!
func pph_showScrollUI(){
//左右按钮
for item in pph_lineArr{
if item.tag == pph_selectCarType {
item.isHidden = false
}else{
item.isHidden = true
}
}
for item in pph_btnArr {
if item.tag == pph_selectCarType {
item.isSelected = true
item.setTitleColor(UIColor(named: "green"), for: .normal)
}else{
item.isSelected = false
item.setTitleColor(UIColor(named: "提示语字体颜色"), for: .normal)
}
}
let btn = pph_btnArr[pph_selectCarType]
let idx = IndexPath(row: 0, section: 0)
let cell = pph_listView.cellForRow(at:idx) as! HLLTopCell
let w = cell.scViewBg.bounds.size.width
cell.scrollView?.setContentOffset(CGPoint(x: pph_selectCarType * Int(w), y: 0), animated: true)
cell.idx = pph_selectCarType
let x = btn.frame.minX
let rect = CGRect(x: Int(x), y: 0, width: Int(w), height: 1)
pph_topBtnScv.scrollRectToVisible(rect, animated: true)
//刷新
// if adrArr.count > 0 {
// let firstData = adrArr.first! as NSDictionary
// if firstData["locName"] as! String != "空" && adrArr.count > 1 {
//
// var adrDs:Array<Any> = []
// adrDs.removeAll()
// for item in adrArr {
// let data = item["adr"] as! cityListDataModel
//
// let dict = ["lat":data.lat_lon!.lat!,"lon":data.lat_lon!.lon!,"city_id":data.city_id!] as [String : Any]
//
// adrDs.append(dict)
// }
//
// let lat_lon_arr = dataChangeString(sender: adrDs)
//
// let fD = adrArr.first!
// let cityData = fD["adr"] as! cityListDataModel
// let params = ["user_token":UserToken as Any,
// "nonce_str":nonce_str as Any,
// "city_id":cityData.city_id as Any,
// "city_info_revision":carModel?.revision as Any,
// "order_vehicle_id":carTypesArr[selectCarType].order_vehicle_id as Any,
// "std_tag_arr":"" as Any,
// "spec_req_arr":spec_select_arr as Any,
// "lat_lon_arr":lat_lon_arr as Any
// ]
// orderPriceCalculate(params, success: { (data) in
// let model = data as! orderPriceCalculateModel
// self.YuGuPriceLbl.text = "\(model.data!.total_price_fen!/100)"
// self.logisticsCostModel = model
// let view = self.hListView.footerView(forSection: 1)
//
// view?.layoutIfNeeded()
//
//
// self.hListView.reloadData()
// }) { (err) in
//
// }
// }
// }
self.pph_listView.reloadData()
}
func showScrollUI(){ func showScrollUI(){
//左右按钮 //左右按钮
for item in lineArr{ for item in lineArr{
...@@ -293,6 +368,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -293,6 +368,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
var carModel:cityCartDataModel? var carModel:cityCartDataModel?
var pph_carModel:getVehicleTypeData_model?
fileprivate func extractedFunc() { fileprivate func extractedFunc() {
HUD.flash(.progress) HUD.flash(.progress)
...@@ -462,6 +538,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -462,6 +538,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
var bgBtn:UIButton? var bgBtn:UIButton?
var btmView:UIView? var btmView:UIView?
@IBOutlet weak var pph_topCarBtnView: UIView!
@IBOutlet weak var topCarBtnSelectView: UIView! @IBOutlet weak var topCarBtnSelectView: UIView!
var adrArr:Array<NSDictionary> = [] var adrArr:Array<NSDictionary> = []
...@@ -794,7 +871,14 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -794,7 +871,14 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
var selectCarType = 0 var selectCarType = 0
var carTypesArr:Array<vehicle_arr_data> = [] var carTypesArr:Array<vehicle_arr_data> = []
var isPPH_Already = true
var pph_selectCarType = 0
var pphCarTypesArr:Array<getVehicleTypeData_model> = []
@IBAction func selectAction(_ sender: UIButton) { @IBAction func selectAction(_ sender: UIButton) {
closeCarList()
pph_closeCarList()
lineV.frame.origin.x = fullScreenWidth * 0.333 * CGFloat(sender.tag) lineV.frame.origin.x = fullScreenWidth * 0.333 * CGFloat(sender.tag)
if rightBtn == sender {//货拉拉 if rightBtn == sender {//货拉拉
hBtnViewH.constant = CGFloat(TabHeight) hBtnViewH.constant = CGFloat(TabHeight)
...@@ -834,6 +918,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -834,6 +918,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
} }
}else{ }else{
if leftBtn == sender {//普通冷运 if leftBtn == sender {//普通冷运
locBtn.isUserInteractionEnabled = false locBtn.isUserInteractionEnabled = false
rightBtn.isSelected = false rightBtn.isSelected = false
...@@ -841,18 +926,71 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -841,18 +926,71 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
p_p_view.isHidden = true p_p_view.isHidden = true
pin_pin_huo.isSelected = false pin_pin_huo.isSelected = false
hllView.isHidden = true hllView.isHidden = true
closeCarList()
}else{//拼拼货 }else{//拼拼货
rightBtn.isSelected = false rightBtn.isSelected = false
leftBtn.isSelected = false leftBtn.isSelected = false
pin_pin_huo.isSelected = true pin_pin_huo.isSelected = true
hllView.isHidden = true hllView.isHidden = true
p_p_view.isHidden = false p_p_view.isHidden = false
pphCarList()
} }
} }
} }
func pphCarList(){
rightBtn.isSelected = false
leftBtn.isSelected = false
hllView.isHidden = true
pin_pin_huo.isSelected = true
p_p_view.isHidden = false
locBtn.isUserInteractionEnabled = true
for item in adrDatas {
if setCityId(name1: item.name!, name2: item.name_en!){
city_id = item.city_id!
}
}
getPPHCar()
let line = UIView()
line.backgroundColor = UIColor(named: "灰色分界线")
topCarBtnSelectView.addSubview(line)
line.snp_makeConstraints { (make) in
make.height.equalTo(1)
make.left.right.bottom.equalTo(0)
}
}
fileprivate func getPPHCar(){
getVehicleType(["user_token":UserToken as Any]) { (data) in
let model = data as! getVehicleType_model
if model.data == nil {
HUD.flash(.label("暂无数据"), delay: 1.2)
return
}
self.pph_carModel = model.data?.first
self.carTypesArr.removeAll()
for item in model.data! {
self.pphCarTypesArr.append(item)
}
if self.pphCarTypesArr.count == 0 {
HUD.flash(.label("暂无车型可供选择"), delay: 1.2)
}
let cell = self.pph_listView.cellForRow(at: IndexPath(row: 0, section: 0)) as! HLLTopCell
cell.idx = 0
cell.scrollView?.setContentOffset(CGPoint(x: 0, y: 0), animated: false)
cell.tjLbl.text = "--"
cell.sizeLbl.text = "--"
cell.weightLbl.text = "--"
let view = self.pph_listView.footerView(forSection: 0)
view?.layoutIfNeeded()
self.setPPHBtnUI(carTypesArr: self.pphCarTypesArr,view: self.pph_topCarBtnView)
self.pph_listView.reloadData()
HUD.hide()
} failture: { (err) in
}
}
func setCityId(name1:String,name2:String)->Bool{ func setCityId(name1:String,name2:String)->Bool{
if selectLoc.contains(name1) || selectLoc.localizedLowercase.contains(name2){ if selectLoc.contains(name1) || selectLoc.localizedLowercase.contains(name2){
return true return true
...@@ -864,6 +1002,8 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -864,6 +1002,8 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
rightBtn.isSelected = true rightBtn.isSelected = true
leftBtn.isSelected = false leftBtn.isSelected = false
hllView.isHidden = false hllView.isHidden = false
pin_pin_huo.isSelected = false
p_p_view.isHidden = true
locBtn.isUserInteractionEnabled = true locBtn.isUserInteractionEnabled = true
for item in adrDatas { for item in adrDatas {
if setCityId(name1: item.name!, name2: item.name_en!){ if setCityId(name1: item.name!, name2: item.name_en!){
...@@ -993,6 +1133,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -993,6 +1133,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
// } // }
} }
@IBOutlet weak var pph_listView: UITableView!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -1043,7 +1184,9 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1043,7 +1184,9 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
//MARK: - 拼拼货 //MARK: - 拼拼货
pph_listView.register(UINib(nibName: "HLLTopCell", bundle: nil), forCellReuseIdentifier: "HLLTopCell")
pph_listView.register(UINib(nibName: "OnlyViewCell", bundle: nil), forCellReuseIdentifier: "OnlyViewCell")
pph_listView.register(UINib(nibName: "TitleAndTFBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFBtnCell")
} }
//MARK:--//冷运请求期望上门时间 //MARK:--//冷运请求期望上门时间
...@@ -1736,7 +1879,18 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1736,7 +1879,18 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
return 49 return 49
}else{//货拉拉 }else if tableView == hListView{//货拉拉
if indexPath.section == 0 {
if indexPath.row == 0 {
return 181
}
return UITableView.automaticDimension
}
if indexPath.section == 1 {
return UITableView.automaticDimension
}
return 49
}else{//拼拼货
if indexPath.section == 0 { if indexPath.section == 0 {
if indexPath.row == 0 { if indexPath.row == 0 {
return 181 return 181
...@@ -1841,7 +1995,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1841,7 +1995,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
cell.nameLbl.text = title2Arr[indexPath.row] cell.nameLbl.text = title2Arr[indexPath.row]
return cell return cell
} }
}else{ }else if tableView == hListView{
//MARK: - 货拉拉cell //MARK: - 货拉拉cell
if indexPath.section == 0 { if indexPath.section == 0 {
if indexPath.row == 1 { if indexPath.row == 1 {
...@@ -1980,8 +2134,40 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1980,8 +2134,40 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFBtnCell") as! TitleAndTFBtnCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFBtnCell") as! TitleAndTFBtnCell
cell.nameLbl.text = hPart3[indexPath.row] cell.nameLbl.text = hPart3[indexPath.row]
return cell return cell
}else{//MARK: - 拼拼货
if indexPath.section == 0 {
if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: "OnlyViewCell") as! OnlyViewCell
cell.isPPH = true
cell.pph_datas = pphCarTypesArr
cell.delegate = self
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "HLLTopCell") as! HLLTopCell
cell.pph_datas = pphCarTypesArr
cell.isPPH = true
cell.delegate = self
cell.idx = pph_selectCarType
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFBtnCell") as! TitleAndTFBtnCell
return cell
}
} }
@objc func pph_topBtnClick(btn:UIButton){
//顶栏按钮
pph_selectCarType = btn.tag
pph_showScrollUI()
let idx = IndexPath(row: 0, section: 0)
let cell = hListView.cellForRow(at:idx) as! HLLTopCell
cell.scrollView?.setContentOffset(CGPoint(x: pph_selectCarType * Int(CGFloat(cell.scViewBg.bounds.size.width)), y: 0), animated: true)
} }
@objc func topBtnClick(btn:UIButton){ @objc func topBtnClick(btn:UIButton){
//顶栏按钮 //顶栏按钮
...@@ -1996,6 +2182,103 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1996,6 +2182,103 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
var btnArr:Array<UIButton> = [] var btnArr:Array<UIButton> = []
var lineArr:Array<UIView> = [] var lineArr:Array<UIView> = []
var topBtnScv:UIScrollView! var topBtnScv:UIScrollView!
var pph_btnArr:Array<UIButton> = []
var pph_lineArr:Array<UIView> = []
var pph_topBtnScv:UIScrollView!
//拼拼货
func setPPHBtnUI(carTypesArr:Array<getVehicleTypeData_model>,view:UIView){
isPPH_Already = false
pph_btnArr.removeAll()
pph_lineArr.removeAll()
for item in view.subviews {
item.removeFromSuperview()
}
let scv = UIScrollView(frame: view.bounds)
view.addSubview(scv)
pph_topBtnScv = scv
var scvContentWidth = 0
scv.showsHorizontalScrollIndicator = false
scv.tag = 99
for i in 0 ..< carTypesArr.count {
let btn = UIButton()
let model = carTypesArr[i]
btn.setTitle(model.name, for: .normal)
btn.tag = i
scv.addSubview(btn)
btn.sizeToFit()
var x:CGFloat = 0
if pph_btnArr.count != 0 {
let button = pph_btnArr[i-1]
x = button.frame.maxX
}
btn.frame = CGRect(x:x, y: 0, width: btn.bounds.size.width + 6, height: 44)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "提示语字体颜色"), for: .normal)
btn.addTarget(self, action: #selector(pph_topBtnClick(btn:)), for: .touchUpInside)
pph_btnArr.append(btn)
scvContentWidth += Int(btn.bounds.size.width)
let topBtnLine = UIView()
topBtnLine.tag = btn.tag
topBtnLine.backgroundColor = UIColor(named: "green")
topBtnLine.layer.cornerRadius = 1.25
topBtnLine.layer.masksToBounds = true
topBtnLine.isHidden = true
btn.addSubview(topBtnLine)
topBtnLine.snp.makeConstraints { (make) in
make.bottom.equalToSuperview()
make.left.equalTo(10)
make.right.equalTo(-10)
make.height.equalTo(3)
}
pph_lineArr.append(topBtnLine)
}
scv.contentSize = CGSize(width: scvContentWidth, height:1)
if carTypesArr.count > 5 {
let button = UIButton(frame: CGRect(x: fullScreenWidth-44, y: 0, width: 44, height: 44))
button.backgroundColor = UIColor.white
button.setImage(UIImage(named: "dot"), for: .normal)
view.addSubview(button)
button.addTarget(self, action: #selector(pph_selectAllCars), for: .touchUpInside)
let line2 = UIView()
line2.backgroundColor = UIColor(named: "灰色分界线")
view.addSubview(line2)
line2.snp_makeConstraints { (make) in
make.height.equalTo(1)
make.right.left.equalTo(0)
make.bottom.equalTo(0)
}
let line = UIView()
line.backgroundColor = UIColor(named: "灰色分界线")
view.addSubview(line)
line.snp_makeConstraints { (make) in
make.height.equalTo(30)
make.width.equalTo(1)
make.right.equalTo(button.snp_left)
make.centerY.equalTo(view.snp_centerY)
}
scv.snp.updateConstraints { (make) in
make.top.left.bottom.equalToSuperview()
make.right.equalTo(line.snp.left)
}
}
if pph_btnArr.count > 0 {
let btn = pph_btnArr.first
btn!.isSelected = true
btn!.setTitleColor(UIColor(named: "green"), for: .normal)
let line = pph_lineArr.first
line!.isHidden = false
}
}
//货拉拉
func setBtnUI(carTypesArr:Array<vehicle_arr_data>,view:UIView){ func setBtnUI(carTypesArr:Array<vehicle_arr_data>,view:UIView){
isAlready = false isAlready = false
btnArr.removeAll() btnArr.removeAll()
...@@ -2052,15 +2335,6 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -2052,15 +2335,6 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
view.addSubview(button) view.addSubview(button)
button.addTarget(self, action: #selector(selectAllCars), for: .touchUpInside) button.addTarget(self, action: #selector(selectAllCars), for: .touchUpInside)
// let line1 = UIView()
// line1.backgroundColor = UIColor(named: "灰色分界线")
// view.addSubview(line1)
// line1.snp_makeConstraints { (make) in
// make.height.equalTo(1)
// make.right.left.equalTo(0)
// make.top.equalTo(0)
// }
let line2 = UIView() let line2 = UIView()
line2.backgroundColor = UIColor(named: "灰色分界线") line2.backgroundColor = UIColor(named: "灰色分界线")
view.addSubview(line2) view.addSubview(line2)
...@@ -2095,7 +2369,78 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -2095,7 +2369,78 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
} }
//MARK: - 拼拼货选所有车型
var pph_carListView:UIView?
var pph_cBtn:UIButton?
@objc func pph_closeCarList(){
pph_carListView?.isHidden = true
pph_cBtn?.isHidden = true
// closeBtn?.isHidden = true
// changeCellSortView?.isHidden = true
}
@objc func pph_selectAllCars(){
print("pphCarTypesArr = ",pphCarTypesArr.count)
pph_cBtn?.isHidden = false
pph_carListView?.isHidden = false
let w = fullScreenWidth / 3
var a = 0
if pphCarTypesArr.count % 3 != 0 {
a = 1
}
let h = w * CGFloat(a + pphCarTypesArr.count / 3)
if pph_carListView == nil {
let view = UIView(frame: CGRect(x: 0, y: topBtnView.frame.maxY, width: fullScreenWidth, height: fullScreenHeight * 0.8))
view.backgroundColor = UIColor.white
self.view.addSubview(view)
pph_carListView = view
let pph_carListSCV = UIScrollView(frame: CGRect(x: 0, y: 44, width: ScreenWidth, height: (pph_carListView?.bounds.size.height)! - 44))
pph_carListView?.addSubview(pph_carListSCV)
pph_carListSCV.contentSize = CGSize(width: fullScreenWidth, height: h)
let lbl = UILabel(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 44))
lbl.text = "所有车型"
lbl.textAlignment = .center
lbl.font = UIFont.systemFont(ofSize: 13)
lbl.textColor = UIColor(named: "标题字颜色")
pph_carListView!.addSubview(lbl)
let closeBtn = UIButton(frame: CGRect(x: fullScreenWidth-44, y: 0, width: 44, height: 44))
closeBtn.setImage(UIImage(named: "xx"), for: .normal)
closeBtn.addTarget(self, action: #selector(pph_closeCarList), for: .touchUpInside)
pph_carListView!.addSubview(closeBtn)
let line = UIView(frame: CGRect(x: 0, y: 43.5, width: fullScreenWidth, height: 0.5))
line.backgroundColor = UIColor(named: "灰色分界线")
pph_carListView!.addSubview(line)
for i in 0 ..< pphCarTypesArr.count {
setPPHCarListUI(index: i, bg: pph_carListSCV)
}
}
let width = CGFloat(3 - pphCarTypesArr.count % 3) * w
let yValue = (CGFloat(pphCarTypesArr.count / 3) * w )+44
let lineV = UIView(frame: CGRect(x: fullScreenWidth - width, y: yValue, width: width, height: w))
lineV.layer.borderColor = UIColor(named: "灰色分界线")?.cgColor
lineV.layer.borderWidth = 0.5
pph_carListView!.addSubview(lineV)
if pph_cBtn == nil {
pph_cBtn = UIButton()
pph_cBtn!.backgroundColor = UIColor(named: "标题字颜色")
pph_cBtn!.alpha = 0.4
pph_cBtn?.addTarget(self, action: #selector(pph_closeCarList), for: .touchUpInside)
self.view.addSubview(pph_cBtn!)
pph_cBtn?.snp_makeConstraints({ (make) in
make.top.equalTo(pph_carListView!.snp_bottom).offset(0)
make.left.right.bottom.equalToSuperview()
})
}
}
//MARK: - 选择所有车型 //MARK: - 选择所有车型
var carListView:UIView? var carListView:UIView?
...@@ -2106,6 +2451,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -2106,6 +2451,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
closeBtn?.isHidden = true closeBtn?.isHidden = true
changeCellSortView?.isHidden = true changeCellSortView?.isHidden = true
} }
@objc func selectAllCars(){ @objc func selectAllCars(){
cBtn?.isHidden = false cBtn?.isHidden = false
carListView?.isHidden = false carListView?.isHidden = false
...@@ -2164,7 +2510,41 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -2164,7 +2510,41 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
}) })
} }
} }
func setPPHCarListUI(index:Int,bg:UIView){
let w = fullScreenWidth / 3
let cols = 3
let col = index % cols
let row = index / cols
let shopX = CGFloat(col) * w
let shopY = CGFloat(row) * w
let btn = UIButton(frame: CGRect(x: shopX, y: shopY, width: w, height: w))
btn.addTarget(self, action: #selector(carSelect(sender:)), for: .touchUpInside)
btn.tag = index
btn.layer.borderColor = UIColor(named: "灰色分界线")?.cgColor
btn.layer.borderWidth = 0.5
let model = pphCarTypesArr[index]
let imgV = UIImageView()
SDWebImageDownloader.shared.downloadImage(with: URL(string:model.img!), options: .continueInBackground, progress: { (a, b, nil) in
}) { (img, data, err, true) in
if img != nil {
imgV.image = img
let p = w / (imgV.image?.size.width)!
imgV.frame = CGRect(x: btn.frame.origin.x, y: btn.frame.origin.y + 30, width: w, height: w * p )
let lbl = UILabel(frame: CGRect(x: btn.frame.origin.x, y: btn.frame.origin.y + imgV.bounds.size.height, width: w, height: w - (w * p * 0.5)))
lbl.textColor = UIColor(named: "灰色字体颜色")
lbl.font = UIFont.systemFont(ofSize: 13)
lbl.textAlignment = .center
lbl.text = model.name
bg.addSubview(lbl)
}
bg.addSubview(imgV)
}
btn.setTitleColor(UIColor.black, for: .normal)
bg.addSubview(btn)
}
func setCarListUI(index:Int,bg:UIView){ func setCarListUI(index:Int,bg:UIView){
let w = fullScreenWidth / 3 let w = fullScreenWidth / 3
let cols = 3 let cols = 3
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
<outlet property="listView" destination="Try-UC-8fP" id="plR-El-hxN"/> <outlet property="listView" destination="Try-UC-8fP" id="plR-El-hxN"/>
<outlet property="p_p_view" destination="Vf0-aT-43t" id="BMv-xY-6z5"/> <outlet property="p_p_view" destination="Vf0-aT-43t" id="BMv-xY-6z5"/>
<outlet property="pin_pin_huo" destination="hwI-gN-CwU" id="xHH-Jp-k0u"/> <outlet property="pin_pin_huo" destination="hwI-gN-CwU" id="xHH-Jp-k0u"/>
<outlet property="pph_listView" destination="lrw-DF-qzM" id="QG0-fE-TaJ"/>
<outlet property="pph_topCarBtnView" destination="dYD-zk-l4l" id="D3e-D2-pIT"/>
<outlet property="priceLbl" destination="TJP-xc-KTh" id="NH7-PB-8a7"/> <outlet property="priceLbl" destination="TJP-xc-KTh" id="NH7-PB-8a7"/>
<outlet property="rightBtn" destination="X6m-t6-gdl" id="yiF-bx-dJm"/> <outlet property="rightBtn" destination="X6m-t6-gdl" id="yiF-bx-dJm"/>
<outlet property="topBtnView" destination="3NL-zo-jTU" id="7XJ-gu-PcZ"/> <outlet property="topBtnView" destination="3NL-zo-jTU" id="7XJ-gu-PcZ"/>
...@@ -506,6 +508,10 @@ ...@@ -506,6 +508,10 @@
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="lrw-DF-qzM"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="lrw-DF-qzM">
<rect key="frame" x="0.0" y="44" width="414" height="636"/> <rect key="frame" x="0.0" y="44" width="414" height="636"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="hRD-SE-jP6"/>
<outlet property="delegate" destination="-1" id="pH6-qu-Y2h"/>
</connections>
</tableView> </tableView>
</subviews> </subviews>
<color key="backgroundColor" name="白色背景色"/> <color key="backgroundColor" name="白色背景色"/>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
...@@ -49,7 +50,7 @@ ...@@ -49,7 +50,7 @@
<fontDescription key="fontDescription" type="system" pointSize="19"/> <fontDescription key="fontDescription" type="system" pointSize="19"/>
<state key="normal" image="fanhui"/> <state key="normal" image="fanhui"/>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mc4-mS-8P7"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mc4-mS-8P7">
<rect key="frame" x="0.0" y="8" width="46" height="30"/> <rect key="frame" x="0.0" y="8" width="46" height="30"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="46" id="4w1-lk-ryV"/> <constraint firstAttribute="width" constant="46" id="4w1-lk-ryV"/>
...@@ -82,7 +83,7 @@ ...@@ -82,7 +83,7 @@
</constraints> </constraints>
</view> </view>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints> <constraints>
<constraint firstAttribute="bottom" secondItem="mc4-mS-8P7" secondAttribute="bottom" constant="7" id="295-Ym-bWu"/> <constraint firstAttribute="bottom" secondItem="mc4-mS-8P7" secondAttribute="bottom" constant="7" id="295-Ym-bWu"/>
<constraint firstItem="mc4-mS-8P7" firstAttribute="top" secondItem="gLT-4M-bfs" secondAttribute="top" constant="8" id="6jl-8q-avT"/> <constraint firstItem="mc4-mS-8P7" firstAttribute="top" secondItem="gLT-4M-bfs" secondAttribute="top" constant="8" id="6jl-8q-avT"/>
...@@ -99,7 +100,7 @@ ...@@ -99,7 +100,7 @@
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zku-OV-GRM" customClass="LGButton" customModule="LGButton"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zku-OV-GRM" customClass="LGButton" customModule="LGButton">
<rect key="frame" x="0.0" y="813" width="414" height="83"/> <rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<userDefinedRuntimeAttributes> <userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="gradientStartColor"> <userDefinedRuntimeAttribute type="color" keyPath="gradientStartColor">
<color key="value" name="按钮渐变色上"/> <color key="value" name="按钮渐变色上"/>
...@@ -147,7 +148,7 @@ ...@@ -147,7 +148,7 @@
</constraints> </constraints>
</view> </view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="发货人信息(选填)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kjg-a9-QU1"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="发货人信息(选填)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kjg-a9-QU1">
<rect key="frame" x="15" y="11" width="118" height="19"/> <rect key="frame" x="15" y="11" width="117" height="19"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<color key="textColor" name="标题字颜色"/> <color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
...@@ -178,7 +179,7 @@ ...@@ -178,7 +179,7 @@
<textInputTraits key="textInputTraits"/> <textInputTraits key="textInputTraits"/>
</textField> </textField>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints> <constraints>
<constraint firstItem="Gh9-a6-8wp" firstAttribute="leading" secondItem="Lvk-JQ-tFy" secondAttribute="leading" id="1PB-XO-mET"/> <constraint firstItem="Gh9-a6-8wp" firstAttribute="leading" secondItem="Lvk-JQ-tFy" secondAttribute="leading" id="1PB-XO-mET"/>
<constraint firstItem="1hY-wr-ip3" firstAttribute="top" secondItem="mLk-53-Hn6" secondAttribute="bottom" constant="8" id="4dz-DW-x9E"/> <constraint firstItem="1hY-wr-ip3" firstAttribute="top" secondItem="mLk-53-Hn6" secondAttribute="bottom" constant="8" id="4dz-DW-x9E"/>
...@@ -213,7 +214,7 @@ ...@@ -213,7 +214,7 @@
<rect key="frame" x="0.0" y="89" width="414" height="586"/> <rect key="frame" x="0.0" y="89" width="414" height="586"/>
<color key="backgroundColor" name="app底色"/> <color key="backgroundColor" name="app底色"/>
</view> </view>
<button hidden="YES" opaque="NO" alpha="0.40000000000000002" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="T9o-ZR-uVl"> <button hidden="YES" opaque="NO" alpha="0.40000000000000002" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="T9o-ZR-uVl">
<rect key="frame" x="0.0" y="89" width="414" height="807"/> <rect key="frame" x="0.0" y="89" width="414" height="807"/>
<color key="backgroundColor" name="标题字颜色"/> <color key="backgroundColor" name="标题字颜色"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
...@@ -227,7 +228,7 @@ ...@@ -227,7 +228,7 @@
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="c1E-9c-vVT"> <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="c1E-9c-vVT">
<rect key="frame" x="0.0" y="148" width="414" height="748"/> <rect key="frame" x="0.0" y="148" width="414" height="748"/>
<subviews> <subviews>
<button opaque="NO" contentMode="scaleToFill" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NcV-XI-uHx"> <button opaque="NO" contentMode="scaleToFill" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NcV-XI-uHx">
<rect key="frame" x="0.0" y="0.0" width="414" height="51.5"/> <rect key="frame" x="0.0" y="0.0" width="414" height="51.5"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="51.5" id="3FM-pF-Ev2"/> <constraint firstAttribute="height" constant="51.5" id="3FM-pF-Ev2"/>
...@@ -271,7 +272,7 @@ ...@@ -271,7 +272,7 @@
<constraint firstAttribute="height" constant="1" id="bZ3-HO-AFP"/> <constraint firstAttribute="height" constant="1" id="bZ3-HO-AFP"/>
</constraints> </constraints>
</view> </view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7b1-Dd-JY1"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7b1-Dd-JY1">
<rect key="frame" x="0.0" y="52.5" width="414" height="49"/> <rect key="frame" x="0.0" y="52.5" width="414" height="49"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal"> <state key="normal">
...@@ -283,7 +284,7 @@ ...@@ -283,7 +284,7 @@
</button> </button>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="FkD-95-sVW"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="FkD-95-sVW">
<rect key="frame" x="0.0" y="101.5" width="414" height="646.5"/> <rect key="frame" x="0.0" y="101.5" width="414" height="646.5"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<connections> <connections>
<outlet property="dataSource" destination="-1" id="0q6-BW-cvc"/> <outlet property="dataSource" destination="-1" id="0q6-BW-cvc"/>
<outlet property="delegate" destination="-1" id="Abz-vu-2hp"/> <outlet property="delegate" destination="-1" id="Abz-vu-2hp"/>
...@@ -291,14 +292,14 @@ ...@@ -291,14 +292,14 @@
</tableView> </tableView>
<tableView hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="WO7-AX-Flw"> <tableView hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="WO7-AX-Flw">
<rect key="frame" x="0.0" y="0.0" width="414" height="748"/> <rect key="frame" x="0.0" y="0.0" width="414" height="748"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<connections> <connections>
<outlet property="dataSource" destination="-1" id="jmz-eX-3c5"/> <outlet property="dataSource" destination="-1" id="jmz-eX-3c5"/>
<outlet property="delegate" destination="-1" id="f1a-0P-OnF"/> <outlet property="delegate" destination="-1" id="f1a-0P-OnF"/>
</connections> </connections>
</tableView> </tableView>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints> <constraints>
<constraint firstItem="0Ha-lY-Z5m" firstAttribute="top" secondItem="NcV-XI-uHx" secondAttribute="bottom" id="2nu-dJ-y63"/> <constraint firstItem="0Ha-lY-Z5m" firstAttribute="top" secondItem="NcV-XI-uHx" secondAttribute="bottom" id="2nu-dJ-y63"/>
<constraint firstItem="FkD-95-sVW" firstAttribute="leading" secondItem="c1E-9c-vVT" secondAttribute="leading" id="5BV-xv-6A3"/> <constraint firstItem="FkD-95-sVW" firstAttribute="leading" secondItem="c1E-9c-vVT" secondAttribute="leading" id="5BV-xv-6A3"/>
...@@ -329,7 +330,8 @@ ...@@ -329,7 +330,8 @@
</constraints> </constraints>
</view> </view>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints> <constraints>
<constraint firstItem="8qa-oS-xtb" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="0eG-SR-nwc"/> <constraint firstItem="8qa-oS-xtb" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="0eG-SR-nwc"/>
<constraint firstItem="Zku-OV-GRM" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="2Gr-Nv-AAd"/> <constraint firstItem="Zku-OV-GRM" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="2Gr-Nv-AAd"/>
...@@ -361,10 +363,14 @@ ...@@ -361,10 +363,14 @@
<constraint firstItem="T9o-ZR-uVl" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="sUG-bR-zWb"/> <constraint firstItem="T9o-ZR-uVl" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="sUG-bR-zWb"/>
<constraint firstItem="gLT-4M-bfs" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="zkb-lY-UXz"/> <constraint firstItem="gLT-4M-bfs" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="zkb-lY-UXz"/>
</constraints> </constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="131.8840579710145" y="89.732142857142847"/> <point key="canvasLocation" x="131.8840579710145" y="89.732142857142847"/>
</view> </view>
</objects> </objects>
<designables>
<designable name="Zku-OV-GRM">
<size key="intrinsicContentSize" width="10" height="10"/>
</designable>
</designables>
<resources> <resources>
<image name="dzdingwei" width="14" height="17"/> <image name="dzdingwei" width="14" height="17"/>
<image name="fanhui" width="18" height="35"/> <image name="fanhui" width="18" height="35"/>
...@@ -399,5 +405,8 @@ ...@@ -399,5 +405,8 @@
<namedColor name="蓝色字体颜色"> <namedColor name="蓝色字体颜色">
<color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources> </resources>
</document> </document>
...@@ -12,7 +12,7 @@ import SDWebImage ...@@ -12,7 +12,7 @@ import SDWebImage
protocol HLLTopCellDelegate { protocol HLLTopCellDelegate {
func HLLTopCellBtnClick(idx:Int) func HLLTopCellBtnClick(idx:Int)
func HLLTopCellScrollIdx(idx:Int) func HLLTopCellScrollIdx(idx:Int)
// func HLLTopCellOtherClick(isSelect:Bool) // func HLLTopCellOtherClick(isSelect:Bool)
} }
class HLLTopCell: UITableViewCell,UIScrollViewDelegate { class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
var idx = 0 var idx = 0
...@@ -62,8 +62,40 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -62,8 +62,40 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
} }
func scrollViewDidScroll(_ scrollView: UIScrollView) { func scrollViewDidScroll(_ scrollView: UIScrollView) {
leftBtn.isHidden = false leftBtn.isHidden = false
rightBtn.isHidden = false rightBtn.isHidden = false
if isPPH {
if scrollView.contentOffset.x/scViewBg.bounds.size.width < 1 {
leftBtn.isHidden = true
}
let num = pph_datas.count - 1
if scrollView.contentOffset.x/scViewBg.bounds.size.width >= CGFloat(num) {
rightBtn.isHidden = true
}
var numIdx = Int(scrollView.contentOffset.x/scViewBg.bounds.size.width - 1)
if numIdx < 0 {
numIdx = 0
}
if numIdx > num {
numIdx = num
}
let model = pph_datas[numIdx]
if pph_datas.count > 0 {
if model.truckWeight != nil {
weightLbl.text = model.truckWeight
}
if model.cubage != nil {
sizeLbl.text = "\(model.cubage!)"
}
tjLbl.text = model.truckVolume
}
}else{
if scrollView.contentOffset.x/scViewBg.bounds.size.width < 1 { if scrollView.contentOffset.x/scViewBg.bounds.size.width < 1 {
leftBtn.isHidden = true leftBtn.isHidden = true
} }
...@@ -80,6 +112,7 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -80,6 +112,7 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
if numIdx > num { if numIdx > num {
numIdx = num numIdx = num
} }
if datas.count > 0 {
let model = datas[numIdx] let model = datas[numIdx]
if (model.vehicle_price_text_item!.text_weight!.contains("/")){ if (model.vehicle_price_text_item!.text_weight!.contains("/")){
let arr = model.vehicle_price_text_item?.text_weight?.components(separatedBy: "/") let arr = model.vehicle_price_text_item?.text_weight?.components(separatedBy: "/")
...@@ -90,7 +123,8 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -90,7 +123,8 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
sizeLbl.text = model.vehicle_price_text_item?.text_size sizeLbl.text = model.vehicle_price_text_item?.text_size
tjLbl.text = model.vehicle_price_text_item?.text_volume tjLbl.text = model.vehicle_price_text_item?.text_volume
}
}
} }
@IBOutlet weak var rightBtn: UIButton! @IBOutlet weak var rightBtn: UIButton!
...@@ -99,7 +133,25 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -99,7 +133,25 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
@IBOutlet weak var tjLbl: UILabel! @IBOutlet weak var tjLbl: UILabel!
@IBOutlet weak var sizeLbl: UILabel! @IBOutlet weak var sizeLbl: UILabel!
@IBOutlet weak var weightLbl: UILabel! @IBOutlet weak var weightLbl: UILabel!
var pph_datas:Array<getVehicleTypeData_model> = []{
didSet{
if pph_datas.count < 2 {
rightBtn.isHidden = true
}else{
rightBtn.isHidden = false
}
if pph_datas.count > 0 {
let model = pph_datas[idx]
if model.truckWeight != nil {
weightLbl.text = model.truckWeight
}
if model.cubage != nil {
sizeLbl.text = "\(model.cubage!)"
}
tjLbl.text = model.truckVolume
}
}
}
var datas:Array<vehicle_arr_data> = []{ var datas:Array<vehicle_arr_data> = []{
didSet{ didSet{
if datas.count < 2 { if datas.count < 2 {
...@@ -124,10 +176,59 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -124,10 +176,59 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
self.selectionStyle = .none self.selectionStyle = .none
} }
var isPPH = false
override func layoutIfNeeded() { override func layoutIfNeeded() {
super.layoutIfNeeded() super.layoutIfNeeded()
if isPPH {
if scrollView == nil {
scrollView = UIScrollView(frame: scViewBg.bounds)
scViewBg.addSubview(scrollView!)
scrollView?.isPagingEnabled = true
scrollView?.showsHorizontalScrollIndicator = false
scrollView?.delegate = self
}
if (scrollView?.subviews.count)! > 0 && scrollView != nil {
for item in scrollView!.subviews {
item.removeFromSuperview()
}
}
let num = pph_datas.count
scrollView?.contentSize = CGSize(width: (scViewBg.bounds.size.width) * CGFloat(num), height: (scViewBg.bounds.size.height))
for i in 0 ..< num{
let view = UIView(frame: CGRect(x: CGFloat(i) * (scViewBg.bounds.size.width), y:0, width: scViewBg.bounds.size.width, height: scViewBg.bounds.size.height))
let model = pph_datas[i]
let imgV = UIImageView()
view.addSubview(imgV)
SDWebImageDownloader.shared.downloadImage(with: URL(string:model.img!), options: .continueInBackground, progress: { (a, b, nil) in
}) { (img, data, err, true) in
imgV.image = img
if img != nil {
let p = self.scViewBg.bounds.size.width / (img!.size.width)
imgV.snp.makeConstraints { (make) in
make.width.equalTo((imgV.image?.size.width)! * p * 0.6)
make.height.equalTo((imgV.image?.size.height)! * p * 0.5)
make.centerX.equalTo(view.snp.centerX)
make.centerY.equalTo(view.snp.centerY)
}
}else{
imgV.image = UIImage(named: "lmn_tool_image")
imgV.snp.makeConstraints { (make) in
make.width.equalTo(self.scViewBg.bounds.size.width)
make.height.equalTo(self.scViewBg.bounds.size.height)
make.centerX.equalTo(view.snp.centerX)
make.centerY.equalTo(view.snp.centerY)
}
}
}
scrollView?.addSubview(view)
}
return
}
if scrollView == nil { if scrollView == nil {
scrollView = UIScrollView(frame: scViewBg.bounds) scrollView = UIScrollView(frame: scViewBg.bounds)
scViewBg.addSubview(scrollView!) scViewBg.addSubview(scrollView!)
...@@ -149,7 +250,6 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate { ...@@ -149,7 +250,6 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
let view = UIView(frame: CGRect(x: CGFloat(i) * (scViewBg.bounds.size.width), y:0, width: scViewBg.bounds.size.width, height: scViewBg.bounds.size.height)) let view = UIView(frame: CGRect(x: CGFloat(i) * (scViewBg.bounds.size.width), y:0, width: scViewBg.bounds.size.width, height: scViewBg.bounds.size.height))
let model = datas[i] let model = datas[i]
let imgV = UIImageView() let imgV = UIImageView()
// imgV.image =
view.addSubview(imgV) view.addSubview(imgV)
......
...@@ -14,6 +14,9 @@ class OnlyViewCell: UITableViewCell { ...@@ -14,6 +14,9 @@ class OnlyViewCell: UITableViewCell {
var delegate:OnlyViewCellDelegate? var delegate:OnlyViewCellDelegate?
@IBOutlet weak var btnViewH: NSLayoutConstraint! @IBOutlet weak var btnViewH: NSLayoutConstraint!
var datas:Array<vehicle_std_arr_data>? var datas:Array<vehicle_std_arr_data>?
var isPPH = false
var pph_datas:Array<getVehicleTypeData_model>?
@IBOutlet weak var btnView: UIView! @IBOutlet weak var btnView: UIView!
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
...@@ -24,6 +27,36 @@ class OnlyViewCell: UITableViewCell { ...@@ -24,6 +27,36 @@ class OnlyViewCell: UITableViewCell {
var isNotReady:Bool = true var isNotReady:Bool = true
override func layoutSubviews() { override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
if isPPH {
if isNotReady {
for index in 0 ..< pph_datas!.count{
let item = pph_datas![index]
let width = fullScreenWidth - 30
let w = width / 3
let cols = 3
let col = index % cols
let row = index / cols
let shopX = CGFloat(col) * (w + 10)
let shopY = CGFloat(row) * (20 + 5)
let btn = UIButton(frame: CGRect(x: shopX , y: shopY , width: w, height: 20))
btn.setImage(UIImage(named: "daixuan"), for: .normal)
btn.setImage(UIImage(named: "yuxuan"), for: .selected)
btn.addTarget(self, action: #selector(carSelect(sender:)), for: .touchUpInside)
btn.tag = index
btn.setTitle(" " + item.name!, for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 11)
btn.setTitleColor(UIColor(named: "灰色字体颜色"), for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btnView.addSubview(btn)
if index == pph_datas!.count - 1 {
btnViewH.constant = shopY+20
isNotReady = false
}
}
}
}else{
if isNotReady { if isNotReady {
for index in 0 ..< datas!.count{ for index in 0 ..< datas!.count{
let item = datas![index] let item = datas![index]
...@@ -52,7 +85,7 @@ class OnlyViewCell: UITableViewCell { ...@@ -52,7 +85,7 @@ class OnlyViewCell: UITableViewCell {
} }
} }
} }
}
} }
@objc func carSelect(sender:UIButton){ @objc func carSelect(sender:UIButton){
if sender.isSelected { if sender.isSelected {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
</label> </label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iu3-IV-bvt"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iu3-IV-bvt">
<rect key="frame" x="15" y="35" width="328" height="20"/> <rect key="frame" x="15" y="35" width="328" height="20"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="20" id="Em9-Te-Ur4"/> <constraint firstAttribute="height" constant="20" id="Em9-Te-Ur4"/>
</constraints> </constraints>
...@@ -57,5 +58,8 @@ ...@@ -57,5 +58,8 @@
<namedColor name="提示语字体颜色"> <namedColor name="提示语字体颜色">
<color red="0.70588235294117652" green="0.70588235294117652" blue="0.70588235294117652" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.70588235294117652" green="0.70588235294117652" blue="0.70588235294117652" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources> </resources>
</document> </document>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment