|
@@ -16,6 +16,8 @@ class JDTradeHoldAlertView: BaseAlertView {
|
|
|
|
|
|
return v
|
|
|
}()
|
|
|
+
|
|
|
+ var itemModel : JDPositionModel?
|
|
|
|
|
|
|
|
|
lazy var topCloseBtn : UIButton = {
|
|
@@ -26,6 +28,11 @@ class JDTradeHoldAlertView: BaseAlertView {
|
|
|
return v
|
|
|
}()
|
|
|
|
|
|
+ var titleAry = ["",switchLanguage("平仓") , switchLanguage("修改") , switchLanguage("交易"),switchLanguage("图标")]
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var iconAry = ["","jd_trade_alert_pc", "jd_trade_alert_xg", "jd_trade_alert_jy","jd_trade_alert_tb"]
|
|
|
|
|
|
|
|
|
lazy var tableView : UITableView = {
|
|
@@ -33,17 +40,17 @@ class JDTradeHoldAlertView: BaseAlertView {
|
|
|
tableView.delegate = self
|
|
|
tableView.dataSource = self
|
|
|
tableView.separatorStyle = .none
|
|
|
- tableView.backgroundColor = .white
|
|
|
+ tableView.backgroundColor = _color("#F3F4F6&#F3F4F6")
|
|
|
tableView.tableFooterView = UIView()
|
|
|
tableView.tableHeaderView = UIView()
|
|
|
tableView.showsVerticalScrollIndicator = false
|
|
|
tableView.showsVerticalScrollIndicator = false
|
|
|
- tableView.estimatedRowHeight = 60
|
|
|
+ tableView.estimatedRowHeight = 160
|
|
|
tableView.layer.masksToBounds = true
|
|
|
tableView.layer.cornerRadius = 10
|
|
|
|
|
|
- tableView.register(JDAFiatAccountBalanceCell.self, forCellReuseIdentifier: JDAFiatAccountBalanceCell.description())
|
|
|
-
|
|
|
+ tableView.register(JDTradeAlertInfoCell.self, forCellReuseIdentifier: JDTradeAlertInfoCell.description())
|
|
|
+ tableView.register(JDTradeAlertCell.self, forCellReuseIdentifier: JDTradeAlertCell.description())
|
|
|
return tableView
|
|
|
|
|
|
}()
|
|
@@ -67,7 +74,7 @@ class JDTradeHoldAlertView: BaseAlertView {
|
|
|
self.addSubview(tableView)
|
|
|
tableView.snp.makeConstraints { make in
|
|
|
make.left.right.equalTo(self)
|
|
|
- make.bottom.equalTo(self.snp.top).offset(6)
|
|
|
+ make.bottom.equalTo(self.snp.bottom)
|
|
|
make.top.equalTo(self.snp.centerY).offset(-6)
|
|
|
}
|
|
|
// self.closeBtn.addTarget(self, action: #selector(clickCloseBtnAction), for: .touchUpInside)
|
|
@@ -97,10 +104,11 @@ class JDTradeHoldAlertView: BaseAlertView {
|
|
|
}
|
|
|
|
|
|
extension JDTradeHoldAlertView{
|
|
|
- func showPopupView(source:[JDTradeAccountModel], complete:@escaping (_ index: NSInteger)->()) -> Void {
|
|
|
+ func showPopupView(model: JDPositionModel, complete:@escaping (_ index: NSInteger)->()) -> Void {
|
|
|
|
|
|
+
|
|
|
completeBlock = complete
|
|
|
- self.sourceArray = source
|
|
|
+ self.itemModel = model
|
|
|
|
|
|
self.backgroundColor = Popup_Bg_Back_Color
|
|
|
|
|
@@ -121,19 +129,32 @@ extension JDTradeHoldAlertView{
|
|
|
extension JDTradeHoldAlertView:UITableViewDelegate,UITableViewDataSource{
|
|
|
|
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
- return self.sourceArray.count
|
|
|
+ return self.titleAry.count
|
|
|
}
|
|
|
|
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
|
|
|
|
- let cell = tableView.dequeueReusableCell(withIdentifier: JDAFiatAccountBalanceCell.description()) as! JDAFiatAccountBalanceCell
|
|
|
- cell.setupBalanceCellByAccount(model: self.sourceArray[indexPath.row])
|
|
|
+ if indexPath.row == 0 {
|
|
|
+
|
|
|
+ let cell = tableView.dequeueReusableCell(withIdentifier: JDTradeAlertInfoCell.description()) as! JDTradeAlertInfoCell
|
|
|
+ return cell
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ let cell = tableView.dequeueReusableCell(withIdentifier: JDTradeAlertCell.description()) as! JDTradeAlertCell
|
|
|
+ cell.iconIv.image = UIImage(named: iconAry[indexPath.row])
|
|
|
+ cell.titleLb.text = titleAry[indexPath.row]
|
|
|
|
|
|
return cell
|
|
|
|
|
|
}
|
|
|
|
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
|
|
+
|
|
|
+ if indexPath.row == 0 {
|
|
|
+ return 180
|
|
|
+ }
|
|
|
+
|
|
|
return -1
|
|
|
}
|
|
|
|
|
@@ -149,6 +170,310 @@ extension JDTradeHoldAlertView:UITableViewDelegate,UITableViewDataSource{
|
|
|
|
|
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
|
self.completeBlock?(indexPath.row)
|
|
|
- dismissAlert()
|
|
|
+// dismissAlert()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+class JDTradeAlertInfoCell: BaseTableViewCell {
|
|
|
+
|
|
|
+ lazy var bgView : UIView = {
|
|
|
+ let v = UIView()
|
|
|
+ v.backgroundColor = .white
|
|
|
+ v.layer.masksToBounds = true
|
|
|
+ v.layer.cornerRadius = 6.4
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var leftLineView : UIView = {
|
|
|
+ let v = UIView()
|
|
|
+ v.backgroundColor = MainBackGroundColor
|
|
|
+// v.layer.masksToBounds = true
|
|
|
+// v.layer.cornerRadius = 6.4
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ lazy var idLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#949494󧳶")
|
|
|
+ v.setTextFont(.PFSR, 14)
|
|
|
+ v.text = "#201542158"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var buyInLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 14)
|
|
|
+ v.text = "买入 1.0"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var upLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#F24040&#F24040")
|
|
|
+ v.setTextFont(.PFSR, 16)
|
|
|
+ v.text = "+3995.50"
|
|
|
+
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var nameLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#333333񑘕")
|
|
|
+ v.setTextFont(.PFSM, 18)
|
|
|
+ v.text = "特斯拉"
|
|
|
+
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var symbolLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 12)
|
|
|
+ v.text = "TSLA"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var timeLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 12)
|
|
|
+ v.text = "2023.08.22 13:04:45"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var szLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 14)
|
|
|
+ v.text = "市值:135000.55"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+ lazy var upDownLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 12)
|
|
|
+ v.text = "135.55-> 138.99"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+ lazy var stopLossLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 12)
|
|
|
+ v.text = "止损: --"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var stopGainLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 12)
|
|
|
+ v.text = "止盈: --"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var lxLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 12)
|
|
|
+ v.text = "利息: 25.00"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var feeLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#AEAEAE&#AEAEAE")
|
|
|
+ v.setTextFont(.PFSR, 12)
|
|
|
+ v.text = "手续费: 25.00"
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
|
|
+ super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
|
+
|
|
|
+ contentView.backgroundColor = .clear
|
|
|
+ self.backgroundColor = .clear
|
|
|
+ contentView.addSubview(bgView)
|
|
|
+ bgView.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(contentView.snp.left).offset(17)
|
|
|
+ make.right.equalTo(contentView.snp.right).offset(-17)
|
|
|
+ make.top.equalTo(contentView.snp.top).offset(17)
|
|
|
+ make.bottom.equalTo(contentView.snp.bottom).offset(-2)
|
|
|
+ }
|
|
|
+ bgView.addSubview(leftLineView)
|
|
|
+ leftLineView.snp.makeConstraints { make in
|
|
|
+ make.left.top.bottom.equalTo(bgView)
|
|
|
+ make.width.equalTo(6)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(idLb)
|
|
|
+ idLb.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(bgView.snp.top).offset(18)
|
|
|
+ make.left.equalTo(leftLineView.snp.right).offset(7)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(buyInLb)
|
|
|
+ buyInLb.snp.makeConstraints { make in
|
|
|
+ make.centerY.equalTo(idLb)
|
|
|
+ make.left.equalTo(idLb.snp.right).offset(18)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(upLb)
|
|
|
+ upLb.snp.makeConstraints { make in
|
|
|
+ make.centerY.equalTo(idLb)
|
|
|
+ make.right.equalTo(bgView.snp.right).offset(-15)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(nameLb)
|
|
|
+ nameLb.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(idLb.snp.left)
|
|
|
+ make.top.equalTo(idLb.snp.bottom).offset(12)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(szLb)
|
|
|
+ szLb.snp.makeConstraints { make in
|
|
|
+ make.centerY.equalTo(nameLb)
|
|
|
+ make.right.equalTo(bgView.snp.right).offset(-15)
|
|
|
+ }
|
|
|
+ bgView.addSubview(symbolLb)
|
|
|
+ symbolLb.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(idLb.snp.left)
|
|
|
+ make.top.equalTo(nameLb.snp.bottom).offset(8)
|
|
|
+ }
|
|
|
+ bgView.addSubview(upDownLb)
|
|
|
+ upDownLb.snp.makeConstraints { make in
|
|
|
+ make.centerY.equalTo(symbolLb)
|
|
|
+ make.right.equalTo(szLb.snp.right)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(timeLb)
|
|
|
+ timeLb.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(idLb.snp.left)
|
|
|
+ make.top.equalTo(timeLb.snp.bottom).offset(8)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(stopLossLb)
|
|
|
+ stopLossLb.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(idLb.snp.left)
|
|
|
+ make.top.equalTo(timeLb.snp.bottom).offset(11)
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(stopGainLb)
|
|
|
+ stopGainLb.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(stopLossLb.snp.left)
|
|
|
+ make.top.equalTo(stopLossLb.snp.bottom).offset(8)
|
|
|
+ make.bottom.equalTo(bgView.snp.bottom).offset(-16)
|
|
|
+ }
|
|
|
+ bgView.addSubview(lxLb)
|
|
|
+ lxLb.snp.makeConstraints { make in
|
|
|
+ make.centerY.equalTo(stopLossLb.snp.centerY)
|
|
|
+ make.right.equalTo(szLb.snp.right)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(feeLb)
|
|
|
+ feeLb.snp.makeConstraints { make in
|
|
|
+ make.centerY.equalTo(stopGainLb)
|
|
|
+ make.right.equalTo(lxLb.snp.right)
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ required init?(coder aDecoder: NSCoder) {
|
|
|
+ fatalError("init(coder:) has not been implemented")
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+class JDTradeAlertCell : BaseTableViewCell {
|
|
|
+
|
|
|
+ lazy var bgView : UIView = {
|
|
|
+ let v = UIView()
|
|
|
+ v.backgroundColor = .white
|
|
|
+ v.layer.masksToBounds = true
|
|
|
+ v.layer.cornerRadius = 6.4
|
|
|
+ v.layer.borderColor = _color("#E7E7E7&#E7E7E7").cgColor
|
|
|
+ v.layer.borderWidth = 0.8
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var iconIv : UIImageView = {
|
|
|
+ let v = UIImageView()
|
|
|
+
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var titleLb : UILabel = {
|
|
|
+ let v = UILabel()
|
|
|
+ v.textColor = _color("#333333񑘕")
|
|
|
+ v.setTextFont(.PFSR, 16)
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ lazy var arrowIv : UIImageView = {
|
|
|
+ let v = UIImageView()
|
|
|
+ v.image = _image("Base_W_RightArrows&Base_W_RightArrows")
|
|
|
+ return v
|
|
|
+ }()
|
|
|
+
|
|
|
+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
|
|
+ super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
|
+
|
|
|
+ contentView.backgroundColor = .clear
|
|
|
+ self.backgroundColor = .clear
|
|
|
+ contentView.addSubview(bgView)
|
|
|
+ bgView.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(contentView.snp.left).offset(17)
|
|
|
+ make.right.equalTo(contentView.snp.right).offset(-17)
|
|
|
+ make.top.equalTo(contentView.snp.top).offset(2)
|
|
|
+ make.bottom.equalTo(contentView.snp.bottom).offset(-2)
|
|
|
+ }
|
|
|
+ bgView.addSubview(iconIv)
|
|
|
+
|
|
|
+ iconIv.snp.makeConstraints { make in
|
|
|
+// make.centerY.equalTo(bgView)
|
|
|
+
|
|
|
+ make.top.equalTo(bgView.snp.top).offset(10)
|
|
|
+ make.bottom.equalTo(bgView.snp.bottom).offset(-10)
|
|
|
+ make.left.equalTo(bgView.snp.left).offset(12)
|
|
|
+ make.size.equalTo(CGSize(width: 24, height: 24))
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(titleLb)
|
|
|
+ titleLb.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(iconIv.snp.right).offset(8)
|
|
|
+ make.centerY.equalTo(iconIv)
|
|
|
+ }
|
|
|
+
|
|
|
+ bgView.addSubview(arrowIv)
|
|
|
+ arrowIv.snp.makeConstraints { make in
|
|
|
+ make.centerY.equalTo(iconIv)
|
|
|
+ make.right.equalTo(bgView.snp.right).offset(-11)
|
|
|
+ make.size.equalTo(CGSize(width: 5, height: 10))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ required init?(coder aDecoder: NSCoder) {
|
|
|
+ fatalError("init(coder:) has not been implemented")
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|