Commit ef758e3c authored by lujunye's avatar lujunye

根据后台要求修改逻辑

parent cf026f3f
...@@ -553,6 +553,8 @@ class getHllOrderDetailsSalePlatDataModel: Mappable { ...@@ -553,6 +553,8 @@ class getHllOrderDetailsSalePlatDataModel: Mappable {
var order_sn : String? var order_sn : String?
var hll_pay_status_two : Int? var hll_pay_status_two : Int?
var wb_no : String? var wb_no : String?
var bill_price_arr:Float?
var pay_status:Int?
required init?( map: Map) { required init?( map: Map) {
...@@ -562,6 +564,8 @@ class getHllOrderDetailsSalePlatDataModel: Mappable { ...@@ -562,6 +564,8 @@ class getHllOrderDetailsSalePlatDataModel: Mappable {
order_sn <- map["order_sn"] order_sn <- map["order_sn"]
hll_pay_status_two <- map["hll_pay_status_two"] hll_pay_status_two <- map["hll_pay_status_two"]
wb_no <- map["wb_no"] wb_no <- map["wb_no"]
bill_price_arr <- map["bill_price_arr"]
pay_status <- map["pay_status"]
} }
} }
......
...@@ -387,8 +387,10 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -387,8 +387,10 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
print("sureSelectAddressAction") print("sureSelectAddressAction")
if titleLbl?.text == "" { if titleLbl?.text == "" {
HUD.flash(.label("未能识别当前位置,请重新定位"), delay: 1.2)
return return
} }
var dict:Dictionary<String,Any> = Dictionary() var dict:Dictionary<String,Any> = Dictionary()
dict["menPai"] = "\(city)\(districet)\(ad)\(addressDetailTF.text!)" dict["menPai"] = "\(city)\(districet)\(ad)\(addressDetailTF.text!)"
dict["shouHuoRen"] = nameTF.text dict["shouHuoRen"] = nameTF.text
......
...@@ -10,7 +10,6 @@ import UIKit ...@@ -10,7 +10,6 @@ import UIKit
import LGButton import LGButton
class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITableViewDataSource,BtmBtnCellDelegate,PaymentViewDelegate{ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITableViewDataSource,BtmBtnCellDelegate,PaymentViewDelegate{
@IBOutlet weak var bottomLheight: NSLayoutConstraint! @IBOutlet weak var bottomLheight: NSLayoutConstraint!
@IBOutlet weak var bottomLbl: UILabel! @IBOutlet weak var bottomLbl: UILabel!
...@@ -18,7 +17,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -18,7 +17,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
//测试数据 //测试数据
var isYDBc = false var isYDBc = false
var lwb_no = "" var lwb_no = ""
var dataModel:getHllOrderDetailsDataModel? = nil var dataModel:getHllOrderDetailsDataModel? = nil
@IBOutlet weak var listView: UITableView! @IBOutlet weak var listView: UITableView!
override func viewDidLoad() { override func viewDidLoad() {
...@@ -44,13 +43,13 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -44,13 +43,13 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
bottomLheight.constant = 0 bottomLheight.constant = 0
bottomLbl.isHidden = true bottomLbl.isHidden = true
bottomBtn.isHidden = true bottomBtn.isHidden = true
} }
var notiObj = "" var notiObj = ""
@objc func getNoti(noti:Notification){ @objc func getNoti(noti:Notification){
notiObj = noti.object as! String notiObj = noti.object as! String
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "logistDetail"), object: nil, userInfo: nil) NotificationCenter.default.post(name: NSNotification.Name(rawValue: "logistDetail"), object: nil, userInfo: nil)
loadData() loadData()
} }
@objc func loadData(){ @objc func loadData(){
...@@ -70,9 +69,8 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -70,9 +69,8 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
return return
} }
self.notiObj = "" self.notiObj = ""
self.dataModel = model.data!
self.dataModel = model.data!
if !self.isYDBc { if !self.isYDBc {
switch self.dataModel?.order_detail_item?.order_item?.order_status { switch self.dataModel?.order_detail_item?.order_item?.order_status {
...@@ -89,13 +87,17 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -89,13 +87,17 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
self.bottomBtn.isHidden = false self.bottomBtn.isHidden = false
self.bottomLbl.text = "取消订单" self.bottomLbl.text = "取消订单"
case 13,2: case 13,2:
//MARK: - 立即支付状态
print("已完成") print("已完成")
if self.dataModel?.delivery?.hll_pay_status_two == 1 { if self.dataModel?.delivery?.pay_status == 1 {
self.bottomLheight.constant = 49 self.bottomLheight.constant = 49
self.bottomLbl.isHidden = false self.bottomLbl.isHidden = false
self.bottomBtn.isHidden = false self.bottomBtn.isHidden = false
self.bottomLbl.text = "立即支付" + String(format: "%.2f", ((self.dataModel?.order_detail_item?.order_item?.price_fen)!/100.0)) + "元" if self.dataModel?.order_detail_item?.order_item?.order_status == 13 {
self.bottomLbl.text = "确认账单"
}else{
self.bottomLbl.text = "立即支付" + String(format: "%.2f", ((self.dataModel?.order_detail_item?.order_item?.price_fen)!/100.0)) + "元"
}
} }
default: default:
break break
...@@ -115,7 +117,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -115,7 +117,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
self.navigationController?.popToRootViewController(animated: true) self.navigationController?.popToRootViewController(animated: true)
}else{ }else{
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
} }
var ispayHllOrder = false var ispayHllOrder = false
...@@ -125,26 +127,32 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -125,26 +127,32 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
let vc = HuolalaCancelViewController() let vc = HuolalaCancelViewController()
vc.lwbno = lwb_no vc.lwbno = lwb_no
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
}else if (bottomLbl.text?.contains("确认账单"))!{
if !ispayHllOrder {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
payHllOrder(["user_token":UserToken as Any,"lwb_no":lwb_no as Any,"nonce_str":String.randomStr(len:30) as Any], success: { (data) in
self.ispayHllOrder = true
self.setPaymentUI(data:self.orderPriceArrName)
}) { (error) in
}
}else{
self.setPaymentUI(data:self.orderPriceArrName)
}
}else if (bottomLbl.text?.contains("立即支付"))!{ }else if (bottomLbl.text?.contains("立即支付"))!{
//MARK: - 支付
if dataModel?.delivery?.hll_pay_status_two == 1 && dataModel?.order_detail_item?.order_item?.order_status == 13{ if dataModel?.delivery?.pay_status == 1{
if !ispayHllOrder { if !ispayHllOrder {
let UserToken = UserDefaults.standard.value(forKey: "user_token") setPaymentUI(data:orderPriceArrName)
payHllOrder(["user_token":UserToken as Any,"lwb_no":lwb_no as Any,"nonce_str":String.randomStr(len:30) as Any], success: { (data) in
self.ispayHllOrder = true
self.setPaymentUI(data:self.orderPriceArrName)
}) { (error) in
}
}else{
self.setPaymentUI(data:self.orderPriceArrName)
} }
}else{ }else{
setPaymentUI(data:orderPriceArrName) self.setPaymentUI(data:self.orderPriceArrName)
} }
} }
} }
...@@ -195,7 +203,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -195,7 +203,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
return 2 return 2
} }
if section == 4 { if section == 4 {
return orderPriceArrName.count return orderPriceArrName.count
} }
return (dataModel?.order_detail_item?.order_item?.addr_info_arr!.count)! return (dataModel?.order_detail_item?.order_item?.addr_info_arr!.count)!
} }
...@@ -212,7 +220,6 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -212,7 +220,6 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
orderPriceArrStr.append("¥" + String(format: "%.2f", (rowModel.price_fen!/100.0))) orderPriceArrStr.append("¥" + String(format: "%.2f", (rowModel.price_fen!/100.0)))
case 2: case 2:
let distance = CGFloat((dataModel?.order_detail_item?.exceed_distance)!) / 1000.0 let distance = CGFloat((dataModel?.order_detail_item?.exceed_distance)!) / 1000.0
print("d == ",distance)
orderPriceArrName.append("超里程价" + "(" + String(format: "%.2f", distance) + "公里" + ")") orderPriceArrName.append("超里程价" + "(" + String(format: "%.2f", distance) + "公里" + ")")
orderPriceArrStr.append("¥" + String(format: "%.2f", (rowModel.price_fen!/100.0))) orderPriceArrStr.append("¥" + String(format: "%.2f", (rowModel.price_fen!/100.0)))
case 4: case 4:
...@@ -237,7 +244,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -237,7 +244,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
orderPriceArrName.append(rowModel.name!) orderPriceArrName.append(rowModel.name!)
orderPriceArrStr.append("¥" + String(format: "%.2f", (rowModel.price_fen!/100.0))) orderPriceArrStr.append("¥" + String(format: "%.2f", (rowModel.price_fen!/100.0)))
}) })
} }
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
if tableView.tag == 99 { if tableView.tag == 99 {
...@@ -375,7 +382,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -375,7 +382,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
cell.line.isHidden = true cell.line.isHidden = true
if indexPath.section == 4 { if indexPath.section == 4 {
let indexName = orderPriceArrName[indexPath.row] let indexName = orderPriceArrName[indexPath.row]
if indexName == "额外费用" { if indexName == "额外费用" {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleHeaderCell") as! TitleHeaderCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleHeaderCell") as! TitleHeaderCell
...@@ -490,14 +497,14 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -490,14 +497,14 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
if section == 3 { if section == 3 {
if (dataModel?.order_detail_item?.bill_price_arr?.count)! > 0 { if (dataModel?.order_detail_item?.bill_price_arr?.count)! > 0 {
var isUrl = false var isUrl = false
dataModel?.order_detail_item?.bill_price_arr?.forEach({ (model) in dataModel?.order_detail_item?.bill_price_arr?.forEach({ (model) in
if model.img_url?.count != 0 { if model.img_url?.count != 0 {
isUrl = true isUrl = true
} }
}) })
if isUrl { if isUrl {
return 10 return 10
} }
return 0.01 return 0.01
} }
return 0.01 return 0.01
...@@ -549,14 +556,14 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -549,14 +556,14 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
if section == 3 { if section == 3 {
if (dataModel?.order_detail_item?.bill_price_arr?.count)! > 0 { if (dataModel?.order_detail_item?.bill_price_arr?.count)! > 0 {
var isUrl = false var isUrl = false
dataModel?.order_detail_item?.bill_price_arr?.forEach({ (model) in dataModel?.order_detail_item?.bill_price_arr?.forEach({ (model) in
if model.img_url?.count != 0 { if model.img_url?.count != 0 {
isUrl = true isUrl = true
} }
}) })
if isUrl { if isUrl {
return 10 return 10
} }
return 0.01 return 0.01
} }
return 0.01 return 0.01
...@@ -674,7 +681,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -674,7 +681,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
titleBtn.titleLabel?.font = UIFont(name: "PingFangSC-Medium", size: 15) titleBtn.titleLabel?.font = UIFont(name: "PingFangSC-Medium", size: 15)
titleBtn.isUserInteractionEnabled = false titleBtn.isUserInteractionEnabled = false
pView?.addSubview(titleBtn) pView?.addSubview(titleBtn)
let titiOutImgBtn = UIButton() let titiOutImgBtn = UIButton()
titiOutImgBtn.setImage( UIImage.init(named: "alterCodeOut"), for: .normal) titiOutImgBtn.setImage( UIImage.init(named: "alterCodeOut"), for: .normal)
pView?.addSubview(titiOutImgBtn) pView?.addSubview(titiOutImgBtn)
...@@ -683,12 +690,12 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -683,12 +690,12 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
make.top.equalTo(15) make.top.equalTo(15)
} }
titiOutImgBtn.addTarget(self, action: #selector(closeAc), for: .touchUpInside) titiOutImgBtn.addTarget(self, action: #selector(closeAc), for: .touchUpInside)
let line = UIButton(frame: CGRect(x: 0, y: 49, width: fullScreenWidth, height: 1)) let line = UIButton(frame: CGRect(x: 0, y: 49, width: fullScreenWidth, height: 1))
line.backgroundColor = UIColor(named: "灰色分界线") line.backgroundColor = UIColor(named: "灰色分界线")
pView?.addSubview(line) pView?.addSubview(line)
let btmBtn = UIButton(frame: CGRect(x: 0, y: CGFloat(h)-CGFloat(TabHeight), width: fullScreenWidth, height: CGFloat(TabHeight))) let btmBtn = UIButton(frame: CGRect(x: 0, y: CGFloat(h)-CGFloat(TabHeight), width: fullScreenWidth, height: CGFloat(TabHeight)))
btmBtn.backgroundColor = UIColor(named: "按钮渐变色上") btmBtn.backgroundColor = UIColor(named: "按钮渐变色上")
btmBtn.setTitle("确认支付" + String(format: "%.2f", ((self.dataModel?.order_detail_item?.order_item?.price_fen)!/100.0)) + "元", for: .normal) btmBtn.setTitle("确认支付" + String(format: "%.2f", ((self.dataModel?.order_detail_item?.order_item?.price_fen)!/100.0)) + "元", for: .normal)
...@@ -706,22 +713,22 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -706,22 +713,22 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
pView?.addSubview(listV) pView?.addSubview(listV)
listV.register(UINib(nibName: "TitleAndLblCell", bundle: nil), forCellReuseIdentifier: "TitleAndLblCell") listV.register(UINib(nibName: "TitleAndLblCell", bundle: nil), forCellReuseIdentifier: "TitleAndLblCell")
listV.register(UINib(nibName: "TitleHeaderCell", bundle: nil), forCellReuseIdentifier: "TitleHeaderCell") listV.register(UINib(nibName: "TitleHeaderCell", bundle: nil), forCellReuseIdentifier: "TitleHeaderCell")
let tishiLbl = UILabel(frame: CGRect(x: 15, y: listV.frame.maxY+8, width: fullScreenWidth - 30, height: 40)) let tishiLbl = UILabel(frame: CGRect(x: 15, y: listV.frame.maxY+8, width: fullScreenWidth - 30, height: 40))
tishiLbl.text = "若产生消费、高速费、停车费、逾时等候费和搬运费,需要您额外支付。额外费用不可使用赠金支付" tishiLbl.text = "若产生消费、高速费、停车费、逾时等候费和搬运费,需要您额外支付。额外费用不可使用赠金支付"
tishiLbl.numberOfLines = 0 tishiLbl.numberOfLines = 0
tishiLbl.textColor = UIColor.init(named: "提示语字体颜色") tishiLbl.textColor = UIColor.init(named: "提示语字体颜色")
tishiLbl.font = UIFont.init(name: "PingFang SC", size: 11) tishiLbl.font = UIFont.init(name: "PingFang SC", size: 11)
pView?.addSubview(tishiLbl) pView?.addSubview(tishiLbl)
} }
cBtn?.isHidden = false cBtn?.isHidden = false
pView?.isHidden = false pView?.isHidden = false
} }
var paymentView:PaymentView? var paymentView:PaymentView?
@objc func payAc(){ @objc func payAc(){
print("payAc") print("payAc")
if paymentView == nil{ if paymentView == nil{
...@@ -731,7 +738,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -731,7 +738,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
view.addSubview(paymentView!) view.addSubview(paymentView!)
} }
} }
@objc func closeAc(){ @objc func closeAc(){
cBtn?.isHidden = true cBtn?.isHidden = true
...@@ -739,7 +746,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -739,7 +746,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
} }
func PaymentViewPassInputFinish(fullpass: String) { func PaymentViewPassInputFinish(fullpass: String) {
HUD.flash(.progress) HUD.flash(.progress)
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
payHllDelivery(["user_token":UserToken as Any,"wb_no":dataModel?.delivery?.wb_no as Any, "pwd":fullpass as Any], success: { (data) in payHllDelivery(["user_token":UserToken as Any,"wb_no":dataModel?.delivery?.wb_no as Any, "pwd":fullpass as Any], success: { (data) in
...@@ -749,7 +756,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab ...@@ -749,7 +756,7 @@ class WaybillDetailViewController: BaseViewController ,UITableViewDelegate,UITab
self.closeAc() self.closeAc()
}) { (error) in }) { (error) in
HUD.hide() HUD.hide()
} }
paymentView?.removeFromSuperview() paymentView?.removeFromSuperview()
paymentView = nil paymentView = nil
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
......
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