Commit 54d9e033 authored by lujunye's avatar lujunye

编辑界面待调整

parent ff005a84
......@@ -73,15 +73,12 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
listView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
listView.register(UINib(nibName: "DaiKeXiaDanGouWuCell", bundle: nil), forCellReuseIdentifier: "DaiKeXiaDanGouWuCell")
listView.register(UINib(nibName: "DKXDAdrCell", bundle: nil), forCellReuseIdentifier: "DKXDAdrCell")
let barView = UIView(frame: CGRect(x: 0, y: fullScreenHeight, width: fullScreenWidth, height: 30))
barView.backgroundColor = UIColor.red
self.view.insertSubview(barView, at: self.view.subviews.count)
barV = barView
//TitleAndBtnCell TitleAndTFCell
// Do any additional setup after loading the view.
registerNotification()
}
var barV:UIView?
//MARK: - cell delegate
func addAction() {
......@@ -376,40 +373,5 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
view.removeFromSuperview()
glSelectView = nil
}
//键盘监听
deinit {
NotificationCenter.default.removeObserver(self)
}
func registerNotification(){
NotificationCenter.default.addObserver(self,
selector: #selector(keyBoardWillShow(_ :)),
name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(keyBoardWillHide(_ :)),
name:UIResponder.keyboardWillHideNotification, object: nil)
}
//MARK:键盘通知相关操作
@objc func keyBoardWillShow(_ notification:Notification){
DispatchQueue.main.async {
let user_info = notification.userInfo
let keyValue = user_info!["UIKeyboardFrameEndUserInfoKey"]
let keyRect = (keyValue as AnyObject).cgRectValue
let y = keyRect?.origin.y
let animationTime = user_info!["UIKeyboardAnimationDurationUserInfoKey"]
UIView.animate(withDuration:0.38) {
self.barV?.frame = CGRect(x: 0, y: y!-30, width: fullScreenWidth, height: 30)
}
}
}
@objc func keyBoardWillHide(_ notification:Notification){
DispatchQueue.main.async {
UIView.animate(withDuration: 0.38) {
self.barV?.frame = CGRect(x: 0, y:fullScreenHeight, width: fullScreenWidth, height: 30)
}
}
}
}
......@@ -400,9 +400,13 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
for item in model.data!.sku_res! {
let dataSource = item
let data = GuiGeModel()
data.price = dataSource.price!//价格
data.danWei = dataSource.unit!//单位
data.sku_id = dataSource.sku_id!//sku_id
data.guiGe = dataSource.spec_str!//规格
let arr = dataSource.spec_str?.components(separatedBy: ":")
data.guiGe = (arr?.last)!//规格
data.weight = dataSource.pack_attr!//重量
data.wenDu = dataSource.refrigerate!//温藏
//预售设置
data.isOpenYSSetting = false
if dataSource.is_open_adsale! == 1 {
......@@ -438,6 +442,7 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
if dataSource.adsale_tiered_pri!.count > 0 {
data.specalArr = self.getResponseArr(str:dataSource.adsale_tiered_pri!)
}
print("data P = ",data.price)
self.guiGeArr.append(data)
}
}
......@@ -1046,15 +1051,15 @@ 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 {
dataDict = guiGeArr[selectIdx!.item]
}else{
dataDict = guiGeArr.first
}
print("abbabab=== ",dataDict.price)
vc.price = dataDict.price
vc.guiGe = dataDict.guiGe
vc.weight = dataDict.weight
......@@ -1470,15 +1475,15 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
goods_banner?.forEach({ (str) in
tempArr.append(str)
})
var data1:Array<Dictionary<String, String>> = []
var data1:Array<Dictionary<String, Any>> = []
tempArr.forEach({ (str) in
tempOldArr.forEach({ (model) in
if str == model.img_original! {
var data:Dictionary<String, String> = [:]
data.updateValue("\(goods_id)", forKey: "goods_id")
data.updateValue("\(model.img_id)", forKey: "img_id")
var data:Dictionary<String, Any> = [:]
data.updateValue(goods_id, forKey: "goods_id")
data.updateValue(model.img_id, forKey: "img_id")
data.updateValue(str, forKey: "banner_img")
data.updateValue("1", forKey: "status")
data.updateValue(1, forKey: "status")
data1.append(data)
}
})
......@@ -1486,26 +1491,30 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
data1.forEach { (dict) in
tempArr.forEach({ (str) in
if str == dict["banner_img"] {
let dic = dict
let str1 = dic["banner_img"] as! String
if str == str1{
let idx = tempArr.index(of: str)
tempArr.remove(at: idx!)
}
})
}
var data2:Array<Dictionary<String, String>> = []
var data2:Array<Dictionary<String, Any>> = []
for item in tempArr {
if item.count > 0 {
var data:Dictionary<String, String> = [:]
data.updateValue("\(goods_id)", forKey: "goods_id")
data.updateValue("0", forKey: "img_id")
var data:Dictionary<String, Any> = [:]
data.updateValue(goods_id, forKey: "goods_id")
data.updateValue(0, forKey: "img_id")
data.updateValue(item, forKey: "banner_img")
data.updateValue("2", forKey: "status")
data.updateValue(2, forKey: "status")
data2.append(data)
}
}
data1.forEach { (dict) in
tempOldArr.forEach({ (model) in
if model.img_original == dict["banner_img"]{
let dic = dict
let str1 = dic["banner_img"] as! String
if model.img_original == str1{
let idx = tempOldArr.firstIndex(where: { (data) -> Bool in
return (data.img_original == model.img_original)
})
......@@ -1513,30 +1522,21 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}
})
}
var data3:Array<Dictionary<String, String>> = []
var data3:Array<Dictionary<String, Any>> = []
for item in tempOldArr {
var data:Dictionary<String, String> = [:]
data.updateValue("\(goods_id)", forKey: "goods_id")
data.updateValue("\(item.img_id)", forKey: "img_id")
var data:Dictionary<String, Any> = [:]
data.updateValue(goods_id, forKey: "goods_id")
data.updateValue(item.img_id, forKey: "img_id")
data.updateValue(item.img_original!, forKey: "banner_img")
data.updateValue("3", forKey: "status")
data.updateValue(3, forKey: "status")
data3.append(data)
}
var data4 = data3 + data2 + data1
return changeAllDictToStr(arr: data4)
}
func changeAllDictToStr(arr:Array<Dictionary<String, String>>)->String{
var array:Array<String> = []
for item in arr {
array.append(dictChangeString(sender: item))
}
return dataChangeString(sender:array)
// return dataChangeString(sender:arr)
}
}
return dataChangeString(sender:data4)
}
}
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