Commit 00fc55b2 authored by lujunye's avatar lujunye

修复显示bug

parent 895a1aac
...@@ -1266,7 +1266,7 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo ...@@ -1266,7 +1266,7 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
vc.barTitle = "查看规格" vc.barTitle = "查看规格"
} }
vc.datasArr = guiGeArr vc.datasArr = guiGeArr
print("abbabab=== ",guiGeArr.count,selectIdx?.item)
vc.danWeiArr = generalInfoModel?.data?.unit! vc.danWeiArr = generalInfoModel?.data?.unit!
let dataDict:GuiGeModel! let dataDict:GuiGeModel!
if selectIdx?.item != nil { if selectIdx?.item != nil {
...@@ -1274,10 +1274,11 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo ...@@ -1274,10 +1274,11 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}else{ }else{
dataDict = guiGeArr.first dataDict = guiGeArr.first
} }
print("abbabab=== ",dataDict.price)
vc.price = dataDict.price vc.price = dataDict.price
vc.guiGe = dataDict.guiGe vc.guiGe = dataDict.guiGe
vc.weight = dataDict.weight vc.weight = dataDict.weight
print("dabnwei === ",dataDict.danWei)
vc.wenDu = dataDict.wenDu vc.wenDu = dataDict.wenDu
vc.danWei = dataDict.danWei vc.danWei = dataDict.danWei
vc.isJieTiOpen = dataDict.isJieTiOpen vc.isJieTiOpen = dataDict.isJieTiOpen
......
...@@ -150,23 +150,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -150,23 +150,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
HUD.flash(.label("请输入规格"), delay: 1.2) HUD.flash(.label("请输入规格"), delay: 1.2)
return return
} }
// if weight.count == 0 {
// HUD.flash(.label("请输入重量"), delay: 1.2)
// return
// }
// if isPurnNumber(str: weight) == false {
// HUD.flash(.label("请输入正确的重量"), delay: 1.2)
// return
// }
// if wenDu.count == 0 {
// HUD.flash(.label("请选择温藏"), delay: 1.2)
// return
// }
// if danWei.count == 0 {
// HUD.flash(.label("请选择单位"), delay: 1.2)
// return
// }
if isYuShouSetting { if isYuShouSetting {
if isPurnNumber(str: yuShouPrice) == false{ if isPurnNumber(str: yuShouPrice) == false{
HUD.flash(.label("请输入正确的预售价格"), delay: 1.2) HUD.flash(.label("请输入正确的预售价格"), delay: 1.2)
...@@ -262,479 +246,492 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -262,479 +246,492 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
} }
} }
func textFieldShouldReturn(_ textField: UITextField) -> Bool { func textFieldShouldReturn(_ textField: UITextField) -> Bool {
switch textField.tag { switch textField.tag {
case 1: case 1:
guiGe = textField.text! guiGe = textField.text!
break break
default: default:
break break
} }
return true return true
}
func PuTongJieTiClickDone() {
IQKeyboardManager.shared.resignFirstResponder()
}
//MARK: - cell delegate
func numberOfSections(in tableView: UITableView) -> Int {
if (navbar.title?.contains("编辑"))! {
return 4
}else{
return 3
} }
} func PuTongJieTiClickDone() {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { IQKeyboardManager.shared.resignFirstResponder()
if section == 0 {
return titleArray.count
} }
if section == 2 { //MARK: - cell delegate
if selectYuShou {//预售 func numberOfSections(in tableView: UITableView) -> Int {
return specalArr.count if (navbar.title?.contains("编辑"))! {
}else{//非预售 return 4
return jieTiArr.count }else{
return 3
} }
} }
return 1 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
}
if section == 0 {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { return titleArray.count
}
if indexPath.section == 0 { if section == 2 {
if indexPath.row < 3 { if selectYuShou {//预售
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell return specalArr.count
cell.nameLbl.text = titleArray[indexPath.row] }else{//非预售
cell.textTF.isUserInteractionEnabled = isAllEditing return jieTiArr.count
cell.tag = indexPath.row
cell.textTF.tag = cell.tag
//keyboardType
cell.textTF.returnKeyType = .done
cell.textTF.delegate = self
if indexPath.row == 0 || indexPath.row == 2{
cell.textTF.keyboardType = .decimalPad
} }
let str = NSAttributedString(string: pliceHolderArr[indexPath.row], attributes: [NSAttributedString.Key.foregroundColor:UIColor(named: "灰色字体颜色")]) }
cell.textTF.attributedPlaceholder = str return 1
if datasArr.count > 0 { }
switch indexPath.row {
case 0: func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
cell.textTF.text = price
break if indexPath.section == 0 {
case 1: if indexPath.row < 3 {
cell.textTF.text = guiGe let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
break cell.nameLbl.text = titleArray[indexPath.row]
default: cell.textTF.isUserInteractionEnabled = isAllEditing
cell.textTF.text = weight cell.tag = indexPath.row
break cell.textTF.tag = cell.tag
//keyboardType
cell.textTF.returnKeyType = .done
cell.textTF.delegate = self
if indexPath.row == 0 || indexPath.row == 2{
cell.textTF.keyboardType = .decimalPad
} }
let str = NSAttributedString(string: pliceHolderArr[indexPath.row], attributes: [NSAttributedString.Key.foregroundColor:UIColor(named: "灰色字体颜色")])
} cell.textTF.attributedPlaceholder = str
cell.delegate = self if datasArr.count > 0 {
return cell switch indexPath.row {
}else{ case 0:
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell cell.textTF.text = price
cell.tag = indexPath.row break
cell.btn.isUserInteractionEnabled = isAllEditing case 1:
cell.delegate = self cell.textTF.text = guiGe
cell.nameLbl.text = titleArray[indexPath.row] break
cell.contentLbl.text = pliceHolderArr[indexPath.row] default:
if indexPath.row == 3 { cell.textTF.text = weight
if tempSelect != nil { break
cell.contentLbl.text = selectListArr[tempSelect!] }
} }
} cell.delegate = self
if indexPath.row == 4 { return cell
if itemDanWeiSelect != nil { }else{
cell.contentLbl.text = danWeiArr![itemDanWeiSelect!] let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.tag = indexPath.row
cell.btn.isUserInteractionEnabled = isAllEditing
cell.delegate = self
cell.nameLbl.text = titleArray[indexPath.row]
cell.contentLbl.text = pliceHolderArr[indexPath.row]
if indexPath.row == 3 {
if tempSelect != nil {
cell.contentLbl.text = selectListArr[tempSelect!]
}
} }
} if indexPath.row == 4 {
if datasArr.count > 0 { if itemDanWeiSelect != nil {
switch indexPath.row { cell.contentLbl.text = danWeiArr![itemDanWeiSelect!]
case 3: }
cell.contentLbl.text = wenDu }
break if datasArr.count > 0 {
case 4: switch indexPath.row {
cell.contentLbl.text = danWei case 3:
break if wenDu.count > 0{
default: cell.contentLbl.text = wenDu
break }
break
case 4:
if danWei.count > 0 {
cell.contentLbl.text = danWei
}
break
default:
break
}
} }
return cell
} }
return cell
} }
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell cell.delegate = self
cell.delegate = self cell.namelbl.font = UIFont.boldSystemFont(ofSize: 15)
cell.namelbl.font = UIFont.boldSystemFont(ofSize: 15) cell.infoSw.isUserInteractionEnabled = isAllEditing
cell.infoSw.isUserInteractionEnabled = isAllEditing if indexPath.section == 1{
if indexPath.section == 1{ cell.namelbl.text = "预售设置"
cell.namelbl.text = "预售设置" if isYuShouSetting == false{
if isYuShouSetting == false{ isOpenYSSetting = isYuShouSetting
isOpenYSSetting = isYuShouSetting cell.namelbl.alpha = 0.45
cell.namelbl.alpha = 0.45 cell.isUserInteractionEnabled = false
cell.isUserInteractionEnabled = false }else{
}else{ cell.infoSw.isOn = isOpenYSSetting
cell.infoSw.isOn = isOpenYSSetting }
cell.tag = 5
} }
cell.tag = 5
} if indexPath.section == 1 {
if isYuShouSetting == true {
if indexPath.section == 1 { let cell = tableView.dequeueReusableCell(withIdentifier: "YuShou") as! YuShouCell
if isYuShouSetting == true { cell.inputTF1.isUserInteractionEnabled = isAllEditing
let cell = tableView.dequeueReusableCell(withIdentifier: "YuShou") as! YuShouCell cell.inputTF2.isUserInteractionEnabled = isAllEditing
cell.inputTF1.isUserInteractionEnabled = isAllEditing cell.inputTF2.keyboardType = .numberPad
cell.inputTF2.isUserInteractionEnabled = isAllEditing cell.inputTF3.isUserInteractionEnabled = isAllEditing
cell.inputTF2.keyboardType = .numberPad cell.tag = indexPath.row
cell.inputTF3.isUserInteractionEnabled = isAllEditing cell.infoSw.isUserInteractionEnabled = isAllEditing
cell.tag = indexPath.row cell.infoSw.isOn = isOpenYSSetting
cell.infoSw.isUserInteractionEnabled = isAllEditing cell.delegate = self
cell.infoSw.isOn = isOpenYSSetting cell.inputTF1.text = yuShouPrice
cell.inputTF2.text = ysKuCun
cell.inputTF3.text = DJBiLi
return cell
}
}
if indexPath.section == 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "PuTongJieTi") as! PuTongJieTiCell
cell.btn.isUserInteractionEnabled = isAllEditing
cell.delegate = self cell.delegate = self
cell.inputTF1.text = yuShouPrice cell.titleLbl.text = "\(indexPath.row+1).数量≥"
cell.inputTF2.text = ysKuCun cell.tag = indexPath.row
cell.inputTF3.text = DJBiLi cell.countTF.isUserInteractionEnabled = isAllEditing
cell.priceTF.isUserInteractionEnabled = isAllEditing
cell.isYuShou = selectYuShou
cell.countTF.text = ""
cell.priceTF.text = ""
var item:NSString = ""
if selectYuShou {
item = specalArr[indexPath.row] as! NSString
}else{
item = jieTiArr[indexPath.row] as! NSString
}
if item != "" {
//MARK:--阶梯价格切割
let arr = item.components(separatedBy: "_")
cell.priceTF.text = arr[0]
cell.countTF.text = arr[1]
}
return cell return cell
} }
} if indexPath.section == 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: "DelGuiGe") as! DelGuiGeCell
if indexPath.section == 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "PuTongJieTi") as! PuTongJieTiCell return cell
cell.btn.isUserInteractionEnabled = isAllEditing
cell.delegate = self
cell.titleLbl.text = "\(indexPath.row+1).数量≥"
cell.tag = indexPath.row
cell.countTF.isUserInteractionEnabled = isAllEditing
cell.priceTF.isUserInteractionEnabled = isAllEditing
cell.isYuShou = selectYuShou
cell.countTF.text = ""
cell.priceTF.text = ""
var item:NSString = ""
if selectYuShou {
item = specalArr[indexPath.row] as! NSString
}else{
item = jieTiArr[indexPath.row] as! NSString
}
if item != "" {
//MARK:--阶梯价格切割
let arr = item.components(separatedBy: "_")
cell.priceTF.text = arr[0]
cell.countTF.text = arr[1]
} }
return cell return cell
}
if indexPath.section == 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: "DelGuiGe") as! DelGuiGeCell
return cell
} }
return cell func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if isAllEditing == false {
} return
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { }
if isAllEditing == false { if indexPath.section == 3 {
return //删除
} datasArr.remove(at: selectIdx!.item)
if indexPath.section == 3 { var num = 0
//删除 if selectIdx!.item > 0 {
datasArr.remove(at: selectIdx!.item) num = selectIdx!.item - 1
var num = 0 }
if selectIdx!.item > 0 { let idx = IndexPath(item: num, section: 0)
num = selectIdx!.item - 1
} delegate?.CreatNewSpecsViewControllerDeleteAction(datas: datasArr,selectIdx:idx)
let idx = IndexPath(item: num, section: 0) self.navigationController?.popViewController(animated: true)
delegate?.CreatNewSpecsViewControllerDeleteAction(datas: datasArr,selectIdx:idx)
self.navigationController?.popViewController(animated: true)
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 1 {
if isOpenYSSetting {
return 184.5
} }
} }
if indexPath.section == 2 { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if isJieTiOpen && selectYuShou == false { if indexPath.section == 1 {
return 49 if isOpenYSSetting {
return 184.5
}
} }
if isYsJieTiOpen && selectYuShou { if indexPath.section == 2 {
return 49 if isJieTiOpen && selectYuShou == false {
return 49
}
if isYsJieTiOpen && selectYuShou {
return 49
}
return 0.001
} }
return 0.001 return 49
} }
return 49
} //header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
//header let view = UIView()
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { if section == 2 {//阶梯价设置
let view = UIView() if isYuShouSetting {//预售阶梯价
if section == 2 {//阶梯价设置 let view = TitleAndSwitchHeaderView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 90))
if isYuShouSetting {//预售阶梯价 view.infoSW.isUserInteractionEnabled = isAllEditing
let view = TitleAndSwitchHeaderView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 90)) view.ysInfoSw.isUserInteractionEnabled = isAllEditing
view.infoSW.isUserInteractionEnabled = isAllEditing view.delegate = self
view.ysInfoSw.isUserInteractionEnabled = isAllEditing view.selectYuShou = selectYuShou
view.delegate = self view.infoSW.isOn = isJieTiOpen//普通
view.selectYuShou = selectYuShou view.ysInfoSw.isOn = isYsJieTiOpen//预售
view.infoSW.isOn = isJieTiOpen//普通 return view
view.ysInfoSw.isOn = isYsJieTiOpen//预售 }else{//普通
return view let view = NewCreateHeader(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49))
}else{//普通 view.delegate = self
let view = NewCreateHeader(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49)) view.infoSw.isUserInteractionEnabled = isAllEditing
view.delegate = self view.infoSw.isOn = isJieTiOpen
view.infoSw.isUserInteractionEnabled = isAllEditing if isJieTiOpen == false{
view.infoSw.isOn = isJieTiOpen return view
if isJieTiOpen == false{ }
return view return view
} }
return view
} }
return view
} }
return view func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
} if section != 0 {
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { if section == 2 {
if section != 0 { if isYuShouSetting{
return 90
}
return 59
}
return 10
}
return 0.01
}
//footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if section == 2 { if section == 2 {
if isYuShouSetting{ if barTitle?.contains("查看") == false {
return 90 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
}
} }
return 59
} }
return 10 let view = UIView()
return view
} }
return 0.01 func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
} if section == 2 {
//footer if isJieTiOpen && selectYuShou == false {
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { return 49
if section == 2 {
if barTitle?.contains("查看") == false {
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{ if isYsJieTiOpen && selectYuShou{
let view = NewCreateFooter(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49)) return 49
view.delegate = self
return view
} }
} }
return 0.01
} }
let view = UIView() //MARK: - NEW CELL DELEGATE
return view
} func YuShouCellTFContent(Price: NSString) {
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { let arr = Price.components(separatedBy: "_")
if section == 2 { yuShouPrice = arr[0]
if isJieTiOpen && selectYuShou == false { ysKuCun = arr[1]
return 49 DJBiLi = arr[2]
} }
if isYsJieTiOpen && selectYuShou{ func textFieldContent(content: String, cell: TitleAndTFCell) {
return 49 switch cell.tag {
case 0:
price = content
break
case 1:
guiGe = content
break
default:
weight = content
break
} }
} }
return 0.01 func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
} let cell = listTbv.cellForRow(at: IndexPath(row: view.tag, section: 0)) as! TitleAndBtnCell
//MARK: - NEW CELL DELEGATE if view.tag == 3 {
tempSelect = selectNum
func YuShouCellTFContent(Price: NSString) { wenDu = selectListArr[selectNum]
let arr = Price.components(separatedBy: "_") cell.contentLbl.text = selectListArr[selectNum]
yuShouPrice = arr[0] }else{
ysKuCun = arr[1] itemDanWeiSelect = selectNum
DJBiLi = arr[2] cell.contentLbl.text = danWeiArr![selectNum]
} danWei = danWeiArr![selectNum]
func textFieldContent(content: String, cell: TitleAndTFCell) { }
switch cell.tag {
case 0:
price = content selectView?.removeFromSuperview()
break selectView = nil
case 1:
guiGe = content
break
default:
weight = content
break
}
}
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
let cell = listTbv.cellForRow(at: IndexPath(row: view.tag, section: 0)) as! TitleAndBtnCell
if view.tag == 3 {
tempSelect = selectNum
wenDu = selectListArr[selectNum]
cell.contentLbl.text = selectListArr[selectNum]
}else{
itemDanWeiSelect = selectNum
cell.contentLbl.text = danWeiArr![selectNum]
danWei = danWeiArr![selectNum]
} }
selectView?.removeFromSuperview()
selectView = nil
} var tempSelect:Int?
var itemDanWeiSelect:Int?
func btnClick(content: String, cell: TitleAndBtnCell) {
if cell.tag == 3 {
var tempSelect:Int? if selectView == nil {
var itemDanWeiSelect:Int? let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
func btnClick(content: String, cell: TitleAndBtnCell) { view.titleLbl.text = "请选择商品温藏"
if cell.tag == 3 { view.delegate = self
if selectView == nil { view.dataArr = selectListArr
let view = GLAlertSelectView(frame: self.view.bounds) for i in 0 ..< selectListArr.count{
view.tag = cell.tag if wenDu == selectListArr[i] {
view.titleLbl.text = "请选择商品温藏" tempSelect = i
view.delegate = self }
view.dataArr = selectListArr }
if tempSelect != nil { if tempSelect != nil {
view.selectNum = tempSelect! view.selectNum = tempSelect!
view.tempNum = view.selectNum view.tempNum = view.selectNum
} }
self.view.addSubview(view) self.view.addSubview(view)
selectView = view selectView = view
}
}else{
if selectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择商品单位"
view.delegate = self
if itemDanWeiSelect != nil {
view.selectNum = itemDanWeiSelect!
} }
}else{
if danWeiArr != nil { if selectView == nil {
view.dataArr = danWeiArr! let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择商品单位"
view.delegate = self
if danWeiArr != nil {
view.dataArr = danWeiArr!
for i in 0 ..< danWeiArr!.count{
if danWei == danWeiArr![i] {
itemDanWeiSelect = i
}
}
}
if itemDanWeiSelect != nil {
view.selectNum = itemDanWeiSelect!
}
self.view.addSubview(view)
selectView = view
} }
self.view.addSubview(view)
selectView = view
} }
} }
} func switchStatus(sender: UISwitch) {//阶梯价设置
if sender.tag == 99 {
func switchStatus(sender: UISwitch) {//阶梯价设置 isYsJieTiOpen = sender.isOn
if sender.tag == 99 { }else{
isYsJieTiOpen = sender.isOn isJieTiOpen = sender.isOn
}else{
isJieTiOpen = sender.isOn
}
listTbv.reloadData()
}
func switchClick(content: UISwitch, cell: TitleAndSwitchCell) {
//控制
if cell.tag == 5{
let idxPath = IndexPath(row: 0, section: 1)
if isYuShouSetting && isOpenYSSetting {//单独点击预售设置
listTbv.reloadData()
}else{//单独打开预售设置
listTbv.reloadRows(at: [idxPath], with: .none)
} }
listTbv.reloadData()
} }
} func switchClick(content: UISwitch, cell: TitleAndSwitchCell) {
func newCreateSwitchStatus(sender: UISwitch) { //控制
//打开switch 阶梯价设置 if cell.tag == 5{
// isJieTiJiaSetting = sender.isOn let idxPath = IndexPath(row: 0, section: 1)
isJieTiOpen = sender.isOn if isYuShouSetting && isOpenYSSetting {//单独点击预售设置
listTbv.reloadData() listTbv.reloadData()
} }else{//单独打开预售设置
listTbv.reloadRows(at: [idxPath], with: .none)
func footerClickAction() { }
if isAllEditing == false { }
return
} }
print(jieTiArr) func newCreateSwitchStatus(sender: UISwitch) {
if selectYuShou {//预售 //打开switch 阶梯价设置
specalArr.append("") // isJieTiJiaSetting = sender.isOn
}else{//非预售 isJieTiOpen = sender.isOn
jieTiArr.append("") listTbv.reloadData()
} }
listTbv.reloadData()
} func footerClickAction() {
func YuShouCellSwitchStatus(sender: UISwitch) { if isAllEditing == false {
//控制 return
// isYuShouSetting = sender.isOn }
isOpenYSSetting = sender.isOn print(jieTiArr)
listTbv.reloadData() if selectYuShou {//预售
} specalArr.append("")
func PuTongJieTiDelAction(sender: PuTongJieTiCell) { }else{//非预售
if selectYuShou { jieTiArr.append("")
specalArr.remove(at: sender.tag) }
listTbv.reloadData() listTbv.reloadData()
}else{ }
jieTiArr.remove(at: sender.tag) func YuShouCellSwitchStatus(sender: UISwitch) {
//控制
// isYuShouSetting = sender.isOn
isOpenYSSetting = sender.isOn
listTbv.reloadData() listTbv.reloadData()
} }
func PuTongJieTiDelAction(sender: PuTongJieTiCell) {
if selectYuShou {
specalArr.remove(at: sender.tag)
listTbv.reloadData()
}else{
jieTiArr.remove(at: sender.tag)
listTbv.reloadData()
}
}
func PuTongJieTiContentSp(price: String, count: String, cell: PuTongJieTiCell) {
specalArr.insert("\(price)_\(count)", at: cell.tag)
specalArr.remove(at: cell.tag+1)
}
func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) {
jieTiArr.insert("\(price)_\(count)", at: cell.tag)
jieTiArr.remove(at: cell.tag+1)
}
} func selectYuShou(sender: UIButton) {
func PuTongJieTiContentSp(price: String, count: String, cell: PuTongJieTiCell) { if sender.tag == 0 {
specalArr.insert("\(price)_\(count)", at: cell.tag) selectYuShou = false
specalArr.remove(at: cell.tag+1) }else{
} selectYuShou = true
func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) { }
listTbv.reloadData()
jieTiArr.insert("\(price)_\(count)", at: cell.tag) }
jieTiArr.remove(at: cell.tag+1) //MARK: - COLLECTIONVIEW DELEGATE
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
} return 0
}
func selectYuShou(sender: UIButton) { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
if sender.tag == 0 { return datasArr.count
selectYuShou = false
}else{
selectYuShou = true
} }
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 datasArr.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath)
as! ItemCell
cell.tag = indexPath.item
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, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath)
selectIdx = indexPath as! ItemCell
//刷新cell cell.tag = indexPath.item
let dataDict = datasArr[selectIdx!.item] cell.nameLbl.text = "规格" + "\(indexPath.item+1)"
price = dataDict.price if indexPath == selectIdx {
guiGe = dataDict.guiGe cell.nameLbl.textColor = UIColor(named: "蓝色字体颜色")
weight = dataDict.weight cell.lineView.isHidden = false
wenDu = dataDict.wenDu }else{
danWei = dataDict.danWei cell.nameLbl.textColor = UIColor(named: "标题字颜色")
yuShouPrice = dataDict.yuShouPrice cell.lineView.isHidden = true
specalArr = dataDict.specalArr }
jieTiArr = dataDict.jieTiArr return cell
isJieTiOpen = dataDict.isJieTiOpen
isOpenYSSetting = dataDict.isOpenYSSetting }
DJBiLi = dataDict.DJBiLi func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
isYsJieTiOpen = dataDict.isYsJieTiOpen selectIdx = indexPath
ysKuCun = dataDict.ysKuCun //刷新cell
selectYuShou = dataDict.selectYuShou let dataDict = datasArr[selectIdx!.item]
listTbv.reloadData() price = dataDict.price
collectionView.reloadData() guiGe = dataDict.guiGe
} weight = dataDict.weight
wenDu = dataDict.wenDu
danWei = dataDict.danWei
yuShouPrice = dataDict.yuShouPrice
specalArr = dataDict.specalArr
jieTiArr = dataDict.jieTiArr
isJieTiOpen = dataDict.isJieTiOpen
isOpenYSSetting = dataDict.isOpenYSSetting
DJBiLi = dataDict.DJBiLi
isYsJieTiOpen = dataDict.isYsJieTiOpen
ysKuCun = dataDict.ysKuCun
selectYuShou = dataDict.selectYuShou
listTbv.reloadData()
collectionView.reloadData()
}
} }
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