Commit 107c5ab0 authored by 刘俊宏's avatar 刘俊宏

应收应付选择时间

parent 0e732c70
......@@ -13,11 +13,12 @@ protocol YingFuZhangKuanXQViewControllerDelegate {
class YingFuZhangKuanXQViewController:BaseViewController,UISearchBarDelegate,SearchBarViewDelegate,UITableViewDelegate,UITableViewDataSource,YingFuZhangKuanXQCellDelegate,GLAlertSelectViewDelegate, GeliAlertViewDelegate{
class YingFuZhangKuanXQViewController:BaseViewController,UISearchBarDelegate,SearchBarViewDelegate,UITableViewDelegate,UITableViewDataSource,YingFuZhangKuanXQCellDelegate,GLAlertSelectViewDelegate, GeliAlertViewDelegate,TimeSelectViewDelgate{
var delegate:YingFuZhangKuanXQViewControllerDelegate?
@IBOutlet weak var selectView: UIView!
@IBOutlet weak var selectimeBV: UIView!
@IBAction func btnSelect(_ sender: UIButton) {
if sender.tag == 0 {
leftBtn.backgroundColor = UIColor(named: "按钮背景颜色")
......@@ -30,6 +31,17 @@ class YingFuZhangKuanXQViewController:BaseViewController,UISearchBarDelegate,Sea
leftBtn.isSelected = false
rightBtn.isSelected = true
}
//10086
timeView.removeFromSuperview()
selectimeBV.addSubview(timeView)
timeView.snp.makeConstraints { (make) in
make.top.left.right.bottom.equalToSuperview()
}
timeView.subviews.forEach { (view) in
view.removeFromSuperview()
}
addTimeView()
}
@IBOutlet weak var rightBtn: UIButton!
@IBOutlet weak var leftBtn: UIButton!
......@@ -41,6 +53,16 @@ class YingFuZhangKuanXQViewController:BaseViewController,UISearchBarDelegate,Sea
@IBAction func showSelectAction(_ sender: UIButton) {
selectView.isHidden = !selectView.isHidden
closeBtn.isHidden = selectView.isHidden
timeView.removeFromSuperview()
selectimeBV.addSubview(timeView)
timeView.snp.makeConstraints { (make) in
make.top.left.right.bottom.equalToSuperview()
}
timeView.subviews.forEach { (view) in
view.removeFromSuperview()
}
addTimeView()
}
......@@ -540,4 +562,115 @@ class YingFuZhangKuanXQViewController:BaseViewController,UISearchBarDelegate,Sea
}
}
//时间筛选
let timeView = UIView()
weak var CalendarV:TimeSelectView?
func addTimeView() {
let line = UIView()
line.backgroundColor = UIColor.init(named: "灰色分界线")
timeView.addSubview(line)
line.snp.makeConstraints { (make) in
make.left.equalTo(15*glscale)
make.right.equalTo(-15*glscale)
make.top.equalToSuperview()
make.height.equalTo(1)
}
let calendarV = TimeSelectView(frame: CGRect(x: 0, y: 1, width: fullScreenWidth, height: 235*glscale))
calendarV.moreSelection = true
timeView.addSubview(calendarV)
calendarV.delegate = self
CalendarV = calendarV
let line2 = UIView()
line2.backgroundColor = UIColor.init(named: "灰色分界线")
timeView.addSubview(line2)
line2.snp.makeConstraints { (make) in
make.left.equalTo(15*glscale)
make.right.equalTo(-15*glscale)
make.top.equalTo(calendarV.snp_bottom)
make.height.equalTo(1)
}
let sureBtn = UIButton(type: .custom)
sureBtn.setTitleColor(UIColor.init(named: "白色背景色"), for: .normal)
sureBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
sureBtn.backgroundColor = UIColor.init(named: "蓝色字体颜色")
sureBtn.setTitle("确定", for: .normal)
sureBtn.layer.cornerRadius = 3
sureBtn.addTarget(self, action: #selector(sureBtnAction(sender:)), for: .touchUpInside)
timeView.addSubview(sureBtn)
sureBtn.snp.makeConstraints { (make) in
make.right.bottom.equalTo(-15*glscale)
make.width.equalTo(70*glscale)
make.height.equalTo(30*glscale)
}
let kuangV = UIView()
kuangV.layer.borderColor = UIColor.init(named: "灰色字体颜色")?.cgColor
kuangV.layer.borderWidth = 1
kuangV.layer.cornerRadius = 3
timeView.addSubview(kuangV)
kuangV.snp.makeConstraints { (make) in
make.height.equalTo(sureBtn)
make.right.equalTo(sureBtn.snp_left).offset(-15*glscale)
make.width.equalTo(180*glscale)
make.centerY.equalTo(sureBtn)
}
let clearBtn = UIButton(type: .custom)
clearBtn.setImage(UIImage.init(named: "workTimeDel"), for: .normal)
clearBtn.addTarget(self, action: #selector(clearBtnAction(sender:)), for: .touchUpInside)
timeView.addSubview(clearBtn)
clearBtn.snp.makeConstraints { (make) in
make.right.equalTo(kuangV.snp_right).offset(-7*glscale)
make.centerY.equalTo(sureBtn)
}
let timeLbl = UILabel()
if BeginDate != nil && EndDate != nil {
let timeInterval:TimeInterval = BeginDate.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = EndDate.timeIntervalSince1970
timeLbl.text = dayByDouble(sender: timeInterval) + "-" + dayByDouble(sender: timeIntervalEnd)
calendarV.setOldDate(beginD: BeginDate!, endD: EndDate!)
}else{
timeLbl.text = "-"
}
timeLbl.font = UIFont.systemFont(ofSize: 13)
timeLbl.textColor = UIColor.init(named: "蓝色字体颜色")
timeView.addSubview(timeLbl)
timeLbl.snp.makeConstraints { (make) in
make.centerY.equalTo(kuangV)
make.left.equalTo(kuangV.snp_left).offset(10*glscale)
}
TimeLbl = timeLbl
}
weak var TimeLbl:UILabel?
func selectMoreDate(beginDate: Date, endginDate: Date) {
print("选择日期·····")
let timeInterval:TimeInterval = beginDate.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970
TimeLbl!.text = dayByDouble(sender: timeInterval) + "-" + dayByDouble(sender: timeIntervalEnd)
EndDate = endginDate
BeginDate = beginDate
}
@objc func clearBtnAction(sender:UIButton){
print("清除日期·····")
TimeLbl!.text = "-"
BeginDate = nil
EndDate = nil
CalendarV!.clearTheSelect()
}
var BeginDate: Date! = nil
var EndDate: Date! = nil
@objc func sureBtnAction(sender:UIButton){
//还要传日期文本出去
if BeginDate == nil || EndDate == nil {
HUD.flash(.label("请选择自定义时间段"),delay: 1.2)
return
}
print("最后的时间",BeginDate,EndDate)
selectView.isHidden = true
closeBtn.isHidden = true
}
}
......@@ -17,6 +17,7 @@
<outlet property="rightBtn" destination="aff-vT-yfV" id="x2Z-c9-IDg"/>
<outlet property="searchBGView" destination="fQf-mJ-t0V" id="Flu-qf-wdv"/>
<outlet property="selectView" destination="ZLV-28-Hdt" id="lGm-Zi-tm9"/>
<outlet property="selectimeBV" destination="K8k-7a-iai" id="ZoQ-gF-9MF"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......@@ -64,7 +65,7 @@
</connections>
</button>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZLV-28-Hdt">
<rect key="frame" x="0.0" y="88" width="414" height="369"/>
<rect key="frame" x="0.0" y="88" width="414" height="400"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CGG-bQ-22Y">
<rect key="frame" x="15" y="20" width="86" height="30"/>
......@@ -116,14 +117,14 @@
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Fyo-qu-1M0">
<rect key="frame" x="15" y="70" width="399" height="1"/>
<color key="backgroundColor" name="灰色分界线"/>
<color key="backgroundColor" name="白色背景色"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="krB-MO-YmS"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="K8k-7a-iai">
<rect key="frame" x="0.0" y="71" width="414" height="298"/>
<color key="backgroundColor" name="标题背景色"/>
<rect key="frame" x="0.0" y="71" width="414" height="329"/>
<color key="backgroundColor" name="白色背景色"/>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
......@@ -132,7 +133,7 @@
<constraint firstItem="Fyo-qu-1M0" firstAttribute="top" secondItem="CGG-bQ-22Y" secondAttribute="bottom" constant="20" id="9OI-Bg-5VR"/>
<constraint firstItem="Fyo-qu-1M0" firstAttribute="leading" secondItem="ZLV-28-Hdt" secondAttribute="leading" constant="15" id="BH9-fU-n3W"/>
<constraint firstItem="CGG-bQ-22Y" firstAttribute="top" secondItem="ZLV-28-Hdt" secondAttribute="top" constant="20" id="Cbl-8z-Y0X"/>
<constraint firstAttribute="height" constant="369" id="JZx-xw-bJf"/>
<constraint firstAttribute="height" constant="400" id="JZx-xw-bJf"/>
<constraint firstItem="K8k-7a-iai" firstAttribute="leading" secondItem="ZLV-28-Hdt" secondAttribute="leading" id="Lre-Yb-BNZ"/>
<constraint firstItem="aff-vT-yfV" firstAttribute="leading" secondItem="CGG-bQ-22Y" secondAttribute="trailing" constant="20" id="OJp-NB-irk"/>
<constraint firstItem="CGG-bQ-22Y" firstAttribute="leading" secondItem="ZLV-28-Hdt" secondAttribute="leading" constant="15" id="jrh-a0-6Wf"/>
......@@ -181,12 +182,6 @@
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="标题背景色">
<color red="1" green="0.68999999761581421" blue="0.47099998593330383" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色分界线">
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" 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