Commit f9e5a69e authored by lujunye's avatar lujunye

地址列表,新增,编辑

parent 9ec64ef9
......@@ -129,6 +129,8 @@
E0516F7F244806C500E373CE /* MsgCenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0516F7E244806C500E373CE /* MsgCenterViewController.swift */; };
E0516F822448086700E373CE /* MsgCenterCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0516F802448086700E373CE /* MsgCenterCell.swift */; };
E0516F832448086700E373CE /* MsgCenterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0516F812448086700E373CE /* MsgCenterCell.xib */; };
E0571C6C248DC60000E85711 /* AddressListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0571C6B248DC60000E85711 /* AddressListModel.swift */; };
E0571C6E248DD4DE00E85711 /* AdressInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0571C6D248DD4DE00E85711 /* AdressInterface.swift */; };
E06524ED2458008900CA22E2 /* RuKuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E06524EB2458008900CA22E2 /* RuKuViewController.swift */; };
E06524EE2458008900CA22E2 /* RuKuViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E06524EC2458008900CA22E2 /* RuKuViewController.xib */; };
E06524F124580AAC00CA22E2 /* RuKuJiaGeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E06524EF24580AAC00CA22E2 /* RuKuJiaGeCell.swift */; };
......@@ -647,6 +649,8 @@
E0516F7E244806C500E373CE /* MsgCenterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MsgCenterViewController.swift; sourceTree = "<group>"; };
E0516F802448086700E373CE /* MsgCenterCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MsgCenterCell.swift; sourceTree = "<group>"; };
E0516F812448086700E373CE /* MsgCenterCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MsgCenterCell.xib; sourceTree = "<group>"; };
E0571C6B248DC60000E85711 /* AddressListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressListModel.swift; sourceTree = "<group>"; };
E0571C6D248DD4DE00E85711 /* AdressInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdressInterface.swift; sourceTree = "<group>"; };
E06524EB2458008900CA22E2 /* RuKuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuKuViewController.swift; sourceTree = "<group>"; };
E06524EC2458008900CA22E2 /* RuKuViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RuKuViewController.xib; sourceTree = "<group>"; };
E06524EF24580AAC00CA22E2 /* RuKuJiaGeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuKuJiaGeCell.swift; sourceTree = "<group>"; };
......@@ -1468,6 +1472,14 @@
path = "消息中心";
sourceTree = "<group>";
};
E0571C68248DC5CD00E85711 /* AdrModel */ = {
isa = PBXGroup;
children = (
E0571C6B248DC60000E85711 /* AddressListModel.swift */,
);
path = AdrModel;
sourceTree = "<group>";
};
E06524EA2458006600CA22E2 /* 入库 */ = {
isa = PBXGroup;
children = (
......@@ -1601,6 +1613,7 @@
E09B03A92445B09200211A51 /* Model */ = {
isa = PBXGroup;
children = (
E0571C68248DC5CD00E85711 /* AdrModel */,
E00D85DC244561FD00F5F816 /* Products */,
F95B8533247F47D800790719 /* Work */,
E0B5308224728D5600FFCC15 /* WarehouseManageModel */,
......@@ -1608,6 +1621,7 @@
F956D5BD246A3629003FF510 /* PersonCenterModel */,
F956D5BC246A35DB003FF510 /* GoodsManageMoel */,
F9171EFB245128B200359C2B /* Interface.swift */,
E0571C6D248DD4DE00E85711 /* AdressInterface.swift */,
E0B5308524728FB600FFCC15 /* WarehouseInterface.swift */,
F93615DA2480B421004187F9 /* WorkInterface.swift */,
F956D5BA246A359C003FF510 /* GoodsInterface.swift */,
......@@ -2915,6 +2929,7 @@
E0190A2D2487696F00B1E067 /* NewSelectItemVc.swift in Sources */,
E09B03C32445BD9500211A51 /* NavViewController.swift in Sources */,
F950FDD924518B9500C40530 /* FSCalendarDelegationFactory.m in Sources */,
E0571C6C248DC60000E85711 /* AddressListModel.swift in Sources */,
E0A2E82B24555D8600D6DB34 /* KuCunXiangQingCell.swift in Sources */,
F933F6C22452C68B00189561 /* PKHUDAnimating.swift in Sources */,
E00E48C62457C99900F16545 /* KuCunShangPinXQViewController.swift in Sources */,
......@@ -3020,6 +3035,7 @@
E013D7882484B1B90092DE46 /* CRKXiangQVC.swift in Sources */,
E0DDCB0F244AD8C500DF54C7 /* DaiQueRenCell.swift in Sources */,
E042F74024528CD500CDFA12 /* TitleAndOnlyBtnCell.swift in Sources */,
E0571C6E248DD4DE00E85711 /* AdressInterface.swift in Sources */,
F969BF07244EC38000C79953 /* GoodsCollectionViewCell.swift in Sources */,
F9531F462465108800724BEE /* JXPhotoBrowser.swift in Sources */,
E08A7ADC246505F000F934F2 /* KeHuListViewController.swift in Sources */,
......
......@@ -127,9 +127,9 @@ func isPurnInt(string: String) -> Bool {
}
//MARK:--是否是正确的数值
func isPurnNumber(str:String)-> Bool{
// let expression = "^[0-9]*((\\.|,)[0-9]{0,2})?$"
// let expression = "^[0-9]*((\\.|,)[0-9]{0,2})?$"
let arr = str.components(separatedBy: ",")
if arr.count > 0 {
......@@ -146,10 +146,10 @@ func isPurnNumber(str:String)-> Bool{
return predicate.evaluate(with: currObject)
}
if isPurnInt(string: num) || isPurnFloat(string: num){
return true
}else{
return false
}
return true
}else{
return false
}
}else{
if str.count > 0 {
var predicateStr:String!
......@@ -217,6 +217,29 @@ func isMailBox(mail_ad:String) -> Bool {
return emailTest.evaluate(with: mail_ad)
}
extension String {
var containsEmoji: Bool {
for scalar in unicodeScalars {
switch scalar.value {
case
0x00A0...0x00AF,
0x2030...0x204F,
0x2120...0x213F,
0x2190...0x21AF,
0x2310...0x329F,
0x1F000...0x1F9CF:
return true
default:
continue
}
}
return false
}
}
extension UIViewController {
class func currentViewController(base: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
......@@ -274,17 +297,18 @@ func dayAndTimeByDouble (sender : Double ) -> String {
}
//MARK: -- 格式化数字
func formatShowNumber(value:String) -> String {
if value.isEmpty {
return "0"
}
//保留位数
let interceptValue = String(format: "%.2f", (value as NSString).doubleValue)
//添加分隔符
let format = NumberFormatter()
format.numberStyle = .decimal
let formatValue = format.string(from: NSNumber(value: (interceptValue as NSString).doubleValue))
return formatValue!
}
if value.isEmpty {
return "0"
}
//保留位数
let interceptValue = String(format: "%.2f", (value as NSString).doubleValue)
//添加分隔符
let format = NumberFormatter()
format.numberStyle = .decimal
let formatValue = format.string(from: NSNumber(value: (interceptValue as NSString).doubleValue))
return formatValue!
}
//MARK:--数组转字符串
func dataChangeString(sender:Array<Any>) -> String{
var str = ""
......@@ -301,26 +325,29 @@ func dataChangeString(sender:Array<Any>) -> String{
}
//MARK:--字符串转字典
func getDictionaryFromJSONString(jsonString:String) ->NSDictionary{
let jsonData:Data = jsonString.data(using: .utf8)!
let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
if dict != nil {
return dict as! NSDictionary
}
return NSDictionary()
let jsonData:Data = jsonString.data(using: .utf8)!
let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
if dict != nil {
return dict as! NSDictionary
}
return NSDictionary()
}
//MARK:--字符串转字典
func getDicFromJSONString(jsonString:String) ->Dictionary<String,Any>{
let jsonData:Data = jsonString.data(using: .utf8)!
let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
if dict != nil {
return dict as! Dictionary
}
return Dictionary()
let jsonData:Data = jsonString.data(using: .utf8)!
let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
if dict != nil {
return dict as! Dictionary
}
return Dictionary()
}
//MARK: - 获取系统当前时间
func getTimeNow()->String{
let date = Date()
......
......@@ -132,5 +132,11 @@
<string>Admin/messageList</string>
<key>出库入库审核不通过</key>
<string>Warehouse/auditFail</string>
<key>地址列表</key>
<string>Address/addressList</string>
<key>编辑地址</key>
<string>Address/editAddress</string>
<key>新增地址</key>
<string>Address/addAddress</string>
</dict>
</plist>
//
// AddressListModel.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/6/8.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//获取统计+权限
class AddressListModel: Mappable {
var code:Int?
var message : String?
var data :Array<AddressListDataModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class AddressListDataModel: Mappable {
var address_id:Int?//地址ID
var user_id : Int?//用户ID
var consignee : String? //联系人名称
var province:Int?//省ID
var city : Int?//市ID
var district : Int?//D区ID
var address:String?//详细地址
var zipcode : String?//邮编
var tel : String?//电话号码
var mobile:String? //手机号码
var is_default : Int?//是否默认收货地址
var country : Int?
var street:Int?//街道ID
var is_send_default : Int?//地址ID是否默认发货地址
var province_cn : String?//地址ID省名
var city_cn:String?//市名
var district_cn : String?//区名
var street_cn : String?//街道名
required init?( map: Map) {
}
func mapping(map: Map) {
address_id <- map["address_id"]
user_id <- map["user_id"]
consignee <- map["consignee"]
province <- map["province"]
city <- map["city"]
district <- map["district"]
address <- map["address"]
zipcode <- map["zipcode"]
tel <- map["tel"]
mobile <- map["mobile"]
is_default <- map["is_default"]
country <- map["country"]
street <- map["street"]
is_send_default <- map["is_send_default"]
province_cn <- map["province_cn"]
city_cn <- map["city_cn"]
district_cn <- map["district_cn"]
street_cn <- map["street_cn"]
}
}
class AddAddressModel: Mappable {
var code:Int?
var message : String?
var data :AddAddressDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class AddAddressDataModel: Mappable {
var consignee:String?//联系人
var province : Int?//省ID
var city :Int?//市ID
var district:Int?//区ID
var street : Int?//街ID
var mobile :String?//手机号码
var address:String?//详细地址
var is_default : Int?//是否默认收货地址,1是0非
var is_send_default :Int?//是否默发收货地址,1是0非
var user_id:Int?
var address_id : Int?
required init?( map: Map) {
}
func mapping(map: Map) {
consignee <- map["consignee"]
province <- map["province"]
city <- map["city"]
district <- map["district"]
street <- map["street"]
mobile <- map["mobile"]
address <- map["address"]
is_default <- map["is_default"]
is_send_default <- map["is_send_default"]
user_id <- map["user_id"]
address_id <- map["address_id"]
}
}
//
// AdressInterface.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/6/8.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import Alamofire
import SwiftyJSON
import ObjectMapper
//MARK:--登录
//params-key(user_token(用户token ),key_word(关键字))
func AddressList(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("地址列表", params, { (rep:DataResponse<AddressListModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
/*
params-key(
user_token(用户token )
address_id 地址ID
consignee 联系人
province 省ID
city 市ID
district 区ID
street 街ID
address 详细地址
mobile 手机号码
tel 电话号码
is_default 是否默认收货地址,1是0非
is_send_default 是否默发收货地址,1是0非
*/
func EditAddress(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("编辑地址", params, { (rep:DataResponse<UpDataModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
/*
params-key(
user_token(用户token )
consignee 联系人
province 省ID
city 市ID
district 区ID
street 街ID
address 详细地址
mobile 手机号码
tel 电话号码
is_default 是否默认收货地址,1是0非
is_send_default 是否默发收货地址,1是0非
*/
func AddAddress(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("新增地址", params, { (rep:DataResponse<AddAddressDataModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
......@@ -8,7 +8,7 @@
import Foundation
import ObjectMapper
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址
class UpDataModel: Mappable {
var code:Int?
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<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">
<device id="retina5_5" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<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"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GeliAlertTextFiled" customModule="GeliBusinessPlatform" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GeliAlertTextFiled" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="textTF" destination="kuS-yq-U0R" id="6K0-Eu-oXJ"/>
</connections>
......@@ -95,7 +96,6 @@
<constraints>
<constraint firstAttribute="height" constant="44" id="dNK-WF-IcX"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
<userDefinedRuntimeAttributes>
......@@ -176,7 +176,7 @@
<color red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="蓝色字体颜色">
<color red="0.27799999713897705" green="0.56099998950958252" blue="0.88999998569488525" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
......@@ -13,9 +13,13 @@ import MAMapKit
import AMapSearchKit
import LGButton
import IQKeyboardManagerSwift
protocol SJMapViewControllerDelegate {
func SJMapViewControllerSelectArd(adr:String)
}
class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapViewDelegate,AMapSearchDelegate,UISearchBarDelegate,SearchBarViewDelegate,UITableViewDelegate,UITableViewDataSource{
var delegate:SJMapViewControllerDelegate?
var mapView: MAMapView!
var search: AMapSearchAPI!
......@@ -25,7 +29,7 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
var lat:CLLocationDegrees = 23.142059
var lng:CLLocationDegrees = 113.240747
var adrArr:Array<Any> = []
var adrArr:Array<AMapPOI> = []
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.navigationBar.isHidden = true
......@@ -66,8 +70,12 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
self.navigationController?.popViewController(animated: true)
}
@objc func submitAction(){
self.navigationController?.popViewController(animated: true)
if adrStr!.count > 0 {
delegate?.SJMapViewControllerSelectArd(adr: adrStr!)
self.navigationController?.popViewController(animated: true)
}else{
HUD.flash(.label("请选择地址"), delay: 1.2)
}
}
//MARK: - 高德地图delegate
......@@ -78,7 +86,9 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
}
//解析response获取POI信息,具体解析见 Demo
adrArr.removeAll()
adrArr.append(response.pois)
response.pois.forEach { (poi) in
adrArr.append(poi)
}
listView?.reloadData()
}
......@@ -139,7 +149,7 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "SJMapCell") as! SJMapCell
let poi = adrArr[indexPath.row] as! AMapPOI
let poi = adrArr[indexPath.row]
cell.nameLbl.text = poi.name
//1.将两个经纬度点转成投影点
......@@ -159,7 +169,7 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
return cell
}
var adrStr:String?
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if idx == indexPath {
return
......@@ -168,6 +178,7 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
let cell = tableView.cellForRow(at: idx!) as! SJMapCell
mapView.setCenter(CLLocationCoordinate2D(latitude:CLLocationDegrees(cell.lat!), longitude: CLLocationDegrees(cell.lng!)), animated: false)
listView?.reloadData()
adrStr = cell.nameLbl.text
}
}
......@@ -193,7 +204,7 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
btn.addTarget(self, action: #selector(submitAction), for: .touchUpInside)
self.view.addSubview(btn)
btn.snp.makeConstraints { (make) in
make.top.equalTo(20)
make.top.equalTo(60)
make.right.equalTo(-20)
make.width.equalTo(60)
make.height.equalTo(30)
......@@ -207,7 +218,7 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
btn2.addTarget(self, action: #selector(backAction), for: .touchUpInside)
self.view.addSubview(btn2)
btn2.snp.makeConstraints { (make) in
make.top.equalTo(20)
make.top.equalTo(60)
make.left.equalTo(20)
make.width.equalTo(60)
make.height.equalTo(30)
......
......@@ -12,38 +12,85 @@ import LGButton
protocol DZGLViewControllerDelegate {
func DZGLViewControllerSelect(data:GetAddrsInfoDataModel)
}
class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,SwipeTableViewCellDelegate{
class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,SwipeTableViewCellDelegate,UISearchBarDelegate,SearchBarViewDelegate,XinZengDiZhiViewControllerDelegate{
func XinZengDiZhiViewControllerFinishAction() {
loadData()
}
func clearSearchAction() {
}
var delegate:DZGLViewControllerDelegate?
var cus_id:Int?
var isSelectMotion = false
var selectIdx:IndexPath?
var adrInfo:GetAddrsInfoModel?
//列表
var adrArrs:Array<AddressListDataModel> = []
@IBOutlet weak var searchBg: UIView!
@IBOutlet weak var btmLbl: UILabel!
@IBOutlet weak var listView: UITableView!
@IBOutlet weak var searchBgH: NSLayoutConstraint!
var searchV : SearchBarView? = nil
@IBOutlet weak var btmBtn: LGButton!
@IBAction func btmClick(_ sender: Any) {
delegate?.DZGLViewControllerSelect(data: (adrInfo?.data![selectIdx!.row])!)
self.navigationController?.popViewController(animated: true)
}
@IBOutlet weak var btmLblHeight: NSLayoutConstraint!
var keyWord = ""
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = "地址管理"
// navbar.rightTitle = "新增"
self.view.addSubview(navbar)
HUD.flash(.progress)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
getAddrsInfo(["user_token":UserToken,"cus_id":cus_id], success: { (data) in
self.adrInfo = data as! GetAddrsInfoModel
self.listView.reloadData()
HUD.hide()
}) { (error) in
if cus_id != nil {
searchBgH.constant = 0
getAddrsInfo(["user_token":UserToken,"cus_id":cus_id], success: { (data) in
self.adrInfo = data as! GetAddrsInfoModel
self.listView.reloadData()
HUD.hide()
}) { (error) in
}
}else{
//searchbar
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)
}
searchV = searchBr
searchBr.placeholderStr = "请输入收货人地址"
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
navbar.rightTitle = "新增"
searchBgH.constant = 45
AddressList(["user_token":UserToken as Any,"key_word":keyWord], success: { (data) in
let model = data as! AddressListModel
model.data?.forEach({ (item) in
self.adrArrs.append(item)
})
self.listView.reloadData()
}) { (error) in
}
}
listView.separatorStyle = .none
SetTopFrameView(view: listView, btmView: btmLbl)
// SetTopFrameView(view: listView, btmView: btmLbl)
SetTopFrame(view: searchBg, height: 45)
listView.register(UINib(nibName: "DiZhiGuanLiCell", bundle: nil), forCellReuseIdentifier: "DiZhiGuanLiCell")
btmLbl.isHidden = !isSelectMotion
......@@ -53,21 +100,38 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
}else{
btmLblHeight.constant = 0
}
// Do any additional setup after loading the view.
}
@objc func loadData(){
let UserToken = UserDefaults.standard.value(forKey: "user_token")
adrArrs.removeAll()
AddressList(["user_token":UserToken as Any,"key_word":""], success: { (data) in
let model = data as! AddressListModel
model.data?.forEach({ (item) in
self.adrArrs.append(item)
})
self.listView.reloadData()
}) { (error) in
}
}
func rightBtnClick() {
let vc = XinZengDiZhiViewController()
vc.navTitle = "新增地址"
vc.delegate = self
self.navigationController?.pushViewController(vc, animated: true)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if adrInfo != nil {
return (adrInfo?.data!.count)!
if cus_id != nil {
if adrInfo != nil {
return (adrInfo?.data!.count)!
}
}
return 1
return adrArrs.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 79
......@@ -75,16 +139,27 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "DiZhiGuanLiCell") as! DiZhiGuanLiCell
cell.delegate = self
let model = adrInfo?.data![indexPath.row]
cell.nameLbl.text = model?.consignee
cell.phoneLbl.text = model?.mobile
cell.adrLbl.text = model?.addr_cn
if isSelectMotion == false {
cell.btnH.constant = 0
cell.xValue.constant = 0
}else{
if indexPath == selectIdx {
cell.btn.isSelected = true
if cus_id != nil {//选择
let model = adrInfo?.data![indexPath.row]
cell.nameLbl.text = model?.consignee
cell.phoneLbl.text = model?.mobile
cell.adrLbl.text = model?.addr_cn
if isSelectMotion == false {
cell.btnH.constant = 0
cell.xValue.constant = 0
}else{
if indexPath == selectIdx {
cell.btn.isSelected = true
}
}
}else{//列表
if adrArrs.count > 0 {
let model = adrArrs[indexPath.row]
cell.nameLbl.text = model.consignee
cell.phoneLbl.text = model.mobile
cell.adrLbl.text = model.address
cell.btnH.constant = 0
cell.xValue.constant = 0
}
}
return cell
......@@ -93,9 +168,31 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print(indexPath.row)
if isSelectMotion == false {
let vc = XinZengDiZhiViewController()
vc.navTitle = "编辑地址"
self.navigationController?.pushViewController(vc, animated: true)
if adrArrs.count > 0 {
let model = adrArrs[indexPath.row]
let vc = XinZengDiZhiViewController()
vc.delegate = self
vc.navTitle = "编辑地址"
vc.provinceIndex = model.province!
vc.cityIndex = model.city!
vc.areaIndex = model.district!
vc.address_id = model.address_id!
vc.adrStr = model.address!
vc.nameStr = model.consignee!
vc.phone = model.mobile!
vc.tel = model.tel!
vc.zip = model.zipcode!
vc.is_send_default = false
vc.pcdStr = model.province_cn!+"-"+model.city_cn!+"-"+model.district_cn!
if model.is_send_default == 1 {
vc.is_send_default = true
}
vc.is_default = false
if model.is_default == 1 {
vc.is_default = true
}
self.navigationController?.pushViewController(vc, animated: true)
}
}else{
selectIdx = indexPath
listView.reloadData()
......
......@@ -15,6 +15,8 @@
<outlet property="btmLbl" destination="Ypv-HH-qxb" id="Qod-Sc-gU9"/>
<outlet property="btmLblHeight" destination="5VM-BT-t21" id="Drd-88-AM5"/>
<outlet property="listView" destination="PT0-ms-ns9" id="I4E-LU-xmE"/>
<outlet property="searchBg" destination="OU4-kr-Utk" id="jZZ-K3-uQJ"/>
<outlet property="searchBgH" destination="ZqD-2y-Mup" id="Kb9-3v-jUA"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......@@ -24,7 +26,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="PT0-ms-ns9">
<rect key="frame" x="0.0" y="44" width="414" height="769"/>
<rect key="frame" x="0.0" y="89" width="414" height="724"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="S9q-iF-ucu"/>
......@@ -63,19 +65,41 @@
</attributedString>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OU4-kr-Utk">
<rect key="frame" x="0.0" y="44" width="414" height="45"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4o7-3y-vAM">
<rect key="frame" x="0.0" y="44" width="414" height="1"/>
<color key="backgroundColor" name="灰色分界线"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="eFj-Bx-o5r"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="4o7-3y-vAM" firstAttribute="leading" secondItem="OU4-kr-Utk" secondAttribute="leading" id="Wwr-qE-7A7"/>
<constraint firstAttribute="bottom" secondItem="4o7-3y-vAM" secondAttribute="bottom" id="ZGB-P3-w3m"/>
<constraint firstAttribute="height" constant="45" id="ZqD-2y-Mup"/>
<constraint firstAttribute="trailing" secondItem="4o7-3y-vAM" secondAttribute="trailing" id="kNH-yD-Ob3"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="cAI-JO-Qdu" secondAttribute="bottom" id="1MD-9W-7eX"/>
<constraint firstItem="cAI-JO-Qdu" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="2al-2v-3lI"/>
<constraint firstItem="OU4-kr-Utk" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="DaO-lj-329"/>
<constraint firstItem="OU4-kr-Utk" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="DtA-69-LGt"/>
<constraint firstItem="cAI-JO-Qdu" firstAttribute="top" secondItem="Ypv-HH-qxb" secondAttribute="top" id="GhW-XG-N4K"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="OU4-kr-Utk" secondAttribute="trailing" id="ODV-uf-oai"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Ypv-HH-qxb" secondAttribute="trailing" id="PaP-SV-iSE"/>
<constraint firstItem="PT0-ms-ns9" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="V5G-53-sAf"/>
<constraint firstItem="PT0-ms-ns9" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="Zy4-E7-jKS"/>
<constraint firstItem="PT0-ms-ns9" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="Qza-8B-fzu"/>
<constraint firstItem="cAI-JO-Qdu" firstAttribute="top" secondItem="PT0-ms-ns9" secondAttribute="bottom" id="Unt-K0-Scq"/>
<constraint firstItem="PT0-ms-ns9" firstAttribute="top" secondItem="OU4-kr-Utk" secondAttribute="bottom" id="VnE-6I-IKx"/>
<constraint firstItem="Ypv-HH-qxb" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="a42-al-5WD"/>
<constraint firstItem="PT0-ms-ns9" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="aAW-Lb-vlo"/>
<constraint firstItem="cAI-JO-Qdu" firstAttribute="top" secondItem="PT0-ms-ns9" secondAttribute="bottom" id="euL-DJ-Xbf"/>
<constraint firstAttribute="trailing" secondItem="cAI-JO-Qdu" secondAttribute="trailing" id="fGl-8X-Oxx"/>
<constraint firstItem="PT0-ms-ns9" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="ySk-wu-4YG"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="Ypv-HH-qxb" secondAttribute="bottom" id="z9r-c2-Am0"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
......@@ -89,6 +113,9 @@
<namedColor name="按钮渐变色下,字体颜色">
<color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色分界线">
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<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">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<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"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="XinZengDiZhiViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="XinZengDiZhiViewController" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="listView" destination="8oC-r4-8Ak" id="BND-Zt-77I"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
......@@ -32,7 +33,7 @@
<userDefinedRuntimeAttribute type="boolean" keyPath="gradientHorizontal" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="saveAction:" destination="-1" eventType="valueChanged" id="Azy-JY-gMp"/>
<action selector="saveAction:" destination="-1" eventType="touchUpInside" id="LQs-al-C7J"/>
</connections>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2aH-ML-hyn">
......
......@@ -423,9 +423,9 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
self.navigationController?.pushViewController(vc, animated: true)
return
case 59: //地址管理
// let vc = DZGLViewController()
let vc = XinZengDiZhiViewController()//新增
vc.navTitle = "新增地址"
let vc = DZGLViewController()
// let vc = XinZengDiZhiViewController()//新增
// vc.navTitle = "新增地址"
self.navigationController?.pushViewController(vc, animated: true )
return
case 61: //库存商品
......
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