Commit eb4ccd97 authored by lujunye's avatar lujunye

分销管理列表和搜索的铺货,取消铺货。

parent 9c45dfd1
...@@ -163,12 +163,12 @@ class supSpreadGoodsDataModel: Mappable { ...@@ -163,12 +163,12 @@ class supSpreadGoodsDataModel: Mappable {
var dbt_price :String?//分销价 var dbt_price :String?//分销价
var commission_type:Int?//佣金类型 1百分比 2固定值 var commission_type:Int?//佣金类型 1百分比 2固定值
var commission_per:Int?//佣金百分比(0为初始值) var commission_per:Int?//佣金百分比(0为初始值)
var good_id:Int?//商品id var goods_id:Int?//商品id
required init?( map: Map) { required init?( map: Map) {
} }
func mapping(map: Map) { func mapping(map: Map) {
good_id <- map["good_id"] goods_id <- map["goods_id"]
commission_type <- map["commission_type"] commission_type <- map["commission_type"]
commission_per <- map["commission_per"] commission_per <- map["commission_per"]
goods_thumb <- map["goods_thumb"] goods_thumb <- map["goods_thumb"]
......
...@@ -9,10 +9,15 @@ ...@@ -9,10 +9,15 @@
import UIKit import UIKit
protocol GYS_FX_ProductCellDelegate { protocol GYS_FX_ProductCellDelegate {
func GYS_FX_ProductCellTableViewCellSelect(idx:Int) func GYS_FX_ProductCellTableViewCellSelect(idx:Int)
func GYS_FX_ProductCellTableViewCellBtnAction(idx:Int)
} }
class GYS_FX_ProductCellTableViewCell: UITableViewCell { class GYS_FX_ProductCellTableViewCell: UITableViewCell {
var delegate:GYS_FX_ProductCellDelegate? var delegate:GYS_FX_ProductCellDelegate?
@IBAction func btnAction(_ sender: UIButton) {
delegate?.GYS_FX_ProductCellTableViewCellBtnAction(idx: self.tag)
}
@IBAction func selectProductAction(_ sender: UIButton) { @IBAction func selectProductAction(_ sender: UIButton) {
delegate?.GYS_FX_ProductCellTableViewCellSelect(idx: self.tag) delegate?.GYS_FX_ProductCellTableViewCellSelect(idx: self.tag)
} }
......
...@@ -51,6 +51,9 @@ ...@@ -51,6 +51,9 @@
<real key="value" value="10"/> <real key="value" value="10"/>
</userDefinedRuntimeAttribute> </userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
<connections>
<action selector="btnAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="2Dd-vp-XDJ"/>
</connections>
</button> </button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rhK-mv-sfb"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rhK-mv-sfb">
<rect key="frame" x="15" y="80" width="90" height="25"/> <rect key="frame" x="15" y="80" width="90" height="25"/>
......
...@@ -22,6 +22,10 @@ class YunDanXiangQingViewController: BaseViewController,UITableViewDelegate,UITa ...@@ -22,6 +22,10 @@ class YunDanXiangQingViewController: BaseViewController,UITableViewDelegate,UITa
} }
} }
deinit {
NotificationCenter.default.removeObserver(self)
}
func PaymentViewClose() { func PaymentViewClose() {
paymentView?.removeFromSuperview() paymentView?.removeFromSuperview()
paymentView = nil paymentView = nil
......
...@@ -8,7 +8,32 @@ ...@@ -8,7 +8,32 @@
import UIKit import UIKit
class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataSource{ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataSource,GYS_FX_ProductCellDelegate{
func GYS_FX_ProductCellTableViewCellSelect(idx: Int) {
}
func GYS_FX_ProductCellTableViewCellBtnAction(idx: Int) {
let model = datas[idx]
var action = 1
var intro = "铺货成功~"
if bottom_title_lbl.text == "已铺货" {
action = 2
intro = "取消成功~"
}
let dic = ["user_token":UserToken as Any,
"goods_id":model.goods_id as Any,
"shop_id":shop_id as Any,
"action":action]
spreadGoods(dic) { (data) in
HUD.flash(.label(intro), delay: 1.2)
self.home_list_tbv.mj_header?.beginRefreshing()
} failture: { (err) in
}
}
@IBOutlet weak var center_select_btn: UIButton! @IBOutlet weak var center_select_btn: UIButton!
@IBOutlet weak var count_lbl: UILabel!//已铺货/可铺货 数量 @IBOutlet weak var count_lbl: UILabel!//已铺货/可铺货 数量
@IBOutlet weak var bottom_title_lbl: UILabel! @IBOutlet weak var bottom_title_lbl: UILabel!
...@@ -81,7 +106,6 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS ...@@ -81,7 +106,6 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
if bottom_title_lbl.text != "已铺货"{ if bottom_title_lbl.text != "已铺货"{
vc.look_type = 2 vc.look_type = 2
} }
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
override func viewDidLoad() { override func viewDidLoad() {
...@@ -102,6 +126,17 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS ...@@ -102,6 +126,17 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
select_list_tbv.separatorStyle = .none select_list_tbv.separatorStyle = .none
select_list_tbv.showsVerticalScrollIndicator = false select_list_tbv.showsVerticalScrollIndicator = false
select_list_tbv.dataSource = self select_list_tbv.dataSource = self
NotificationCenter.default.addObserver(self, selector: #selector(getNoti(noti:)), name: NSNotification.Name(rawValue: "haveChange"), object: nil)
}
@objc func getNoti(noti:Notification){
home_list_tbv.mj_header?.beginRefreshing()
}
deinit {
/// 移除通知
NotificationCenter.default.removeObserver(self)
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
...@@ -170,12 +205,16 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS ...@@ -170,12 +205,16 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
self.home_list_tbv.reloadData() self.home_list_tbv.reloadData()
self.home_list_tbv?.mj_header?.endRefreshing() self.home_list_tbv?.mj_header?.endRefreshing()
self.page = 2 self.page = 2
self.count_lbl.text = "0"
if look_type == 1{ if look_type == 1{
if model.data?.sum_dbt_goods != nil {
self.count_lbl.text = StringByInt(number: (model.data?.sum_dbt_goods!)!) self.count_lbl.text = StringByInt(number: (model.data?.sum_dbt_goods!)!)
}
}else{ }else{
if model.data?.sum_goods != nil {
self.count_lbl.text = StringByInt(number: (model.data?.sum_goods!)!) self.count_lbl.text = StringByInt(number: (model.data?.sum_goods!)!)
} }
}
if model.data?.res?.count == 0 { if model.data?.res?.count == 0 {
self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData() self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData()
...@@ -236,6 +275,8 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS ...@@ -236,6 +275,8 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
}else{ }else{
cell.submitBtn.setTitle("铺货", for: .normal) cell.submitBtn.setTitle("铺货", for: .normal)
} }
cell.tag = indexPath.row
cell.delegate = self
let model = datas[indexPath.row] let model = datas[indexPath.row]
cell.title_Lbl.text = model.goods_name cell.title_Lbl.text = model.goods_name
cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!) cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!)
......
...@@ -8,7 +8,32 @@ ...@@ -8,7 +8,32 @@
import UIKit import UIKit
class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate{ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_FX_ProductCellDelegate{
func GYS_FX_ProductCellTableViewCellBtnAction(idx: Int) {
print(idx)
let model = datas[idx]
var action = 1
var intro = "铺货成功~"
if look_type == 1 {
action = 2
intro = "取消成功~"
}
let dic = ["user_token":UserToken as Any,
"goods_id":model.goods_id as Any,
"shop_id":shop_id as Any,
"action":action]
spreadGoods(dic) { (data) in
HUD.flash(.label(intro), delay: 1.2)
self.home_list_tbv.mj_header?.beginRefreshing()
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "haveChange"), object: "gysSearch")
} failture: { (err) in
}
}
func GYS_FX_ProductCellTableViewCellSelect(idx: Int) {
//这里没用。
}
var keyword = "" var keyword = ""
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
...@@ -88,7 +113,6 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -88,7 +113,6 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl
print("加载数据") print("加载数据")
page = 1 page = 1
let dic = ["user_token":UserToken as Any,"retrieval":keyword as Any,"page":page as Any,"look_type":look_type as Any,"shop_id":shop_id as Any] let dic = ["user_token":UserToken as Any,"retrieval":keyword as Any,"page":page as Any,"look_type":look_type as Any,"shop_id":shop_id as Any]
supSpreadGoods(dic) { (data) in supSpreadGoods(dic) { (data) in
...@@ -143,6 +167,8 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -143,6 +167,8 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_FX_ProductCellTableViewCell") as! GYS_FX_ProductCellTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_FX_ProductCellTableViewCell") as! GYS_FX_ProductCellTableViewCell
let model = datas[indexPath.row] let model = datas[indexPath.row]
cell.delegate = self
cell.tag = indexPath.row
cell.title_Lbl.text = model.goods_name cell.title_Lbl.text = model.goods_name
cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!) cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!)
cell.store_lbl.text = StringByInt(number: model.goods_number!) cell.store_lbl.text = StringByInt(number: model.goods_number!)
...@@ -152,6 +178,12 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -152,6 +178,12 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl
}else{ }else{
cell.FX_Percent_Lbl.isHidden = true cell.FX_Percent_Lbl.isHidden = true
} }
cell.submitBtn.setTitleColor(UIColor(named: "按钮背景颜色"), for: .normal)
if look_type == 1 {
cell.submitBtn.setTitle("取消铺货", for: .normal)
}else{
cell.submitBtn.setTitle("铺货", for: .normal)
}
cell.new_price_Lbl.text = model.dbt_price cell.new_price_Lbl.text = model.dbt_price
cell.old_price_Lbl.text = model.shop_price cell.old_price_Lbl.text = model.shop_price
cell.item_Icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.goods_thumb!)) cell.item_Icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.goods_thumb!))
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
import UIKit import UIKit
class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_FX_ProductCellDelegate ,SelectContentViewDelegate,HeaderSelectViewDelegate{ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_FX_ProductCellDelegate ,SelectContentViewDelegate,HeaderSelectViewDelegate{
func GYS_FX_ProductCellTableViewCellBtnAction(idx: Int) {
}
var selectIndexArr = [0,0] var selectIndexArr = [0,0]
var showSelectvIndex = 0 var showSelectvIndex = 0
......
...@@ -52,6 +52,12 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -52,6 +52,12 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
loadData() loadData()
} }
deinit {
/// 移除通知
NotificationCenter.default.removeObserver(self)
}
@objc func loadData(){ @objc func loadData(){
indexNext = 0 indexNext = 0
HUD.show(.progress) HUD.show(.progress)
......
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