Commit 030e2ce0 authored by 刘俊宏's avatar 刘俊宏

修正个人中心获取数据逻辑+修正商品管理总数显示bug

parent 1337df96
...@@ -24,16 +24,18 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable ...@@ -24,16 +24,18 @@ class PersonCenterViewController: BaseViewController,UITableViewDelegate,UITable
//MARK:--加载数据 //MARK:--加载数据
func loadData(){ func loadData(){
if self.dataModel != nil {
return
}
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
HUD.flash(.progress) HUD.flash(.progress)
adminInfo(["user_token":UserToken as Any], success: { (data) in adminInfo(["user_token":UserToken as Any], success: { (data) in
HUD.hide() HUD.hide()
self.dataModel = (data as! AdminInfoModel) self.dataModel = (data as! AdminInfoModel)
// self.iconImg.sd_setImage(with: URL(string: SERVERCE_ImageHost + (self.dataModel?.data?.shop_img)!), placeholderImage: UIImage.init(named: "个人设置头像"))
self.shopNameLbl.text = self.dataModel?.data?.stall_name self.shopNameLbl.text = self.dataModel?.data?.stall_name
self.nameLbl.text = self.nowDateStr() self.nameLbl.text = self.nowDateStr()
}) { (error) in }) { (error) in
HUD.hide()
} }
} }
func nowDateStr() -> String { func nowDateStr() -> String {
......
...@@ -34,6 +34,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect ...@@ -34,6 +34,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
//MARK:--数据处理字段 //MARK:--数据处理字段
var items = Array<GoodsResModel>() var items = Array<GoodsResModel>()
var itemsSearch = Array<GoodsResModel>() var itemsSearch = Array<GoodsResModel>()
var itemsAllCount = 0
var selectIndexArr = [0,0,0] var selectIndexArr = [0,0,0]
var showSelectvIndex = 0 var showSelectvIndex = 0
var isSearch = false var isSearch = false
...@@ -130,7 +131,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect ...@@ -130,7 +131,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
} }
getSortData () getSortData ()
itemsAllCount = 0
goodsList(["user_token":UserToken as Any,"keyword":keyword,"goods_type":goodsType,"sort":sort,"is_show":isShow,"page":page], success: { (data) in goodsList(["user_token":UserToken as Any,"keyword":keyword,"goods_type":goodsType,"sort":sort,"is_show":isShow,"page":page], success: { (data) in
let dataM = data as! GoodsListModel let dataM = data as! GoodsListModel
if self.isSearch { if self.isSearch {
...@@ -138,12 +139,14 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect ...@@ -138,12 +139,14 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
self.itemsSearch.removeAll() self.itemsSearch.removeAll()
dataM.data?.goods_res?.forEach({ (model) in dataM.data?.goods_res?.forEach({ (model) in
self.itemsSearch.append(model) self.itemsSearch.append(model)
self.itemsAllCount = dataM.data?.count as! Int
}) })
}else{ }else{
self.pageNum = 2 self.pageNum = 2
self.items.removeAll() self.items.removeAll()
dataM.data?.goods_res?.forEach({ (model) in dataM.data?.goods_res?.forEach({ (model) in
self.items.append(model) self.items.append(model)
self.itemsAllCount = dataM.data?.count as! Int
}) })
} }
//collection动画效果 //collection动画效果
...@@ -360,13 +363,13 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect ...@@ -360,13 +363,13 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
let headerLbl = UILabel(frame: CGRect(x: 15*glscale, y: 10*glscale, width: 100*glscale, height: 20*glscale)) let headerLbl = UILabel(frame: CGRect(x: 15*glscale, y: 10*glscale, width: 100*glscale, height: 20*glscale))
if isSearch { if isSearch {
if itemsSearch.count > 0 { if itemsSearch.count > 0 {
headerLbl.text = "共" + StringByInt(number: itemsSearch.count) + "件商品" headerLbl.text = "共" + StringByInt(number: self.itemsAllCount) + "件商品"
}else{ }else{
headerLbl.text = "" headerLbl.text = ""
} }
}else{ }else{
if items.count > 0 { if items.count > 0 {
headerLbl.text = "共" + StringByInt(number: items.count) + "件商品" headerLbl.text = "共" + StringByInt(number: self.itemsAllCount) + "件商品"
}else{ }else{
headerLbl.text = "" headerLbl.text = ""
} }
......
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