Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GeliBusinessPlatform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljy
GeliBusinessPlatform
Commits
910199a4
Commit
910199a4
authored
Jun 09, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地址删除
parent
f9e5a69e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
179 additions
and
29 deletions
+179
-29
GeliBusinessPlatform/Interface/Interface_Z.plist
GeliBusinessPlatform/Interface/Interface_Z.plist
+2
-0
GeliBusinessPlatform/Model/AdressInterface.swift
GeliBusinessPlatform/Model/AdressInterface.swift
+16
-0
GeliBusinessPlatform/Model/UpDataModel.swift
GeliBusinessPlatform/Model/UpDataModel.swift
+1
-1
GeliBusinessPlatform/ViewController/地址管理/DZGLViewController.swift
...nessPlatform/ViewController/地址管理/DZGLViewController.swift
+98
-17
GeliBusinessPlatform/ViewController/地址管理/DiZhiGuanLiCell.swift
...usinessPlatform/ViewController/地址管理/DiZhiGuanLiCell.swift
+1
-0
GeliBusinessPlatform/ViewController/地址管理/DiZhiGuanLiCell.xib
GeliBusinessPlatform/ViewController/地址管理/DiZhiGuanLiCell.xib
+1
-0
GeliBusinessPlatform/ViewController/地址管理/XinZengDiZhiViewController.swift
...form/ViewController/地址管理/XinZengDiZhiViewController.swift
+60
-11
No files found.
GeliBusinessPlatform/Interface/Interface_Z.plist
View file @
910199a4
...
...
@@ -138,5 +138,7 @@
<string>
Address/editAddress
</string>
<key>
新增地址
</key>
<string>
Address/addAddress
</string>
<key>
删除地址
</key>
<string>
Address/addressDel
</string>
</dict>
</plist>
GeliBusinessPlatform/Model/AdressInterface.swift
View file @
910199a4
...
...
@@ -67,3 +67,19 @@ func AddAddress(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture
failture
(
error
)
}
}
/*
params-key(
user_token(用户token )
address_id 地址id
*/
func
AddressDel
(
_
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
)
}
}
GeliBusinessPlatform/Model/UpDataModel.swift
View file @
910199a4
...
...
@@ -8,7 +8,7 @@
import
Foundation
import
ObjectMapper
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址
,删除地址
class
UpDataModel
:
Mappable
{
var
code
:
Int
?
...
...
GeliBusinessPlatform/ViewController/地址管理/DZGLViewController.swift
View file @
910199a4
...
...
@@ -12,13 +12,70 @@ import LGButton
protocol
DZGLViewControllerDelegate
{
func
DZGLViewControllerSelect
(
data
:
GetAddrsInfoDataModel
)
}
class
DZGLViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
SwipeTableViewCellDelegate
,
UISearchBarDelegate
,
SearchBarViewDelegate
,
XinZengDiZhiViewControllerDelegate
{
class
DZGLViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
SwipeTableViewCellDelegate
,
UISearchBarDelegate
,
SearchBarViewDelegate
,
XinZengDiZhiViewControllerDelegate
,
GeliAlertViewDelegate
{
func
sureGeliAlertViewAction
(
sender
:
UIButton
)
{
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
let
model
=
adrArrs
[
sender
.
tag
]
AddressDel
([
"user_token"
:
UserToken
as
Any
,
"address_id"
:
model
.
address_id
as
Any
],
success
:
{
(
data
)
in
self
.
loadData
()
})
{
(
error
)
in
}
}
func
XinZengDiZhiViewControllerFinishAction
()
{
loadData
()
}
func
clearSearchAction
()
{
//MARK:--搜索模块
//MAKR:--调起搜索后添加个蒙版本
var
blackBtnView
:
UIButton
!
=
nil
func
searchBarShouldBeginEditing
(
_
searchBar
:
UISearchBar
)
->
Bool
{
print
(
"调起搜索后添加个蒙版本"
)
blackBtnView
=
UIButton
()
blackBtnView
.
backgroundColor
=
UIColor
.
init
(
named
:
"提示视图背景色"
)
view
.
addSubview
(
blackBtnView
)
blackBtnView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
top
.
equalTo
(
searchBg
.
snp_bottom
)
}
blackBtnView
.
addTarget
(
self
,
action
:
#selector(
removeBlackBtnView
)
,
for
:
.
touchUpInside
)
return
true
}
@objc
func
removeBlackBtnView
(){
if
blackBtnView
!=
nil
{
blackBtnView
.
removeFromSuperview
()
searchV
!.
resignFirstResponder
()
}
}
//MARK:--搜索按钮代理
func
searchBarSearchButtonClicked
(
_
searchBar
:
UISearchBar
)
{
print
(
"点击搜索关键字进行--
\(
searchBar
.
text
)
"
)
searchBar
.
resignFirstResponder
()
if
blackBtnView
!=
nil
{
blackBtnView
.
removeFromSuperview
()
}
keyWord
=
searchBar
.
text
!
loadData
()
}
//MARK:--清空搜索代理
func
clearSearchAction
()
{
}
//MARK:--编辑即将结束
func
searchBarTextDidEndEditing
(
_
searchBar
:
UISearchBar
)
{
print
(
"编辑即将结束了--"
)
removeBlackBtnView
()
if
keyWord
.
count
>
0
{
keyWord
=
searchBar
.
text
!
if
keyWord
.
count
==
0
{
loadData
()
}
}
}
var
delegate
:
DZGLViewControllerDelegate
?
...
...
@@ -48,8 +105,6 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
self
.
view
.
addSubview
(
navbar
)
HUD
.
flash
(
.
progress
)
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
if
cus_id
!=
nil
{
searchBgH
.
constant
=
0
...
...
@@ -78,15 +133,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
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
}
loadData
()
}
listView
.
separatorStyle
=
.
none
// SetTopFrameView(view: listView, btmView: btmLbl)
...
...
@@ -108,12 +155,13 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
@objc
func
loadData
(){
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
adrArrs
.
removeAll
()
AddressList
([
"user_token"
:
UserToken
as
Any
,
"key_word"
:
""
],
success
:
{
(
data
)
in
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
()
HUD
.
hide
()
})
{
(
error
)
in
}
...
...
@@ -144,6 +192,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
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
...
...
@@ -160,6 +209,24 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
cell
.
adrLbl
.
text
=
model
.
address
cell
.
btnH
.
constant
=
0
cell
.
xValue
.
constant
=
0
cell
.
blueLbl
.
isHidden
=
true
cell
.
yellowLbl
.
isHidden
=
true
if
model
.
is_default
==
1
{
cell
.
yellowLbl
.
isHidden
=
false
cell
.
blueLbl
.
isHidden
=
true
cell
.
yellowLblLeft
.
constant
=
-
18
}
if
model
.
is_send_default
==
1
{
cell
.
blueLbl
.
isHidden
=
false
cell
.
yellowLbl
.
isHidden
=
true
}
if
(
model
.
is_send_default
==
1
)
&&
(
model
.
is_default
==
1
)
{
cell
.
yellowLbl
.
isHidden
=
false
cell
.
blueLbl
.
isHidden
=
false
cell
.
yellowLblLeft
.
constant
=
10
}
}
}
return
cell
...
...
@@ -183,7 +250,13 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
vc
.
tel
=
model
.
tel
!
vc
.
zip
=
model
.
zipcode
!
vc
.
is_send_default
=
false
vc
.
pcdStr
=
model
.
province_cn
!+
"-"
+
model
.
city_cn
!+
"-"
+
model
.
district_cn
!
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
!
}
}
if
model
.
is_send_default
==
1
{
vc
.
is_send_default
=
true
}
...
...
@@ -211,12 +284,20 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
return
options
}
func
tableView
(
_
tableView
:
UITableView
,
editActionsForRowAt
indexPath
:
IndexPath
,
for
orientation
:
SwipeActionsOrientation
)
->
[
SwipeAction
]?
{
let
tag
=
indexPath
.
row
//创建“删除”事件按钮
let
deleteAction
=
SwipeAction
(
style
:
.
destructive
,
title
:
nil
)
{
action
,
indexPath
in
//将对应条目的数据删除
tableView
.
reloadData
()
let
alertView
=
GeliAlertView
(
frame
:
self
.
view
.
window
!.
bounds
)
alertView
.
delegate
=
self
alertView
.
tishiLbl
.
text
=
""
alertView
.
titileLbl
.
text
=
"是否删除地址?"
alertView
.
rightBtn
.
setAttributedTitle
(
NSAttributedString
(
string
:
"确定"
),
for
:
.
normal
)
alertView
.
rightBtn
.
tag
=
tag
self
.
view
.
window
?
.
addSubview
(
alertView
)
}
deleteAction
.
image
=
UIImage
(
named
:
"shanchuWhite"
)
deleteAction
.
backgroundColor
=
UIColor
(
named
:
"#F57575"
)
...
...
GeliBusinessPlatform/ViewController/地址管理/DiZhiGuanLiCell.swift
View file @
910199a4
...
...
@@ -11,6 +11,7 @@ import SwipeCellKit
class
DiZhiGuanLiCell
:
SwipeTableViewCell
{
@IBOutlet
weak
var
yellowLblLeft
:
NSLayoutConstraint
!
@IBOutlet
weak
var
btn
:
UIButton
!
@IBOutlet
weak
var
adrLbl
:
UILabel
!
@IBOutlet
weak
var
yellowLbl
:
UILabel
!
...
...
GeliBusinessPlatform/ViewController/地址管理/DiZhiGuanLiCell.xib
View file @
910199a4
...
...
@@ -137,6 +137,7 @@
<outlet
property=
"phoneLbl"
destination=
"0Zd-v3-Vtu"
id=
"3CH-Ai-KUY"
/>
<outlet
property=
"xValue"
destination=
"4ok-AC-XWT"
id=
"Lfk-u8-Fp8"
/>
<outlet
property=
"yellowLbl"
destination=
"mWp-V0-KaZ"
id=
"La4-PQ-SDN"
/>
<outlet
property=
"yellowLblLeft"
destination=
"Q58-SO-drh"
id=
"Rxw-kX-5Wm"
/>
</connections>
<point
key=
"canvasLocation"
x=
"131.15942028985509"
y=
"121.54017857142857"
/>
</tableViewCell>
...
...
GeliBusinessPlatform/ViewController/地址管理/XinZengDiZhiViewController.swift
View file @
910199a4
...
...
@@ -14,14 +14,32 @@ protocol XinZengDiZhiViewControllerDelegate {
class
XinZengDiZhiViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndTFAndBtnCellDelegate
,
UIPickerViewDelegate
,
UIPickerViewDataSource
,
SJMapViewControllerDelegate
,
UITextFieldDelegate
,
TitleAndSwitchCellDelegate
,
GeliAlertViewDelegate
{
var
address_id
:
Int
?
func
sureGeliAlertViewAction
(
sender
:
UIButton
)
{
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
if
sender
.
tag
==
999
{
AddressDel
([
"user_token"
:
UserToken
as
Any
,
"address_id"
:
address_id
as
Any
],
success
:
{
(
data
)
in
self
.
delegate
?
.
XinZengDiZhiViewControllerFinishAction
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
error
)
in
}
return
}
HUD
.
flash
(
.
progress
)
print
(
"adfb == "
,
provinceIndex
)
let
proDict
=
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
var
cityDict
:
Dictionary
<
String
,
Any
>
=
Dictionary
()
var
areaDict
:
Dictionary
<
String
,
Any
>
=
Dictionary
()
cityDict
[
"area_id"
]
=
""
areaDict
[
"area_id"
]
=
""
if
(
proDict
[
"city_list"
]
as!
NSArray
)
.
count
>
0
{
cityDict
=
(
proDict
[
"city_list"
]
as!
NSArray
)[
cityIndex
]
as!
Dictionary
<
String
,
Any
>
if
(
cityDict
[
"district_list"
]
as!
NSArray
)
.
count
>
0
{
areaDict
=
(
cityDict
[
"district_list"
]
as!
NSArray
)[
areaIndex
]
as!
Dictionary
<
String
,
Any
>
}
}
let
cityDict
=
(
proDict
[
"city_list"
]
as!
NSArray
)[
cityIndex
]
as!
[
String
:
AnyObject
]
let
areaDict
=
(
cityDict
[
"district_list"
]
as!
NSArray
)[
areaIndex
]
as!
Dictionary
<
String
,
Any
>
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
var
defalut
=
0
if
is_default
{
defalut
=
1
...
...
@@ -127,10 +145,16 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
let
item
=
addressArray
[
i
]
as!
Dictionary
<
String
,
Any
>
if
item
[
"area_id"
]
as!
Int
==
provinceIndex
{
let
citys
=
item
[
"city_list"
]
as!
Array
<
Dictionary
<
String
,
Any
>>
if
citys
.
count
==
0
{
provinceIndex
=
i
}
for
j
in
0
..<
citys
.
count
{
let
cItem
=
citys
[
j
]
if
cItem
[
"area_id"
]
as!
Int
==
cityIndex
{
let
districts
=
cItem
[
"district_list"
]
as!
Array
<
Dictionary
<
String
,
Any
>>
if
districts
.
count
==
0
{
cityIndex
=
j
}
for
k
in
0
..<
districts
.
count
{
let
dItem
=
districts
[
k
]
if
dItem
[
"area_id"
]
as!
Int
==
areaIndex
{
...
...
@@ -152,12 +176,11 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
}
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
getIndex
()
navbar
.
title
=
navTitle
if
navTitle
==
"编辑地址"
{
//
navbar.rightTitle = "删除"
navbar
.
rightTitle
=
"删除"
if
pcdStr
!=
nil
{
holderArr
.
insert
(
pcdStr
!
,
at
:
1
)
holderArr
.
remove
(
at
:
2
)
...
...
@@ -183,12 +206,30 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
}
@objc
func
adrSelectFinish
(
sender
:
UIButton
){
var
proName
=
""
var
cityName
=
""
var
areaName
=
""
let
proDict
=
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
proName
=
proDict
[
"area_name"
]
as!
String
if
(
proDict
[
"city_list"
]
as!
NSArray
)
.
count
>
0
{
let
cityDict
=
(
proDict
[
"city_list"
]
as!
NSArray
)[
cityIndex
]
as!
[
String
:
AnyObject
]
cityName
=
cityDict
[
"area_name"
]
as!
String
if
(
cityDict
[
"district_list"
]
as!
NSArray
)
.
count
>
0
{
let
areaDict
=
(
cityDict
[
"district_list"
]
as!
NSArray
)[
areaIndex
]
as!
Dictionary
<
String
,
Any
>
areaName
=
areaDict
[
"area_name"
]
as!
String
}
}
let
cityDict
=
(
proDict
[
"city_list"
]
as!
NSArray
)[
cityIndex
]
as!
[
String
:
AnyObject
]
let
areaDict
=
(
cityDict
[
"district_list"
]
as!
NSArray
)[
areaIndex
]
as!
Dictionary
<
String
,
Any
>
let
selectAdr
=
"
\(
proDict
[
"area_name"
]
!
)
"
+
"-"
+
"
\(
cityDict
[
"area_name"
]
!
)
"
+
"-"
+
"
\(
areaDict
[
"area_name"
]
!
)
"
var
selectAdr
=
proName
if
cityName
.
count
>
0
{
selectAdr
=
proName
+
"-"
+
cityName
if
areaName
.
count
>
0
{
selectAdr
=
proName
+
"-"
+
cityName
+
"-"
+
areaName
}
}
holderArr
.
insert
(
selectAdr
,
at
:
1
)
holderArr
.
remove
(
at
:
2
)
bgBtn
?
.
removeFromSuperview
()
...
...
@@ -268,7 +309,13 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
}
func
rightBtnClick
()
{
print
(
"删除"
)
let
alertView
=
GeliAlertView
(
frame
:
self
.
view
.
window
!.
bounds
)
alertView
.
delegate
=
self
alertView
.
tishiLbl
.
text
=
""
alertView
.
titileLbl
.
text
=
"是否删除地址?"
alertView
.
rightBtn
.
setAttributedTitle
(
NSAttributedString
(
string
:
"确定"
),
for
:
.
normal
)
alertView
.
rightBtn
.
tag
=
999
self
.
view
.
window
?
.
addSubview
(
alertView
)
}
//MARK: - cell delegate
func
TitleAndTFAndBtnCellBtnClick
()
{
...
...
@@ -394,6 +441,7 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
if
component
==
0
{
return
self
.
addressArray
.
count
}
else
if
component
==
1
{
print
(
"alkjdflkasd == "
,
provinceIndex
)
let
province
=
self
.
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
return
(
province
[
"city_list"
]
!
as
AnyObject
)
.
count
}
else
{
...
...
@@ -504,7 +552,8 @@ class XinZengDiZhiViewController: BaseViewController,UITableViewDelegate,UITable
func
switchClick
(
content
:
UISwitch
,
cell
:
TitleAndSwitchCell
)
{
if
cell
.
tag
==
1
{
//寄件
is_send_default
=
content
.
isOn
}
else
{
//收件
is_default
=
content
.
isOn
}
is_default
=
content
.
isOn
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment