Commit 14f598fa authored by lujunye's avatar lujunye

完善采购单详情cell适用含预售标识的cell

parent c370e356
......@@ -9,18 +9,101 @@
import UIKit
class CGDListCell: UITableViewCell {
///预售图标
@IBOutlet weak var yuShouStatus: UILabel!
///标题左间距
@IBOutlet weak var nameLblLeft: NSLayoutConstraint!
///图标
@IBOutlet weak var leftIcon: UIImageView!
///列表底图
@IBOutlet weak var listBgView: UIView!
///按钮底图
@IBOutlet weak var btnBgView: UIView!
///数量
@IBOutlet weak var countLbl: UILabel!
///价格
@IBOutlet weak var priceLbl: UILabel!
///状态
@IBOutlet weak var statusLbl: UILabel!
///标题
@IBOutlet weak var nameLbl: UILabel!
var dataArr:Array<Any>?
override func awakeFromNib() {
super.awakeFromNib()
self.selectionStyle = .none
// Initialization code
}
override func layoutIfNeeded() {
if dataArr != nil {
setListView(arr: dataArr!)
}
super.layoutIfNeeded()
}
func setBtnView(arr:Array<Any>){
//按钮
btnBgView.subviews.forEach { (view) in
view.removeFromSuperview()
}
}
func setListView(arr:Array<Any>){
//列表
listBgView.subviews.forEach { (view) in
view.removeFromSuperview()
}
if arr.count > 0 {
var num = 0
if arr.count > 4 {
num = 4
}else{
num = arr.count
}
for i in 0 ..< num {
// let model = dataArr![i]
let view = UIView()
listBgView.addSubview(view)
view.backgroundColor = UIColor.white
view.snp.makeConstraints { (make) in
make.top.equalTo(i * 49)
make.left.right.equalTo(0)
make.height.equalTo(49)
}
if i != num - 1 {
let dotLine = UIImageView()
view.addSubview(dotLine)
dotLine.image = UIImage(named: "dotLine")
dotLine.snp.makeConstraints { (make) in
make.left.equalTo(15)
make.bottom.right.equalTo(0)
make.height.equalTo(1)
}
}
let lbl = UILabel()
lbl.font = UIFont.systemFont(ofSize: 13)
lbl.textColor = UIColor(named: "灰色字体颜色")
// lbl.text = model.goods_name
view.addSubview(lbl)
lbl.snp.makeConstraints { (make) in
make.left.equalTo(15)
make.bottom.top.right.equalTo(0)
}
let lbl2 = UILabel()
lbl2.font = UIFont.systemFont(ofSize: 13)
lbl2.textColor = UIColor(named: "灰色字体颜色")
// lbl2.text = "x" + "\(model.number!)"
lbl2.textAlignment = .right
view.addSubview(lbl2)
lbl2.snp.makeConstraints { (make) in
make.right.equalTo(-15)
make.bottom.left.top.equalTo(0)
}
}
}
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
......
......@@ -124,12 +124,35 @@
<rect key="frame" x="0.0" y="48.5" width="345" height="0.0"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
</view>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="预售" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ekx-rs-uaM">
<rect key="frame" x="67" y="15" width="32" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="32" id="LHh-n4-Z7e"/>
<constraint firstAttribute="height" constant="18" id="aij-u3-5HC"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" name="企业、预售字体"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" name="企业、预售字体"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="1"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="2"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="ZEQ-bR-jNZ" firstAttribute="leading" secondItem="xNb-6a-mWT" secondAttribute="leading" id="3H6-Mf-efn"/>
<constraint firstItem="HVh-eU-WcT" firstAttribute="top" secondItem="xNb-6a-mWT" secondAttribute="top" constant="15" id="3vl-Na-tUS"/>
<constraint firstItem="wn2-a8-osu" firstAttribute="top" secondItem="ZEQ-bR-jNZ" secondAttribute="bottom" id="4nM-v6-4eY"/>
<constraint firstItem="ekx-rs-uaM" firstAttribute="leading" secondItem="CPQ-JB-dO9" secondAttribute="trailing" constant="5" id="5O5-f0-Pp7"/>
<constraint firstItem="ekx-rs-uaM" firstAttribute="centerY" secondItem="CPQ-JB-dO9" secondAttribute="centerY" id="66g-c2-yre"/>
<constraint firstItem="CPQ-JB-dO9" firstAttribute="centerY" secondItem="HVh-eU-WcT" secondAttribute="centerY" id="6qc-GO-WUG"/>
<constraint firstItem="CPQ-JB-dO9" firstAttribute="leading" secondItem="HVh-eU-WcT" secondAttribute="trailing" constant="5" id="F2c-jm-aNc"/>
<constraint firstItem="HVh-eU-WcT" firstAttribute="leading" secondItem="xNb-6a-mWT" secondAttribute="leading" constant="15" id="I5S-Pm-VYW"/>
......@@ -166,10 +189,13 @@
<connections>
<outlet property="btnBgView" destination="KO3-dv-aSL" id="FKG-4d-9rD"/>
<outlet property="countLbl" destination="J1p-oh-7KC" id="brI-AH-qUH"/>
<outlet property="leftIcon" destination="HVh-eU-WcT" id="dMO-qL-wPe"/>
<outlet property="listBgView" destination="ZEQ-bR-jNZ" id="tlg-VJ-Qsv"/>
<outlet property="nameLbl" destination="CPQ-JB-dO9" id="iu0-NX-a71"/>
<outlet property="nameLblLeft" destination="F2c-jm-aNc" id="HWs-sw-XVh"/>
<outlet property="priceLbl" destination="gXv-WF-NRU" id="VRb-af-Nta"/>
<outlet property="statusLbl" destination="2ga-12-xdH" id="rf1-RB-YLe"/>
<outlet property="yuShouStatus" destination="ekx-rs-uaM" id="O20-FR-ggQ"/>
</connections>
<point key="canvasLocation" x="131.15942028985509" y="96.428571428571431"/>
</tableViewCell>
......@@ -185,6 +211,9 @@
<namedColor name="个人中心灰色字体">
<color red="0.3919999897480011" green="0.3919999897480011" blue="0.3919999897480011" 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.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
......
......@@ -37,6 +37,8 @@ class CGDXQVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,GLAl
listView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
listView.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtnCell")
listView.register(UINib(nibName: "CGDCell", bundle: nil), forCellReuseIdentifier: "CGDCell")
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
......
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