Commit da8dd94a authored by lujunye's avatar lujunye

36

parent 638d510e
......@@ -377,8 +377,13 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
}
let vc = DZGLViewController()
vc.cus_id = cusModel?.cus_id
vc.isSelectlogAddress = true
vc.isSelectMotion = true
vc.is_keHu_list = true
vc.delegate = self
if adrData != nil {
vc.adrData = adrData
}
self.navigationController?.pushViewController(vc, animated: true)
}
return
......
......@@ -14,8 +14,33 @@ protocol DZGLViewControllerDelegate {
func DZGLViewController_adr(adr_id:String,count:Int)
func DZGLViewController_back(count:Int)
}
class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,SwipeTableViewCellDelegate,UISearchBarDelegate,SearchBarViewDelegate,XinZengDiZhiViewControllerDelegate,GeliAlertViewDelegate{
class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,SwipeTableViewCellDelegate,UISearchBarDelegate,SearchBarViewDelegate,XinZengDiZhiViewControllerDelegate,GeliAlertViewDelegate,DiZhiGuanLiCellDelegate{
var adrData:GetAddrsInfoDataModel?
func DiZhiGuanLiCell_Edit_Action(cell: DiZhiGuanLiCell) {
if navbar.title == "地址选择" {
let model = adrInfo?.data![cell.tag]
let vc = XinZengDiZhiViewController()
vc.is_keHu_list = true
vc.cus_id = cus_id!
vc.delegate = self
vc.navTitle = "编辑地址"
vc.caddr_id = (model?.caddr_id)!
vc.provinceIndex = (model?.province)!
vc.cityIndex = (model?.city)!
vc.areaIndex = (model?.district)!
vc.phone = (model?.mobile)!
vc.adrStr = (model?.addr_cn)!
vc.nameStr = (model?.consignee)!
vc.pcdStr = model?.province_cn!
if model!.city_cn != nil {
vc.pcdStr = (model?.province_cn!)! + "-" + (model?.city_cn!)!
if model!.district_cn != nil {
vc.pcdStr = (model?.province_cn!)! + "-" + (model?.city_cn!)! + "-" + (model?.district_cn!)!
}
}
self.navigationController?.pushViewController(vc, animated: true)
}
}
func XinZengDiZhiViewControllerFinishAction_kehu(adr_id: String) {
......@@ -32,9 +57,11 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
print("jcount1 = ",kehu_adrArr.count)
}
}else{
delegate?.DZGLViewController_adr(adr_id: adr_id,count: kehu_adrArr.count)
print("jcount12 = ",kehu_adrArr.count)
delegate?.DZGLViewController_adr(adr_id: adr_id,count: kehu_adrArr.count)
listView.mj_header?.beginRefreshing()
}
......@@ -142,18 +169,39 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
self.holder_view.isHidden = true
if isSelectlogAddress {
navbar.title = "地址选择"
HUD.flash(.progress)
searchBgH.constant = 0
getAddr(["user_token":UserToken as Any], success: { (data) in
self.adrInfo = (data as! GetAddrsInfoModel)
if self.adrInfo?.data?.count == 0 {
self.holder_view.isHidden = false
if is_keHu_list {
let searchBr = SearchBarView.init()
self.searchBg.addSubview(searchBr)
searchBr.snp.makeConstraints { (make) in
make.left.right.equalTo(0)
make.centerY.equalToSuperview()
make.height.equalTo(35)
}
self.listView.reloadData()
HUD.hide()
}) { (error) in
searchV = searchBr
searchBr.placeholderStr = "请输入收货人地址"
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
navbar.rightTitle = "新增"
searchBgH.constant = 45
headerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadData))
self.listView!.mj_header = headerMJ
self.listView.mj_header?.beginRefreshing()
}else{
HUD.flash(.progress)
searchBgH.constant = 0
getAddr(["user_token":UserToken as Any], success: { (data) in
self.adrInfo = (data as! GetAddrsInfoModel)
if self.adrInfo?.data?.count == 0 {
self.holder_view.isHidden = false
}
self.listView.reloadData()
HUD.hide()
}) { (error) in
}
}
}else{
//searchbar
......@@ -205,6 +253,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
}
@objc func loadData(){
if is_keHu_list {
if cus_id != nil {
getAddrsInfo(["user_token":UserToken as Any,"cus_id":cus_id as Any], success: { (data) in
......@@ -223,7 +272,9 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
}) { (error) in
self.listView.mj_header?.endRefreshing()
}
return
}else{
print("ddd2")
getAddrsInfoCaddr(["user_token":UserToken as Any,"caddr_id":address_id_arr.joined(separator: ",") as Any]) { data in
self.adrInfo = (data as! GetAddrsInfoModel)
self.kehu_adrArr.removeAll()
......@@ -244,6 +295,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
}
return
}
print("ddd3")
adrArrs.removeAll()
AddressList(["user_token":UserToken as Any,"key_word":keyWord], success: { (data) in
let model = data as! AddressListModel
......@@ -296,7 +348,9 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DiZhiGuanLiCell") as! DiZhiGuanLiCell
cell.delegate = self
if is_keHu_list {
cell.delegateD = self
cell.tag = indexPath.row
if is_keHu_list && isSelectlogAddress == false{
let model = kehu_adrArr[indexPath.row]
cell.nameLbl.text = model.consignee
cell.phoneLbl.text = model.mobile
......@@ -305,6 +359,31 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
cell.xValue.constant = 0
cell.blueLbl.isHidden = true
cell.yellowLbl.isHidden = true
return cell
}
if is_keHu_list && isSelectlogAddress {
let model = kehu_adrArr[indexPath.row]
cell.nameLbl.text = model.consignee
cell.phoneLbl.text = model.mobile
cell.adrLbl.text = model.addr_cn
cell.blueLbl.isHidden = true
cell.yellowLbl.isHidden = true
cell.btn.isSelected = false
if adrData != nil {
if model.caddr_id == adrData?.caddr_id {
cell.btn.isSelected = true
}
}else{
if isSelectMotion == false {
cell.btnH.constant = 0
cell.xValue.constant = 0
}else{
if indexPath == selectIdx {
cell.btn.isSelected = true
}
}
}
return cell
}
if isSelectlogAddress {
......@@ -313,7 +392,6 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
cell.phoneLbl.text = model?.mobile
cell.adrLbl.text = model?.addr_name
cell.btn.isSelected = false
if isSelectMotion == false {
cell.btnH.constant = 0
cell.xValue.constant = 0
......@@ -338,6 +416,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
}
}
}else{//列表
print("abc2")
if adrArrs.count > 0 {
let model = adrArrs[indexPath.row]
cell.nameLbl.text = model.consignee
......@@ -378,8 +457,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print(indexPath.row)
if is_keHu_list {
if is_keHu_list && isSelectlogAddress == false{
if kehu_adrArr.count > 0 {
let model = kehu_adrArr[indexPath.row]
let vc = XinZengDiZhiViewController()
......@@ -405,9 +483,6 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
}
}
}
//if model.is_send_default == 1 {
// vc.is_send_default = true
//}
vc.is_default = false
if model.is_default == 1 {
vc.is_default = true
......@@ -416,7 +491,13 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
}
return
}
if is_keHu_list && isSelectlogAddress {
if kehu_adrArr.count > 0 {
selectIdx = indexPath
listView.reloadData()
}
return
}
if isSelectMotion == false {
if adrArrs.count > 0 {
let model = adrArrs[indexPath.row]
......
......@@ -8,9 +8,16 @@
import UIKit
import SwipeCellKit
protocol DiZhiGuanLiCellDelegate {
func DiZhiGuanLiCell_Edit_Action(cell:DiZhiGuanLiCell)
}
class DiZhiGuanLiCell: SwipeTableViewCell {
@IBAction func edit_action(_ sender: UIButton) {
delegateD?.DiZhiGuanLiCell_Edit_Action(cell: self)
}
var delegateD:DiZhiGuanLiCellDelegate?
@IBOutlet weak var edit_btn: UIButton!
@IBOutlet weak var yellowLblLeft: NSLayoutConstraint!
@IBOutlet weak var btn: UIButton!
@IBOutlet weak var adrLbl: UILabel!
......
<?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="18122" 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="18093"/>
<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"/>
......@@ -26,13 +26,13 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="15577124121" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Zd-v3-Vtu">
<rect key="frame" x="100" y="16.5" width="79" height="16"/>
<rect key="frame" x="99" y="16.5" width="79" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="寄" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jf6-0X-5eB">
<rect key="frame" x="189" y="15.5" width="18" height="18"/>
<rect key="frame" x="188" y="15.5" width="18" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="18" id="KUq-24-4Xw"/>
<constraint firstAttribute="height" constant="18" id="v9o-TA-DNq"/>
......@@ -53,7 +53,7 @@
</userDefinedRuntimeAttributes>
</label>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mWp-V0-KaZ">
<rect key="frame" x="217" y="15.5" width="18" height="18"/>
<rect key="frame" x="216" y="15.5" width="18" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="18" id="Yz5-IC-luF"/>
<constraint firstAttribute="height" constant="18" id="lb5-dI-B8T"/>
......@@ -86,7 +86,7 @@
<constraint firstAttribute="height" constant="9" id="Q4i-ra-ezu"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oeS-KW-qjD">
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oeS-KW-qjD">
<rect key="frame" x="15" y="29.5" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="Ulx-IU-UMy"/>
......@@ -96,7 +96,7 @@
<state key="selected" image="yuxuan"/>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vAQ-5q-KPr">
<rect key="frame" x="50" y="15" width="40" height="18.5"/>
<rect key="frame" x="50" y="15" width="39" height="18.5"/>
<attributedString key="attributedText">
<fragment content="梁小锋">
<attributes>
......@@ -106,8 +106,18 @@
</attributedString>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F2U-NL-yOi">
<rect key="frame" x="329" y="0.0" width="46" height="78"/>
<constraints>
<constraint firstAttribute="width" constant="46" id="8h6-at-sYZ"/>
</constraints>
<connections>
<action selector="edit_action:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="SF5-bO-BLq"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="F2U-NL-yOi" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="2eK-4U-VaO"/>
<constraint firstItem="0Zd-v3-Vtu" firstAttribute="leading" secondItem="vAQ-5q-KPr" secondAttribute="trailing" constant="10" id="3IR-u1-EGI"/>
<constraint firstItem="vAQ-5q-KPr" firstAttribute="leading" secondItem="oeS-KW-qjD" secondAttribute="trailing" constant="15" id="4ok-AC-XWT"/>
<constraint firstAttribute="trailing" secondItem="raS-k5-oNa" secondAttribute="trailing" id="5WN-Ud-Jc7"/>
......@@ -120,6 +130,8 @@
<constraint firstItem="SOh-hJ-gKS" firstAttribute="top" secondItem="jf6-0X-5eB" secondAttribute="bottom" constant="15" id="Lxh-Z0-Emg"/>
<constraint firstItem="jf6-0X-5eB" firstAttribute="centerY" secondItem="0Zd-v3-Vtu" secondAttribute="centerY" id="Mbj-p2-VdQ"/>
<constraint firstItem="mWp-V0-KaZ" firstAttribute="leading" secondItem="jf6-0X-5eB" secondAttribute="trailing" constant="10" id="Q58-SO-drh"/>
<constraint firstItem="raS-k5-oNa" firstAttribute="top" secondItem="F2U-NL-yOi" secondAttribute="bottom" id="RfO-1h-lm1"/>
<constraint firstAttribute="trailing" secondItem="F2U-NL-yOi" secondAttribute="trailing" id="V2m-3d-aIh"/>
<constraint firstItem="oeS-KW-qjD" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="cia-6b-Gc1"/>
<constraint firstItem="7eJ-B4-h9O" firstAttribute="leading" secondItem="SOh-hJ-gKS" secondAttribute="trailing" constant="15" id="iaQ-5H-nCe"/>
<constraint firstAttribute="bottom" secondItem="raS-k5-oNa" secondAttribute="bottom" id="ow3-Vt-3kW"/>
......@@ -135,6 +147,7 @@
<outlet property="blueLbl" destination="jf6-0X-5eB" id="8kh-Kf-KNP"/>
<outlet property="btn" destination="oeS-KW-qjD" id="cq8-ro-fPs"/>
<outlet property="btnH" destination="x1L-SF-P2T" id="Mvh-bJ-EXz"/>
<outlet property="edit_btn" destination="F2U-NL-yOi" id="EMm-1Z-gU5"/>
<outlet property="nameLbl" destination="vAQ-5q-KPr" id="Z7m-rl-JTe"/>
<outlet property="phoneLbl" destination="0Zd-v3-Vtu" id="3CH-Ai-KUY"/>
<outlet property="xValue" destination="4ok-AC-XWT" id="Lfk-u8-Fp8"/>
......@@ -149,7 +162,7 @@
<image name="jinru" width="13" height="23"/>
<image name="yuxuan" width="19" height="19"/>
<namedColor name="企业、预售字体">
<color red="1" green="0.68999999761581421" blue="0.47099998593330383" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="1" green="0.68627450980392157" blue="0.47058823529411764" 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"/>
......
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