Commit eb4ccd97 authored by lujunye's avatar lujunye

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

parent 9c45dfd1
......@@ -163,12 +163,12 @@ class supSpreadGoodsDataModel: Mappable {
var dbt_price :String?//分销价
var commission_type:Int?//佣金类型 1百分比 2固定值
var commission_per:Int?//佣金百分比(0为初始值)
var good_id:Int?//商品id
var goods_id:Int?//商品id
required init?( map: Map) {
}
func mapping(map: Map) {
good_id <- map["good_id"]
goods_id <- map["goods_id"]
commission_type <- map["commission_type"]
commission_per <- map["commission_per"]
goods_thumb <- map["goods_thumb"]
......
......@@ -9,10 +9,15 @@
import UIKit
protocol GYS_FX_ProductCellDelegate {
func GYS_FX_ProductCellTableViewCellSelect(idx:Int)
func GYS_FX_ProductCellTableViewCellBtnAction(idx:Int)
}
class GYS_FX_ProductCellTableViewCell: UITableViewCell {
var delegate:GYS_FX_ProductCellDelegate?
@IBAction func btnAction(_ sender: UIButton) {
delegate?.GYS_FX_ProductCellTableViewCellBtnAction(idx: self.tag)
}
@IBAction func selectProductAction(_ sender: UIButton) {
delegate?.GYS_FX_ProductCellTableViewCellSelect(idx: self.tag)
}
......
......@@ -51,6 +51,9 @@
<real key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="btnAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="2Dd-vp-XDJ"/>
</connections>
</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">
<rect key="frame" x="15" y="80" width="90" height="25"/>
......
......@@ -22,6 +22,10 @@ class YunDanXiangQingViewController: BaseViewController,UITableViewDelegate,UITa
}
}
deinit {
NotificationCenter.default.removeObserver(self)
}
func PaymentViewClose() {
paymentView?.removeFromSuperview()
paymentView = nil
......
......@@ -8,7 +8,32 @@
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 count_lbl: UILabel!//已铺货/可铺货 数量
@IBOutlet weak var bottom_title_lbl: UILabel!
......@@ -81,7 +106,6 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
if bottom_title_lbl.text != "已铺货"{
vc.look_type = 2
}
self.navigationController?.pushViewController(vc, animated: true)
}
override func viewDidLoad() {
......@@ -102,6 +126,17 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
select_list_tbv.separatorStyle = .none
select_list_tbv.showsVerticalScrollIndicator = false
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) {
......@@ -170,11 +205,15 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
self.home_list_tbv.reloadData()
self.home_list_tbv?.mj_header?.endRefreshing()
self.page = 2
self.count_lbl.text = "0"
if look_type == 1{
self.count_lbl.text = StringByInt(number: (model.data?.sum_dbt_goods!)!)
if model.data?.sum_dbt_goods != nil {
self.count_lbl.text = StringByInt(number: (model.data?.sum_dbt_goods!)!)
}
}else{
self.count_lbl.text = StringByInt(number: (model.data?.sum_goods!)!)
if model.data?.sum_goods != nil {
self.count_lbl.text = StringByInt(number: (model.data?.sum_goods!)!)
}
}
if model.data?.res?.count == 0 {
......@@ -236,6 +275,8 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
}else{
cell.submitBtn.setTitle("铺货", for: .normal)
}
cell.tag = indexPath.row
cell.delegate = self
let model = datas[indexPath.row]
cell.title_Lbl.text = model.goods_name
cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!)
......
......@@ -8,7 +8,32 @@
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 = ""
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
......@@ -88,7 +113,6 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl
print("加载数据")
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]
supSpreadGoods(dic) { (data) in
......@@ -143,6 +167,8 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_FX_ProductCellTableViewCell") as! GYS_FX_ProductCellTableViewCell
let model = datas[indexPath.row]
cell.delegate = self
cell.tag = indexPath.row
cell.title_Lbl.text = model.goods_name
cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!)
cell.store_lbl.text = StringByInt(number: model.goods_number!)
......@@ -152,6 +178,12 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl
}else{
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.old_price_Lbl.text = model.shop_price
cell.item_Icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.goods_thumb!))
......
......@@ -9,6 +9,10 @@
import UIKit
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 showSelectvIndex = 0
......
......@@ -52,6 +52,12 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
loadData()
}
deinit {
/// 移除通知
NotificationCenter.default.removeObserver(self)
}
@objc func loadData(){
indexNext = 0
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