Commit 1c8a0529 authored by lujunye's avatar lujunye

19

parent c2505dca
......@@ -27,6 +27,8 @@ class dbtIncomeInfoModel: Mappable {
class dbtIncomeInfoDataModel: Mappable {
var is_sup:Int?//是否是供应商(1是0否)
var is_dbt : Int? //是否是分销商(1是0否)
var is_agent:Int?//是否是代理商(1是0否)
var role_type:Int?//1供应商 2分销商 4代理商
var inc :Float?//收入
var exp:Float?//支出
var res : Array<dbtIncomeInfoDatasModel>?
......@@ -35,6 +37,8 @@ class dbtIncomeInfoDataModel: Mappable {
func mapping(map: Map) {
is_sup <- map["is_sup"]
is_dbt <- map["is_dbt"]
is_agent <- map["is_agent"]
role_type <- map["role_type"]
inc <- map["inc"]
exp <- map["exp"]
res <- map["res"]
......
......@@ -231,6 +231,8 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "GYS_FX_Product_VC_Cell") as! GYS_FX_Product_VC_Cell
cell.tag = indexPath.row
if vcType != 180 {
let model = datas[indexPath.row]
......@@ -240,6 +242,13 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
// cell.submitBtn.setTitle("铺货", for: .normal)
}
}else{
let model = datas[indexPath.row]
if self.title!.contains("已铺货") {
// cell.submitBtn.setTitle("取消铺货", for: .normal)
}else{
// cell.submitBtn.setTitle("铺货", for: .normal)
}
}
// cell.tag = indexPath.row
......
......@@ -80,58 +80,49 @@ class FXSY_ViewController: BaseViewController,GLTimeSelectViewDelegate,UITableVi
self.view.addSubview(vc)
}
var role_type = 1
@IBOutlet weak var line_w: NSLayoutConstraint!
var role_type = 0
var inc_exp_type = 0
@IBOutlet weak var last_btn: UIButton!
var keyword = ""
@IBAction func top_btn_click(_ sender: UIButton) {
@objc func top_btn_click(_ sender: UIButton) {
removeBlackBtnView()
if sender == left_btn {
left_btn.isSelected = true
right_btn.isSelected = false
last_btn.isSelected = false
self.bottom_line.snp.updateConstraints { (make) in
make.width.equalTo(ScreenWidth*0.33)
make.height.equalTo(3)
make.left.equalTo(0)
make.top.equalTo(self.left_btn.snp_bottom)
top_view.subviews.forEach { (view) in
if view.isKind(of: UIButton.self) {
let btn = view as! UIButton
btn.isSelected = false
}
}
sender.isSelected = true
switch sender.titleLabel?.text {
case "供应商":
role_type = 1
}else if sender == right_btn{
left_btn.isSelected = false
right_btn.isSelected = true
last_btn.isSelected = false
break
case "代理商":
role_type = 4
self.bottom_line.snp.updateConstraints { (make) in
make.left.width.equalTo(ScreenWidth*0.33)
make.height.equalTo(3)
make.top.equalTo(self.left_btn.snp_bottom)
}
}else{
left_btn.isSelected = false
right_btn.isSelected = false
last_btn.isSelected = true
break
default:
role_type = 2
self.bottom_line.snp.updateConstraints { (make) in
make.left.equalTo(ScreenWidth*0.66)
make.width.equalTo(ScreenWidth*0.33)
make.height.equalTo(3)
make.top.equalTo(self.left_btn.snp_bottom)
}
break
}
let width = Int(ScreenWidth)/top_view.subviews.count
line_w.constant = CGFloat(width)
bottom_line.snp.updateConstraints { (make) in
make.width.equalTo(width)
make.height.equalTo(3)
make.top.equalTo(top_view.snp_bottom)
make.left.equalTo(sender.tag * Int(sender.bounds.size.width))
}
// getData()
gys_list.mj_header?.beginRefreshing()
}
var glSelectView:GLAlertSelectView?
@IBOutlet weak var right_btn: UIButton!
@IBOutlet weak var left_btn: UIButton!
@IBOutlet weak var bottom_line: UIView!
@IBAction func type_select(_ sender: Any) {
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
......@@ -344,7 +335,7 @@ class FXSY_ViewController: BaseViewController,GLTimeSelectViewDelegate,UITableVi
"page":page as Any
]
dbtIncomeInfo(dic) { (data) in
dbtIncomeInfo(dic) { [self] (data) in
let dateModel = data as! dbtIncomeInfoModel
self.model = dateModel.data
if self.model?.res?.count == nil || self.model?.res?.count == 0 {
......@@ -370,26 +361,31 @@ class FXSY_ViewController: BaseViewController,GLTimeSelectViewDelegate,UITableVi
self.dataArr.removeAll()
self.role_type = (self.model?.role_type) as! Int
if self.isFirstTime {
self.isFirstTime = false
if self.model?.is_dbt == 1 && self.model?.is_sup == 0 {
self.role_type = 2
self.left_btn.isSelected = false
self.right_btn.isSelected = true
self.bottom_line.snp.updateConstraints { (make) in
make.left.width.equalTo(ScreenWidth*0.5)
make.height.equalTo(3)
make.top.equalTo(self.left_btn.snp_bottom)
}
}
if self.model?.is_sup == 1 && self.model?.is_dbt == 1 {
let count = (self.model?.is_agent)! + (self.model?.is_dbt)! + (self.model?.is_sup)!
if count != 0 {
self.top_view.isHidden = false
self.bottom_line.isHidden = false
SetTopFrame(view: self.top_view, height: 44)
var titleArr:Array<String> = []
if self.model?.is_sup == 1 {
titleArr.append("供应商")
}
if self.model?.is_dbt == 1 {
titleArr.append("代理商")
}
if self.model?.is_agent == 1 {
titleArr.append("分销店长")
}
if top_view.subviews.count == 0 && titleArr.count > 1 {
setBtns(titles: titleArr)
}
}else{
self.top_view.isHidden = true
self.bottom_line.isHidden = true
SetTopFrame(view: self.top_view, height: 0.00001)
}
}
......@@ -405,4 +401,22 @@ class FXSY_ViewController: BaseViewController,GLTimeSelectViewDelegate,UITableVi
self.gys_list.mj_header?.endRefreshing()
}
}
func setBtns(titles:Array<String>) {
for i in 0 ..< titles.count {
let btn = UIButton(frame: CGRect(x: i * Int(ScreenWidth)/titles.count, y: 0, width: Int(ScreenWidth)/titles.count, height: 44))
btn.tag = i
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.addTarget(self, action: #selector(top_btn_click(_:)), for: .touchUpInside)
btn.setTitle(titles[i], for: .normal)
btn.setTitleColor(UIColor(named: "多选按钮字体颜色"), for: .normal)
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .selected)
if i == 0 {
btn.isSelected = true
}
top_view.addSubview(btn)
line_w.constant = CGFloat(Int(ScreenWidth)/titles.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