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,7 +246,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -262,7 +246,7 @@ 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!
...@@ -271,19 +255,19 @@ func textFieldShouldReturn(_ textField: UITextField) -> Bool { ...@@ -271,19 +255,19 @@ func textFieldShouldReturn(_ textField: UITextField) -> Bool {
break break
} }
return true return true
} }
func PuTongJieTiClickDone() { func PuTongJieTiClickDone() {
IQKeyboardManager.shared.resignFirstResponder() IQKeyboardManager.shared.resignFirstResponder()
} }
//MARK: - cell delegate //MARK: - cell delegate
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
if (navbar.title?.contains("编辑"))! { if (navbar.title?.contains("编辑"))! {
return 4 return 4
}else{ }else{
return 3 return 3
} }
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 { if section == 0 {
return titleArray.count return titleArray.count
...@@ -296,9 +280,9 @@ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> ...@@ -296,9 +280,9 @@ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) ->
} }
} }
return 1 return 1
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 { if indexPath.section == 0 {
if indexPath.row < 3 { if indexPath.row < 3 {
...@@ -351,10 +335,14 @@ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> U ...@@ -351,10 +335,14 @@ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> U
if datasArr.count > 0 { if datasArr.count > 0 {
switch indexPath.row { switch indexPath.row {
case 3: case 3:
if wenDu.count > 0{
cell.contentLbl.text = wenDu cell.contentLbl.text = wenDu
}
break break
case 4: case 4:
if danWei.count > 0 {
cell.contentLbl.text = danWei cell.contentLbl.text = danWei
}
break break
default: default:
break break
...@@ -433,8 +421,8 @@ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> U ...@@ -433,8 +421,8 @@ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> U
} }
return cell return cell
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if isAllEditing == false { if isAllEditing == false {
return return
} }
...@@ -451,8 +439,8 @@ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { ...@@ -451,8 +439,8 @@ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 1 { if indexPath.section == 1 {
if isOpenYSSetting { if isOpenYSSetting {
return 184.5 return 184.5
...@@ -469,10 +457,10 @@ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> ...@@ -469,10 +457,10 @@ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) ->
} }
return 49 return 49
} }
//header //header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView() let view = UIView()
if section == 2 {//阶梯价设置 if section == 2 {//阶梯价设置
if isYuShouSetting {//预售阶梯价 if isYuShouSetting {//预售阶梯价
...@@ -496,8 +484,8 @@ func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> ...@@ -496,8 +484,8 @@ func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) ->
} }
} }
return view return view
} }
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section != 0 { if section != 0 {
if section == 2 { if section == 2 {
if isYuShouSetting{ if isYuShouSetting{
...@@ -508,9 +496,9 @@ func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) ...@@ -508,9 +496,9 @@ func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int)
return 10 return 10
} }
return 0.01 return 0.01
} }
//footer //footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if section == 2 { if section == 2 {
if barTitle?.contains("查看") == false { if barTitle?.contains("查看") == false {
if isJieTiOpen && selectYuShou == false{ if isJieTiOpen && selectYuShou == false{
...@@ -527,8 +515,8 @@ func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> ...@@ -527,8 +515,8 @@ func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) ->
} }
let view = UIView() let view = UIView()
return view return view
} }
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == 2 { if section == 2 {
if isJieTiOpen && selectYuShou == false { if isJieTiOpen && selectYuShou == false {
return 49 return 49
...@@ -538,16 +526,16 @@ func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) ...@@ -538,16 +526,16 @@ func tableView(_ tableView: UITableView, heightForFooterInSection section: Int)
} }
} }
return 0.01 return 0.01
} }
//MARK: - NEW CELL DELEGATE //MARK: - NEW CELL DELEGATE
func YuShouCellTFContent(Price: NSString) { func YuShouCellTFContent(Price: NSString) {
let arr = Price.components(separatedBy: "_") let arr = Price.components(separatedBy: "_")
yuShouPrice = arr[0] yuShouPrice = arr[0]
ysKuCun = arr[1] ysKuCun = arr[1]
DJBiLi = arr[2] DJBiLi = arr[2]
} }
func textFieldContent(content: String, cell: TitleAndTFCell) { func textFieldContent(content: String, cell: TitleAndTFCell) {
switch cell.tag { switch cell.tag {
case 0: case 0:
price = content price = content
...@@ -559,8 +547,8 @@ func textFieldContent(content: String, cell: TitleAndTFCell) { ...@@ -559,8 +547,8 @@ func textFieldContent(content: String, cell: TitleAndTFCell) {
weight = content weight = content
break break
} }
} }
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) { func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
let cell = listTbv.cellForRow(at: IndexPath(row: view.tag, section: 0)) as! TitleAndBtnCell let cell = listTbv.cellForRow(at: IndexPath(row: view.tag, section: 0)) as! TitleAndBtnCell
if view.tag == 3 { if view.tag == 3 {
tempSelect = selectNum tempSelect = selectNum
...@@ -575,15 +563,15 @@ func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) { ...@@ -575,15 +563,15 @@ func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
selectView?.removeFromSuperview() selectView?.removeFromSuperview()
selectView = nil selectView = nil
} }
var tempSelect:Int? var tempSelect:Int?
var itemDanWeiSelect:Int? var itemDanWeiSelect:Int?
func btnClick(content: String, cell: TitleAndBtnCell) { func btnClick(content: String, cell: TitleAndBtnCell) {
if cell.tag == 3 { if cell.tag == 3 {
if selectView == nil { if selectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds) let view = GLAlertSelectView(frame: self.view.bounds)
...@@ -591,6 +579,11 @@ func btnClick(content: String, cell: TitleAndBtnCell) { ...@@ -591,6 +579,11 @@ func btnClick(content: String, cell: TitleAndBtnCell) {
view.titleLbl.text = "请选择商品温藏" view.titleLbl.text = "请选择商品温藏"
view.delegate = self view.delegate = self
view.dataArr = selectListArr view.dataArr = selectListArr
for i in 0 ..< selectListArr.count{
if wenDu == selectListArr[i] {
tempSelect = i
}
}
if tempSelect != nil { if tempSelect != nil {
view.selectNum = tempSelect! view.selectNum = tempSelect!
view.tempNum = view.selectNum view.tempNum = view.selectNum
...@@ -604,30 +597,34 @@ func btnClick(content: String, cell: TitleAndBtnCell) { ...@@ -604,30 +597,34 @@ func btnClick(content: String, cell: TitleAndBtnCell) {
view.tag = cell.tag view.tag = cell.tag
view.titleLbl.text = "请选择商品单位" view.titleLbl.text = "请选择商品单位"
view.delegate = self view.delegate = self
if itemDanWeiSelect != nil {
view.selectNum = itemDanWeiSelect!
}
if danWeiArr != nil { if danWeiArr != nil {
view.dataArr = danWeiArr! 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) self.view.addSubview(view)
selectView = view selectView = view
} }
} }
} }
func switchStatus(sender: UISwitch) {//阶梯价设置 func switchStatus(sender: UISwitch) {//阶梯价设置
if sender.tag == 99 { if sender.tag == 99 {
isYsJieTiOpen = sender.isOn isYsJieTiOpen = sender.isOn
}else{ }else{
isJieTiOpen = sender.isOn isJieTiOpen = sender.isOn
} }
listTbv.reloadData() listTbv.reloadData()
} }
func switchClick(content: UISwitch, cell: TitleAndSwitchCell) { func switchClick(content: UISwitch, cell: TitleAndSwitchCell) {
//控制 //控制
if cell.tag == 5{ if cell.tag == 5{
let idxPath = IndexPath(row: 0, section: 1) let idxPath = IndexPath(row: 0, section: 1)
...@@ -638,15 +635,15 @@ func switchClick(content: UISwitch, cell: TitleAndSwitchCell) { ...@@ -638,15 +635,15 @@ func switchClick(content: UISwitch, cell: TitleAndSwitchCell) {
} }
} }
} }
func newCreateSwitchStatus(sender: UISwitch) { func newCreateSwitchStatus(sender: UISwitch) {
//打开switch 阶梯价设置 //打开switch 阶梯价设置
// isJieTiJiaSetting = sender.isOn // isJieTiJiaSetting = sender.isOn
isJieTiOpen = sender.isOn isJieTiOpen = sender.isOn
listTbv.reloadData() listTbv.reloadData()
} }
func footerClickAction() { func footerClickAction() {
if isAllEditing == false { if isAllEditing == false {
return return
} }
...@@ -657,14 +654,14 @@ func footerClickAction() { ...@@ -657,14 +654,14 @@ func footerClickAction() {
jieTiArr.append("") jieTiArr.append("")
} }
listTbv.reloadData() listTbv.reloadData()
} }
func YuShouCellSwitchStatus(sender: UISwitch) { func YuShouCellSwitchStatus(sender: UISwitch) {
//控制 //控制
// isYuShouSetting = sender.isOn // isYuShouSetting = sender.isOn
isOpenYSSetting = sender.isOn isOpenYSSetting = sender.isOn
listTbv.reloadData() listTbv.reloadData()
} }
func PuTongJieTiDelAction(sender: PuTongJieTiCell) { func PuTongJieTiDelAction(sender: PuTongJieTiCell) {
if selectYuShou { if selectYuShou {
specalArr.remove(at: sender.tag) specalArr.remove(at: sender.tag)
listTbv.reloadData() listTbv.reloadData()
...@@ -673,35 +670,35 @@ func PuTongJieTiDelAction(sender: PuTongJieTiCell) { ...@@ -673,35 +670,35 @@ func PuTongJieTiDelAction(sender: PuTongJieTiCell) {
listTbv.reloadData() listTbv.reloadData()
} }
} }
func PuTongJieTiContentSp(price: String, count: String, cell: PuTongJieTiCell) { func PuTongJieTiContentSp(price: String, count: String, cell: PuTongJieTiCell) {
specalArr.insert("\(price)_\(count)", at: cell.tag) specalArr.insert("\(price)_\(count)", at: cell.tag)
specalArr.remove(at: cell.tag+1) specalArr.remove(at: cell.tag+1)
} }
func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) { func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) {
jieTiArr.insert("\(price)_\(count)", at: cell.tag) jieTiArr.insert("\(price)_\(count)", at: cell.tag)
jieTiArr.remove(at: cell.tag+1) jieTiArr.remove(at: cell.tag+1)
} }
func selectYuShou(sender: UIButton) { func selectYuShou(sender: UIButton) {
if sender.tag == 0 { if sender.tag == 0 {
selectYuShou = false selectYuShou = false
}else{ }else{
selectYuShou = true selectYuShou = true
} }
listTbv.reloadData() listTbv.reloadData()
} }
//MARK: - COLLECTIONVIEW DELEGATE //MARK: - COLLECTIONVIEW DELEGATE
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0 return 0
} }
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return datasArr.count return datasArr.count
} }
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath) let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath)
as! ItemCell as! ItemCell
cell.tag = indexPath.item cell.tag = indexPath.item
...@@ -715,8 +712,8 @@ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: ...@@ -715,8 +712,8 @@ func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath:
} }
return cell return cell
} }
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIdx = indexPath selectIdx = indexPath
//刷新cell //刷新cell
let dataDict = datasArr[selectIdx!.item] let dataDict = datasArr[selectIdx!.item]
...@@ -736,5 +733,5 @@ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPat ...@@ -736,5 +733,5 @@ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPat
selectYuShou = dataDict.selectYuShou selectYuShou = dataDict.selectYuShou
listTbv.reloadData() listTbv.reloadData()
collectionView.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