Commit 4bc32ab5 authored by lujunye's avatar lujunye

4

parent 61a214c7
......@@ -9,8 +9,23 @@
import UIKit
class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,SelectContentViewDelegate,HeaderSelectViewDelegate, New_Fx_Cell_Delegate, FXSZ_View_Delegate{
func FXSZ_View_submitAction(tag: Int, price: String, commission: String,view:FXSZ_View) {
class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_FX_ProductCellDelegate ,SelectContentViewDelegate,HeaderSelectViewDelegate,DistributorSettingAlertViewDelegate{
@IBOutlet weak var all_select_btn: UIButton!
@IBAction func select_mode_Action(_ sender: UIButton) {
if selectItem.count == 0 {
return
}
let vc = DistributorSettingAlertView(frame: self.view.bounds)
vc.delegate = self
if selectItem.count > 1 {
vc.is_all_select_mode = is_Edit
}
self.view.addSubview(vc)
}
func DistributorSettingAlertViewSubmitAction(tag: Int, operation_type: Int, dbt_price: String, commission_type: Int, commission_per: String, commission_val: String,view:DistributorSettingAlertView) {
HUD.flash(.progress, delay: 1.2)
if is_Edit {
var sku_id = ""
......@@ -24,12 +39,12 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
}
let dic = ["user_token":UserToken as Any,
"operation_type":1 as Any,
"operation_type":operation_type as Any,
"sku_id":sku_id as Any,
"dbt_price":price as Any,
"dbt_price":dbt_price as Any,
"commission_type":1 as Any,
"commission_per":0 as Any,
"commission_val":commission as Any]
"commission_per":commission_per as Any,
"commission_val":commission_val as Any]
supSetCommodity(dic) { (data) in
HUD.flash(.label("设置成功~"), delay: 1.2)
view.removeFromSuperview()
......@@ -45,12 +60,12 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
let model = datas[tag]
let dic = ["user_token":UserToken as Any,
"operation_type":1 as Any,
"operation_type":operation_type as Any,
"sku_id":model.sku_id as Any,
"dbt_price":price as Any,
"commission_type":1 as Any,
"commission_per":0 as Any,
"commission_val":commission as Any]
"dbt_price":dbt_price as Any,
"commission_type":commission_type as Any,
"commission_per":commission_per as Any,
"commission_val":commission_val as Any]
supSetCommodity(dic) { (data) in
HUD.flash(.label("设置成功~"), delay: 1.2)
view.removeFromSuperview()
......@@ -59,66 +74,14 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
} failture: { (err) in}
}
func New_Fx_Cell_btnSelect(idx: Int, cell: New_Fx_Cell) {
let model = datas[idx]
if selectItem.contains(model.sku_id!){
let index = selectItem.firstIndex(of: model.sku_id!)
selectItem.remove(at: index!)
}else{
selectItem.append(model.sku_id!)
}
all_select_btn.isSelected = false
all_select_btn.setTitle(" 全选(已选 " + StringByInt(number: selectItem.count) + " 件商品)", for: .normal)
home_list_tbv.reloadData()
}
func New_Fx_Cell_btnClick(idx: Int, cell: New_Fx_Cell) {
switch idx {
case 0:
break
case 1:
break
default:
let view = XY_FX_Setting_View(frame: self.view.bounds)
self.view.addSubview(view)
//分销设置
// let data = datas[cell.tag]
// let view = FXSZ_View(frame: self.view.bounds)
// view.delegate = self
// view.FX_Price_Tf.text = data.dbt_price
// view.commission_tf.text = data.commission_val
// self.view.addSubview(view)
break
}
}
@IBOutlet weak var all_select_btn: UIButton!
@IBAction func select_mode_Action(_ sender: UIButton) {
if selectItem.count == 0 {
return
}
let vc = FXSZ_View(frame: self.view.bounds)
func GYS_FX_ProductCellTableViewCellBtnAction(idx: Int) {
let vc = DistributorSettingAlertView(frame: self.view.bounds)
vc.tag = idx
vc.data = datas[idx]
vc.delegate = self
if selectItem.count > 1 {
vc.is_all_select_mode = is_Edit
}
self.view.addSubview(vc)
}
// func new_GYS_FX_ProductCellTableViewCellBtnAction(idx: Int) {
// let vc = DistributorSettingAlertView(frame: self.view.bounds)
// vc.tag = idx
// vc.data = datas[idx]
// vc.delegate = self
// self.view.addSubview(vc)
// }
var datas:Array<supGoodsListResDataModel> = []
var selectIndexArr = [0,0]
var showSelectvIndex = 0
......@@ -335,7 +298,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
initHeaderSelectView()
home_list_tbv.register(UINib(nibName: "New_Fx_Cell", bundle: nil), forCellReuseIdentifier: "New_Fx_Cell")
home_list_tbv.register(UINib(nibName: "GYS_FX_ProductCellTableViewCell", bundle: nil), forCellReuseIdentifier: "GYS_FX_ProductCellTableViewCell")
home_list_tbv.separatorStyle = .none
// Do any additional setup after loading the view.
//下拉刷新相关设置
......@@ -354,52 +317,88 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let model = datas[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: "New_Fx_Cell") as! New_Fx_Cell
let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_FX_ProductCellTableViewCell") as! GYS_FX_ProductCellTableViewCell
cell.submitBtn.setTitle("设置", for: .normal)
cell.submitBtn.setTitleColor(UIColor(named: "按钮背景颜色"), for: .normal)
cell.tag = indexPath.row
cell.delegate = self
if is_Edit{
cell.leftValue.constant = 45
cell.leftBtn.isUserInteractionEnabled = true
cell.select_img.isHidden = false
cell.select_img.image = UIImage(named: "daixuan")
cell.submit_Btn_W.constant = 10
cell.submitBtn.isHidden = true
cell.left_btn.isUserInteractionEnabled = true
cell.select_Img.isHidden = false
cell.select_Img.image = UIImage(named: "daixuan")
selectItem.forEach { (idx) in
if idx == model.sku_id{
cell.select_img.image = UIImage(named: "yuxuan")
cell.select_Img.image = UIImage(named: "yuxuan")
}
}
}else{
cell.leftValue.constant = 0
cell.leftBtn.isUserInteractionEnabled = false
cell.select_img.isHidden = true
cell.submit_Btn_W.constant = 50
cell.submitBtn.isHidden = false
cell.left_btn.isUserInteractionEnabled = false
cell.select_Img.isHidden = true
}
if model.dbt_price == nil && model.commission_val == nil {
cell.price.isHidden = true
cell.old_price_line.isHidden = false
cell.new_price_Lbl.isHidden = false
if model.dbt_price == nil {
cell.old_price_line.isHidden = true
cell.new_price_Lbl.text = ""
}else{
cell.price.isHidden = false
cell.price.text = "分销价: ¥\(model.dbt_price!) (固定提成: \(model.commission_val!))"
cell.new_price_Lbl.text = "¥" + model.dbt_price!
}
cell.spec.text = "单价: ¥" + model.price!
cell.old_price_Lbl.text = "¥" + model.price!
if model.commission_type == 1{
cell.FX_Percent_Lbl.isHidden = false
cell.name.text = model.goods_name
if model.inventory != nil {
cell.spec.text! += " " + "库存: \(model.inventory!)"
cell.FX_Percent_Lbl.text = "分销(" + StringByInt(number: model.commission_per!) + "%)"
}else if model.commission_type == 2{
cell.FX_Percent_Lbl.isHidden = false
cell.FX_Percent_Lbl.text = "分销(" + model.commission_val! + "元)"
}else{
cell.spec.text! += " " + "库存: -"
cell.FX_Percent_Lbl.isHidden = true
}
cell.title_Lbl.text = model.goods_name
cell.sell_total_Lbl.text = "销量:-"
if model.dbt_sale != nil {
cell.sell_total_Lbl.text = "销量:" + StringByInt(number: model.dbt_sale!)
}
cell.store_lbl.text = "库存:-"
if model.inventory != nil {
cell.store_lbl.text = "库存:" + StringByInt(number: model.inventory!)
}
if model.goods_thumb != nil {
cell.icon.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.goods_thumb!), placeholderImage: nil,options:.allowInvalidSSLCertificates)
cell.item_Icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.goods_thumb!))
}
cell.color_lbl.isHidden = cell.FX_Percent_Lbl.isHidden
cell.color_lbl.text = cell.FX_Percent_Lbl.text
return cell
}
var selectItem:Array<Int> = []
func GYS_FX_ProductCellTableViewCellSelect(idx: Int) {
let model = datas[idx]
if selectItem.contains(model.sku_id!){
let index = selectItem.firstIndex(of: model.sku_id!)
selectItem.remove(at: index!)
}else{
selectItem.append(model.sku_id!)
}
all_select_btn.isSelected = false
all_select_btn.setTitle(" 全选(已选 " + StringByInt(number: selectItem.count) + " 件商品)", for: .normal)
home_list_tbv.reloadData()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 145
return 125
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......
......@@ -755,7 +755,8 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
self.navigationController?.pushViewController(vc, animated: true)
return
case 164://上游供应商管理
let vc = SY_GYS_GL_VC()
let vc = GYS_HZ_Vc()
vc.title_str = "上游供应商管理"
self.navigationController?.pushViewController(vc, animated: true)
return
case 165://上游代理商管理
......
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