Commit 692d3661 authored by 刘俊宏's avatar 刘俊宏

完成运单列表

parent 3874bb4e
...@@ -27,7 +27,7 @@ class LogisticsModel: Mappable { ...@@ -27,7 +27,7 @@ class LogisticsModel: Mappable {
class LogisticsDataModel: Mappable { class LogisticsDataModel: Mappable {
var id:Int? var id:Int?
var lwb_no : String? //运单号 var lwb_no : String? //运单号
var delivery_status :String? //运单状态:1下单完成 2揽收成功 3运输中 4已签收 5已取消 6拒收 7再投 var delivery_status :Int? //运单状态:1下单完成 2揽收成功 3运输中 4已签收 5已取消 6拒收 7再投
var express_item_name:String?//托寄物名称 var express_item_name:String?//托寄物名称
var sale_plat : String?//所属平台 var sale_plat : String?//所属平台
...@@ -39,6 +39,9 @@ class LogisticsDataModel: Mappable { ...@@ -39,6 +39,9 @@ class LogisticsDataModel: Mappable {
var lc_name:String? //物流公司 var lc_name:String? //物流公司
var delivery_status_cn : String? //运单状态(中文) var delivery_status_cn : String? //运单状态(中文)
var wb_no : String?
var pay_status : Int?
var freight : Float?
required init?( map: Map) { required init?( map: Map) {
...@@ -59,6 +62,11 @@ class LogisticsDataModel: Mappable { ...@@ -59,6 +62,11 @@ class LogisticsDataModel: Mappable {
lc_name <- map["lc_name"] lc_name <- map["lc_name"]
delivery_status_cn <- map["delivery_status_cn"] delivery_status_cn <- map["delivery_status_cn"]
wb_no <- map["wb_no"]
pay_status <- map["pay_status"]
freight <- map["freight"]
} }
} }
......
...@@ -8,7 +8,12 @@ ...@@ -8,7 +8,12 @@
import UIKit import UIKit
protocol YunDanLieBiaoCellDelegate {
func YunDanLieBiaoCellAction(sender:UIButton)
}
class YunDanLieBiaoCell: UITableViewCell { class YunDanLieBiaoCell: UITableViewCell {
var delegate : YunDanLieBiaoCellDelegate?
/// 订单号 /// 订单号
@IBOutlet weak var orderNumLbl: UILabel! @IBOutlet weak var orderNumLbl: UILabel!
/// 时间 /// 时间
...@@ -38,6 +43,9 @@ class YunDanLieBiaoCell: UITableViewCell { ...@@ -38,6 +43,9 @@ class YunDanLieBiaoCell: UITableViewCell {
// Initialization code // Initialization code
} }
@IBAction func acTion(_ sender: UIButton) {
delegate?.YunDanLieBiaoCellAction(sender: sender)
}
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
......
...@@ -156,6 +156,9 @@ ...@@ -156,6 +156,9 @@
<color key="value" name="蓝色字体颜色"/> <color key="value" name="蓝色字体颜色"/>
</userDefinedRuntimeAttribute> </userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
<connections>
<action selector="acTion:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="nKQ-4e-vs1"/>
</connections>
</button> </button>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
......
...@@ -158,7 +158,6 @@ class YunDanXiangQingViewController: BaseViewController,UITableViewDelegate,UITa ...@@ -158,7 +158,6 @@ class YunDanXiangQingViewController: BaseViewController,UITableViewDelegate,UITa
alertView.tishiLbl.text = "" alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否取消运单?" alertView.titileLbl.text = "是否取消运单?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确定"), for: .normal) alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确定"), for: .normal)
// alertView.rightBtn.tag = model.po_id!
self.view.window?.addSubview(alertView) self.view.window?.addSubview(alertView)
break break
default: default:
......
...@@ -8,8 +8,39 @@ ...@@ -8,8 +8,39 @@
import UIKit import UIKit
class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,SearchBarViewDelegate,UITextFieldDelegate,TimeSelectViewDelgate{ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,SearchBarViewDelegate,UITextFieldDelegate,TimeSelectViewDelgate,YunDanLieBiaoCellDelegate,PaymentViewDelegate, GeliAlertViewDelegate{
func sureGeliAlertViewAction(sender: UIButton) {
print("取消订单")
let rowModel = datas[sender.tag]
HUD.flash(.progress)
cancelLogisticsOrder(["wb_no":rowModel.wb_no as Any,"user_token":UserToken as Any], success: { (data) in
//通知刷新
HUD.hide()
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "logistDetail"), object: nil, userInfo: nil)
}) { (err) in
}
}
func PaymentViewClose() {
paymentView?.removeFromSuperview()
paymentView = nil
}
func PaymentViewPassInputFinish(fullpass: String) {
HUD.flash(.progress)
let rowModel = datas[selectIndex!]
payDelivery(["wb_no":rowModel.wb_no as Any,"user_token":UserToken as Any,"pwd":fullpass as Any], success: { (data) in
//通知刷新
HUD.hide()
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "logistDetail"), object: nil, userInfo: nil)
}) { (err) in
}
paymentView?.removeFromSuperview()
paymentView = nil
}
let UserToken = UserDefaults.standard.value(forKey: "user_token")
@IBOutlet weak var timeBgH: NSLayoutConstraint! @IBOutlet weak var timeBgH: NSLayoutConstraint!
@IBOutlet weak var scvContentH: NSLayoutConstraint! @IBOutlet weak var scvContentH: NSLayoutConstraint!
@IBOutlet weak var contentView: UIView! @IBOutlet weak var contentView: UIView!
...@@ -112,12 +143,12 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea ...@@ -112,12 +143,12 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
} }
} }
// @objc func closeTimeSelect(){ // @objc func closeTimeSelect(){
// timeBgH.constant = 0 // timeBgH.constant = 0
// scvContentH.constant = 680 // scvContentH.constant = 680
// calendarV.removeFromSuperview() // calendarV.removeFromSuperview()
// //
// } // }
deinit { deinit {
NotificationCenter.default.removeObserver(self) NotificationCenter.default.removeObserver(self)
...@@ -130,8 +161,8 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea ...@@ -130,8 +161,8 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
NotificationCenter.default.addObserver(self, selector: #selector(refreshList), name: NSNotification.Name(rawValue: "logistDetail"), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(refreshList), name: NSNotification.Name(rawValue: "logistDetail"), object: nil)
// let tap = UITapGestureRecognizer(target: self, action: #selector(closeTimeSelect)) // let tap = UITapGestureRecognizer(target: self, action: #selector(closeTimeSelect))
// contentView.addGestureRecognizer(tap) // contentView.addGestureRecognizer(tap)
timeBgH.constant = 0 timeBgH.constant = 0
scvContentH.constant = 680 scvContentH.constant = 680
...@@ -184,9 +215,9 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea ...@@ -184,9 +215,9 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
@IBAction func btnClick(_ sender: UIButton) { @IBAction func btnClick(_ sender: UIButton) {
// if sender.titleLabel!.text != "重置" && sender.titleLabel!.text != "确定"{ // if sender.titleLabel!.text != "重置" && sender.titleLabel!.text != "确定"{
// btnUISet(btn: sender) // btnUISet(btn: sender)
// } // }
switch sender.titleLabel?.text { switch sender.titleLabel?.text {
case "顺丰": case "顺丰":
for item in wlgsArr { for item in wlgsArr {
...@@ -677,9 +708,17 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea ...@@ -677,9 +708,17 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
} }
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
let rowModel = datas[indexPath.row]
if rowModel.delivery_status == 1 {
return 257
}
if ((rowModel.freight)! > 0) && rowModel.pay_status == 1 {
return 257 return 257
} }
return 227 return 227
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
...@@ -688,11 +727,24 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea ...@@ -688,11 +727,24 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "YunDanLieBiaoCell") as! YunDanLieBiaoCell let cell = tableView.dequeueReusableCell(withIdentifier: "YunDanLieBiaoCell") as! YunDanLieBiaoCell
cell.delegate = self
cell.tag = indexPath.row cell.tag = indexPath.row
if cell.tag == 0 {
cell.acButton.isHidden = true
let rowModel = datas[indexPath.row]
if rowModel.delivery_status == 1 {
cell.acButton.isHidden = false cell.acButton.isHidden = false
cell.acButton.setTitle("取消运单", for: .normal)
} }
let rowModel = datas[indexPath.row] if ((rowModel.freight)! > 0) && rowModel.pay_status == 1 {
cell.acButton.isHidden = false
cell.acButton.setTitle("支付运费", for: .normal)
}
cell.acButton.tag = indexPath.row
cell.title1.text = "运单号:" + rowModel.lwb_no! cell.title1.text = "运单号:" + rowModel.lwb_no!
cell.title2.text = rowModel.lc_name! cell.title2.text = rowModel.lc_name!
cell.senderLbl.text = rowModel.s_city_name! cell.senderLbl.text = rowModel.s_city_name!
...@@ -716,6 +768,34 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea ...@@ -716,6 +768,34 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
} }
return cell return cell
} }
//MARK:--cell 按钮方法
var paymentView:PaymentView?
var selectIndex: Int?
func YunDanLieBiaoCellAction(sender: UIButton) {
let rowModel = datas[sender.tag]
selectIndex = sender.tag
switch sender.titleLabel?.text {
case "支付运费":
if paymentView == nil{
paymentView = PaymentView(frame: view.bounds)
paymentView?.delegate = self
paymentView?.price = rowModel.freight
view.addSubview(paymentView!)
}
break
case "取消运单":
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否取消运单?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确定"), for: .normal)
alertView.rightBtn.tag = sender.tag
self.view.window?.addSubview(alertView)
break
default:
break
}
}
func textFieldDidBeginEditing(_ textField: UITextField) { func textFieldDidBeginEditing(_ textField: UITextField) {
if (orderNumTF == textField) { if (orderNumTF == textField) {
order_sn = orderNumTF.text! order_sn = orderNumTF.text!
......
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