Commit 93f8bc21 authored by lujunye's avatar lujunye

待补充时间选择

parent f8abf555
......@@ -33,6 +33,7 @@ class VendorListDataModel: Mappable {
var city : Int? //市id
var district : Int? //区id
var address : String? //详细地址
var contacts_name:String? //联系人
var contacts_phone : String? //联系人电话
var contacts_mobile : String? //联系人手机号
var zhizhao : String? //营业执照
......@@ -52,6 +53,7 @@ class VendorListDataModel: Mappable {
ven_name <- map["ven_name"]
province <- map["province"]
city <- map["city"]
contacts_name <- map["contacts_name"]
district <- map["district"]
address <- map["address"]
contacts_phone <- map["contacts_phone"]
......
......@@ -15,9 +15,7 @@ class GYSGLCell: UITableViewCell {
@IBOutlet weak var selectTypeBtn: UIButton!
@IBOutlet weak var selectTypeView: UIView!
@IBAction func selectAction(_ sender: Any) {
selectTypeBtn.isSelected = !selectTypeBtn.isSelected
}
@IBOutlet weak var Lbl3: UILabel!
@IBOutlet weak var Lbl2: UILabel!
@IBOutlet weak var Lbl1: UILabel!
......
<?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"/>
......@@ -10,7 +11,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="GYSGLCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="GYSGLCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
......@@ -91,22 +92,12 @@
<state key="normal" image="daixuan"/>
<state key="selected" image="yuxuan"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Hl5-nJ-ltZ">
<rect key="frame" x="0.0" y="0.0" width="60" height="100"/>
<connections>
<action selector="selectAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="gos-H7-iRU"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="q1A-kf-Vam" secondAttribute="trailing" constant="15" id="7rf-NV-2qJ"/>
<constraint firstItem="Hl5-nJ-ltZ" firstAttribute="leading" secondItem="yTm-Gk-jr3" secondAttribute="leading" id="JZ8-4t-68d"/>
<constraint firstItem="q1A-kf-Vam" firstAttribute="centerY" secondItem="yTm-Gk-jr3" secondAttribute="centerY" id="Lfn-Bw-qKb"/>
<constraint firstAttribute="trailing" secondItem="Hl5-nJ-ltZ" secondAttribute="trailing" id="WTh-w4-hQk"/>
<constraint firstAttribute="width" constant="60" id="XEz-wR-bpA"/>
<constraint firstAttribute="bottom" secondItem="Hl5-nJ-ltZ" secondAttribute="bottom" id="cYf-p4-glJ"/>
<constraint firstItem="Hl5-nJ-ltZ" firstAttribute="top" secondItem="yTm-Gk-jr3" secondAttribute="top" id="lWD-4j-dMX"/>
</constraints>
</view>
</subviews>
......
......@@ -11,11 +11,68 @@ import UIKit
class GYSListViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate,UISearchBarDelegate,SearchBarViewDelegate{
var searchV : SearchBarView? = nil
var selectTarget:VendorListDataModel?
@IBOutlet weak var topView: UIView!
@IBOutlet weak var btmLbl: UILabel!
@IBOutlet weak var listView: UITableView!
var barTitle:String?
var keyWord = ""
var page = 0
var datas:Array<VendorListDataModel> = []
@objc func loadData(){
print("加载数据")
page = 1
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let dict = [
"user_token":UserToken as Any,
"keyword":keyWord as Any,
"page":page as Any
]
vendorList(dict, success: { (data) in
self.datas.removeAll()
let model = data as! VendorListModel
self.listView.mj_header?.endRefreshing()
self.page = 2
model.data?.forEach({ (item) in
self.datas.append(item)
})
self.listView.reloadData()
if model.data?.count == 0 {
self.listView?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.listView?.mj_footer?.endRefreshing()
}
}) { (error) in
}
}
//MARK:--加载更多数据
@objc func loadMoreData(){
print("加载更多数据")
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let dict = [
"user_token":UserToken as Any,
"keyword":keyWord as Any,
"page":page as Any
]
vendorList(dict, success: { (data) in
let dataM = data as! VendorListModel
if dataM.data?.count == 0{
self.listView?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.page += 1
dataM.data?.forEach({ (model) in
self.datas.append(model)
})
self.listView.reloadData()
self.listView?.mj_footer?.endRefreshing()
}
}) { (error) in
self.listView?.mj_footer?.endRefreshing()
}
}
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = barTitle
......@@ -42,6 +99,14 @@ class GYSListViewController: BaseViewController,UITableViewDataSource,UITableVie
listView.separatorStyle = .none
listView.register(UINib(nibName: "GYSGLCell", bundle: nil), forCellReuseIdentifier: "GYSGLCell")
// Do any additional setup after loading the view.
//下拉刷新相关设置
headerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadData))
self.listView!.mj_header = headerMJ
//上拉加载相关设置
footerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadMoreData))
self.listView!.mj_footer = footerMJ
self.listView?.mj_header?.beginRefreshing()
}
@IBAction func addAction(_ sender: Any) {
......@@ -58,23 +123,46 @@ class GYSListViewController: BaseViewController,UITableViewDataSource,UITableVie
}
//MARK: - CELL DELEGATE
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = GYSGLViewController()
self.navigationController?.pushViewController(vc, animated: true)
if barTitle == "供应商管理" {
let vc = GYSGLViewController()
self.navigationController?.pushViewController(vc, animated: true)
}else{
selectTarget = datas[indexPath.row]
listView.reloadData()
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 105.5
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
return datas.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "GYSGLCell") as! GYSGLCell
let model = datas[indexPath.row]
if barTitle != "供应商管理" {
cell.selectTypeBtn.isSelected = false
cell.selectTypeView.isHidden = false
if selectTarget?.ven_id == model.ven_id {
cell.selectTypeBtn.isSelected = true
}
}else{
cell.selectTypeView.isHidden = true
}
cell.Lbl1.text = model.ven_name!
cell.Lbl2.text = model.contacts_name! + " " + model.contacts_phone!
cell.Lbl3.text = model.p_cn! + model.address!
if model.c_cn != nil {
cell.Lbl3.text = model.p_cn! + model.c_cn! + model.address!
if model.d_cn != nil {
cell.Lbl3.text = model.p_cn! + model.c_cn! + model.d_cn! + model.address!
}
}
return cell
}
}
......@@ -206,7 +206,13 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
let model = adrArrs[indexPath.row]
cell.nameLbl.text = model.consignee
cell.phoneLbl.text = model.mobile
cell.adrLbl.text = model.address
cell.adrLbl.text = model.province_cn! + model.address!
if model.city_cn != nil {
cell.adrLbl.text = model.province_cn! + model.city_cn! + model.address!
if model.district_cn != nil {
cell.adrLbl.text = model.province_cn! + model.city_cn! + model.district_cn! + model.address!
}
}
cell.btnH.constant = 0
cell.xValue.constant = 0
cell.blueLbl.isHidden = true
......
......@@ -7,9 +7,20 @@
//
import UIKit
protocol CGDCellDelegate {
func CGDCellDelAction(cell:CGDCell)
}
class CGDCell: UITableViewCell {
var delegate:CGDCellDelegate?
@IBAction func delAction(_ sender: UIButton) {
delegate?.CGDCellDelAction(cell: self)
}
@IBOutlet weak var cgTotalPrice: UILabel!
@IBOutlet weak var cgPrice: UILabel!
@IBOutlet weak var cgCount: UILabel!
@IBOutlet weak var detailLbl: UILabel!
@IBOutlet weak var nameLbl: UILabel!
@IBOutlet weak var btnWidth: NSLayoutConstraint!
override func awakeFromNib() {
super.awakeFromNib()
self.selectionStyle = .none
......
......@@ -8,7 +8,27 @@
import UIKit
class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource {
class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CGDCellDelegate,XuanZeShangPinViewControllerDelegate{
func XuanZeShangPinViewControllerSubmitAction(selectArr: Array<GetGoodsInfoDataModel>) {
for item in selectArr{
datas.append(item)
}
listView.reloadData()
}
func XuanZeShangPinViewControllerYuShou(YuShouData: Array<GetGoodsInfoDataModel>) {
}
func XuanZeShangPinViewControllerEdit(selectArr: Array<GetGoodsInfoDataModel>) {
}
//MARK: - 删除
func CGDCellDelAction(cell: CGDCell) {
}
//MARK: - 提交审核
@IBAction func submitAction(_ sender: Any) {
......@@ -16,8 +36,8 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
}
@IBOutlet weak var listView: UITableView!
@IBOutlet weak var btmLine: UIView!
var datas:Array<Any> = []
let titleArr = ["采购日期","供应商","采购人","制单人","采购类型"]
var datas:Array<GetGoodsInfoDataModel> = []
let titleArr = ["采购日期","供应商","采购人","采购类型"]
let holderArr = ["","请选择供应商","请输入采购人姓名","","请选择采购类型"]
override func viewDidLoad() {
super.viewDidLoad()
......@@ -29,6 +49,7 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
listView.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtnCell")
listView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
listView.register(UINib(nibName: "CGDDayCell", bundle: nil), forCellReuseIdentifier: "CGDDayCell")
listView.register(UINib(nibName: "CGDCell", bundle: nil), forCellReuseIdentifier: "CGDCell")
}
//MARK: - cell delegate
......@@ -39,6 +60,9 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
case 0://时间
break
case 1://供应商
let vc = GYSListViewController()
vc.barTitle = "选择供应商"
self.navigationController?.pushViewController(vc, animated: true)
break
case 4://采购类型
break
......@@ -50,9 +74,11 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
//MARK: - 添加商品
@objc func addItemAction(){
print("add product")
datas.append("1")
listView.reloadData()
let vc = XuanZeShangPinViewController()
vc.delegate = self
vc.barTitle = "选择商品"
self.navigationController?.pushViewController(vc, animated: true)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
......@@ -76,7 +102,16 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
}
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
let cell = tableView.dequeueReusableCell(withIdentifier: "CGDCell") as! CGDCell
cell.tag = indexPath.row
cell.delegate = self
let model = datas[indexPath.row]
cell.nameLbl.text = model.goods_name!
cell.detailLbl.text = model.spec_str! + " ¥" + model.target_Price! + "x\(model.target_Count!) " + model.unit!
cell.cgCount.text = "\(model.target_Count!)"
cell.cgPrice.text = model.target_Price!
let price = model.target_Price! as NSString
cell.cgTotalPrice.text = "\(Float(model.target_Count!) * price.floatValue)"
return cell
}
......
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