Commit 6b56d5bc authored by lujunye's avatar lujunye

京东物流计费

parent 6c86fb0a
......@@ -145,6 +145,11 @@ class registerModel: Mappable {
class registerDataModel: Mappable {
var price_jd:String?
var price_sf : Float?
var total_freight_jd:Float?
var collect_fees:Float?
var delivery_fee:Float?
var sf_data : Array<registerSfDataDataModel>?
var kjxy_sf:String?
var kjxy_jd:String?
......@@ -158,6 +163,10 @@ class registerDataModel: Mappable {
}
func mapping(map: Map) {
total_freight_jd <- map["total_freight_jd"]
collect_fees <- map["collect_fees"]
delivery_fee <- map["delivery_fee"]
price_jd <- map["price_jd"]
price_sf <- map["price_sf"]
sf_data <- map["sf_data"]
......
......@@ -27,6 +27,8 @@ class LogisticalSelectView: UIView {
@IBAction func blackAction(_ sender: Any) {
self.removeFromSuperview()
}
@IBOutlet weak var sfTop: NSLayoutConstraint!
@IBOutlet weak var jdlineBottom: NSLayoutConstraint!
@IBOutlet weak var selectBgView: UIView!
@IBOutlet weak var selectBgHeight: NSLayoutConstraint!
@IBOutlet weak var sfAgreeLbl: UILabel!
......@@ -39,7 +41,39 @@ class LogisticalSelectView: UIView {
@IBOutlet weak var xyAgreeLbl: UILabel!
@IBOutlet weak var sfPriceLbl: UILabel!
@IBOutlet weak var jdPriceLbl: UILabel!
@IBOutlet weak var jdAgreeLbl: UILabel!
var JDtempArr:Array<UILabel> = []
var JDfuTitleArr:Array<String> = [] {
didSet{
if JDfuTitleArr.count == 0 {
JDtempArr.forEach { (item) in
item.removeFromSuperview()
}
sfTop.constant = CGFloat(0)
jdlineBottom.constant = CGFloat(0)
selectBgHeight.constant = CGFloat(340)
return
}
for i in 0 ..< JDfuTitleArr.count {
let lbl = UILabel()
lbl.text = JDfuTitleArr[i]
lbl.textColor = UIColor.init(named: "提示语字体颜色")
lbl.font = UIFont.systemFont(ofSize: 11)
selectBgView.addSubview(lbl)
lbl.snp.makeConstraints { (make) in
make.left.equalTo(jdAgreeLbl)
make.top.equalTo(jdAgreeLbl.snp_bottom).offset((5 + 15) * i + 5)
}
JDtempArr.append(lbl)
}
sfTop.constant = CGFloat(JDfuTitleArr.count * 19)
jdlineBottom.constant = CGFloat(-(JDfuTitleArr.count * 19))
selectBgHeight.constant = CGFloat(340 + JDfuTitleArr.count * 19)
}
}
var SFtempArr:Array<UILabel> = []
var SFfuTitleArr:Array<String> = [] {
......@@ -136,8 +170,11 @@ class LogisticalSelectView: UIView {
jdSelectBtn.isSelected = !jdSelectBtn.isSelected
sfSelectBtn.isSelected = false
xySelectBtn.isSelected = false
delegate?.LogisticalSelectViewBtnclick(idx: 0)
if jdSelectBtn.isSelected {
delegate?.LogisticalSelectViewBtnclick(idx: 0)
}else{
delegate?.LogisticalSelectViewBtnclick(idx: 2)
}
}else if sender == sfSelectBtn {
sfSelectBtn.isSelected = !sfSelectBtn.isSelected
jdSelectBtn.isSelected = false
......@@ -145,7 +182,7 @@ class LogisticalSelectView: UIView {
if sfSelectBtn.isSelected {
delegate?.LogisticalSelectViewBtnclick(idx: 1)
}else{
delegate?.LogisticalSelectViewBtnclick(idx: 0)
delegate?.LogisticalSelectViewBtnclick(idx: 2)
}
}else if sender == xySelectBtn {
xySelectBtn.isSelected = !xySelectBtn.isSelected
......@@ -154,7 +191,7 @@ class LogisticalSelectView: UIView {
if xySelectBtn.isSelected {
delegate?.LogisticalSelectViewBtnclick(idx: 3)
}else{
delegate?.LogisticalSelectViewBtnclick(idx: 0)
delegate?.LogisticalSelectViewBtnclick(idx: 2)
}
}
......
......@@ -12,10 +12,12 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LogisticalSelectView">
<connections>
<outlet property="jdAgreeLbl" destination="ejE-yd-OuT" id="QJe-Vh-64v"/>
<outlet property="jdBgView" destination="65a-vB-vRu" id="R3o-9U-Hl6"/>
<outlet property="jdBgViewH" destination="VbT-Ng-sOM" id="ODI-rR-O25"/>
<outlet property="jdPriceLbl" destination="NjJ-Ja-GKH" id="Gxb-tF-ubD"/>
<outlet property="jdSelectBtn" destination="5iJ-FB-kNk" id="EZu-xj-5I9"/>
<outlet property="jdlineBottom" destination="1Ch-VX-2Tk" id="cxF-E3-sAC"/>
<outlet property="selectBgHeight" destination="nLk-ap-Uau" id="WKa-F7-HPd"/>
<outlet property="selectBgView" destination="Jkx-2x-8N8" id="YLN-t4-96A"/>
<outlet property="sfAgreeLbl" destination="Uzk-gy-02b" id="ZId-A8-k71"/>
......@@ -23,6 +25,7 @@
<outlet property="sfBgViewH" destination="ydn-uH-AYo" id="FWQ-kp-xn9"/>
<outlet property="sfPriceLbl" destination="wwr-FR-oJl" id="B1O-wO-mD7"/>
<outlet property="sfSelectBtn" destination="4U6-AL-8Yv" id="bsK-dU-3Nn"/>
<outlet property="sfTop" destination="c2d-OZ-AAC" id="vzR-Na-yid"/>
<outlet property="sflineBottom" destination="NjH-t8-5V4" id="ERs-mR-twl"/>
<outlet property="xingYuanBgHeight" destination="d7K-wk-lMJ" id="I5Q-ac-Mnr"/>
<outlet property="xingYuanBgV" destination="ae9-Qq-iC9" id="stY-2Q-AD3"/>
......
......@@ -129,7 +129,7 @@
<constraint firstAttribute="width" constant="20" id="mRp-L3-0ok"/>
</constraints>
</imageView>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="0" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="oYB-7R-ZKc">
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="1" placeholder="0" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="oYB-7R-ZKc">
<rect key="frame" x="284" y="12.5" width="80" height="35"/>
<color key="backgroundColor" name="app底色"/>
<constraints>
......@@ -205,7 +205,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3m5-vv-wjM">
<rect key="frame" x="0.0" y="217" width="414" height="50"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="1" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="dXi-t1-G5Y">
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="1" placeholder="1" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="dXi-t1-G5Y">
<rect key="frame" x="319" y="15" width="80" height="35"/>
<color key="backgroundColor" name="app底色"/>
<constraints>
......@@ -251,7 +251,7 @@
<constraint firstAttribute="height" constant="20" id="VQb-9i-u8A"/>
</constraints>
</imageView>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="1" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xT3-6M-vtU">
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="1" placeholder="1" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xT3-6M-vtU">
<rect key="frame" x="284" y="15" width="80" height="35"/>
<color key="backgroundColor" name="app底色"/>
<constraints>
......
......@@ -660,14 +660,14 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
@IBOutlet weak var priceLbl: UILabel!
weak var weak_alertView:LogisticalSelectView? = nil
@IBAction func orderAction(_ sender: Any) {
if r_city == nil || s_city == nil || weight == nil || tiJi == nil || wenduIndex == 0{
HUD.flash(.label("请填写相关信息"), delay: 1.2)
return
}
if logPayPriceModel == nil {
HUD.flash(.label("无法估算运费"), delay: 1.2)
return
}
// if r_city == nil || s_city == nil || weight == nil || tiJi == nil || wenduIndex == 0{
// HUD.flash(.label("请填写相关信息"), delay: 1.2)
// return
// }
// if logPayPriceModel == nil {
// HUD.flash(.label("无法估算运费"), delay: 1.2)
// return
// }
let alertView = LogisticalSelectView(frame: self.view.window!.bounds)
alertView.delegate = self
if logPayPriceModel?.price_jd != nil {
......@@ -694,7 +694,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
func LogisticalSelectViewBtnclick(idx:Int){
weak_alertView?.SFfuTitleArr = []
weak_alertView?.XYfuTitleArr = []
weak_alertView?.JDfuTitleArr = []
if idx == 1{
var futitleArr:Array<String> = []
logPayPriceModel?.sf_data?.forEach({ (model) in
......@@ -710,6 +710,11 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
})
weak_alertView?.XYfuTitleArr = futitleArr
}else if idx == 0{
let str = "运费:¥\(logPayPriceModel!.total_freight_jd!)"
let str1 = "揽收费:¥\(logPayPriceModel!.collect_fees!)"
let str2 = "派送费:¥\(logPayPriceModel!.delivery_fee!)"
weak_alertView?.JDfuTitleArr = [str,str1,str2]
}
}
......@@ -2214,7 +2219,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
return
}
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let addr = ["s_city":s_city as Any,"r_city":r_city as Any,"s_province_name":s_province_name as Any,"r_province_name":r_province_name as Any,"s_city_name":s_city_name as Any,"r_city_name":r_city_name as Any,"s_district_name":s_district_name as Any,"r_district_name":r_district_name as Any,"s_address":sendAdr as Any,"r_address":receiveAdr as Any]
let addr = ["s_city":s_city as Any,"r_city":r_city as Any,"s_province_name":s_province_name as Any,"r_province_name":r_province_name as Any,"s_city_name":s_city_name as Any,"r_city_name":r_city_name as Any,"s_district_name":s_district_name as Any,"r_district_name":r_district_name as Any,"s_address":sendAdr as Any,"r_address":receiveAdr as Any,"s_district":s_district as Any,"r_district":r_district as Any]
var home_delivery_on = "false"
if send == 0 {
......
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