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)
}
}
}
......@@ -17,10 +17,8 @@
<outlet property="date_lbl" destination="p0d-nN-gRY" id="32x-fS-Ztn"/>
<outlet property="gys_list" destination="x8A-F9-ceB" id="r5R-8a-geu"/>
<outlet property="income_lbl" destination="Bxv-vi-fqZ" id="cTf-ig-rKc"/>
<outlet property="last_btn" destination="MGn-lg-139" id="pKz-Mq-7qe"/>
<outlet property="left_btn" destination="oz8-MC-aZt" id="511-qe-BKP"/>
<outlet property="line_w" destination="nQ9-Ac-4fD" id="H7H-Jo-bGI"/>
<outlet property="refuse_lbl" destination="WW0-jT-mpV" id="YWH-Ad-Bim"/>
<outlet property="right_btn" destination="67A-fb-ve2" id="ycR-Zq-5xs"/>
<outlet property="search_view" destination="UKe-tW-CyK" id="wnc-Uv-VwN"/>
<outlet property="time_select_btn" destination="LLc-OZ-DX2" id="kaq-qL-iJs"/>
<outlet property="top_view" destination="WSB-Vn-KNN" id="qWg-yo-cin"/>
......@@ -35,74 +33,17 @@
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WSB-Vn-KNN">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oz8-MC-aZt">
<rect key="frame" x="0.0" y="0.0" width="138" height="44"/>
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="13"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="供应商">
<color key="titleColor" name="多选按钮字体颜色"/>
</state>
<state key="selected" title="供应商">
<color key="titleColor" name="按钮渐变色下,字体颜色"/>
</state>
<connections>
<action selector="top_btn_click:" destination="-1" eventType="touchUpInside" id="6FW-jJ-1Bw"/>
</connections>
</button>
<button opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="67A-fb-ve2">
<rect key="frame" x="138" y="0.0" width="138" height="44"/>
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="13"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="代理商">
<color key="titleColor" name="多选按钮字体颜色"/>
</state>
<state key="selected" title="代理商">
<color key="titleColor" name="按钮渐变色下,字体颜色"/>
</state>
<connections>
<action selector="top_btn_click:" destination="-1" eventType="touchUpInside" id="9Ac-P3-mwH"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MGn-lg-139">
<rect key="frame" x="276" y="0.0" width="138" height="44"/>
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="13"/>
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="分销店长">
<color key="titleColor" name="多选按钮字体颜色"/>
</state>
<state key="selected">
<color key="titleColor" name="按钮渐变色下,字体颜色"/>
</state>
<connections>
<action selector="top_btn_click:" destination="-1" eventType="touchUpInside" id="Feg-jk-8hv"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="oz8-MC-aZt" secondAttribute="bottom" id="KRv-q9-Rs3"/>
<constraint firstItem="MGn-lg-139" firstAttribute="width" secondItem="oz8-MC-aZt" secondAttribute="width" id="NWF-Xs-2aD"/>
<constraint firstAttribute="trailing" secondItem="MGn-lg-139" secondAttribute="trailing" id="O85-xk-xy3"/>
<constraint firstItem="67A-fb-ve2" firstAttribute="leading" secondItem="oz8-MC-aZt" secondAttribute="trailing" id="Plu-iT-sbY"/>
<constraint firstItem="MGn-lg-139" firstAttribute="top" secondItem="WSB-Vn-KNN" secondAttribute="top" id="RMj-C9-XVv"/>
<constraint firstItem="67A-fb-ve2" firstAttribute="width" secondItem="oz8-MC-aZt" secondAttribute="width" id="TYf-QT-KHR"/>
<constraint firstItem="MGn-lg-139" firstAttribute="leading" secondItem="67A-fb-ve2" secondAttribute="trailing" id="WHW-ZP-6WS"/>
<constraint firstAttribute="bottom" secondItem="MGn-lg-139" secondAttribute="bottom" id="dhU-ym-NsY"/>
<constraint firstAttribute="bottom" secondItem="67A-fb-ve2" secondAttribute="bottom" id="l7W-38-z9a"/>
<constraint firstItem="oz8-MC-aZt" firstAttribute="top" secondItem="WSB-Vn-KNN" secondAttribute="top" id="p6w-1p-2FM"/>
<constraint firstItem="MGn-lg-139" firstAttribute="height" secondItem="oz8-MC-aZt" secondAttribute="height" id="pgk-bM-lHx"/>
<constraint firstAttribute="height" constant="44" id="qGv-cC-f7b"/>
<constraint firstItem="oz8-MC-aZt" firstAttribute="leading" secondItem="WSB-Vn-KNN" secondAttribute="leading" id="rXQ-xH-cef"/>
<constraint firstItem="67A-fb-ve2" firstAttribute="height" secondItem="oz8-MC-aZt" secondAttribute="height" id="riw-dE-wdn"/>
<constraint firstItem="67A-fb-ve2" firstAttribute="top" secondItem="WSB-Vn-KNN" secondAttribute="top" id="udu-Yh-KDZ"/>
</constraints>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IxS-20-RHd">
<rect key="frame" x="0.0" y="88" width="138" height="3"/>
<color key="backgroundColor" name="按钮渐变色下,字体颜色"/>
<constraints>
<constraint firstAttribute="height" constant="3" id="AKC-lg-WsT"/>
<constraint firstAttribute="height" constant="3" id="XTk-Ja-jT7"/>
<constraint firstAttribute="width" constant="138" id="nQ9-Ac-4fD"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
......@@ -236,21 +177,20 @@
<constraint firstItem="Agb-5D-GhT" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="0yT-7f-y6P"/>
<constraint firstItem="Qvu-y5-cnX" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="1eu-RJ-YIM"/>
<constraint firstItem="WSB-Vn-KNN" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="2mp-e7-uPo"/>
<constraint firstItem="bVM-Rj-Ldp" firstAttribute="top" secondItem="IxS-20-RHd" secondAttribute="bottom" id="6pu-lq-0k9"/>
<constraint firstItem="WSB-Vn-KNN" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="7m6-nL-EBm"/>
<constraint firstItem="IxS-20-RHd" firstAttribute="width" secondItem="oz8-MC-aZt" secondAttribute="width" id="9a1-z6-Ule"/>
<constraint firstItem="IxS-20-RHd" firstAttribute="top" secondItem="WSB-Vn-KNN" secondAttribute="bottom" id="9HS-FN-GU4"/>
<constraint firstItem="Qvu-y5-cnX" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="9yL-R7-NKy"/>
<constraint firstItem="IxS-20-RHd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="CVX-9N-qtO"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="WSB-Vn-KNN" secondAttribute="trailing" id="CnI-wo-2Vl"/>
<constraint firstItem="IxS-20-RHd" firstAttribute="top" secondItem="WSB-Vn-KNN" secondAttribute="bottom" id="GDu-un-Tca"/>
<constraint firstAttribute="bottom" secondItem="Qvu-y5-cnX" secondAttribute="bottom" id="LZh-cN-7hK"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Agb-5D-GhT" secondAttribute="trailing" id="P5u-N7-vtX"/>
<constraint firstAttribute="bottom" secondItem="x8A-F9-ceB" secondAttribute="bottom" id="Pt8-vh-lRl"/>
<constraint firstItem="IxS-20-RHd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="Tea-d8-maf"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="bVM-Rj-Ldp" secondAttribute="trailing" id="WIT-60-9Ri"/>
<constraint firstItem="x8A-F9-ceB" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="aIP-0Y-veR"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="x8A-F9-ceB" secondAttribute="trailing" id="dJO-9v-RjF"/>
<constraint firstItem="Agb-5D-GhT" firstAttribute="top" secondItem="bVM-Rj-Ldp" secondAttribute="bottom" id="dKP-38-e8r"/>
<constraint firstItem="bVM-Rj-Ldp" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="npf-z2-EPD"/>
<constraint firstItem="bVM-Rj-Ldp" firstAttribute="top" secondItem="IxS-20-RHd" secondAttribute="bottom" id="ptx-IH-lov"/>
<constraint firstItem="Qvu-y5-cnX" firstAttribute="top" secondItem="Agb-5D-GhT" secondAttribute="bottom" id="sgE-zs-hv4"/>
<constraint firstItem="x8A-F9-ceB" firstAttribute="top" secondItem="Agb-5D-GhT" secondAttribute="bottom" id="ywx-kA-VKG"/>
</constraints>
......@@ -260,9 +200,6 @@
<resources>
<image name="down_black" width="11.5" height="6"/>
<image name="无数据1" width="205" height="154.5"/>
<namedColor name="多选按钮字体颜色">
<color red="0.41176470588235292" green="0.41176470588235292" blue="0.41176470588235292" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="按钮渐变色下,字体颜色">
<color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
......
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