Commit 9f3a4b1f authored by lujunye's avatar lujunye

字典修改成model

parent 42fea0c7
...@@ -257,6 +257,7 @@ ...@@ -257,6 +257,7 @@
E0DDCB19244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0DDCB17244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.xib */; }; E0DDCB19244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0DDCB17244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.xib */; };
E0DDCB1D244AE81800DF54C7 /* GuanLianKeHuCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0DDCB1B244AE81800DF54C7 /* GuanLianKeHuCell.swift */; }; E0DDCB1D244AE81800DF54C7 /* GuanLianKeHuCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0DDCB1B244AE81800DF54C7 /* GuanLianKeHuCell.swift */; };
E0DDCB1E244AE81800DF54C7 /* GuanLianKeHuCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0DDCB1C244AE81800DF54C7 /* GuanLianKeHuCell.xib */; }; E0DDCB1E244AE81800DF54C7 /* GuanLianKeHuCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0DDCB1C244AE81800DF54C7 /* GuanLianKeHuCell.xib */; };
E0E8ABFD246E359700E3BB54 /* GuiGeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0E8ABFC246E359700E3BB54 /* GuiGeModel.swift */; };
E0F1BE382469220D003015B2 /* RongSticker.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E0F1BE2A24692208003015B2 /* RongSticker.bundle */; }; E0F1BE382469220D003015B2 /* RongSticker.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E0F1BE2A24692208003015B2 /* RongSticker.bundle */; };
E0F1BE392469220D003015B2 /* RCColor.plist in Resources */ = {isa = PBXBuildFile; fileRef = E0F1BE2B24692208003015B2 /* RCColor.plist */; }; E0F1BE392469220D003015B2 /* RCColor.plist in Resources */ = {isa = PBXBuildFile; fileRef = E0F1BE2B24692208003015B2 /* RCColor.plist */; };
E0F1BE3A2469220D003015B2 /* libvo-amrwbenc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0F1BE2C24692208003015B2 /* libvo-amrwbenc.a */; }; E0F1BE3A2469220D003015B2 /* libvo-amrwbenc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0F1BE2C24692208003015B2 /* libvo-amrwbenc.a */; };
...@@ -737,6 +738,7 @@ ...@@ -737,6 +738,7 @@
E0DDCB17244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XiuGaiYuShouJiaViewController.xib; sourceTree = "<group>"; }; E0DDCB17244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XiuGaiYuShouJiaViewController.xib; sourceTree = "<group>"; };
E0DDCB1B244AE81800DF54C7 /* GuanLianKeHuCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuanLianKeHuCell.swift; sourceTree = "<group>"; }; E0DDCB1B244AE81800DF54C7 /* GuanLianKeHuCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuanLianKeHuCell.swift; sourceTree = "<group>"; };
E0DDCB1C244AE81800DF54C7 /* GuanLianKeHuCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GuanLianKeHuCell.xib; sourceTree = "<group>"; }; E0DDCB1C244AE81800DF54C7 /* GuanLianKeHuCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GuanLianKeHuCell.xib; sourceTree = "<group>"; };
E0E8ABFC246E359700E3BB54 /* GuiGeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuiGeModel.swift; sourceTree = "<group>"; };
E0F1BE2A24692208003015B2 /* RongSticker.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = RongSticker.bundle; sourceTree = "<group>"; }; E0F1BE2A24692208003015B2 /* RongSticker.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = RongSticker.bundle; sourceTree = "<group>"; };
E0F1BE2B24692208003015B2 /* RCColor.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = RCColor.plist; sourceTree = "<group>"; }; E0F1BE2B24692208003015B2 /* RCColor.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = RCColor.plist; sourceTree = "<group>"; };
E0F1BE2C24692208003015B2 /* libvo-amrwbenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libvo-amrwbenc.a"; sourceTree = "<group>"; }; E0F1BE2C24692208003015B2 /* libvo-amrwbenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libvo-amrwbenc.a"; sourceTree = "<group>"; };
...@@ -1247,6 +1249,7 @@ ...@@ -1247,6 +1249,7 @@
E0336DD2244EC3CA00380BE9 /* 新增规格 */ = { E0336DD2244EC3CA00380BE9 /* 新增规格 */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E0E8ABFC246E359700E3BB54 /* GuiGeModel.swift */,
E0336DD3244EC40000380BE9 /* CreatNewSpecsViewController.swift */, E0336DD3244EC40000380BE9 /* CreatNewSpecsViewController.swift */,
E0336DD4244EC40000380BE9 /* CreatNewSpecsViewController.xib */, E0336DD4244EC40000380BE9 /* CreatNewSpecsViewController.xib */,
E0C4F4B3244EE9EE00CC7E2F /* YuShouCell.swift */, E0C4F4B3244EE9EE00CC7E2F /* YuShouCell.swift */,
...@@ -2656,6 +2659,7 @@ ...@@ -2656,6 +2659,7 @@
E09F4CA22452D18800BE033D /* ZengZhiServicesViewController.swift in Sources */, E09F4CA22452D18800BE033D /* ZengZhiServicesViewController.swift in Sources */,
F94A315B24628C7E00FEC38E /* WorkItemTableViewCell.swift in Sources */, F94A315B24628C7E00FEC38E /* WorkItemTableViewCell.swift in Sources */,
E0DDCB18244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.swift in Sources */, E0DDCB18244AE2AC00DF54C7 /* XiuGaiYuShouJiaViewController.swift in Sources */,
E0E8ABFD246E359700E3BB54 /* GuiGeModel.swift in Sources */,
F950FDEA2451920200C40530 /* DIYCalendarCell.swift in Sources */, F950FDEA2451920200C40530 /* DIYCalendarCell.swift in Sources */,
F950FDE224518B9500C40530 /* FSCalendarCalculator.m in Sources */, F950FDE224518B9500C40530 /* FSCalendarCalculator.m in Sources */,
E0D197C12448431C002B080C /* BabyToy.m in Sources */, E0D197C12448431C002B080C /* BabyToy.m in Sources */,
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
// //
import UIKit import UIKit
@objc protocol AddImgCellDelegate { protocol AddImgCellDelegate {
@objc optional func AddImgCellBtnClick(cell:AddImgCell) func AddImgCellBtnClick(cell:AddImgCell)
@objc optional func DelImgCellBtnClick(sender:UIButton,cell:AddImgCell) func DelImgCellBtnClick(sender:UIButton,cell:AddImgCell)
func ChangeCellBtnClick(sender:UIButton,cell:AddImgCell)
} }
class AddImgCell: UITableViewCell { class AddImgCell: UITableViewCell {
var delegate:AddImgCellDelegate? var delegate:AddImgCellDelegate?
...@@ -20,26 +21,27 @@ class AddImgCell: UITableViewCell { ...@@ -20,26 +21,27 @@ class AddImgCell: UITableViewCell {
} }
} }
@IBAction func btnClick(_ sender: Any) { @IBAction func btnClick(_ sender: Any) {
delegate?.AddImgCellBtnClick?(cell: self) delegate?.AddImgCellBtnClick(cell: self)
} }
var isSingle:Bool? var isSingle:Bool?
var imgs:NSArray?{ var imgs:Array<UIImage> = []{
didSet{ didSet{
if imgs!.count > 0{ print(imgs.count)
if imgs.count > 0{
if scrollView == nil { if scrollView == nil {
let scrView = UIScrollView(frame: CGRect(x: 0, y: nameLbl.frame.maxY, width: fullScreenWidth, height: self.bounds.size.height-nameLbl.frame.maxY)) let scrView = UIScrollView(frame: CGRect(x: addBtn.frame.minX, y: addBtn.frame.minY, width: fullScreenWidth, height: 90))
scrView.showsHorizontalScrollIndicator = false scrView.showsHorizontalScrollIndicator = false
scrView.backgroundColor = UIColor.white
self.contentView.addSubview(scrView) self.contentView.addSubview(scrView)
scrollView = scrView scrollView = scrView
} }
scrollView?.isHidden = false scrollView?.isHidden = false
if isSingle == true { if isSingle == true {
addBtn.isHidden = true setImgUI(arr: imgs)
setImgUI(arr: imgs!)
}else{ }else{
setImgUI(arr: imgs!) setImgUI(arr: imgs)
} }
}else{ }else{
scrollView?.isHidden = true scrollView?.isHidden = true
...@@ -47,7 +49,7 @@ class AddImgCell: UITableViewCell { ...@@ -47,7 +49,7 @@ class AddImgCell: UITableViewCell {
if isSingle == true { if isSingle == true {
addBtn.isHidden = false addBtn.isHidden = false
} }
} }
} }
} }
...@@ -56,23 +58,24 @@ class AddImgCell: UITableViewCell { ...@@ -56,23 +58,24 @@ class AddImgCell: UITableViewCell {
@IBOutlet weak var nameLbl: UILabel! @IBOutlet weak var nameLbl: UILabel!
@IBOutlet weak var addBtnX: NSLayoutConstraint! @IBOutlet weak var addBtnX: NSLayoutConstraint!
func setImgUI(arr:NSArray){ func setImgUI(arr:Array<UIImage>){
let y = nameLbl.frame.maxY let y = addBtn.frame.minY
let h = self.bounds.size.height-nameLbl.frame.maxY let h:CGFloat = 90
if isSingle == false { if isSingle == false {
addBtn.isHidden = false addBtn.isHidden = false
scrollView?.isHidden = false scrollView?.isHidden = false
if arr.count < 3 { if arr.count < 3 {
scrollView?.frame = CGRect(x: 0, y: CGFloat(y), width: CGFloat(arr.count)*110, height:h) scrollView?.contentSize = CGSize(width: arr.count*105, height: 0)
addBtnX.constant = (scrollView?.frame.maxX)!+10 scrollView?.frame = CGRect(x: 15, y: CGFloat(y), width: CGFloat(arr.count)*105, height:h)
addBtnX.constant = (scrollView?.frame.maxX)!
}else if arr.count == 5 { }else if arr.count == 5 {
addBtn.isHidden = true addBtn.isHidden = true
scrollView?.contentSize = CGSize(width: arr.count*110, height: 0) scrollView?.contentSize = CGSize(width: arr.count*105, height: 0)
scrollView?.frame = CGRect(x: 0, y: CGFloat(y), width: fullScreenWidth, height:h) scrollView?.frame = CGRect(x: 15, y: CGFloat(y), width: fullScreenWidth, height:h)
}else{ }else{
scrollView?.contentSize = CGSize(width: arr.count*110, height: 0) scrollView?.contentSize = CGSize(width: arr.count*105, height: 0)
scrollView?.frame = CGRect(x: 0, y: CGFloat(y), width: fullScreenWidth*0.7, height:h) scrollView?.frame = CGRect(x: 15, y: CGFloat(y), width: fullScreenWidth-130, height:h)
addBtnX.constant = (scrollView?.frame.maxX)!+10 addBtnX.constant = fullScreenWidth-105
} }
} }
for i in 0 ..< arr.count { for i in 0 ..< arr.count {
...@@ -80,12 +83,31 @@ class AddImgCell: UITableViewCell { ...@@ -80,12 +83,31 @@ class AddImgCell: UITableViewCell {
img.layer.cornerRadius = 3 img.layer.cornerRadius = 3
img.layer.masksToBounds = true img.layer.masksToBounds = true
scrollView!.addSubview(img) scrollView!.addSubview(img)
img.image = arr[i] as! UIImage img.image = arr[i]
img.isUserInteractionEnabled = true img.isUserInteractionEnabled = true
img.snp.makeConstraints { (make) in img.snp.makeConstraints { (make) in
make.centerY.equalTo(scrollView!.snp_centerY) make.centerY.equalTo(scrollView!.snp_centerY)
make.width.height.equalTo(90) make.width.height.equalTo(90)
make.left.equalTo(15 + 105*i) make.left.equalTo(105*i)
}
let changeBtn = UIButton()
changeBtn.tag = i
changeBtn.backgroundColor = UIColor(named: "标题字颜色")
changeBtn.alpha = 0.5
changeBtn.addTarget(self, action: #selector(changeAction(sender:)), for: .touchUpInside)
img.addSubview(changeBtn)
changeBtn.snp.makeConstraints { (make) in
make.top.bottom.right.left.equalTo(0)
}
let ti = UILabel()
ti.text = "替 换"
ti.textColor = UIColor.white
ti.textAlignment = .center
ti.font = UIFont.systemFont(ofSize: 15)
img.addSubview(ti)
ti.snp.makeConstraints { (make) in
make.top.bottom.right.left.equalTo(0)
} }
let delImg = UIImageView() let delImg = UIImageView()
img.addSubview(delImg) img.addSubview(delImg)
...@@ -109,8 +131,12 @@ class AddImgCell: UITableViewCell { ...@@ -109,8 +131,12 @@ class AddImgCell: UITableViewCell {
delBtn.addTarget(self, action: #selector(delAction(sender:)), for: .touchUpInside) delBtn.addTarget(self, action: #selector(delAction(sender:)), for: .touchUpInside)
} }
} }
@objc func changeAction(sender:UIButton){
delegate?.ChangeCellBtnClick(sender: sender,cell:self)
}
@objc func delAction(sender:UIButton){ @objc func delAction(sender:UIButton){
delegate?.DelImgCellBtnClick?(sender: sender, cell: self)
delegate?.DelImgCellBtnClick(sender:sender, cell: self)
} }
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
......
...@@ -7,19 +7,25 @@ ...@@ -7,19 +7,25 @@
// //
import UIKit import UIKit
protocol YuShouWeiKuanFaHuoCellDelegate {
func YuShouWeiKuanFaHuoCellString(str:String)
}
class YuShouWeiKuanFaHuoCell: UITableViewCell { class YuShouWeiKuanFaHuoCell: UITableViewCell {
var delegate:YuShouWeiKuanFaHuoCellDelegate?
@IBOutlet weak var textTF: UITextField! @IBOutlet weak var textTF: UITextField!
@IBOutlet weak var nameLbl: UILabel! @IBOutlet weak var nameLbl: UILabel!
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
self.selectionStyle = .none self.selectionStyle = .none
textTF.addTarget(self, action: #selector(textChange(tf:)), for: .allEditingEvents)
// Initialization code // Initialization code
} }
@objc func textChange(tf:UITextField){
if tf.text != nil {
delegate?.YuShouWeiKuanFaHuoCellString(str: tf.text!)
}
}
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
......
////
//// ProductDetailViewController.swift
//// GeliBusinessPlatform
////
//// Created by junye lu on 2020/4/23.
//// Copyright © 2020 junye lu. All rights reserved.
////
// //
// ProductDetailViewController.swift //import UIKit
// GeliBusinessPlatform //import LGButton
//import Photos
// //
// Created by junye lu on 2020/4/23. //class EditProductViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CommendCellDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate{
// Copyright © 2020 junye lu. All rights reserved. //
// // var isEdit:Bool = false//是否编辑状态
//
import UIKit // var selectIdx:IndexPath?
import LGButton // var layout = UICollectionViewFlowLayout()
import Photos // var glSelectView:GLAlertSelectView?
// let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
class EditProductViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CommendCellDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate{ // let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
//
var isEdit:Bool = false//是否编辑状态 // let tishixxArr:NSMutableArray = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"]
// let tishixxArr1:NSMutableArray = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"]
var selectIdx:IndexPath? //
var layout = UICollectionViewFlowLayout() // let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"]
var glSelectView:GLAlertSelectView? // let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"]
let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"] // let ysszArr = ["用户付款是否需要审核","预设预付定金时间段","预设预付尾款时间段","预设预付尾款发货时间"]
let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"] // let ysszHolder = ["0","请选择时段","请选择时段","0"]
//
let tishixxArr:NSMutableArray = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"] //
let tishixxArr1:NSMutableArray = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"] // var itemTypeArr = NSMutableArray()
//
let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"] // var shangPinStatus:Int?
let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"] // var shangPinStatusArr = ["热销","爆款","新品","促销","外采","团购"]
let ysszArr = ["用户付款是否需要审核","预设预付定金时间段","预设预付尾款时间段","预设预付尾款发货时间"] //
let ysszHolder = ["0","请选择时段","请选择时段","0"] // var yunShuType:Int?
// var yunShuTypeArr = ["冷链","常温","热链"]
// //MARK:--保存按钮
var itemTypeArr = NSMutableArray() // @IBOutlet weak var bottomView: UIView!
//
var shangPinStatus:Int? // @IBOutlet weak var listTbv: UITableView!
var shangPinStatusArr = ["热销","爆款","新品","促销","外采","团购"] // var cellHeight = 18.5
// var contentStr:String = ""
var yunShuType:Int? //
var yunShuTypeArr = ["冷链","常温","热链"] // var guiGeArr:NSMutableArray = []//根据规格资料数量控制右上角新增按钮是否显示
//MARK:--保存按钮 //
@IBOutlet weak var bottomView: UIView! //
//
@IBOutlet weak var listTbv: UITableView! // var isYuShouShangPin:Bool?
var cellHeight = 18.5 //
var contentStr:String = "" // let btmTitleArr = ["编辑","入库","下架","删除"]
// @objc func bottomBtnClick(sender:UIButton){
var guiGeArr:NSMutableArray = []//根据规格资料数量控制右上角新增按钮是否显示 //
// switch sender.titleLabel?.text {
// case "编辑":
// isEdit = true
var isYuShouShangPin:Bool? // sender.setTitle("保存", for: .normal)
// firstLbl!.text = "保存"
let btmTitleArr = ["编辑","入库","下架","删除"] // listTbv.reloadData()
@objc func bottomBtnClick(sender:UIButton){ // break
// case "保存":
switch sender.titleLabel?.text { // isEdit = false
case "编辑": // sender.setTitle("编辑", for: .normal)
isEdit = true // firstLbl!.text = "编辑"
sender.setTitle("保存", for: .normal) // listTbv.reloadData()
firstLbl!.text = "保存" // break
listTbv.reloadData() // default:
break // break
case "保存": // }
isEdit = false // }
sender.setTitle("编辑", for: .normal) //
firstLbl!.text = "编辑" // var firstLbl:UILabel? = nil
listTbv.reloadData() // var generalInfoModel : GeneralInfoModel? = nil
break // override func viewDidLoad() {
default: // super.viewDidLoad()
break // //MARK:--获取新增商品的基本信息(品牌和分类等)
} // HUD.flash(.progress)
} // let UserToken = UserDefaults.standard.value(forKey: "user_token")
// GeneralInfo(["user_token":UserToken as Any], success: { (data) in
var firstLbl:UILabel? = nil // HUD.hide(animated: true)
var generalInfoModel : GeneralInfoModel? = nil // self.generalInfoModel = data as! GeneralInfoModel
override func viewDidLoad() { //
super.viewDidLoad() // }) { (error) in
//MARK:--获取新增商品的基本信息(品牌和分类等) //
HUD.flash(.progress) // }
let UserToken = UserDefaults.standard.value(forKey: "user_token") // isYuShouShangPin = true
GeneralInfo(["user_token":UserToken as Any], success: { (data) in //
HUD.hide(animated: true) // navbar.title = "商品详情"
self.generalInfoModel = data as! GeneralInfoModel // self.view.addSubview(navbar)
// listTbv.separatorStyle = .none
}) { (error) in // listTbv.snp.makeConstraints { (make) in
// make.top.equalTo(NavCGRect.height)
} // make.left.right.equalTo(0)
isYuShouShangPin = true // make.bottom.equalTo(bottomView.snp_top)
// }
navbar.title = "商品详情" //
self.view.addSubview(navbar) // listTbv.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF")
listTbv.separatorStyle = .none // listTbv.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitch")
listTbv.snp.makeConstraints { (make) in // listTbv.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn")
make.top.equalTo(NavCGRect.height) // listTbv.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImg")
make.left.right.equalTo(0) // listTbv.register(UINib(nibName: "AddGuiGeCell", bundle: nil), forCellReuseIdentifier: "AddGuiGe")
make.bottom.equalTo(bottomView.snp_top) // listTbv.register(UINib(nibName: "CommendCell", bundle: nil), forCellReuseIdentifier: "Commend")
} // listTbv.register(UINib(nibName: "YuShouWeiKuanFaHuoCell", bundle: nil), forCellReuseIdentifier: "YuShouWeiKuanFaHuoCell")
// listTbv.register(UINib(nibName: "ShangPinGguiGeCell", bundle: nil), forCellReuseIdentifier: "ShangPinGguiGeCell")
listTbv.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF") // // Do any additional setup after loading the view.
listTbv.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitch") // let w = fullScreenWidth / CGFloat(btmTitleArr.count)
listTbv.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn") // for i in 0 ..< btmTitleArr.count{
listTbv.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImg") // let btn = UIButton(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: bottomView.bounds.size.height))
listTbv.register(UINib(nibName: "AddGuiGeCell", bundle: nil), forCellReuseIdentifier: "AddGuiGe") // btn.tag = i
listTbv.register(UINib(nibName: "CommendCell", bundle: nil), forCellReuseIdentifier: "Commend") // btn.setTitle(btmTitleArr[i], for: .normal)
listTbv.register(UINib(nibName: "YuShouWeiKuanFaHuoCell", bundle: nil), forCellReuseIdentifier: "YuShouWeiKuanFaHuoCell") // btn.titleLabel?.textColor = UIColor.clear
listTbv.register(UINib(nibName: "ShangPinGguiGeCell", bundle: nil), forCellReuseIdentifier: "ShangPinGguiGeCell") // btn.addTarget(self, action: #selector(bottomBtnClick(sender:)), for: .touchUpInside)
// Do any additional setup after loading the view. // let lbl = UILabel(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: 49*glscale))
let w = fullScreenWidth / CGFloat(btmTitleArr.count) // lbl.textAlignment = .center
for i in 0 ..< btmTitleArr.count{ // lbl.text = btmTitleArr[i]
let btn = UIButton(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: bottomView.bounds.size.height)) // lbl.font = UIFont.systemFont(ofSize: 13)
btn.tag = i // lbl.textColor = UIColor(named: "蓝色字体颜色")
btn.setTitle(btmTitleArr[i], for: .normal) // if i == 0 {
btn.titleLabel?.textColor = UIColor.clear // firstLbl = lbl
btn.addTarget(self, action: #selector(bottomBtnClick(sender:)), for: .touchUpInside) // }
let lbl = UILabel(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: 49*glscale)) // bottomView.addSubview(btn)
lbl.textAlignment = .center // bottomView.addSubview(lbl)
lbl.text = btmTitleArr[i] // }
lbl.font = UIFont.systemFont(ofSize: 13) // }
lbl.textColor = UIColor(named: "蓝色字体颜色") // //MARK: - cell delegate
if i == 0 { // func numberOfSections(in tableView: UITableView) -> Int {
firstLbl = lbl // return 6
} // }
bottomView.addSubview(btn) // func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
bottomView.addSubview(lbl) // switch section {
} // case 0: return 7
} // case 1:return 2
//MARK: - cell delegate // case 2:return 1
func numberOfSections(in tableView: UITableView) -> Int { // case 3:return 4
return 6 // case 4:return 5
} // default:return 2
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { // }
switch section { // }
case 0: return 7 //
case 1:return 2 // func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
case 2:return 1 // switch indexPath.section {
case 3:return 4 // case 0:
case 4:return 5 // if indexPath.row == 0 || indexPath.row == 4 {
default:return 2 // let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
} // cell.nameLbl.text = spxxArr[indexPath.row]
} //
// cell.textTF.placeholder = tishixxArr[indexPath.row] as! String
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { // cell.textTF.isUserInteractionEnabled = isEdit
switch indexPath.section { // return cell
case 0: // }
if indexPath.row == 0 || indexPath.row == 4 { // if indexPath.row > 4{
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell // let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
cell.nameLbl.text = spxxArr[indexPath.row] // cell.delegate = self
// cell.namelbl.text = spxxArr[indexPath.row]
cell.textTF.placeholder = tishixxArr[indexPath.row] as! String // cell.infoSw.isUserInteractionEnabled = isEdit
cell.textTF.isUserInteractionEnabled = isEdit // return cell
return cell // }
} // let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
if indexPath.row > 4{ // cell.nameLbl.text = spxxArr[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell // cell.contentLbl.text = tishixxArr[indexPath.row] as! String
cell.delegate = self // cell.tag = indexPath.row
cell.namelbl.text = spxxArr[indexPath.row] // cell.btn.isUserInteractionEnabled = isEdit
cell.infoSw.isUserInteractionEnabled = isEdit // cell.delegate = self
return cell // return cell
} // case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell // let cell = tableView.dequeueReusableCell(withIdentifier: "AddImg") as! AddImgCell
cell.nameLbl.text = spxxArr[indexPath.row] // cell.nameLbl.text = sptpArr[indexPath.row]
cell.contentLbl.text = tishixxArr[indexPath.row] as! String // if indexPath.row == 0 {
cell.tag = indexPath.row // cell.isSingle = true
cell.btn.isUserInteractionEnabled = isEdit // cell.imgs = singleImgArr
cell.delegate = self // }else{
return cell // cell.isSingle = false
case 1: // cell.imgs = maxFiveImgsArr
let cell = tableView.dequeueReusableCell(withIdentifier: "AddImg") as! AddImgCell // }
cell.nameLbl.text = sptpArr[indexPath.row] // cell.delegate = self
if indexPath.row == 0 { // cell.addBtn.tag = indexPath.row
cell.isSingle = true // cell.isEdit = isEdit
cell.imgs = singleImgArr // return cell
}else{ // case 2:
cell.isSingle = false // if guiGeArr.count > 0 {
cell.imgs = maxFiveImgsArr // let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell
} // cell.delegate = self
cell.delegate = self // var dict:NSDictionary!
cell.addBtn.tag = indexPath.row // if selectIdx != nil{
cell.isEdit = isEdit // dict = guiGeArr[selectIdx!.item] as! NSDictionary
return cell // }else{
case 2: // dict = guiGeArr.firstObject as! NSDictionary
if guiGeArr.count > 0 { // }
let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell // cell.tempLbl.text = "冷藏:\(String(describing: dict["wenDu"]!))℃"
cell.delegate = self // cell.weightLbl.text = "重量(kg):\(String(describing: dict["weight"]!))kg"
var dict:NSDictionary! // cell.guiGeLbl.text = "规格:\(String(describing: dict["guiGe"]!))kg/件"
if selectIdx != nil{ // cell.danWeiLbl.text = "单位:\(String(describing: dict["danWei"]!))"
dict = guiGeArr[selectIdx!.item] as! NSDictionary // cell.sellPriceLbl.text = "售价:¥\(dict["price"]!)"
}else{ // if isEdit{
dict = guiGeArr.firstObject as! NSDictionary // cell.btn.setTitle("编辑详情", for: .normal)
} // }else{
cell.tempLbl.text = "冷藏:\(String(describing: dict["wenDu"]!))℃" // cell.btn.setTitle("查看详情", for: .normal)
cell.weightLbl.text = "重量(kg):\(String(describing: dict["weight"]!))kg" // }
cell.guiGeLbl.text = "规格:\(String(describing: dict["guiGe"]!))kg/件" // return cell
cell.danWeiLbl.text = "单位:\(String(describing: dict["danWei"]!))" // }
cell.sellPriceLbl.text = "售价:¥\(dict["price"]!)" // let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
if isEdit{ // cell.imgBtn.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
cell.btn.setTitle("编辑详情", for: .normal) // cell.imgBtn.setImage(UIImage(named: "xinzeng"), for: .normal)
}else{ // cell.imgBtn.isUserInteractionEnabled = isEdit
cell.btn.setTitle("查看详情", for: .normal) // return cell
} // case 3:
return cell // if indexPath.row == 0 {
} // let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell // cell.namelbl.text = ysszArr[indexPath.row]
cell.imgBtn.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside) // cell.delegate = self
cell.imgBtn.setImage(UIImage(named: "xinzeng"), for: .normal) // cell.infoSw.isUserInteractionEnabled = isEdit
cell.imgBtn.isUserInteractionEnabled = isEdit // return cell
return cell // }
case 3: // if indexPath.row == 3 {
if indexPath.row == 0 { // let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell // cell.nameLbl.text = ysszArr[indexPath.row]
cell.namelbl.text = ysszArr[indexPath.row] // cell.textTF.keyboardType = .numberPad
cell.delegate = self // cell.textTF.isUserInteractionEnabled = isEdit
cell.infoSw.isUserInteractionEnabled = isEdit // return cell
return cell // }
} // let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
if indexPath.row == 3 { // cell.nameLbl.text = ysszArr[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell // cell.delegate = self
cell.nameLbl.text = ysszArr[indexPath.row] // cell.contentLbl.text = ysszHolder[indexPath.row]
cell.textTF.keyboardType = .numberPad // cell.btn.isUserInteractionEnabled = isEdit
cell.textTF.isUserInteractionEnabled = isEdit // return cell
return cell // case 4:
} // if indexPath.row < 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell // let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = ysszArr[indexPath.row] // cell.nameLbl.text = qtxxArr[indexPath.row]
cell.delegate = self // cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String
cell.contentLbl.text = ysszHolder[indexPath.row] // cell.tag = indexPath.row
cell.btn.isUserInteractionEnabled = isEdit // cell.textTF.isUserInteractionEnabled = isEdit
return cell // return cell
case 4: // }else{
if indexPath.row < 2 { // let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell // cell.nameLbl.text = qtxxArr[indexPath.row]
cell.nameLbl.text = qtxxArr[indexPath.row] // cell.tag = indexPath.row
cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String // cell.contentLbl.text = tishixxArr1[indexPath.row] as! String
cell.tag = indexPath.row // cell.btn.isUserInteractionEnabled = isEdit
cell.textTF.isUserInteractionEnabled = isEdit // cell.delegate = self
return cell // return cell
}else{ // }
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell // default:
cell.nameLbl.text = qtxxArr[indexPath.row] // if indexPath.row == 0 {
cell.tag = indexPath.row // let cell = tableView.dequeueReusableCell(withIdentifier: "Commend") as! CommendCell
cell.contentLbl.text = tishixxArr1[indexPath.row] as! String // cell.delegate = self
cell.btn.isUserInteractionEnabled = isEdit // cell.autoTf?.isUserInteractionEnabled = isEdit
cell.delegate = self // return cell
return cell // }else{
} // let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
default: // cell.imgBtn.setImage(UIImage(named: "tupian"), for: .normal)
if indexPath.row == 0 { // cell.delegate = self
let cell = tableView.dequeueReusableCell(withIdentifier: "Commend") as! CommendCell // cell.imgBtn.tag = indexPath.row
cell.delegate = self // cell.imgBtn.isUserInteractionEnabled = isEdit
cell.autoTf?.isUserInteractionEnabled = isEdit // return cell
return cell // }
}else{ // }
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell // }
cell.imgBtn.setImage(UIImage(named: "tupian"), for: .normal) //
cell.delegate = self // func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
cell.imgBtn.tag = indexPath.row //
cell.imgBtn.isUserInteractionEnabled = isEdit // }
return cell // func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
} // switch indexPath.section {
} // case 0: return 49
} // case 1:return 148.5
// case 2:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { // if guiGeArr.count > 0 {
// return 146
} // }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { // return 123.5
switch indexPath.section { // case 3:
case 0: return 49 // if isYuShouShangPin == false {
case 1:return 148.5 // return 0.01
case 2: // }else{
if guiGeArr.count > 0 { // return 49
return 146 // }
} // case 4:return 49
return 123.5 // default:
case 3: // if indexPath.row == 0 {
if isYuShouShangPin == false { // return CGFloat(cellHeight)+27.5
return 0.01 // }else{
}else{ // return 155.5
return 49 // }
} // }
case 4:return 49 // }
default: // //header
if indexPath.row == 0 { // func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return CGFloat(cellHeight)+27.5 // if section == 3 {
}else{ // if isYuShouShangPin == false {
return 155.5 // return UIView()
} // }
} // }
} // let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
//header // let lbl = UILabel(frame: CGRect(x: 15, y: 15, width: fullScreenWidth, height: 21))
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { // lbl.text = titleArr[section]
if section == 3 { // lbl.textColor = UIColor(named: "标题字颜色")
if isYuShouShangPin == false { // lbl.font = UIFont.boldSystemFont(ofSize: 15)
return UIView() // view.addSubview(lbl)
} // if section == 2 && guiGeArr.count > 0{
} // let btn = UIButton()
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39)) // btn.setTitle(" 新增", for: .normal)
let lbl = UILabel(frame: CGRect(x: 15, y: 15, width: fullScreenWidth, height: 21)) // btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
lbl.text = titleArr[section] // btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
lbl.textColor = UIColor(named: "标题字颜色") // btn.setImage(UIImage(named: "jiahaoXG"), for: .normal)
lbl.font = UIFont.boldSystemFont(ofSize: 15) // view.addSubview(btn)
view.addSubview(lbl) // btn.sizeToFit()
if section == 2 && guiGeArr.count > 0{ // btn.snp.makeConstraints { (make) in
let btn = UIButton() // make.centerY.equalTo(lbl.snp_centerY)
btn.setTitle(" 新增", for: .normal) // make.right.equalTo(-15)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13) // make.height.equalTo(btn.frame.size.height)
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal) // make.width.equalTo(btn.frame.size.width)
btn.setImage(UIImage(named: "jiahaoXG"), for: .normal) // }
view.addSubview(btn) // let btn2 = UIButton()
btn.sizeToFit() // view.addSubview(btn2)
btn.snp.makeConstraints { (make) in // btn2.snp.makeConstraints { (make) in
make.centerY.equalTo(lbl.snp_centerY) // make.top.right.bottom.equalTo(0)
make.right.equalTo(-15) // make.width.equalTo(80)
make.height.equalTo(btn.frame.size.height) // }
make.width.equalTo(btn.frame.size.width) // btn2.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
} // if guiGeArr.count > 1 {
let btn2 = UIButton() // view.frame = CGRect(x: 0, y: 0, width: fullScreenWidth, height: 80)
view.addSubview(btn2) // let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 0, height: 0), collectionViewLayout: layout)
btn2.snp.makeConstraints { (make) in // collectionView.backgroundColor = UIColor.white
make.top.right.bottom.equalTo(0) // collectionView.delegate = self
make.width.equalTo(80) // collectionView.dataSource = self
} // view.addSubview(collectionView)
btn2.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside) // collectionView.snp.makeConstraints { (make) in
if guiGeArr.count > 1 { // make.bottom.left.right.equalTo(0)
view.frame = CGRect(x: 0, y: 0, width: fullScreenWidth, height: 80) // make.height.equalTo(41)
let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 0, height: 0), collectionViewLayout: layout) // }
collectionView.backgroundColor = UIColor.white // collectionView.showsHorizontalScrollIndicator = false
collectionView.delegate = self // collectionView.isPagingEnabled = true
collectionView.dataSource = self // layout.itemSize = CGSize(width: fullScreenWidth*0.5, height: 41)
view.addSubview(collectionView) // layout.scrollDirection = .horizontal
collectionView.snp.makeConstraints { (make) in // collectionView.collectionViewLayout = layout
make.bottom.left.right.equalTo(0) // collectionView.register(UINib(nibName: "ItemCell", bundle: nil), forCellWithReuseIdentifier: "ItemCell")
make.height.equalTo(41) // collectionView.selectItem(at:selectIdx, animated: false, scrollPosition: .left)
} // }
collectionView.showsHorizontalScrollIndicator = false // }
collectionView.isPagingEnabled = true // return view
layout.itemSize = CGSize(width: fullScreenWidth*0.5, height: 41) // }
layout.scrollDirection = .horizontal // func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
collectionView.collectionViewLayout = layout // if section == 3 {
collectionView.register(UINib(nibName: "ItemCell", bundle: nil), forCellWithReuseIdentifier: "ItemCell") // if isYuShouShangPin == false {
collectionView.selectItem(at:selectIdx, animated: false, scrollPosition: .left) // return 0.001
} // }
} // }
return view // if section == 2 {
} // if guiGeArr.count > 1 {
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { // return 80
if section == 3 { // }
if isYuShouShangPin == false { // }
return 0.001 // return 39
} // }
} // //footer
if section == 2 { // func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if guiGeArr.count > 1 { // let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10))
return 80 // view.backgroundColor = UIColor(named: "app底色")
} // return view
} // }
return 39 // func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
} // if section == 3 {
//footer // if isYuShouShangPin == false {
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { // return 0.001
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10)) // }
view.backgroundColor = UIColor(named: "app底色") // }
return view // return 10
} // }
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { // //MARK: - 自定义delegate
if section == 3 { // func CommendCellSendH(height: CGFloat) {
if isYuShouShangPin == false { // cellHeight = Double(height)
return 0.001 // listTbv.beginUpdates()
} // listTbv.endUpdates()
} // }
return 10 // func CommendCellSendStr(content: String) {
} // print("CommendCellSendStr")
//MARK: - 自定义delegate // }
func CommendCellSendH(height: CGFloat) { // override func backAction() {
cellHeight = Double(height) // self.navigationController?.popViewController(animated: true)
listTbv.beginUpdates() // }
listTbv.endUpdates() // //MARK: -- 选择填或跳转
} //
func CommendCellSendStr(content: String) { //
print("CommendCellSendStr") //
} // func btnClick(content: String, cell: TitleAndBtnCell) {
override func backAction() { // if cell.nameLbl.text == "商品类型" {
self.navigationController?.popViewController(animated: true) // if glSelectView == nil {
} // let view = GLAlertSelectView(frame: self.view.bounds)
//MARK: -- 选择填或跳转 // view.tag = cell.tag
// view.isMultipleS = true
// view.titleLbl.text = "请选择商品类型"
// view.delegate = self
func btnClick(content: String, cell: TitleAndBtnCell) { // view.dataArr = ["预售","普通","期货","团购"]
if cell.nameLbl.text == "商品类型" { // if itemTypeArr.count == 0 {
if glSelectView == nil { // for _ in view.dataArr {
let view = GLAlertSelectView(frame: self.view.bounds) // itemTypeArr.add("99")
view.tag = cell.tag // }
view.isMultipleS = true // }
view.titleLbl.text = "请选择商品类型" // view.selectArray = itemTypeArr
view.delegate = self // self.view.addSubview(view)
view.dataArr = ["预售","普通","期货","团购"] // glSelectView = view
if itemTypeArr.count == 0 { // }
for _ in view.dataArr { // }
itemTypeArr.add("99") // if cell.nameLbl.text == "商品分类" {
} // let vc = GoodsClassViewController()
} // vc.delegate = self
view.selectArray = itemTypeArr // vc.dataModelArray = generalInfoModel?.data?.cats
self.view.addSubview(view) // self.navigationController?.pushViewController(vc, animated: true)
glSelectView = view // }
} // if cell.nameLbl.text == "品牌" {
} // let vc = PinPaiListViewController()
if cell.nameLbl.text == "商品分类" { // vc.isSelectData = true
let vc = GoodsClassViewController() // vc.delegate = self
vc.delegate = self // vc.dataModelArray = generalInfoModel?.data?.brand
vc.dataModelArray = generalInfoModel?.data?.cats // self.navigationController?.pushViewController(vc, animated: true)
self.navigationController?.pushViewController(vc, animated: true) // }
} // if cell.nameLbl.text == "国家" {
if cell.nameLbl.text == "品牌" { //
let vc = PinPaiListViewController() // }
vc.isSelectData = true // if cell.nameLbl.text == "商品状态" {
vc.delegate = self // let view = GLAlertSelectView(frame: self.view.bounds)
vc.dataModelArray = generalInfoModel?.data?.brand // view.tag = cell.tag
self.navigationController?.pushViewController(vc, animated: true) // view.titleLbl.text = "请选择商品类型"
} // view.delegate = self
if cell.nameLbl.text == "国家" { // view.dataArr = shangPinStatusArr
// view.selectNum = shangPinStatus!
} // self.view.addSubview(view)
if cell.nameLbl.text == "商品状态" { // glSelectView = view
let view = GLAlertSelectView(frame: self.view.bounds) // }
view.tag = cell.tag // if cell.nameLbl.text == "运输方式" {
view.titleLbl.text = "请选择商品类型" // let view = GLAlertSelectView(frame: self.view.bounds)
view.delegate = self // view.tag = cell.tag
view.dataArr = shangPinStatusArr // view.titleLbl.text = "请选择运输方式"
view.selectNum = shangPinStatus! // view.delegate = self
self.view.addSubview(view) // view.dataArr = yunShuTypeArr
glSelectView = view // view.selectNum = yunShuType!
} // self.view.addSubview(view)
if cell.nameLbl.text == "运输方式" { // glSelectView = view
let view = GLAlertSelectView(frame: self.view.bounds) // }
view.tag = cell.tag // if cell.nameLbl.text == "预设预付定金时间段" {
view.titleLbl.text = "请选择运输方式" //
view.delegate = self // }
view.dataArr = yunShuTypeArr // if cell.nameLbl.text == "预设预付尾款时间段" {
view.selectNum = yunShuType! //
self.view.addSubview(view) // }
glSelectView = view // print(cell.nameLbl.text)
} // }
if cell.nameLbl.text == "预设预付定金时间段" { // //MARK:---选择商品分类返回数据
// func blackGoodsClass(sender: GoodsClassModel) {
} // print("选择商品分类返回数据=\(sender)")
if cell.nameLbl.text == "预设预付尾款时间段" { // }
// //MARK:--选择品牌返回的数据
} // func blackSelectPinPaiData(sender: GeneralInfoBrandModel) {
print(cell.nameLbl.text) // print("选择品牌返回的数据=\(sender)")
} //
//MARK:---选择商品分类返回数据 // }
func blackGoodsClass(sender: GoodsClassModel) { //
print("选择商品分类返回数据=\(sender)") // func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
} // print("单选",selectNum)
//MARK:--选择品牌返回的数据 // print(view.titleLbl.text)
func blackSelectPinPaiData(sender: GeneralInfoBrandModel) { // switch view.titleLbl.text {
print("选择品牌返回的数据=\(sender)") // case "请选择商品类型":
// shangPinStatus = selectNum
} // tishixxArr1.replaceObject(at: view.tag, with: shangPinStatusArr[selectNum])
// break
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) { // case "请选择运输方式":
print("单选",selectNum) // yunShuType = selectNum
print(view.titleLbl.text) // tishixxArr1.replaceObject(at: view.tag, with: yunShuTypeArr[selectNum])
switch view.titleLbl.text { // break
case "请选择商品类型": // default:
shangPinStatus = selectNum // break
tishixxArr1.replaceObject(at: view.tag, with: shangPinStatusArr[selectNum]) // }
break // glSelectView?.removeFromSuperview()
case "请选择运输方式": // glSelectView = nil
yunShuType = selectNum // listTbv.reloadData()
tishixxArr1.replaceObject(at: view.tag, with: yunShuTypeArr[selectNum]) // }
break // var isYuShou:Bool = false
default: //
break // func GLAlertMoreSelectViewClick(sender: NSArray, view:UIView) {
} // print("多选",sender)
glSelectView?.removeFromSuperview() // itemTypeArr = sender as! NSMutableArray
glSelectView = nil // let str = "\(sender.firstObject!)" as! NSString
listTbv.reloadData() // if str != "99" {
} // isYuShou = true
var isYuShou:Bool = false // }else{
// isYuShou = false
func GLAlertMoreSelectViewClick(sender: NSArray, view:UIView) { // }
print("多选",sender) // let contentArr = ["预售","普通","期货","团购"]
itemTypeArr = sender as! NSMutableArray // let titles = NSMutableArray()
let str = "\(sender.firstObject!)" as! NSString // titles.removeAllObjects()
if str != "99" { // for num in itemTypeArr {
isYuShou = true // let str = "\(num)" as! NSString
}else{ // if str != "99"{
isYuShou = false // titles.add(contentArr[str.integerValue])
} // }
let contentArr = ["预售","普通","期货","团购"] // }
let titles = NSMutableArray() // tishixxArr.replaceObject(at: view.tag, with: titles.componentsJoined(by: ","))
titles.removeAllObjects() //
for num in itemTypeArr { // if itemTypeArr.componentsJoined(by: "_") == "99_99_99_99" {
let str = "\(num)" as! NSString // tishixxArr.replaceObject(at: view.tag, with:"请选择商品类型")
if str != "99"{ // }
titles.add(contentArr[str.integerValue]) //
} // glSelectView?.removeFromSuperview()
} // glSelectView = nil
tishixxArr.replaceObject(at: view.tag, with: titles.componentsJoined(by: ",")) // listTbv.reloadData()
// }
if itemTypeArr.componentsJoined(by: "_") == "99_99_99_99" { // func GLAlertSelectViewClose(sender: UIButton) {
tishixxArr.replaceObject(at: view.tag, with:"请选择商品类型") // glSelectView?.removeFromSuperview()
} // glSelectView = nil
// }
glSelectView?.removeFromSuperview() // var maxFiveImgsArr = NSMutableArray()
glSelectView = nil // var singleImgArr = NSMutableArray()
listTbv.reloadData() // func DelImgCellBtnClick(sender: UIButton, cell: AddImgCell) {
} // if cell.isSingle == true {
func GLAlertSelectViewClose(sender: UIButton) { // singleImgArr.removeObject(at: sender.tag)
glSelectView?.removeFromSuperview() // listTbv.reloadData()
glSelectView = nil // }else{
} // maxFiveImgsArr.removeObject(at: sender.tag)
var maxFiveImgsArr = NSMutableArray() // listTbv.reloadData()
var singleImgArr = NSMutableArray() // }
func DelImgCellBtnClick(sender: UIButton, cell: AddImgCell) { //
if cell.isSingle == true { // }
singleImgArr.removeObject(at: sender.tag) // func AddImgCellBtnClick(cell: AddImgCell) {
listTbv.reloadData() // if cell.addBtn.tag == 0 {//仅一张
}else{ // _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
maxFiveImgsArr.removeObject(at: sender.tag) // //结果处理
listTbv.reloadData() // print("共选择了\(assets.count)张图片,分别如下:")
} // let option = PHImageRequestOptions()
// option.isSynchronous = true
} // option.isNetworkAccessAllowed = true
func AddImgCellBtnClick(cell: AddImgCell) { // for asset in assets {
if cell.addBtn.tag == 0 {//仅一张 // PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
_ = self.presentHGImagePicker(maxSelected:1) { (assets) in // // print("上传图片==\(image)")
//结果处理 // self.singleImgArr.add(image)
print("共选择了\(assets.count)张图片,分别如下:") // })
let option = PHImageRequestOptions() // }
option.isSynchronous = true // cell.imgs = self.singleImgArr
option.isNetworkAccessAllowed = true // }
for asset in assets { // }else{//可多张
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in // _ = self.presentHGImagePicker(maxSelected:5) { (assets) in
// print("上传图片==\(image)") // //结果处理
self.singleImgArr.add(image) // print("共选择了\(assets.count)张图片,分别如下:")
}) // let option = PHImageRequestOptions()
} // option.isSynchronous = true
cell.imgs = self.singleImgArr // option.isNetworkAccessAllowed = true
} // for asset in assets {
}else{//可多张 // PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
_ = self.presentHGImagePicker(maxSelected:5) { (assets) in // // print("上传图片==\(image)")
//结果处理 // self.maxFiveImgsArr.add(image)
print("共选择了\(assets.count)张图片,分别如下:") // })
let option = PHImageRequestOptions() // }
option.isSynchronous = true // cell.imgs = self.maxFiveImgsArr
option.isNetworkAccessAllowed = true // }
for asset in assets { // }
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in // }
// print("上传图片==\(image)") // func ShangPinGguiGeCellEditAction(cell: ShangPinGguiGeCell) {
self.maxFiveImgsArr.add(image) // let vc = CreatNewSpecsViewController()
}) // vc.barTitle = "编辑规格"
} // vc.datasArr = guiGeArr
cell.imgs = self.maxFiveImgsArr // let dataDict:NSDictionary!
} // if selectIdx?.item != nil {
} // dataDict = guiGeArr[selectIdx!.item] as! NSDictionary
} // }else{
func ShangPinGguiGeCellEditAction(cell: ShangPinGguiGeCell) { // dataDict = guiGeArr.firstObject as! NSDictionary
let vc = CreatNewSpecsViewController() // }
vc.barTitle = "编辑规格" //
vc.datasArr = guiGeArr // vc.price = dataDict["price"] as! String
let dataDict:NSDictionary! // vc.guiGe = dataDict["guiGe"] as! String
if selectIdx?.item != nil { // vc.weight = dataDict["weight"] as! String
dataDict = guiGeArr[selectIdx!.item] as! NSDictionary // vc.wenDu = dataDict["wenDu"] as! String
}else{ // vc.danWei = dataDict["danWei"] as! String
dataDict = guiGeArr.firstObject as! NSDictionary // let arr = dataDict["jieTiArr"] as! NSMutableArray
} // let arr2 = dataDict["specalArr"] as! NSMutableArray
// vc.isNonYuShou = dataDict["isNonYuShou"] as! Bool
vc.price = dataDict["price"] as! String // vc.isYuShouSetting = dataDict["isYuShouSetting"] as! Bool
vc.guiGe = dataDict["guiGe"] as! String // vc.yuShouPrice = dataDict["yuShouPrice"] as! String
vc.weight = dataDict["weight"] as! String // vc.specalArr = arr2
vc.wenDu = dataDict["wenDu"] as! String // vc.jieTiArr = arr
vc.danWei = dataDict["danWei"] as! String // if selectIdx == nil {
let arr = dataDict["jieTiArr"] as! NSMutableArray // vc.selectIdx = IndexPath(item: 0, section: 0)
let arr2 = dataDict["specalArr"] as! NSMutableArray // }else{
vc.isNonYuShou = dataDict["isNonYuShou"] as! Bool // vc.selectIdx = selectIdx
vc.isYuShouSetting = dataDict["isYuShouSetting"] as! Bool // }
vc.yuShouPrice = dataDict["yuShouPrice"] as! String // print(vc.selectIdx?.item)
vc.specalArr = arr2 // vc.delegate = self
vc.jieTiArr = arr // self.navigationController?.pushViewController(vc, animated: true)
if selectIdx == nil { // }
vc.selectIdx = IndexPath(item: 0, section: 0) //
}else{ // func CreatNewSpecsViewControllerDeleteAction() {
vc.selectIdx = selectIdx // print("删除数据")
} // }
print(vc.selectIdx?.item) // func AddGuiGeCellClick(cell: AddGuiGeCell) {
vc.delegate = self // //
self.navigationController?.pushViewController(vc, animated: true) // print("商品详情添加图片")
} // }
// @objc func addGuiGe(){
func CreatNewSpecsViewControllerDeleteAction() { // print("新增规格")
print("删除数据") // let vc = CreatNewSpecsViewController()
} // vc.barTitle = "新增规格"
func AddGuiGeCellClick(cell: AddGuiGeCell) { // vc.delegate = self
// // print("abc == ",isYuShou)
print("商品详情添加图片") // vc.isYuShouSetting = isYuShou
} // vc.isNonYuShou = isYuShou
@objc func addGuiGe(){ // vc.datasArr = guiGeArr
print("新增规格") // self.navigationController?.pushViewController(vc, animated: true)
let vc = CreatNewSpecsViewController() // }
vc.barTitle = "新增规格" // @objc func addImageAction(sender:UIButton){
vc.delegate = self // print(sender.tag)
print("abc == ",isYuShou) // }
vc.isYuShouSetting = isYuShou //
vc.isNonYuShou = isYuShou // func CreatNewSpecsViewControllerSaveAction(datas: NSMutableArray) {
vc.datasArr = guiGeArr // guiGeArr = datas
self.navigationController?.pushViewController(vc, animated: true) // listTbv.reloadData()
} // }
@objc func addImageAction(sender:UIButton){ //
print(sender.tag) // //MARK: - COLLECTIONVIEW DELEGATE
} // func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
// return 0
func CreatNewSpecsViewControllerSaveAction(datas: NSMutableArray) { // }
guiGeArr = datas // func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
listTbv.reloadData() // return guiGeArr.count
} // }
//
//MARK: - COLLECTIONVIEW DELEGATE // func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { // let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath)
return 0 // as! ItemCell
} // cell.tag = indexPath.row
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { // if selectIdx == nil {
return guiGeArr.count // selectIdx = IndexPath(item: 0, section: 0)
} // }
// if indexPath == selectIdx {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { // cell.nameLbl.textColor = UIColor(named: "蓝色字体颜色")
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath) // cell.lineView.isHidden = false
as! ItemCell // }else{
cell.tag = indexPath.row // cell.nameLbl.textColor = UIColor(named: "标题字颜色")
if selectIdx == nil { // cell.lineView.isHidden = true
selectIdx = IndexPath(item: 0, section: 0) // }
} // return cell
if indexPath == selectIdx { //
cell.nameLbl.textColor = UIColor(named: "蓝色字体颜色") // }
cell.lineView.isHidden = false // func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
}else{ // selectIdx = indexPath
cell.nameLbl.textColor = UIColor(named: "标题字颜色") // //刷新cell
cell.lineView.isHidden = true // print("selectItem",selectIdx?.item)
} // listTbv.reloadData()
return cell // collectionView.reloadData()
// }
} //}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIdx = indexPath
//刷新cell
print("selectItem",selectIdx?.item)
listTbv.reloadData()
collectionView.reloadData()
}
}
...@@ -10,9 +10,8 @@ import UIKit ...@@ -10,9 +10,8 @@ import UIKit
import LGButton import LGButton
import Photos import Photos
class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate,TitleAndTFCellDelegate{ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate,TitleAndTFCellDelegate,YuShouWeiKuanFaHuoCellDelegate{
let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"] let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"] let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
let tishixxArr:NSMutableArray = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"] let tishixxArr:NSMutableArray = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"]
...@@ -23,7 +22,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -23,7 +22,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let ysszHolder = ["0","请选择时段","请选择时段","0"] let ysszHolder = ["0","请选择时段","请选择时段","0"]
var shangPinStatusArr = ["热销","爆款","新品","促销","外采","团购"] var shangPinStatusArr = ["热销","爆款","新品","促销","外采","团购"]
var yunShuTypeArr = ["冷链","常温","热链"] var yunShuTypeArr = ["冷链","常温","热链"]
var countryArr = ["中国"]
var layout = UICollectionViewFlowLayout() var layout = UICollectionViewFlowLayout()
var glSelectView:GLAlertSelectView? var glSelectView:GLAlertSelectView?
...@@ -35,31 +34,34 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -35,31 +34,34 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
var isYuShou:Bool = false//是否预售 var isYuShou:Bool = false//是否预售
var shangPinStatus:Int?//商品状态 var shangPinStatus:Int?//商品状态
var yunShuType:Int?//运输类型 var yunShuType:Int?//运输类型
var maxFiveImgsArr = NSMutableArray()//多图 var maxFiveImgsArr:Array<UIImage> = []//多图
var singleImgArr = NSMutableArray()//单张图 var singleImgArr:Array<UIImage> = []//单张图
var itemName = ""//商品名称 var itemName = ""//商品名称
var qiMaiShuLiang = ""//起卖数量 var qiMaiShuLiang = ""//起卖数量
var shiFouQZ = false//是否清真 var shiFouQZ = false//是否清真
var shiFouXJ = false//是否询价 var shiFouXJ = false//是否询价
var keyWord = ""//关键字 var keyWord = ""//关键字
var wuLiuPrice = ""//物流费用 var wuLiuPrice = ""//物流费用
var guiGeArr:NSMutableArray = []//规格数组,根据规格资料数量控制右上角新增按钮是否显示 var countrySelect:Int?//选择国家
var guiGeArr:Array<GuiGeModel> = []//规格数组,根据规格资料数量控制右上角新增按钮是否显示
var shiFouSH = false //是否审核
var faHuoTime = ""//发货时间
//MARK:--保存按钮 //MARK:--保存按钮
@IBAction func submitAction(_ sender: Any) { @IBAction func submitAction(_ sender: Any) {
print("保存按钮submitAction") print("保存按钮submitAction")
print(itemName)//商品名称 // print(itemName)//商品名称
print(itemTypeArr)//商品类型 // print(itemTypeArr)//商品类型
print(qiMaiShuLiang)//起卖数量 // print(qiMaiShuLiang)//起卖数量
print(shiFouQZ)//是否清真 // print(shiFouQZ)//是否清真
print(shiFouXJ)//是否询价 // print(shiFouXJ)//是否询价
print(singleImgArr.firstObject)//商品封面图 // print(singleImgArr[0])//商品封面图
print(maxFiveImgsArr)//商品主图 // print(maxFiveImgsArr)//商品主图
print(guiGeArr)//商品规格 // print(guiGeArr)//商品规格
print(keyWord)//关键字 // print(keyWord)//关键字
print(wuLiuPrice)//物流费用 // print(wuLiuPrice)//物流费用
print(shangPinStatusArr[shangPinStatus!])//商品状态 // print(shangPinStatusArr[shangPinStatus!])//商品状态
print(yunShuTypeArr[yunShuType!])//运输方式 // print(yunShuTypeArr[yunShuType!])//运输方式
// print(countryArr[countrySelect!])//选择国家
} }
@IBOutlet weak var submitBtn: LGButton! @IBOutlet weak var submitBtn: LGButton!
@IBOutlet weak var listTbv: UITableView! @IBOutlet weak var listTbv: UITableView!
...@@ -80,7 +82,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -80,7 +82,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
//是否为预售商品 //是否为预售商品
isYuShouShangPin = false isYuShouShangPin = true
navbar.title = "商品详情" navbar.title = "商品详情"
self.view.addSubview(navbar) self.view.addSubview(navbar)
...@@ -107,22 +109,42 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -107,22 +109,42 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if indexPath.row == 0 || indexPath.row == 4 { if indexPath.row == 0 || indexPath.row == 4 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = spxxArr[indexPath.row] cell.nameLbl.text = spxxArr[indexPath.row]
//商家名称
switch cell.nameLbl.text {
case "商家名称":
cell.textTF.text = itemName
break
case "起卖数量":
cell.textTF.text = qiMaiShuLiang
break
default:
break
}
cell.textTF.placeholder = tishixxArr[indexPath.row] as! String cell.textTF.placeholder = tishixxArr[indexPath.row] as! String
cell.delegate = self cell.delegate = self
return cell return cell
} }
if indexPath.row > 4{ if indexPath.row > 4{
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
cell.delegate = self
cell.namelbl.text = spxxArr[indexPath.row] cell.namelbl.text = spxxArr[indexPath.row]
cell.delegate = self
switch cell.namelbl.text {
case "是否清真":
cell.infoSw.isOn = shiFouQZ
break
case "是否询价":
cell.infoSw.isOn = shiFouXJ
break
default:
break
}
return cell return cell
} }
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = spxxArr[indexPath.row] cell.nameLbl.text = spxxArr[indexPath.row]
cell.contentLbl.text = tishixxArr[indexPath.row] as! String cell.contentLbl.text = tishixxArr[indexPath.row] as! String
cell.tag = indexPath.row cell.tag = indexPath.row
cell.delegate = self cell.delegate = self
return cell return cell
case 1: case 1:
...@@ -130,10 +152,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -130,10 +152,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
cell.nameLbl.text = sptpArr[indexPath.row] cell.nameLbl.text = sptpArr[indexPath.row]
if indexPath.row == 0 { if indexPath.row == 0 {
cell.isSingle = true cell.isSingle = true
cell.imgs = singleImgArr if singleImgArr.count > 0{
cell.imgs = singleImgArr
cell.addBtn.isHidden = true
}else{
cell.scrollView?.isHidden = true
cell.addBtn.isHidden = false
}
}else{ }else{
cell.isSingle = false cell.isSingle = false
cell.imgs = maxFiveImgsArr if maxFiveImgsArr.count > 0{
cell.imgs = maxFiveImgsArr
}else{
cell.scrollView?.isHidden = true
cell.addBtnX.constant = 15
}
} }
cell.delegate = self cell.delegate = self
cell.addBtn.tag = indexPath.row cell.addBtn.tag = indexPath.row
...@@ -143,18 +176,19 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -143,18 +176,19 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if guiGeArr.count > 0 { if guiGeArr.count > 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell
cell.delegate = self cell.delegate = self
var dict:NSDictionary! var dict:GuiGeModel!
if selectIdx != nil{ if selectIdx != nil{
dict = guiGeArr[selectIdx!.item] as! NSDictionary dict = guiGeArr[selectIdx!.item] as! GuiGeModel
}else{ }else{
dict = guiGeArr.firstObject as! NSDictionary
dict = guiGeArr.first as! GuiGeModel
} }
cell.tempLbl.text = "冷藏:\(String(describing: dict["wenDu"]!))℃" cell.tempLbl.text = "冷藏:\(dict.wenDu)℃"
cell.weightLbl.text = "重量(kg):\(String(describing: dict["weight"]!))kg" cell.weightLbl.text = "重量(kg):\(dict.weight)kg"
cell.guiGeLbl.text = "规格:\(String(describing: dict["guiGe"]!))kg/件" cell.guiGeLbl.text = "规格:\(dict.guiGe)kg/件"
cell.danWeiLbl.text = "单位:\(String(describing: dict["danWei"]!))" cell.danWeiLbl.text = "单位:\(dict.danWei)"
cell.sellPriceLbl.text = "售价:¥\(dict["price"]!)" cell.sellPriceLbl.text = "售价:¥\(dict.price)"
return cell return cell
} }
...@@ -168,13 +202,15 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -168,13 +202,15 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
cell.namelbl.text = ysszArr[indexPath.row] cell.namelbl.text = ysszArr[indexPath.row]
cell.delegate = self cell.delegate = self
cell.infoSw.isOn = shiFouSH
return cell return cell
} }
if indexPath.row == 3 { if indexPath.row == 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell
cell.nameLbl.text = ysszArr[indexPath.row] cell.nameLbl.text = ysszArr[indexPath.row]
cell.textTF.keyboardType = .numberPad cell.textTF.keyboardType = .numberPad
cell.delegate = self
cell.textTF.text = faHuoTime
return cell return cell
} }
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
...@@ -186,6 +222,16 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -186,6 +222,16 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if indexPath.row < 2 { if indexPath.row < 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = qtxxArr[indexPath.row] cell.nameLbl.text = qtxxArr[indexPath.row]
switch cell.nameLbl.text {
case "关键字":
cell.textTF.text = keyWord
break
case "物流费用":
cell.textTF.text = wuLiuPrice
break
default:
break
}
cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String
cell.tag = indexPath.row cell.tag = indexPath.row
cell.delegate = self cell.delegate = self
...@@ -213,9 +259,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -213,9 +259,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
//MARK: - 底部广告软文跳转 //MARK: - 底部广告软文跳转
func AddGuiGeCellClick(cell: AddGuiGeCell) { func AddGuiGeCellClick(cell: AddGuiGeCell) {
print("底部广告软文跳转") print("底部广告软文跳转")
} }
//MARK: -- 点击按钮事件,跳转或者展示选择界面 //MARK: -- 点击按钮事件,跳转或者展示选择界面
func btnClick(content: String, cell: TitleAndBtnCell) { func btnClick(content: String, cell: TitleAndBtnCell) {
if cell.nameLbl.text == "商品类型" { if cell.nameLbl.text == "商品类型" {
...@@ -250,7 +296,18 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -250,7 +296,18 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
if cell.nameLbl.text == "国家" { if cell.nameLbl.text == "国家" {
print("选择国家") if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择国家"
view.delegate = self
view.dataArr = countryArr
if countrySelect != nil {
view.selectNum = countrySelect!
}
self.view.addSubview(view)
glSelectView = view
}
} }
if cell.nameLbl.text == "商品状态" { if cell.nameLbl.text == "商品状态" {
let view = GLAlertSelectView(frame: self.view.bounds) let view = GLAlertSelectView(frame: self.view.bounds)
...@@ -294,45 +351,84 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -294,45 +351,84 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
//MARK:--图片选择处理 //MARK:--图片选择处理
func AddImgCellBtnClick(cell: AddImgCell) { func AddImgCellBtnClick(cell: AddImgCell) {
if cell.addBtn.tag == 0 {//仅一张 if cell.addBtn.tag == 0 {//仅一张
_ = self.presentHGImagePicker(maxSelected:1) { (assets) in _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
//结果处理 //结果处理
print("共选择了\(assets.count)张图片,分别如下:") print("共选择了\(assets.count)张图片,分别如下:")
let option = PHImageRequestOptions() let option = PHImageRequestOptions()
option.isSynchronous = true option.isSynchronous = true
option.isNetworkAccessAllowed = true option.isNetworkAccessAllowed = true
for asset in assets { for asset in assets {
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// print("上传图片==\(image)") // print("上传图片==\(image)")
self.singleImgArr.add(image) self.singleImgArr.append(image!)
}) })
} }
cell.imgs = self.singleImgArr self.listTbv.reloadData()
} }
}else{//可多张 }else{//可多张
_ = self.presentHGImagePicker(maxSelected:5) { (assets) in let num = 5 - maxFiveImgsArr.count
//结果处理 _ = self.presentHGImagePicker(maxSelected:num) { (assets) in
print("共选择了\(assets.count)张图片,分别如下:") //结果处理
let option = PHImageRequestOptions() print("共选择了\(assets.count)张图片,分别如下:")
option.isSynchronous = true let option = PHImageRequestOptions()
option.isNetworkAccessAllowed = true option.isSynchronous = true
for asset in assets { option.isNetworkAccessAllowed = true
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in for asset in assets {
// print("上传图片==\(image)") PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
self.maxFiveImgsArr.add(image) // print("上传图片==\(image)")
}) self.maxFiveImgsArr.append(image!)
} })
cell.imgs = self.maxFiveImgsArr }
} self.listTbv.reloadData()
} }
} }
}
//MARK: - 修改图片
func ChangeCellBtnClick(sender: UIButton, cell: AddImgCell) {
print(sender.tag)
if cell.addBtn.tag == 0 {//仅一张
_ = self.presentHGImagePicker(maxSelected:1) { (assets) in
//结果处理
print("共选择了\(assets.count)张图片,分别如下:")
let option = PHImageRequestOptions()
option.isSynchronous = true
option.isNetworkAccessAllowed = true
for asset in assets {
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// print("上传图片==\(image)")
self.singleImgArr.removeAll()
self.singleImgArr.append(image!)
})
}
self.listTbv.reloadData()
}
}else{//可多张
let num = 5 - maxFiveImgsArr.count
_ = self.presentHGImagePicker(maxSelected:num) { (assets) in
//结果处理
print("共选择了\(assets.count)张图片,分别如下:")
let option = PHImageRequestOptions()
option.isSynchronous = true
option.isNetworkAccessAllowed = true
for asset in assets {
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// print("上传图片==\(image)")
self.maxFiveImgsArr.insert(image!, at: sender.tag)
self.maxFiveImgsArr.remove(at: sender.tag+1)
})
}
self.listTbv.reloadData()
}
}
}
//MARK: - 删除图片处理 //MARK: - 删除图片处理
func DelImgCellBtnClick(sender: UIButton, cell: AddImgCell) { func DelImgCellBtnClick(sender:UIButton, cell: AddImgCell) {
if cell.isSingle == true { if cell.isSingle == true {
singleImgArr.removeObject(at: sender.tag) singleImgArr.remove(at:sender.tag)
listTbv.reloadData() listTbv.reloadData()
}else{ }else{
maxFiveImgsArr.removeObject(at: sender.tag) maxFiveImgsArr.remove(at:sender.tag)
listTbv.reloadData() listTbv.reloadData()
} }
} }
...@@ -413,25 +509,23 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -413,25 +509,23 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let vc = CreatNewSpecsViewController() let vc = CreatNewSpecsViewController()
vc.barTitle = "编辑规格" vc.barTitle = "编辑规格"
vc.datasArr = guiGeArr vc.datasArr = guiGeArr
let dataDict:NSDictionary! let dataDict:GuiGeModel!
if selectIdx?.item != nil { if selectIdx?.item != nil {
dataDict = guiGeArr[selectIdx!.item] as! NSDictionary dataDict = guiGeArr[selectIdx!.item]
}else{ }else{
dataDict = guiGeArr.firstObject as! NSDictionary dataDict = guiGeArr.first
} }
vc.price = dataDict["price"] as! String vc.price = dataDict.price
vc.guiGe = dataDict["guiGe"] as! String vc.guiGe = dataDict.guiGe
vc.weight = dataDict["weight"] as! String vc.weight = dataDict.weight
vc.wenDu = dataDict["wenDu"] as! String vc.wenDu = dataDict.wenDu
vc.danWei = dataDict["danWei"] as! String vc.danWei = dataDict.danWei
let arr = dataDict["jieTiArr"] as! NSMutableArray vc.isNonYuShou = dataDict.isNonYuShou
let arr2 = dataDict["specalArr"] as! NSMutableArray vc.isYuShouSetting = dataDict.isYuShouSetting
vc.isNonYuShou = dataDict["isNonYuShou"] as! Bool vc.yuShouPrice = dataDict.yuShouPrice
vc.isYuShouSetting = dataDict["isYuShouSetting"] as! Bool vc.specalArr = dataDict.specalArr
vc.yuShouPrice = dataDict["yuShouPrice"] as! String vc.jieTiArr = dataDict.jieTiArr
vc.specalArr = arr2
vc.jieTiArr = arr
if selectIdx == nil { if selectIdx == nil {
vc.selectIdx = IndexPath(item: 0, section: 0) vc.selectIdx = IndexPath(item: 0, section: 0)
}else{ }else{
...@@ -445,7 +539,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -445,7 +539,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
func CreatNewSpecsViewControllerDeleteAction() { func CreatNewSpecsViewControllerDeleteAction() {
print("删除数据") print("删除数据")
} }
//MARK: - 新增规格 //MARK: - 新增规格
@objc func addGuiGe(){ @objc func addGuiGe(){
print("新增规格") print("新增规格")
...@@ -457,9 +551,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -457,9 +551,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
vc.datasArr = guiGeArr vc.datasArr = guiGeArr
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
//MARK: - 新增、编辑规格 //MARK: - 新增、编辑规格
func CreatNewSpecsViewControllerSaveAction(datas: NSMutableArray) { func CreatNewSpecsViewControllerSaveAction(datas: Array<GuiGeModel>) {
guiGeArr = datas guiGeArr = datas
listTbv.reloadData() listTbv.reloadData()
} }
...@@ -503,37 +597,40 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -503,37 +597,40 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
case "是否询价": case "是否询价":
shiFouXJ = content.isOn shiFouXJ = content.isOn
break break
case "用户付款是否需要审核":
shiFouSH = content.isOn
break
default: default:
break break
} }
} }
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
return 6 return 6
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section { switch section {
case 0: return 7 case 0: return 7
case 1:return 2 case 1:return 2
case 2:return 1 case 2:return 1
case 3:return 4 case 3:return 4
case 4:return 5 case 4:return 5
default:return 1 default:return 1
} }
} }
//MARK: - tableview footer //MARK: - tableview footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10)) let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10))
view.backgroundColor = UIColor(named: "app底色") view.backgroundColor = UIColor(named: "app底色")
return view return view
} }
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == 3 { if section == 3 {
if isYuShouShangPin == false { if isYuShouShangPin == false {
return 0.001 return 0.001
} }
} }
return 10 return 10
} }
//MARK: - tableview header //MARK: - tableview header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 3 { if section == 3 {
...@@ -624,7 +721,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -624,7 +721,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
} }
func YuShouWeiKuanFaHuoCellString(str: String) {
faHuoTime = str
print(faHuoTime)
}
override func backAction() { override func backAction() {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import UIKit import UIKit
import LGButton import LGButton
protocol CreatNewSpecsViewControllerDelegate { protocol CreatNewSpecsViewControllerDelegate {
func CreatNewSpecsViewControllerSaveAction(datas:NSMutableArray) func CreatNewSpecsViewControllerSaveAction(datas:Array<GuiGeModel>)
func CreatNewSpecsViewControllerDeleteAction() func CreatNewSpecsViewControllerDeleteAction()
} }
class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndTFCellDelegate,TitleAndBtnCellDelegate,TitleAndSwitchCellDelegate,TitleAndSwitchHeaderViewDelegate,NewCreateHeaderDelegate,NewCreateFooterDelegate,YuShouCellDelegate,GLAlertSelectViewDelegate,PuTongJieTiCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndTFCellDelegate,TitleAndBtnCellDelegate,TitleAndSwitchCellDelegate,TitleAndSwitchHeaderViewDelegate,NewCreateHeaderDelegate,NewCreateFooterDelegate,YuShouCellDelegate,GLAlertSelectViewDelegate,PuTongJieTiCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{
...@@ -19,9 +19,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -19,9 +19,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
var delegate:CreatNewSpecsViewControllerDelegate? var delegate:CreatNewSpecsViewControllerDelegate?
var collectView:UICollectionView? var collectView:UICollectionView?
var datasArr:NSMutableArray = [] var datasArr:Array<GuiGeModel> = []
var dataDict:NSDictionary? var dataModel = GuiGeModel()
let titleArray = ["售价:","规格:","重量:","温藏:","单位:"] let titleArray = ["售价:","规格:","重量:","温藏:","单位:"]
let pliceHolderArr = ["请输入商品售价","请输入商品规格","请输入商品重量","请选择商品温藏","请选择商品单位"] let pliceHolderArr = ["请输入商品售价","请输入商品规格","请输入商品重量","请选择商品温藏","请选择商品单位"]
@IBOutlet weak var bottomBtn: LGButton! @IBOutlet weak var bottomBtn: LGButton!
...@@ -68,16 +67,16 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -68,16 +67,16 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
danWei = newValue danWei = newValue
} }
}//规格 }//规格
var specalArr:NSMutableArray = []{ var specalArr:Array<Any> = []{
willSet{ willSet{
specalArr.removeAllObjects() specalArr.removeAll()
specalArr = newValue specalArr = newValue
} }
}//预售 }//预售
var jieTiArr:NSMutableArray = []{ var jieTiArr:Array<Any> = []{
willSet{ willSet{
jieTiArr.removeAllObjects() jieTiArr.removeAll()
jieTiArr = newValue jieTiArr = newValue
} }
...@@ -186,24 +185,26 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -186,24 +185,26 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
// } // }
// } // }
let dict = NSMutableDictionary() // let dict = NSMutableDictionary()
dict["price"] = price dataModel.price = price
dict["guiGe"] = guiGe dataModel.guiGe = guiGe
dict["weight"] = weight dataModel.weight = weight
dict["wenDu"] = wenDu dataModel.wenDu = wenDu
dict["danWei"] = danWei dataModel.danWei = danWei
dict["jieTiArr"] = jieTiArr dataModel.jieTiArr = jieTiArr as! Array<Any>
dict["specalArr"] = specalArr dataModel.specalArr = specalArr as! Array<Any>
dict["itemIdx"] = datasArr.count dataModel.isNonYuShou = isNonYuShou
dict["isNonYuShou"] = isNonYuShou dataModel.isYuShouSetting = isYuShouSetting
dict["isYuShouSetting"] = isYuShouSetting dataModel.yuShouPrice = yuShouPrice
dict["yuShouPrice"] = yuShouPrice
if barTitle?.contains("编辑") == true { if barTitle?.contains("编辑") == true {
datasArr.replaceObject(at: selectIdx!.item, with: dict) // datasArr.replaceObject(at: selectIdx!.item, with: dict)
datasArr.insert(dataModel, at: selectIdx!.item)
datasArr.remove(at: selectIdx!.item+1)
}else{ }else{
datasArr.add(dict) datasArr.append(dataModel)
} }
delegate?.CreatNewSpecsViewControllerSaveAction(datas: datasArr) delegate?.CreatNewSpecsViewControllerSaveAction(datas:datasArr)
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
//MARK: - cell delegate //MARK: - cell delegate
...@@ -529,29 +530,33 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -529,29 +530,33 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
} }
func footerClickAction() { func footerClickAction() {
print(jieTiArr)
if selectYuShou {//预售 if selectYuShou {//预售
specalArr.add("") specalArr.append("")
}else{//非预售 }else{//非预售
jieTiArr.add("") jieTiArr.append("")
} }
listTbv.reloadData() listTbv.reloadData()
} }
func YuShouCellSwitchStatus(sender: UISwitch) { func YuShouCellSwitchStatus(sender: UISwitch) {
//控制 //控制
print("status3 = \(isYuShouSetting) , \(isJieTiJiaSetting)")
isYuShouSetting = sender.isOn isYuShouSetting = sender.isOn
listTbv.reloadData() listTbv.reloadData()
} }
func PuTongJieTiDelAction(sender: UIButton) { func PuTongJieTiDelAction(sender: PuTongJieTiCell) {
jieTiArr.removeObject(at: sender.tag) jieTiArr.remove(at: sender.tag)
print(jieTiArr) print(jieTiArr,sender.tag)
listTbv.reloadData() listTbv.reloadData()
} }
func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) { func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) {
if selectYuShou { if selectYuShou {
specalArr.replaceObject(at: cell.tag, with: "\(price)_\(count)") specalArr.insert("\(price)_\(count)", at: cell.tag)
print(specalArr)
specalArr.remove(at: cell.tag+1)
}else{ }else{
jieTiArr.replaceObject(at: cell.tag, with: "\(price)_\(count)") jieTiArr.insert("\(price)_\(count)", at: cell.tag)
print(jieTiArr)
jieTiArr.remove(at: cell.tag+1)
} }
} }
...@@ -589,19 +594,17 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -589,19 +594,17 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIdx = indexPath selectIdx = indexPath
//刷新cell //刷新cell
let dataDict = datasArr[selectIdx!.item] as! NSDictionary let dataDict = datasArr[selectIdx!.item]
price = dataDict["price"] as! String price = dataDict.price
guiGe = dataDict["guiGe"] as! String guiGe = dataDict.guiGe
weight = dataDict["weight"] as! String weight = dataDict.weight
wenDu = dataDict["wenDu"] as! String wenDu = dataDict.wenDu
danWei = dataDict["danWei"] as! String danWei = dataDict.danWei
let arr = dataDict["jieTiArr"] as! NSMutableArray isNonYuShou = dataDict.isNonYuShou
let arr2 = dataDict["specalArr"] as! NSMutableArray isYuShouSetting = dataDict.isYuShouSetting
isNonYuShou = dataDict["isNonYuShou"] as! Bool yuShouPrice = dataDict.yuShouPrice
isYuShouSetting = dataDict["isYuShouSetting"] as! Bool specalArr = dataDict.specalArr
yuShouPrice = dataDict["yuShouPrice"] as! String jieTiArr = dataDict.jieTiArr
specalArr = arr2
jieTiArr = arr
listTbv.reloadData() listTbv.reloadData()
collectionView.reloadData() collectionView.reloadData()
} }
......
//
// GuiGeModel.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/5/15.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
class GuiGeModel: NSObject {
///售价
var price : String = ""
///规格
var guiGe : String = ""
///重量
var weight : String = ""
///温度
var wenDu : String = ""
///单位
var danWei : String = ""
///是否预售
var isNonYuShou : Bool = false
///是否打开预售设置
var isYuShouSetting : Bool = false
///预售价格
var yuShouPrice : String = ""
///普通阶梯价
var jieTiArr : Array<Any> = []
///预售阶梯价
var specalArr : Array<Any> = []
}
...@@ -8,16 +8,15 @@ ...@@ -8,16 +8,15 @@
import UIKit import UIKit
@objc protocol PuTongJieTiCellDelegate { @objc protocol PuTongJieTiCellDelegate {
@objc optional func PuTongJieTiDelAction(sender:UIButton) @objc optional func PuTongJieTiDelAction(sender:PuTongJieTiCell)
@objc optional func PuTongJieTiContent(price:String,count:String,cell:PuTongJieTiCell) @objc optional func PuTongJieTiContent(price:String,count:String,cell:PuTongJieTiCell)
} }
class PuTongJieTiCell: UITableViewCell { class PuTongJieTiCell: UITableViewCell {
var delegate:PuTongJieTiCellDelegate? var delegate:PuTongJieTiCellDelegate?
@IBAction func delAction(_ sender: UIButton) { @IBAction func delAction(_ sender: UIButton) {
delegate?.PuTongJieTiDelAction?(sender: sender) delegate?.PuTongJieTiDelAction?(sender: self)
} }
@IBOutlet weak var priceTF: UITextField! @IBOutlet weak var priceTF: UITextField!
@IBOutlet weak var countTF: UITextField! @IBOutlet weak var countTF: UITextField!
@IBOutlet weak var titleLbl: UILabel! @IBOutlet weak var titleLbl: UILabel!
......
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
<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>
<namedColor name="标题字颜色"> <namedColor name="标题字颜色">
<color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<namedColor name="灰色分界线"> <namedColor name="灰色分界线">
<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"/>
......
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