Commit 271433da authored by lujunye's avatar lujunye

出库样式修改完成

parent 866f9655
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.929",
"green" : "0.929",
"red" : "0.929"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.929",
"green" : "0.929",
"red" : "0.929"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.973",
"green" : "0.957",
"red" : "0.953"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.973",
"green" : "0.957",
"red" : "0.953"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -13,11 +13,12 @@ protocol CKGmCellDelegate { ...@@ -13,11 +13,12 @@ protocol CKGmCellDelegate {
} }
class CKGmCell: UITableViewCell { class CKGmCell: UITableViewCell {
var dataArr:Array<GetGoodBatchDataModel>? = [] var dataArr:Array<GetGoodBatchDataModel>? = []
@IBOutlet weak var listBg: UIView!
@IBOutlet weak var titleViewH: NSLayoutConstraint!
@IBOutlet weak var select_btn: UIButton!
@IBOutlet weak var detailLbl: UILabel! @IBOutlet weak var detailLbl: UILabel!
@IBOutlet weak var titleView: UIView!
var delegate:CKGmCellDelegate? var delegate:CKGmCellDelegate?
@IBAction func selectAction(_ sender: Any) { @IBAction func selectAction(_ sender: Any) {
delegate?.CKGmCellSelectAction(cell: self) delegate?.CKGmCellSelectAction(cell: self)
...@@ -32,15 +33,57 @@ class CKGmCell: UITableViewCell { ...@@ -32,15 +33,57 @@ class CKGmCell: UITableViewCell {
// Initialization code // Initialization code
} }
let scrollView = UIScrollView()
override func layoutIfNeeded() { override func layoutIfNeeded() {
listBg.subviews.forEach { (view) in let colorName = "#F3F4F8"
view.removeFromSuperview() scrollView.bounces = true
} scrollView.frame = CGRect(x: 15.0, y: select_btn.frame.maxY + 3.0, width: ScreenWidth-30.0, height: CGFloat(dataArr!.count) * 30.0 + 38.5)
scrollView.contentSize = CGSize(width: 495, height: 0)
self.contentView.addSubview(scrollView)
let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 495, height: 38.5))
scrollView.addSubview(titleView)
titleView.backgroundColor = UIColor(named: colorName)
let t1 = UILabel(frame: CGRect(x: 0, y: 0, width: 110, height: 38.5))
titleView.addSubview(t1)
t1.text = "格利商品批次"
t1.font = UIFont.systemFont(ofSize: 13)
t1.textAlignment = .center
t1.textColor = UIColor(named: "标题字颜色")
let t2 = UILabel(frame: CGRect(x: 111, y: 0, width: 110, height: 38.5))
titleView.addSubview(t2)
t2.text = "商品状态"
t2.font = UIFont.systemFont(ofSize: 13)
t2.textAlignment = .center
t2.textColor = UIColor(named: "标题字颜色")
let t3 = UILabel(frame: CGRect(x: t2.frame.maxX+1, y: 0, width: 181.5, height: 38.5))
titleView.addSubview(t3)
t3.text = "供应商"
t3.font = UIFont.systemFont(ofSize: 13)
t3.textAlignment = .center
t3.textColor = UIColor(named: "标题字颜色")
let t4 = UILabel(frame: CGRect(x: t3.frame.maxX+1, y: 0, width: 495 - t3.frame.maxX - 1 , height: 38.5))
titleView.addSubview(t4)
t4.text = "出库数量"
t4.font = UIFont.systemFont(ofSize: 13)
t4.textAlignment = .center
t4.textColor = UIColor(named: "标题字颜色")
let lineV = UIView(frame: CGRect(x: 0, y: titleView.frame.maxY, width: 495, height: 1))
scrollView.addSubview(lineV)
lineV.backgroundColor = UIColor(named: "#EDEDED")
let bottomView = UIView(frame: CGRect(x: 0, y: titleView.frame.maxY+1, width: 495, height: scrollView.bounds.size.height-38.5))
scrollView.addSubview(bottomView)
bottomView.backgroundColor = UIColor(named: colorName)
if dataArr!.count > 0 { if dataArr!.count > 0 {
for i in 0 ..< dataArr!.count { for i in 0 ..< dataArr!.count {
let model = dataArr![i] let model = dataArr![i]
let view = UIView() let view = UIView()
listBg.addSubview(view) bottomView.addSubview(view)
view.snp.makeConstraints { (make) in view.snp.makeConstraints { (make) in
make.top.equalTo(i * 30) make.top.equalTo(i * 30)
make.height.equalTo(30) make.height.equalTo(30)
...@@ -48,22 +91,25 @@ class CKGmCell: UITableViewCell { ...@@ -48,22 +91,25 @@ class CKGmCell: UITableViewCell {
} }
let leftL = UILabel() let leftL = UILabel()
view.addSubview(leftL) view.addSubview(leftL)
leftL.textAlignment = .center
leftL.textColor = UIColor(named: "个人中心灰色字体") leftL.textColor = UIColor(named: "个人中心灰色字体")
leftL.font = UIFont.systemFont(ofSize: 13) leftL.font = UIFont.systemFont(ofSize: 13)
leftL.snp.makeConstraints { (make) in leftL.snp.makeConstraints { (make) in
make.left.equalTo(30) make.centerX.equalTo(t1.snp_centerX)
make.top.bottom.right.equalTo(0) make.centerY.equalTo(view.snp_centerY)
make.width.equalTo(100)
} }
leftL.text = "\(model.batch_id!)" leftL.text = "\(model.batch_id!)"
let middleL = UILabel() let middleL = UILabel()
view.addSubview(middleL) bottomView.addSubview(middleL)
middleL.textColor = UIColor(named: "个人中心灰色字体") middleL.textColor = UIColor(named: "个人中心灰色字体")
middleL.font = UIFont.systemFont(ofSize: 13) middleL.font = UIFont.systemFont(ofSize: 13)
middleL.textAlignment = .center middleL.textAlignment = .center
middleL.snp.makeConstraints { (make) in middleL.snp.makeConstraints { (make) in
make.centerX.equalTo(view.snp_centerX) make.centerX.equalTo(t2.snp_centerX)
make.top.bottom.right.equalTo(0) make.centerY.equalTo(view.snp_centerY)
make.width.equalTo(100)
} }
var stauts = "" var stauts = ""
switch model.status {//1正常,2临期,3过期 switch model.status {//1正常,2临期,3过期
...@@ -77,20 +123,35 @@ class CKGmCell: UITableViewCell { ...@@ -77,20 +123,35 @@ class CKGmCell: UITableViewCell {
stauts = "过期" stauts = "过期"
break break
} }
middleL.text = stauts middleL.text = stauts
let rightL = UILabel() let rightL = UILabel()
view.addSubview(rightL) bottomView.addSubview(rightL)
rightL.textColor = UIColor(named: "个人中心灰色字体") rightL.textColor = UIColor(named: "个人中心灰色字体")
rightL.textAlignment = .right rightL.textAlignment = .center
rightL.font = UIFont.systemFont(ofSize: 13) rightL.font = UIFont.systemFont(ofSize: 13)
rightL.snp.makeConstraints { (make) in rightL.snp.makeConstraints { (make) in
make.right.equalTo(-30) make.centerX.equalTo(t4.snp_centerX)
make.top.bottom.left.equalTo(0) make.centerY.equalTo(view.snp_centerY)
make.width.equalTo(83.5)
} }
rightL.text = "\(model.chuHuoLiang!)" rightL.text = "\(model.chuHuoLiang!)"
let rightL2 = UILabel()
bottomView.addSubview(rightL2)
rightL2.textColor = UIColor(named: "个人中心灰色字体")
rightL2.textAlignment = .center
rightL2.font = UIFont.systemFont(ofSize: 13)
rightL2.snp.makeConstraints { (make) in
make.centerX.equalTo(t3.snp_centerX)
make.centerY.equalTo(view.snp_centerY)
make.width.equalTo(171.5)
}
rightL2.text = "\(model.chuHuoLiang!)"
} }
} }
scrollView.contentSize = CGSize(width: 495.0, height: 38.5 + 30.0 * CGFloat(dataArr!.count))
scrollView.isScrollEnabled = true
super.layoutIfNeeded() super.layoutIfNeeded()
} }
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
......
...@@ -319,17 +319,9 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -319,17 +319,9 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
let arr = piCiArr?[cell.tag] let arr = piCiArr?[cell.tag]
if arr!.count > 0 { if arr!.count > 0 {
cell.dataArr = arr cell.dataArr = arr
cell.titleView.alpha = 1 cell.scrollView.isHidden = false
cell.titleView.isHidden = false
cell.titleViewH.constant = 35
cell.listBg.isHidden = false
cell.listBg.alpha = 1
}else{ }else{
cell.listBg.isHidden = true cell.scrollView.isHidden = true
cell.titleView.isHidden = true
cell.titleViewH.constant = 0
cell.titleView.alpha = 0
cell.listBg.alpha = 0
} }
return cell 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