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
346d3d08
Commit
346d3d08
authored
May 27, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
补充规格填写售价,重量输入格式错误提醒
parent
680fd596
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
434 additions
and
423 deletions
+434
-423
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/View/Cell/TitleAndTFCell.swift
GeliBusinessPlatform/View/Cell/TitleAndTFCell.swift
+1
-3
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
...orm/ViewController/新增规格/CreatNewSpecsViewController.swift
+433
-420
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
346d3d08
No preview for this file type
GeliBusinessPlatform/View/Cell/TitleAndTFCell.swift
View file @
346d3d08
...
@@ -22,9 +22,7 @@ class TitleAndTFCell: UITableViewCell {
...
@@ -22,9 +22,7 @@ class TitleAndTFCell: UITableViewCell {
// Initialization code
// Initialization code
}
}
@objc
func
textEditing
(
sender
:
UITextField
){
@objc
func
textEditing
(
sender
:
UITextField
){
// if sender.text!.count > 0 {
delegate
?
.
textFieldContent
?(
content
:
sender
.
text
!
,
cell
:
self
)
delegate
?
.
textFieldContent
?(
content
:
sender
.
text
!
,
cell
:
self
)
// }
}
}
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
super
.
setSelected
(
selected
,
animated
:
animated
)
super
.
setSelected
(
selected
,
animated
:
animated
)
...
...
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
View file @
346d3d08
...
@@ -237,490 +237,503 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -237,490 +237,503 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
func
textFieldDidEndEditing
(
_
textField
:
UITextField
)
{
func
textFieldDidEndEditing
(
_
textField
:
UITextField
)
{
switch
textField
.
tag
{
switch
textField
.
tag
{
case
0
:
case
0
:
textField
.
text
=
formatShowNumber
(
value
:
textField
.
text
!
)
if
isPurnNumber
(
str
:
textField
.
text
!
)
{
price
=
textField
.
text
!
textField
.
text
=
formatShowNumber
(
value
:
textField
.
text
!
)
price
=
textField
.
text
!
}
else
{
HUD
.
flash
(
.
label
(
"请输入正确的价格"
),
delay
:
1.2
)
textField
.
text
=
""
price
=
textField
.
text
!
}
break
break
case
2
:
case
2
:
textField
.
text
=
formatShowNumber
(
value
:
textField
.
text
!
)
if
isPurnNumber
(
str
:
textField
.
text
!
)
{
weight
=
textField
.
text
!
textField
.
text
=
formatShowNumber
(
value
:
textField
.
text
!
)
break
weight
=
textField
.
text
!
default
:
}
else
{
break
HUD
.
flash
(
.
label
(
"请输入正确的重量"
),
delay
:
1.2
)
}
textField
.
text
=
""
}
price
=
textField
.
text
!
func
textFieldShouldReturn
(
_
textField
:
UITextField
)
->
Bool
{
}
switch
textField
.
tag
{
case
1
:
guiGe
=
textField
.
text
!
break
break
default
:
default
:
break
break
}
}
return
true
}
}
func
PuTongJieTiClickDone
()
{
IQKeyboardManager
.
shared
.
resignFirstResponder
()
func
textFieldShouldReturn
(
_
textField
:
UITextField
)
->
Bool
{
switch
textField
.
tag
{
case
1
:
guiGe
=
textField
.
text
!
break
default
:
break
}
return
true
}
func
PuTongJieTiClickDone
()
{
IQKeyboardManager
.
shared
.
resignFirstResponder
()
}
//MARK: - cell delegate
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
if
(
navbar
.
title
?
.
contains
(
"编辑"
))
!
{
return
4
}
else
{
return
3
}
}
//MARK: - cell delegate
}
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
(
navbar
.
title
?
.
contains
(
"编辑"
))
!
{
return
4
if
section
==
0
{
}
else
{
return
titleArray
.
count
return
3
}
}
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
section
==
2
{
if
selectYuShou
{
//预售
if
section
==
0
{
return
specalArr
.
count
return
titleArray
.
count
}
else
{
//非预售
}
return
jieTiArr
.
count
if
section
==
2
{
if
selectYuShou
{
//预售
return
specalArr
.
count
}
else
{
//非预售
return
jieTiArr
.
count
}
}
}
return
1
}
}
return
1
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
indexPath
.
section
==
0
{
if
indexPath
.
row
<
3
{
if
indexPath
.
section
==
0
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
if
indexPath
.
row
<
3
{
cell
.
nameLbl
.
text
=
titleArray
[
indexPath
.
row
]
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
cell
.
textTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
nameLbl
.
text
=
titleArray
[
indexPath
.
row
]
cell
.
tag
=
indexPath
.
row
cell
.
textTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
textTF
.
tag
=
cell
.
tag
cell
.
tag
=
indexPath
.
row
//keyboardType
cell
.
textTF
.
tag
=
cell
.
tag
cell
.
textTF
.
returnKeyType
=
.
done
//keyboardType
cell
.
textTF
.
delegate
=
self
cell
.
textTF
.
returnKeyType
=
.
done
if
indexPath
.
row
==
0
||
indexPath
.
row
==
2
{
cell
.
textTF
.
delegate
=
self
cell
.
textTF
.
keyboardType
=
.
decimalPad
if
indexPath
.
row
==
0
||
indexPath
.
row
==
2
{
}
cell
.
textTF
.
keyboardType
=
.
decimalPad
let
str
=
NSAttributedString
(
string
:
pliceHolderArr
[
indexPath
.
row
],
attributes
:
[
NSAttributedString
.
Key
.
foregroundColor
:
UIColor
(
named
:
"灰色字体颜色"
)])
}
cell
.
textTF
.
attributedPlaceholder
=
str
let
str
=
NSAttributedString
(
string
:
pliceHolderArr
[
indexPath
.
row
],
attributes
:
[
NSAttributedString
.
Key
.
foregroundColor
:
UIColor
(
named
:
"灰色字体颜色"
)])
if
datasArr
.
count
>
0
{
cell
.
textTF
.
attributedPlaceholder
=
str
switch
indexPath
.
row
{
if
datasArr
.
count
>
0
{
case
0
:
switch
indexPath
.
row
{
cell
.
textTF
.
text
=
price
case
0
:
break
cell
.
textTF
.
text
=
price
case
1
:
break
cell
.
textTF
.
text
=
guiGe
case
1
:
break
cell
.
textTF
.
text
=
guiGe
default
:
break
cell
.
textTF
.
text
=
weight
default
:
break
cell
.
textTF
.
text
=
weight
break
}
}
cell
.
delegate
=
self
return
cell
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
cell
.
tag
=
indexPath
.
row
cell
.
btn
.
isUserInteractionEnabled
=
isAllEditing
cell
.
delegate
=
self
cell
.
nameLbl
.
text
=
titleArray
[
indexPath
.
row
]
cell
.
contentLbl
.
text
=
pliceHolderArr
[
indexPath
.
row
]
if
indexPath
.
row
==
3
{
if
tempSelect
!=
nil
{
cell
.
contentLbl
.
text
=
selectListArr
[
tempSelect
!
]
}
}
}
if
indexPath
.
row
==
4
{
if
itemDanWeiSelect
!=
nil
{
}
cell
.
contentLbl
.
text
=
danWeiArr
!
[
itemDanWeiSelect
!
]
cell
.
delegate
=
self
}
return
cell
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
cell
.
tag
=
indexPath
.
row
cell
.
btn
.
isUserInteractionEnabled
=
isAllEditing
cell
.
delegate
=
self
cell
.
nameLbl
.
text
=
titleArray
[
indexPath
.
row
]
cell
.
contentLbl
.
text
=
pliceHolderArr
[
indexPath
.
row
]
if
indexPath
.
row
==
3
{
if
tempSelect
!=
nil
{
cell
.
contentLbl
.
text
=
selectListArr
[
tempSelect
!
]
}
}
if
datasArr
.
count
>
0
{
}
switch
indexPath
.
row
{
if
indexPath
.
row
==
4
{
case
3
:
if
itemDanWeiSelect
!=
nil
{
cell
.
contentLbl
.
text
=
wenDu
cell
.
contentLbl
.
text
=
danWeiArr
!
[
itemDanWeiSelect
!
]
break
case
4
:
cell
.
contentLbl
.
text
=
danWei
break
default
:
break
}
}
}
return
cell
}
}
}
if
datasArr
.
count
>
0
{
switch
indexPath
.
row
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
case
3
:
cell
.
delegate
=
self
cell
.
contentLbl
.
text
=
wenDu
cell
.
namelbl
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
15
)
break
cell
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
case
4
:
if
indexPath
.
section
==
1
{
cell
.
contentLbl
.
text
=
danWei
cell
.
namelbl
.
text
=
"预售设置"
break
if
isYuShouSetting
==
false
{
default
:
isOpenYSSetting
=
isYuShouSetting
break
cell
.
namelbl
.
alpha
=
0.45
}
cell
.
isUserInteractionEnabled
=
false
}
else
{
cell
.
infoSw
.
isOn
=
isOpenYSSetting
}
}
cell
.
tag
=
5
return
cell
}
}
}
if
indexPath
.
section
==
1
{
if
isYuShouSetting
==
true
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"YuShou"
)
as!
YuShouCell
cell
.
delegate
=
self
cell
.
inputTF1
.
isUserInteractionEnabled
=
isAllEditing
cell
.
namelbl
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
15
)
cell
.
inputTF2
.
isUserInteractionEnabled
=
isAllEditing
cell
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
cell
.
inputTF2
.
keyboardType
=
.
numberPad
if
indexPath
.
section
==
1
{
cell
.
inputTF3
.
isUserInteractionEnabled
=
isAllEditing
cell
.
namelbl
.
text
=
"预售设置"
cell
.
tag
=
indexPath
.
row
if
isYuShouSetting
==
false
{
cell
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
isOpenYSSetting
=
isYuShouSetting
cell
.
infoSw
.
isOn
=
isOpenYSSetting
cell
.
namelbl
.
alpha
=
0.45
cell
.
delegate
=
self
cell
.
isUserInteractionEnabled
=
false
cell
.
inputTF1
.
text
=
yuShouPrice
}
else
{
cell
.
inputTF2
.
text
=
ysKuCun
cell
.
infoSw
.
isOn
=
isOpenYSSetting
cell
.
inputTF3
.
text
=
DJBiLi
return
cell
}
}
}
cell
.
tag
=
5
if
indexPath
.
section
==
2
{
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"PuTongJieTi"
)
as!
PuTongJieTiCell
cell
.
btn
.
isUserInteractionEnabled
=
isAllEditing
if
indexPath
.
section
==
1
{
cell
.
delegate
=
self
if
isYuShouSetting
==
true
{
cell
.
titleLbl
.
text
=
"
\(
indexPath
.
row
+
1
)
.数量≥"
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"YuShou"
)
as!
YuShouCell
cell
.
inputTF1
.
isUserInteractionEnabled
=
isAllEditing
cell
.
inputTF2
.
isUserInteractionEnabled
=
isAllEditing
cell
.
inputTF2
.
keyboardType
=
.
numberPad
cell
.
inputTF3
.
isUserInteractionEnabled
=
isAllEditing
cell
.
tag
=
indexPath
.
row
cell
.
tag
=
indexPath
.
row
cell
.
countTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
cell
.
priceTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
infoSw
.
isOn
=
isOpenYSSetting
cell
.
isYuShou
=
selectYuShou
cell
.
delegate
=
self
cell
.
countTF
.
text
=
""
cell
.
inputTF1
.
text
=
yuShouPrice
cell
.
priceTF
.
text
=
""
cell
.
inputTF2
.
text
=
ysKuCun
var
item
:
NSString
=
""
cell
.
inputTF3
.
text
=
DJBiLi
if
selectYuShou
{
item
=
specalArr
[
indexPath
.
row
]
as!
NSString
}
else
{
item
=
jieTiArr
[
indexPath
.
row
]
as!
NSString
}
if
item
!=
""
{
//MARK:--阶梯价格切割
let
arr
=
item
.
components
(
separatedBy
:
"_"
)
cell
.
priceTF
.
text
=
arr
[
0
]
cell
.
countTF
.
text
=
arr
[
1
]
}
return
cell
return
cell
}
}
if
indexPath
.
section
==
3
{
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"DelGuiGe"
)
as!
DelGuiGeCell
if
indexPath
.
section
==
2
{
return
cell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"PuTongJieTi"
)
as!
PuTongJieTiCell
cell
.
btn
.
isUserInteractionEnabled
=
isAllEditing
cell
.
delegate
=
self
cell
.
titleLbl
.
text
=
"
\(
indexPath
.
row
+
1
)
.数量≥"
cell
.
tag
=
indexPath
.
row
cell
.
countTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
priceTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
isYuShou
=
selectYuShou
cell
.
countTF
.
text
=
""
cell
.
priceTF
.
text
=
""
var
item
:
NSString
=
""
if
selectYuShou
{
item
=
specalArr
[
indexPath
.
row
]
as!
NSString
}
else
{
item
=
jieTiArr
[
indexPath
.
row
]
as!
NSString
}
}
if
item
!=
""
{
//MARK:--阶梯价格切割
let
arr
=
item
.
components
(
separatedBy
:
"_"
)
cell
.
priceTF
.
text
=
arr
[
0
]
cell
.
countTF
.
text
=
arr
[
1
]
}
return
cell
return
cell
}
if
indexPath
.
section
==
3
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"DelGuiGe"
)
as!
DelGuiGeCell
return
cell
}
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
return
cell
if
isAllEditing
==
false
{
return
}
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
indexPath
.
section
==
3
{
if
isAllEditing
==
false
{
//删除
return
datasArr
.
remove
(
at
:
selectIdx
!.
item
)
}
var
num
=
0
if
indexPath
.
section
==
3
{
if
selectIdx
!.
item
>
0
{
//删除
num
=
selectIdx
!.
item
-
1
datasArr
.
remove
(
at
:
selectIdx
!.
item
)
}
var
num
=
0
let
idx
=
IndexPath
(
item
:
num
,
section
:
0
)
if
selectIdx
!.
item
>
0
{
num
=
selectIdx
!.
item
-
1
delegate
?
.
CreatNewSpecsViewControllerDeleteAction
(
datas
:
datasArr
,
selectIdx
:
idx
)
}
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
let
idx
=
IndexPath
(
item
:
num
,
section
:
0
)
delegate
?
.
CreatNewSpecsViewControllerDeleteAction
(
datas
:
datasArr
,
selectIdx
:
idx
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
indexPath
.
section
==
1
{
if
isOpenYSSetting
{
return
184.5
}
}
}
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
indexPath
.
section
==
2
{
if
indexPath
.
section
==
1
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
if
isOpenYSSetting
{
return
49
return
184.5
}
}
}
if
indexPath
.
section
==
2
{
if
isYsJieTiOpen
&&
selectYuShou
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
return
49
return
49
}
if
isYsJieTiOpen
&&
selectYuShou
{
return
49
}
return
0.001
}
}
return
49
return
0.001
}
}
return
49
//header
}
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
let
view
=
UIView
()
//header
if
section
==
2
{
//阶梯价设置
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
if
isYuShouSetting
{
//预售阶梯价
let
view
=
UIView
()
let
view
=
TitleAndSwitchHeaderView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
90
))
if
section
==
2
{
//阶梯价设置
view
.
infoSW
.
isUserInteractionEnabled
=
isAllEditing
if
isYuShouSetting
{
//预售阶梯价
view
.
ysInfoSw
.
isUserInteractionEnabled
=
isAllEditing
let
view
=
TitleAndSwitchHeaderView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
90
))
view
.
delegate
=
self
view
.
infoSW
.
isUserInteractionEnabled
=
isAllEditing
view
.
selectYuShou
=
selectYuShou
view
.
ysInfoSw
.
isUserInteractionEnabled
=
isAllEditing
view
.
infoSW
.
isOn
=
isJieTiOpen
//普通
view
.
delegate
=
self
view
.
ysInfoSw
.
isOn
=
isYsJieTiOpen
//预售
view
.
selectYuShou
=
selectYuShou
return
view
view
.
infoSW
.
isOn
=
isJieTiOpen
//普通
}
else
{
//普通
view
.
ysInfoSw
.
isOn
=
isYsJieTiOpen
//预售
let
view
=
NewCreateHeader
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
return
view
view
.
delegate
=
self
}
else
{
//普通
view
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
let
view
=
NewCreateHeader
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
infoSw
.
isOn
=
isJieTiOpen
view
.
delegate
=
self
if
isJieTiOpen
==
false
{
view
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
return
view
view
.
infoSw
.
isOn
=
isJieTiOpen
}
if
isJieTiOpen
==
false
{
return
view
return
view
}
}
return
view
}
}
return
view
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
if
section
!=
0
{
if
section
==
2
{
if
isYuShouSetting
{
return
90
}
return
59
}
return
10
}
return
0.01
}
}
//footer
return
view
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
if
section
!=
0
{
if
section
==
2
{
if
section
==
2
{
if
barTitle
?
.
contains
(
"查看"
)
==
false
{
if
isYuShouSetting
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
return
90
let
view
=
NewCreateFooter
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
return
view
}
if
isYsJieTiOpen
&&
selectYuShou
{
let
view
=
NewCreateFooter
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
return
view
}
}
}
return
59
}
}
let
view
=
UIView
()
return
10
return
view
}
}
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
return
0.01
if
section
==
2
{
}
if
isJieTiOpen
&&
selectYuShou
==
false
{
//footer
return
49
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
if
section
==
2
{
if
barTitle
?
.
contains
(
"查看"
)
==
false
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
let
view
=
NewCreateFooter
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
return
view
}
}
if
isYsJieTiOpen
&&
selectYuShou
{
if
isYsJieTiOpen
&&
selectYuShou
{
return
49
let
view
=
NewCreateFooter
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
return
view
}
}
}
}
return
0.01
}
}
//MARK: - NEW CELL DELEGATE
let
view
=
UIView
()
return
view
func
YuShouCellTFContent
(
Price
:
NSString
)
{
}
let
arr
=
Price
.
components
(
separatedBy
:
"_"
)
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
yuShouPrice
=
arr
[
0
]
if
section
==
2
{
ysKuCun
=
arr
[
1
]
if
isJieTiOpen
&&
selectYuShou
==
false
{
DJBiLi
=
arr
[
2
]
return
49
}
func
textFieldContent
(
content
:
String
,
cell
:
TitleAndTFCell
)
{
switch
cell
.
tag
{
case
0
:
price
=
content
break
case
1
:
guiGe
=
content
break
default
:
weight
=
content
break
}
}
}
if
isYsJieTiOpen
&&
selectYuShou
{
func
GLAlertSelectViewClick
(
selectNum
:
Int
,
view
:
GLAlertSelectView
)
{
return
49
let
cell
=
listTbv
.
cellForRow
(
at
:
IndexPath
(
row
:
view
.
tag
,
section
:
0
))
as!
TitleAndBtnCell
if
view
.
tag
==
3
{
tempSelect
=
selectNum
wenDu
=
selectListArr
[
selectNum
]
cell
.
contentLbl
.
text
=
selectListArr
[
selectNum
]
}
else
{
itemDanWeiSelect
=
selectNum
cell
.
contentLbl
.
text
=
danWeiArr
!
[
selectNum
]
danWei
=
danWeiArr
!
[
selectNum
]
}
}
}
return
0.01
selectView
?
.
removeFromSuperview
()
}
selectView
=
nil
//MARK: - NEW CELL DELEGATE
func
YuShouCellTFContent
(
Price
:
NSString
)
{
let
arr
=
Price
.
components
(
separatedBy
:
"_"
)
yuShouPrice
=
arr
[
0
]
ysKuCun
=
arr
[
1
]
DJBiLi
=
arr
[
2
]
}
func
textFieldContent
(
content
:
String
,
cell
:
TitleAndTFCell
)
{
switch
cell
.
tag
{
case
0
:
price
=
content
break
case
1
:
guiGe
=
content
break
default
:
weight
=
content
break
}
}
func
GLAlertSelectViewClick
(
selectNum
:
Int
,
view
:
GLAlertSelectView
)
{
let
cell
=
listTbv
.
cellForRow
(
at
:
IndexPath
(
row
:
view
.
tag
,
section
:
0
))
as!
TitleAndBtnCell
if
view
.
tag
==
3
{
tempSelect
=
selectNum
wenDu
=
selectListArr
[
selectNum
]
cell
.
contentLbl
.
text
=
selectListArr
[
selectNum
]
}
else
{
itemDanWeiSelect
=
selectNum
cell
.
contentLbl
.
text
=
danWeiArr
!
[
selectNum
]
danWei
=
danWeiArr
!
[
selectNum
]
}
}
selectView
?
.
removeFromSuperview
()
selectView
=
nil
var
tempSelect
:
Int
?
}
var
itemDanWeiSelect
:
Int
?
func
btnClick
(
content
:
String
,
cell
:
TitleAndBtnCell
)
{
if
cell
.
tag
==
3
{
if
selectView
==
nil
{
var
tempSelect
:
Int
?
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
var
itemDanWeiSelect
:
Int
?
view
.
tag
=
cell
.
tag
view
.
titleLbl
.
text
=
"请选择商品温藏"
func
btnClick
(
content
:
String
,
cell
:
TitleAndBtnCell
)
{
view
.
delegate
=
self
if
cell
.
tag
==
3
{
view
.
dataArr
=
selectListArr
if
selectView
==
nil
{
if
tempSelect
!=
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
selectNum
=
tempSelect
!
view
.
tag
=
cell
.
tag
view
.
tempNum
=
view
.
selectNum
view
.
titleLbl
.
text
=
"请选择商品温藏"
}
view
.
delegate
=
self
self
.
view
.
addSubview
(
view
)
view
.
dataArr
=
selectListArr
selectView
=
view
if
tempSelect
!=
nil
{
view
.
selectNum
=
tempSelect
!
view
.
tempNum
=
view
.
selectNum
}
}
}
else
{
self
.
view
.
addSubview
(
view
)
if
selectView
==
nil
{
selectView
=
view
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
}
view
.
tag
=
cell
.
tag
}
else
{
view
.
titleLbl
.
text
=
"请选择商品单位"
if
selectView
==
nil
{
view
.
delegate
=
self
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
if
itemDanWeiSelect
!=
nil
{
view
.
tag
=
cell
.
tag
view
.
selectNum
=
itemDanWeiSelect
!
view
.
titleLbl
.
text
=
"请选择商品单位"
}
view
.
delegate
=
self
if
itemDanWeiSelect
!=
nil
{
if
danWeiArr
!=
nil
{
view
.
selectNum
=
itemDanWeiSelect
!
view
.
dataArr
=
danWeiArr
!
}
self
.
view
.
addSubview
(
view
)
selectView
=
view
}
}
}
if
danWeiArr
!=
nil
{
}
view
.
dataArr
=
danWeiArr
!
func
switchStatus
(
sender
:
UISwitch
)
{
//阶梯价设置
if
sender
.
tag
==
99
{
isYsJieTiOpen
=
sender
.
isOn
}
else
{
isJieTiOpen
=
sender
.
isOn
}
listTbv
.
reloadData
()
}
func
switchClick
(
content
:
UISwitch
,
cell
:
TitleAndSwitchCell
)
{
//控制
if
cell
.
tag
==
5
{
let
idxPath
=
IndexPath
(
row
:
0
,
section
:
1
)
if
isYuShouSetting
&&
isOpenYSSetting
{
//单独点击预售设置
listTbv
.
reloadData
()
}
else
{
//单独打开预售设置
listTbv
.
reloadRows
(
at
:
[
idxPath
],
with
:
.
none
)
}
}
self
.
view
.
addSubview
(
view
)
selectView
=
view
}
}
}
func
newCreateSwitchStatus
(
sender
:
UISwitch
)
{
//打开switch 阶梯价设置
// isJieTiJiaSetting = sender.isOn
isJieTiOpen
=
sender
.
isOn
listTbv
.
reloadData
()
}
}
func
footerClickAction
()
{
}
if
isAllEditing
==
false
{
return
func
switchStatus
(
sender
:
UISwitch
)
{
//阶梯价设置
}
if
sender
.
tag
==
99
{
print
(
jieTiArr
)
isYsJieTiOpen
=
sender
.
isOn
if
selectYuShou
{
//预售
}
else
{
specalArr
.
append
(
""
)
isJieTiOpen
=
sender
.
isOn
}
else
{
//非预售
jieTiArr
.
append
(
""
)
}
listTbv
.
reloadData
()
}
func
YuShouCellSwitchStatus
(
sender
:
UISwitch
)
{
//控制
// isYuShouSetting = sender.isOn
isOpenYSSetting
=
sender
.
isOn
listTbv
.
reloadData
()
}
}
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
{
listTbv
.
reloadData
()
if
selectYuShou
{
}
specalArr
.
remove
(
at
:
sender
.
tag
)
listTbv
.
reloadData
()
func
switchClick
(
content
:
UISwitch
,
cell
:
TitleAndSwitchCell
)
{
}
else
{
//控制
jieTiArr
.
remove
(
at
:
sender
.
tag
)
if
cell
.
tag
==
5
{
let
idxPath
=
IndexPath
(
row
:
0
,
section
:
1
)
if
isYuShouSetting
&&
isOpenYSSetting
{
//单独点击预售设置
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
else
{
//单独打开预售设置
listTbv
.
reloadRows
(
at
:
[
idxPath
],
with
:
.
none
)
}
}
}
func
PuTongJieTiContentSp
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
specalArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
specalArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
jieTiArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
jieTiArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
}
func
selectYuShou
(
sender
:
UIButton
)
{
}
if
sender
.
tag
==
0
{
func
newCreateSwitchStatus
(
sender
:
UISwitch
)
{
selectYuShou
=
false
//打开switch 阶梯价设置
}
else
{
// isJieTiJiaSetting = sender.isOn
selectYuShou
=
true
isJieTiOpen
=
sender
.
isOn
}
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
func
footerClickAction
()
{
if
isAllEditing
==
false
{
return
}
}
//MARK: - COLLECTIONVIEW DELEGATE
print
(
jieTiArr
)
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
minimumLineSpacingForSectionAt
section
:
Int
)
->
CGFloat
{
if
selectYuShou
{
//预售
return
0
specalArr
.
append
(
""
)
}
else
{
//非预售
jieTiArr
.
append
(
""
)
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
listTbv
.
reloadData
()
return
datasArr
.
count
}
func
YuShouCellSwitchStatus
(
sender
:
UISwitch
)
{
//控制
// isYuShouSetting = sender.isOn
isOpenYSSetting
=
sender
.
isOn
listTbv
.
reloadData
()
}
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
{
if
selectYuShou
{
specalArr
.
remove
(
at
:
sender
.
tag
)
listTbv
.
reloadData
()
}
else
{
jieTiArr
.
remove
(
at
:
sender
.
tag
)
listTbv
.
reloadData
()
}
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
}
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"ItemCell"
,
for
:
indexPath
)
func
PuTongJieTiContentSp
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
as!
ItemCell
specalArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
cell
.
tag
=
indexPath
.
item
specalArr
.
remove
(
at
:
cell
.
tag
+
1
)
cell
.
nameLbl
.
text
=
"规格"
+
"
\(
indexPath
.
item
+
1
)
"
}
if
indexPath
==
selectIdx
{
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
cell
.
lineView
.
isHidden
=
false
jieTiArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
}
else
{
jieTiArr
.
remove
(
at
:
cell
.
tag
+
1
)
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
cell
.
lineView
.
isHidden
=
true
}
}
return
cell
func
selectYuShou
(
sender
:
UIButton
)
{
if
sender
.
tag
==
0
{
}
selectYuShou
=
false
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
}
else
{
selectIdx
=
indexPath
selectYuShou
=
true
//刷新cell
let
dataDict
=
datasArr
[
selectIdx
!.
item
]
price
=
dataDict
.
price
guiGe
=
dataDict
.
guiGe
weight
=
dataDict
.
weight
wenDu
=
dataDict
.
wenDu
danWei
=
dataDict
.
danWei
yuShouPrice
=
dataDict
.
yuShouPrice
specalArr
=
dataDict
.
specalArr
jieTiArr
=
dataDict
.
jieTiArr
isJieTiOpen
=
dataDict
.
isJieTiOpen
isOpenYSSetting
=
dataDict
.
isOpenYSSetting
DJBiLi
=
dataDict
.
DJBiLi
isYsJieTiOpen
=
dataDict
.
isYsJieTiOpen
ysKuCun
=
dataDict
.
ysKuCun
selectYuShou
=
dataDict
.
selectYuShou
listTbv
.
reloadData
()
collectionView
.
reloadData
()
}
}
listTbv
.
reloadData
()
}
//MARK: - COLLECTIONVIEW DELEGATE
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
minimumLineSpacingForSectionAt
section
:
Int
)
->
CGFloat
{
return
0
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
return
datasArr
.
count
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"ItemCell"
,
for
:
indexPath
)
as!
ItemCell
cell
.
tag
=
indexPath
.
item
cell
.
nameLbl
.
text
=
"规格"
+
"
\(
indexPath
.
item
+
1
)
"
if
indexPath
==
selectIdx
{
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
cell
.
lineView
.
isHidden
=
false
}
else
{
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
cell
.
lineView
.
isHidden
=
true
}
return
cell
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
selectIdx
=
indexPath
//刷新cell
let
dataDict
=
datasArr
[
selectIdx
!.
item
]
price
=
dataDict
.
price
guiGe
=
dataDict
.
guiGe
weight
=
dataDict
.
weight
wenDu
=
dataDict
.
wenDu
danWei
=
dataDict
.
danWei
yuShouPrice
=
dataDict
.
yuShouPrice
specalArr
=
dataDict
.
specalArr
jieTiArr
=
dataDict
.
jieTiArr
isJieTiOpen
=
dataDict
.
isJieTiOpen
isOpenYSSetting
=
dataDict
.
isOpenYSSetting
DJBiLi
=
dataDict
.
DJBiLi
isYsJieTiOpen
=
dataDict
.
isYsJieTiOpen
ysKuCun
=
dataDict
.
ysKuCun
selectYuShou
=
dataDict
.
selectYuShou
listTbv
.
reloadData
()
collectionView
.
reloadData
()
}
}
}
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