Commit 37e01016 authored by 刘俊宏's avatar 刘俊宏

完成新增商品品牌选择操作

parent 7a25e418
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_5" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......
......@@ -9,7 +9,7 @@
import UIKit
import LGButton
class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CommendCellDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate{
class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CommendCellDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate{
var glSelectView:GLAlertSelectView?
let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
......@@ -279,7 +279,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
self.navigationController?.pushViewController(vc, animated: true)
}
if cell.nameLbl.text == "品牌" {
let vc = PinPaiListViewController()
vc.isSelectData = true
vc.delegate = self
vc.dataModelArray = generalInfoModel?.data?.brand
self.navigationController?.pushViewController(vc, animated: true)
}
if cell.nameLbl.text == "国家" {
......@@ -302,6 +306,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
func blackGoodsClass(sender: GoodsClassModel) {
print("选择商品分类返回数据=\(sender)")
}
//MARK:--选择品牌返回的数据
func blackSelectPinPaiData(sender: GeneralInfoBrandModel) {
print("选择品牌返回的数据=\(sender)")
}
func GLAlertSelectViewClick(selectNum: Int, view: UIView) {
print("单选",selectNum)
......
......@@ -7,16 +7,33 @@
//
import UIKit
protocol PinPaiListViewControllerDelegate {
func blackSelectPinPaiData(sender:GeneralInfoBrandModel)
}
class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBarViewDelegate,UITableViewDelegate,UITableViewDataSource{
var dataModelArray : Array<GeneralInfoBrandModel>? = []
var isSelectData : Bool = false
var delegate : PinPaiListViewControllerDelegate?
@IBOutlet weak var sureTop: NSLayoutConstraint!
@IBOutlet weak var tableBottom: NSLayoutConstraint!
@IBOutlet weak var sureLbl: UILabel!
@IBOutlet weak var sureBtn: UIButton!
@IBOutlet weak var topView: UIView!
@IBOutlet weak var listView: UITableView!
var searchV : SearchBarView? = nil
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = "品牌列表"
navbar.rightTitle = "新增"
if isSelectData {
navbar.title = "请选择品牌"
tableBottom.constant = CGFloat(TabHeight)
}else{
navbar.title = "品牌列表"
navbar.rightTitle = "新增"
sureBtn.isHidden = true
sureLbl.isHidden = true
}
self.view.addSubview(navbar)
SetTopFrame(view: topView, height: 44)
listView.separatorStyle = .none
......@@ -30,8 +47,8 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar
make.height.equalTo(30)
}
searchV = searchBr
searchBr.placeholderStr = "请输入品牌名称/商品编码"
searchBr.cornerRadius = 30*0.5
searchBr.placeholderStr = "请输入品牌名称"
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
......@@ -55,19 +72,45 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar
return 49
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
return dataModelArray!.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
cell.nameLbl.text = "天地壹号"
let rowModel = dataModelArray![indexPath.row] as! GeneralInfoBrandModel
cell.nameLbl.text = rowModel.brand_name
cell.contentLbl.text = ""
cell.btn.isUserInteractionEnabled = false
cell.selectionStyle = .gray
if isSelectData {
cell.arrowImg.isHidden = true
}
return cell
}
var selectModel : GeneralInfoBrandModel? = nil
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = XinZengPinPaiViewController()
vc.navTitle = "编辑品牌"
self.navigationController?.pushViewController(vc, animated: true)
if isSelectData {
let rowModel = dataModelArray![indexPath.row] as! GeneralInfoBrandModel
selectModel = rowModel
}else{
let vc = XinZengPinPaiViewController()
vc.navTitle = "编辑品牌"
self.navigationController?.pushViewController(vc, animated: true)
}
}
//MARK:--选择品牌确定按钮
@IBAction func sureAction(_ sender: UIButton) {
print("选择品牌确定按钮")
if selectModel == nil {
HUD.flash(.label("请选择品牌"), delay: 1.2)
}else{
self.delegate?.blackSelectPinPaiData(sender: selectModel!)
self.navigationController?.popViewController(animated: true)
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
......@@ -10,6 +11,10 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PinPaiListViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<connections>
<outlet property="listView" destination="u1k-5i-gDO" id="yRs-QD-hlI"/>
<outlet property="sureBtn" destination="NCX-sh-Sjd" id="sei-VK-VFB"/>
<outlet property="sureLbl" destination="hKC-0a-Rbu" id="mUo-UU-tAl"/>
<outlet property="sureTop" destination="bbx-dC-NyU" id="ZSL-nl-UjK"/>
<outlet property="tableBottom" destination="ZQL-aV-zrz" id="qua-zV-aB1"/>
<outlet property="topView" destination="8ei-hi-CSb" id="Gf2-pT-Nnu"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
......@@ -27,26 +32,57 @@
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="u1k-5i-gDO">
<rect key="frame" x="0.0" y="88" width="414" height="774"/>
<rect key="frame" x="0.0" y="88" width="414" height="808"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="wNq-qE-Qfi"/>
<outlet property="delegate" destination="-1" id="QMP-Ey-BaB"/>
</connections>
</tableView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NCX-sh-Sjd">
<rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" name="蓝色字体颜色"/>
<connections>
<action selector="sureAction:" destination="-1" eventType="touchUpInside" id="VjW-0R-ltX"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="确定" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hKC-0a-Rbu">
<rect key="frame" x="0.0" y="813" width="414" height="49"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="3jR-nd-S8v"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="17"/>
<color key="textColor" name="白色背景色"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="hKC-0a-Rbu" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="1AY-ep-XjO"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="8ei-hi-CSb" secondAttribute="trailing" id="1sp-OU-PVp"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="u1k-5i-gDO" secondAttribute="trailing" id="ACy-YM-7rO"/>
<constraint firstAttribute="bottom" secondItem="NCX-sh-Sjd" secondAttribute="bottom" id="F4A-Z7-lOO"/>
<constraint firstItem="NCX-sh-Sjd" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="MaD-5F-xcv"/>
<constraint firstItem="8ei-hi-CSb" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="NDo-1d-XVB"/>
<constraint firstItem="u1k-5i-gDO" firstAttribute="top" secondItem="8ei-hi-CSb" secondAttribute="bottom" id="U4T-vU-Gcn"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="u1k-5i-gDO" secondAttribute="bottom" id="ZQL-aV-zrz"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="NCX-sh-Sjd" secondAttribute="trailing" id="ZFZ-me-fRQ"/>
<constraint firstAttribute="bottom" secondItem="u1k-5i-gDO" secondAttribute="bottom" id="ZQL-aV-zrz"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="hKC-0a-Rbu" secondAttribute="bottom" id="b4l-79-J9K"/>
<constraint firstItem="8ei-hi-CSb" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="bZk-D7-usz"/>
<constraint firstItem="NCX-sh-Sjd" firstAttribute="top" secondItem="hKC-0a-Rbu" secondAttribute="top" id="bbx-dC-NyU"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="hKC-0a-Rbu" secondAttribute="trailing" id="kIM-sr-htj"/>
<constraint firstItem="u1k-5i-gDO" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="tyP-du-bhA"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="133" y="132"/>
</view>
</objects>
<resources>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="蓝色字体颜色">
<color red="0.27799999713897705" green="0.56099998950958252" blue="0.88999998569488525" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</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