Commit 664c91ea authored by lujunye's avatar lujunye

物流费用显示

parent 91b39340
......@@ -155,6 +155,7 @@ class registerDataModel: Mappable {
var kjxy_jd:String?
var xy_data : Array<registerXYDataDataModel>?
var jd_data : Array<registerJDDataDataModel>?
var kjxy_xy:String?
var price_xy : Float?
......@@ -169,6 +170,7 @@ class registerDataModel: Mappable {
price_jd <- map["price_jd"]
price_sf <- map["price_sf"]
jd_data <- map["jd_data"]
sf_data <- map["sf_data"]
kjxy_sf <- map["kjxy_sf"]
kjxy_jd <- map["kjxy_jd"]
......@@ -178,6 +180,17 @@ class registerDataModel: Mappable {
price_xy <- map["price_xy"]
}
}
class registerJDDataDataModel: Mappable {
var cn:String?
var number : String?
required init?( map: Map) {
}
func mapping(map: Map) {
cn <- map["cn"]
number <- map["number"]
}
}
class registerSfDataDataModel: Mappable {
var cn:String?
var number : String?
......
<?xml version="1.0" encoding="UTF-8"?>
<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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" 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"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......
<?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="17701" 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"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -134,7 +135,7 @@
<color key="textColor" name="灰色字体颜色"/>
<nil key="highlightedColor"/>
</label>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gc6-oj-wSU">
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gc6-oj-wSU">
<rect key="frame" x="250" y="212" width="80" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="Kss-y0-K0x"/>
......@@ -161,7 +162,7 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Tvb-s6-5wR" firstAttribute="top" secondItem="aOy-Ef-DsK" secondAttribute="bottom" constant="5" id="0yL-uI-2Cg"/>
<constraint firstAttribute="trailing" secondItem="yJh-1b-Ri8" secondAttribute="trailing" id="1wh-dY-0cB"/>
......@@ -238,14 +239,14 @@
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色字体颜色">
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="蓝色字体颜色">
<color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
......@@ -16,6 +16,92 @@ protocol LogisticalSelectViewDelegate {
}
class LogisticalSelectView: UIView {
var data:registerDataModel?{
didSet{
if data != nil {
var jd_temp:Array<String> = []
var sf_temp:Array<String> = []
var xy_temp:Array<String> = []
data?.jd_data?.forEach({ (item) in
if item.number != "0" && item.number != "0.00"{
jd_temp.append(item.cn! + ":¥" + item.number!)
}
})
data?.xy_data?.forEach({ (item) in
if item.number != 0 {
xy_temp.append(item.cn! + ":¥\(item.number!)")
}
})
data?.sf_data?.forEach({ (item) in
if item.number != "0" && item.number != "0.00"{
sf_temp.append(item.cn! + ":¥" + item.number!)
}
})
let num = (jd_temp.count) + (xy_temp.count) + (sf_temp.count)
selectBgHeight.constant = CGFloat(340 + num * 19)
if (jd_temp.count) > 0 {
for i in 0 ..< jd_temp.count {
let lbl = UILabel()
lbl.text = jd_temp[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)
}
}
sfTop.constant = CGFloat((data?.jd_data!.count)! * 19)
jdlineBottom.constant = CGFloat(-((data?.jd_data!.count)! * 19))
}else{
sfTop.constant = CGFloat(0)
jdlineBottom.constant = CGFloat(0)
}
if sf_temp.count > 0 {
for i in 0..<sf_temp.count {
let lbl = UILabel()
lbl.text = sf_temp[i]
lbl.textColor = UIColor.init(named: "提示语字体颜色")
lbl.font = UIFont.systemFont(ofSize: 11)
selectBgView.addSubview(lbl)
lbl.snp.makeConstraints { (make) in
make.left.equalTo(sfAgreeLbl)
make.top.equalTo(sfAgreeLbl.snp_bottom).offset((5 + 15) * i + 5)
}
SFtempArr.append(lbl)
}
xyTop.constant = CGFloat(SFfuTitleArr.count * 19)
sflineBottom.constant = CGFloat(-(SFfuTitleArr.count * 19))
}else{
xyTop.constant = CGFloat(0)
sflineBottom.constant = CGFloat(0)
}
if xy_temp.count > 0 {
for i in 0..<xy_temp.count {
let lbl = UILabel()
lbl.text = xy_temp[i]
lbl.textColor = UIColor.init(named: "提示语字体颜色")
lbl.font = UIFont.systemFont(ofSize: 11)
selectBgView.addSubview(lbl)
lbl.snp.makeConstraints { (make) in
make.left.equalTo(xyAgreeLbl)
make.top.equalTo(xyAgreeLbl.snp_bottom).offset((5 + 15) * i + 5)
}
}
}
}
}
}
var delegate:LogisticalSelectViewDelegate?
@IBOutlet weak var jdBgViewH: NSLayoutConstraint!
@IBOutlet weak var jdSelectBtn: UIButton!
......
......@@ -363,7 +363,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GjP-qm-Koz">
<rect key="frame" x="114" y="12" width="285" height="37"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="最多输入十个汉字喔。" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hlo-EC-mgW">
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="无" placeholder="最多输入十个汉字喔。" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hlo-EC-mgW">
<rect key="frame" x="5" y="0.0" width="275" height="37"/>
<color key="textColor" name="灰色字体颜色"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
......
......@@ -671,7 +671,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
let alertView = LogisticalSelectView(frame: self.view.window!.bounds)
alertView.delegate = self
if logPayPriceModel?.total_freight_jd != nil && logPayPriceModel?.total_freight_jd != 0 {
alertView.jdPriceLbl.text = "京东冷运(预估运费\(logPayPriceModel?.total_freight_jd)元)"
alertView.jdPriceLbl.text = "京东冷运(预估运费\(logPayPriceModel?.total_freight_jd!)元)"
}else{
alertView.jdPriceLbl.text = "京东冷运(待上门评估)"
}
......@@ -686,7 +686,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
// alertView.setXingYuan()
alertView.xyPriceLbl.text = "鑫源物流(待上门评估)"
}
alertView.data = logPayPriceModel
self.view.window?.addSubview(alertView)
// alertView.setJD()
weak_alertView = alertView
......@@ -694,30 +694,35 @@ 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
let str = model.cn! + ":¥" + (model.number)!
futitleArr.append(str)
})
weak_alertView?.SFfuTitleArr = futitleArr
}else if idx == 3{
var futitleArr:Array<String> = []
logPayPriceModel?.xy_data?.forEach({ (model) in
let str = model.cn! + ":¥" + String(format: "%.2f", (model.number)!)
futitleArr.append(str)
})
weak_alertView?.XYfuTitleArr = futitleArr
}else if idx == 0{
let str = "运费:¥\(logPayPriceModel!.price_jd!)"
let str1 = "揽收费:¥\(logPayPriceModel!.collect_fees!)"
let str2 = "派送费:¥\(logPayPriceModel!.delivery_fee!)"
weak_alertView?.JDfuTitleArr = [str,str1,str2]
}
// weak_alertView?.SFfuTitleArr = []
// weak_alertView?.XYfuTitleArr = []
// weak_alertView?.JDfuTitleArr = []
// if idx == 1{
// var futitleArr:Array<String> = []
// logPayPriceModel?.sf_data?.forEach({ (model) in
// let str = model.cn! + ":¥" + (model.number)!
// if model.number != "0" || model.number != nil {
// futitleArr.append(str)
// }
// futitleArr.append(str)
// })
// weak_alertView?.SFfuTitleArr = futitleArr
// }else if idx == 3{
// var futitleArr:Array<String> = []
// logPayPriceModel?.xy_data?.forEach({ (model) in
// let str = model.cn! + ":¥" + String(format: "%.2f", (model.number)!)
// if model.number != 0 || model.number != nil {
// futitleArr.append(str)
// }
// })
//
// weak_alertView?.XYfuTitleArr = futitleArr
// }else if idx == 0{
// let str = "运费:¥\(logPayPriceModel!.price_jd!)"
// let str1 = "揽收费:¥\(logPayPriceModel!.collect_fees!)"
// let str2 = "派送费:¥\(logPayPriceModel!.delivery_fee!)"
// weak_alertView?.JDfuTitleArr = [str,str1,str2]
// }
}
override func viewWillAppear(_ animated: Bool) {
......
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