Commit ef758e3c authored by lujunye's avatar lujunye

根据后台要求修改逻辑

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