diff --git a/GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate b/GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate index d79a958e641e509194efb3e3abb47f86de9e467c..392fd559ab08c913c1299069398cefaeb5f3de1a 100644 Binary files a/GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate and b/GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index ca0bec393fe86d49b42a2ea2b2f7f4bc8b9d7c5b..0abdde61329e1dffa5497c1e710604cd493c1863 100644 --- a/GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -24,21 +24,5 @@ continueAfterRunningActions = "No"> </BreakpointContent> </BreakpointProxy> - <BreakpointProxy - BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> - <BreakpointContent - uuid = "B223F50A-4F5B-423B-9F6D-A967E5BFB36E" - shouldBeEnabled = "No" - ignoreCount = "0" - continueAfterRunningActions = "No" - filePath = "GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift" - startingColumnNumber = "9223372036854775807" - endingColumnNumber = "9223372036854775807" - startingLineNumber = "575" - endingLineNumber = "575" - landmarkName = "YuShouCellSwitchStatus(sender:)" - landmarkType = "7"> - </BreakpointContent> - </BreakpointProxy> </Breakpoints> </Bucket> diff --git a/GeliBusinessPlatform/Model/GoodsManageMoel/GoodsDetailModel.swift b/GeliBusinessPlatform/Model/GoodsManageMoel/GoodsDetailModel.swift index 47b9e6793a6a735b5e4b62d0341e64ac4601ae4a..7c64a38534b708cf6c9e43b8f54e8e8f5a8eb4ce 100644 --- a/GeliBusinessPlatform/Model/GoodsManageMoel/GoodsDetailModel.swift +++ b/GeliBusinessPlatform/Model/GoodsManageMoel/GoodsDetailModel.swift @@ -25,14 +25,18 @@ class GoodsDetailModel: Mappable { } class GoodsDetailDataModel: Mappable { - var goods_res : Array<GoodsDetailGoodsResModel>? //商哿•°æ® - + var goods_res : GoodsDetailGoodsResModel? //商哿•°æ® + var sku_res : Array<GoodsDetailSkuResModel>? //商å“skuä¿¡æ¯ + var banner_res : Array<GoodsDetailBannerResModel>? //å‰¯å›¾ä¿¡æ¯ + required init?( map: Map) { } func mapping(map: Map) { goods_res <- map["goods_res"] - + sku_res <- map["sku_res"] + banner_res <- map["banner_res"] + } } @@ -40,7 +44,9 @@ class GoodsDetailGoodsResModel: Mappable { var goods_id : Int? //商å“id var goods_name : String? //商å“å var cat_id : Int? //分类id + var cat_name : String? //分类å var brand_id : Int? //å“牌id + var brand_name : String? //å“牌å var goods_sn : String? //商å“sn var market_price : String? //市场价 var shop_price : String? //(默认)售价(本店售价) @@ -106,6 +112,8 @@ class GoodsDetailGoodsResModel: Mappable { set_time <- map["set_time"] is_inquiry <- map["is_inquiry"] is_qz <- map["is_qz"] + brand_name <- map["brand_name"] + cat_name <- map["cat_name"] } diff --git "a/GeliBusinessPlatform/ViewController/\345\225\206\345\223\201\350\257\246\346\203\205/EPViewController.swift" "b/GeliBusinessPlatform/ViewController/\345\225\206\345\223\201\350\257\246\346\203\205/EPViewController.swift" index 54b8758c5180be8a595c91d5af94ca2e2fa9e448..b6da34d7a447a60db322193f487397ed94b583cc 100644 --- "a/GeliBusinessPlatform/ViewController/\345\225\206\345\223\201\350\257\246\346\203\205/EPViewController.swift" +++ "b/GeliBusinessPlatform/ViewController/\345\225\206\345\223\201\350\257\246\346\203\205/EPViewController.swift" @@ -13,7 +13,7 @@ import IQKeyboardManagerSwift import Dollar class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate,TitleAndTFCellDelegate,YuShouWeiKuanFaHuoCellDelegate,UITextFieldDelegate,ShowTimeSelectViewDelegate { - + @IBOutlet weak var btmBtnViewH: NSLayoutConstraint! @IBOutlet weak var tbvBGView: UIView! @IBOutlet weak var btmBtnBGView: UIView! @@ -23,1008 +23,1078 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo var goods_id:Int? func GLASClose(view: GLAlertSelectView, selectnum: Int, selectArr: Array<Int>) { - if view.titleLbl.text == "请选择商å“类型" { - print(itemTypeArr,selectArr) - itemTypeArr = selectArr - } - if selectnum != 10086 { - if view.titleLbl.text == "请选择国家" { - print(itemTypeArr,selectArr) - countrySelect = selectnum - } - if view.titleLbl.text == "请选择è¿è¾“æ–¹å¼" { - yunShuType = selectnum - } - if view.titleLbl.text == "请选择商å“状æ€" { - shangPinStatus = selectnum - } - } - view.removeFromSuperview() - glSelectView = nil - } + if view.titleLbl.text == "请选择商å“类型" { + print(itemTypeArr,selectArr) + itemTypeArr = selectArr + } + if selectnum != 10086 { + if view.titleLbl.text == "请选择国家" { + print(itemTypeArr,selectArr) + countrySelect = selectnum + } + if view.titleLbl.text == "请选择è¿è¾“æ–¹å¼" { + yunShuType = selectnum + } + if view.titleLbl.text == "请选择商å“状æ€" { + shangPinStatus = selectnum + } + } + view.removeFromSuperview() + glSelectView = nil + } + + let titleArr = ["商å“ä¿¡æ¯","商å“图片","商å“è§„æ ¼","预售设置","其它信æ¯","商å“详情"] + let spxxArr = ["商å“åç§°","商å“类型","商å“分类","å“牌","èµ·å–æ•°é‡","æ˜¯å¦æ¸…真","是å¦è¯¢ä»·"] + var tishixxArr = ["请输入商å“åç§°","请选择商å“类型","请选择商å“分类","请选择å“牌","è¯·è¾“å…¥èµ·å–æ•°é‡"] + var tishixxArr1 = ["请输入关键å—","请输入物æµè´¹ç”¨","请选择国家","请选择商å“状æ€","请选择è¿è¾“æ–¹å¼"] + let sptpArr = ["商å“å°é¢å›¾(é™ä¸€å¼ )","商å“主图(é™äº”å¼ )"] + let qtxxArr = ["关键å—","物æµè´¹ç”¨","国家","商å“状æ€","è¿è¾“æ–¹å¼"] + let ysszArr = ["用户付款是å¦éœ€è¦å®¡æ ¸","预设预付定金时间段","预设预付尾款时间段","预设预付尾款å‘è´§æ—¶é—´"] + var ysszHolder = ["0","请选择时段","请选择时段","0"] + var shangPinStatusArr:Array<GeneralInfoGsModel>? = [] + var yunShuTypeArr = ["冷链","常温","çƒé“¾"] + var countryArr = ["ä¸å›½"] + var layout = UICollectionViewFlowLayout() + + var glSelectView:GLAlertSelectView? - let titleArr = ["商å“ä¿¡æ¯","商å“图片","商å“è§„æ ¼","预售设置","其它信æ¯","商å“详情"] - let spxxArr = ["商å“åç§°","商å“类型","商å“分类","å“牌","èµ·å–æ•°é‡","æ˜¯å¦æ¸…真","是å¦è¯¢ä»·"] - var tishixxArr = ["请输入商å“åç§°","请选择商å“类型","请选择商å“分类","请选择å“牌","è¯·è¾“å…¥èµ·å–æ•°é‡"] - var tishixxArr1 = ["请输入关键å—","请输入物æµè´¹ç”¨","请选择国家","请选择商å“状æ€","请选择è¿è¾“æ–¹å¼"] - let sptpArr = ["商å“å°é¢å›¾(é™ä¸€å¼ )","商å“主图(é™äº”å¼ )"] - let qtxxArr = ["关键å—","物æµè´¹ç”¨","国家","商å“状æ€","è¿è¾“æ–¹å¼"] - let ysszArr = ["用户付款是å¦éœ€è¦å®¡æ ¸","预设预付定金时间段","预设预付尾款时间段","预设预付尾款å‘è´§æ—¶é—´"] - var ysszHolder = ["0","请选择时段","请选择时段","0"] - var shangPinStatusArr:Array<GeneralInfoGsModel>? = [] - var yunShuTypeArr = ["冷链","常温","çƒé“¾"] - var countryArr = ["ä¸å›½"] - var layout = UICollectionViewFlowLayout() - - var glSelectView:GLAlertSelectView? - - var selectIdx:IndexPath? = IndexPath(item: 0, section: 0) //å¤šè§„æ ¼çŠ¶æ€ä¸‹ç‚¹å‡»collectionCellçš„row记录 - - var isYuShouShangPin:Bool?//是å¦ä¸ºé¢„å”®å•†å“ - - var itemTypeArr:Array<Int>? = []//多选 - var isYuShou:Bool = false//是å¦é¢„å”® - var shangPinStatus:Int? = 0//商å“çŠ¶æ€ - var yunShuType:Int? = 0//è¿è¾“类型 - var maxFiveImgsArr:Array<UIImage> = []//多图 - var singleImgArr:Array<UIImage> = []//å•å¼ å›¾ - var itemName = ""//商å“åç§° - var qiMaiShuLiang = ""//èµ·å–æ•°é‡ - var shiFouQZ = false//æ˜¯å¦æ¸…真 - var shiFouXJ = false//是å¦è¯¢ä»· - var keyWord = ""//å…³é”®å— - var wuLiuPrice = ""//物æµè´¹ç”¨ - var countrySelect:Int?//选择国家 - var guiGeArr:Array<GuiGeModel> = []//è§„æ ¼æ•°ç»„,æ ¹æ®è§„æ ¼èµ„æ–™æ•°é‡æŽ§åˆ¶å³ä¸Šè§’æ–°å¢žæŒ‰é’®æ˜¯å¦æ˜¾ç¤º - var shiFouSH = false //是å¦å®¡æ ¸ - var faHuoTime = ""//å‘è´§æ—¶é—´ - //预售时间段 - var dj_time_start:Int? = 0 - var dj_time_end:Int? = 0 - var wk_time_start:Int? = 0 - var wk_time_end:Int? = 0 + var selectIdx:IndexPath? = IndexPath(item: 0, section: 0) //å¤šè§„æ ¼çŠ¶æ€ä¸‹ç‚¹å‡»collectionCellçš„row记录 - var listTbv:UITableView! - override func viewDidLoad() { - super.viewDidLoad() - //MARK:--èŽ·å–æ–°å¢žå•†å“的基本信æ¯ï¼ˆå“牌和分类ç‰ï¼‰ - HUD.flash(.progress) - - //MARK:--新增商å“å’Œç¼–è¾‘å•†å“æ‰€éœ€è¦çš„基本信æ¯ï¼ˆæ— )就页é¢ä¸æ£å¸¸æ˜¾ç¤º -// let UserToken = UserDefaults.standard.value(forKey: "user_token") -// GeneralInfo(["user_token":UserToken as Any], success: { (data) in -// HUD.hide(animated: true) -// self.generalInfoModel = (data as! GeneralInfoModel) -// self.shangPinStatusArr = (self.generalInfoModel?.data!.gs)! -// -// }) { (error) in -// -// } - //是å¦ä¸ºé¢„å”®å•†å“ - isYuShouShangPin = false - - navbar.title = "商å“详情" - self.view.addSubview(navbar) - if listTbv == nil { - let tbv = UITableView() - tbvBGView.addSubview(tbv) - tbv.snp.makeConstraints { (make) in - make.top.left.bottom.right.equalTo(0) + var isYuShouShangPin:Bool?//是å¦ä¸ºé¢„å”®å•†å“ + + var itemTypeArr:Array<Int>? = []//多选 + + var shangPinStatus:Int? = 0//商å“çŠ¶æ€ + var yunShuType:Int? = 0//è¿è¾“类型 + var maxFiveImgsArr:Array<UIImage> = []//多图 + var singleImgArr:Array<UIImage> = []//å•å¼ å›¾ + var itemName = ""//商å“åç§° + var qiMaiShuLiang = ""//èµ·å–æ•°é‡ + var shiFouQZ = false//æ˜¯å¦æ¸…真 + var shiFouXJ = false//是å¦è¯¢ä»· + var keyWord = ""//å…³é”®å— + var wuLiuPrice = ""//物æµè´¹ç”¨ + var countrySelect:Int?//选择国家 + var guiGeArr:Array<GuiGeModel> = []//è§„æ ¼æ•°ç»„,æ ¹æ®è§„æ ¼èµ„æ–™æ•°é‡æŽ§åˆ¶å³ä¸Šè§’æ–°å¢žæŒ‰é’®æ˜¯å¦æ˜¾ç¤º + var shiFouSH = false //是å¦å®¡æ ¸ + var faHuoTime = ""//å‘è´§æ—¶é—´ + //预售时间段 + var dj_time_start:Int? = 0 + var dj_time_end:Int? = 0 + var wk_time_start:Int? = 0 + var wk_time_end:Int? = 0 + + var listTbv:UITableView! + override func viewDidLoad() { + super.viewDidLoad() + //MARK:--èŽ·å–æ–°å¢žå•†å“的基本信æ¯ï¼ˆå“牌和分类ç‰ï¼‰ + HUD.flash(.progress) + + //是å¦ä¸ºé¢„å”®å•†å“ + isYuShouShangPin = false + + navbar.title = "商å“详情" + self.view.addSubview(navbar) + + //MARK:--新增商å“å’Œç¼–è¾‘å•†å“æ‰€éœ€è¦çš„基本信æ¯ï¼ˆæ— )就页é¢ä¸æ£å¸¸æ˜¾ç¤º + let UserToken = UserDefaults.standard.value(forKey: "user_token") + goodsDetail(["user_token":UserToken,"goods_id":goods_id], success: { (data) in + let model = data as! GoodsDetailModel + //商å“å + self.itemName = (model.data?.goods_res!.goods_name)! + //商å“类型 + if model.data?.goods_res!.is_adsale == 0{ + self.itemTypeArr = [99,99,99,99] + }else{ + self.itemTypeArr = [1,99,99,99] + } + if (model.data?.goods_res!.goods_type)! == 1 || (model.data?.goods_res!.goods_type)! == 2 { + self.itemTypeArr?.insert(1, at: 1) + self.itemTypeArr?.remove(at: 2) + }else{ + self.itemTypeArr?.insert((model.data?.goods_res!.goods_type)!, at: (model.data?.goods_res!.goods_type)!-1) + self.itemTypeArr?.remove(at: (model.data?.goods_res!.goods_type)!) + } + let contentArr = ["预售","普通","期货","团è´"] + let titles = NSMutableArray() + titles.removeAllObjects() + for num in self.itemTypeArr! { + if num != 99{ + titles.add(contentArr[num]) + } + } + if titles.componentsJoined(by: ",").contains("预售") { + self.isYuShouShangPin = true + }else{ + self.isYuShouShangPin = false + } + self.tishixxArr.insert(titles.componentsJoined(by: ","), at: 1) + self.tishixxArr.remove(at: 2) + //商å“分类 + print("abc == ",model.data?.goods_res!.cat_name) + self.tishixxArr.insert((model.data?.goods_res!.cat_name)!, at: 2) + self.tishixxArr.remove(at: 3) + //å“牌å + self.tishixxArr.insert((model.data?.goods_res!.brand_name)!, at: 3) + self.tishixxArr.remove(at: 4) + //èµ·å–æ•°é‡ + self.qiMaiShuLiang = "\(model.data!.goods_res!.origin_number!)" + //æ˜¯å¦æ¸…真 + self.shiFouQZ = true + if model.data?.goods_res!.is_qz == 0 { + self.shiFouQZ = false + } + //是å¦è¯¢ä»· + self.shiFouXJ = true + if model.data?.goods_res!.is_inquiry == 0 { + self.shiFouXJ = false } - listTbv = tbv + //æ˜¯å¦æœ‰å°é¢å›¾ + // if model.data?.goods_res?.original_img?.count > 0 { + // + // } + //商å“主图 + //商å“è§„æ ¼ + if (model.data?.sku_res?.count)! > 0{ + self.guiGeArr.removeAll() + for item in model.data!.sku_res! { + let dataSource = item as! GoodsDetailSkuResModel + let data = GuiGeModel() + data.DJBiLi = dataSource.pct! + data.danWei = dataSource.unit! + data.sku_id = dataSource.sku_id! + data.guiGe = dataSource.spec_str! + data.isOpenYSSetting = false + if dataSource.is_open_adsale! == 1 { + data.isOpenYSSetting = true + } + data.isJieTiOpen = false + if dataSource.is_tiered == 1 { + data.isJieTiOpen = true + } + + + + } + + } + + + + + if self.listTbv == nil { + let tbv = UITableView() + self.tbvBGView.addSubview(tbv) + tbv.snp.makeConstraints { (make) in + make.top.left.bottom.right.equalTo(0) + } + self.listTbv = tbv + self.listTbv.separatorStyle = .none + self.listTbv.delegate = self + self.listTbv.dataSource = self + self.listTbv.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF") + self.listTbv.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitch") + self.listTbv.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn") + self.listTbv.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImg") + self.listTbv.register(UINib(nibName: "AddGuiGeCell", bundle: nil), forCellReuseIdentifier: "AddGuiGe") + self.listTbv.register(UINib(nibName: "YuShouWeiKuanFaHuoCell", bundle: nil), forCellReuseIdentifier: "YuShouWeiKuanFaHuoCell") + self.listTbv.register(UINib(nibName: "ShangPinGguiGeCell", bundle: nil), forCellReuseIdentifier: "ShangPinGguiGeCell") + } + }) { (error) in + } - listTbv.separatorStyle = .none - listTbv.delegate = self - listTbv.dataSource = self SetTopFrameView(view: tbvBGView, btmView: btmBtnBGView) - - listTbv.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF") - listTbv.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitch") - listTbv.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn") - listTbv.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImg") - listTbv.register(UINib(nibName: "AddGuiGeCell", bundle: nil), forCellReuseIdentifier: "AddGuiGe") - listTbv.register(UINib(nibName: "YuShouWeiKuanFaHuoCell", bundle: nil), forCellReuseIdentifier: "YuShouWeiKuanFaHuoCell") - listTbv.register(UINib(nibName: "ShangPinGguiGeCell", bundle: nil), forCellReuseIdentifier: "ShangPinGguiGeCell") - // Do any additional setup after loading the view. - } - //MARK: - cell delegate - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - switch indexPath.section { - case 0: - if indexPath.row == 0 || indexPath.row == 4 { - let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell - cell.textTF.delegate = self - cell.nameLbl.text = spxxArr[indexPath.row] - //商家åç§° - switch cell.nameLbl.text { - case "商å“åç§°": - cell.textTF.text = itemName - cell.textTF.returnKeyType = .done - break - case "èµ·å–æ•°é‡": - cell.textTF.text = qiMaiShuLiang - cell.textTF.keyboardType = .numberPad - break - default: - break - } - - cell.textTF.placeholder = tishixxArr[indexPath.row] as! String - cell.delegate = self - return cell - } - if indexPath.row > 4{ - let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell - 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 - } - let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell - cell.nameLbl.text = spxxArr[indexPath.row] - cell.contentLbl.text = tishixxArr[indexPath.row] as! String - cell.tag = indexPath.row - cell.delegate = self - return cell - case 1: - let cell = tableView.dequeueReusableCell(withIdentifier: "AddImg") as! AddImgCell - cell.nameLbl.text = sptpArr[indexPath.row] - if indexPath.row == 0 { - cell.isSingle = true - if singleImgArr.count > 0{ - cell.imgs = singleImgArr - cell.addBtn.isHidden = true - }else{ - cell.scrollView?.isHidden = true - cell.addBtn.isHidden = false - } - }else{ - cell.isSingle = false - if maxFiveImgsArr.count > 0{ - cell.imgs = maxFiveImgsArr - }else{ - cell.scrollView?.isHidden = true - cell.addBtnX.constant = 15 - } - } - cell.delegate = self - cell.addBtn.tag = indexPath.row - cell.isEdit = true - return cell - case 2: - if guiGeArr.count > 0 { - let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell - cell.delegate = self - var dict:GuiGeModel! - if selectIdx != nil{ - print(selectIdx?.item) - dict = guiGeArr[selectIdx!.item] - }else{ - - dict = guiGeArr.first - } - - cell.tempLbl.text = "冷è—:\(dict.wenDu)℃" - cell.weightLbl.text = "é‡é‡ï¼ˆkg):\(dict.weight)kg" - cell.guiGeLbl.text = "è§„æ ¼ï¼š\(dict.guiGe)kg/ä»¶" - cell.danWeiLbl.text = "å•ä½ï¼š\(dict.danWei)" - cell.sellPriceLbl.text = "售价:¥\(dict.price)" - - return cell - } - let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell - cell.imgBtn.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside) - cell.imgBtn.setImage(UIImage(named: "xinzeng"), for: .normal) - - return cell - case 3: - if indexPath.row == 0 { - let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell - cell.namelbl.text = ysszArr[indexPath.row] - cell.delegate = self - cell.infoSw.isOn = shiFouSH - return cell - } - if indexPath.row == 3 { - let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell - cell.nameLbl.text = ysszArr[indexPath.row] - cell.textTF.keyboardType = .numberPad - cell.delegate = self - cell.textTF.text = faHuoTime - return cell - } - let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell - cell.nameLbl.text = ysszArr[indexPath.row] - cell.delegate = self - cell.contentLbl.text = ysszHolder[indexPath.row] - return cell - case 4: - if indexPath.row < 2 { - let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell - cell.nameLbl.text = qtxxArr[indexPath.row] - cell.textTF.delegate = self - cell.textTF.returnKeyType = .done - switch cell.nameLbl.text { - case "关键å—": - cell.textTF.text = keyWord - break - case "物æµè´¹ç”¨": - cell.textTF.text = wuLiuPrice - cell.textTF.keyboardType = .numbersAndPunctuation - break - default: - break - } - cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String - cell.tag = indexPath.row - cell.delegate = self - return cell - }else{ - let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell - cell.nameLbl.text = qtxxArr[indexPath.row] - cell.tag = indexPath.row - cell.contentLbl.text = tishixxArr1[indexPath.row] as! String - cell.delegate = self - return cell - } - default: - let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell - cell.imgBtn.setImage(UIImage(named: "XiaYunDanViewController"), for: .normal) - cell.delegate = self - cell.imgBtn.tag = indexPath.row - cell.imgBtn.setImage(UIImage(named: "tjxq"), for: .normal) - cell.btmH.constant = 25 - return cell - } - } - - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - - } - //MARK: - 底部广告软文跳转 - func AddGuiGeCellClick(cell: AddGuiGeCell) { - print("底部广告软文跳转") - let vc = LMNoteViewController() - self.navigationController?.pushViewController(vc, animated: true) - } - //MARK: -- ç‚¹å‡»æŒ‰é’®äº‹ä»¶ï¼Œè·³è½¬æˆ–è€…å±•ç¤ºé€‰æ‹©ç•Œé¢ - func btnClick(content: String, cell: TitleAndBtnCell) { - if cell.nameLbl.text == "商å“类型" { - if glSelectView == nil { - let view = GLAlertSelectView(frame: self.view.bounds) - view.tag = cell.tag - view.isMultipleS = true - view.isShangPinType = true - view.titleLbl.text = "请选择商å“类型" - view.delegate = self - view.dataArr = ["预售","普通","期货","团è´"] - if itemTypeArr?.count == 0 { - for _ in view.dataArr { - itemTypeArr?.append(99) - } - } - - view.selectArray = itemTypeArr - view.tempArr = itemTypeArr - self.view.addSubview(view) - glSelectView = view - } - } - if cell.nameLbl.text == "商å“分类" { - let vc = GoodsClassViewController() - vc.delegate = self - vc.selectModel = selectGoodsClassModel - vc.dataModelArray = generalInfoModel?.data?.cats - self.navigationController?.pushViewController(vc, animated: true) - } - if cell.nameLbl.text == "å“牌" { - let vc = PinPaiListViewController() - vc.isSelectData = true - vc.delegate = self - vc.selectModel = selectPinPaiData - vc.dataModelArray = generalInfoModel?.data?.brand - self.navigationController?.pushViewController(vc, animated: true) - } - if cell.nameLbl.text == "国家" { - 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 == "商å“状æ€" { - let view = GLAlertSelectView(frame: self.view.bounds) - view.tag = cell.tag - view.titleLbl.text = "请选择商å“状æ€" - view.delegate = self - if shangPinStatusArr != nil { - var arr:Array<String>? = [] - for item in shangPinStatusArr! { - arr?.append(item.gs_name!) - } - view.dataArr = arr! - } - if shangPinStatus != nil { - view.selectNum = shangPinStatus! - - } - self.view.addSubview(view) - glSelectView = view - } - if cell.nameLbl.text == "è¿è¾“æ–¹å¼" { - let view = GLAlertSelectView(frame: self.view.bounds) - view.tag = cell.tag - view.titleLbl.text = "请选择è¿è¾“æ–¹å¼" - view.delegate = self - view.dataArr = yunShuTypeArr - if yunShuType != nil{ - view.selectNum = yunShuType! - - } - self.view.addSubview(view) - glSelectView = view - } - if cell.nameLbl.text == "预设预付定金时间段" { - print("定金时间段") - let timeSelectV = ShowTimeSelectView(frame: self.view.window!.bounds) - timeSelectV.titleLbl.text = "预设预付定金时间段" - timeSelectV.delegate = self - self.view.window?.addSubview(timeSelectV) - isWeiTime = false - - } - if cell.nameLbl.text == "预设预付尾款时间段" { - print("预付尾款时") - let timeSelectV = ShowTimeSelectView(frame: self.view.window!.bounds) - timeSelectV.titleLbl.text = "预设预付尾款时间段" - timeSelectV.delegate = self - self.view.window?.addSubview(timeSelectV) - isWeiTime = true - } - } - - //MARK:--é€‰æ‹©é¢„å”®æ—¶é—´å›žè°ƒæ•°æ® - var isWeiTime : Bool = false - func showTimeSelectByData(timeStr: String, beginDate: Date, endginDate: Date) { - let timeInterval:TimeInterval = beginDate.timeIntervalSince1970 - let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970 - if isWeiTime { - ysszHolder.insert(timeStr, at: 2) - ysszHolder.remove(at: 3) - wk_time_start = Int(timeInterval) - wk_time_end = Int(timeIntervalEnd) - }else{ - ysszHolder.insert(timeStr, at: 1) - ysszHolder.remove(at: 2) - dj_time_start = Int(timeInterval) - dj_time_end = Int(timeIntervalEnd) - } - listTbv.reloadData() - - } - - //MARK:---选择商å“åˆ†ç±»è¿”å›žæ•°æ® - var selectGoodsClassModel:GoodsClassModel? = nil - func blackGoodsClass(sender: GoodsClassModel) { - print("选择商å“分类返回数æ®=\(sender)") - selectGoodsClassModel = sender - tishixxArr.insert(sender.cat_name!, at: 2) - tishixxArr.remove(at: 3) - listTbv.reloadData() - } - //MARK:--选择å“ç‰Œè¿”å›žçš„æ•°æ® - var selectPinPaiData:GeneralInfoBrandModel? = nil - func blackSelectPinPaiData(sender: GeneralInfoBrandModel) { - print("选择å“牌返回的数æ®=\(sender)") - selectPinPaiData = sender - tishixxArr.insert(sender.brand_name!, at: 3) - tishixxArr.remove(at: 4) - listTbv.reloadData() - - } - //MARK:--å›¾ç‰‡é€‰æ‹©å¤„ç† - func AddImgCellBtnClick(cell: AddImgCell) { - 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.append(image!) - self.uploadImg(imge: image!, isOriginal: true, tag: 0) - - }) - } - 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.append(image!) - let index = Dollar.indexOf(self.maxFiveImgsArr, value: image!) - self.uploadImg(imge: image!, isOriginal: false, tag: index!) - - }) - } - 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.uploadImg(imge: image!, isOriginal: true, tag: 0) - - }) - } - self.listTbv.reloadData() - } - }else{//å¯å¤šå¼ - _ = 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.maxFiveImgsArr.insert(image!, at: sender.tag) - self.maxFiveImgsArr.remove(at: sender.tag+1) - self.uploadImg(imge: image!, isOriginal: false, tag: sender.tag) - }) - } - self.listTbv.reloadData() - } - } - } - //MARK:--å›¾ç‰‡ä¸Šä¼ åŠŸèƒ½ - var original_img:String? = "" //商å“å°é¢å›¾ - var goods_banner:Array<String>? = ["","","","",""] //商å“å‰¯å›¾ï¼Œå¤šå¼ ï¼Œæœ€å¤š5å¼ ï¼Œä½¿ç”¨ä¸€ç»´æ•°ç»„è½¬jsonæ ¼å¼ - func uploadImg (imge:UIImage,isOriginal:Bool,tag:Int){ - let UserToken = UserDefaults.standard.value(forKey: "user_token") - let upLoadImg = imge as! UIImage - - saveFile(image: upLoadImg, ["user_token":UserToken as Any], success: { (data) in - let dataM = data as! SaveFileModel - if dataM.code == 1 { - print("å›¾ç‰‡ä¸Šä¼ æˆåŠŸ\(dataM.data?.url)") - if isOriginal { - self.original_img = dataM.data?.url! - }else{ - self.goods_banner?.insert((dataM.data?.url!)!, at: tag) - self.goods_banner?.remove(at: tag + 1) - } - } - }) { (error) in - print("å›¾ç‰‡ä¸Šä¼ å¤±è´¥\(error)") - } - - } - //MARK: - åˆ é™¤å›¾ç‰‡å¤„ç† - func DelImgCellBtnClick(sender:UIButton, cell: AddImgCell) { - if cell.isSingle == true { - singleImgArr.remove(at:sender.tag) - self.original_img = "" - listTbv.reloadData() - }else{ - maxFiveImgsArr.remove(at:sender.tag) - self.goods_banner?.insert("", at: 5) - self.goods_banner?.remove(at: sender.tag) - listTbv.reloadData() - } - } - //MARK: - GLAlertView(å•é€‰ï¼‰ä¸‹çš„é¡µé¢ - func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) { - - switch view.titleLbl.text { - case "请选择商å“状æ€": - shangPinStatus = selectNum - let item = shangPinStatusArr![selectNum] - print(item.gs_name!) - tishixxArr1.insert(item.gs_name!, at: view.tag) - tishixxArr1.remove(at: view.tag+1) - break - case "请选择è¿è¾“æ–¹å¼": - yunShuType = selectNum - tishixxArr1.insert(yunShuTypeArr[selectNum], at: view.tag) - tishixxArr1.remove(at: view.tag+1) - break - case "请选择国家": - countrySelect = selectNum - tishixxArr1.insert(countryArr[selectNum], at: view.tag) - tishixxArr1.remove(at: view.tag+1) - break - - default: - break - } - glSelectView?.removeFromSuperview() - glSelectView = nil - listTbv.reloadData() - } - - //MARK: - GLAlertViewï¼ˆå¤šé€‰ï¼‰ä¸‹çš„é¡µé¢ - func GLAlertMoreSelectViewClick(sender: Array<Int>, view:UIView) { - - itemTypeArr = sender - let str = "\(sender.first!)" - if str != "99" { - isYuShou = true - }else{ - isYuShou = false - } - let contentArr = ["预售","普通","期货","团è´"] - let titles = NSMutableArray() - titles.removeAllObjects() - for num in itemTypeArr! { - if num != 99{ - titles.add(contentArr[num]) - } - } - - if titles.componentsJoined(by: ",").contains("预售") { - isYuShouShangPin = true - }else{ - isYuShouShangPin = false - } - print("isYuShouShangPin == ",isYuShouShangPin) - tishixxArr.insert(titles.componentsJoined(by: ","), at: view.tag) - tishixxArr.remove(at: view.tag+1) - if itemTypeArr == [99,99,99,99] { - tishixxArr.insert("请选择商å“类型", at: view.tag) - tishixxArr.remove(at: view.tag+1) - } - - glSelectView?.removeFromSuperview() - glSelectView = nil - listTbv.reloadData() - } - - - //MARK: - titleAndTFdelegate - func textFieldContent(content: String, cell: TitleAndTFCell) { - switch cell.nameLbl.text { - case "商å“åç§°": - itemName = content - break - case "èµ·å–æ•°é‡": - qiMaiShuLiang = content - break - case "关键å—": - keyWord = content - break - case "物æµè´¹ç”¨": - wuLiuPrice = content - break - default: - break - } - } - //MARK: - ç¼–è¾‘è§„æ ¼ - func ShangPinGguiGeCellEditAction(cell: ShangPinGguiGeCell) { - let vc = CreatNewSpecsViewController() - vc.barTitle = "ç¼–è¾‘è§„æ ¼" - vc.datasArr = guiGeArr - vc.danWeiArr = generalInfoModel?.data?.unit! - - let dataDict:GuiGeModel! - if selectIdx?.item != nil { - dataDict = guiGeArr[selectIdx!.item] - }else{ - dataDict = guiGeArr.first - } - - vc.price = dataDict.price - vc.guiGe = dataDict.guiGe - vc.weight = dataDict.weight - vc.wenDu = dataDict.wenDu - vc.danWei = dataDict.danWei - vc.isJieTiOpen = dataDict.isJieTiOpen - vc.isYuShouSetting = isYuShouShangPin! - vc.yuShouPrice = dataDict.yuShouPrice - vc.specalArr = dataDict.specalArr - vc.jieTiArr = dataDict.jieTiArr - vc.isOpenYSSetting = dataDict.isOpenYSSetting - vc.selectIdx = selectIdx - vc.itemDanWeiSelect = dataDict.itemDanWeiSelect - vc.tempSelect = dataDict.tempSelect - vc.delegate = self - vc.DJBiLi = dataDict.DJBiLi - vc.ysKuCun = dataDict.ysKuCun - self.navigationController?.pushViewController(vc, animated: true) - } - // //MARK: - åˆ é™¤è§„æ ¼ - func CreatNewSpecsViewControllerDeleteAction(datas: Array<GuiGeModel>,selectIdx:IndexPath) { - guiGeArr = datas - self.selectIdx = selectIdx - listTbv.reloadData() - } - - //MARK: - æ–°å¢žè§„æ ¼ - @objc func addGuiGe(){ - print("æ–°å¢žè§„æ ¼") - let vc = CreatNewSpecsViewController() - vc.barTitle = "æ–°å¢žè§„æ ¼" - vc.delegate = self - vc.danWeiArr = generalInfoModel?.data!.unit - vc.isYuShouSetting = isYuShouShangPin! - vc.datasArr = guiGeArr - vc.selectIdx = selectIdx - self.navigationController?.pushViewController(vc, animated: true) - } - - //MARK: - 新增ã€ç¼–è¾‘è§„æ ¼æ•°æ®è¿”回 - func CreatNewSpecsViewControllerSaveAction(datas: Array<GuiGeModel>,selectIdx:IndexPath) { - guiGeArr = datas - self.selectIdx = selectIdx - listTbv.reloadData() - } - - //MARK: - COLLECTIONVIEW DELEGATE - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { - return 0 - } - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return guiGeArr.count - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath) - as! ItemCell - cell.tag = indexPath.row - cell.nameLbl.text = "è§„æ ¼" + "\(indexPath.item+1)" - - if indexPath == selectIdx { - cell.nameLbl.textColor = UIColor(named: "è“色å—体颜色") - cell.lineView.isHidden = false - }else{ - cell.nameLbl.textColor = UIColor(named: "æ ‡é¢˜å—颜色") - cell.lineView.isHidden = true - } - return cell - - } - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - selectIdx = indexPath - //刷新cell - collectionView.reloadData() - listTbv.reloadRows(at: [IndexPath(row: 0, section: 2)], with:.none) - } - //MARK: - switchClick - func switchClick(content: UISwitch, cell: TitleAndSwitchCell) { - switch cell.namelbl.text { - case "æ˜¯å¦æ¸…真": - shiFouQZ = content.isOn - break - case "是å¦è¯¢ä»·": - shiFouXJ = content.isOn - break - case "用户付款是å¦éœ€è¦å®¡æ ¸": - shiFouSH = content.isOn - break - default: - break - } - } - func numberOfSections(in tableView: UITableView) -> Int { - return 6 - } - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - switch section { - case 0: return 7 - case 1:return 2 - case 2:return 1 - case 3:return 4 - case 4:return 5 - default:return 1 - } - } - //MARK: - tableview footer - func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { - let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10)) - view.backgroundColor = UIColor(named: "app底色") - return view - } - func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { - if section == 3 { - if isYuShouShangPin == false { - return 0.001 - } - } - return 10 - } - //MARK: - tableview header - func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - if section == 3 { - if isYuShouShangPin == false { - return UIView() - } - } - let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39)) - let lbl = UILabel(frame: CGRect(x: 15, y: 15, width: fullScreenWidth, height: 21)) - lbl.text = titleArr[section] - lbl.textColor = UIColor(named: "æ ‡é¢˜å—颜色") - lbl.font = UIFont.boldSystemFont(ofSize: 15) - view.addSubview(lbl) - if section == 2 && guiGeArr.count > 0{ - let btn = UIButton() - btn.setTitle(" 新增", for: .normal) - btn.titleLabel?.font = UIFont.systemFont(ofSize: 13) - btn.setTitleColor(UIColor(named: "è“色å—体颜色"), for: .normal) - btn.setImage(UIImage(named: "jiahaoXG"), for: .normal) - view.addSubview(btn) - btn.sizeToFit() - btn.snp.makeConstraints { (make) in - make.centerY.equalTo(lbl.snp_centerY) - make.right.equalTo(-15) - make.height.equalTo(btn.frame.size.height) - make.width.equalTo(btn.frame.size.width) - } - let btn2 = UIButton() - view.addSubview(btn2) - btn2.snp.makeConstraints { (make) in - make.top.right.bottom.equalTo(0) - make.width.equalTo(80) - } - btn2.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside) - if guiGeArr.count > 1 { - view.frame = CGRect(x: 0, y: 0, width: fullScreenWidth, height: 80) - let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 0, height: 0), collectionViewLayout: layout) - collectionView.backgroundColor = UIColor.white - collectionView.delegate = self - collectionView.dataSource = self - view.addSubview(collectionView) - collectionView.snp.makeConstraints { (make) in - make.bottom.left.right.equalTo(0) - make.height.equalTo(41) - } - collectionView.showsHorizontalScrollIndicator = false - collectionView.isPagingEnabled = true - layout.itemSize = CGSize(width: fullScreenWidth*0.5, height: 41) - layout.scrollDirection = .horizontal - collectionView.collectionViewLayout = layout - collectionView.register(UINib(nibName: "ItemCell", bundle: nil), forCellWithReuseIdentifier: "ItemCell") - if guiGeArr.count > 0 { - collectionView.layoutIfNeeded() - collectionView.scrollToItem(at: selectIdx!, at: .centeredHorizontally, animated: false) - } - } - } - return view - } - func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - if section == 3 { - if isYuShouShangPin == false { - return 0.001 - } - } - if section == 2 { - if guiGeArr.count > 1 { - return 80 - } - } - return 39 - } - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - switch indexPath.section { - case 0: return 49 - case 1:return 148.5 - case 2: - if guiGeArr.count > 0 { - return 146 - } - return 123.5 - case 3: - if isYuShouShangPin == false { - return 0.01 - }else{ - return 49 - } - case 4:return 49 - default: - return 98 - - } - } - func YuShouWeiKuanFaHuoCellString(str: String) { - faHuoTime = str - print(faHuoTime) - } - override func backAction() { - self.navigationController?.popViewController(animated: true) - } - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - IQKeyboardManager.shared.resignFirstResponder() - } - func scrollViewDidScroll(_ scrollView: UIScrollView) { - IQKeyboardManager.shared.resignFirstResponder() - } - - //MARK:--处ç†è§„æ ¼æ•°æ® - var specifications = "" - var shop_price: Float = 0.0 - var goods_unit = "" - var sku_info = "" - func getUpSkuInfoByData(dataArr:Array<GuiGeModel>) { - var price: Float = 0.0 - var isgetP :Bool = false - var model : GuiGeModel? = nil - var skuArr:Array<Any> = [] - dataArr.forEach { (md) in - if isPurnNumber(str: md.price) { - if isgetP { - let peiceP = Float(md.price)! //第n个售价(n > 1) - if peiceP < price { - price = peiceP - model = md - } - }else { - price = Float(md.price)! //第一个售价 - model = md - isgetP = true - } - } - - - //普通阶梯价 - var is_tiered = 0 - var tiered_pri:Dictionary<String, String> = [:] - - if md.isJieTiOpen { - is_tiered = 1 - md.jieTiArr.forEach { (obj) in - let str = obj as! String - let arr = str.components(separatedBy: "_") - let priceStr = arr[0] - let coutStr = arr[1] - - if isPurnNumber(str: priceStr) { - let specaP = Float(priceStr)! - if specaP < price { - price = specaP - model = md - } - } - - tiered_pri.updateValue(priceStr, forKey: coutStr) - - } - } - - - //预售价 - var is_adsale_tiered = 0 - var adsale_tiered_pri:Dictionary<String, String> = [:] - if md.isOpenYSSetting { - if isPurnNumber(str: md.yuShouPrice) { - let yushoup = Float(md.yuShouPrice)! - if yushoup < price { - price = yushoup - model = md - } - } - if md.isJieTiOpen { - is_adsale_tiered = 1 - //æ¯ä¸€ä¸ªé¢„售阶梯价 - md.specalArr.forEach { (obj) in - let str = obj as! String - let arr = str.components(separatedBy: "_") - let priceStr = arr[0] - let coutStr = arr[1] - - if isPurnNumber(str: priceStr) { - let specaP = Float(priceStr)! - if specaP < price { - price = specaP - model = md - } - } - - adsale_tiered_pri.updateValue(priceStr, forKey: coutStr) - + + + // Do any additional setup after loading the view. + } + //MARK: - cell delegate + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + switch indexPath.section { + case 0: + if indexPath.row == 0 || indexPath.row == 4 { + let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell + cell.textTF.delegate = self + cell.nameLbl.text = spxxArr[indexPath.row] + //商家åç§° + switch cell.nameLbl.text { + case "商å“åç§°": + cell.textTF.text = itemName + cell.textTF.returnKeyType = .done + break + case "èµ·å–æ•°é‡": + cell.textTF.text = qiMaiShuLiang + cell.textTF.keyboardType = .numberPad + break + default: + break + } + + cell.textTF.placeholder = tishixxArr[indexPath.row] as! String + cell.delegate = self + return cell + } + if indexPath.row > 4{ + let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell + 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 + } + let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell + cell.nameLbl.text = spxxArr[indexPath.row] + cell.contentLbl.text = tishixxArr[indexPath.row] as! String + cell.tag = indexPath.row + cell.delegate = self + return cell + case 1: + let cell = tableView.dequeueReusableCell(withIdentifier: "AddImg") as! AddImgCell + cell.nameLbl.text = sptpArr[indexPath.row] + if indexPath.row == 0 { + cell.isSingle = true + if singleImgArr.count > 0{ + cell.imgs = singleImgArr + cell.addBtn.isHidden = true + }else{ + cell.scrollView?.isHidden = true + cell.addBtn.isHidden = false + } + }else{ + cell.isSingle = false + if maxFiveImgsArr.count > 0{ + cell.imgs = maxFiveImgsArr + }else{ + cell.scrollView?.isHidden = true + cell.addBtnX.constant = 15 + } + } + cell.delegate = self + cell.addBtn.tag = indexPath.row + cell.isEdit = true + return cell + case 2: + if guiGeArr.count > 0 { + let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell + cell.delegate = self + var dict:GuiGeModel! + if selectIdx != nil{ + print(selectIdx?.item) + dict = guiGeArr[selectIdx!.item] + }else{ + + dict = guiGeArr.first + } + + cell.tempLbl.text = "冷è—:\(dict.wenDu)℃" + cell.weightLbl.text = "é‡é‡ï¼ˆkg):\(dict.weight)kg" + cell.guiGeLbl.text = "è§„æ ¼ï¼š\(dict.guiGe)kg/ä»¶" + cell.danWeiLbl.text = "å•ä½ï¼š\(dict.danWei)" + cell.sellPriceLbl.text = "售价:¥\(dict.price)" + + return cell + } + let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell + cell.imgBtn.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside) + cell.imgBtn.setImage(UIImage(named: "xinzeng"), for: .normal) + + return cell + case 3: + if indexPath.row == 0 { + let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell + cell.namelbl.text = ysszArr[indexPath.row] + cell.delegate = self + cell.infoSw.isOn = shiFouSH + return cell + } + if indexPath.row == 3 { + let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell + cell.nameLbl.text = ysszArr[indexPath.row] + cell.textTF.keyboardType = .numberPad + cell.delegate = self + cell.textTF.text = faHuoTime + return cell + } + let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell + cell.nameLbl.text = ysszArr[indexPath.row] + cell.delegate = self + cell.contentLbl.text = ysszHolder[indexPath.row] + return cell + case 4: + if indexPath.row < 2 { + let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell + cell.nameLbl.text = qtxxArr[indexPath.row] + cell.textTF.delegate = self + cell.textTF.returnKeyType = .done + switch cell.nameLbl.text { + case "关键å—": + cell.textTF.text = keyWord + break + case "物æµè´¹ç”¨": + cell.textTF.text = wuLiuPrice + cell.textTF.keyboardType = .numbersAndPunctuation + break + default: + break + } + cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String + cell.tag = indexPath.row + cell.delegate = self + return cell + }else{ + let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell + cell.nameLbl.text = qtxxArr[indexPath.row] + cell.tag = indexPath.row + cell.contentLbl.text = tishixxArr1[indexPath.row] as! String + cell.delegate = self + return cell + } + default: + let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell + cell.imgBtn.setImage(UIImage(named: "XiaYunDanViewController"), for: .normal) + cell.delegate = self + cell.imgBtn.tag = indexPath.row + cell.imgBtn.setImage(UIImage(named: "tjxq"), for: .normal) + cell.btmH.constant = 25 + return cell + } + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + + } + //MARK: - 底部广告软文跳转 + func AddGuiGeCellClick(cell: AddGuiGeCell) { + print("底部广告软文跳转") + let vc = LMNoteViewController() + self.navigationController?.pushViewController(vc, animated: true) + } + //MARK: -- ç‚¹å‡»æŒ‰é’®äº‹ä»¶ï¼Œè·³è½¬æˆ–è€…å±•ç¤ºé€‰æ‹©ç•Œé¢ + func btnClick(content: String, cell: TitleAndBtnCell) { + if cell.nameLbl.text == "商å“类型" { + if glSelectView == nil { + let view = GLAlertSelectView(frame: self.view.bounds) + view.tag = cell.tag + view.isMultipleS = true + view.isShangPinType = true + view.titleLbl.text = "请选择商å“类型" + view.delegate = self + view.dataArr = ["预售","普通","期货","团è´"] + if itemTypeArr?.count == 0 { + for _ in view.dataArr { + itemTypeArr?.append(99) + } + } + + view.selectArray = itemTypeArr + view.tempArr = itemTypeArr + self.view.addSubview(view) + glSelectView = view + } + } + if cell.nameLbl.text == "商å“分类" { + let vc = GoodsClassViewController() + vc.delegate = self + vc.selectModel = selectGoodsClassModel + vc.dataModelArray = generalInfoModel?.data?.cats + self.navigationController?.pushViewController(vc, animated: true) + } + if cell.nameLbl.text == "å“牌" { + let vc = PinPaiListViewController() + vc.isSelectData = true + vc.delegate = self + vc.selectModel = selectPinPaiData + vc.dataModelArray = generalInfoModel?.data?.brand + self.navigationController?.pushViewController(vc, animated: true) + } + if cell.nameLbl.text == "国家" { + 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 == "商å“状æ€" { + let view = GLAlertSelectView(frame: self.view.bounds) + view.tag = cell.tag + view.titleLbl.text = "请选择商å“状æ€" + view.delegate = self + if shangPinStatusArr != nil { + var arr:Array<String>? = [] + for item in shangPinStatusArr! { + arr?.append(item.gs_name!) + } + view.dataArr = arr! + } + if shangPinStatus != nil { + view.selectNum = shangPinStatus! + + } + self.view.addSubview(view) + glSelectView = view + } + if cell.nameLbl.text == "è¿è¾“æ–¹å¼" { + let view = GLAlertSelectView(frame: self.view.bounds) + view.tag = cell.tag + view.titleLbl.text = "请选择è¿è¾“æ–¹å¼" + view.delegate = self + view.dataArr = yunShuTypeArr + if yunShuType != nil{ + view.selectNum = yunShuType! + + } + self.view.addSubview(view) + glSelectView = view + } + if cell.nameLbl.text == "预设预付定金时间段" { + print("定金时间段") + let timeSelectV = ShowTimeSelectView(frame: self.view.window!.bounds) + timeSelectV.titleLbl.text = "预设预付定金时间段" + timeSelectV.delegate = self + self.view.window?.addSubview(timeSelectV) + isWeiTime = false + + } + if cell.nameLbl.text == "预设预付尾款时间段" { + print("预付尾款时") + let timeSelectV = ShowTimeSelectView(frame: self.view.window!.bounds) + timeSelectV.titleLbl.text = "预设预付尾款时间段" + timeSelectV.delegate = self + self.view.window?.addSubview(timeSelectV) + isWeiTime = true + } + } + + //MARK:--é€‰æ‹©é¢„å”®æ—¶é—´å›žè°ƒæ•°æ® + var isWeiTime : Bool = false + func showTimeSelectByData(timeStr: String, beginDate: Date, endginDate: Date) { + let timeInterval:TimeInterval = beginDate.timeIntervalSince1970 + let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970 + if isWeiTime { + ysszHolder.insert(timeStr, at: 2) + ysszHolder.remove(at: 3) + wk_time_start = Int(timeInterval) + wk_time_end = Int(timeIntervalEnd) + }else{ + ysszHolder.insert(timeStr, at: 1) + ysszHolder.remove(at: 2) + dj_time_start = Int(timeInterval) + dj_time_end = Int(timeIntervalEnd) + } + listTbv.reloadData() + + } + + //MARK:---选择商å“åˆ†ç±»è¿”å›žæ•°æ® + var selectGoodsClassModel:GoodsClassModel? = nil + func blackGoodsClass(sender: GoodsClassModel) { + print("选择商å“分类返回数æ®=\(sender)") + selectGoodsClassModel = sender + tishixxArr.insert(sender.cat_name!, at: 2) + tishixxArr.remove(at: 3) + listTbv.reloadData() + } + //MARK:--选择å“ç‰Œè¿”å›žçš„æ•°æ® + var selectPinPaiData:GeneralInfoBrandModel? = nil + func blackSelectPinPaiData(sender: GeneralInfoBrandModel) { + print("选择å“牌返回的数æ®=\(sender)") + selectPinPaiData = sender + tishixxArr.insert(sender.brand_name!, at: 3) + tishixxArr.remove(at: 4) + listTbv.reloadData() + + } + //MARK:--å›¾ç‰‡é€‰æ‹©å¤„ç† + func AddImgCellBtnClick(cell: AddImgCell) { + 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.append(image!) + self.uploadImg(imge: image!, isOriginal: true, tag: 0) + + }) + } + 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.append(image!) + let index = Dollar.indexOf(self.maxFiveImgsArr, value: image!) + self.uploadImg(imge: image!, isOriginal: false, tag: index!) + + }) + } + 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.uploadImg(imge: image!, isOriginal: true, tag: 0) + + }) + } + self.listTbv.reloadData() + } + }else{//å¯å¤šå¼ + _ = 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.maxFiveImgsArr.insert(image!, at: sender.tag) + self.maxFiveImgsArr.remove(at: sender.tag+1) + self.uploadImg(imge: image!, isOriginal: false, tag: sender.tag) + }) + } + self.listTbv.reloadData() + } + } + } + //MARK:--å›¾ç‰‡ä¸Šä¼ åŠŸèƒ½ + var original_img:String? = "" //商å“å°é¢å›¾ + var goods_banner:Array<String>? = ["","","","",""] //商å“å‰¯å›¾ï¼Œå¤šå¼ ï¼Œæœ€å¤š5å¼ ï¼Œä½¿ç”¨ä¸€ç»´æ•°ç»„è½¬jsonæ ¼å¼ + func uploadImg (imge:UIImage,isOriginal:Bool,tag:Int){ + let UserToken = UserDefaults.standard.value(forKey: "user_token") + let upLoadImg = imge as! UIImage + + saveFile(image: upLoadImg, ["user_token":UserToken as Any], success: { (data) in + let dataM = data as! SaveFileModel + if dataM.code == 1 { + print("å›¾ç‰‡ä¸Šä¼ æˆåŠŸ\(dataM.data?.url)") + if isOriginal { + self.original_img = dataM.data?.url! + }else{ + self.goods_banner?.insert((dataM.data?.url!)!, at: tag) + self.goods_banner?.remove(at: tag + 1) + } + } + }) { (error) in + print("å›¾ç‰‡ä¸Šä¼ å¤±è´¥\(error)") + } + + } + //MARK: - åˆ é™¤å›¾ç‰‡å¤„ç† + func DelImgCellBtnClick(sender:UIButton, cell: AddImgCell) { + if cell.isSingle == true { + singleImgArr.remove(at:sender.tag) + self.original_img = "" + listTbv.reloadData() + }else{ + maxFiveImgsArr.remove(at:sender.tag) + self.goods_banner?.insert("", at: 5) + self.goods_banner?.remove(at: sender.tag) + listTbv.reloadData() + } + } + //MARK: - GLAlertView(å•é€‰ï¼‰ä¸‹çš„é¡µé¢ + func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) { + + switch view.titleLbl.text { + case "请选择商å“状æ€": + shangPinStatus = selectNum + let item = shangPinStatusArr![selectNum] + print(item.gs_name!) + tishixxArr1.insert(item.gs_name!, at: view.tag) + tishixxArr1.remove(at: view.tag+1) + break + case "请选择è¿è¾“æ–¹å¼": + yunShuType = selectNum + tishixxArr1.insert(yunShuTypeArr[selectNum], at: view.tag) + tishixxArr1.remove(at: view.tag+1) + break + case "请选择国家": + countrySelect = selectNum + tishixxArr1.insert(countryArr[selectNum], at: view.tag) + tishixxArr1.remove(at: view.tag+1) + break + + default: + break + } + glSelectView?.removeFromSuperview() + glSelectView = nil + listTbv.reloadData() + } + + //MARK: - GLAlertViewï¼ˆå¤šé€‰ï¼‰ä¸‹çš„é¡µé¢ + func GLAlertMoreSelectViewClick(sender: Array<Int>, view:UIView) { + + itemTypeArr = sender + + let contentArr = ["预售","普通","期货","团è´"] + let titles = NSMutableArray() + titles.removeAllObjects() + for num in itemTypeArr! { + if num != 99{ + titles.add(contentArr[num]) + } + } + + if titles.componentsJoined(by: ",").contains("预售") { + isYuShouShangPin = true + }else{ + isYuShouShangPin = false + } + print("isYuShouShangPin == ",isYuShouShangPin) + tishixxArr.insert(titles.componentsJoined(by: ","), at: view.tag) + tishixxArr.remove(at: view.tag+1) + if itemTypeArr == [99,99,99,99] { + tishixxArr.insert("请选择商å“类型", at: view.tag) + tishixxArr.remove(at: view.tag+1) + } + + glSelectView?.removeFromSuperview() + glSelectView = nil + listTbv.reloadData() + } + + + //MARK: - titleAndTFdelegate + func textFieldContent(content: String, cell: TitleAndTFCell) { + switch cell.nameLbl.text { + case "商å“åç§°": + itemName = content + break + case "èµ·å–æ•°é‡": + qiMaiShuLiang = content + break + case "关键å—": + keyWord = content + break + case "物æµè´¹ç”¨": + wuLiuPrice = content + break + default: + break + } + } + //MARK: - ç¼–è¾‘è§„æ ¼ + func ShangPinGguiGeCellEditAction(cell: ShangPinGguiGeCell) { + let vc = CreatNewSpecsViewController() + vc.barTitle = "ç¼–è¾‘è§„æ ¼" + vc.datasArr = guiGeArr + vc.danWeiArr = generalInfoModel?.data?.unit! + + let dataDict:GuiGeModel! + if selectIdx?.item != nil { + dataDict = guiGeArr[selectIdx!.item] + }else{ + dataDict = guiGeArr.first + } + + vc.price = dataDict.price + vc.guiGe = dataDict.guiGe + vc.weight = dataDict.weight + vc.wenDu = dataDict.wenDu + vc.danWei = dataDict.danWei + vc.isJieTiOpen = dataDict.isJieTiOpen + vc.isYuShouSetting = isYuShouShangPin! + vc.yuShouPrice = dataDict.yuShouPrice + vc.specalArr = dataDict.specalArr + vc.jieTiArr = dataDict.jieTiArr + vc.isOpenYSSetting = dataDict.isOpenYSSetting + vc.selectIdx = selectIdx + vc.itemDanWeiSelect = dataDict.itemDanWeiSelect + vc.tempSelect = dataDict.tempSelect + vc.delegate = self + vc.DJBiLi = dataDict.DJBiLi + vc.ysKuCun = dataDict.ysKuCun + self.navigationController?.pushViewController(vc, animated: true) + } + // //MARK: - åˆ é™¤è§„æ ¼ + func CreatNewSpecsViewControllerDeleteAction(datas: Array<GuiGeModel>,selectIdx:IndexPath) { + guiGeArr = datas + self.selectIdx = selectIdx + listTbv.reloadData() + } + + //MARK: - æ–°å¢žè§„æ ¼ + @objc func addGuiGe(){ + print("æ–°å¢žè§„æ ¼") + let vc = CreatNewSpecsViewController() + vc.barTitle = "æ–°å¢žè§„æ ¼" + vc.delegate = self + vc.danWeiArr = generalInfoModel?.data!.unit + vc.isYuShouSetting = isYuShouShangPin! + vc.datasArr = guiGeArr + vc.selectIdx = selectIdx + self.navigationController?.pushViewController(vc, animated: true) + } + + //MARK: - 新增ã€ç¼–è¾‘è§„æ ¼æ•°æ®è¿”回 + func CreatNewSpecsViewControllerSaveAction(datas: Array<GuiGeModel>,selectIdx:IndexPath) { + guiGeArr = datas + self.selectIdx = selectIdx + listTbv.reloadData() + } + + //MARK: - COLLECTIONVIEW DELEGATE + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 0 + } + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return guiGeArr.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath) + as! ItemCell + cell.tag = indexPath.row + cell.nameLbl.text = "è§„æ ¼" + "\(indexPath.item+1)" + + if indexPath == selectIdx { + cell.nameLbl.textColor = UIColor(named: "è“色å—体颜色") + cell.lineView.isHidden = false + }else{ + cell.nameLbl.textColor = UIColor(named: "æ ‡é¢˜å—颜色") + cell.lineView.isHidden = true + } + return cell + + } + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + selectIdx = indexPath + //刷新cell + collectionView.reloadData() + listTbv.reloadRows(at: [IndexPath(row: 0, section: 2)], with:.none) + } + //MARK: - switchClick + func switchClick(content: UISwitch, cell: TitleAndSwitchCell) { + switch cell.namelbl.text { + case "æ˜¯å¦æ¸…真": + shiFouQZ = content.isOn + break + case "是å¦è¯¢ä»·": + shiFouXJ = content.isOn + break + case "用户付款是å¦éœ€è¦å®¡æ ¸": + shiFouSH = content.isOn + break + default: + break + } + } + func numberOfSections(in tableView: UITableView) -> Int { + return 6 + } + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + switch section { + case 0: return 7 + case 1:return 2 + case 2:return 1 + case 3:return 4 + case 4:return 5 + default:return 1 + } + } + //MARK: - tableview footer + func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { + let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10)) + view.backgroundColor = UIColor(named: "app底色") + return view + } + func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { + if section == 3 { + if isYuShouShangPin == false { + return 0.001 + } + } + return 10 + } + //MARK: - tableview header + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + if section == 3 { + if isYuShouShangPin == false { + return UIView() + } + } + let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39)) + let lbl = UILabel(frame: CGRect(x: 15, y: 15, width: fullScreenWidth, height: 21)) + lbl.text = titleArr[section] + lbl.textColor = UIColor(named: "æ ‡é¢˜å—颜色") + lbl.font = UIFont.boldSystemFont(ofSize: 15) + view.addSubview(lbl) + if section == 2 && guiGeArr.count > 0{ + let btn = UIButton() + btn.setTitle(" 新增", for: .normal) + btn.titleLabel?.font = UIFont.systemFont(ofSize: 13) + btn.setTitleColor(UIColor(named: "è“色å—体颜色"), for: .normal) + btn.setImage(UIImage(named: "jiahaoXG"), for: .normal) + view.addSubview(btn) + btn.sizeToFit() + btn.snp.makeConstraints { (make) in + make.centerY.equalTo(lbl.snp_centerY) + make.right.equalTo(-15) + make.height.equalTo(btn.frame.size.height) + make.width.equalTo(btn.frame.size.width) + } + let btn2 = UIButton() + view.addSubview(btn2) + btn2.snp.makeConstraints { (make) in + make.top.right.bottom.equalTo(0) + make.width.equalTo(80) + } + btn2.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside) + if guiGeArr.count > 1 { + view.frame = CGRect(x: 0, y: 0, width: fullScreenWidth, height: 80) + let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 0, height: 0), collectionViewLayout: layout) + collectionView.backgroundColor = UIColor.white + collectionView.delegate = self + collectionView.dataSource = self + view.addSubview(collectionView) + collectionView.snp.makeConstraints { (make) in + make.bottom.left.right.equalTo(0) + make.height.equalTo(41) + } + collectionView.showsHorizontalScrollIndicator = false + collectionView.isPagingEnabled = true + layout.itemSize = CGSize(width: fullScreenWidth*0.5, height: 41) + layout.scrollDirection = .horizontal + collectionView.collectionViewLayout = layout + collectionView.register(UINib(nibName: "ItemCell", bundle: nil), forCellWithReuseIdentifier: "ItemCell") + if guiGeArr.count > 0 { + collectionView.layoutIfNeeded() + collectionView.scrollToItem(at: selectIdx!, at: .centeredHorizontally, animated: false) + } + } + } + return view + } + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + if section == 3 { + if isYuShouShangPin == false { + return 0.001 + } + } + if section == 2 { + if guiGeArr.count > 1 { + return 80 + } + } + return 39 + } + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + switch indexPath.section { + case 0: return 49 + case 1:return 148.5 + case 2: + if guiGeArr.count > 0 { + return 146 + } + return 123.5 + case 3: + if isYuShouShangPin == false { + return 0.01 + }else{ + return 49 + } + case 4:return 49 + default: + return 98 + + } + } + func YuShouWeiKuanFaHuoCellString(str: String) { + faHuoTime = str + print(faHuoTime) + } + override func backAction() { + self.navigationController?.popViewController(animated: true) + } + + //MARK:--处ç†è§„æ ¼æ•°æ® + var specifications = "" + var shop_price: Float = 0.0 + var goods_unit = "" + var sku_info = "" + func getUpSkuInfoByData(dataArr:Array<GuiGeModel>) { + var price: Float = 0.0 + var isgetP :Bool = false + var model : GuiGeModel? = nil + var skuArr:Array<Any> = [] + dataArr.forEach { (md) in + if isPurnNumber(str: md.price) { + if isgetP { + let peiceP = Float(md.price)! //第n个售价(n > 1) + if peiceP < price { + price = peiceP + model = md + } + }else { + price = Float(md.price)! //第一个售价 + model = md + isgetP = true + } + } + + + //普通阶梯价 + var is_tiered = 0 + var tiered_pri:Dictionary<String, String> = [:] + + if md.isJieTiOpen { + is_tiered = 1 + md.jieTiArr.forEach { (obj) in + let str = obj as! String + let arr = str.components(separatedBy: "_") + let priceStr = arr[0] + let coutStr = arr[1] + + if isPurnNumber(str: priceStr) { + let specaP = Float(priceStr)! + if specaP < price { + price = specaP + model = md } - } - - } - - - let pack_attr = ["l":"0","w":"0","h":"0","wg":md.weight,"v":"0"] - - var is_open_adsale = 0 - var adsale_pri = "" - var adsale_inventory = "" - var pct = "" - - if md.isOpenYSSetting { - is_open_adsale = 1 - adsale_pri = md.yuShouPrice - adsale_inventory = md.ysKuCun - pct = md.DJBiLi + } + + tiered_pri.updateValue(priceStr, forKey: coutStr) + } - var sku = ["sku_sn":"", - "spec_id":"1", - "attr":md.guiGe, - "pack_attr":pack_attr, - "refrigerate":md.wenDu, - "unit":md.danWei, - "price":md.price, - "is_tiered":is_tiered, - "is_open_adsale":is_open_adsale, - "adsale_pri":adsale_pri, - "adsale_inventory":adsale_inventory, - "pct":pct, - "is_adsale_tiered":is_adsale_tiered] as [String : Any] - - if tiered_pri.keys.count > 0{ - sku.updateValue(tiered_pri, forKey: "tiered_pri") - }else{ - sku.updateValue("", forKey: "tiered_pri") - - } - if adsale_tiered_pri.keys.count > 0 { - sku.updateValue(adsale_tiered_pri, forKey: "adsale_tiered_pri") - }else{ - sku.updateValue("", forKey: "adsale_tiered_pri") - } - - skuArr.append(sku) - - } - if skuArr.count > 0 { - sku_info = dataChangeString(sender: skuArr) - } - shop_price = price - if model != nil { - specifications = model!.guiGe - goods_unit = model!.danWei - } + } + + + //预售价 + var is_adsale_tiered = 0 + var adsale_tiered_pri:Dictionary<String, String> = [:] + if md.isOpenYSSetting { + if isPurnNumber(str: md.yuShouPrice) { + let yushoup = Float(md.yuShouPrice)! + if yushoup < price { + price = yushoup + model = md + } + } + if md.isJieTiOpen { + is_adsale_tiered = 1 + //æ¯ä¸€ä¸ªé¢„售阶梯价 + md.specalArr.forEach { (obj) in + let str = obj as! String + let arr = str.components(separatedBy: "_") + let priceStr = arr[0] + let coutStr = arr[1] + + if isPurnNumber(str: priceStr) { + let specaP = Float(priceStr)! + if specaP < price { + price = specaP + model = md + } + } + + adsale_tiered_pri.updateValue(priceStr, forKey: coutStr) + + } + } + + } + + + let pack_attr = ["l":"0","w":"0","h":"0","wg":md.weight,"v":"0"] + + var is_open_adsale = 0 + var adsale_pri = "" + var adsale_inventory = "" + var pct = "" + + if md.isOpenYSSetting { + is_open_adsale = 1 + adsale_pri = md.yuShouPrice + adsale_inventory = md.ysKuCun + pct = md.DJBiLi + } + var sku = ["sku_sn":"", + "spec_id":"1", + "attr":md.guiGe, + "pack_attr":pack_attr, + "refrigerate":md.wenDu, + "unit":md.danWei, + "price":md.price, + "is_tiered":is_tiered, + "is_open_adsale":is_open_adsale, + "adsale_pri":adsale_pri, + "adsale_inventory":adsale_inventory, + "pct":pct, + "is_adsale_tiered":is_adsale_tiered] as [String : Any] + + if tiered_pri.keys.count > 0{ + sku.updateValue(tiered_pri, forKey: "tiered_pri") + }else{ + sku.updateValue("", forKey: "tiered_pri") + + } + if adsale_tiered_pri.keys.count > 0 { + sku.updateValue(adsale_tiered_pri, forKey: "adsale_tiered_pri") + }else{ + sku.updateValue("", forKey: "adsale_tiered_pri") + } + + skuArr.append(sku) + + } + if skuArr.count > 0 { + sku_info = dataChangeString(sender: skuArr) + } + shop_price = price + if model != nil { + specifications = model!.guiGe + goods_unit = model!.danWei + } + + } - } - } - - + + diff --git "a/GeliBusinessPlatform/ViewController/\345\225\206\345\223\201\350\257\246\346\203\205/ProductDetailViewController.swift" "b/GeliBusinessPlatform/ViewController/\345\225\206\345\223\201\350\257\246\346\203\205/ProductDetailViewController.swift" index cb0aca60697f0fea045bc4e11cd82461476d67e9..62718872f19686305cb88dd50ab2a8e73392f00a 100644 --- "a/GeliBusinessPlatform/ViewController/\345\225\206\345\223\201\350\257\246\346\203\205/ProductDetailViewController.swift" +++ "b/GeliBusinessPlatform/ViewController/\345\225\206\345\223\201\350\257\246\346\203\205/ProductDetailViewController.swift" @@ -60,7 +60,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl var isYuShouShangPin:Bool?//是å¦ä¸ºé¢„å”®å•†å“ var itemTypeArr:Array<Int>? = []//多选 - var isYuShou:Bool = false//是å¦é¢„å”® var shangPinStatus:Int? = 0//商å“çŠ¶æ€ var yunShuType:Int? = 0//è¿è¾“类型 var maxFiveImgsArr:Array<UIImage> = []//多图 @@ -770,14 +769,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl //MARK: - GLAlertViewï¼ˆå¤šé€‰ï¼‰ä¸‹çš„é¡µé¢ func GLAlertMoreSelectViewClick(sender: Array<Int>, view:UIView) { - itemTypeArr = sender - let str = "\(sender.first!)" - if str != "99" { - isYuShou = true - }else{ - isYuShou = false - } let contentArr = ["预售","普通","期货","团è´"] let titles = NSMutableArray() titles.removeAllObjects() @@ -838,7 +830,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl }else{ dataDict = guiGeArr.first } - vc.price = dataDict.price vc.guiGe = dataDict.guiGe vc.weight = dataDict.weight @@ -856,6 +847,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl vc.delegate = self vc.DJBiLi = dataDict.DJBiLi vc.ysKuCun = dataDict.ysKuCun + vc.isYsJieTiOpen = dataDict.isYsJieTiOpen + vc.selectYuShou = dataDict.selectYuShou self.navigationController?.pushViewController(vc, animated: true) } // //MARK: - åˆ é™¤è§„æ ¼ @@ -1058,13 +1051,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl override func backAction() { self.navigationController?.popViewController(animated: true) } - func textFieldShouldReturn(_ textField: UITextField) -> Bool { - IQKeyboardManager.shared.resignFirstResponder() - } - func scrollViewDidScroll(_ scrollView: UIScrollView) { - IQKeyboardManager.shared.resignFirstResponder() - } - + + //MARK:--处ç†è§„æ ¼æ•°æ® var specifications = "" var shop_price: Float = 0.0 diff --git "a/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/CreatNewSpecsViewController.swift" "b/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/CreatNewSpecsViewController.swift" index 4dca8e099d86ebeb61e6ca9910fbdef95872f614..b56f45e21672ea76e025327522f7501b0438e6b1 100644 --- "a/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/CreatNewSpecsViewController.swift" +++ "b/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/CreatNewSpecsViewController.swift" @@ -35,16 +35,19 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl var collectView:UICollectionView? var datasArr:Array<GuiGeModel> = [] var dataModel = GuiGeModel() + let titleArray = ["售价:","è§„æ ¼ï¼š","é‡é‡ï¼š","温è—:","å•ä½ï¼š"] let pliceHolderArr = ["请输入商å“售价","请输入商å“è§„æ ¼","请输入商å“é‡é‡","è¯·é€‰æ‹©å•†å“æ¸©è—","请选择商å“å•ä½"] @IBOutlet weak var bottomBtn: LGButton! @IBOutlet weak var listTbv: UITableView! var selectIdx:IndexPath? var isYuShouSetting = false//打开预售 - // var isJieTiJiaSetting = false + var isJieTiOpen = false//æŽ§åˆ¶é˜¶æ¢¯ä»·æ˜¯å¦æ‰“å¼€ + var isYsJieTiOpen = false//æŽ§åˆ¶é¢„å”®é˜¶æ¢¯æ˜¯å¦æ‰“å¼€ + var isOpenYSSetting = false//æ˜¯å¦æ‰“开预售设置 - var selectYuShou:Bool = false//是å¦é€‰æ‹©è®¾ç½®é¢„å”®ä»·æ ¼ + var selectYuShou = false//是å¦é€‰æ‹©è®¾ç½®é¢„å”®ä»·æ ¼ //é€‰æ‹©é¡µé¢ var selectView:GLAlertSelectView? = nil @@ -180,9 +183,12 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl dataModel.weight = weight dataModel.wenDu = wenDu dataModel.danWei = danWei + dataModel.isYsJieTiOpen = isYsJieTiOpen dataModel.jieTiArr = jieTiArr as! Array<Any> dataModel.specalArr = specalArr as! Array<Any> dataModel.yuShouPrice = yuShouPrice + print("save == ",selectYuShou) + dataModel.selectYuShou = selectYuShou dataModel.itemDanWeiSelect = itemDanWeiSelect dataModel.tempSelect = tempSelect dataModel.isJieTiOpen = isJieTiOpen @@ -190,10 +196,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl dataModel.DJBiLi = DJBiLi dataModel.ysKuCun = ysKuCun if barTitle?.contains("编辑") == true { - datasArr.insert(dataModel, at: selectIdx!.item) datasArr.remove(at: selectIdx!.item+1) - }else{ datasArr.append(dataModel) selectIdx?.item = datasArr.count - 1 @@ -240,9 +244,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl } if section == 2 { if selectYuShou {//预售 - return specalArr.count - }else{//éžé¢„å”® return jieTiArr.count } @@ -392,11 +394,14 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl } } if indexPath.section == 2 { - if isJieTiOpen { + if isJieTiOpen && selectYuShou == false { + return 49 + } + if isYsJieTiOpen && selectYuShou { return 49 - }else{ - return 0.001 } + return 0.001 + } return 49 } @@ -405,30 +410,30 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let view = UIView() if section == 2 {//阶梯价设置 - let view = NewCreateHeader(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49)) - view.delegate = self - view.infoSw.isOn = isJieTiOpen - - if isJieTiOpen == false{ - return view - } - - - if isYuShouSetting {//阶梯价 + if isYuShouSetting {//预售阶梯价 let view = TitleAndSwitchHeaderView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 90)) view.delegate = self + print("selectYuShou == ",selectYuShou) view.selectYuShou = selectYuShou - view.infoSW.isOn = isJieTiOpen + view.infoSW.isOn = isJieTiOpen//普通 + view.ysInfoSw.isOn = isYsJieTiOpen//预售 + return view + }else{//普通 + let view = NewCreateHeader(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49)) + view.delegate = self + view.infoSw.isOn = isJieTiOpen + if isJieTiOpen == false{ + return view + } return view } - return view } return view } func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { if section != 0 { if section == 2 { - if isYuShouSetting && isJieTiOpen { + if isYuShouSetting{ return 90 } return 59 @@ -440,7 +445,12 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl //footer func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { if section == 2 { - if isJieTiOpen { + if isJieTiOpen && selectYuShou == false{ + let view = NewCreateFooter(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49)) + view.delegate = self + return view + } + if isYsJieTiOpen && selectYuShou{ let view = NewCreateFooter(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49)) view.delegate = self return view @@ -451,7 +461,10 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl } func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { if section == 2 { - if isJieTiOpen { + if isJieTiOpen && selectYuShou == false { + return 49 + } + if isYsJieTiOpen && selectYuShou{ return 49 } } @@ -537,8 +550,11 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl } func switchStatus(sender: UISwitch) {//阶梯价设置 - isJieTiOpen = sender.isOn - // isJieTiJiaSetting = sender.isOn + if sender.tag == 99 { + isYsJieTiOpen = sender.isOn + }else{ + isJieTiOpen = sender.isOn + } listTbv.reloadData() } @@ -583,11 +599,9 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) { if selectYuShou { specalArr.insert("\(price)_\(count)", at: cell.tag) - print(specalArr) specalArr.remove(at: cell.tag+1) }else{ jieTiArr.insert("\(price)_\(count)", at: cell.tag) - print(jieTiArr) jieTiArr.remove(at: cell.tag+1) } } @@ -638,7 +652,9 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl isJieTiOpen = dataDict.isJieTiOpen isOpenYSSetting = dataDict.isOpenYSSetting DJBiLi = dataDict.DJBiLi + isYsJieTiOpen = dataDict.isYsJieTiOpen ysKuCun = dataDict.ysKuCun + selectYuShou = dataDict.selectYuShou listTbv.reloadData() collectionView.reloadData() } diff --git "a/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/GuiGeModel.swift" "b/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/GuiGeModel.swift" index 4de08658bbdf411b8f98d1834decde23dd8c6a71..3784ee316522aa8a9fb98734d2b10ea547090f72 100644 --- "a/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/GuiGeModel.swift" +++ "b/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/GuiGeModel.swift" @@ -9,6 +9,8 @@ import Foundation class GuiGeModel: NSObject { + ///sku_id + var sku_id :Int? ///售价 var price : String = "" ///è§„æ ¼ @@ -39,4 +41,8 @@ class GuiGeModel: NSObject { var isJieTiOpen:Bool = false ///æ˜¯å¦æ‰“开预售设置 var isOpenYSSetting:Bool = false + ///æ˜¯å¦æ‰“开预售阶梯价 + var isYsJieTiOpen:Bool = false + ///是å¦é€‰æ‹©é¢„售阶梯 + var selectYuShou:Bool = false } diff --git "a/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/\346\231\256\351\200\232+\351\242\204\345\224\256header/TitleAndSwitchHeaderView.swift" "b/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/\346\231\256\351\200\232+\351\242\204\345\224\256header/TitleAndSwitchHeaderView.swift" index 8d9707b9cb9e637f03df86da295f6113e8534ef5..238e15990dca7c054e6208aeeadcd9464ddcf34a 100644 --- "a/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/\346\231\256\351\200\232+\351\242\204\345\224\256header/TitleAndSwitchHeaderView.swift" +++ "b/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/\346\231\256\351\200\232+\351\242\204\345\224\256header/TitleAndSwitchHeaderView.swift" @@ -17,15 +17,17 @@ class TitleAndSwitchHeaderView: UIView { @IBOutlet weak var bottomLine: UIView! var selectYuShou:Bool = false{ didSet{ + print("abababababab === ",selectYuShou) var sender = 0 if selectYuShou { sender = 1 leftBtn.setTitleColor(UIColor(named: "æ ‡é¢˜å—颜色"), for: .normal) rightBtn.setTitleColor(UIColor(named: "按钮æ¸å˜è‰²ä¸‹,å—体颜色"), for: .normal) + ysSettingView.isHidden = false }else{ leftBtn.setTitleColor(UIColor(named: "按钮æ¸å˜è‰²ä¸‹,å—体颜色"), for: .normal) rightBtn.setTitleColor(UIColor(named: "æ ‡é¢˜å—颜色"), for: .normal) - + ysSettingView.isHidden = true } let x = CGFloat(sender)*fullScreenWidth*0.5 bottomLine.snp.updateConstraints { (make) in @@ -38,6 +40,8 @@ class TitleAndSwitchHeaderView: UIView { } var contentView:UIView! var delegate:TitleAndSwitchHeaderViewDelegate? + @IBOutlet weak var ysSettingView: UIView! + @IBOutlet weak var ysInfoSw: UISwitch! @IBOutlet weak var infoSW: UISwitch! //åˆå§‹åŒ–æ—¶å°†xibä¸çš„viewæ·»åŠ è¿›æ¥ override init(frame: CGRect) { @@ -45,6 +49,14 @@ class TitleAndSwitchHeaderView: UIView { contentView = loadViewFromNib() addSubview(contentView) + + ysInfoSw.transform = CGAffineTransform(scaleX: 0.8, y: 0.8) + ysInfoSw.tag = 99 + ysInfoSw.addTarget(self, action: #selector(switchChange(sender:)), for: .valueChanged) + contentView.snp.makeConstraints { (make) in + make.left.top.right.bottom.equalToSuperview() + } + infoSW.transform = CGAffineTransform(scaleX: 0.8, y: 0.8) infoSW.addTarget(self, action: #selector(switchChange(sender:)), for: .valueChanged) contentView.snp.makeConstraints { (make) in diff --git "a/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/\346\231\256\351\200\232+\351\242\204\345\224\256header/TitleAndSwitchHeaderView.xib" "b/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/\346\231\256\351\200\232+\351\242\204\345\224\256header/TitleAndSwitchHeaderView.xib" index eb07ae0654305aa85e80a478cdc4501ad7c18f7f..13e4ef83ccb808ad92bc403834576b0e97273520 100644 --- "a/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/\346\231\256\351\200\232+\351\242\204\345\224\256header/TitleAndSwitchHeaderView.xib" +++ "b/GeliBusinessPlatform/ViewController/\346\226\260\345\242\236\350\247\204\346\240\274/\346\231\256\351\200\232+\351\242\204\345\224\256header/TitleAndSwitchHeaderView.xib" @@ -13,6 +13,8 @@ <outlet property="infoSW" destination="CB7-5d-TkX" id="NR3-4A-D6i"/> <outlet property="leftBtn" destination="Foa-mx-5Yx" id="T72-dm-y5o"/> <outlet property="rightBtn" destination="ybR-u7-XP4" id="Dk3-d2-gbZ"/> + <outlet property="ysInfoSw" destination="GMQ-8b-xpg" id="Qqe-Na-SeV"/> + <outlet property="ysSettingView" destination="II7-GR-59T" id="7M4-1t-9N5"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> @@ -77,12 +79,44 @@ </constraints> <color key="onTintColor" name="è“色å—体颜色"/> </switch> + <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="II7-GR-59T"> + <rect key="frame" x="0.0" y="10" width="375" height="52"/> + <subviews> + <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GMQ-8b-xpg"> + <rect key="frame" x="311" y="10" width="51" height="31"/> + <color key="onTintColor" name="è“色å—体颜色"/> + </switch> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fzO-2v-R5h"> + <rect key="frame" x="15" y="15" width="105" height="21"/> + <constraints> + <constraint firstAttribute="height" constant="21" id="dAn-sg-2eN"/> + </constraints> + <attributedString key="attributedText"> + <fragment content="预售阶梯价设置"> + <attributes> + <color key="NSColor" name="æ ‡é¢˜å—颜色"/> + <font key="NSFont" size="15" name="PingFangSC-Medium"/> + </attributes> + </fragment> + </attributedString> + <nil key="highlightedColor"/> + </label> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <constraints> + <constraint firstItem="fzO-2v-R5h" firstAttribute="top" secondItem="II7-GR-59T" secondAttribute="top" constant="15" id="Tr9-yg-lIC"/> + <constraint firstAttribute="trailing" secondItem="GMQ-8b-xpg" secondAttribute="trailing" constant="15" id="ZH7-e5-ZP3"/> + <constraint firstItem="GMQ-8b-xpg" firstAttribute="centerY" secondItem="fzO-2v-R5h" secondAttribute="centerY" id="ipq-Mm-XOP"/> + <constraint firstItem="fzO-2v-R5h" firstAttribute="leading" secondItem="II7-GR-59T" secondAttribute="leading" constant="15" id="ytg-81-7V9"/> + </constraints> + </view> </subviews> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstItem="76R-R0-pCI" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="4o5-ak-hVE"/> <constraint firstItem="FFu-OD-rc8" firstAttribute="top" secondItem="76R-R0-pCI" secondAttribute="bottom" constant="15" id="HvO-2g-yPj"/> <constraint firstAttribute="trailing" secondItem="FFu-OD-rc8" secondAttribute="trailing" id="JhF-wO-qGP"/> + <constraint firstItem="Foa-mx-5Yx" firstAttribute="top" secondItem="II7-GR-59T" secondAttribute="bottom" id="KFe-TD-fPY"/> <constraint firstAttribute="bottom" secondItem="Foa-mx-5Yx" secondAttribute="bottom" id="LS2-nW-eWp"/> <constraint firstItem="76R-R0-pCI" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="LrY-UI-RcR"/> <constraint firstAttribute="trailing" secondItem="ybR-u7-XP4" secondAttribute="trailing" id="NLC-no-i4E"/> @@ -91,12 +125,15 @@ <constraint firstItem="ybR-u7-XP4" firstAttribute="leading" secondItem="Foa-mx-5Yx" secondAttribute="trailing" id="S3X-IS-ztd"/> <constraint firstAttribute="trailing" secondItem="76R-R0-pCI" secondAttribute="trailing" id="Uth-qd-FUC"/> <constraint firstAttribute="bottom" secondItem="iUg-fe-DMN" secondAttribute="bottom" id="UyW-VQ-lzx"/> + <constraint firstAttribute="trailing" secondItem="II7-GR-59T" secondAttribute="trailing" id="Wsj-kO-7V7"/> <constraint firstItem="ybR-u7-XP4" firstAttribute="height" secondItem="Foa-mx-5Yx" secondAttribute="height" id="X7T-nQ-A6m"/> <constraint firstItem="CB7-5d-TkX" firstAttribute="centerY" secondItem="FFu-OD-rc8" secondAttribute="centerY" id="e18-MP-pNs"/> + <constraint firstItem="II7-GR-59T" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="eQr-UG-t4i"/> <constraint firstItem="FFu-OD-rc8" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="15" id="kCT-vS-1St"/> <constraint firstAttribute="trailing" secondItem="CB7-5d-TkX" secondAttribute="trailing" constant="15" id="ktE-YY-c70"/> <constraint firstItem="Foa-mx-5Yx" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="lve-Dd-EFp"/> <constraint firstAttribute="bottom" secondItem="ybR-u7-XP4" secondAttribute="bottom" id="ras-iE-35P"/> + <constraint firstItem="II7-GR-59T" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="sgG-cQ-N2v"/> <constraint firstItem="iUg-fe-DMN" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="u3M-i0-jPq"/> </constraints> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> @@ -113,6 +150,9 @@ <namedColor name="æ ‡é¢˜å—颜色"> <color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </namedColor> + <namedColor name="æ ‡é¢˜å—颜色"> + <color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + </namedColor> <namedColor name="ç°è‰²å—体颜色"> <color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </namedColor>