123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- //
- // ShoppingCartOrderPayView.swift
- // RainbowPlanet
- //
- // Created by Christopher on 2019/5/9.
- // Copyright © 2019 RainbowPlanet. All rights reserved.
- // 购物车--订单支付View
- import UIKit
- class ShoppingCartOrderPayView: BaseView {
-
- override func setupViews() {
- self.backgroundColor = kf7f8faColor
- addSubview(accountView)
- addSubview(tableView)
- let emptyView = EmptyView.shared.diyCustomEmptyViewStyle2(iconStr: "page04", titleStr: "当前暂无数据")
- emptyView.contentViewY = kScaleValue(value: 182)
- tableView.ly_emptyView = emptyView
- tableView.ly_startLoading()
- }
-
- override func setupLayouts() {
- accountView.snp.makeConstraints { (make) in
- make.left.right.equalToSuperview()
- make.bottom.equalTo(-kSafeTabBarHeight)
- make.height.equalTo(48)
- }
- tableView.snp.makeConstraints { (make) in
- make.edges.equalToSuperview()
- make.bottom.equalTo(accountView.snp_top).offset(-20)
- }
- }
-
- lazy var accountView: OrderPayAcountView = {
- let accountView = OrderPayAcountView()
- return accountView
- }()
-
- lazy var tableView: UITableView = {
- let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
- tableView.separatorStyle = .none
- tableView.backgroundColor = kf7f8faColor
- tableView.dataSource = self
- tableView.delegate = self
- tableView.estimatedRowHeight = 0.000001
- tableView.estimatedSectionFooterHeight = 0.000001
- tableView.estimatedSectionHeaderHeight = 0.000001
- return tableView
- }()
-
- }
- extension ShoppingCartOrderPayView : UITableViewDelegate, UITableViewDataSource {
- func numberOfSections(in tableView: UITableView) -> Int {
- return 3
- }
-
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- if section == 0 {
- return 1
- } else {
- return 2
- }
- }
-
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- if indexPath.section == 0 {
- let cell = ShoppingCartListNoneItemCell.cellWith(tableView: tableView, indexPath: indexPath)
- return cell
-
- } else {
- let cell = ShoppingCartPayOrderItemCell.cellWith(tableView: tableView, indexPath: indexPath)
- return cell
- }
- }
-
- func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
- return UITableView.automaticDimension
- }
-
- func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
- if section == 0 {
- return 10
- } else {
- return 48
- }
- }
-
- func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
- if section == 0 {
- return nil
- } else {
- let headerView = ShoppingCartPayOrderHeader(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 48))
- return headerView
- }
- }
-
- func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
- if section == 0 {
- return 0.000001
- } else {
- return 88
- }
- }
-
- func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
- if section == 0 {
- return nil
- } else {
- let footerView = ShoppingCartPayOrderFooter(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 88))
- return footerView
- }
- }
-
- }
|