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

完成运单列表

parent 3874bb4e
......@@ -27,7 +27,7 @@ class LogisticsModel: Mappable {
class LogisticsDataModel: Mappable {
var id:Int?
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 sale_plat : String?//所属平台
......@@ -39,7 +39,10 @@ class LogisticsDataModel: Mappable {
var lc_name:String? //物流公司
var delivery_status_cn : String? //运单状态(中文)
var wb_no : String?
var pay_status : Int?
var freight : Float?
required init?( map: Map) {
......@@ -59,6 +62,11 @@ class LogisticsDataModel: Mappable {
lc_name <- map["lc_name"]
delivery_status_cn <- map["delivery_status_cn"]
wb_no <- map["wb_no"]
pay_status <- map["pay_status"]
freight <- map["freight"]
}
}
......
......@@ -8,7 +8,12 @@
import UIKit
protocol YunDanLieBiaoCellDelegate {
func YunDanLieBiaoCellAction(sender:UIButton)
}
class YunDanLieBiaoCell: UITableViewCell {
var delegate : YunDanLieBiaoCellDelegate?
/// 订单号
@IBOutlet weak var orderNumLbl: UILabel!
/// 时间
......@@ -38,6 +43,9 @@ class YunDanLieBiaoCell: UITableViewCell {
// Initialization code
}
@IBAction func acTion(_ sender: UIButton) {
delegate?.YunDanLieBiaoCellAction(sender: sender)
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
......
......@@ -156,6 +156,9 @@
<color key="value" name="蓝色字体颜色"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="acTion:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="nKQ-4e-vs1"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
......
......@@ -158,7 +158,6 @@ class YunDanXiangQingViewController: BaseViewController,UITableViewDelegate,UITa
alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否取消运单?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确定"), for: .normal)
// alertView.rightBtn.tag = model.po_id!
self.view.window?.addSubview(alertView)
break
default:
......
......@@ -8,8 +8,39 @@
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 scvContentH: NSLayoutConstraint!
@IBOutlet weak var contentView: UIView!
......@@ -21,7 +52,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
}
let calendarV = TimeSelectView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 235))
@IBOutlet weak var preView: UIView!
@IBOutlet weak var listView: UITableView!
......@@ -112,12 +143,12 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
}
}
// @objc func closeTimeSelect(){
// timeBgH.constant = 0
// scvContentH.constant = 680
// calendarV.removeFromSuperview()
//
// }
// @objc func closeTimeSelect(){
// timeBgH.constant = 0
// scvContentH.constant = 680
// calendarV.removeFromSuperview()
//
// }
deinit {
NotificationCenter.default.removeObserver(self)
......@@ -130,8 +161,8 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
NotificationCenter.default.addObserver(self, selector: #selector(refreshList), name: NSNotification.Name(rawValue: "logistDetail"), object: nil)
// let tap = UITapGestureRecognizer(target: self, action: #selector(closeTimeSelect))
// contentView.addGestureRecognizer(tap)
// let tap = UITapGestureRecognizer(target: self, action: #selector(closeTimeSelect))
// contentView.addGestureRecognizer(tap)
timeBgH.constant = 0
scvContentH.constant = 680
......@@ -184,9 +215,9 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
@IBAction func btnClick(_ sender: UIButton) {
// if sender.titleLabel!.text != "重置" && sender.titleLabel!.text != "确定"{
// btnUISet(btn: sender)
// }
// if sender.titleLabel!.text != "重置" && sender.titleLabel!.text != "确定"{
// btnUISet(btn: sender)
// }
switch sender.titleLabel?.text {
case "顺丰":
for item in wlgsArr {
......@@ -215,7 +246,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
}
break
case "京东":
for item in wlgsArr {
for item in wlgsArr {
if item.titleLabel!.text == sender.titleLabel?.text{
item.isSelected = true
item.setTitleColor(UIColor.white, for: .normal)
......@@ -417,7 +448,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
}
}
}
calendarV.clearTheSelect()
BeginDate = nil
EndDate = nil
......@@ -426,7 +457,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
delivery_status = ""
order_sn = ""
sale_plat = ""
break
case "确定":
preView.isHidden = true
......@@ -518,7 +549,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
timeBgH.constant = 0
scvContentH.constant = 680
calendarV.removeFromSuperview()
}else{
timeBgH.constant = 235
scvContentH.constant = 915
......@@ -538,11 +569,11 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
//bug
let timeInterval:TimeInterval = beginDate.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970
timeTF.text = dayByDouble(sender: timeInterval) + "," + dayByDouble(sender: timeIntervalEnd)
EndDate = endginDate
BeginDate = beginDate
}
//MARK: - 加载数据
var start_time = 0
......@@ -552,7 +583,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
var sale_plat = "" //所属平台
var pay_status = "" //运单运费支付状态:1待支付 2已支付 3已退款
var delivery_status = "" //运单状态:1下单完成 2揽收成功 3运输中 4已签收 5已取消 6拒收 7再投
var page = 1
@objc func loadData(){
print("加载数据")
......@@ -569,7 +600,7 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
}
let UserToken = UserDefaults.standard.value(forKey: "user_token")
jdOrderList(["user_token":UserToken as Any,"keyword":keyWord as Any,"start_time":start_time as Any,"end_time":end_time as Any,"lc_id":lc_id as Any,"order_sn":order_sn as Any,"sale_plat":sale_plat as Any,"pay_status":pay_status as Any,"delivery_status":delivery_status as Any,"page":page as Any], success: { (data) in
self.datas.removeAll()
......@@ -581,47 +612,47 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
}
self.listView.mj_header?.endRefreshing()
self.listView.reloadData()
}) { (error) in
self.listView.mj_header?.endRefreshing()
}
}
@objc func loadMoreData(){
print("加载数据")
removeBlackBtnView()
if BeginDate == nil {
start_time = 0
end_time = 0
}else{
let timeInterval:TimeInterval = BeginDate!.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = EndDate!.timeIntervalSince1970
start_time = Int(timeInterval)
end_time = Int(timeIntervalEnd)
}
let UserToken = UserDefaults.standard.value(forKey: "user_token")
jdOrderList(["user_token":UserToken as Any,"keyword":keyWord as Any,"start_time":start_time as Any,"end_time":end_time as Any,"lc_id":lc_id as Any,"order_sn":order_sn as Any,"sale_plat":sale_plat as Any,"pay_status":pay_status as Any,"delivery_status":delivery_status as Any,"page":page as Any], success: { (data) in
let dataModel = data as! LogisticsModel
if dataModel.code == 1 {
print("加载数据")
removeBlackBtnView()
if BeginDate == nil {
start_time = 0
end_time = 0
}else{
let timeInterval:TimeInterval = BeginDate!.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = EndDate!.timeIntervalSince1970
start_time = Int(timeInterval)
end_time = Int(timeIntervalEnd)
}
let UserToken = UserDefaults.standard.value(forKey: "user_token")
jdOrderList(["user_token":UserToken as Any,"keyword":keyWord as Any,"start_time":start_time as Any,"end_time":end_time as Any,"lc_id":lc_id as Any,"order_sn":order_sn as Any,"sale_plat":sale_plat as Any,"pay_status":pay_status as Any,"delivery_status":delivery_status as Any,"page":page as Any], success: { (data) in
let dataModel = data as! LogisticsModel
if dataModel.code == 1 {
dataModel.data?.forEach({ (item) in
self.datas.append(item)
})
self.page = self.page + 1
}
self.listView.reloadData()
self.listView?.mj_footer?.endRefreshing()
}) { (error) in
self.listView?.mj_footer?.endRefreshing()
}
}
}) { (error) in
self.listView?.mj_footer?.endRefreshing()
}
}
//MARK:--搜索模块
......@@ -677,9 +708,17 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
}
}
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 227
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
......@@ -688,27 +727,40 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "YunDanLieBiaoCell") as! YunDanLieBiaoCell
cell.delegate = self
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.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.title2.text = rowModel.lc_name!
cell.senderLbl.text = rowModel.s_city_name!
cell.receiverLbl.text = rowModel.r_city_name!
cell.statusLbl.text = rowModel.delivery_status_cn!
cell.productNameLbl.text = "寄托物:" + rowModel.express_item_name!
cell.signLbl.text = "签收状态:-"
cell.standerLbl.text = "订单平台:" + rowModel.sale_plat!
if rowModel.sale_plat?.count == 0 {
cell.standerLbl.text = "订单平台:-"
}
cell.timeLbl.text = "签收时间:" + dayByDouble(sender: rowModel.sign_time!)
if rowModel.sign_time! == 0 {
cell.timeLbl.text = "签收时间:-"
cell.timeLbl.text = "签收时间:-"
}
cell.orderNumLbl.text = "订单号:" + rowModel.order_sn!
if rowModel.order_sn?.count == 0 {
......@@ -716,6 +768,34 @@ class YDLBVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,UISea
}
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) {
if (orderNumTF == textField) {
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