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
deaee81b
Commit
deaee81b
authored
Jun 15, 2020
by
刘俊宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成绑定用户
parent
bdb4a171
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
10 deletions
+150
-10
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
...ata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/ViewController/客户管理/BingDingKeHuViewController.swift
...form/ViewController/客户管理/BingDingKeHuViewController.swift
+135
-8
GeliBusinessPlatform/ViewController/客户管理/XinZengAndBianJiKeHuViewController.swift
...wController/客户管理/XinZengAndBianJiKeHuViewController.swift
+15
-2
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
View file @
deaee81b
No preview for this file type
GeliBusinessPlatform/ViewController/客户管理/BingDingKeHuViewController.swift
View file @
deaee81b
...
...
@@ -7,19 +7,27 @@
//
import
UIKit
class
BingDingKeHuViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
UISearchBarDelegate
,
SearchBarViewDelegate
{
protocol
BingDingKeHuViewControllerDelegate
{
func
BingDingKeHuViewControllerSelec
(
sender
:
GetBindUserDataModel
)
}
class
BingDingKeHuViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
UISearchBarDelegate
,
SearchBarViewDelegate
,
TitleAndSelectCellDelegate
{
var
searchV
:
SearchBarView
?
=
nil
var
delegate
:
BingDingKeHuViewControllerDelegate
?
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
if
selectModel
==
nil
{
HUD
.
flash
(
.
label
(
"请选择绑定的用户"
),
delay
:
1.2
)
return
}
else
{
delegate
?
.
BingDingKeHuViewControllerSelec
(
sender
:
selectModel
!
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
@IBOutlet
weak
var
listView
:
UITableView
!
@IBOutlet
weak
var
topView
:
UIView
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
navbar
.
title
=
"绑定
客
户"
navbar
.
title
=
"绑定
用
户"
self
.
view
.
addSubview
(
navbar
)
SetTopFrame
(
view
:
topView
,
height
:
44
)
listView
.
separatorStyle
=
.
none
...
...
@@ -40,11 +48,110 @@ class BingDingKeHuViewController: BaseViewController,UITableViewDelegate,UITable
listView
.
register
(
UINib
(
nibName
:
"TitleAndSelectCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndSelectCell"
)
// Do any additional setup after loading the view.
//下拉刷新相关设置
headerMJ
.
setRefreshingTarget
(
self
,
refreshingAction
:
#selector(
loadData
)
)
listView
.
mj_header
=
headerMJ
listView
.
mj_header
?
.
beginRefreshing
()
//上拉加载相关设置
footerMJ
.
setRefreshingTarget
(
self
,
refreshingAction
:
#selector(
loadMoreData
)
)
listView
.
mj_footer
=
footerMJ
}
var
keyword
:
String
=
""
var
dataArr
:
Array
<
GetBindUserDataModel
>
=
[]
var
page
:
Int
=
0
var
selectModel
:
GetBindUserDataModel
?
=
nil
//MAKR:--调起搜索后添加个蒙版本
var
blackBtnView
:
UIButton
!
=
nil
func
searchBarSearchButtonClicked
(
_
searchBar
:
UISearchBar
)
{
print
(
"点击搜索进行--"
)
searchBar
.
resignFirstResponder
()
keyword
=
searchBar
.
text
!
listView
.
mj_header
?
.
beginRefreshing
()
//MARK: - 自定义delegate
}
//MARK:--取消搜索代理
func
clearSearchAction
()
{
print
(
"取消搜索代理了--"
)
}
func
searchBarTextDidEndEditing
(
_
searchBar
:
UISearchBar
)
{
print
(
"编辑即将结束了--"
)
removeBlackBtnView
()
if
searchBar
.
text
?
.
count
==
0
&&
keyword
.
count
!=
0
{
keyword
=
searchBar
.
text
!
listView
.
mj_header
?
.
beginRefreshing
()
}
}
func
searchBarShouldBeginEditing
(
_
searchBar
:
UISearchBar
)
->
Bool
{
print
(
"调起搜索后添加个蒙版本"
)
blackBtnView
=
UIButton
()
blackBtnView
.
backgroundColor
=
UIColor
.
init
(
named
:
"提示视图背景色"
)
self
.
view
.
addSubview
(
blackBtnView
)
blackBtnView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
top
.
equalTo
(
topView
!.
snp_bottom
)
}
blackBtnView
.
addTarget
(
self
,
action
:
#selector(
removeBlackBtnView
)
,
for
:
.
touchUpInside
)
return
true
}
@objc
func
removeBlackBtnView
(){
if
blackBtnView
!=
nil
{
blackBtnView
.
removeFromSuperview
()
searchV
!.
resignFirstResponder
()
}
}
//MARK:--加载数据
@objc
func
loadData
(){
print
(
"加载数据"
)
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
page
=
1
let
dic
=
[
"user_token"
:
UserToken
as
Any
,
"keyword"
:
keyword
,
"page"
:
page
]
getBindUser
(
dic
,
success
:
{
(
data
)
in
self
.
dataArr
.
removeAll
()
let
dataM
=
data
as!
GetBindUserModel
dataM
.
data
?
.
forEach
({
(
model
)
in
self
.
dataArr
.
append
(
model
)
})
self
.
listView
.
reloadData
()
self
.
listView
.
mj_header
?
.
endRefreshing
()
self
.
page
=
2
if
dataM
.
data
?
.
count
==
0
{
self
.
listView
.
mj_footer
?
.
endRefreshingWithNoMoreData
()
}
else
{
self
.
listView
.
mj_footer
?
.
endRefreshing
()
}
})
{
(
error
)
in
self
.
listView
.
mj_header
?
.
endRefreshing
()
}
}
//MARK:--加载更多数据
@objc
func
loadMoreData
(){
print
(
"加载更多数据"
)
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
let
dic
=
[
"user_token"
:
UserToken
as
Any
,
"keyword"
:
keyword
,
"page"
:
page
]
getBindUser
(
dic
,
success
:
{
(
data
)
in
let
dataM
=
data
as!
GetBindUserModel
if
dataM
.
data
?
.
count
==
0
{
self
.
listView
.
mj_footer
?
.
endRefreshingWithNoMoreData
()
}
else
{
self
.
page
+=
1
dataM
.
data
?
.
forEach
({
(
model
)
in
self
.
dataArr
.
append
(
model
)
})
self
.
listView
.
reloadData
()
self
.
listView
.
mj_footer
?
.
endRefreshing
()
}
})
{
(
error
)
in
self
.
listView
.
mj_footer
?
.
endRefreshing
()
}
}
//MARK: - CELL DELEGATE
...
...
@@ -52,16 +159,36 @@ class BingDingKeHuViewController: BaseViewController,UITableViewDelegate,UITable
return
49
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
3
return
self
.
dataArr
.
count
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSelectCell"
)
as!
TitleAndSelectCell
cell
.
selectBtn
.
isSelected
=
false
if
indexPath
.
row
==
0
{
cell
.
line
.
isHidden
=
true
}
let
rowModel
=
self
.
dataArr
[
indexPath
.
row
]
cell
.
titleLbl
.
text
=
rowModel
.
user_name
cell
.
delegate
=
self
if
selectModel
!=
nil
{
if
selectModel
?
.
user_id
==
rowModel
.
user_id
{
cell
.
selectBtn
.
isSelected
=
true
}
}
cell
.
tag
=
indexPath
.
row
return
cell
}
func
TitleAndSelectCellClick
(
content
:
UIButton
,
cell
:
TitleAndSelectCell
)
{
let
rowModel
=
self
.
dataArr
[
cell
.
tag
]
selectModel
=
rowModel
listView
.
reloadData
()
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
let
rowModel
=
self
.
dataArr
[
indexPath
.
row
]
selectModel
=
rowModel
listView
.
reloadData
()
}
}
GeliBusinessPlatform/ViewController/客户管理/XinZengAndBianJiKeHuViewController.swift
View file @
deaee81b
...
...
@@ -9,7 +9,7 @@
import
UIKit
import
LGButton
class
XinZengAndBianJiKeHuViewController
:
BaseViewController
,
UITableViewDataSource
,
UITableViewDelegate
{
class
XinZengAndBianJiKeHuViewController
:
BaseViewController
,
UITableViewDataSource
,
UITableViewDelegate
,
BingDingKeHuViewControllerDelegate
{
var
kehuName
:
String
=
""
var
phoneNum
:
String
=
""
...
...
@@ -17,6 +17,7 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
var
bindKehu
:
String
=
""
var
KehuType
:
String
=
""
var
discount
:
String
=
""
var
userDataModel
:
GetBindUserDataModel
?
=
nil
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
}
...
...
@@ -50,7 +51,7 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
}
let
titleArr
=
[
"客户名称:"
,
"客户手机号码: "
,
"客户公司名称:"
,
"绑定
客
户:"
,
"客户类型:"
,
"客户折扣:"
]
let
titleArr
=
[
"客户名称:"
,
"客户手机号码: "
,
"客户公司名称:"
,
"绑定
用
户:"
,
"客户类型:"
,
"客户折扣:"
]
let
holderArr
=
[
"请输入客户名"
,
"请输入手机号码"
,
"请输入公司名称"
,
"搜索绑定"
,
"请选择客户类型"
,
"请输入折扣数值"
]
//MARK: - CELL DELEGATE
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
...
...
@@ -62,14 +63,26 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
indexPath
.
row
==
3
{
let
vc
=
BingDingKeHuViewController
()
vc
.
delegate
=
self
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
//MARK:--绑定用户选择回调
func
BingDingKeHuViewControllerSelec
(
sender
:
GetBindUserDataModel
)
{
userDataModel
=
sender
listView
.
reloadData
()
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
indexPath
.
row
==
3
||
indexPath
.
row
==
4
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtnCell"
)
as!
TitleAndBtnCell
cell
.
nameLbl
.
text
=
titleArr
[
indexPath
.
row
]
cell
.
contentLbl
.
text
=
holderArr
[
indexPath
.
row
]
if
indexPath
.
row
==
3
&&
userDataModel
!=
nil
{
cell
.
contentLbl
.
text
=
userDataModel
?
.
user_name
}
cell
.
btn
.
isUserInteractionEnabled
=
false
if
indexPath
.
row
==
3
{
if
bindKehu
.
count
>
0
{
...
...
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