Commit 9ec64ef9 authored by 刘俊宏's avatar 刘俊宏

添加了(收支统计的时间选择)和 新增编辑地址的地址选择器

parent fe252789
......@@ -482,6 +482,7 @@
F96E9D5D246656A700B5B94A /* HGImagePickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F96E9D58246656A700B5B94A /* HGImagePickerController.swift */; };
F96E9D60246657B500B5B94A /* HGImage.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F96E9D5E246657B500B5B94A /* HGImage.xcassets */; };
F96E9D61246657B500B5B94A /* HGImage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F96E9D5F246657B500B5B94A /* HGImage.storyboard */; };
F971D7B3248B6432007F1619 /* address_new.json in Resources */ = {isa = PBXBuildFile; fileRef = F971D7B2248B6432007F1619 /* address_new.json */; };
F9956B1C2463D941001A617D /* WorkSelectTimeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9956B1B2463D941001A617D /* WorkSelectTimeView.xib */; };
F9956B1E2463D94E001A617D /* WorkSelectTimeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9956B1D2463D94E001A617D /* WorkSelectTimeView.swift */; };
F9956B22246408A6001A617D /* GoodsClassViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9956B20246408A6001A617D /* GoodsClassViewController.swift */; };
......@@ -1054,6 +1055,7 @@
F96E9D58246656A700B5B94A /* HGImagePickerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HGImagePickerController.swift; sourceTree = "<group>"; };
F96E9D5E246657B500B5B94A /* HGImage.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = HGImage.xcassets; sourceTree = "<group>"; };
F96E9D5F246657B500B5B94A /* HGImage.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = HGImage.storyboard; sourceTree = "<group>"; };
F971D7B2248B6432007F1619 /* address_new.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = address_new.json; sourceTree = "<group>"; };
F9956B1B2463D941001A617D /* WorkSelectTimeView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WorkSelectTimeView.xib; sourceTree = "<group>"; };
F9956B1D2463D94E001A617D /* WorkSelectTimeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkSelectTimeView.swift; sourceTree = "<group>"; };
F9956B20246408A6001A617D /* GoodsClassViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoodsClassViewController.swift; sourceTree = "<group>"; };
......@@ -1366,6 +1368,7 @@
E02FD9F3245578D800E10E27 /* 地址管理 */ = {
isa = PBXGroup;
children = (
F971D7B2248B6432007F1619 /* address_new.json */,
E02FD9F42455790800E10E27 /* DiZhiGuanLiCell.swift */,
E02FD9F52455790800E10E27 /* DiZhiGuanLiCell.xib */,
E02FD9F824557E8600E10E27 /* XinZengDiZhiViewController.swift */,
......@@ -2724,6 +2727,7 @@
E099B589246BF8FA009F587F /* OrderDViewController.xib in Resources */,
E0BE8A91245A9B9600E80134 /* YingFuZhangKuanCell.xib in Resources */,
E02DDD9A24501A5B00ABB707 /* DelGuiGeCell.xib in Resources */,
F971D7B3248B6432007F1619 /* address_new.json in Resources */,
E00D85E8244561FE00F5F816 /* Preview Assets.xcassets in Resources */,
E02DDD962450106C00ABB707 /* PuTongJieTiCell.xib in Resources */,
E07B1E79245966E60055BA3C /* XinCaiGouViewController.xib in Resources */,
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ShouZhiTongJiDayEdit.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ShouZhiTongJiDayEdit@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ShouZhiTongJiDayEdit@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -27,10 +27,10 @@ let systemVersion = (UIDevice.current.systemVersion as String)
//接口地址
//test
//let SERVERCE_ImageHost = "https://z.gelifood.com/"
//let SERVERCE_HOST = "https://z.gelifood.com/admin/"
let SERVERCE_ImageHost = "https://zx.gelifood.com/"
let SERVERCE_HOST = "https://zx.gelifood.com/admin/"
let SERVERCE_ImageHost = "https://z.gelifood.com/"
let SERVERCE_HOST = "https://z.gelifood.com/admin/"
//let SERVERCE_ImageHost = "https://zx.gelifood.com/"
//let SERVERCE_HOST = "https://zx.gelifood.com/admin/"
//online
//let SERVERCE_ImageHost = "https://api.laigewan.com/upload/images/"
//let SERVERCE_HOST = "http://a.gelifood.com/apia"
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="DZGLViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="DZGLViewController" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="btmBtn" destination="cAI-JO-Qdu" id="Ld9-CG-TRT"/>
<outlet property="btmLbl" destination="Ypv-HH-qxb" id="Qod-Sc-gU9"/>
......
......@@ -2,6 +2,7 @@
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
......@@ -157,7 +158,7 @@
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="蓝色字体颜色">
<color red="0.27799999713897705" green="0.56099998950958252" blue="0.88999998569488525" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
......@@ -7,8 +7,11 @@
//
import UIKit
import SwiftyJSON
class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndTFAndBtnCellDelegate{
class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndTFAndBtnCellDelegate, UIPickerViewDelegate, UIPickerViewDataSource{
let titleArr = ["收货人:","地址:","详细地址:","手机号:","电话:","邮编:"]
let holderArr = ["请填写收货人姓名","请选择城市","请输入详细地址","请输入手机号","请输入电话","请输入邮编"]
@IBOutlet weak var listView: UITableView!
......@@ -26,7 +29,7 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
self.view.addSubview(navbar)
listView.separatorStyle = .none
listView.snp.makeConstraints { (make) in
make.top.equalTo(NavCGRect.height)
make.left.right.equalTo(0)
......@@ -38,6 +41,8 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
listView.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitchCell")
listView.register(UINib(nibName: "TitleAndTFAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFAndBtnCell")
// Do any additional setup after loading the view.
showAreaSelect()
}
func rightBtnClick() {
print("删除")
......@@ -69,8 +74,8 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
return 6
}
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
switch indexPath.section {
case 0:
if indexPath.row != 1 && indexPath.row != 2 {
......@@ -94,11 +99,145 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitchCell") as! TitleAndSwitchCell
cell.namelbl.text = "设为默认收货地址"
if indexPath.section == 1 {
cell.namelbl.text = "设为默认寄件地址"
cell.namelbl.text = "设为默认寄件地址"
}
return cell
}
}
}
//MARK:--地址选择器
func showAreaSelect(){
let path = Bundle.main.path(forResource: "address_new", ofType: "json")
let url = URL(fileURLWithPath: path!)
// 带throws的方法需要抛异常
do {
let data = try Data(contentsOf: url)
let jsonData = JSON(data)
print("地址文件数据",jsonData["data"])
self.addressArray = jsonData["data"].arrayObject!
//创建选择器
pickerView=UIPickerView()
//将dataSource设置成自己
pickerView.dataSource=self
//将delegate设置成自己
pickerView.delegate=self
self.view.addSubview(pickerView)
pickerView.snp.makeConstraints { (make) in
make.left.right.equalTo(0)
make.height.equalTo(200)
make.top.equalTo(600)
}
} catch let error as Error? {
print("读取本地数据出现错误!",error as Any)
}
}
//选择器
var pickerView:UIPickerView!
//所以地址数据集合
var addressArray:Array<Any> = []
//选择的省索引
var provinceIndex = 0
//选择的市索引
var cityIndex = 0
//选择的区(县)索引
var areaIndex = 0
//设置选择框的列数为3列,继承于UIPickerViewDataSource协议
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 3
}
//设置选择框的行数,继承于UIPickerViewDataSource协议
func pickerView(_ pickerView: UIPickerView,
numberOfRowsInComponent component: Int) -> Int {
if component == 0 {
return self.addressArray.count
} else if component == 1 {
let province = self.addressArray[provinceIndex] as! Dictionary<String,Any>
return (province["city_list"]! as AnyObject).count
} else {
let province = self.addressArray[provinceIndex] as! Dictionary<String,Any>
if (province["city_list"] as! NSArray).count == 0 {
return 0
}
if let city = (province["city_list"] as! NSArray)[cityIndex]
as? [String: AnyObject] {
print(city["district_list"] as Any)
return city["district_list"]!.count
} else {
return 0
}
}
}
//设置选择框各选项的内容,继承于UIPickerViewDelegate协议
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int,
forComponent component: Int) -> String? {
if component == 0 {
let rowDic = self.addressArray[row] as! Dictionary<String,Any>
return rowDic["area_name"] as? String
}else if component == 1 {
let province = self.addressArray[provinceIndex] as! Dictionary<String,Any>
let city = (province["city_list"] as! NSArray)[row]
as! [String: AnyObject]
return city["area_name"] as? String
}else {
let province = self.addressArray[provinceIndex] as! Dictionary<String,Any>
let city = (province["city_list"] as! NSArray)[cityIndex]
as! [String: AnyObject]
let area = (city["district_list"] as! NSArray)[row] as! Dictionary<String,Any>
return area["area_name"] as? String
}
}
//选中项改变事件(将在滑动停止后触发)
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int,
inComponent component: Int) {
//根据列、行索引判断需要改变数据的区域
switch (component) {
case 0:
provinceIndex = row;
cityIndex = 0;
areaIndex = 0;
pickerView.reloadComponent(1);
pickerView.reloadComponent(2);
pickerView.selectRow(0, inComponent: 1, animated: false)
pickerView.selectRow(0, inComponent: 2, animated: false)
case 1:
cityIndex = row;
areaIndex = 0;
pickerView.reloadComponent(2);
pickerView.selectRow(0, inComponent: 2, animated: false)
case 2:
areaIndex = row;
default:
break;
}
}
//自定义UIPickerView
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
let genderLbl = UILabel()
genderLbl.textAlignment = .center
genderLbl.font = UIFont.systemFont(ofSize: 15)
genderLbl.textColor = UIColor.init(named: "标题字颜色")
if component == 0 {
let rowDic = self.addressArray[row] as! Dictionary<String,Any>
genderLbl.text = rowDic["area_name"] as? String
}else if component == 1 {
let province = self.addressArray[provinceIndex] as! Dictionary<String,Any>
let city = (province["city_list"] as! NSArray)[row]
as! [String: AnyObject]
genderLbl.text = city["area_name"] as? String
}else {
let province = self.addressArray[provinceIndex] as! Dictionary<String,Any>
let city = (province["city_list"] as! NSArray)[cityIndex]
as! [String: AnyObject]
let area = (city["district_list"] as! NSArray)[row] as! Dictionary<String,Any>
genderLbl.text = area["area_name"] as? String
}
return genderLbl
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -423,7 +423,10 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
self.navigationController?.pushViewController(vc, animated: true)
return
case 59: //地址管理
HUD.flash(.label("敬请期待"),delay: 1.2)
// let vc = DZGLViewController()
let vc = XinZengDiZhiViewController()//新增
vc.navTitle = "新增地址"
self.navigationController?.pushViewController(vc, animated: true )
return
case 61: //库存商品
HUD.flash(.label("敬请期待"),delay: 1.2)
......@@ -472,7 +475,8 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
HUD.flash(.label("敬请期待"),delay: 1.2)
return
case 75: //收支统计
HUD.flash(.label("敬请期待"),delay: 1.2)
let vc = ShouZhiTongJiViewController()
self.navigationController?.pushViewController(vc, animated: true)
return
case 76: //收支详情
HUD.flash(.label("敬请期待"),delay: 1.2)
......@@ -527,7 +531,8 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
self.navigationController?.pushViewController(vc, animated: true)
return
case 119: //新增采购单
HUD.flash(.label("敬请期待"),delay: 1.2)
let vc = XinCaiGouViewController()
self.navigationController?.pushViewController(vc, animated: true)
return
case 120: //商品毛利统计
HUD.flash(.label("敬请期待"),delay: 1.2)
......
......@@ -7,8 +7,9 @@
//
import UIKit
import SwiftDate
class ShouZhiTongJiViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource {
class ShouZhiTongJiViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource, WorkSelectTimeViewDelegate {
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var bottomListView: UITableView!
......@@ -22,6 +23,7 @@ class ShouZhiTongJiViewController: BaseViewController,UITableViewDelegate,UITabl
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = "收支统计"
navbar.rightImg = UIImage.init(named: "ShouZhiTongJiDayEdit")
self.view.addSubview(navbar)
SetTopFrame(view: scrollView, height: fullScreenHeight - NavCGRect.height)
......@@ -34,7 +36,68 @@ class ShouZhiTongJiViewController: BaseViewController,UITableViewDelegate,UITabl
topListView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
bottomListView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
}
//MARK:--日期筛选按钮(右上角按钮)
let selectV = WorkSelectTimeView()
var selelctIndex = 1001
var isShowSelectTimeV:Bool = false
var endTime = DateInRegion().dateAt(.endOfDay).date - 8.hours
var starTime = DateInRegion().dateAt(.startOfDay).date - 8.hours
func rightBtnClick() {
print("日期筛选按钮")
if isShowSelectTimeV {
selectV.removeFromSuperview()
}else{
selectV.delegate = self
selectV.selectIndex = selelctIndex
self.view.window?.addSubview(selectV)
selectV.snp.makeConstraints { (make) in
make.top.equalTo(navbar.snp_bottom)
make.left.right.bottom.equalToSuperview()
}
selectV.BeginDate = starTime
selectV.EndDate = endTime
}
}
//MARK:--时间选择视图反馈
func selectWorkIndx(sender: Int, beginDate: Date?, endginDate: Date?) {
selelctIndex = sender;
isShowSelectTimeV = false
switch sender {
case 1001:
// topNavBtn.setTitle("今日", for: .normal)
endTime = DateInRegion().dateAt(.endOfDay).date - 8.hours
starTime = DateInRegion().dateAt(.startOfDay).date - 8.hours //今天开始时间
// loadData()
break
case 1002:
// topNavBtn.setTitle("本周", for: .normal)
endTime = DateInRegion().dateAt(.endOfDay).date - 8.hours
starTime = DateInRegion().dateAt(.startOfWeek).date + 1.days - 8.hours //当周周一开始时间
// loadData()
break
case 1003:
// topNavBtn.setTitle("本月", for: .normal)
endTime = DateInRegion().dateAt(.endOfDay).date - 8.hours
starTime = DateInRegion().dateAt(.startOfMonth).date - 8.hours //本月开始时间
// loadData()
break
case 1004:
if beginDate != nil && endginDate != nil {
let timeInterval:TimeInterval = beginDate!.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = endginDate!.timeIntervalSince1970
let timestr = dayByDouble(sender: timeInterval) + "-" + dayByDouble(sender: timeIntervalEnd)
// topNavBtn.setTitle(timestr, for: .normal)
endTime = endginDate!
starTime = beginDate!
print(timestr)
// loadData()
}
break
default:
break
}
}
//MARK: - cell delegate
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ShouZhiTongJiViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ShouZhiTongJiViewController" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="bottomListView" destination="8vs-I4-ukF" id="bKM-yV-LyJ"/>
<outlet property="scrollView" destination="E3n-cW-Crm" id="Qi6-93-OYR"/>
......@@ -235,7 +236,7 @@
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="蓝色字体颜色">
<color red="0.27799999713897705" green="0.56099998950958252" blue="0.88999998569488525" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
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