Commit 58e686eb authored by lujunye's avatar lujunye

21

parent 8553b67a
......@@ -234,7 +234,7 @@ class getsupList_Data_model: Mappable {
class selAgeDbtGoodsList_model: Mappable {
var code:Int?
var message : String?
var data :Array<selAgeDbtGoodsList_Data_model>?
var data :selAgeDbtGoodsList_Data_model?
required init?( map: Map) {
......@@ -246,6 +246,20 @@ class selAgeDbtGoodsList_model: Mappable {
}
}
class selAgeDbtGoodsList_Data_model: Mappable {
var sum_goods:Int?
var sum_goods2 : Int?
var res :Array<selAgeDbtGoodsList_Data_D_model>?
required init?( map: Map) {
}
func mapping(map: Map) {
sum_goods <- map["sum_goods"]
sum_goods2 <- map["sum_goods2"]
res <- map["res"]
}
}
class selAgeDbtGoodsList_Data_D_model: Mappable {
var goods_name:String?
var goods_thumb : String?
var goods_id :Int?
......@@ -261,6 +275,8 @@ class selAgeDbtGoodsList_Data_model: Mappable {
var dbt_price:String? //分销价
var commission_val : String? //佣金
var is_show:Int?
required init?( map: Map) {
}
......@@ -279,6 +295,8 @@ class selAgeDbtGoodsList_Data_model: Mappable {
dbt_price <- map["dbt_price"]
commission_val <- map["commission_val"]
is_show <- map["is_show"]
}
}
//MARK: - 上游供应商信息页面查询
......
......@@ -11,7 +11,33 @@ import UIKit
class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataSource,GYS_FX_ProductCellDelegate, UISearchBarDelegate, SearchBarViewDelegate, GYS_FX_Product_VC_Cell_Delegate, GeliAlertViewDelegate{
func sureGeliAlertViewAction(sender: UIButton) {
if vcType != 180 {
let model = dls_datas[cellTag]
switch sender.tag {
case 0:
delAgentDbt(["user_token":UserToken as Any,"sku_id":model.sku_id as Any]) { (data) in
self.home_list_tbv.mj_header?.beginRefreshing()
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "haveChange"), object: "setting")
} failture: { (err) in
}
break
case 1:
let cell = home_list_tbv.cellForRow(at: IndexPath(row: cellTag, section:0 )) as! GYS_FX_Product_VC_Cell
var action = 1
if cell.up_down_btn.titleLabel!.text!.contains("下架") {
action = 2
}
ageSetGoodsAttr(["user_token":UserToken as Any,"sku_id":model.sku_id as Any,"action":action as Any]) { (data) in
self.home_list_tbv.mj_header?.beginRefreshing()
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "haveChange"), object: "setting")
} failture: { (err) in
}
break
default:
break
}
}else{
let model = datas[cellTag]
if sender.tag == 1 {
......@@ -26,7 +52,6 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
} failture: { (err) in
}
return
}
......@@ -45,10 +70,35 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
}
var cellTag = -1
func GYS_FX_Product_VC_Cell_Action(cell: GYS_FX_Product_VC_Cell, action: Int) {
cellTag = cell.tag
if vcType != 180 {
switch action {
case 0:
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否取消分销?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确认"), for: .normal)
alertView.rightBtn.tag = action
self.view.window?.addSubview(alertView)
break
case 1:
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
if cell.up_down_btn.titleLabel!.text!.contains("下架") {//下架
alertView.titileLbl.text = "是否下架?"
}else{//上架
alertView.titileLbl.text = "是否上架?"
}
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确认"), for: .normal)
alertView.rightBtn.tag = action
self.view.window?.addSubview(alertView)
break
default:
break
}
}else{
cellTag = cell.tag
switch action {
case 0://取消分销
let alertView = GeliAlertView(frame: self.view.window!.bounds)
......@@ -177,7 +227,7 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
var shop_id:Int = 0
var datas:Array<supSpreadGoodsDataModel> = []
var dls_datas:Array<selAgeDbtGoodsList_Data_model> = []
var dls_datas:Array<selAgeDbtGoodsList_Data_D_model> = []
@IBOutlet weak var home_list_tbv: UITableView!//主视图列表
......@@ -250,25 +300,26 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
if vcType != 180 {
let dict = ["user_token":UserToken as Any,"tab_type":look_type as Any,"keyword":keyword as Any,"sup_id":shop_id as Any,"page":page as Any]
selAgeDbtGoodsList(dict) {[self] (data) in
let model = data as! selAgeDbtGoodsList_model
dls_datas.removeAll()
model.data?.forEach({ (item) in
dls_datas.append(item)
model.data?.res?.forEach({ (item) in
self.dls_datas.append(item)
})
self.home_list_tbv.reloadData()
self.home_list_tbv?.mj_header?.endRefreshing()
self.page = 2
// if model.data?.sum_goods2 != nil && model.data?.sum_goods != nil{
// NotificationCenter.default.post(name: NSNotification.Name(rawValue: "sum_goods_count"), object: nil, userInfo: ["sum_goods":model.data!.sum_goods!,"sum_goods2":model.data!.sum_goods2!] )
// }
if model.data?.sum_goods2 != nil && model.data?.sum_goods != nil{
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "sum_goods_count"), object: nil, userInfo: ["sum_goods":model.data!.sum_goods!,"sum_goods2":model.data!.sum_goods2!] )
}
// if model.data?.res?.count == 0 {
// self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData()
// }else{
// self.home_list_tbv?.mj_footer?.endRefreshing()
// }
if model.data?.res?.count == 0 {
self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.home_list_tbv?.mj_footer?.endRefreshing()
}
} failture: { (err) in
self.home_list_tbv?.mj_header?.endRefreshing()
......@@ -308,7 +359,22 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
@objc func loadMoreData(){
print("加载更多数据")
if vcType != 180 {
let dict = ["user_token":UserToken as Any,"tab_type":look_type as Any,"keyword":keyword as Any,"sup_id":shop_id as Any,"page":page as Any]
selAgeDbtGoodsList(dict, success: { (data) in
let model = data as! selAgeDbtGoodsList_model
if model.data?.res?.count == 0 {
self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.page += 1
model.data?.res?.forEach({ (item) in
self.dls_datas.append(item)
})
self.home_list_tbv.reloadData()
self.home_list_tbv?.mj_footer?.endRefreshing()
}
}) { (error) in
self.home_list_tbv?.mj_footer?.endRefreshing()
}
return
}
let dic = ["user_token":UserToken as Any,"retrieval":"" as Any,"page":page as Any,"look_type":look_type as Any,"shop_id":shop_id as Any]
......@@ -332,7 +398,9 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
//MARK: - tableview_delegate
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if vcType != 180 {
return dls_datas.count
}
return datas.count
}
......@@ -351,7 +419,18 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
cell.up_down_btn_w.constant = 0
}
if vcType != 180 {//代理商品管理
let model = dls_datas[indexPath.row]
cell.icon.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.goods_thumb!), placeholderImage: nil,options:.allowInvalidSSLCertificates)
cell.name.text = model.goods_name
cell.price.text = "分销价:"
cell.comission.text = "¥\(model.dbt_price!)(固定提成:\(model.commission_val!))"
cell.inventory.isHidden = true
cell.store.text = "库存:\(model.inventory!)"
cell.up_down_btn.setTitle("商品上架", for: .normal)
if model.is_show == 1 {
cell.up_down_btn.setTitle("商品下架", for: .normal)
}
cell.fx_price.isHidden = true
......
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