123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- //
- // OrderDetailFootView.swift
- // ADHTuanCan
- //
- // Created by 敖德亨 on 2023/11/8.
- //
- import UIKit
- class OrderDetailFootView: UIView {
- @IBOutlet weak var countLab: UILabel!
-
- @IBOutlet weak var priceLab: UILabel!
-
- @IBOutlet weak var orderNumLab: UILabel!
-
- ///下单时间
- @IBOutlet weak var takeOrderTimeLab: UILabel!
-
- /// 结算方式
- @IBOutlet weak var paySetLab: UILabel!
-
- @IBOutlet weak var tableView: UITableView!
-
- /// 原价
- @IBOutlet weak var oldPriceLab: UILabel!
-
- /// 优惠价格
- @IBOutlet weak var salePriceLab: UILabel!
-
- @IBOutlet weak var saleTableBackView: UIView!
-
- @IBOutlet weak var tableViewHeight: NSLayoutConstraint!
- var dataModel : OrderOutDetailModel?
-
- var dataSource : [SaleDetailModel]?
-
- /// hud 提示
- lazy var hud : MCHud! = {
- return MCHud()
- }()
-
- override func awakeFromNib() {
- super.awakeFromNib()
- self.tableView.register(withType: SaleDetailViewCellTableViewCell.self)
- }
-
- func configModel(model : OrderOutDetailModel){
- self.dataModel = model
- self.dataSource = model.mealPriceMsgs
- self.countLab.text = LanguagesUtil.createTextBy(Ctext: "共\(model.mealNum ?? "")件 合计S$", Etext: "There are \(model.mealNum ?? "") dishes,total S$")
- self.priceLab.text = "\(model.price ?? "")"
- self.orderNumLab.text = "\(model.orderNo ?? "")"
- self.takeOrderTimeLab.text = "\(model.createTime ?? "")"
-
- ///结算方式,1全款,2定金
- if model.settleType === 1{
- self.paySetLab.text = LanguagesUtil.createTextBy(Ctext: "全款", Etext: "full payment")
- }else{
- self.paySetLab.text = LanguagesUtil.createTextBy(Ctext: "定金", Etext: "deposit")
- }
-
-
- self.oldPriceLab.text = "S$\(model.originalPrice ?? "")"
- self.salePriceLab.text = "S$\(model.discountAmount ?? "")"
-
- self.tableView.reloadData()
-
-
- if self.dataSource?.count ?? 0 > 0{
- self.tableViewHeight.constant = CGFloat(60 + (self.dataSource?.count ?? 0) * 44)
-
- }else{
- self.tableViewHeight.constant = 0
-
- }
-
- self.setFrameSize(CGSize.init(width: kSCREEN_WIDTH, height: 230 + self.tableViewHeight.constant))
-
- }
- @IBAction func copyOrderNumAcTion(_ sender: UIButton) {
-
- let pastboard = UIPasteboard.general
- pastboard.string = "\(self.dataModel?.orderNo ?? "")"
- if !(pastboard.string.isEmptyStr){
- print("%@",pastboard.string!)
- self.hud.showSuccess(LanguagesUtil.createTextBy(Ctext: "复制成功", Etext: "copy success"))
- }
- }
-
-
- @IBAction func checkSaleDetailAction(_ sender: UIButton) {
- }
- }
- extension OrderDetailFootView : UITableViewDelegate,UITableViewDataSource{
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return self.dataSource?.count ?? 0
-
- }
-
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = tableView.dequeueReusableCell(withIdentifier: "SaleDetailViewCellTableViewCell") as! SaleDetailViewCellTableViewCell
- let model : SaleDetailModel = self.dataSource![indexPath.row]
- cell.configModel(model: model)
- return cell
- }
-
- func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
- return 0.01
- }
-
- func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- }
-
- func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
- return 0.01
- }
-
-
- }
|