Commit 00fc55b2 authored by lujunye's avatar lujunye

修复显示bug

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