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
9d1dcdc1
Commit
9d1dcdc1
authored
Jun 16, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户列表完成
parent
deaee81b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
320 additions
and
28 deletions
+320
-28
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/Model/CustomerModel/CusListModel.swift
GeliBusinessPlatform/Model/CustomerModel/CusListModel.swift
+1
-1
GeliBusinessPlatform/Model/CustomerModel/CusSalesStatisticsModel.swift
...latform/Model/CustomerModel/CusSalesStatisticsModel.swift
+1
-1
GeliBusinessPlatform/ViewController/客户管理/KeHuListViewController.swift
...Platform/ViewController/客户管理/KeHuListViewController.swift
+36
-1
GeliBusinessPlatform/ViewController/客户管理/KeHuXQViewController.swift
...ssPlatform/ViewController/客户管理/KeHuXQViewController.swift
+91
-1
GeliBusinessPlatform/ViewController/客户管理/XinZengAndBianJiKeHuViewController.swift
...wController/客户管理/XinZengAndBianJiKeHuViewController.swift
+186
-20
GeliBusinessPlatform/ViewController/客户管理/XinZengAndBianJiKeHuViewController.xib
...iewController/客户管理/XinZengAndBianJiKeHuViewController.xib
+5
-4
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
9d1dcdc1
No preview for this file type
GeliBusinessPlatform/Model/CustomerModel/CusListModel.swift
View file @
9d1dcdc1
...
@@ -34,7 +34,7 @@ class CusListDataModel: Mappable {
...
@@ -34,7 +34,7 @@ class CusListDataModel: Mappable {
var
is_del
:
Int
?
//是否删除 1删除 0正常
var
is_del
:
Int
?
//是否删除 1删除 0正常
var
shop_id
:
Int
?
var
shop_id
:
Int
?
var
user_id
:
Int
?
//绑定的用户id
var
user_id
:
Int
?
//绑定的用户id
var
discounts_rate
:
Floa
t
?
//优惠率,使用时除100
var
discounts_rate
:
In
t
?
//优惠率,使用时除100
var
arrears_money
:
String
?
//欠款金额
var
arrears_money
:
String
?
//欠款金额
var
province
:
Int
?
//省
var
province
:
Int
?
//省
var
city
:
Int
?
//市
var
city
:
Int
?
//市
...
...
GeliBusinessPlatform/Model/CustomerModel/CusSalesStatisticsModel.swift
View file @
9d1dcdc1
...
@@ -24,7 +24,7 @@ class CusSalesStatisticsModel: Mappable {
...
@@ -24,7 +24,7 @@ class CusSalesStatisticsModel: Mappable {
}
}
}
}
class
CusSalesStatisticsDataModel
:
Mappable
{
class
CusSalesStatisticsDataModel
:
Mappable
{
var
sum_number
:
Int
?
//商品数量
var
sum_number
:
String
?
//商品数量
var
sum_amount
:
String
?
//商品金额
var
sum_amount
:
String
?
//商品金额
var
sku_id
:
Int
?
//商品sku_id
var
sku_id
:
Int
?
//商品sku_id
var
goods_name
:
String
?
//商品名
var
goods_name
:
String
?
//商品名
...
...
GeliBusinessPlatform/ViewController/客户管理/KeHuListViewController.swift
View file @
9d1dcdc1
...
@@ -8,7 +8,11 @@
...
@@ -8,7 +8,11 @@
import
UIKit
import
UIKit
class
KeHuListViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
UISearchBarDelegate
,
SearchBarViewDelegate
,
KeHuGuanLiCellDelegate
{
class
KeHuListViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
UISearchBarDelegate
,
SearchBarViewDelegate
,
KeHuGuanLiCellDelegate
,
XinZengAndBianJiKeHuViewControllerDelegate
{
func
XinZengAndBianJiKeHuViewControllerFinish
()
{
listView
.
mj_header
?
.
beginRefreshing
()
}
var
searchV
:
SearchBarView
?
=
nil
var
searchV
:
SearchBarView
?
=
nil
...
@@ -234,12 +238,37 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
...
@@ -234,12 +238,37 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
@IBAction
func
addAction
(
_
sender
:
Any
)
{
@IBAction
func
addAction
(
_
sender
:
Any
)
{
let
vc
=
XinZengAndBianJiKeHuViewController
()
let
vc
=
XinZengAndBianJiKeHuViewController
()
vc
.
titleStr
=
"新增客户"
vc
.
titleStr
=
"新增客户"
vc
.
delegate
=
self
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
//MARK: - 自定义delegate
//MARK: - 自定义delegate
func
KeHuGuanLiCellEditClick
(
cell
:
KeHuGuanLiCell
)
{
func
KeHuGuanLiCellEditClick
(
cell
:
KeHuGuanLiCell
)
{
let
model
=
dataArr
[
cell
.
tag
]
let
vc
=
XinZengAndBianJiKeHuViewController
()
let
vc
=
XinZengAndBianJiKeHuViewController
()
vc
.
titleStr
=
"编辑客户"
vc
.
titleStr
=
"编辑客户"
vc
.
delegate
=
self
vc
.
cus_id
=
model
.
cus_id
!
if
model
.
company
!=
nil
{
vc
.
companyName
=
model
.
company
!
}
if
model
.
cus_name
!=
nil
{
vc
.
kehuName
=
model
.
cus_name
!
}
if
model
.
user_id
!=
nil
{
vc
.
user_id
=
model
.
user_id
!
}
if
model
.
phone
!=
nil
{
vc
.
phoneNum
=
model
.
phone
!
}
if
model
.
discounts_rate
!=
nil
{
vc
.
discount
=
"
\(
model
.
discounts_rate
!
)
"
}
if
model
.
user_name
!=
nil
{
vc
.
bindKehu
=
model
.
user_name
!
}
if
model
.
cus_type
!=
nil
{
vc
.
typeSelect
=
model
.
cus_type
!
-
1
}
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
...
@@ -273,7 +302,9 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
...
@@ -273,7 +302,9 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
}
}
//MARK: - 跳转客户详情
//MARK: - 跳转客户详情
if
tableView
==
listView
{
if
tableView
==
listView
{
let
model
=
dataArr
[
indexPath
.
row
]
let
vc
=
KeHuXQViewController
()
let
vc
=
KeHuXQViewController
()
vc
.
model
=
model
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
...
@@ -300,6 +331,7 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
...
@@ -300,6 +331,7 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
if
tableView
==
listView
{
if
tableView
==
listView
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"KeHuGuanLiCell"
)
as!
KeHuGuanLiCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"KeHuGuanLiCell"
)
as!
KeHuGuanLiCell
let
rowModel
=
self
.
dataArr
[
indexPath
.
row
]
let
rowModel
=
self
.
dataArr
[
indexPath
.
row
]
cell
.
tag
=
indexPath
.
row
cell
.
compenyLbl
.
text
=
rowModel
.
company
cell
.
compenyLbl
.
text
=
rowModel
.
company
cell
.
nameLbl
.
text
=
rowModel
.
cus_name
cell
.
nameLbl
.
text
=
rowModel
.
cus_name
cell
.
delegate
=
self
cell
.
delegate
=
self
...
@@ -312,11 +344,13 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
...
@@ -312,11 +344,13 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
cell
.
arrowImg
.
isHidden
=
true
cell
.
arrowImg
.
isHidden
=
true
cell
.
nameLbl2
.
isHidden
=
true
cell
.
nameLbl2
.
isHidden
=
true
if
rowModel
.
phone
!=
nil
{
if
rowModel
.
phone
!=
nil
{
if
rowModel
.
phone
!.
count
>
0
{
cell
.
photoIcon
.
isHidden
=
false
cell
.
photoIcon
.
isHidden
=
false
cell
.
phoneNum
=
rowModel
.
phone
!
cell
.
phoneNum
=
rowModel
.
phone
!
}
else
{
}
else
{
cell
.
photoIcon
.
isHidden
=
true
cell
.
photoIcon
.
isHidden
=
true
}
}
}
if
rowModel
.
user_name
!=
nil
{
if
rowModel
.
user_name
!=
nil
{
cell
.
nameLbl2
.
isHidden
=
false
cell
.
nameLbl2
.
isHidden
=
false
...
@@ -330,6 +364,7 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
...
@@ -330,6 +364,7 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
cell
.
textTF
.
isHidden
=
true
cell
.
textTF
.
isHidden
=
true
cell
.
textTF
.
isUserInteractionEnabled
=
false
cell
.
textTF
.
isUserInteractionEnabled
=
false
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
cell
.
tag
=
indexPath
.
row
if
tableView
==
leftSelectView
{
if
tableView
==
leftSelectView
{
cell
.
nameLbl
.
text
=
leftArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
leftArr
[
indexPath
.
row
]
...
...
GeliBusinessPlatform/ViewController/客户管理/KeHuXQViewController.swift
View file @
9d1dcdc1
...
@@ -9,9 +9,12 @@
...
@@ -9,9 +9,12 @@
import
UIKit
import
UIKit
class
KeHuXQViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
{
class
KeHuXQViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
{
var
dataArr
=
[
"1"
,
"2"
]
var
page
=
0
var
model
:
CusListDataModel
?
var
dataArr
:
Array
<
CusSalesStatisticsDataModel
>
=
[]
@IBOutlet
weak
var
btmListView
:
UITableView
!
@IBOutlet
weak
var
btmListView
:
UITableView
!
@IBOutlet
weak
var
topListView
:
UITableView
!
@IBOutlet
weak
var
topListView
:
UITableView
!
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
navbar
.
title
=
"客户详情"
navbar
.
title
=
"客户详情"
...
@@ -23,8 +26,63 @@ class KeHuXQViewController: BaseViewController,UITableViewDelegate,UITableViewDa
...
@@ -23,8 +26,63 @@ class KeHuXQViewController: BaseViewController,UITableViewDelegate,UITableViewDa
topListView
.
register
(
UINib
(
nibName
:
"KeHuGuanLiCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"KeHuGuanLiCell"
)
topListView
.
register
(
UINib
(
nibName
:
"KeHuGuanLiCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"KeHuGuanLiCell"
)
btmListView
.
register
(
UINib
(
nibName
:
"KeHuXQCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"KeHuXQCell"
)
btmListView
.
register
(
UINib
(
nibName
:
"KeHuXQCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"KeHuXQCell"
)
//
//
//下拉刷新相关设置
headerMJ
.
setRefreshingTarget
(
self
,
refreshingAction
:
#selector(
loadData
)
)
btmListView
.
mj_header
=
headerMJ
//上拉加载相关设置
footerMJ
.
setRefreshingTarget
(
self
,
refreshingAction
:
#selector(
loadMoreData
)
)
btmListView
.
mj_footer
=
footerMJ
btmListView
.
mj_header
?
.
beginRefreshing
()
}
}
//MARK:--加载数据
@objc
func
loadData
(){
print
(
"加载数据"
)
page
=
1
let
dic
=
[
"user_token"
:
UserToken
as
Any
,
"page"
:
page
as
Any
,
"cus_id"
:
model
!.
cus_id
as
Any
]
cusSalesStatistics
(
dic
,
success
:
{
(
data
)
in
self
.
dataArr
.
removeAll
()
let
dataM
=
data
as!
CusSalesStatisticsModel
dataM
.
data
?
.
forEach
({
(
model
)
in
self
.
dataArr
.
append
(
model
)
})
self
.
btmListView
.
reloadData
()
self
.
btmListView
.
mj_header
?
.
endRefreshing
()
self
.
page
=
2
if
dataM
.
data
?
.
count
==
0
{
self
.
btmListView
.
mj_footer
?
.
endRefreshingWithNoMoreData
()
}
else
{
self
.
btmListView
.
mj_footer
?
.
endRefreshing
()
}
})
{
(
error
)
in
self
.
btmListView
.
mj_header
?
.
endRefreshing
()
}
}
//MARK:--加载更多数据
@objc
func
loadMoreData
(){
print
(
"加载更多数据"
)
let
dic
=
[
"user_token"
:
UserToken
as
Any
,
"page"
:
page
as
Any
,
"cus_id"
:
model
!.
cus_id
as
Any
]
cusSalesStatistics
(
dic
,
success
:
{
(
data
)
in
let
dataM
=
data
as!
CusSalesStatisticsModel
if
dataM
.
data
?
.
count
==
0
{
self
.
btmListView
.
mj_footer
?
.
endRefreshingWithNoMoreData
()
}
else
{
self
.
page
+=
1
dataM
.
data
?
.
forEach
({
(
model
)
in
self
.
dataArr
.
append
(
model
)
})
self
.
btmListView
.
reloadData
()
self
.
btmListView
.
mj_footer
?
.
endRefreshing
()
}
})
{
(
error
)
in
self
.
btmListView
.
mj_footer
?
.
endRefreshing
()
}
}
//MARK: - CELL DELEGATE
//MARK: - CELL DELEGATE
//header
//header
...
@@ -101,9 +159,41 @@ class KeHuXQViewController: BaseViewController,UITableViewDelegate,UITableViewDa
...
@@ -101,9 +159,41 @@ class KeHuXQViewController: BaseViewController,UITableViewDelegate,UITableViewDa
if
tableView
==
topListView
{
if
tableView
==
topListView
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"KeHuGuanLiCell"
)
as!
KeHuGuanLiCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"KeHuGuanLiCell"
)
as!
KeHuGuanLiCell
cell
.
btnWidth
.
constant
=
0
cell
.
btnWidth
.
constant
=
0
cell
.
tag
=
indexPath
.
row
cell
.
compenyLbl
.
text
=
model
!.
company
cell
.
nameLbl
.
text
=
model
!.
cus_name
cell
.
cus_type
=
model
!.
cus_type
!
cell
.
statusLbl2
.
isHidden
=
true
if
model
!.
discounts_rate
!=
0
&&
model
!.
discounts_rate
!=
100
{
cell
.
statusLbl2
.
isHidden
=
false
cell
.
statusLbl2
.
text
=
"
\(
model
!.
discounts_rate
!
)
折"
}
cell
.
arrowImg
.
isHidden
=
true
cell
.
nameLbl2
.
isHidden
=
true
if
model
!.
phone
!=
nil
{
if
model
!.
phone
!.
count
>
0
{
cell
.
photoIcon
.
isHidden
=
false
cell
.
phoneNum
=
model
!.
phone
!
}
else
{
cell
.
photoIcon
.
isHidden
=
true
}
}
if
model
!.
user_name
!=
nil
{
cell
.
nameLbl2
.
isHidden
=
false
cell
.
arrowImg
.
isHidden
=
false
cell
.
nameLbl2
.
text
=
model
!.
user_name
!
}
return
cell
return
cell
}
}
let
model
=
dataArr
[
indexPath
.
row
]
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"KeHuXQCell"
)
as!
KeHuXQCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"KeHuXQCell"
)
as!
KeHuXQCell
cell
.
nameLbl
.
text
=
model
.
goods_name
!
cell
.
shuLiangLbl
.
text
=
model
.
sum_number
!
cell
.
priceLbl
.
text
=
model
.
sum_amount
!
return
cell
return
cell
}
}
...
...
GeliBusinessPlatform/ViewController/客户管理/XinZengAndBianJiKeHuViewController.swift
View file @
9d1dcdc1
...
@@ -8,25 +8,142 @@
...
@@ -8,25 +8,142 @@
import
UIKit
import
UIKit
import
LGButton
import
LGButton
protocol
XinZengAndBianJiKeHuViewControllerDelegate
{
func
XinZengAndBianJiKeHuViewControllerFinish
()
}
class
XinZengAndBianJiKeHuViewController
:
BaseViewController
,
UITableViewDataSource
,
UITableViewDelegate
,
BingDingKeHuViewControllerDelegate
,
GLAlertSelectViewDelegate
,
UITextFieldDelegate
,
GeliAlertViewDelegate
{
var
delegate
:
XinZengAndBianJiKeHuViewControllerDelegate
?
var
cus_id
:
Int
?
var
user_id
:
Int
?
func
rightBtnClick
()
{
let
alertView
=
GeliAlertView
(
frame
:
self
.
view
.
window
!.
bounds
)
alertView
.
delegate
=
self
;
alertView
.
tishiLbl
.
text
=
""
alertView
.
titileLbl
.
text
=
"是否删除客户?"
alertView
.
rightBtn
.
tag
=
100
alertView
.
rightBtn
.
setAttributedTitle
(
NSAttributedString
(
string
:
"确定"
),
for
:
.
normal
)
self
.
view
.
window
?
.
addSubview
(
alertView
)
}
func
sureGeliAlertViewAction
(
sender
:
UIButton
)
{
HUD
.
flash
(
.
progress
)
if
sender
.
tag
==
100
{
let
dic
=
[
"user_token"
:
UserToken
as
Any
,
"function_id"
:
22
as
Any
,
"prval"
:
cus_id
as
Any
,
"value"
:
1
as
Any
,
]
editField
(
dic
,
success
:
{
(
data
)
in
HUD
.
hide
()
self
.
delegate
?
.
XinZengAndBianJiKeHuViewControllerFinish
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
err
)
in
}
return
}
var
dict
=
[
"user_token"
:
UserToken
as
Any
,
"cus_name"
:
kehuName
as
Any
,
"company"
:
companyName
as
Any
,
"cus_type"
:
typeSelect
+
1
as
Any
,
"phone"
:
phoneNum
as
Any
,
"user_id"
:
user_id
as
Any
,
"discounts_rate"
:
discount
as
Any
]
if
cus_id
==
nil
{
cusAdd
(
dict
,
success
:
{
(
data
)
in
HUD
.
hide
()
HUD
.
flash
(
.
labeledSubSuccess
(
subtitle
:
"提交成功"
),
delay
:
1.2
)
self
.
delegate
?
.
XinZengAndBianJiKeHuViewControllerFinish
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
err
)
in
}
print
(
"add == "
,
dict
)
}
else
{
dict
[
"cus_id"
]
=
cus_id
print
(
"edit == "
,
dict
)
cusEdit
(
dict
,
success
:
{
(
data
)
in
HUD
.
hide
()
HUD
.
flash
(
.
labeledSubSuccess
(
subtitle
:
"编辑成功"
),
delay
:
1.2
)
self
.
delegate
?
.
XinZengAndBianJiKeHuViewControllerFinish
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
err
)
in
}
}
}
class
XinZengAndBianJiKeHuViewController
:
BaseViewController
,
UITableViewDataSource
,
UITableViewDelegate
,
BingDingKeHuViewControllerDelegate
{
func
GLASClose
(
view
:
GLAlertSelectView
,
selectnum
:
Int
,
selectArr
:
Array
<
Int
>
)
{
typeSelect
=
selectnum
glSelectView
?
.
removeFromSuperview
()
glSelectView
=
nil
}
var
glSelectView
:
GLAlertSelectView
?
var
kehuName
:
String
=
""
var
kehuName
:
String
=
""
var
phoneNum
:
String
=
""
var
phoneNum
:
String
=
""
var
companyName
:
String
=
""
var
companyName
:
String
=
""
var
bindKehu
:
String
=
""
var
bindKehu
:
String
=
""
var
KehuType
:
String
=
""
var
discount
:
String
=
""
var
discount
:
String
=
""
var
userDataModel
:
GetBindUserDataModel
?
=
nil
var
typeArr
=
[
"个人"
,
"企业"
]
var
typeSelect
=
0
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
if
kehuName
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请填写客户名称"
),
delay
:
1.2
)
return
}
if
phoneNum
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请填写手机号码"
),
delay
:
1.2
)
return
}
if
isTelNumber
(
num
:
phoneNum
as
NSString
)
==
false
{
HUD
.
flash
(
.
label
(
"请填写正确的手机号码"
),
delay
:
1.2
)
return
}
if
companyName
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请填写客户公司名称"
),
delay
:
1.2
)
return
}
if
bindKehu
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请选择绑定用户"
),
delay
:
1.2
)
return
}
if
discount
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请填写折扣数,没有折扣请输入0"
),
delay
:
1.2
)
return
}
let
alertView
=
GeliAlertView
(
frame
:
self
.
view
.
window
!.
bounds
)
alertView
.
delegate
=
self
;
alertView
.
tishiLbl
.
text
=
""
if
(
titleStr
?
.
contains
(
"编辑"
))
!
{
alertView
.
titileLbl
.
text
=
"是否完成编辑?"
}
else
{
alertView
.
titileLbl
.
text
=
"是否新增客户?"
}
alertView
.
rightBtn
.
setAttributedTitle
(
NSAttributedString
(
string
:
"确定"
),
for
:
.
normal
)
self
.
view
.
window
?
.
addSubview
(
alertView
)
}
}
var
titleStr
:
String
?
var
titleStr
:
String
?
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
@IBOutlet
weak
var
bottomBtn
:
LGButton
!
@IBOutlet
weak
var
bottomBtn
:
LGButton
!
@IBOutlet
weak
var
listView
:
UITableView
!
@IBOutlet
weak
var
listView
:
UITableView
!
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
print
(
"==="
,
bindKehu
,
phoneNum
,
companyName
)
navbar
.
title
=
titleStr
navbar
.
title
=
titleStr
if
(
titleStr
?
.
contains
(
"编辑"
))
!
{
if
(
titleStr
?
.
contains
(
"编辑"
))
!
{
navbar
.
rightTitle
=
"删除"
navbar
.
rightTitle
=
"删除"
...
@@ -44,15 +161,11 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
...
@@ -44,15 +161,11 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
listView
.
register
(
UINib
(
nibName
:
"TitleAndBtnCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndBtnCell"
)
listView
.
register
(
UINib
(
nibName
:
"TitleAndBtnCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndBtnCell"
)
listView
.
register
(
UINib
(
nibName
:
"TitleAndTFCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndTFCell"
)
listView
.
register
(
UINib
(
nibName
:
"TitleAndTFCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndTFCell"
)
if
discount
.
count
==
0
||
kehuName
.
count
==
0
||
KehuType
.
count
==
0
||
bindKehu
.
count
==
0
||
phoneNum
.
count
==
0
||
companyName
.
count
==
0
{
bottomBtn
.
alpha
=
0.5
bottomBtn
.
isUserInteractionEnabled
=
false
}
}
}
let
titleArr
=
[
"客户名称:"
,
"客户手机号码: "
,
"客户公司名称:"
,
"绑定用户:"
,
"客户类型:"
,
"客户折扣:"
]
let
titleArr
=
[
"客户名称:"
,
"客户手机号码: "
,
"客户公司名称:"
,
"绑定用户:"
,
"客户类型:"
,
"客户折扣:"
]
let
holderArr
=
[
"请输入客户名"
,
"请输入手机号码"
,
"请输入公司名称"
,
"搜索绑定"
,
"请选择客户类型"
,
"请输入折扣数值
"
]
var
holderArr
=
[
"请输入客户名"
,
"请输入手机号码"
,
"请输入公司名称"
,
"搜索绑定"
,
"个人"
,
"请输入折扣数值(0~100)
"
]
//MARK: - CELL DELEGATE
//MARK: - CELL DELEGATE
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
return
49
return
49
...
@@ -66,10 +179,34 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
...
@@ -66,10 +179,34 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
vc
.
delegate
=
self
vc
.
delegate
=
self
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
if
indexPath
.
row
==
4
{
if
glSelectView
==
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
delegate
=
self
view
.
selectNum
=
typeSelect
view
.
tempNum
=
view
.
selectNum
view
.
titleLbl
.
text
=
"请选择企业类型"
view
.
dataArr
=
typeArr
self
.
view
.
addSubview
(
view
)
glSelectView
=
view
}
}
}
func
GLAlertSelectViewClick
(
selectNum
:
Int
,
view
:
GLAlertSelectView
)
{
typeSelect
=
selectNum
holderArr
.
insert
(
typeArr
[
selectNum
],
at
:
4
)
holderArr
.
remove
(
at
:
5
)
listView
.
reloadData
()
view
.
removeFromSuperview
()
glSelectView
=
nil
}
}
//MARK:--绑定用户选择回调
//MARK:--绑定用户选择回调
func
BingDingKeHuViewControllerSelec
(
sender
:
GetBindUserDataModel
)
{
func
BingDingKeHuViewControllerSelec
(
sender
:
GetBindUserDataModel
)
{
userDataModel
=
sender
bindKehu
=
sender
.
user_name
!
user_id
=
sender
.
user_id
!
listView
.
reloadData
()
listView
.
reloadData
()
}
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
...
@@ -79,9 +216,6 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
...
@@ -79,9 +216,6 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
cell
.
contentLbl
.
text
=
holderArr
[
indexPath
.
row
]
cell
.
contentLbl
.
text
=
holderArr
[
indexPath
.
row
]
if
indexPath
.
row
==
3
&&
userDataModel
!=
nil
{
cell
.
contentLbl
.
text
=
userDataModel
?
.
user_name
}
cell
.
btn
.
isUserInteractionEnabled
=
false
cell
.
btn
.
isUserInteractionEnabled
=
false
if
indexPath
.
row
==
3
{
if
indexPath
.
row
==
3
{
...
@@ -89,9 +223,7 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
...
@@ -89,9 +223,7 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
cell
.
contentLbl
.
text
=
bindKehu
cell
.
contentLbl
.
text
=
bindKehu
}
}
}
else
{
}
else
{
if
KehuType
.
count
>
0
{
cell
.
contentLbl
.
text
=
typeArr
[
typeSelect
]
cell
.
contentLbl
.
text
=
KehuType
}
}
}
return
cell
return
cell
...
@@ -99,22 +231,56 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
...
@@ -99,22 +231,56 @@ class XinZengAndBianJiKeHuViewController: BaseViewController,UITableViewDataSour
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTFCell"
)
as!
TitleAndTFCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTFCell"
)
as!
TitleAndTFCell
cell
.
nameLbl
.
text
=
titleArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
titleArr
[
indexPath
.
row
]
cell
.
textTF
.
placeholder
=
holderArr
[
indexPath
.
row
]
cell
.
textTF
.
placeholder
=
holderArr
[
indexPath
.
row
]
cell
.
textTF
.
delegate
=
self
if
(
titleStr
?
.
contains
(
"编辑"
))
!
{
if
(
titleStr
?
.
contains
(
"编辑"
))
!
{
cell
.
textTF
.
clearButtonMode
=
.
always
cell
.
textTF
.
clearButtonMode
=
.
always
}
}
cell
.
textTF
.
tag
=
indexPath
.
row
switch
indexPath
.
row
{
switch
indexPath
.
row
{
case
0
:
kehuName
=
cell
.
textTF
.
text
!
case
0
:
cell
.
textTF
.
keyboardType
=
.
default
cell
.
textTF
.
text
=
kehuName
break
break
case
1
:
phoneNum
=
cell
.
textTF
.
text
!
case
1
:
cell
.
textTF
.
keyboardType
=
.
numberPad
cell
.
textTF
.
text
=
phoneNum
break
break
case
2
:
companyName
=
cell
.
textTF
.
text
!
case
2
:
cell
.
textTF
.
keyboardType
=
.
default
cell
.
textTF
.
text
=
companyName
break
break
case
5
:
discount
=
cell
.
textTF
.
text
!
case
5
:
cell
.
textTF
.
keyboardType
=
.
numberPad
cell
.
textTF
.
text
=
discount
break
break
default
:
default
:
break
break
}
}
return
cell
return
cell
}
}
func
textFieldDidEndEditing
(
_
textField
:
UITextField
)
{
switch
textField
.
tag
{
case
0
:
kehuName
=
textField
.
text
!
break
case
1
:
phoneNum
=
textField
.
text
!
break
case
2
:
companyName
=
textField
.
text
!
break
case
5
:
let
str
=
textField
.
text
!
as
NSString
if
str
.
integerValue
>
100
{
HUD
.
flash
(
.
label
(
"不能超过100,请重新填写"
),
delay
:
1.2
)
textField
.
text
=
"100"
discount
=
"100"
return
}
discount
=
textField
.
text
!
break
default
:
break
}
}
}
}
GeliBusinessPlatform/ViewController/客户管理/XinZengAndBianJiKeHuViewController.xib
View file @
9d1dcdc1
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1
5702
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1
6097
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<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=
"Named colors"
minToolsVersion=
"9.0"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
</dependencies>
<objects>
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"XinZengAndBianJiKeHuViewController"
customModule=
"
GeliBusinessPlatform
"
customModuleProvider=
"target"
>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"XinZengAndBianJiKeHuViewController"
customModule=
"
TestClass
"
customModuleProvider=
"target"
>
<connections>
<connections>
<outlet
property=
"bottomBtn"
destination=
"Hbo-FL-O2S"
id=
"gfj-Jr-rtv"
/>
<outlet
property=
"bottomBtn"
destination=
"Hbo-FL-O2S"
id=
"gfj-Jr-rtv"
/>
<outlet
property=
"listView"
destination=
"lZh-U4-Q33"
id=
"thn-cy-mca"
/>
<outlet
property=
"listView"
destination=
"lZh-U4-Q33"
id=
"thn-cy-mca"
/>
...
@@ -33,7 +34,7 @@
...
@@ -33,7 +34,7 @@
<userDefinedRuntimeAttribute
type=
"boolean"
keyPath=
"gradientHorizontal"
value=
"YES"
/>
<userDefinedRuntimeAttribute
type=
"boolean"
keyPath=
"gradientHorizontal"
value=
"YES"
/>
</userDefinedRuntimeAttributes>
</userDefinedRuntimeAttributes>
<connections>
<connections>
<action
selector=
"submitAction:"
destination=
"-1"
eventType=
"
valueChanged"
id=
"eoB-XF-F8m
"
/>
<action
selector=
"submitAction:"
destination=
"-1"
eventType=
"
touchUpInside"
id=
"Dfo-s9-uQf
"
/>
</connections>
</connections>
</view>
</view>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
usesAttributedText=
"YES"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"jMG-ga-6QQ"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
usesAttributedText=
"YES"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"jMG-ga-6QQ"
>
...
...
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