Commit 9473a865 authored by lujunye's avatar lujunye

补充选择下拉列表

parent 356d4821
...@@ -14,11 +14,6 @@ class GYS_FX_ProductCellTableViewCell: UITableViewCell { ...@@ -14,11 +14,6 @@ class GYS_FX_ProductCellTableViewCell: UITableViewCell {
var delegate:GYS_FX_ProductCellDelegate? var delegate:GYS_FX_ProductCellDelegate?
@IBAction func selectProductAction(_ sender: UIButton) { @IBAction func selectProductAction(_ sender: UIButton) {
// left_btn.isSelected = !left_btn.isSelected
// select_Img.image = UIImage(named: "daixuan")
// if left_btn.isSelected {
// select_Img.image = UIImage(named: "yuxuan")
// }
delegate?.GYS_FX_ProductCellTableViewCellSelect(idx: self.tag) delegate?.GYS_FX_ProductCellTableViewCellSelect(idx: self.tag)
} }
@IBOutlet weak var left_btn: UIButton! @IBOutlet weak var left_btn: UIButton!
......
...@@ -11,12 +11,13 @@ protocol HeaderSelectViewDelegate { ...@@ -11,12 +11,13 @@ protocol HeaderSelectViewDelegate {
// 协议定义 // 协议定义
func showAction(sender:Int) func showAction(sender:Int)
func colseAction(sender:Int) func colseAction(sender:Int)
} }
class HeaderSelectView: UIView { class HeaderSelectView: UIView {
var delegate:HeaderSelectViewDelegate? var delegate:HeaderSelectViewDelegate?
@IBOutlet weak var firstBtn: UIButton! @IBOutlet weak var firstBtn: UIButton!
@IBOutlet weak var secBtn: UIButton! @IBOutlet weak var secBtn: UIButton!
@IBOutlet weak var thereBtn: UIButton! @IBOutlet weak var thereBtn: UIButton!
...@@ -38,14 +39,16 @@ class HeaderSelectView: UIView { ...@@ -38,14 +39,16 @@ class HeaderSelectView: UIView {
sender.setImage(upImg, for: .normal) sender.setImage(upImg, for: .normal)
secBtn.setTitleColor(upColor, for: .normal) secBtn.setTitleColor(upColor, for: .normal)
thereBtn.setTitleColor(upColor, for: .normal)
secBtnAction(secBtn) secBtnAction(secBtn)
thereBtnAction(thereBtn) if thereBtn != nil {
thereBtn.setTitleColor(upColor, for: .normal)
thereBtnAction(thereBtn)
}
self.delegate?.showAction(sender: 0) self.delegate?.showAction(sender: 0)
} }
} }
@IBAction func secBtnAction(_ sender: UIButton) { @IBAction func secBtnAction(_ sender: UIButton) {
...@@ -53,17 +56,19 @@ class HeaderSelectView: UIView { ...@@ -53,17 +56,19 @@ class HeaderSelectView: UIView {
sender.setTitleColor(dowColor, for: .normal) sender.setTitleColor(dowColor, for: .normal)
sender.setImage(dowImg, for: .normal) sender.setImage(dowImg, for: .normal)
self.delegate?.colseAction(sender: 1) self.delegate?.colseAction(sender: 1)
}else{ }else{
sender.setTitleColor(upColor, for: .normal) sender.setTitleColor(upColor, for: .normal)
sender.setImage(upImg, for: .normal) sender.setImage(upImg, for: .normal)
firstBtn.setTitleColor(upColor, for: .normal) firstBtn.setTitleColor(upColor, for: .normal)
thereBtn.setTitleColor(upColor, for: .normal) if thereBtn != nil {
thereBtn.setTitleColor(upColor, for: .normal)
thereBtnAction(thereBtn)
}
fristBtnAction(firstBtn) fristBtnAction(firstBtn)
thereBtnAction(thereBtn)
self.delegate?.showAction(sender: 1) self.delegate?.showAction(sender: 1)
} }
} }
...@@ -72,7 +77,7 @@ class HeaderSelectView: UIView { ...@@ -72,7 +77,7 @@ class HeaderSelectView: UIView {
sender.setTitleColor(dowColor, for: .normal) sender.setTitleColor(dowColor, for: .normal)
sender.setImage(dowImg, for: .normal) sender.setImage(dowImg, for: .normal)
self.delegate?.colseAction(sender: 2) self.delegate?.colseAction(sender: 2)
}else{ }else{
sender.setTitleColor(upColor, for: .normal) sender.setTitleColor(upColor, for: .normal)
sender.setImage(upImg, for: .normal) sender.setImage(upImg, for: .normal)
...@@ -82,7 +87,7 @@ class HeaderSelectView: UIView { ...@@ -82,7 +87,7 @@ class HeaderSelectView: UIView {
fristBtnAction(firstBtn) fristBtnAction(firstBtn)
secBtnAction(secBtn) secBtnAction(secBtn)
self.delegate?.showAction(sender: 2) self.delegate?.showAction(sender: 2)
} }
} }
func colseBytitleArr(arr:[String],index:Int){ func colseBytitleArr(arr:[String],index:Int){
...@@ -98,10 +103,12 @@ class HeaderSelectView: UIView { ...@@ -98,10 +103,12 @@ class HeaderSelectView: UIView {
} }
firstBtn.setTitleColor(dowColor, for: .normal) firstBtn.setTitleColor(dowColor, for: .normal)
secBtn.setTitleColor(dowColor, for: .normal) secBtn.setTitleColor(dowColor, for: .normal)
thereBtn.setTitleColor(dowColor, for: .normal) if thereBtn != nil {
thereBtn.setTitleColor(dowColor, for: .normal)
thereBtn.setImage(dowImg, for: .normal)
}
firstBtn.setImage(dowImg, for: .normal) firstBtn.setImage(dowImg, for: .normal)
secBtn.setImage(dowImg, for: .normal) secBtn.setImage(dowImg, for: .normal)
thereBtn.setImage(dowImg, for: .normal)
} }
//初始化时将xib中的view添加进来 //初始化时将xib中的view添加进来
override init(frame: CGRect) { override init(frame: CGRect) {
......
<?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" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/> <device id="retina4_7" 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="17125"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" 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>
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
</connections> </connections>
</button> </button>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints> <constraints>
<constraint firstItem="fJG-vM-HVA" firstAttribute="width" secondItem="qBG-jC-B4y" secondAttribute="width" id="147-PD-30D"/> <constraint firstItem="fJG-vM-HVA" firstAttribute="width" secondItem="qBG-jC-B4y" secondAttribute="width" id="147-PD-30D"/>
<constraint firstAttribute="bottom" secondItem="fJG-vM-HVA" secondAttribute="bottom" id="3UK-w4-fob"/> <constraint firstAttribute="bottom" secondItem="fJG-vM-HVA" secondAttribute="bottom" id="3UK-w4-fob"/>
...@@ -75,5 +76,8 @@ ...@@ -75,5 +76,8 @@
<namedColor name="标题字颜色"> <namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" 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>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<device id="retina4_7" orientation="portrait" appearance="light"/> <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.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"/>
......
...@@ -8,7 +8,72 @@ ...@@ -8,7 +8,72 @@
import UIKit import UIKit
class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_FX_ProductCellDelegate { class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_FX_ProductCellDelegate ,SelectContentViewDelegate,HeaderSelectViewDelegate{
var selectIndexArr = [0,0]
var showSelectvIndex = 0
weak var showSelectV: SelectContentView! = nil
func didselectCell(sender: Int) {
selectIndexArr[showSelectvIndex] = sender
var arr:[String] = []
if showSelectvIndex == 0 {
let arr1 = ["全部商品", "不参与分销商品", "参与分销商品", "佣金比例商品", "绝对额比例商品"]
arr.append(arr1[sender])
}else if showSelectvIndex == 1{
let arr2 = ["全部","上架", "下架"]
arr.append(arr2[sender])
}
selectV.colseBytitleArr(arr: arr, index:showSelectvIndex)
}
func selectContentvRemoveForSup() {
selectV.colseBytitleArr(arr: [], index:showSelectvIndex)
}
func showAction(sender: Int) {
showSelectvIndex = sender
switch sender {
case 0:
do {
let showSelectView = SelectContentView()
showSelectView.delegate = self
self.view.addSubview(showSelectView)
showSelectView.snp.makeConstraints { (make) in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(top_btn_bg_view.snp_bottom)
}
showSelectV = showSelectView
showSelectView.dataArr = ["全部商品", "不参与分销商品", "参与分销商品", "佣金比例商品", "绝对额比例商品"]
showSelectView.selectIndx = selectIndexArr[0]
}
break
case 1:
do {
let showSelectView = SelectContentView()
showSelectView.delegate = self
self.view.addSubview(showSelectView)
showSelectView.snp.makeConstraints { (make) in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(top_btn_bg_view.snp_bottom)
}
showSelectV = showSelectView
showSelectView.dataArr = ["全部","上架", "下架"]
showSelectView.selectIndx = selectIndexArr[1]
}
break
default: break
}
}
func colseAction(sender: Int) {
if showSelectV != nil {
showSelectV.removeFromSuperview()
}
}
var keyword = "" var keyword = ""
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
...@@ -72,9 +137,31 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -72,9 +137,31 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
@IBOutlet weak var search_view: UIView! @IBOutlet weak var search_view: UIView!
weak var searchV: SearchBarView? = nil weak var searchV: SearchBarView? = nil
weak var selectV: HeaderSelectView! = nil
@IBOutlet weak var top_btn_bg_view: UIView!
@IBOutlet weak var edit_bottom_view_H: NSLayoutConstraint! @IBOutlet weak var edit_bottom_view_H: NSLayoutConstraint!
func initHeaderSelectView() {
let selectView = HeaderSelectView()
selectView.firstBtn.setTitle("全部商品", for: .normal)
selectView.secBtn.setTitle("全部", for: .normal)
selectView.thereBtn.removeFromSuperview()
selectView.firstBtn.snp_makeConstraints { (make) in
make.left.top.bottom.equalTo(0)
make.width.equalTo(fullScreenWidth*0.5)
}
selectView.secBtn.snp_makeConstraints { (make) in
make.right.top.bottom.equalTo(0)
make.width.equalTo(fullScreenWidth*0.5)
}
top_btn_bg_view.addSubview(selectView)
selectView.snp.makeConstraints { (make) in
make.left.top.right.bottom.equalTo(0);
}
selectView.delegate = self
selectV = selectView
}
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -82,6 +169,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -82,6 +169,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
navbar.title = "分销商品管理" navbar.title = "分销商品管理"
self.view.addSubview(navbar) self.view.addSubview(navbar)
navbar.rightTitle = "编辑商品" navbar.rightTitle = "编辑商品"
let searchBr = SearchBarView.init() let searchBr = SearchBarView.init()
searchV = searchBr searchV = searchBr
searchBr.placeholderStr = "请输入分销商品名称" searchBr.placeholderStr = "请输入分销商品名称"
...@@ -96,6 +184,8 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -96,6 +184,8 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
make.height.equalTo(35) make.height.equalTo(35)
} }
initHeaderSelectView()
home_list_tbv.register(UINib(nibName: "GYS_FX_ProductCellTableViewCell", bundle: nil), forCellReuseIdentifier: "GYS_FX_ProductCellTableViewCell") home_list_tbv.register(UINib(nibName: "GYS_FX_ProductCellTableViewCell", bundle: nil), forCellReuseIdentifier: "GYS_FX_ProductCellTableViewCell")
home_list_tbv.separatorStyle = .none home_list_tbv.separatorStyle = .none
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<outlet property="right_arrow_img" destination="Z6Z-hX-dxA" id="cxW-5C-f5A"/> <outlet property="right_arrow_img" destination="Z6Z-hX-dxA" id="cxW-5C-f5A"/>
<outlet property="right_title" destination="qvp-uj-CDO" id="AWs-ge-IPf"/> <outlet property="right_title" destination="qvp-uj-CDO" id="AWs-ge-IPf"/>
<outlet property="search_view" destination="PRi-3L-xM8" id="w4D-xa-5mf"/> <outlet property="search_view" destination="PRi-3L-xM8" id="w4D-xa-5mf"/>
<outlet property="top_btn_bg_view" destination="oxr-Do-FWP" id="2mf-wn-Lfv"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections> </connections>
</placeholder> </placeholder>
......
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