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
00fc55b2
Commit
00fc55b2
authored
May 27, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复显示bug
parent
895a1aac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
432 additions
and
434 deletions
+432
-434
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/ViewController/商品详情/EPViewController.swift
...sinessPlatform/ViewController/商品详情/EPViewController.swift
+3
-2
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
...orm/ViewController/新增规格/CreatNewSpecsViewController.swift
+429
-432
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
00fc55b2
No preview for this file type
GeliBusinessPlatform/ViewController/商品详情/EPViewController.swift
View file @
00fc55b2
...
...
@@ -1266,7 +1266,7 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
vc
.
barTitle
=
"查看规格"
}
vc
.
datasArr
=
guiGeArr
print
(
"abbabab=== "
,
guiGeArr
.
count
,
selectIdx
?
.
item
)
vc
.
danWeiArr
=
generalInfoModel
?
.
data
?
.
unit
!
let
dataDict
:
GuiGeModel
!
if
selectIdx
?
.
item
!=
nil
{
...
...
@@ -1274,10 +1274,11 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}
else
{
dataDict
=
guiGeArr
.
first
}
print
(
"abbabab=== "
,
dataDict
.
price
)
vc
.
price
=
dataDict
.
price
vc
.
guiGe
=
dataDict
.
guiGe
vc
.
weight
=
dataDict
.
weight
print
(
"dabnwei === "
,
dataDict
.
danWei
)
vc
.
wenDu
=
dataDict
.
wenDu
vc
.
danWei
=
dataDict
.
danWei
vc
.
isJieTiOpen
=
dataDict
.
isJieTiOpen
...
...
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
View file @
00fc55b2
...
...
@@ -150,23 +150,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
HUD
.
flash
(
.
label
(
"请输入规格"
),
delay
:
1.2
)
return
}
// if weight.count == 0 {
// HUD.flash(.label("请输入重量"), delay: 1.2)
// return
// }
// if isPurnNumber(str: weight) == false {
// HUD.flash(.label("请输入正确的重量"), delay: 1.2)
// return
// }
// if wenDu.count == 0 {
// HUD.flash(.label("请选择温藏"), delay: 1.2)
// return
// }
// if danWei.count == 0 {
// HUD.flash(.label("请选择单位"), delay: 1.2)
// return
// }
if
isYuShouSetting
{
if
isPurnNumber
(
str
:
yuShouPrice
)
==
false
{
HUD
.
flash
(
.
label
(
"请输入正确的预售价格"
),
delay
:
1.2
)
...
...
@@ -262,479 +246,492 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
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
func
textFieldShouldReturn
(
_
textField
:
UITextField
)
->
Bool
{
switch
textField
.
tag
{
case
1
:
guiGe
=
textField
.
text
!
break
default
:
break
}
return
true
}
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
section
==
0
{
return
titleArray
.
count
func
PuTongJieTiClickDone
()
{
IQKeyboardManager
.
shared
.
resignFirstResponder
()
}
if
section
==
2
{
if
selectYuShou
{
//预售
return
specalArr
.
count
}
else
{
//非预售
return
jieTiArr
.
count
//MARK: - cell delegate
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
if
(
navbar
.
title
?
.
contains
(
"编辑"
))
!
{
return
4
}
else
{
return
3
}
}
return
1
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
indexPath
.
section
==
0
{
if
indexPath
.
row
<
3
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
cell
.
nameLbl
.
text
=
titleArray
[
indexPath
.
row
]
cell
.
textTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
tag
=
indexPath
.
row
cell
.
textTF
.
tag
=
cell
.
tag
//keyboardType
cell
.
textTF
.
returnKeyType
=
.
done
cell
.
textTF
.
delegate
=
self
if
indexPath
.
row
==
0
||
indexPath
.
row
==
2
{
cell
.
textTF
.
keyboardType
=
.
decimalPad
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
section
==
0
{
return
titleArray
.
count
}
if
section
==
2
{
if
selectYuShou
{
//预售
return
specalArr
.
count
}
else
{
//非预售
return
jieTiArr
.
count
}
let
str
=
NSAttributedString
(
string
:
pliceHolderArr
[
indexPath
.
row
],
attributes
:
[
NSAttributedString
.
Key
.
foregroundColor
:
UIColor
(
named
:
"灰色字体颜色"
)])
cell
.
textTF
.
attributedPlaceholder
=
str
if
datasArr
.
count
>
0
{
switch
indexPath
.
row
{
case
0
:
cell
.
textTF
.
text
=
price
break
case
1
:
cell
.
textTF
.
text
=
guiGe
break
default
:
cell
.
textTF
.
text
=
weight
break
}
return
1
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
indexPath
.
section
==
0
{
if
indexPath
.
row
<
3
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
cell
.
nameLbl
.
text
=
titleArray
[
indexPath
.
row
]
cell
.
textTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
tag
=
indexPath
.
row
cell
.
textTF
.
tag
=
cell
.
tag
//keyboardType
cell
.
textTF
.
returnKeyType
=
.
done
cell
.
textTF
.
delegate
=
self
if
indexPath
.
row
==
0
||
indexPath
.
row
==
2
{
cell
.
textTF
.
keyboardType
=
.
decimalPad
}
}
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
!
]
let
str
=
NSAttributedString
(
string
:
pliceHolderArr
[
indexPath
.
row
],
attributes
:
[
NSAttributedString
.
Key
.
foregroundColor
:
UIColor
(
named
:
"灰色字体颜色"
)])
cell
.
textTF
.
attributedPlaceholder
=
str
if
datasArr
.
count
>
0
{
switch
indexPath
.
row
{
case
0
:
cell
.
textTF
.
text
=
price
break
case
1
:
cell
.
textTF
.
text
=
guiGe
break
default
:
cell
.
textTF
.
text
=
weight
break
}
}
}
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
{
case
3
:
cell
.
contentLbl
.
text
=
wenDu
break
case
4
:
cell
.
contentLbl
.
text
=
danWei
break
default
:
break
if
indexPath
.
row
==
4
{
if
itemDanWeiSelect
!=
nil
{
cell
.
contentLbl
.
text
=
danWeiArr
!
[
itemDanWeiSelect
!
]
}
}
if
datasArr
.
count
>
0
{
switch
indexPath
.
row
{
case
3
:
if
wenDu
.
count
>
0
{
cell
.
contentLbl
.
text
=
wenDu
}
break
case
4
:
if
danWei
.
count
>
0
{
cell
.
contentLbl
.
text
=
danWei
}
break
default
:
break
}
}
return
cell
}
return
cell
}
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
cell
.
delegate
=
self
cell
.
namelbl
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
15
)
cell
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
if
indexPath
.
section
==
1
{
cell
.
namelbl
.
text
=
"预售设置"
if
isYuShouSetting
==
false
{
isOpenYSSetting
=
isYuShouSetting
cell
.
namelbl
.
alpha
=
0.45
cell
.
isUserInteractionEnabled
=
false
}
else
{
cell
.
infoSw
.
isOn
=
isOpenYSSetting
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
cell
.
delegate
=
self
cell
.
namelbl
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
15
)
cell
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
if
indexPath
.
section
==
1
{
cell
.
namelbl
.
text
=
"预售设置"
if
isYuShouSetting
==
false
{
isOpenYSSetting
=
isYuShouSetting
cell
.
namelbl
.
alpha
=
0.45
cell
.
isUserInteractionEnabled
=
false
}
else
{
cell
.
infoSw
.
isOn
=
isOpenYSSetting
}
cell
.
tag
=
5
}
cell
.
tag
=
5
}
if
indexPath
.
section
==
1
{
if
isYuShouSetting
==
true
{
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
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
cell
.
infoSw
.
isOn
=
isOpenYSSetting
if
indexPath
.
section
==
1
{
if
isYuShouSetting
==
true
{
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
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
cell
.
infoSw
.
isOn
=
isOpenYSSetting
cell
.
delegate
=
self
cell
.
inputTF1
.
text
=
yuShouPrice
cell
.
inputTF2
.
text
=
ysKuCun
cell
.
inputTF3
.
text
=
DJBiLi
return
cell
}
}
if
indexPath
.
section
==
2
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"PuTongJieTi"
)
as!
PuTongJieTiCell
cell
.
btn
.
isUserInteractionEnabled
=
isAllEditing
cell
.
delegate
=
self
cell
.
inputTF1
.
text
=
yuShouPrice
cell
.
inputTF2
.
text
=
ysKuCun
cell
.
inputTF3
.
text
=
DJBiLi
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
}
}
if
indexPath
.
section
==
2
{
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
]
if
indexPath
.
section
==
3
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"DelGuiGe"
)
as!
DelGuiGeCell
return
cell
}
return
cell
}
if
indexPath
.
section
==
3
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"DelGuiGe"
)
as!
DelGuiGeCell
return
cell
}
return
cell
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
isAllEditing
==
false
{
return
}
if
indexPath
.
section
==
3
{
//删除
datasArr
.
remove
(
at
:
selectIdx
!.
item
)
var
num
=
0
if
selectIdx
!.
item
>
0
{
num
=
selectIdx
!.
item
-
1
}
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
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
isAllEditing
==
false
{
return
}
if
indexPath
.
section
==
3
{
//删除
datasArr
.
remove
(
at
:
selectIdx
!.
item
)
var
num
=
0
if
selectIdx
!.
item
>
0
{
num
=
selectIdx
!.
item
-
1
}
let
idx
=
IndexPath
(
item
:
num
,
section
:
0
)
delegate
?
.
CreatNewSpecsViewControllerDeleteAction
(
datas
:
datasArr
,
selectIdx
:
idx
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
if
indexPath
.
section
==
2
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
return
49
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
indexPath
.
section
==
1
{
if
isOpenYSSetting
{
return
184.5
}
}
if
isYsJieTiOpen
&&
selectYuShou
{
return
49
if
indexPath
.
section
==
2
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
return
49
}
if
isYsJieTiOpen
&&
selectYuShou
{
return
49
}
return
0.001
}
return
0.001
return
49
}
return
49
}
//header
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
let
view
=
UIView
()
if
section
==
2
{
//阶梯价设置
if
isYuShouSetting
{
//预售阶梯价
let
view
=
TitleAndSwitchHeaderView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
90
))
view
.
infoSW
.
isUserInteractionEnabled
=
isAllEditing
view
.
ysInfoSw
.
isUserInteractionEnabled
=
isAllEditing
view
.
delegate
=
self
view
.
selectYuShou
=
selectYuShou
view
.
infoSW
.
isOn
=
isJieTiOpen
//普通
view
.
ysInfoSw
.
isOn
=
isYsJieTiOpen
//预售
return
view
}
else
{
//普通
let
view
=
NewCreateHeader
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
view
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
view
.
infoSw
.
isOn
=
isJieTiOpen
if
isJieTiOpen
==
false
{
//header
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
let
view
=
UIView
()
if
section
==
2
{
//阶梯价设置
if
isYuShouSetting
{
//预售阶梯价
let
view
=
TitleAndSwitchHeaderView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
90
))
view
.
infoSW
.
isUserInteractionEnabled
=
isAllEditing
view
.
ysInfoSw
.
isUserInteractionEnabled
=
isAllEditing
view
.
delegate
=
self
view
.
selectYuShou
=
selectYuShou
view
.
infoSW
.
isOn
=
isJieTiOpen
//普通
view
.
ysInfoSw
.
isOn
=
isYsJieTiOpen
//预售
return
view
}
else
{
//普通
let
view
=
NewCreateHeader
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
view
.
infoSw
.
isUserInteractionEnabled
=
isAllEditing
view
.
infoSw
.
isOn
=
isJieTiOpen
if
isJieTiOpen
==
false
{
return
view
}
return
view
}
return
view
}
return
view
}
return
view
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
if
section
!=
0
{
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
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
if
section
==
2
{
if
isYuShouSetting
{
return
90
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
{
let
view
=
NewCreateFooter
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
return
view
}
}
return
59
}
return
10
let
view
=
UIView
()
return
view
}
return
0.01
}
//footer
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
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
if
section
==
2
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
return
49
}
if
isYsJieTiOpen
&&
selectYuShou
{
let
view
=
NewCreateFooter
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
return
view
return
49
}
}
return
0.01
}
let
view
=
UIView
()
return
view
}
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
if
section
==
2
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
return
49
}
if
isYsJieTiOpen
&&
selectYuShou
{
return
49
//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
}
}
return
0.01
}
//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
]
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
}
selectView
?
.
removeFromSuperview
()
selectView
=
nil
}
var
tempSelect
:
Int
?
var
itemDanWeiSelect
:
Int
?
func
btnClick
(
content
:
String
,
cell
:
TitleAndBtnCell
)
{
if
cell
.
tag
==
3
{
if
selectView
==
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
tag
=
cell
.
tag
view
.
titleLbl
.
text
=
"请选择商品温藏"
view
.
delegate
=
self
view
.
dataArr
=
selectListArr
if
tempSelect
!=
nil
{
view
.
selectNum
=
tempSelect
!
view
.
tempNum
=
view
.
selectNum
}
self
.
view
.
addSubview
(
view
)
selectView
=
view
}
}
else
{
if
selectView
==
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
tag
=
cell
.
tag
view
.
titleLbl
.
text
=
"请选择商品单位"
view
.
delegate
=
self
if
itemDanWeiSelect
!=
nil
{
view
.
selectNum
=
itemDanWeiSelect
!
var
tempSelect
:
Int
?
var
itemDanWeiSelect
:
Int
?
func
btnClick
(
content
:
String
,
cell
:
TitleAndBtnCell
)
{
if
cell
.
tag
==
3
{
if
selectView
==
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
tag
=
cell
.
tag
view
.
titleLbl
.
text
=
"请选择商品温藏"
view
.
delegate
=
self
view
.
dataArr
=
selectListArr
for
i
in
0
..<
selectListArr
.
count
{
if
wenDu
==
selectListArr
[
i
]
{
tempSelect
=
i
}
}
if
tempSelect
!=
nil
{
view
.
selectNum
=
tempSelect
!
view
.
tempNum
=
view
.
selectNum
}
self
.
view
.
addSubview
(
view
)
selectView
=
view
}
if
danWeiArr
!=
nil
{
view
.
dataArr
=
danWeiArr
!
}
else
{
if
selectView
==
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
tag
=
cell
.
tag
view
.
titleLbl
.
text
=
"请选择商品单位"
view
.
delegate
=
self
if
danWeiArr
!=
nil
{
view
.
dataArr
=
danWeiArr
!
for
i
in
0
..<
danWeiArr
!.
count
{
if
danWei
==
danWeiArr
!
[
i
]
{
itemDanWeiSelect
=
i
}
}
}
if
itemDanWeiSelect
!=
nil
{
view
.
selectNum
=
itemDanWeiSelect
!
}
self
.
view
.
addSubview
(
view
)
selectView
=
view
}
self
.
view
.
addSubview
(
view
)
selectView
=
view
}
}
}
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
)
func
switchStatus
(
sender
:
UISwitch
)
{
//阶梯价设置
if
sender
.
tag
==
99
{
isYsJieTiOpen
=
sender
.
isOn
}
else
{
isJieTiOpen
=
sender
.
isOn
}
listTbv
.
reloadData
()
}
}
func
newCreateSwitchStatus
(
sender
:
UISwitch
)
{
//打开switch 阶梯价设置
// isJieTiJiaSetting = sender.isOn
isJieTiOpen
=
sender
.
isOn
listTbv
.
reloadData
()
}
func
footerClickAction
()
{
if
isAllEditing
==
false
{
return
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
)
}
}
}
print
(
jieTiArr
)
if
selectYuShou
{
//预售
specalArr
.
append
(
""
)
}
else
{
//非预售
jieTiArr
.
append
(
""
)
func
newCreateSwitchStatus
(
sender
:
UISwitch
)
{
//打开switch 阶梯价设置
// isJieTiJiaSetting = sender.isOn
isJieTiOpen
=
sender
.
isOn
listTbv
.
reloadData
(
)
}
listTbv
.
reloadData
()
}
func
YuShouCellSwitchStatus
(
sender
:
UISwitch
)
{
//控制
// isYuShouSetting = sender.isOn
isOpenYSSetting
=
sender
.
isOn
listTbv
.
reloadData
()
}
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
{
if
selectYuShou
{
specalArr
.
remove
(
at
:
sender
.
tag
)
func
footerClickAction
()
{
if
isAllEditing
==
false
{
return
}
print
(
jieTiArr
)
if
selectYuShou
{
//预售
specalArr
.
append
(
""
)
}
else
{
//非预售
jieTiArr
.
append
(
""
)
}
listTbv
.
reloadData
()
}
else
{
jieTiArr
.
remove
(
at
:
sender
.
tag
)
}
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
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
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
{
selectYuShou
=
false
}
else
{
selectYuShou
=
true
func
selectYuShou
(
sender
:
UIButton
)
{
if
sender
.
tag
==
0
{
selectYuShou
=
false
}
else
{
selectYuShou
=
true
}
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
}
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
()
}
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