Commit 1e21ed32 authored by lujunye's avatar lujunye

选择地址调整完整

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