Commit f626cdc2 authored by lujunye's avatar lujunye

优化操作流程

parent 0f0862f1
...@@ -12,9 +12,13 @@ protocol DistributorSettingAlertViewDelegate { ...@@ -12,9 +12,13 @@ protocol DistributorSettingAlertViewDelegate {
} }
class DistributorSettingAlertView: UIView { class DistributorSettingAlertView: UIView {
var temp_commission_per = ""
var temp_commission_val = ""
var temp_commission_type = 1
var is_all_select_mode = false var is_all_select_mode = false
var data:supGoodsListResDataModel?{ var data:supGoodsListResDataModel?{
didSet{ didSet{
temp_commission_type = (data?.commission_type)!
if data?.is_dbt == 0{ if data?.is_dbt == 0{
canYuBtn .setImage(UIImage.init(named: "daixuan"), for: .normal) canYuBtn .setImage(UIImage.init(named: "daixuan"), for: .normal)
nonCanYuBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal) nonCanYuBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal)
...@@ -41,6 +45,7 @@ class DistributorSettingAlertView: UIView { ...@@ -41,6 +45,7 @@ class DistributorSettingAlertView: UIView {
payJueBtn.isSelected = false payJueBtn.isSelected = false
payNumTypelbl.text = "%" payNumTypelbl.text = "%"
payTF.text = StringByInt(number: (data?.commission_per)!) payTF.text = StringByInt(number: (data?.commission_per)!)
temp_commission_per = StringByInt(number: (data?.commission_per)!)
}else{ }else{
payBiBtn .setImage(UIImage.init(named: "daixuan"), for: .normal) payBiBtn .setImage(UIImage.init(named: "daixuan"), for: .normal)
payJueBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal) payJueBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal)
...@@ -48,6 +53,7 @@ class DistributorSettingAlertView: UIView { ...@@ -48,6 +53,7 @@ class DistributorSettingAlertView: UIView {
payJueBtn.isSelected = true payJueBtn.isSelected = true
payNumTypelbl.text = "元" payNumTypelbl.text = "元"
payTF.text = data?.commission_val payTF.text = data?.commission_val
temp_commission_val = (data?.commission_val)!
} }
} }
...@@ -96,6 +102,8 @@ class DistributorSettingAlertView: UIView { ...@@ -96,6 +102,8 @@ class DistributorSettingAlertView: UIView {
payJueBtn.isSelected = false payJueBtn.isSelected = false
payNumTypelbl.text = "%" payNumTypelbl.text = "%"
payTF.placeholder = "请输入比例" payTF.placeholder = "请输入比例"
temp_commission_type = 1
payTF.text = temp_commission_per
} }
@IBAction func payJueAction(_ sender: UIButton) { @IBAction func payJueAction(_ sender: UIButton) {
//绝对值 //绝对值
...@@ -105,7 +113,18 @@ class DistributorSettingAlertView: UIView { ...@@ -105,7 +113,18 @@ class DistributorSettingAlertView: UIView {
payJueBtn.isSelected = true payJueBtn.isSelected = true
payNumTypelbl.text = "元" payNumTypelbl.text = "元"
payTF.placeholder = "请输入数值" payTF.placeholder = "请输入数值"
temp_commission_type = 2
payTF.text = temp_commission_val
} }
@objc func textChange(textField:UITextField){
if temp_commission_type == 1 {
temp_commission_per = textField.text!
}else{
temp_commission_val = textField.text!
}
}
@IBOutlet weak var payTF: UITextField! @IBOutlet weak var payTF: UITextField!
@IBOutlet weak var payNumTypelbl: UILabel! @IBOutlet weak var payNumTypelbl: UILabel!
...@@ -114,6 +133,9 @@ class DistributorSettingAlertView: UIView { ...@@ -114,6 +133,9 @@ class DistributorSettingAlertView: UIView {
self.removeFromSuperview() self.removeFromSuperview()
} }
@IBAction func sureAction(_ sender: UIButton) { @IBAction func sureAction(_ sender: UIButton) {
if canYuBtn.isSelected && payBiBtn.isUserInteractionEnabled { if canYuBtn.isSelected && payBiBtn.isUserInteractionEnabled {
if (payTF.text?.count == 0 || moneyTx.text?.count == 0){ if (payTF.text?.count == 0 || moneyTx.text?.count == 0){
...@@ -180,8 +202,9 @@ class DistributorSettingAlertView: UIView { ...@@ -180,8 +202,9 @@ class DistributorSettingAlertView: UIView {
contentView.snp.makeConstraints { (make) in contentView.snp.makeConstraints { (make) in
make.left.top.right.bottom.equalToSuperview() make.left.top.right.bottom.equalToSuperview()
} }
payTF.addTarget(self, action: #selector(textChange(textField:)), for: .editingChanged)
} }
// /初始化时将xib中的view添加进来 // /初始化时将xib中的view添加进来
required init?(coder aDecoder: NSCoder) { required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) super.init(coder: aDecoder)
...@@ -190,7 +213,7 @@ class DistributorSettingAlertView: UIView { ...@@ -190,7 +213,7 @@ class DistributorSettingAlertView: UIView {
contentView.snp.makeConstraints { (make) in contentView.snp.makeConstraints { (make) in
make.left.top.right.bottom.equalToSuperview() make.left.top.right.bottom.equalToSuperview()
} }
payTF.addTarget(self, action: #selector(textChange(textField:)), for: .editingChanged)
} }
//加载xib //加载xib
func loadViewFromNib() -> UIView { func loadViewFromNib() -> UIView {
......
...@@ -118,10 +118,13 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U ...@@ -118,10 +118,13 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U
searchV = searchBr searchV = searchBr
var holder_str = "请输入供应商名称" var holder_str = "请输入供应商名称"
navbar.rightTitle = "新增店铺"
if title_str == "分销商管理" { if title_str == "分销商管理" {
navbar.rightTitle = "新增店铺"
holder_str = "请输入分销商名称" holder_str = "请输入分销商名称"
}else{
navbar.rightTitle = "新增供应商"
} }
searchBr.placeholderStr = holder_str searchBr.placeholderStr = holder_str
...@@ -209,17 +212,33 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U ...@@ -209,17 +212,33 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U
cell.isFenXiaoShang = true cell.isFenXiaoShang = true
if dbt_datas.count > 0 { if dbt_datas.count > 0 {
let model = dbt_datas[indexPath.row] let model = dbt_datas[indexPath.row]
if model.shop_img_thumb != nil {
cell.icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.shop_img_thumb!)) cell.icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.shop_img_thumb!))
}
cell.title_Lbl.text = "-"
if model.create_time != nil {
cell.time_Lbl.text = model.create_time cell.time_Lbl.text = model.create_time
}
cell.adr_Lbl.text = "-"
if model.address != nil {
cell.adr_Lbl.text = model.address cell.adr_Lbl.text = model.address
}
cell.title_Lbl.text = model.shop_name cell.title_Lbl.text = model.shop_name
} }
}else{ }else{
if gys_datas.count > 0 { if gys_datas.count > 0 {
let model = gys_datas[indexPath.row] let model = gys_datas[indexPath.row]
if model.shop_img_thumb != nil {
cell.icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.shop_img_thumb!)) cell.icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.shop_img_thumb!))
}
cell.title_Lbl.text = "-"
if model.create_time != nil {
cell.time_Lbl.text = model.create_time cell.time_Lbl.text = model.create_time
}
cell.adr_Lbl.text = "-"
if model.address != nil {
cell.adr_Lbl.text = model.address cell.adr_Lbl.text = model.address
}
cell.title_Lbl.text = model.shop_name cell.title_Lbl.text = model.shop_name
} }
} }
......
...@@ -216,6 +216,8 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -216,6 +216,8 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
}else{ }else{
edit_bottom_view_H.constant = 49 edit_bottom_view_H.constant = 49
} }
}else{
selectItem.removeAll()
} }
home_list_tbv.reloadData() home_list_tbv.reloadData()
} }
...@@ -296,7 +298,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -296,7 +298,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let model = datas[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_FX_ProductCellTableViewCell") as! GYS_FX_ProductCellTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_FX_ProductCellTableViewCell") as! GYS_FX_ProductCellTableViewCell
cell.submitBtn.setTitle("设置", for: .normal) cell.submitBtn.setTitle("设置", for: .normal)
cell.submitBtn.setTitleColor(UIColor(named: "按钮背景颜色"), for: .normal) cell.submitBtn.setTitleColor(UIColor(named: "按钮背景颜色"), for: .normal)
...@@ -309,8 +311,9 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -309,8 +311,9 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
cell.left_btn.isUserInteractionEnabled = true cell.left_btn.isUserInteractionEnabled = true
cell.select_Img.isHidden = false cell.select_Img.isHidden = false
cell.select_Img.image = UIImage(named: "daixuan") cell.select_Img.image = UIImage(named: "daixuan")
selectItem.forEach { (idx) in selectItem.forEach { (idx) in
if idx == indexPath.row { if idx == model.sku_id{
cell.select_Img.image = UIImage(named: "yuxuan") cell.select_Img.image = UIImage(named: "yuxuan")
} }
} }
...@@ -321,17 +324,17 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -321,17 +324,17 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
cell.left_btn.isUserInteractionEnabled = false cell.left_btn.isUserInteractionEnabled = false
cell.select_Img.isHidden = true cell.select_Img.isHidden = true
} }
let model = datas[indexPath.row]
cell.old_price_line.isHidden = false cell.old_price_line.isHidden = false
cell.new_price_Lbl.isHidden = false cell.new_price_Lbl.isHidden = false
if model.dbt_price == nil { if model.dbt_price == nil {
cell.old_price_line.isHidden = true cell.old_price_line.isHidden = true
// cell.new_price_Lbl.isHidden = true
cell.new_price_Lbl.text = "" cell.new_price_Lbl.text = ""
}else{ }else{
cell.new_price_Lbl.text = "¥" + model.dbt_price! cell.new_price_Lbl.text = "¥" + model.dbt_price!
} }
cell.old_price_Lbl.text = "¥" + model.price! cell.old_price_Lbl.text = "¥" + model.price!
if model.commission_type == 1{ if model.commission_type == 1{
cell.FX_Percent_Lbl.isHidden = false cell.FX_Percent_Lbl.isHidden = false
...@@ -343,21 +346,29 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -343,21 +346,29 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
cell.FX_Percent_Lbl.isHidden = true cell.FX_Percent_Lbl.isHidden = true
} }
cell.title_Lbl.text = model.goods_name cell.title_Lbl.text = model.goods_name
cell.sell_total_Lbl.text = "销量:-"
if model.dbt_sale != nil { if model.dbt_sale != nil {
cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!) 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!)
} }
cell.store_lbl.text = StringByInt(number: model.inventory!) if model.goods_thumb != nil {
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!))
}
return cell return cell
} }
var selectItem:Array<Int> = [] var selectItem:Array<Int> = []
func GYS_FX_ProductCellTableViewCellSelect(idx: Int) { func GYS_FX_ProductCellTableViewCellSelect(idx: Int) {
let model = datas[idx]
if selectItem.contains(idx){ if selectItem.contains(idx){
let index = selectItem.firstIndex(of: idx) let index = selectItem.firstIndex(of: model.sku_id!)
selectItem.remove(at: index!) selectItem.remove(at: index!)
}else{ }else{
selectItem.append(idx) selectItem.append(model.sku_id!)
} }
home_list_tbv.reloadData() home_list_tbv.reloadData()
} }
...@@ -393,7 +404,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -393,7 +404,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
let model = data as! supGoodsListModel let model = data as! supGoodsListModel
self.datas.removeAll() self.datas.removeAll()
self.count_lbl.text = "0" self.count_lbl.text = "-"
if model.data!.count! > 0 || model.data?.count != nil{ if model.data!.count! > 0 || model.data?.count != nil{
self.count_lbl.text = StringByInt(number: model.data!.count!) self.count_lbl.text = StringByInt(number: model.data!.count!)
} }
......
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