Commit 1e21ed32 authored by lujunye's avatar lujunye

选择地址调整完整

parent 1e55e9ee
...@@ -375,9 +375,24 @@ class shopsAuthListModel: Mappable { ...@@ -375,9 +375,24 @@ class shopsAuthListModel: Mappable {
data <- map["data"] data <- map["data"]
} }
} }
class shopsAuthListDataModel: Mappable { class shopsAuthListDataModel: Mappable {
var order_display_id:String? //订单号 var msg:String?
var data:shopsAuthListDataDetailModel? //订单号
var ret:Int?
required init?( map: Map) {
}
func mapping(map: Map) {
msg <- map["msg"]
data <- map["data"]
ret <- map["ret"]
}
}
class shopsAuthListDataDetailModel: Mappable {
var order_display_id:Int?
required init?( map: Map) { required init?( map: Map) {
} }
......
...@@ -14,6 +14,7 @@ import SwiftDate ...@@ -14,6 +14,7 @@ import SwiftDate
import SDWebImage import SDWebImage
import IQKeyboardManagerSwift import IQKeyboardManagerSwift
class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,JiTuoWuXinXiViewDelegate,JiPaiFangShiViewControllerDelegate,ZengZhiServicesViewControllerDelegate,AdressSelectCellDelegate,DZGLViewControllerDelegate,XinZengDiZhiViewControllerDelegate,TitleAndTFBtnCellDelegate,WenDuCellDelegate,LogisticalSelectViewDelegate, UIPickerViewDataSource, UIPickerViewDelegate, GLAlertSelectViewDelegate,CLLocationManagerDelegate, CityListViewControllerDelegate,ToAndFormSelectViewControllerDelegate,WayBillAddressCanDelItemCellDelegate,HLLTopCellDelegate,OtherDemandViewControllerDelegate,OnlyViewCellDelegate, XiaDanUserInfoViewControllerDelegate{ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,JiTuoWuXinXiViewDelegate,JiPaiFangShiViewControllerDelegate,ZengZhiServicesViewControllerDelegate,AdressSelectCellDelegate,DZGLViewControllerDelegate,XinZengDiZhiViewControllerDelegate,TitleAndTFBtnCellDelegate,WenDuCellDelegate,LogisticalSelectViewDelegate, UIPickerViewDataSource, UIPickerViewDelegate, GLAlertSelectViewDelegate,CLLocationManagerDelegate, CityListViewControllerDelegate,ToAndFormSelectViewControllerDelegate,WayBillAddressCanDelItemCellDelegate,HLLTopCellDelegate,OtherDemandViewControllerDelegate,OnlyViewCellDelegate, XiaDanUserInfoViewControllerDelegate{
var xiaDanRenMsg:NSString = "" var xiaDanRenMsg:NSString = ""
func XiaDanUserInfoViewControllerData(str: NSString) { func XiaDanUserInfoViewControllerData(str: NSString) {
...@@ -144,20 +145,20 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -144,20 +145,20 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
let itemModel = item["adr"] as! cityListDataModel let itemModel = item["adr"] as! cityListDataModel
let itemData = (item["detailAdr"] as! NSString).components(separatedBy: "_") let itemData = (item["detailAdr"] as! NSString).components(separatedBy: "_")
// "addr_info":"[{\"lat_lon\":{\"lat\":\"31.196027516575054\",\"lon\":\"121.31625670047288\"},\"addr\":\"闵行区申贵路1500号\",\"name\":\"申贵路1500号\",\"city_id\":\"1006\",\"district_name\":\"闵行区\"},{\"lat_lon\":{\"lat\":\"31.202375193368646\",\"lon\":\"121.32264161728554\"},\"addr\":\"长宁区人民医院\",\"name\":\"人民医院\",\"city_id\":\"1006\",\"district_name\":\"长宁区\"}]"}
let dict = ["name":(itemData.last)! as Any, let dict = ["name":(itemData.last)! as Any,
"addr":itemData[2] as Any, "addr":itemData[2] as Any,
"city_name":itemData.first as Any,
"city_id":itemModel.city_id! as Any, "city_id":itemModel.city_id! as Any,
"district_name":itemData[1] as Any, "district_name":itemData[1] as Any,
// "house_number":item["menPai"]! as Any, "house_number":item["menPai"]! as Any,
// "contact_name":firstDict!["shouHuoRen"] as Any, "contact_name":firstDict!["shouHuoRen"] as Any,
// "contact_phone_no":firstDict!["phoneNum"] as Any, "contact_phone_no":firstDict!["phoneNum"] as Any,
"lat_lon":["lat":itemModel.lat_lon!.lat as Any,"lon":itemModel.lat_lon!.lon as Any]] "lat_lon":["lat":itemModel.lat_lon!.lat as Any,"lon":itemModel.lat_lon!.lon as Any]]
addr_info_arr.append(dict) addr_info_arr.append(dict)
} }
var s_consignee = "" var s_consignee = ""
if (firstDict!["shouHuoRen"] as! String).count > 0 { if (firstDict!["shouHuoRen"] as! String).count > 0 {
s_consignee = firstDict!["shouHuoRen"] as! String s_consignee = firstDict!["shouHuoRen"] as! String
...@@ -181,8 +182,6 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -181,8 +182,6 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
spec_select_arr_str = dataChangeString(sender: spec_select_arr) spec_select_arr_str = dataChangeString(sender: spec_select_arr)
} }
// print(dataChangeString(sender: addr_info_arr))
// return
let dict1 = ["user_token":UserToken as Any, let dict1 = ["user_token":UserToken as Any,
"nonce_str":String.randomStr(len: 30) as Any, "nonce_str":String.randomStr(len: 30) as Any,
"city_id":firstCity.city_id as Any, "city_id":firstCity.city_id as Any,
...@@ -205,7 +204,8 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -205,7 +204,8 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
shopsAuthList(dict1, success: { (data) in shopsAuthList(dict1, success: { (data) in
let model = data as! shopsAuthListModel let model = data as! shopsAuthListModel
print("订单号 - ",model.data?.order_display_id) HUD.flash(.success)
self.navigationController?.popViewController(animated: true)
}) { (err) in }) { (err) in
} }
...@@ -1360,6 +1360,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1360,6 +1360,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
vc.adrDatas = self.adrDatas vc.adrDatas = self.adrDatas
vc.delegate = self vc.delegate = self
if self.adrArr.count > indexPath.row { if self.adrArr.count > indexPath.row {
let dict = self.adrArr[indexPath.row] as! NSDictionary let dict = self.adrArr[indexPath.row] as! NSDictionary
if dict["locName"] as! String != "空" && dict["locName"] != nil{ if dict["locName"] as! String != "空" && dict["locName"] != nil{
...@@ -1383,15 +1384,16 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1383,15 +1384,16 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
vc.idx = indexPath.row vc.idx = indexPath.row
vc.adrDatas = adrDatas vc.adrDatas = adrDatas
vc.delegate = self vc.delegate = self
if adrArr.count > indexPath.row { if adrArr.count > indexPath.row {
let dict = adrArr[indexPath.row] as! NSDictionary let dict = adrArr[indexPath.row] as! NSDictionary
if dict["locName"] as! String != "空" && dict["locName"] != nil{ if dict["locName"] as! String != "空" && dict["locName"] != nil{
vc.nameStr = (dict["shouHuoRen"] as! String) vc.nameStr = (dict["shouHuoRen"] as! String)
vc.phoneNum = (dict["phoneNum"] as! String) vc.phoneNum = (dict["phoneNum"] as! String)
vc.adrStr = (dict["menPai"] as! String) vc.adrStr = (dict["menPai"] as! String)
let adr = dict["adr"] as! cityListDataModel let coordinate = (dict["lat_lon"] as! NSString).components(separatedBy: "_")
vc.lat = adr.lat_lon!.lat! vc.lat = (coordinate.first as! NSString).doubleValue
vc.lng = adr.lat_lon!.lon! vc.lng = (coordinate.last as! NSString).doubleValue
} }
} }
...@@ -1406,6 +1408,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1406,6 +1408,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
if indexPath.row == 1 { if indexPath.row == 1 {
let view = XiaDanUserInfoViewController() let view = XiaDanUserInfoViewController()
view.delegate = self view.delegate = self
view.str = xiaDanRenMsg
self.navigationController?.pushViewController(view, animated: true) self.navigationController?.pushViewController(view, animated: true)
} }
if indexPath.row == 2 { if indexPath.row == 2 {
...@@ -1417,19 +1420,19 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1417,19 +1420,19 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
} }
//保障 //保障
if indexPath.row == 3 { if indexPath.row == 3 {
if glSelectView == nil { // if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds) // let view = GLAlertSelectView(frame: self.view.bounds)
view.delegate = self // view.delegate = self
view.isBz = true // view.isBz = true
if bzIdx != 10086 { // if bzIdx != 10086 {
view.selectNum = bzIdx // view.selectNum = bzIdx
view.tempNum = view.selectNum // view.tempNum = view.selectNum
} // }
view.titleLbl.text = "货物保障" // view.titleLbl.text = "货物保障"
view.dataArr = bzArr // view.dataArr = bzArr
self.view.addSubview(view) // self.view.addSubview(view)
glSelectView = view // glSelectView = view
} // }
} }
//时间 //时间
if indexPath.row == 0 { if indexPath.row == 0 {
...@@ -1733,6 +1736,9 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -1733,6 +1736,9 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
cell.btn.isUserInteractionEnabled = false cell.btn.isUserInteractionEnabled = false
cell.nameLbl.text = hPart2[indexPath.row] cell.nameLbl.text = hPart2[indexPath.row]
cell.contentLbl.text = hPart2P[indexPath.row] cell.contentLbl.text = hPart2P[indexPath.row]
if indexPath.row == 3 {
cell.contentLbl.text = "0元最高保5万"
}
return cell return cell
} }
if indexPath.section == 4 { if indexPath.section == 4 {
...@@ -2147,9 +2153,11 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -2147,9 +2153,11 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
let min = mins.i![minIdx] let min = mins.i![minIdx]
stime = min.stime! stime = min.stime!
} }
var dateTimeStr = "立刻用车" var dateTimeStr = ""
if dayIdx != 0 && hourIdx != 0 { if dayIdx == 0 && hourIdx == 0 {
dateTimeStr = "\(day.date!):\(String(describing: day.h![hourIdx].val)):\(String(describing: mins.i![minIdx].val))" dateTimeStr = "立刻用车"
}else{
dateTimeStr = "\(day.date!):\(String(describing: day.h![hourIdx].val!)):\(String(describing: mins.i![minIdx].val!))"
} }
hPart2P.insert(dateTimeStr, at: 0) hPart2P.insert(dateTimeStr, at: 0)
hPart2P.remove(at: 1) hPart2P.remove(at: 1)
...@@ -2179,10 +2187,12 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie ...@@ -2179,10 +2187,12 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
if dayIdx == 0 && hourIdx == 0{ if dayIdx == 0 && hourIdx == 0{
return 0 return 0
}else{ }else{
let hours = model.h
let mins = hours![hourIdx] let hour = model.h![hourIdx]
let arr = mins.i if hour.i == nil {
return arr!.count return 0
}
return hour.i!.count
} }
} }
} }
......
...@@ -20,6 +20,8 @@ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate ...@@ -20,6 +20,8 @@ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate
@IBOutlet weak var userNameTF: UITextField! @IBOutlet weak var userNameTF: UITextField!
@IBOutlet weak var orderTimeLbl: UILabel! @IBOutlet weak var orderTimeLbl: UILabel!
@IBOutlet weak var contentV: UIView! @IBOutlet weak var contentV: UIView!
var str:NSString?
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
navbar.title = "下单联系人信息" navbar.title = "下单联系人信息"
...@@ -31,10 +33,16 @@ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate ...@@ -31,10 +33,16 @@ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate
orderTimeLbl.text = getTimeNow() orderTimeLbl.text = getTimeNow()
if str != nil && str!.length > 0{
let arr = str?.components(separatedBy: "_")
userNameTF.text = arr![0]
userPhoneTF.text = arr![1]
messageTV.text = arr![2]
}
} }
@IBAction func gotoPhoneAccoutAction(_ sender: UIButton) { func gotoPhoneAccoutAction(_ sender: UIButton) {
print("gotoPhoneAccoutAction-获取通讯录") print("gotoPhoneAccoutAction-获取通讯录")
//联系人选择控制器 //联系人选择控制器
let contactPicker = CNContactPickerViewController() let contactPicker = CNContactPickerViewController()
......
...@@ -40,6 +40,8 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -40,6 +40,8 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
citySelectBtn.setTitle(cityStr, for: .normal) citySelectBtn.setTitle(cityStr, for: .normal)
mapView.centerCoordinate = BLCoordinatesChangeHelper.shared()?.bl_wgs84togcj02((model.location?.lon)!, andLat: (model.location?.lat)!) as! CLLocationCoordinate2D mapView.centerCoordinate = BLCoordinatesChangeHelper.shared()?.bl_wgs84togcj02((model.location?.lon)!, andLat: (model.location?.lat)!) as! CLLocationCoordinate2D
lat = mapView.centerCoordinate.latitude
lng = mapView.centerCoordinate.longitude
isMove = false isMove = false
adrName = model.name! adrName = model.name!
detailAdr = model.address! detailAdr = model.address!
...@@ -53,6 +55,8 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -53,6 +55,8 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
citySelectBtn.setTitle(loc.name, for: .normal) citySelectBtn.setTitle(loc.name, for: .normal)
self.loc = loc self.loc = loc
let location = BLCoordinatesChangeHelper.shared()?.bl_wgs84togcj02((loc.lat_lon?.lon)!, andLat: (loc.lat_lon?.lat)!) let location = BLCoordinatesChangeHelper.shared()?.bl_wgs84togcj02((loc.lat_lon?.lon)!, andLat: (loc.lat_lon?.lat)!)
lat = location?.latitude as! CLLocationDegrees
lng = location?.longitude as! CLLocationDegrees
mapView.setCenter(location!, animated: false) mapView.setCenter(location!, animated: false)
} }
...@@ -200,6 +204,8 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -200,6 +204,8 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
let locData = BLCoordinatesChangeHelper.shared()?.bl_wgs84togcj02(model.location!.lon!, andLat: model.location!.lat!) let locData = BLCoordinatesChangeHelper.shared()?.bl_wgs84togcj02(model.location!.lon!, andLat: model.location!.lat!)
lat = locData?.latitude as! CLLocationDegrees
lng = locData?.longitude as! CLLocationDegrees
isMove = false isMove = false
adrName = model.name! adrName = model.name!
detailAdr = model.address! detailAdr = model.address!
...@@ -268,6 +274,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -268,6 +274,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
self.mapView.centerCoordinate = CLLocationCoordinate2DMake(lat,lng) self.mapView.centerCoordinate = CLLocationCoordinate2DMake(lat,lng)
MapBgView.addSubview(mapView!) MapBgView.addSubview(mapView!)
let tap = UITapGestureRecognizer(target: self, action: #selector(cancelKeyboard)) let tap = UITapGestureRecognizer(target: self, action: #selector(cancelKeyboard))
mapView.addGestureRecognizer(tap) mapView.addGestureRecognizer(tap)
...@@ -282,6 +289,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -282,6 +289,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
tempLat = lat tempLat = lat
tempLng = lng tempLng = lng
print(lat,lng)
mapView.centerCoordinate = CLLocationCoordinate2DMake((lat),(lng)) mapView.centerCoordinate = CLLocationCoordinate2DMake((lat),(lng))
...@@ -328,6 +336,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -328,6 +336,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
dict["phoneNum"] = phoneTF.text dict["phoneNum"] = phoneTF.text
dict["adr"] = adrData dict["adr"] = adrData
dict["detailAdr"] = detailAdrStr dict["detailAdr"] = detailAdrStr
dict["lat_lon"] = "\(lat)_\(lng)"
if locName.count > 0 { if locName.count > 0 {
dict["locName"] = titleLbl!.text dict["locName"] = titleLbl!.text
var sr_type = 1 var sr_type = 1
...@@ -335,8 +344,8 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -335,8 +344,8 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
sr_type = 2 sr_type = 2
} }
let ll = ["lat":adrData?.lat_lon!.lat as Any, let ll = ["lat":lat as Any,
"lon":adrData?.lat_lon?.lon as Any] "lon":lng as Any]
let lldata = dictChangeString(sender: ll) let lldata = dictChangeString(sender: ll)
if adrName.count > 0 { if adrName.count > 0 {
...@@ -363,6 +372,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo ...@@ -363,6 +372,7 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
HUD.flash(.progress) HUD.flash(.progress)
setSearchLog(dic, success: { (data) in setSearchLog(dic, success: { (data) in
HUD.hide() HUD.hide()
self.delegate?.ToAndFormSelectViewControllerSelectAdr(dict: dict,idx:self.idx!) self.delegate?.ToAndFormSelectViewControllerSelectAdr(dict: dict,idx:self.idx!)
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
}) { (err) in }) { (err) in
......
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