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

修改新增商品

parent 528b32c9
...@@ -74,6 +74,11 @@ class GoodsClassViewController: BaseViewController , UITableViewDelegate, UITabl ...@@ -74,6 +74,11 @@ class GoodsClassViewController: BaseViewController , UITableViewDelegate, UITabl
model_3.level = dataModel_3.level model_3.level = dataModel_3.level
model_3.cat_id = dataModel_3.cat_id model_3.cat_id = dataModel_3.cat_id
if selectModel != nil {
if model_3.cat_id == selectModel?.cat_id {
model_3.isSelect = true
}
}
//添加 //添加
model_2.modelS?.append(model_3) model_2.modelS?.append(model_3)
} }
...@@ -83,7 +88,11 @@ class GoodsClassViewController: BaseViewController , UITableViewDelegate, UITabl ...@@ -83,7 +88,11 @@ class GoodsClassViewController: BaseViewController , UITableViewDelegate, UITabl
if !model_2.isCanExpand! { if !model_2.isCanExpand! {
model_2.isCanSelect = true model_2.isCanSelect = true
} }
if selectModel != nil {
if model_2.cat_id == selectModel?.cat_id {
model_2.isSelect = true
}
}
model_1.modelS?.append(model_2) model_1.modelS?.append(model_2)
} }
...@@ -91,6 +100,11 @@ class GoodsClassViewController: BaseViewController , UITableViewDelegate, UITabl ...@@ -91,6 +100,11 @@ class GoodsClassViewController: BaseViewController , UITableViewDelegate, UITabl
if !model_1.isCanExpand! { if !model_1.isCanExpand! {
model_1.isCanSelect = true model_1.isCanSelect = true
} }
if selectModel != nil {
if model_1.cat_id == selectModel?.cat_id {
model_1.isSelect = true
}
}
var arrs:Array<Any> = [] var arrs:Array<Any> = []
arrs.append(model_1) arrs.append(model_1)
dataArr.append(arrs) dataArr.append(arrs)
......
...@@ -285,6 +285,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -285,6 +285,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if cell.nameLbl.text == "商品分类" { if cell.nameLbl.text == "商品分类" {
let vc = GoodsClassViewController() let vc = GoodsClassViewController()
vc.delegate = self vc.delegate = self
vc.selectModel = selectGoodsClassModel
vc.dataModelArray = generalInfoModel?.data?.cats vc.dataModelArray = generalInfoModel?.data?.cats
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
...@@ -292,6 +293,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -292,6 +293,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let vc = PinPaiListViewController() let vc = PinPaiListViewController()
vc.isSelectData = true vc.isSelectData = true
vc.delegate = self vc.delegate = self
vc.selectModel = selectPinPaiData
vc.dataModelArray = generalInfoModel?.data?.brand vc.dataModelArray = generalInfoModel?.data?.brand
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
...@@ -341,12 +343,20 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -341,12 +343,20 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
} }
//MARK:---选择商品分类返回数据 //MARK:---选择商品分类返回数据
var selectGoodsClassModel:GoodsClassModel? = nil
func blackGoodsClass(sender: GoodsClassModel) { func blackGoodsClass(sender: GoodsClassModel) {
print("选择商品分类返回数据=\(sender)") print("选择商品分类返回数据=\(sender)")
selectGoodsClassModel = sender
tishixxArr.replaceObject(at: 2, with:sender.cat_name)
listTbv.reloadData()
} }
//MARK:--选择品牌返回的数据 //MARK:--选择品牌返回的数据
var selectPinPaiData:GeneralInfoBrandModel? = nil
func blackSelectPinPaiData(sender: GeneralInfoBrandModel) { func blackSelectPinPaiData(sender: GeneralInfoBrandModel) {
print("选择品牌返回的数据=\(sender)") print("选择品牌返回的数据=\(sender)")
selectPinPaiData = sender
tishixxArr.replaceObject(at: 3, with:sender.brand_name)
listTbv.reloadData()
} }
//MARK:--图片选择处理 //MARK:--图片选择处理
......
...@@ -14,7 +14,6 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar ...@@ -14,7 +14,6 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar
var dataModelArray : Array<GeneralInfoBrandModel>? = [] var dataModelArray : Array<GeneralInfoBrandModel>? = []
var isSelectData : Bool = false var isSelectData : Bool = false
var delegate : PinPaiListViewControllerDelegate? var delegate : PinPaiListViewControllerDelegate?
var selectIdx:Int?
@IBOutlet weak var sureTop: NSLayoutConstraint! @IBOutlet weak var sureTop: NSLayoutConstraint!
@IBOutlet weak var tableBottom: NSLayoutConstraint! @IBOutlet weak var tableBottom: NSLayoutConstraint!
@IBOutlet weak var sureLbl: UILabel! @IBOutlet weak var sureLbl: UILabel!
...@@ -72,35 +71,31 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar ...@@ -72,35 +71,31 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar
return 49 return 49
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 12 return dataModelArray!.count
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSelectCell") as! TitleAndSelectCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSelectCell") as! TitleAndSelectCell
cell.delegate = self cell.delegate = self
cell.tag = indexPath.row cell.tag = indexPath.row
if selectIdx == indexPath.row { let rowModel = dataModelArray![indexPath.row]
cell.titleLbl.textColor = UIColor(named: "蓝色字体颜色") cell.titleLbl.text = rowModel.brand_name
cell.selectBtn.isSelected = true
}else{
cell.titleLbl.textColor = UIColor(named: "标题字颜色") cell.titleLbl.textColor = UIColor(named: "标题字颜色")
cell.selectBtn.isSelected = false cell.selectBtn.isSelected = false
if selectModel != nil {
if rowModel.brand_id == selectModel?.brand_id {
cell.titleLbl.textColor = UIColor(named: "蓝色字体颜色")
cell.selectBtn.isSelected = true
} }
// 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 return cell
} }
var selectModel : GeneralInfoBrandModel? = nil var selectModel : GeneralInfoBrandModel? = nil
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if isSelectData { if isSelectData {
// let rowModel = dataModelArray![indexPath.row] as! GeneralInfoBrandModel let rowModel = dataModelArray![indexPath.row] as! GeneralInfoBrandModel
// selectModel = rowModel selectModel = rowModel
selectIdx = indexPath.row
listView.reloadData() listView.reloadData()
}else{ }else{
let vc = XinZengPinPaiViewController() let vc = XinZengPinPaiViewController()
...@@ -124,7 +119,8 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar ...@@ -124,7 +119,8 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar
//MARK:--自定义celldelegate //MARK:--自定义celldelegate
func TitleAndSelectCellClick(content: UIButton, cell: TitleAndSelectCell) { func TitleAndSelectCellClick(content: UIButton, cell: TitleAndSelectCell) {
print(cell.tag) print(cell.tag)
selectIdx = cell.tag let rowModel = dataModelArray![cell.tag] as! GeneralInfoBrandModel
selectModel = rowModel
listView.reloadData() listView.reloadData()
} }
......
<?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="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"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
<color red="0.3880000114440918" green="0.62400001287460327" blue="0.90200001001358032" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.3880000114440918" green="0.62400001287460327" blue="0.90200001001358032" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<namedColor name="按钮渐变色下,字体颜色"> <namedColor name="按钮渐变色下,字体颜色">
<color red="0.27450980392156865" green="0.5607843137254902" blue="0.88627450980392153" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<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"/>
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<namedColor name="灰色字体颜色"> <namedColor name="灰色字体颜色">
<color red="0.40000000596046448" green="0.40000000596046448" blue="0.40000000596046448" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
</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