Commit 65d7c78f authored by lujunye's avatar lujunye

优化地址选择

parent 9a5ac1b4
......@@ -20,7 +20,7 @@ class GLMessageAlertView: UIView {
@IBAction func submitAction(_ sender: Any) {
delegate?.GLMessageAlertViewCloseAction()
}
var datasArr:Array<Any> = []
var datasArr:Array<NSString> = ["单位地址,广东省广州市荔湾区环市西路37号富力国际鞋业贸易中心2105","纳税人识别号,HF5241515215142115122125","类型,普通发票"]
@IBOutlet weak var btnLbl: UILabel!
@IBAction func closeAction(_ sender: UIButton) {
......@@ -31,6 +31,8 @@ class GLMessageAlertView: UIView {
func setUI(){
topLbl?.layer.cornerRadius = 5
topLbl?.layer.maskedCorners = [CACornerMask.layerMinXMinYCorner,CACornerMask.layerMaxXMinYCorner]
}
......
......@@ -55,13 +55,17 @@
<color key="textColor" name="白色背景色"/>
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="wCN-zG-K2b">
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="wCN-zG-K2b">
<rect key="frame" x="0.0" y="663" width="414" height="150"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="U4Q-y5-xZl"/>
</constraints>
<color key="sectionIndexBackgroundColor" name="白色背景色"/>
<connections>
<outlet property="dataSource" destination="-1" id="nK9-CX-nSv"/>
<outlet property="delegate" destination="-1" id="tKd-Ns-Vb4"/>
</connections>
</tableView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="标题" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YlV-1D-5EA">
<rect key="frame" x="0.0" y="612" width="414" height="50"/>
......
......@@ -16,7 +16,7 @@ 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 isLoadingTime = true
let nonce_str = String.randomStr(len: 30)
var xiaDanRenMsg:NSString = ""
......@@ -288,7 +288,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
fileprivate func extractedFunc() {
HUD.flash(.progress)
cityCart(["user_token":UserToken as Any,"nonce_str":nonce_str as Any,"city_id":city_id as Any], success: { (data) in
let model = data as! cityCartModel
if model.data == nil {
HUD.flash(.label("暂无数据"), delay: 1.2)
......@@ -575,8 +575,8 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
listView.reloadData()
getLogPayPrice()
}
func AdressSelectCellBtnCLick(row: Int) {
let vc = DZGLViewController()
vc.isSelectlogAddress = true
......@@ -663,16 +663,16 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
alertView.sfPriceLbl.text = "顺丰冷运(预估运费" + String(format: "%.2f", (logPayPriceModel?.price_sf)!) + "元)"
self.view.window?.addSubview(alertView)
//暂无京东
// if logPayPriceModel?.price_jd != "-" {
alertView.jdSelectBtn.isSelected = false
alertView.sfSelectBtn.isSelected = true
// let num1 = logPayPriceModel?.price_sf
// let num2 = logPayPriceModel?.price_jd as! NSString
// if num1! > num2.floatValue {
// alertView.jdSelectBtn.isSelected = true
// alertView.sfSelectBtn.isSelected = false
// }
// }
// if logPayPriceModel?.price_jd != "-" {
alertView.jdSelectBtn.isSelected = false
alertView.sfSelectBtn.isSelected = true
// let num1 = logPayPriceModel?.price_sf
// let num2 = logPayPriceModel?.price_jd as! NSString
// if num1! > num2.floatValue {
// alertView.jdSelectBtn.isSelected = true
// alertView.sfSelectBtn.isSelected = false
// }
// }
var futitleArr:Array<String> = []
logPayPriceModel?.sf_data?.forEach({ (model) in
let str = model.cn! + ":¥" + (model.number)!
......@@ -761,7 +761,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
if adrDatas.count == 0{
HUD.flash(.progress)
cityList(["user_token":UserToken as Any,"nonce_str":nonce_str as Any], success: { (data) in
let model = data as! cityListModel
if model.data == nil {
HUD.flash(.label("暂无数据"), delay: 1.2)
......@@ -867,10 +867,10 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
}else{
let vc = CityListViewController()
vc.adrDatas = adrDatas
vc.locatStr = "未定位"
if self.selectLoc.count != 0 {
vc.locatStr = self.selectLoc
}
vc.locatStr = "未定位"
if self.selectLoc.count != 0 {
vc.locatStr = self.selectLoc
}
vc.delegate = self
self.navigationController?.pushViewController(vc, animated: true)
}
......@@ -901,7 +901,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
self.locBtn.setTitle(" " + (firstPL?.postalAddress?.city)!, for: .normal)
self.selectLoc = (firstPL?.postalAddress?.city)!
self.locBtn.sizeToFit()
self.locBtn.snp_makeConstraints({ (make) in
make.right.equalTo(-15)
make.bottom.equalTo(self.navbar.snp_bottom).offset(-7)
......@@ -925,22 +925,22 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
var locationIsOpen = false
func checkLocation(){
// if CLLocationManager.locationServicesEnabled() && CLLocationManager.authorizationStatus() == .authorizedAlways || CLLocationManager.authorizationStatus() == .authorizedWhenInUse{
locationIsOpen = true
// }else if CLLocationManager.authorizationStatus() == .denied {
// let aleat = UIAlertController(title: "打开定位开关", message:"定位服务未开启,请进入系统设置>隐私>定位服务中打开开关,并允许商户端使用定位服务", preferredStyle: .alert)
// let tempAction = UIAlertAction(title: "取消", style: .cancel) { (action) in
// }
// let callAction = UIAlertAction(title: "立即设置", style: .default) { (action) in
// let url = NSURL.init(string: UIApplication.openSettingsURLString)
// if(UIApplication.shared.canOpenURL(url! as URL)) {
// UIApplication.shared.openURL(url! as URL)
// }
// }
// aleat.addAction(tempAction)
// aleat.addAction(callAction)
// self.present(aleat, animated: true, completion: nil)
// }
// if CLLocationManager.locationServicesEnabled() && CLLocationManager.authorizationStatus() == .authorizedAlways || CLLocationManager.authorizationStatus() == .authorizedWhenInUse{
locationIsOpen = true
// }else if CLLocationManager.authorizationStatus() == .denied {
// let aleat = UIAlertController(title: "打开定位开关", message:"定位服务未开启,请进入系统设置>隐私>定位服务中打开开关,并允许商户端使用定位服务", preferredStyle: .alert)
// let tempAction = UIAlertAction(title: "取消", style: .cancel) { (action) in
// }
// let callAction = UIAlertAction(title: "立即设置", style: .default) { (action) in
// let url = NSURL.init(string: UIApplication.openSettingsURLString)
// if(UIApplication.shared.canOpenURL(url! as URL)) {
// UIApplication.shared.openURL(url! as URL)
// }
// }
// aleat.addAction(tempAction)
// aleat.addAction(callAction)
// self.present(aleat, animated: true, completion: nil)
// }
}
override func viewDidLoad() {
......@@ -1149,31 +1149,55 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
}
changeCellSortView?.frame = CGRect(x: 0, y: fullScreenHeight - CGFloat(h), width: fullScreenWidth, height: CGFloat(h))
var btnH = 49
if IS_IPHONE_X {
btnH = 83
}
let leftBtn = UIButton()
leftBtn.addTarget(self, action: #selector(changeCellSortAc(sender:)), for: .touchUpInside)
leftBtn.backgroundColor = RGB(r: 170, g: 205, b: 240)
leftBtn.setTitle("取消", for: .normal)
leftBtn.titleLabel?.font = UIFont(name: "PingFangSC-Medium", size: 17)
changeCellSortView?.addSubview(leftBtn)
leftBtn.snp.makeConstraints { (make) in
make.left.bottom.equalTo(0)
make.height.equalTo(49)
make.height.equalTo(btnH)
make.width.equalTo(fullScreenWidth*0.5)
}
let leftTitle = UILabel()
leftTitle.text = "取消"
leftTitle.textColor = .white
leftTitle.textAlignment = .center
leftTitle.font = UIFont(name: "PingFangSC-Medium", size: 17)
leftBtn.addSubview(leftTitle)
leftTitle.snp.makeConstraints { (make) in
make.left.top.right.equalTo(0)
make.height.equalTo(49)
}
let rightBtn = UIButton()
rightBtn.addTarget(self, action: #selector(changeCellSortAc(sender:)), for: .touchUpInside)
rightBtn.tag = 1
rightBtn.backgroundColor = RGB(r: 53, g: 135, b: 219)
rightBtn.setTitle("确定", for: .normal)
rightBtn.titleLabel?.font = UIFont(name: "PingFangSC-Medium", size: 17)
changeCellSortView?.addSubview(rightBtn)
rightBtn.snp.makeConstraints { (make) in
make.left.equalTo(leftBtn.snp.right)
make.bottom.equalTo(0)
make.height.equalTo(49)
make.height.equalTo(btnH)
make.width.equalTo(fullScreenWidth*0.5)
}
let rightTitle = UILabel()
rightTitle.text = "确定"
rightTitle.textColor = .white
rightTitle.textAlignment = .center
rightTitle.font = UIFont(name: "PingFangSC-Medium", size: 17)
rightBtn.addSubview(rightTitle)
rightTitle.snp.makeConstraints { (make) in
make.left.top.right.equalTo(0)
make.height.equalTo(49)
}
let titleLbl = UILabel()
titleLbl.textAlignment = .center
......@@ -1272,6 +1296,11 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
vc.idx = 10086
vc.adrDatasArr = self.adrDatas
vc.delegate = self
if self.loc != nil {
vc.lat = self.loc.lat_lon?.lat as! CLLocationDegrees
vc.lng = self.loc.lat_lon?.lon as! CLLocationDegrees
}
self.navigationController?.pushViewController(vc, animated: true)
HUD.hide()
}) { (err) in
......@@ -1282,6 +1311,10 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
vc.idx = 10086
vc.adrDatasArr = adrDatas
vc.delegate = self
if self.loc != nil {
vc.lat = self.loc.lat_lon?.lat as! CLLocationDegrees
vc.lng = self.loc.lat_lon?.lon as! CLLocationDegrees
}
if adrDatas.count > 0 {
self.navigationController?.pushViewController(vc, animated: true)
}
......@@ -1298,6 +1331,47 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
if sender.tag == 0 {
print("左边")
adrArr = tempadrArr
}else{
if adrArr.count > 0 {
let firstData = adrArr.first! as NSDictionary
if firstData["locName"] as! String != "空" && adrArr.count > 1 {
var adrDs:Array<Any> = []
adrDs.removeAll()
for item in adrArr {
let data = item["adr"] as! cityListDataModel
let dict = ["lat":data.lat_lon!.lat!,"lon":data.lat_lon!.lon!,"city_id":data.city_id!] as [String : Any]
adrDs.append(dict)
}
let lat_lon_arr = dataChangeString(sender: adrDs)
let fD = adrArr.first!
let cityData = fD["adr"] as! cityListDataModel
let params = ["user_token":UserToken as Any,
"nonce_str":nonce_str as Any,
"city_id":cityData.city_id as Any,
"city_info_revision":carModel?.revision as Any,
"order_vehicle_id":carTypesArr[selectCarType].order_vehicle_id as Any,
"std_tag_arr":"" as Any,
"spec_req_arr":spec_select_arr as Any,
"lat_lon_arr":lat_lon_arr as Any
]
orderPriceCalculate(params, success: { (data) in
let model = data as! orderPriceCalculateModel
self.YuGuPriceLbl.text = "\(model.data!.total_price_fen!/100)"
self.logisticsCostModel = model
let view = self.hListView.footerView(forSection: 1)
view?.layoutIfNeeded()
self.hListView.reloadData()
return
}) { (err) in
}
}
}
}
hListView.reloadData()
......
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