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
9f3a4b1f
Commit
9f3a4b1f
authored
May 15, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字典修改成model
parent
42fea0c7
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
957 additions
and
785 deletions
+957
-785
GeliBusinessPlatform.xcodeproj/project.pbxproj
GeliBusinessPlatform.xcodeproj/project.pbxproj
+4
-0
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/View/Cell/AddImgCell.swift
GeliBusinessPlatform/View/Cell/AddImgCell.swift
+50
-24
GeliBusinessPlatform/View/Cell/YuShouWeiKuanFaHuoCell.swift
GeliBusinessPlatform/View/Cell/YuShouWeiKuanFaHuoCell.swift
+10
-4
GeliBusinessPlatform/ViewController/商品详情/EditProductViewController.swift
...tform/ViewController/商品详情/EditProductViewController.swift
+650
-650
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
...orm/ViewController/商品详情/ProductDetailViewController.swift
+160
-59
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
...orm/ViewController/新增规格/CreatNewSpecsViewController.swift
+47
-44
GeliBusinessPlatform/ViewController/新增规格/GuiGeModel.swift
GeliBusinessPlatform/ViewController/新增规格/GuiGeModel.swift
+33
-0
GeliBusinessPlatform/ViewController/新增规格/PuTongJieTiCell.swift
...usinessPlatform/ViewController/新增规格/PuTongJieTiCell.swift
+2
-3
GeliBusinessPlatform/ViewController/新增规格/YuShouCell.xib
GeliBusinessPlatform/ViewController/新增规格/YuShouCell.xib
+1
-1
No files found.
GeliBusinessPlatform.xcodeproj/project.pbxproj
View file @
9f3a4b1f
...
@@ -257,6 +257,7 @@
...
@@ -257,6 +257,7 @@
E0DDCB19244AE2AC00DF54C7
/* XiuGaiYuShouJiaViewController.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0DDCB17244AE2AC00DF54C7
/* XiuGaiYuShouJiaViewController.xib */
;
};
E0DDCB19244AE2AC00DF54C7
/* XiuGaiYuShouJiaViewController.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0DDCB17244AE2AC00DF54C7
/* XiuGaiYuShouJiaViewController.xib */
;
};
E0DDCB1D244AE81800DF54C7
/* GuanLianKeHuCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0DDCB1B244AE81800DF54C7
/* GuanLianKeHuCell.swift */
;
};
E0DDCB1D244AE81800DF54C7
/* GuanLianKeHuCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0DDCB1B244AE81800DF54C7
/* GuanLianKeHuCell.swift */
;
};
E0DDCB1E244AE81800DF54C7
/* GuanLianKeHuCell.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0DDCB1C244AE81800DF54C7
/* GuanLianKeHuCell.xib */
;
};
E0DDCB1E244AE81800DF54C7
/* GuanLianKeHuCell.xib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0DDCB1C244AE81800DF54C7
/* GuanLianKeHuCell.xib */
;
};
E0E8ABFD246E359700E3BB54
/* GuiGeModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0E8ABFC246E359700E3BB54
/* GuiGeModel.swift */
;
};
E0F1BE382469220D003015B2
/* RongSticker.bundle in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0F1BE2A24692208003015B2
/* RongSticker.bundle */
;
};
E0F1BE382469220D003015B2
/* RongSticker.bundle in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0F1BE2A24692208003015B2
/* RongSticker.bundle */
;
};
E0F1BE392469220D003015B2
/* RCColor.plist in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0F1BE2B24692208003015B2
/* RCColor.plist */
;
};
E0F1BE392469220D003015B2
/* RCColor.plist in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0F1BE2B24692208003015B2
/* RCColor.plist */
;
};
E0F1BE3A2469220D003015B2
/* libvo-amrwbenc.a in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0F1BE2C24692208003015B2
/* libvo-amrwbenc.a */
;
};
E0F1BE3A2469220D003015B2
/* libvo-amrwbenc.a in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
E0F1BE2C24692208003015B2
/* libvo-amrwbenc.a */
;
};
...
@@ -737,6 +738,7 @@
...
@@ -737,6 +738,7 @@
E0DDCB17244AE2AC00DF54C7
/* XiuGaiYuShouJiaViewController.xib */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.xib
;
path
=
XiuGaiYuShouJiaViewController.xib
;
sourceTree
=
"<group>"
;
};
E0DDCB17244AE2AC00DF54C7
/* XiuGaiYuShouJiaViewController.xib */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.xib
;
path
=
XiuGaiYuShouJiaViewController.xib
;
sourceTree
=
"<group>"
;
};
E0DDCB1B244AE81800DF54C7
/* GuanLianKeHuCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GuanLianKeHuCell.swift
;
sourceTree
=
"<group>"
;
};
E0DDCB1B244AE81800DF54C7
/* GuanLianKeHuCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GuanLianKeHuCell.swift
;
sourceTree
=
"<group>"
;
};
E0DDCB1C244AE81800DF54C7
/* GuanLianKeHuCell.xib */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.xib
;
path
=
GuanLianKeHuCell.xib
;
sourceTree
=
"<group>"
;
};
E0DDCB1C244AE81800DF54C7
/* GuanLianKeHuCell.xib */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.xib
;
path
=
GuanLianKeHuCell.xib
;
sourceTree
=
"<group>"
;
};
E0E8ABFC246E359700E3BB54
/* GuiGeModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GuiGeModel.swift
;
sourceTree
=
"<group>"
;
};
E0F1BE2A24692208003015B2
/* RongSticker.bundle */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"wrapper.plug-in"
;
path
=
RongSticker.bundle
;
sourceTree
=
"<group>"
;
};
E0F1BE2A24692208003015B2
/* RongSticker.bundle */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
"wrapper.plug-in"
;
path
=
RongSticker.bundle
;
sourceTree
=
"<group>"
;
};
E0F1BE2B24692208003015B2
/* RCColor.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
path
=
RCColor.plist
;
sourceTree
=
"<group>"
;
};
E0F1BE2B24692208003015B2
/* RCColor.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
path
=
RCColor.plist
;
sourceTree
=
"<group>"
;
};
E0F1BE2C24692208003015B2
/* libvo-amrwbenc.a */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
archive.ar
;
path
=
"libvo-amrwbenc.a"
;
sourceTree
=
"<group>"
;
};
E0F1BE2C24692208003015B2
/* libvo-amrwbenc.a */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
archive.ar
;
path
=
"libvo-amrwbenc.a"
;
sourceTree
=
"<group>"
;
};
...
@@ -1247,6 +1249,7 @@
...
@@ -1247,6 +1249,7 @@
E0336DD2244EC3CA00380BE9
/* 新增规格 */
=
{
E0336DD2244EC3CA00380BE9
/* 新增规格 */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
E0E8ABFC246E359700E3BB54
/* GuiGeModel.swift */
,
E0336DD3244EC40000380BE9
/* CreatNewSpecsViewController.swift */
,
E0336DD3244EC40000380BE9
/* CreatNewSpecsViewController.swift */
,
E0336DD4244EC40000380BE9
/* CreatNewSpecsViewController.xib */
,
E0336DD4244EC40000380BE9
/* CreatNewSpecsViewController.xib */
,
E0C4F4B3244EE9EE00CC7E2F
/* YuShouCell.swift */
,
E0C4F4B3244EE9EE00CC7E2F
/* YuShouCell.swift */
,
...
@@ -2656,6 +2659,7 @@
...
@@ -2656,6 +2659,7 @@
E09F4CA22452D18800BE033D
/* ZengZhiServicesViewController.swift in Sources */
,
E09F4CA22452D18800BE033D
/* ZengZhiServicesViewController.swift in Sources */
,
F94A315B24628C7E00FEC38E
/* WorkItemTableViewCell.swift in Sources */
,
F94A315B24628C7E00FEC38E
/* WorkItemTableViewCell.swift in Sources */
,
E0DDCB18244AE2AC00DF54C7
/* XiuGaiYuShouJiaViewController.swift in Sources */
,
E0DDCB18244AE2AC00DF54C7
/* XiuGaiYuShouJiaViewController.swift in Sources */
,
E0E8ABFD246E359700E3BB54
/* GuiGeModel.swift in Sources */
,
F950FDEA2451920200C40530
/* DIYCalendarCell.swift in Sources */
,
F950FDEA2451920200C40530
/* DIYCalendarCell.swift in Sources */
,
F950FDE224518B9500C40530
/* FSCalendarCalculator.m in Sources */
,
F950FDE224518B9500C40530
/* FSCalendarCalculator.m in Sources */
,
E0D197C12448431C002B080C
/* BabyToy.m in Sources */
,
E0D197C12448431C002B080C
/* BabyToy.m in Sources */
,
...
...
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
9f3a4b1f
No preview for this file type
GeliBusinessPlatform/View/Cell/AddImgCell.swift
View file @
9f3a4b1f
...
@@ -7,9 +7,10 @@
...
@@ -7,9 +7,10 @@
//
//
import
UIKit
import
UIKit
@objc
protocol
AddImgCellDelegate
{
protocol
AddImgCellDelegate
{
@objc
optional
func
AddImgCellBtnClick
(
cell
:
AddImgCell
)
func
AddImgCellBtnClick
(
cell
:
AddImgCell
)
@objc
optional
func
DelImgCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
func
DelImgCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
func
ChangeCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
}
}
class
AddImgCell
:
UITableViewCell
{
class
AddImgCell
:
UITableViewCell
{
var
delegate
:
AddImgCellDelegate
?
var
delegate
:
AddImgCellDelegate
?
...
@@ -20,26 +21,27 @@ class AddImgCell: UITableViewCell {
...
@@ -20,26 +21,27 @@ class AddImgCell: UITableViewCell {
}
}
}
}
@IBAction
func
btnClick
(
_
sender
:
Any
)
{
@IBAction
func
btnClick
(
_
sender
:
Any
)
{
delegate
?
.
AddImgCellBtnClick
?
(
cell
:
self
)
delegate
?
.
AddImgCellBtnClick
(
cell
:
self
)
}
}
var
isSingle
:
Bool
?
var
isSingle
:
Bool
?
var
imgs
:
NSArray
?
{
var
imgs
:
Array
<
UIImage
>
=
[]
{
didSet
{
didSet
{
if
imgs
!.
count
>
0
{
print
(
imgs
.
count
)
if
imgs
.
count
>
0
{
if
scrollView
==
nil
{
if
scrollView
==
nil
{
let
scrView
=
UIScrollView
(
frame
:
CGRect
(
x
:
0
,
y
:
nameLbl
.
frame
.
maxY
,
width
:
fullScreenWidth
,
height
:
self
.
bounds
.
size
.
height
-
nameLbl
.
frame
.
maxY
))
let
scrView
=
UIScrollView
(
frame
:
CGRect
(
x
:
addBtn
.
frame
.
minX
,
y
:
addBtn
.
frame
.
minY
,
width
:
fullScreenWidth
,
height
:
90
))
scrView
.
showsHorizontalScrollIndicator
=
false
scrView
.
showsHorizontalScrollIndicator
=
false
scrView
.
backgroundColor
=
UIColor
.
white
self
.
contentView
.
addSubview
(
scrView
)
self
.
contentView
.
addSubview
(
scrView
)
scrollView
=
scrView
scrollView
=
scrView
}
}
scrollView
?
.
isHidden
=
false
scrollView
?
.
isHidden
=
false
if
isSingle
==
true
{
if
isSingle
==
true
{
addBtn
.
isHidden
=
true
setImgUI
(
arr
:
imgs
)
setImgUI
(
arr
:
imgs
!
)
}
else
{
}
else
{
setImgUI
(
arr
:
imgs
!
)
setImgUI
(
arr
:
imgs
)
}
}
}
else
{
}
else
{
scrollView
?
.
isHidden
=
true
scrollView
?
.
isHidden
=
true
...
@@ -56,23 +58,24 @@ class AddImgCell: UITableViewCell {
...
@@ -56,23 +58,24 @@ class AddImgCell: UITableViewCell {
@IBOutlet
weak
var
nameLbl
:
UILabel
!
@IBOutlet
weak
var
nameLbl
:
UILabel
!
@IBOutlet
weak
var
addBtnX
:
NSLayoutConstraint
!
@IBOutlet
weak
var
addBtnX
:
NSLayoutConstraint
!
func
setImgUI
(
arr
:
NSArray
){
func
setImgUI
(
arr
:
Array
<
UIImage
>
){
let
y
=
nameLbl
.
frame
.
max
Y
let
y
=
addBtn
.
frame
.
min
Y
let
h
=
self
.
bounds
.
size
.
height
-
nameLbl
.
frame
.
maxY
let
h
:
CGFloat
=
90
if
isSingle
==
false
{
if
isSingle
==
false
{
addBtn
.
isHidden
=
false
addBtn
.
isHidden
=
false
scrollView
?
.
isHidden
=
false
scrollView
?
.
isHidden
=
false
if
arr
.
count
<
3
{
if
arr
.
count
<
3
{
scrollView
?
.
frame
=
CGRect
(
x
:
0
,
y
:
CGFloat
(
y
),
width
:
CGFloat
(
arr
.
count
)
*
110
,
height
:
h
)
scrollView
?
.
contentSize
=
CGSize
(
width
:
arr
.
count
*
105
,
height
:
0
)
addBtnX
.
constant
=
(
scrollView
?
.
frame
.
maxX
)
!+
10
scrollView
?
.
frame
=
CGRect
(
x
:
15
,
y
:
CGFloat
(
y
),
width
:
CGFloat
(
arr
.
count
)
*
105
,
height
:
h
)
addBtnX
.
constant
=
(
scrollView
?
.
frame
.
maxX
)
!
}
else
if
arr
.
count
==
5
{
}
else
if
arr
.
count
==
5
{
addBtn
.
isHidden
=
true
addBtn
.
isHidden
=
true
scrollView
?
.
contentSize
=
CGSize
(
width
:
arr
.
count
*
1
10
,
height
:
0
)
scrollView
?
.
contentSize
=
CGSize
(
width
:
arr
.
count
*
1
05
,
height
:
0
)
scrollView
?
.
frame
=
CGRect
(
x
:
0
,
y
:
CGFloat
(
y
),
width
:
fullScreenWidth
,
height
:
h
)
scrollView
?
.
frame
=
CGRect
(
x
:
15
,
y
:
CGFloat
(
y
),
width
:
fullScreenWidth
,
height
:
h
)
}
else
{
}
else
{
scrollView
?
.
contentSize
=
CGSize
(
width
:
arr
.
count
*
1
10
,
height
:
0
)
scrollView
?
.
contentSize
=
CGSize
(
width
:
arr
.
count
*
1
05
,
height
:
0
)
scrollView
?
.
frame
=
CGRect
(
x
:
0
,
y
:
CGFloat
(
y
),
width
:
fullScreenWidth
*
0.7
,
height
:
h
)
scrollView
?
.
frame
=
CGRect
(
x
:
15
,
y
:
CGFloat
(
y
),
width
:
fullScreenWidth
-
130
,
height
:
h
)
addBtnX
.
constant
=
(
scrollView
?
.
frame
.
maxX
)
!+
10
addBtnX
.
constant
=
fullScreenWidth
-
105
}
}
}
}
for
i
in
0
..<
arr
.
count
{
for
i
in
0
..<
arr
.
count
{
...
@@ -80,12 +83,31 @@ class AddImgCell: UITableViewCell {
...
@@ -80,12 +83,31 @@ class AddImgCell: UITableViewCell {
img
.
layer
.
cornerRadius
=
3
img
.
layer
.
cornerRadius
=
3
img
.
layer
.
masksToBounds
=
true
img
.
layer
.
masksToBounds
=
true
scrollView
!.
addSubview
(
img
)
scrollView
!.
addSubview
(
img
)
img
.
image
=
arr
[
i
]
as!
UIImage
img
.
image
=
arr
[
i
]
img
.
isUserInteractionEnabled
=
true
img
.
isUserInteractionEnabled
=
true
img
.
snp
.
makeConstraints
{
(
make
)
in
img
.
snp
.
makeConstraints
{
(
make
)
in
make
.
centerY
.
equalTo
(
scrollView
!.
snp_centerY
)
make
.
centerY
.
equalTo
(
scrollView
!.
snp_centerY
)
make
.
width
.
height
.
equalTo
(
90
)
make
.
width
.
height
.
equalTo
(
90
)
make
.
left
.
equalTo
(
15
+
105*
i
)
make
.
left
.
equalTo
(
105*
i
)
}
let
changeBtn
=
UIButton
()
changeBtn
.
tag
=
i
changeBtn
.
backgroundColor
=
UIColor
(
named
:
"标题字颜色"
)
changeBtn
.
alpha
=
0.5
changeBtn
.
addTarget
(
self
,
action
:
#selector(
changeAction(sender:)
)
,
for
:
.
touchUpInside
)
img
.
addSubview
(
changeBtn
)
changeBtn
.
snp
.
makeConstraints
{
(
make
)
in
make
.
top
.
bottom
.
right
.
left
.
equalTo
(
0
)
}
let
ti
=
UILabel
()
ti
.
text
=
"替 换"
ti
.
textColor
=
UIColor
.
white
ti
.
textAlignment
=
.
center
ti
.
font
=
UIFont
.
systemFont
(
ofSize
:
15
)
img
.
addSubview
(
ti
)
ti
.
snp
.
makeConstraints
{
(
make
)
in
make
.
top
.
bottom
.
right
.
left
.
equalTo
(
0
)
}
}
let
delImg
=
UIImageView
()
let
delImg
=
UIImageView
()
img
.
addSubview
(
delImg
)
img
.
addSubview
(
delImg
)
...
@@ -109,8 +131,12 @@ class AddImgCell: UITableViewCell {
...
@@ -109,8 +131,12 @@ class AddImgCell: UITableViewCell {
delBtn
.
addTarget
(
self
,
action
:
#selector(
delAction(sender:)
)
,
for
:
.
touchUpInside
)
delBtn
.
addTarget
(
self
,
action
:
#selector(
delAction(sender:)
)
,
for
:
.
touchUpInside
)
}
}
}
}
@objc
func
changeAction
(
sender
:
UIButton
){
delegate
?
.
ChangeCellBtnClick
(
sender
:
sender
,
cell
:
self
)
}
@objc
func
delAction
(
sender
:
UIButton
){
@objc
func
delAction
(
sender
:
UIButton
){
delegate
?
.
DelImgCellBtnClick
?(
sender
:
sender
,
cell
:
self
)
delegate
?
.
DelImgCellBtnClick
(
sender
:
sender
,
cell
:
self
)
}
}
override
func
awakeFromNib
()
{
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
super
.
awakeFromNib
()
...
...
GeliBusinessPlatform/View/Cell/YuShouWeiKuanFaHuoCell.swift
View file @
9f3a4b1f
...
@@ -7,19 +7,25 @@
...
@@ -7,19 +7,25 @@
//
//
import
UIKit
import
UIKit
protocol
YuShouWeiKuanFaHuoCellDelegate
{
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
}
class
YuShouWeiKuanFaHuoCell
:
UITableViewCell
{
class
YuShouWeiKuanFaHuoCell
:
UITableViewCell
{
var
delegate
:
YuShouWeiKuanFaHuoCellDelegate
?
@IBOutlet
weak
var
textTF
:
UITextField
!
@IBOutlet
weak
var
textTF
:
UITextField
!
@IBOutlet
weak
var
nameLbl
:
UILabel
!
@IBOutlet
weak
var
nameLbl
:
UILabel
!
override
func
awakeFromNib
()
{
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
super
.
awakeFromNib
()
self
.
selectionStyle
=
.
none
self
.
selectionStyle
=
.
none
textTF
.
addTarget
(
self
,
action
:
#selector(
textChange(tf:)
)
,
for
:
.
allEditingEvents
)
// Initialization code
// Initialization code
}
}
@objc
func
textChange
(
tf
:
UITextField
){
if
tf
.
text
!=
nil
{
delegate
?
.
YuShouWeiKuanFaHuoCellString
(
str
:
tf
.
text
!
)
}
}
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/商品详情/EditProductViewController.swift
View file @
9f3a4b1f
////
//// ProductDetailViewController.swift
//// GeliBusinessPlatform
////
//// Created by junye lu on 2020/4/23.
//// Copyright © 2020 junye lu. All rights reserved.
////
//
//
// ProductDetailViewController.swift
//import UIKit
// GeliBusinessPlatform
//import LGButton
//
//import Photos
// Created by junye lu on 2020/4/23.
//
// Copyright © 2020 junye lu. All rights reserved.
//class EditProductViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CommendCellDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate{
//
//
// var isEdit:Bool = false//是否编辑状态
import
UIKit
//
import
LGButton
// var selectIdx:IndexPath?
import
Photos
// var layout = UICollectionViewFlowLayout()
// var glSelectView:GLAlertSelectView?
class
EditProductViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
CommendCellDelegate
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
{
// let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
// let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
var
isEdit
:
Bool
=
false
//是否编辑状态
//
// let tishixxArr:NSMutableArray = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"]
var
selectIdx
:
IndexPath
?
// let tishixxArr1:NSMutableArray = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"]
var
layout
=
UICollectionViewFlowLayout
()
//
var
glSelectView
:
GLAlertSelectView
?
// let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"]
let
titleArr
=
[
"商品信息"
,
"商品图片"
,
"商品规格"
,
"预售设置"
,
"其它信息"
,
"商品详情"
]
// let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"]
let
spxxArr
=
[
"商品名称"
,
"商品类型"
,
"商品分类"
,
"品牌"
,
"起卖数量"
,
"是否清真"
,
"是否询价"
]
// let ysszArr = ["用户付款是否需要审核","预设预付定金时间段","预设预付尾款时间段","预设预付尾款发货时间"]
// let ysszHolder = ["0","请选择时段","请选择时段","0"]
let
tishixxArr
:
NSMutableArray
=
[
"请输入商品名称"
,
"请选择商品类型"
,
"请选择商品分类"
,
"请选择品牌"
,
"请输入起卖数量"
]
//
let
tishixxArr1
:
NSMutableArray
=
[
"请输入关键字"
,
"请输入物流费用"
,
"请选择国家"
,
"请选择商品状态"
,
"请选择运输方式"
]
//
// var itemTypeArr = NSMutableArray()
let
sptpArr
=
[
"商品封面图(限一张)"
,
"商品主图(限五张)"
]
//
let
qtxxArr
=
[
"关键字"
,
"物流费用"
,
"国家"
,
"商品状态"
,
"运输方式"
]
// var shangPinStatus:Int?
let
ysszArr
=
[
"用户付款是否需要审核"
,
"预设预付定金时间段"
,
"预设预付尾款时间段"
,
"预设预付尾款发货时间"
]
// var shangPinStatusArr = ["热销","爆款","新品","促销","外采","团购"]
let
ysszHolder
=
[
"0"
,
"请选择时段"
,
"请选择时段"
,
"0"
]
//
// var yunShuType:Int?
// var yunShuTypeArr = ["冷链","常温","热链"]
var
itemTypeArr
=
NSMutableArray
()
// //MARK:--保存按钮
// @IBOutlet weak var bottomView: UIView!
var
shangPinStatus
:
Int
?
//
var
shangPinStatusArr
=
[
"热销"
,
"爆款"
,
"新品"
,
"促销"
,
"外采"
,
"团购"
]
// @IBOutlet weak var listTbv: UITableView!
// var cellHeight = 18.5
var
yunShuType
:
Int
?
// var contentStr:String = ""
var
yunShuTypeArr
=
[
"冷链"
,
"常温"
,
"热链"
]
//
//MARK:--保存按钮
// var guiGeArr:NSMutableArray = []//根据规格资料数量控制右上角新增按钮是否显示
@IBOutlet
weak
var
bottomView
:
UIView
!
//
//
@IBOutlet
weak
var
listTbv
:
UITableView
!
//
var
cellHeight
=
18.5
// var isYuShouShangPin:Bool?
var
contentStr
:
String
=
""
//
// let btmTitleArr = ["编辑","入库","下架","删除"]
var
guiGeArr
:
NSMutableArray
=
[]
//根据规格资料数量控制右上角新增按钮是否显示
// @objc func bottomBtnClick(sender:UIButton){
//
// switch sender.titleLabel?.text {
// case "编辑":
var
isYuShouShangPin
:
Bool
?
// isEdit = true
// sender.setTitle("保存", for: .normal)
let
btmTitleArr
=
[
"编辑"
,
"入库"
,
"下架"
,
"删除"
]
// firstLbl!.text = "保存"
@objc
func
bottomBtnClick
(
sender
:
UIButton
){
// listTbv.reloadData()
// break
switch
sender
.
titleLabel
?
.
text
{
// case "保存":
case
"编辑"
:
// isEdit = false
isEdit
=
true
// sender.setTitle("编辑", for: .normal)
sender
.
setTitle
(
"保存"
,
for
:
.
normal
)
// firstLbl!.text = "编辑"
firstLbl
!.
text
=
"保存"
// listTbv.reloadData()
listTbv
.
reloadData
()
// break
break
// default:
case
"保存"
:
// break
isEdit
=
false
// }
sender
.
setTitle
(
"编辑"
,
for
:
.
normal
)
// }
firstLbl
!.
text
=
"编辑"
//
listTbv
.
reloadData
()
// var firstLbl:UILabel? = nil
break
// var generalInfoModel : GeneralInfoModel? = nil
default
:
// override func viewDidLoad() {
break
// super.viewDidLoad()
}
// //MARK:--获取新增商品的基本信息(品牌和分类等)
}
// HUD.flash(.progress)
// let UserToken = UserDefaults.standard.value(forKey: "user_token")
var
firstLbl
:
UILabel
?
=
nil
// GeneralInfo(["user_token":UserToken as Any], success: { (data) in
var
generalInfoModel
:
GeneralInfoModel
?
=
nil
// HUD.hide(animated: true)
override
func
viewDidLoad
()
{
// self.generalInfoModel = data as! GeneralInfoModel
super
.
viewDidLoad
()
//
//MARK:--获取新增商品的基本信息(品牌和分类等)
// }) { (error) in
HUD
.
flash
(
.
progress
)
//
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
// }
GeneralInfo
([
"user_token"
:
UserToken
as
Any
],
success
:
{
(
data
)
in
// isYuShouShangPin = true
HUD
.
hide
(
animated
:
true
)
//
self
.
generalInfoModel
=
data
as!
GeneralInfoModel
// navbar.title = "商品详情"
// self.view.addSubview(navbar)
})
{
(
error
)
in
// listTbv.separatorStyle = .none
// listTbv.snp.makeConstraints { (make) in
}
// make.top.equalTo(NavCGRect.height)
isYuShouShangPin
=
true
// make.left.right.equalTo(0)
// make.bottom.equalTo(bottomView.snp_top)
navbar
.
title
=
"商品详情"
// }
self
.
view
.
addSubview
(
navbar
)
//
listTbv
.
separatorStyle
=
.
none
// listTbv.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF")
listTbv
.
snp
.
makeConstraints
{
(
make
)
in
// listTbv.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitch")
make
.
top
.
equalTo
(
NavCGRect
.
height
)
// listTbv.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn")
make
.
left
.
right
.
equalTo
(
0
)
// listTbv.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImg")
make
.
bottom
.
equalTo
(
bottomView
.
snp_top
)
// listTbv.register(UINib(nibName: "AddGuiGeCell", bundle: nil), forCellReuseIdentifier: "AddGuiGe")
}
// listTbv.register(UINib(nibName: "CommendCell", bundle: nil), forCellReuseIdentifier: "Commend")
// listTbv.register(UINib(nibName: "YuShouWeiKuanFaHuoCell", bundle: nil), forCellReuseIdentifier: "YuShouWeiKuanFaHuoCell")
listTbv
.
register
(
UINib
(
nibName
:
"TitleAndTFCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndTF"
)
// listTbv.register(UINib(nibName: "ShangPinGguiGeCell", bundle: nil), forCellReuseIdentifier: "ShangPinGguiGeCell")
listTbv
.
register
(
UINib
(
nibName
:
"TitleAndSwitchCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndSwitch"
)
// // Do any additional setup after loading the view.
listTbv
.
register
(
UINib
(
nibName
:
"TitleAndBtnCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndBtn"
)
// let w = fullScreenWidth / CGFloat(btmTitleArr.count)
listTbv
.
register
(
UINib
(
nibName
:
"AddImgCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"AddImg"
)
// for i in 0 ..< btmTitleArr.count{
listTbv
.
register
(
UINib
(
nibName
:
"AddGuiGeCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"AddGuiGe"
)
// let btn = UIButton(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: bottomView.bounds.size.height))
listTbv
.
register
(
UINib
(
nibName
:
"CommendCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"Commend"
)
// btn.tag = i
listTbv
.
register
(
UINib
(
nibName
:
"YuShouWeiKuanFaHuoCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"YuShouWeiKuanFaHuoCell"
)
// btn.setTitle(btmTitleArr[i], for: .normal)
listTbv
.
register
(
UINib
(
nibName
:
"ShangPinGguiGeCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"ShangPinGguiGeCell"
)
// btn.titleLabel?.textColor = UIColor.clear
// Do any additional setup after loading the view.
// btn.addTarget(self, action: #selector(bottomBtnClick(sender:)), for: .touchUpInside)
let
w
=
fullScreenWidth
/
CGFloat
(
btmTitleArr
.
count
)
// let lbl = UILabel(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: 49*glscale))
for
i
in
0
..<
btmTitleArr
.
count
{
// lbl.textAlignment = .center
let
btn
=
UIButton
(
frame
:
CGRect
(
x
:
CGFloat
(
i
)
*
w
,
y
:
0
,
width
:
w
,
height
:
bottomView
.
bounds
.
size
.
height
))
// lbl.text = btmTitleArr[i]
btn
.
tag
=
i
// lbl.font = UIFont.systemFont(ofSize: 13)
btn
.
setTitle
(
btmTitleArr
[
i
],
for
:
.
normal
)
// lbl.textColor = UIColor(named: "蓝色字体颜色")
btn
.
titleLabel
?
.
textColor
=
UIColor
.
clear
// if i == 0 {
btn
.
addTarget
(
self
,
action
:
#selector(
bottomBtnClick(sender:)
)
,
for
:
.
touchUpInside
)
// firstLbl = lbl
let
lbl
=
UILabel
(
frame
:
CGRect
(
x
:
CGFloat
(
i
)
*
w
,
y
:
0
,
width
:
w
,
height
:
49*
glscale
))
// }
lbl
.
textAlignment
=
.
center
// bottomView.addSubview(btn)
lbl
.
text
=
btmTitleArr
[
i
]
// bottomView.addSubview(lbl)
lbl
.
font
=
UIFont
.
systemFont
(
ofSize
:
13
)
// }
lbl
.
textColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
// }
if
i
==
0
{
// //MARK: - cell delegate
firstLbl
=
lbl
// func numberOfSections(in tableView: UITableView) -> Int {
}
// return 6
bottomView
.
addSubview
(
btn
)
// }
bottomView
.
addSubview
(
lbl
)
// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
}
// switch section {
}
// case 0: return 7
//MARK: - cell delegate
// case 1:return 2
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
// case 2:return 1
return
6
// case 3:return 4
}
// case 4:return 5
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
// default:return 2
switch
section
{
// }
case
0
:
return
7
// }
case
1
:
return
2
//
case
2
:
return
1
// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
case
3
:
return
4
// switch indexPath.section {
case
4
:
return
5
// case 0:
default
:
return
2
// if indexPath.row == 0 || indexPath.row == 4 {
}
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
}
// cell.nameLbl.text = spxxArr[indexPath.row]
//
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
// cell.textTF.placeholder = tishixxArr[indexPath.row] as! String
switch
indexPath
.
section
{
// cell.textTF.isUserInteractionEnabled = isEdit
case
0
:
// return cell
if
indexPath
.
row
==
0
||
indexPath
.
row
==
4
{
// }
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
// if indexPath.row > 4{
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
// cell.delegate = self
cell
.
textTF
.
placeholder
=
tishixxArr
[
indexPath
.
row
]
as!
String
// cell.namelbl.text = spxxArr[indexPath.row]
cell
.
textTF
.
isUserInteractionEnabled
=
isEdit
// cell.infoSw.isUserInteractionEnabled = isEdit
return
cell
// return cell
}
// }
if
indexPath
.
row
>
4
{
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
// cell.nameLbl.text = spxxArr[indexPath.row]
cell
.
delegate
=
self
// cell.contentLbl.text = tishixxArr[indexPath.row] as! String
cell
.
namelbl
.
text
=
spxxArr
[
indexPath
.
row
]
// cell.tag = indexPath.row
cell
.
infoSw
.
isUserInteractionEnabled
=
isEdit
// cell.btn.isUserInteractionEnabled = isEdit
return
cell
// cell.delegate = self
}
// return cell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
// case 1:
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
// let cell = tableView.dequeueReusableCell(withIdentifier: "AddImg") as! AddImgCell
cell
.
contentLbl
.
text
=
tishixxArr
[
indexPath
.
row
]
as!
String
// cell.nameLbl.text = sptpArr[indexPath.row]
cell
.
tag
=
indexPath
.
row
// if indexPath.row == 0 {
cell
.
btn
.
isUserInteractionEnabled
=
isEdit
// cell.isSingle = true
cell
.
delegate
=
self
// cell.imgs = singleImgArr
return
cell
// }else{
case
1
:
// cell.isSingle = false
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AddImg"
)
as!
AddImgCell
// cell.imgs = maxFiveImgsArr
cell
.
nameLbl
.
text
=
sptpArr
[
indexPath
.
row
]
// }
if
indexPath
.
row
==
0
{
// cell.delegate = self
cell
.
isSingle
=
true
// cell.addBtn.tag = indexPath.row
cell
.
imgs
=
singleImgArr
// cell.isEdit = isEdit
}
else
{
// return cell
cell
.
isSingle
=
false
// case 2:
cell
.
imgs
=
maxFiveImgsArr
// if guiGeArr.count > 0 {
}
// let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell
cell
.
delegate
=
self
// cell.delegate = self
cell
.
addBtn
.
tag
=
indexPath
.
row
// var dict:NSDictionary!
cell
.
isEdit
=
isEdit
// if selectIdx != nil{
return
cell
// dict = guiGeArr[selectIdx!.item] as! NSDictionary
case
2
:
// }else{
if
guiGeArr
.
count
>
0
{
// dict = guiGeArr.firstObject as! NSDictionary
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"ShangPinGguiGeCell"
)
as!
ShangPinGguiGeCell
// }
cell
.
delegate
=
self
// cell.tempLbl.text = "冷藏:\(String(describing: dict["wenDu"]!))℃"
var
dict
:
NSDictionary
!
// cell.weightLbl.text = "重量(kg):\(String(describing: dict["weight"]!))kg"
if
selectIdx
!=
nil
{
// cell.guiGeLbl.text = "规格:\(String(describing: dict["guiGe"]!))kg/件"
dict
=
guiGeArr
[
selectIdx
!.
item
]
as!
NSDictionary
// cell.danWeiLbl.text = "单位:\(String(describing: dict["danWei"]!))"
}
else
{
// cell.sellPriceLbl.text = "售价:¥\(dict["price"]!)"
dict
=
guiGeArr
.
firstObject
as!
NSDictionary
// if isEdit{
}
// cell.btn.setTitle("编辑详情", for: .normal)
cell
.
tempLbl
.
text
=
"冷藏:
\(
String
(
describing
:
dict
[
"wenDu"
]
!
)
)
℃"
// }else{
cell
.
weightLbl
.
text
=
"重量(kg):
\(
String
(
describing
:
dict
[
"weight"
]
!
)
)
kg"
// cell.btn.setTitle("查看详情", for: .normal)
cell
.
guiGeLbl
.
text
=
"规格:
\(
String
(
describing
:
dict
[
"guiGe"
]
!
)
)
kg/件"
// }
cell
.
danWeiLbl
.
text
=
"单位:
\(
String
(
describing
:
dict
[
"danWei"
]
!
)
)
"
// return cell
cell
.
sellPriceLbl
.
text
=
"售价:¥
\(
dict
[
"price"
]
!
)
"
// }
if
isEdit
{
// let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
cell
.
btn
.
setTitle
(
"编辑详情"
,
for
:
.
normal
)
// cell.imgBtn.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
}
else
{
// cell.imgBtn.setImage(UIImage(named: "xinzeng"), for: .normal)
cell
.
btn
.
setTitle
(
"查看详情"
,
for
:
.
normal
)
// cell.imgBtn.isUserInteractionEnabled = isEdit
}
// return cell
return
cell
// case 3:
}
// if indexPath.row == 0 {
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AddGuiGe"
)
as!
AddGuiGeCell
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
cell
.
imgBtn
.
addTarget
(
self
,
action
:
#selector(
addGuiGe
)
,
for
:
.
touchUpInside
)
// cell.namelbl.text = ysszArr[indexPath.row]
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"xinzeng"
),
for
:
.
normal
)
// cell.delegate = self
cell
.
imgBtn
.
isUserInteractionEnabled
=
isEdit
// cell.infoSw.isUserInteractionEnabled = isEdit
return
cell
// return cell
case
3
:
// }
if
indexPath
.
row
==
0
{
// if indexPath.row == 3 {
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
// let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell
cell
.
namelbl
.
text
=
ysszArr
[
indexPath
.
row
]
// cell.nameLbl.text = ysszArr[indexPath.row]
cell
.
delegate
=
self
// cell.textTF.keyboardType = .numberPad
cell
.
infoSw
.
isUserInteractionEnabled
=
isEdit
// cell.textTF.isUserInteractionEnabled = isEdit
return
cell
// return cell
}
// }
if
indexPath
.
row
==
3
{
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"YuShouWeiKuanFaHuoCell"
)
as!
YuShouWeiKuanFaHuoCell
// cell.nameLbl.text = ysszArr[indexPath.row]
cell
.
nameLbl
.
text
=
ysszArr
[
indexPath
.
row
]
// cell.delegate = self
cell
.
textTF
.
keyboardType
=
.
numberPad
// cell.contentLbl.text = ysszHolder[indexPath.row]
cell
.
textTF
.
isUserInteractionEnabled
=
isEdit
// cell.btn.isUserInteractionEnabled = isEdit
return
cell
// return cell
}
// case 4:
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
// if indexPath.row < 2 {
cell
.
nameLbl
.
text
=
ysszArr
[
indexPath
.
row
]
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell
.
delegate
=
self
// cell.nameLbl.text = qtxxArr[indexPath.row]
cell
.
contentLbl
.
text
=
ysszHolder
[
indexPath
.
row
]
// cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String
cell
.
btn
.
isUserInteractionEnabled
=
isEdit
// cell.tag = indexPath.row
return
cell
// cell.textTF.isUserInteractionEnabled = isEdit
case
4
:
// return cell
if
indexPath
.
row
<
2
{
// }else{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell
.
nameLbl
.
text
=
qtxxArr
[
indexPath
.
row
]
// cell.nameLbl.text = qtxxArr[indexPath.row]
cell
.
textTF
.
placeholder
=
tishixxArr1
[
indexPath
.
row
]
as!
String
// cell.tag = indexPath.row
cell
.
tag
=
indexPath
.
row
// cell.contentLbl.text = tishixxArr1[indexPath.row] as! String
cell
.
textTF
.
isUserInteractionEnabled
=
isEdit
// cell.btn.isUserInteractionEnabled = isEdit
return
cell
// cell.delegate = self
}
else
{
// return cell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
// }
cell
.
nameLbl
.
text
=
qtxxArr
[
indexPath
.
row
]
// default:
cell
.
tag
=
indexPath
.
row
// if indexPath.row == 0 {
cell
.
contentLbl
.
text
=
tishixxArr1
[
indexPath
.
row
]
as!
String
// let cell = tableView.dequeueReusableCell(withIdentifier: "Commend") as! CommendCell
cell
.
btn
.
isUserInteractionEnabled
=
isEdit
// cell.delegate = self
cell
.
delegate
=
self
// cell.autoTf?.isUserInteractionEnabled = isEdit
return
cell
// return cell
}
// }else{
default
:
// let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
if
indexPath
.
row
==
0
{
// cell.imgBtn.setImage(UIImage(named: "tupian"), for: .normal)
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"Commend"
)
as!
CommendCell
// cell.delegate = self
cell
.
delegate
=
self
// cell.imgBtn.tag = indexPath.row
cell
.
autoTf
?
.
isUserInteractionEnabled
=
isEdit
// cell.imgBtn.isUserInteractionEnabled = isEdit
return
cell
// return cell
}
else
{
// }
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AddGuiGe"
)
as!
AddGuiGeCell
// }
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"tupian"
),
for
:
.
normal
)
// }
cell
.
delegate
=
self
//
cell
.
imgBtn
.
tag
=
indexPath
.
row
// func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
cell
.
imgBtn
.
isUserInteractionEnabled
=
isEdit
//
return
cell
// }
}
// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
}
// switch indexPath.section {
}
// case 0: return 49
// case 1:return 148.5
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
// case 2:
// if guiGeArr.count > 0 {
}
// return 146
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
// }
switch
indexPath
.
section
{
// return 123.5
case
0
:
return
49
// case 3:
case
1
:
return
148.5
// if isYuShouShangPin == false {
case
2
:
// return 0.01
if
guiGeArr
.
count
>
0
{
// }else{
return
146
// return 49
}
// }
return
123.5
// case 4:return 49
case
3
:
// default:
if
isYuShouShangPin
==
false
{
// if indexPath.row == 0 {
return
0.01
// return CGFloat(cellHeight)+27.5
}
else
{
// }else{
return
49
// return 155.5
}
// }
case
4
:
return
49
// }
default
:
// }
if
indexPath
.
row
==
0
{
// //header
return
CGFloat
(
cellHeight
)
+
27.5
// func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
}
else
{
// if section == 3 {
return
155.5
// if isYuShouShangPin == false {
}
// return UIView()
}
// }
}
// }
//header
// let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
// let lbl = UILabel(frame: CGRect(x: 15, y: 15, width: fullScreenWidth, height: 21))
if
section
==
3
{
// lbl.text = titleArr[section]
if
isYuShouShangPin
==
false
{
// lbl.textColor = UIColor(named: "标题字颜色")
return
UIView
()
// lbl.font = UIFont.boldSystemFont(ofSize: 15)
}
// view.addSubview(lbl)
}
// if section == 2 && guiGeArr.count > 0{
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
39
))
// let btn = UIButton()
let
lbl
=
UILabel
(
frame
:
CGRect
(
x
:
15
,
y
:
15
,
width
:
fullScreenWidth
,
height
:
21
))
// btn.setTitle(" 新增", for: .normal)
lbl
.
text
=
titleArr
[
section
]
// btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
lbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
// btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
lbl
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
15
)
// btn.setImage(UIImage(named: "jiahaoXG"), for: .normal)
view
.
addSubview
(
lbl
)
// view.addSubview(btn)
if
section
==
2
&&
guiGeArr
.
count
>
0
{
// btn.sizeToFit()
let
btn
=
UIButton
()
// btn.snp.makeConstraints { (make) in
btn
.
setTitle
(
" 新增"
,
for
:
.
normal
)
// make.centerY.equalTo(lbl.snp_centerY)
btn
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
13
)
// make.right.equalTo(-15)
btn
.
setTitleColor
(
UIColor
(
named
:
"蓝色字体颜色"
),
for
:
.
normal
)
// make.height.equalTo(btn.frame.size.height)
btn
.
setImage
(
UIImage
(
named
:
"jiahaoXG"
),
for
:
.
normal
)
// make.width.equalTo(btn.frame.size.width)
view
.
addSubview
(
btn
)
// }
btn
.
sizeToFit
()
// let btn2 = UIButton()
btn
.
snp
.
makeConstraints
{
(
make
)
in
// view.addSubview(btn2)
make
.
centerY
.
equalTo
(
lbl
.
snp_centerY
)
// btn2.snp.makeConstraints { (make) in
make
.
right
.
equalTo
(
-
15
)
// make.top.right.bottom.equalTo(0)
make
.
height
.
equalTo
(
btn
.
frame
.
size
.
height
)
// make.width.equalTo(80)
make
.
width
.
equalTo
(
btn
.
frame
.
size
.
width
)
// }
}
// btn2.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
let
btn2
=
UIButton
()
// if guiGeArr.count > 1 {
view
.
addSubview
(
btn2
)
// view.frame = CGRect(x: 0, y: 0, width: fullScreenWidth, height: 80)
btn2
.
snp
.
makeConstraints
{
(
make
)
in
// let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 0, height: 0), collectionViewLayout: layout)
make
.
top
.
right
.
bottom
.
equalTo
(
0
)
// collectionView.backgroundColor = UIColor.white
make
.
width
.
equalTo
(
80
)
// collectionView.delegate = self
}
// collectionView.dataSource = self
btn2
.
addTarget
(
self
,
action
:
#selector(
addGuiGe
)
,
for
:
.
touchUpInside
)
// view.addSubview(collectionView)
if
guiGeArr
.
count
>
1
{
// collectionView.snp.makeConstraints { (make) in
view
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
80
)
// make.bottom.left.right.equalTo(0)
let
collectionView
=
UICollectionView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
0
,
height
:
0
),
collectionViewLayout
:
layout
)
// make.height.equalTo(41)
collectionView
.
backgroundColor
=
UIColor
.
white
// }
collectionView
.
delegate
=
self
// collectionView.showsHorizontalScrollIndicator = false
collectionView
.
dataSource
=
self
// collectionView.isPagingEnabled = true
view
.
addSubview
(
collectionView
)
// layout.itemSize = CGSize(width: fullScreenWidth*0.5, height: 41)
collectionView
.
snp
.
makeConstraints
{
(
make
)
in
// layout.scrollDirection = .horizontal
make
.
bottom
.
left
.
right
.
equalTo
(
0
)
// collectionView.collectionViewLayout = layout
make
.
height
.
equalTo
(
41
)
// collectionView.register(UINib(nibName: "ItemCell", bundle: nil), forCellWithReuseIdentifier: "ItemCell")
}
// collectionView.selectItem(at:selectIdx, animated: false, scrollPosition: .left)
collectionView
.
showsHorizontalScrollIndicator
=
false
// }
collectionView
.
isPagingEnabled
=
true
// }
layout
.
itemSize
=
CGSize
(
width
:
fullScreenWidth
*
0.5
,
height
:
41
)
// return view
layout
.
scrollDirection
=
.
horizontal
// }
collectionView
.
collectionViewLayout
=
layout
// func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
collectionView
.
register
(
UINib
(
nibName
:
"ItemCell"
,
bundle
:
nil
),
forCellWithReuseIdentifier
:
"ItemCell"
)
// if section == 3 {
collectionView
.
selectItem
(
at
:
selectIdx
,
animated
:
false
,
scrollPosition
:
.
left
)
// if isYuShouShangPin == false {
}
// return 0.001
}
// }
return
view
// }
}
// if section == 2 {
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
// if guiGeArr.count > 1 {
if
section
==
3
{
// return 80
if
isYuShouShangPin
==
false
{
// }
return
0.001
// }
}
// return 39
}
// }
if
section
==
2
{
// //footer
if
guiGeArr
.
count
>
1
{
// func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return
80
// let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10))
}
// view.backgroundColor = UIColor(named: "app底色")
}
// return view
return
39
// }
}
// func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
//footer
// if section == 3 {
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
// if isYuShouShangPin == false {
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
10
))
// return 0.001
view
.
backgroundColor
=
UIColor
(
named
:
"app底色"
)
// }
return
view
// }
}
// return 10
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
// }
if
section
==
3
{
// //MARK: - 自定义delegate
if
isYuShouShangPin
==
false
{
// func CommendCellSendH(height: CGFloat) {
return
0.001
// cellHeight = Double(height)
}
// listTbv.beginUpdates()
}
// listTbv.endUpdates()
return
10
// }
}
// func CommendCellSendStr(content: String) {
//MARK: - 自定义delegate
// print("CommendCellSendStr")
func
CommendCellSendH
(
height
:
CGFloat
)
{
// }
cellHeight
=
Double
(
height
)
// override func backAction() {
listTbv
.
beginUpdates
()
// self.navigationController?.popViewController(animated: true)
listTbv
.
endUpdates
()
// }
}
// //MARK: -- 选择填或跳转
func
CommendCellSendStr
(
content
:
String
)
{
//
print
(
"CommendCellSendStr"
)
//
}
//
override
func
backAction
()
{
// func btnClick(content: String, cell: TitleAndBtnCell) {
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
// if cell.nameLbl.text == "商品类型" {
}
// if glSelectView == nil {
//MARK: -- 选择填或跳转
// let view = GLAlertSelectView(frame: self.view.bounds)
// view.tag = cell.tag
// view.isMultipleS = true
// view.titleLbl.text = "请选择商品类型"
func
btnClick
(
content
:
String
,
cell
:
TitleAndBtnCell
)
{
// view.delegate = self
if
cell
.
nameLbl
.
text
==
"商品类型"
{
// view.dataArr = ["预售","普通","期货","团购"]
if
glSelectView
==
nil
{
// if itemTypeArr.count == 0 {
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
// for _ in view.dataArr {
view
.
tag
=
cell
.
tag
// itemTypeArr.add("99")
view
.
isMultipleS
=
true
// }
view
.
titleLbl
.
text
=
"请选择商品类型"
// }
view
.
delegate
=
self
// view.selectArray = itemTypeArr
view
.
dataArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
// self.view.addSubview(view)
if
itemTypeArr
.
count
==
0
{
// glSelectView = view
for
_
in
view
.
dataArr
{
// }
itemTypeArr
.
add
(
"99"
)
// }
}
// if cell.nameLbl.text == "商品分类" {
}
// let vc = GoodsClassViewController()
view
.
selectArray
=
itemTypeArr
// vc.delegate = self
self
.
view
.
addSubview
(
view
)
// vc.dataModelArray = generalInfoModel?.data?.cats
glSelectView
=
view
// self.navigationController?.pushViewController(vc, animated: true)
}
// }
}
// if cell.nameLbl.text == "品牌" {
if
cell
.
nameLbl
.
text
==
"商品分类"
{
// let vc = PinPaiListViewController()
let
vc
=
GoodsClassViewController
()
// vc.isSelectData = true
vc
.
delegate
=
self
// vc.delegate = self
vc
.
dataModelArray
=
generalInfoModel
?
.
data
?
.
cats
// vc.dataModelArray = generalInfoModel?.data?.brand
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
// self.navigationController?.pushViewController(vc, animated: true)
}
// }
if
cell
.
nameLbl
.
text
==
"品牌"
{
// if cell.nameLbl.text == "国家" {
let
vc
=
PinPaiListViewController
()
//
vc
.
isSelectData
=
true
// }
vc
.
delegate
=
self
// if cell.nameLbl.text == "商品状态" {
vc
.
dataModelArray
=
generalInfoModel
?
.
data
?
.
brand
// let view = GLAlertSelectView(frame: self.view.bounds)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
// view.tag = cell.tag
}
// view.titleLbl.text = "请选择商品类型"
if
cell
.
nameLbl
.
text
==
"国家"
{
// view.delegate = self
// view.dataArr = shangPinStatusArr
}
// view.selectNum = shangPinStatus!
if
cell
.
nameLbl
.
text
==
"商品状态"
{
// self.view.addSubview(view)
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
// glSelectView = view
view
.
tag
=
cell
.
tag
// }
view
.
titleLbl
.
text
=
"请选择商品类型"
// if cell.nameLbl.text == "运输方式" {
view
.
delegate
=
self
// let view = GLAlertSelectView(frame: self.view.bounds)
view
.
dataArr
=
shangPinStatusArr
// view.tag = cell.tag
view
.
selectNum
=
shangPinStatus
!
// view.titleLbl.text = "请选择运输方式"
self
.
view
.
addSubview
(
view
)
// view.delegate = self
glSelectView
=
view
// view.dataArr = yunShuTypeArr
}
// view.selectNum = yunShuType!
if
cell
.
nameLbl
.
text
==
"运输方式"
{
// self.view.addSubview(view)
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
// glSelectView = view
view
.
tag
=
cell
.
tag
// }
view
.
titleLbl
.
text
=
"请选择运输方式"
// if cell.nameLbl.text == "预设预付定金时间段" {
view
.
delegate
=
self
//
view
.
dataArr
=
yunShuTypeArr
// }
view
.
selectNum
=
yunShuType
!
// if cell.nameLbl.text == "预设预付尾款时间段" {
self
.
view
.
addSubview
(
view
)
//
glSelectView
=
view
// }
}
// print(cell.nameLbl.text)
if
cell
.
nameLbl
.
text
==
"预设预付定金时间段"
{
// }
// //MARK:---选择商品分类返回数据
}
// func blackGoodsClass(sender: GoodsClassModel) {
if
cell
.
nameLbl
.
text
==
"预设预付尾款时间段"
{
// print("选择商品分类返回数据=\(sender)")
// }
}
// //MARK:--选择品牌返回的数据
print
(
cell
.
nameLbl
.
text
)
// func blackSelectPinPaiData(sender: GeneralInfoBrandModel) {
}
// print("选择品牌返回的数据=\(sender)")
//MARK:---选择商品分类返回数据
//
func
blackGoodsClass
(
sender
:
GoodsClassModel
)
{
// }
print
(
"选择商品分类返回数据=
\(
sender
)
"
)
//
}
// func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
//MARK:--选择品牌返回的数据
// print("单选",selectNum)
func
blackSelectPinPaiData
(
sender
:
GeneralInfoBrandModel
)
{
// print(view.titleLbl.text)
print
(
"选择品牌返回的数据=
\(
sender
)
"
)
// switch view.titleLbl.text {
// case "请选择商品类型":
}
// shangPinStatus = selectNum
// tishixxArr1.replaceObject(at: view.tag, with: shangPinStatusArr[selectNum])
func
GLAlertSelectViewClick
(
selectNum
:
Int
,
view
:
GLAlertSelectView
)
{
// break
print
(
"单选"
,
selectNum
)
// case "请选择运输方式":
print
(
view
.
titleLbl
.
text
)
// yunShuType = selectNum
switch
view
.
titleLbl
.
text
{
// tishixxArr1.replaceObject(at: view.tag, with: yunShuTypeArr[selectNum])
case
"请选择商品类型"
:
// break
shangPinStatus
=
selectNum
// default:
tishixxArr1
.
replaceObject
(
at
:
view
.
tag
,
with
:
shangPinStatusArr
[
selectNum
])
// break
break
// }
case
"请选择运输方式"
:
// glSelectView?.removeFromSuperview()
yunShuType
=
selectNum
// glSelectView = nil
tishixxArr1
.
replaceObject
(
at
:
view
.
tag
,
with
:
yunShuTypeArr
[
selectNum
])
// listTbv.reloadData()
break
// }
default
:
// var isYuShou:Bool = false
break
//
}
// func GLAlertMoreSelectViewClick(sender: NSArray, view:UIView) {
glSelectView
?
.
removeFromSuperview
()
// print("多选",sender)
glSelectView
=
nil
// itemTypeArr = sender as! NSMutableArray
listTbv
.
reloadData
()
// let str = "\(sender.firstObject!)" as! NSString
}
// if str != "99" {
var
isYuShou
:
Bool
=
false
// isYuShou = true
// }else{
func
GLAlertMoreSelectViewClick
(
sender
:
NSArray
,
view
:
UIView
)
{
// isYuShou = false
print
(
"多选"
,
sender
)
// }
itemTypeArr
=
sender
as!
NSMutableArray
// let contentArr = ["预售","普通","期货","团购"]
let
str
=
"
\(
sender
.
firstObject
!
)
"
as!
NSString
// let titles = NSMutableArray()
if
str
!=
"99"
{
// titles.removeAllObjects()
isYuShou
=
true
// for num in itemTypeArr {
}
else
{
// let str = "\(num)" as! NSString
isYuShou
=
false
// if str != "99"{
}
// titles.add(contentArr[str.integerValue])
let
contentArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
// }
let
titles
=
NSMutableArray
()
// }
titles
.
removeAllObjects
()
// tishixxArr.replaceObject(at: view.tag, with: titles.componentsJoined(by: ","))
for
num
in
itemTypeArr
{
//
let
str
=
"
\(
num
)
"
as!
NSString
// if itemTypeArr.componentsJoined(by: "_") == "99_99_99_99" {
if
str
!=
"99"
{
// tishixxArr.replaceObject(at: view.tag, with:"请选择商品类型")
titles
.
add
(
contentArr
[
str
.
integerValue
])
// }
}
//
}
// glSelectView?.removeFromSuperview()
tishixxArr
.
replaceObject
(
at
:
view
.
tag
,
with
:
titles
.
componentsJoined
(
by
:
","
))
// glSelectView = nil
// listTbv.reloadData()
if
itemTypeArr
.
componentsJoined
(
by
:
"_"
)
==
"99_99_99_99"
{
// }
tishixxArr
.
replaceObject
(
at
:
view
.
tag
,
with
:
"请选择商品类型"
)
// func GLAlertSelectViewClose(sender: UIButton) {
}
// glSelectView?.removeFromSuperview()
// glSelectView = nil
glSelectView
?
.
removeFromSuperview
()
// }
glSelectView
=
nil
// var maxFiveImgsArr = NSMutableArray()
listTbv
.
reloadData
()
// var singleImgArr = NSMutableArray()
}
// func DelImgCellBtnClick(sender: UIButton, cell: AddImgCell) {
func
GLAlertSelectViewClose
(
sender
:
UIButton
)
{
// if cell.isSingle == true {
glSelectView
?
.
removeFromSuperview
()
// singleImgArr.removeObject(at: sender.tag)
glSelectView
=
nil
// listTbv.reloadData()
}
// }else{
var
maxFiveImgsArr
=
NSMutableArray
()
// maxFiveImgsArr.removeObject(at: sender.tag)
var
singleImgArr
=
NSMutableArray
()
// listTbv.reloadData()
func
DelImgCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
// }
if
cell
.
isSingle
==
true
{
//
singleImgArr
.
removeObject
(
at
:
sender
.
tag
)
// }
listTbv
.
reloadData
()
// func AddImgCellBtnClick(cell: AddImgCell) {
}
else
{
// if cell.addBtn.tag == 0 {//仅一张
maxFiveImgsArr
.
removeObject
(
at
:
sender
.
tag
)
// _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
listTbv
.
reloadData
()
// //结果处理
}
// print("共选择了\(assets.count)张图片,分别如下:")
// let option = PHImageRequestOptions()
}
// option.isSynchronous = true
func
AddImgCellBtnClick
(
cell
:
AddImgCell
)
{
// option.isNetworkAccessAllowed = true
if
cell
.
addBtn
.
tag
==
0
{
//仅一张
// for asset in assets {
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
//结果处理
// // print("上传图片==\(image)")
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
// self.singleImgArr.add(image)
let
option
=
PHImageRequestOptions
()
// })
option
.
isSynchronous
=
true
// }
option
.
isNetworkAccessAllowed
=
true
// cell.imgs = self.singleImgArr
for
asset
in
assets
{
// }
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// }else{//可多张
// print("上传图片==\(image)")
// _ = self.presentHGImagePicker(maxSelected:5) { (assets) in
self
.
singleImgArr
.
add
(
image
)
// //结果处理
})
// print("共选择了\(assets.count)张图片,分别如下:")
}
// let option = PHImageRequestOptions()
cell
.
imgs
=
self
.
singleImgArr
// option.isSynchronous = true
}
// option.isNetworkAccessAllowed = true
}
else
{
//可多张
// for asset in assets {
_
=
self
.
presentHGImagePicker
(
maxSelected
:
5
)
{
(
assets
)
in
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
//结果处理
// // print("上传图片==\(image)")
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
// self.maxFiveImgsArr.add(image)
let
option
=
PHImageRequestOptions
()
// })
option
.
isSynchronous
=
true
// }
option
.
isNetworkAccessAllowed
=
true
// cell.imgs = self.maxFiveImgsArr
for
asset
in
assets
{
// }
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// }
// print("上传图片==\(image)")
// }
self
.
maxFiveImgsArr
.
add
(
image
)
// func ShangPinGguiGeCellEditAction(cell: ShangPinGguiGeCell) {
})
// let vc = CreatNewSpecsViewController()
}
// vc.barTitle = "编辑规格"
cell
.
imgs
=
self
.
maxFiveImgsArr
// vc.datasArr = guiGeArr
}
// let dataDict:NSDictionary!
}
// if selectIdx?.item != nil {
}
// dataDict = guiGeArr[selectIdx!.item] as! NSDictionary
func
ShangPinGguiGeCellEditAction
(
cell
:
ShangPinGguiGeCell
)
{
// }else{
let
vc
=
CreatNewSpecsViewController
()
// dataDict = guiGeArr.firstObject as! NSDictionary
vc
.
barTitle
=
"编辑规格"
// }
vc
.
datasArr
=
guiGeArr
//
let
dataDict
:
NSDictionary
!
// vc.price = dataDict["price"] as! String
if
selectIdx
?
.
item
!=
nil
{
// vc.guiGe = dataDict["guiGe"] as! String
dataDict
=
guiGeArr
[
selectIdx
!.
item
]
as!
NSDictionary
// vc.weight = dataDict["weight"] as! String
}
else
{
// vc.wenDu = dataDict["wenDu"] as! String
dataDict
=
guiGeArr
.
firstObject
as!
NSDictionary
// vc.danWei = dataDict["danWei"] as! String
}
// let arr = dataDict["jieTiArr"] as! NSMutableArray
// let arr2 = dataDict["specalArr"] as! NSMutableArray
vc
.
price
=
dataDict
[
"price"
]
as!
String
// vc.isNonYuShou = dataDict["isNonYuShou"] as! Bool
vc
.
guiGe
=
dataDict
[
"guiGe"
]
as!
String
// vc.isYuShouSetting = dataDict["isYuShouSetting"] as! Bool
vc
.
weight
=
dataDict
[
"weight"
]
as!
String
// vc.yuShouPrice = dataDict["yuShouPrice"] as! String
vc
.
wenDu
=
dataDict
[
"wenDu"
]
as!
String
// vc.specalArr = arr2
vc
.
danWei
=
dataDict
[
"danWei"
]
as!
String
// vc.jieTiArr = arr
let
arr
=
dataDict
[
"jieTiArr"
]
as!
NSMutableArray
// if selectIdx == nil {
let
arr2
=
dataDict
[
"specalArr"
]
as!
NSMutableArray
// vc.selectIdx = IndexPath(item: 0, section: 0)
vc
.
isNonYuShou
=
dataDict
[
"isNonYuShou"
]
as!
Bool
// }else{
vc
.
isYuShouSetting
=
dataDict
[
"isYuShouSetting"
]
as!
Bool
// vc.selectIdx = selectIdx
vc
.
yuShouPrice
=
dataDict
[
"yuShouPrice"
]
as!
String
// }
vc
.
specalArr
=
arr2
// print(vc.selectIdx?.item)
vc
.
jieTiArr
=
arr
// vc.delegate = self
if
selectIdx
==
nil
{
// self.navigationController?.pushViewController(vc, animated: true)
vc
.
selectIdx
=
IndexPath
(
item
:
0
,
section
:
0
)
// }
}
else
{
//
vc
.
selectIdx
=
selectIdx
// func CreatNewSpecsViewControllerDeleteAction() {
}
// print("删除数据")
print
(
vc
.
selectIdx
?
.
item
)
// }
vc
.
delegate
=
self
// func AddGuiGeCellClick(cell: AddGuiGeCell) {
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
// //
}
// print("商品详情添加图片")
// }
func
CreatNewSpecsViewControllerDeleteAction
()
{
// @objc func addGuiGe(){
print
(
"删除数据"
)
// print("新增规格")
}
// let vc = CreatNewSpecsViewController()
func
AddGuiGeCellClick
(
cell
:
AddGuiGeCell
)
{
// vc.barTitle = "新增规格"
//
// vc.delegate = self
print
(
"商品详情添加图片"
)
// print("abc == ",isYuShou)
}
// vc.isYuShouSetting = isYuShou
@objc
func
addGuiGe
(){
// vc.isNonYuShou = isYuShou
print
(
"新增规格"
)
// vc.datasArr = guiGeArr
let
vc
=
CreatNewSpecsViewController
()
// self.navigationController?.pushViewController(vc, animated: true)
vc
.
barTitle
=
"新增规格"
// }
vc
.
delegate
=
self
// @objc func addImageAction(sender:UIButton){
print
(
"abc == "
,
isYuShou
)
// print(sender.tag)
vc
.
isYuShouSetting
=
isYuShou
// }
vc
.
isNonYuShou
=
isYuShou
//
vc
.
datasArr
=
guiGeArr
// func CreatNewSpecsViewControllerSaveAction(datas: NSMutableArray) {
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
// guiGeArr = datas
}
// listTbv.reloadData()
@objc
func
addImageAction
(
sender
:
UIButton
){
// }
print
(
sender
.
tag
)
//
}
// //MARK: - COLLECTIONVIEW DELEGATE
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
func
CreatNewSpecsViewControllerSaveAction
(
datas
:
NSMutableArray
)
{
// return 0
guiGeArr
=
datas
// }
listTbv
.
reloadData
()
// func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
}
// return guiGeArr.count
// }
//MARK: - COLLECTIONVIEW DELEGATE
//
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
minimumLineSpacingForSectionAt
section
:
Int
)
->
CGFloat
{
// func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
return
0
// let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath)
}
// as! ItemCell
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
// cell.tag = indexPath.row
return
guiGeArr
.
count
// if selectIdx == nil {
}
// selectIdx = IndexPath(item: 0, section: 0)
// }
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
// if indexPath == selectIdx {
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"ItemCell"
,
for
:
indexPath
)
// cell.nameLbl.textColor = UIColor(named: "蓝色字体颜色")
as!
ItemCell
// cell.lineView.isHidden = false
cell
.
tag
=
indexPath
.
row
// }else{
if
selectIdx
==
nil
{
// cell.nameLbl.textColor = UIColor(named: "标题字颜色")
selectIdx
=
IndexPath
(
item
:
0
,
section
:
0
)
// cell.lineView.isHidden = true
}
// }
if
indexPath
==
selectIdx
{
// return cell
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
//
cell
.
lineView
.
isHidden
=
false
// }
}
else
{
// func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
// selectIdx = indexPath
cell
.
lineView
.
isHidden
=
true
// //刷新cell
}
// print("selectItem",selectIdx?.item)
return
cell
// listTbv.reloadData()
// collectionView.reloadData()
}
// }
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
//}
selectIdx
=
indexPath
//刷新cell
print
(
"selectItem"
,
selectIdx
?
.
item
)
listTbv
.
reloadData
()
collectionView
.
reloadData
()
}
}
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
View file @
9f3a4b1f
...
@@ -10,8 +10,7 @@ import UIKit
...
@@ -10,8 +10,7 @@ import UIKit
import
LGButton
import
LGButton
import
Photos
import
Photos
class
ProductDetailViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
,
TitleAndTFCellDelegate
{
class
ProductDetailViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
,
TitleAndTFCellDelegate
,
YuShouWeiKuanFaHuoCellDelegate
{
let
titleArr
=
[
"商品信息"
,
"商品图片"
,
"商品规格"
,
"预售设置"
,
"其它信息"
,
"商品详情"
]
let
titleArr
=
[
"商品信息"
,
"商品图片"
,
"商品规格"
,
"预售设置"
,
"其它信息"
,
"商品详情"
]
let
spxxArr
=
[
"商品名称"
,
"商品类型"
,
"商品分类"
,
"品牌"
,
"起卖数量"
,
"是否清真"
,
"是否询价"
]
let
spxxArr
=
[
"商品名称"
,
"商品类型"
,
"商品分类"
,
"品牌"
,
"起卖数量"
,
"是否清真"
,
"是否询价"
]
...
@@ -23,7 +22,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -23,7 +22,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let
ysszHolder
=
[
"0"
,
"请选择时段"
,
"请选择时段"
,
"0"
]
let
ysszHolder
=
[
"0"
,
"请选择时段"
,
"请选择时段"
,
"0"
]
var
shangPinStatusArr
=
[
"热销"
,
"爆款"
,
"新品"
,
"促销"
,
"外采"
,
"团购"
]
var
shangPinStatusArr
=
[
"热销"
,
"爆款"
,
"新品"
,
"促销"
,
"外采"
,
"团购"
]
var
yunShuTypeArr
=
[
"冷链"
,
"常温"
,
"热链"
]
var
yunShuTypeArr
=
[
"冷链"
,
"常温"
,
"热链"
]
var
countryArr
=
[
"中国"
]
var
layout
=
UICollectionViewFlowLayout
()
var
layout
=
UICollectionViewFlowLayout
()
var
glSelectView
:
GLAlertSelectView
?
var
glSelectView
:
GLAlertSelectView
?
...
@@ -35,31 +34,34 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -35,31 +34,34 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
var
isYuShou
:
Bool
=
false
//是否预售
var
isYuShou
:
Bool
=
false
//是否预售
var
shangPinStatus
:
Int
?
//商品状态
var
shangPinStatus
:
Int
?
//商品状态
var
yunShuType
:
Int
?
//运输类型
var
yunShuType
:
Int
?
//运输类型
var
maxFiveImgsArr
=
NSMutableArray
()
//多图
var
maxFiveImgsArr
:
Array
<
UIImage
>
=
[]
//多图
var
singleImgArr
=
NSMutableArray
()
//单张图
var
singleImgArr
:
Array
<
UIImage
>
=
[]
//单张图
var
itemName
=
""
//商品名称
var
itemName
=
""
//商品名称
var
qiMaiShuLiang
=
""
//起卖数量
var
qiMaiShuLiang
=
""
//起卖数量
var
shiFouQZ
=
false
//是否清真
var
shiFouQZ
=
false
//是否清真
var
shiFouXJ
=
false
//是否询价
var
shiFouXJ
=
false
//是否询价
var
keyWord
=
""
//关键字
var
keyWord
=
""
//关键字
var
wuLiuPrice
=
""
//物流费用
var
wuLiuPrice
=
""
//物流费用
var
guiGeArr
:
NSMutableArray
=
[]
//规格数组,根据规格资料数量控制右上角新增按钮是否显示
var
countrySelect
:
Int
?
//选择国家
var
guiGeArr
:
Array
<
GuiGeModel
>
=
[]
//规格数组,根据规格资料数量控制右上角新增按钮是否显示
var
shiFouSH
=
false
//是否审核
var
faHuoTime
=
""
//发货时间
//MARK:--保存按钮
//MARK:--保存按钮
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
print
(
"保存按钮submitAction"
)
print
(
"保存按钮submitAction"
)
print
(
itemName
)
//商品名称
//
print(itemName)//商品名称
print
(
itemTypeArr
)
//商品类型
//
print(itemTypeArr)//商品类型
print
(
qiMaiShuLiang
)
//起卖数量
//
print(qiMaiShuLiang)//起卖数量
print
(
shiFouQZ
)
//是否清真
//
print(shiFouQZ)//是否清真
print
(
shiFouXJ
)
//是否询价
//
print(shiFouXJ)//是否询价
print
(
singleImgArr
.
firstObject
)
//商品封面图
// print(singleImgArr[0]
)//商品封面图
print
(
maxFiveImgsArr
)
//商品主图
//
print(maxFiveImgsArr)//商品主图
print
(
guiGeArr
)
//商品规格
//
print(guiGeArr)//商品规格
print
(
keyWord
)
//关键字
//
print(keyWord)//关键字
print
(
wuLiuPrice
)
//物流费用
//
print(wuLiuPrice)//物流费用
print
(
shangPinStatusArr
[
shangPinStatus
!
])
//商品状态
//
print(shangPinStatusArr[shangPinStatus!])//商品状态
print
(
yunShuTypeArr
[
yunShuType
!
])
//运输方式
//
print(yunShuTypeArr[yunShuType!])//运输方式
// print(countryArr[countrySelect!])//选择国家
}
}
@IBOutlet
weak
var
submitBtn
:
LGButton
!
@IBOutlet
weak
var
submitBtn
:
LGButton
!
@IBOutlet
weak
var
listTbv
:
UITableView
!
@IBOutlet
weak
var
listTbv
:
UITableView
!
...
@@ -80,7 +82,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -80,7 +82,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
//是否为预售商品
//是否为预售商品
isYuShouShangPin
=
fals
e
isYuShouShangPin
=
tru
e
navbar
.
title
=
"商品详情"
navbar
.
title
=
"商品详情"
self
.
view
.
addSubview
(
navbar
)
self
.
view
.
addSubview
(
navbar
)
...
@@ -107,22 +109,42 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -107,22 +109,42 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if
indexPath
.
row
==
0
||
indexPath
.
row
==
4
{
if
indexPath
.
row
==
0
||
indexPath
.
row
==
4
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
//商家名称
switch
cell
.
nameLbl
.
text
{
case
"商家名称"
:
cell
.
textTF
.
text
=
itemName
break
case
"起卖数量"
:
cell
.
textTF
.
text
=
qiMaiShuLiang
break
default
:
break
}
cell
.
textTF
.
placeholder
=
tishixxArr
[
indexPath
.
row
]
as!
String
cell
.
textTF
.
placeholder
=
tishixxArr
[
indexPath
.
row
]
as!
String
cell
.
delegate
=
self
cell
.
delegate
=
self
return
cell
return
cell
}
}
if
indexPath
.
row
>
4
{
if
indexPath
.
row
>
4
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
cell
.
delegate
=
self
cell
.
namelbl
.
text
=
spxxArr
[
indexPath
.
row
]
cell
.
namelbl
.
text
=
spxxArr
[
indexPath
.
row
]
cell
.
delegate
=
self
switch
cell
.
namelbl
.
text
{
case
"是否清真"
:
cell
.
infoSw
.
isOn
=
shiFouQZ
break
case
"是否询价"
:
cell
.
infoSw
.
isOn
=
shiFouXJ
break
default
:
break
}
return
cell
return
cell
}
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
cell
.
contentLbl
.
text
=
tishixxArr
[
indexPath
.
row
]
as!
String
cell
.
contentLbl
.
text
=
tishixxArr
[
indexPath
.
row
]
as!
String
cell
.
tag
=
indexPath
.
row
cell
.
tag
=
indexPath
.
row
cell
.
delegate
=
self
cell
.
delegate
=
self
return
cell
return
cell
case
1
:
case
1
:
...
@@ -130,10 +152,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -130,10 +152,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
cell
.
nameLbl
.
text
=
sptpArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
sptpArr
[
indexPath
.
row
]
if
indexPath
.
row
==
0
{
if
indexPath
.
row
==
0
{
cell
.
isSingle
=
true
cell
.
isSingle
=
true
if
singleImgArr
.
count
>
0
{
cell
.
imgs
=
singleImgArr
cell
.
imgs
=
singleImgArr
cell
.
addBtn
.
isHidden
=
true
}
else
{
cell
.
scrollView
?
.
isHidden
=
true
cell
.
addBtn
.
isHidden
=
false
}
}
else
{
}
else
{
cell
.
isSingle
=
false
cell
.
isSingle
=
false
if
maxFiveImgsArr
.
count
>
0
{
cell
.
imgs
=
maxFiveImgsArr
cell
.
imgs
=
maxFiveImgsArr
}
else
{
cell
.
scrollView
?
.
isHidden
=
true
cell
.
addBtnX
.
constant
=
15
}
}
}
cell
.
delegate
=
self
cell
.
delegate
=
self
cell
.
addBtn
.
tag
=
indexPath
.
row
cell
.
addBtn
.
tag
=
indexPath
.
row
...
@@ -143,18 +176,19 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -143,18 +176,19 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if
guiGeArr
.
count
>
0
{
if
guiGeArr
.
count
>
0
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"ShangPinGguiGeCell"
)
as!
ShangPinGguiGeCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"ShangPinGguiGeCell"
)
as!
ShangPinGguiGeCell
cell
.
delegate
=
self
cell
.
delegate
=
self
var
dict
:
NSDictionary
!
var
dict
:
GuiGeModel
!
if
selectIdx
!=
nil
{
if
selectIdx
!=
nil
{
dict
=
guiGeArr
[
selectIdx
!.
item
]
as!
NSDictionary
dict
=
guiGeArr
[
selectIdx
!.
item
]
as!
GuiGeModel
}
else
{
}
else
{
dict
=
guiGeArr
.
firstObject
as!
NSDictionary
dict
=
guiGeArr
.
first
as!
GuiGeModel
}
}
cell
.
tempLbl
.
text
=
"冷藏:
\(
String
(
describing
:
dict
[
"wenDu"
]
!
)
)
℃"
cell
.
tempLbl
.
text
=
"冷藏:
\(
dict
.
wenDu
)
℃"
cell
.
weightLbl
.
text
=
"重量(kg):
\(
String
(
describing
:
dict
[
"weight"
]
!
)
)
kg"
cell
.
weightLbl
.
text
=
"重量(kg):
\(
dict
.
weight
)
kg"
cell
.
guiGeLbl
.
text
=
"规格:
\(
String
(
describing
:
dict
[
"guiGe"
]
!
)
)
kg/件"
cell
.
guiGeLbl
.
text
=
"规格:
\(
dict
.
guiGe
)
kg/件"
cell
.
danWeiLbl
.
text
=
"单位:
\(
String
(
describing
:
dict
[
"danWei"
]
!
)
)
"
cell
.
danWeiLbl
.
text
=
"单位:
\(
dict
.
danWei
)
"
cell
.
sellPriceLbl
.
text
=
"售价:¥
\(
dict
[
"price"
]
!
)
"
cell
.
sellPriceLbl
.
text
=
"售价:¥
\(
dict
.
price
)
"
return
cell
return
cell
}
}
...
@@ -168,13 +202,15 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -168,13 +202,15 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
cell
.
namelbl
.
text
=
ysszArr
[
indexPath
.
row
]
cell
.
namelbl
.
text
=
ysszArr
[
indexPath
.
row
]
cell
.
delegate
=
self
cell
.
delegate
=
self
cell
.
infoSw
.
isOn
=
shiFouSH
return
cell
return
cell
}
}
if
indexPath
.
row
==
3
{
if
indexPath
.
row
==
3
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"YuShouWeiKuanFaHuoCell"
)
as!
YuShouWeiKuanFaHuoCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"YuShouWeiKuanFaHuoCell"
)
as!
YuShouWeiKuanFaHuoCell
cell
.
nameLbl
.
text
=
ysszArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
ysszArr
[
indexPath
.
row
]
cell
.
textTF
.
keyboardType
=
.
numberPad
cell
.
textTF
.
keyboardType
=
.
numberPad
cell
.
delegate
=
self
cell
.
textTF
.
text
=
faHuoTime
return
cell
return
cell
}
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
...
@@ -186,6 +222,16 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -186,6 +222,16 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if
indexPath
.
row
<
2
{
if
indexPath
.
row
<
2
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
cell
.
nameLbl
.
text
=
qtxxArr
[
indexPath
.
row
]
cell
.
nameLbl
.
text
=
qtxxArr
[
indexPath
.
row
]
switch
cell
.
nameLbl
.
text
{
case
"关键字"
:
cell
.
textTF
.
text
=
keyWord
break
case
"物流费用"
:
cell
.
textTF
.
text
=
wuLiuPrice
break
default
:
break
}
cell
.
textTF
.
placeholder
=
tishixxArr1
[
indexPath
.
row
]
as!
String
cell
.
textTF
.
placeholder
=
tishixxArr1
[
indexPath
.
row
]
as!
String
cell
.
tag
=
indexPath
.
row
cell
.
tag
=
indexPath
.
row
cell
.
delegate
=
self
cell
.
delegate
=
self
...
@@ -250,7 +296,18 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -250,7 +296,18 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
if
cell
.
nameLbl
.
text
==
"国家"
{
if
cell
.
nameLbl
.
text
==
"国家"
{
print
(
"选择国家"
)
if
glSelectView
==
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
tag
=
cell
.
tag
view
.
titleLbl
.
text
=
"请选择国家"
view
.
delegate
=
self
view
.
dataArr
=
countryArr
if
countrySelect
!=
nil
{
view
.
selectNum
=
countrySelect
!
}
self
.
view
.
addSubview
(
view
)
glSelectView
=
view
}
}
}
if
cell
.
nameLbl
.
text
==
"商品状态"
{
if
cell
.
nameLbl
.
text
==
"商品状态"
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
...
@@ -304,13 +361,51 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -304,13 +361,51 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
for
asset
in
assets
{
for
asset
in
assets
{
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
// print("上传图片==\(image)")
self
.
singleImgArr
.
add
(
image
)
self
.
singleImgArr
.
append
(
image
!
)
})
}
self
.
listTbv
.
reloadData
()
}
}
else
{
//可多张
let
num
=
5
-
maxFiveImgsArr
.
count
_
=
self
.
presentHGImagePicker
(
maxSelected
:
num
)
{
(
assets
)
in
//结果处理
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
let
option
=
PHImageRequestOptions
()
option
.
isSynchronous
=
true
option
.
isNetworkAccessAllowed
=
true
for
asset
in
assets
{
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
self
.
maxFiveImgsArr
.
append
(
image
!
)
})
}
self
.
listTbv
.
reloadData
()
}
}
}
//MARK: - 修改图片
func
ChangeCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
print
(
sender
.
tag
)
if
cell
.
addBtn
.
tag
==
0
{
//仅一张
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
//结果处理
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
let
option
=
PHImageRequestOptions
()
option
.
isSynchronous
=
true
option
.
isNetworkAccessAllowed
=
true
for
asset
in
assets
{
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
self
.
singleImgArr
.
removeAll
()
self
.
singleImgArr
.
append
(
image
!
)
})
})
}
}
cell
.
imgs
=
self
.
singleImgArr
self
.
listTbv
.
reloadData
()
}
}
}
else
{
//可多张
}
else
{
//可多张
_
=
self
.
presentHGImagePicker
(
maxSelected
:
5
)
{
(
assets
)
in
let
num
=
5
-
maxFiveImgsArr
.
count
_
=
self
.
presentHGImagePicker
(
maxSelected
:
num
)
{
(
assets
)
in
//结果处理
//结果处理
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
let
option
=
PHImageRequestOptions
()
let
option
=
PHImageRequestOptions
()
...
@@ -319,20 +414,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -319,20 +414,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
for
asset
in
assets
{
for
asset
in
assets
{
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
// print("上传图片==\(image)")
self
.
maxFiveImgsArr
.
add
(
image
)
self
.
maxFiveImgsArr
.
insert
(
image
!
,
at
:
sender
.
tag
)
self
.
maxFiveImgsArr
.
remove
(
at
:
sender
.
tag
+
1
)
})
})
}
}
cell
.
imgs
=
self
.
maxFiveImgsArr
self
.
listTbv
.
reloadData
()
}
}
}
}
}
}
//MARK: - 删除图片处理
//MARK: - 删除图片处理
func
DelImgCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
func
DelImgCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
if
cell
.
isSingle
==
true
{
if
cell
.
isSingle
==
true
{
singleImgArr
.
remove
Object
(
at
:
sender
.
tag
)
singleImgArr
.
remove
(
at
:
sender
.
tag
)
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
else
{
}
else
{
maxFiveImgsArr
.
remove
Object
(
at
:
sender
.
tag
)
maxFiveImgsArr
.
remove
(
at
:
sender
.
tag
)
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
}
}
}
...
@@ -413,25 +509,23 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -413,25 +509,23 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let
vc
=
CreatNewSpecsViewController
()
let
vc
=
CreatNewSpecsViewController
()
vc
.
barTitle
=
"编辑规格"
vc
.
barTitle
=
"编辑规格"
vc
.
datasArr
=
guiGeArr
vc
.
datasArr
=
guiGeArr
let
dataDict
:
NSDictionary
!
let
dataDict
:
GuiGeModel
!
if
selectIdx
?
.
item
!=
nil
{
if
selectIdx
?
.
item
!=
nil
{
dataDict
=
guiGeArr
[
selectIdx
!.
item
]
as!
NSDictionary
dataDict
=
guiGeArr
[
selectIdx
!.
item
]
}
else
{
}
else
{
dataDict
=
guiGeArr
.
firstObject
as!
NSDictionary
dataDict
=
guiGeArr
.
first
}
}
vc
.
price
=
dataDict
[
"price"
]
as!
String
vc
.
price
=
dataDict
.
price
vc
.
guiGe
=
dataDict
[
"guiGe"
]
as!
String
vc
.
guiGe
=
dataDict
.
guiGe
vc
.
weight
=
dataDict
[
"weight"
]
as!
String
vc
.
weight
=
dataDict
.
weight
vc
.
wenDu
=
dataDict
[
"wenDu"
]
as!
String
vc
.
wenDu
=
dataDict
.
wenDu
vc
.
danWei
=
dataDict
[
"danWei"
]
as!
String
vc
.
danWei
=
dataDict
.
danWei
let
arr
=
dataDict
[
"jieTiArr"
]
as!
NSMutableArray
vc
.
isNonYuShou
=
dataDict
.
isNonYuShou
let
arr2
=
dataDict
[
"specalArr"
]
as!
NSMutableArray
vc
.
isYuShouSetting
=
dataDict
.
isYuShouSetting
vc
.
isNonYuShou
=
dataDict
[
"isNonYuShou"
]
as!
Bool
vc
.
yuShouPrice
=
dataDict
.
yuShouPrice
vc
.
isYuShouSetting
=
dataDict
[
"isYuShouSetting"
]
as!
Bool
vc
.
specalArr
=
dataDict
.
specalArr
vc
.
yuShouPrice
=
dataDict
[
"yuShouPrice"
]
as!
String
vc
.
jieTiArr
=
dataDict
.
jieTiArr
vc
.
specalArr
=
arr2
vc
.
jieTiArr
=
arr
if
selectIdx
==
nil
{
if
selectIdx
==
nil
{
vc
.
selectIdx
=
IndexPath
(
item
:
0
,
section
:
0
)
vc
.
selectIdx
=
IndexPath
(
item
:
0
,
section
:
0
)
}
else
{
}
else
{
...
@@ -459,7 +553,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -459,7 +553,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
//MARK: - 新增、编辑规格
//MARK: - 新增、编辑规格
func
CreatNewSpecsViewControllerSaveAction
(
datas
:
NSMutableArray
)
{
func
CreatNewSpecsViewControllerSaveAction
(
datas
:
Array
<
GuiGeModel
>
)
{
guiGeArr
=
datas
guiGeArr
=
datas
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
}
...
@@ -503,6 +597,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -503,6 +597,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
case
"是否询价"
:
case
"是否询价"
:
shiFouXJ
=
content
.
isOn
shiFouXJ
=
content
.
isOn
break
break
case
"用户付款是否需要审核"
:
shiFouSH
=
content
.
isOn
break
default
:
default
:
break
break
}
}
...
@@ -624,6 +721,10 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -624,6 +721,10 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
}
}
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
{
faHuoTime
=
str
print
(
faHuoTime
)
}
override
func
backAction
()
{
override
func
backAction
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
...
...
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
View file @
9f3a4b1f
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
import
UIKit
import
UIKit
import
LGButton
import
LGButton
protocol
CreatNewSpecsViewControllerDelegate
{
protocol
CreatNewSpecsViewControllerDelegate
{
func
CreatNewSpecsViewControllerSaveAction
(
datas
:
NSMutableArray
)
func
CreatNewSpecsViewControllerSaveAction
(
datas
:
Array
<
GuiGeModel
>
)
func
CreatNewSpecsViewControllerDeleteAction
()
func
CreatNewSpecsViewControllerDeleteAction
()
}
}
class
CreatNewSpecsViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndTFCellDelegate
,
TitleAndBtnCellDelegate
,
TitleAndSwitchCellDelegate
,
TitleAndSwitchHeaderViewDelegate
,
NewCreateHeaderDelegate
,
NewCreateFooterDelegate
,
YuShouCellDelegate
,
GLAlertSelectViewDelegate
,
PuTongJieTiCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
{
class
CreatNewSpecsViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndTFCellDelegate
,
TitleAndBtnCellDelegate
,
TitleAndSwitchCellDelegate
,
TitleAndSwitchHeaderViewDelegate
,
NewCreateHeaderDelegate
,
NewCreateFooterDelegate
,
YuShouCellDelegate
,
GLAlertSelectViewDelegate
,
PuTongJieTiCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
{
...
@@ -19,9 +19,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -19,9 +19,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
var
delegate
:
CreatNewSpecsViewControllerDelegate
?
var
delegate
:
CreatNewSpecsViewControllerDelegate
?
var
collectView
:
UICollectionView
?
var
collectView
:
UICollectionView
?
var
datasArr
:
NSMutableArray
=
[]
var
datasArr
:
Array
<
GuiGeModel
>
=
[]
var
dataDict
:
NSDictionary
?
var
dataModel
=
GuiGeModel
()
let
titleArray
=
[
"售价:"
,
"规格:"
,
"重量:"
,
"温藏:"
,
"单位:"
]
let
titleArray
=
[
"售价:"
,
"规格:"
,
"重量:"
,
"温藏:"
,
"单位:"
]
let
pliceHolderArr
=
[
"请输入商品售价"
,
"请输入商品规格"
,
"请输入商品重量"
,
"请选择商品温藏"
,
"请选择商品单位"
]
let
pliceHolderArr
=
[
"请输入商品售价"
,
"请输入商品规格"
,
"请输入商品重量"
,
"请选择商品温藏"
,
"请选择商品单位"
]
@IBOutlet
weak
var
bottomBtn
:
LGButton
!
@IBOutlet
weak
var
bottomBtn
:
LGButton
!
...
@@ -68,16 +67,16 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -68,16 +67,16 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
danWei
=
newValue
danWei
=
newValue
}
}
}
//规格
}
//规格
var
specalArr
:
NSMutableArray
=
[]{
var
specalArr
:
Array
<
Any
>
=
[]{
willSet
{
willSet
{
specalArr
.
removeAll
Objects
()
specalArr
.
removeAll
()
specalArr
=
newValue
specalArr
=
newValue
}
}
}
//预售
}
//预售
var
jieTiArr
:
NSMutableArray
=
[]{
var
jieTiArr
:
Array
<
Any
>
=
[]{
willSet
{
willSet
{
jieTiArr
.
removeAll
Objects
()
jieTiArr
.
removeAll
()
jieTiArr
=
newValue
jieTiArr
=
newValue
}
}
...
@@ -186,24 +185,26 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -186,24 +185,26 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
// }
// }
// }
// }
let
dict
=
NSMutableDictionary
()
// let dict = NSMutableDictionary()
dict
[
"price"
]
=
price
dataModel
.
price
=
price
dict
[
"guiGe"
]
=
guiGe
dataModel
.
guiGe
=
guiGe
dict
[
"weight"
]
=
weight
dataModel
.
weight
=
weight
dict
[
"wenDu"
]
=
wenDu
dataModel
.
wenDu
=
wenDu
dict
[
"danWei"
]
=
danWei
dataModel
.
danWei
=
danWei
dict
[
"jieTiArr"
]
=
jieTiArr
dataModel
.
jieTiArr
=
jieTiArr
as!
Array
<
Any
>
dict
[
"specalArr"
]
=
specalArr
dataModel
.
specalArr
=
specalArr
as!
Array
<
Any
>
dict
[
"itemIdx"
]
=
datasArr
.
count
dataModel
.
isNonYuShou
=
isNonYuShou
dict
[
"isNonYuShou"
]
=
isNonYuShou
dataModel
.
isYuShouSetting
=
isYuShouSetting
dict
[
"isYuShouSetting"
]
=
isYuShouSetting
dataModel
.
yuShouPrice
=
yuShouPrice
dict
[
"yuShouPrice"
]
=
yuShouPrice
if
barTitle
?
.
contains
(
"编辑"
)
==
true
{
if
barTitle
?
.
contains
(
"编辑"
)
==
true
{
datasArr
.
replaceObject
(
at
:
selectIdx
!.
item
,
with
:
dict
)
// datasArr.replaceObject(at: selectIdx!.item, with: dict)
datasArr
.
insert
(
dataModel
,
at
:
selectIdx
!.
item
)
datasArr
.
remove
(
at
:
selectIdx
!.
item
+
1
)
}
else
{
}
else
{
datasArr
.
a
dd
(
dict
)
datasArr
.
a
ppend
(
dataModel
)
}
}
delegate
?
.
CreatNewSpecsViewControllerSaveAction
(
datas
:
datasArr
)
delegate
?
.
CreatNewSpecsViewControllerSaveAction
(
datas
:
datasArr
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
//MARK: - cell delegate
//MARK: - cell delegate
...
@@ -529,29 +530,33 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -529,29 +530,33 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
func
footerClickAction
()
{
func
footerClickAction
()
{
print
(
jieTiArr
)
if
selectYuShou
{
//预售
if
selectYuShou
{
//预售
specalArr
.
a
d
d
(
""
)
specalArr
.
a
ppen
d
(
""
)
}
else
{
//非预售
}
else
{
//非预售
jieTiArr
.
a
d
d
(
""
)
jieTiArr
.
a
ppen
d
(
""
)
}
}
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
}
func
YuShouCellSwitchStatus
(
sender
:
UISwitch
)
{
func
YuShouCellSwitchStatus
(
sender
:
UISwitch
)
{
//控制
//控制
print
(
"status3 =
\(
isYuShouSetting
)
,
\(
isJieTiJiaSetting
)
"
)
isYuShouSetting
=
sender
.
isOn
isYuShouSetting
=
sender
.
isOn
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
}
func
PuTongJieTiDelAction
(
sender
:
UIButton
)
{
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
{
jieTiArr
.
remove
Object
(
at
:
sender
.
tag
)
jieTiArr
.
remove
(
at
:
sender
.
tag
)
print
(
jieTiArr
)
print
(
jieTiArr
,
sender
.
tag
)
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
}
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
if
selectYuShou
{
if
selectYuShou
{
specalArr
.
replaceObject
(
at
:
cell
.
tag
,
with
:
"
\(
price
)
_
\(
count
)
"
)
specalArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
print
(
specalArr
)
specalArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
else
{
}
else
{
jieTiArr
.
replaceObject
(
at
:
cell
.
tag
,
with
:
"
\(
price
)
_
\(
count
)
"
)
jieTiArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
print
(
jieTiArr
)
jieTiArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
}
}
}
...
@@ -589,19 +594,17 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -589,19 +594,17 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
selectIdx
=
indexPath
selectIdx
=
indexPath
//刷新cell
//刷新cell
let
dataDict
=
datasArr
[
selectIdx
!.
item
]
as!
NSDictionary
let
dataDict
=
datasArr
[
selectIdx
!.
item
]
price
=
dataDict
[
"price"
]
as!
String
price
=
dataDict
.
price
guiGe
=
dataDict
[
"guiGe"
]
as!
String
guiGe
=
dataDict
.
guiGe
weight
=
dataDict
[
"weight"
]
as!
String
weight
=
dataDict
.
weight
wenDu
=
dataDict
[
"wenDu"
]
as!
String
wenDu
=
dataDict
.
wenDu
danWei
=
dataDict
[
"danWei"
]
as!
String
danWei
=
dataDict
.
danWei
let
arr
=
dataDict
[
"jieTiArr"
]
as!
NSMutableArray
isNonYuShou
=
dataDict
.
isNonYuShou
let
arr2
=
dataDict
[
"specalArr"
]
as!
NSMutableArray
isYuShouSetting
=
dataDict
.
isYuShouSetting
isNonYuShou
=
dataDict
[
"isNonYuShou"
]
as!
Bool
yuShouPrice
=
dataDict
.
yuShouPrice
isYuShouSetting
=
dataDict
[
"isYuShouSetting"
]
as!
Bool
specalArr
=
dataDict
.
specalArr
yuShouPrice
=
dataDict
[
"yuShouPrice"
]
as!
String
jieTiArr
=
dataDict
.
jieTiArr
specalArr
=
arr2
jieTiArr
=
arr
listTbv
.
reloadData
()
listTbv
.
reloadData
()
collectionView
.
reloadData
()
collectionView
.
reloadData
()
}
}
...
...
GeliBusinessPlatform/ViewController/新增规格/GuiGeModel.swift
0 → 100644
View file @
9f3a4b1f
//
// GuiGeModel.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/5/15.
// Copyright © 2020 junye lu. All rights reserved.
//
import
Foundation
class
GuiGeModel
:
NSObject
{
///售价
var
price
:
String
=
""
///规格
var
guiGe
:
String
=
""
///重量
var
weight
:
String
=
""
///温度
var
wenDu
:
String
=
""
///单位
var
danWei
:
String
=
""
///是否预售
var
isNonYuShou
:
Bool
=
false
///是否打开预售设置
var
isYuShouSetting
:
Bool
=
false
///预售价格
var
yuShouPrice
:
String
=
""
///普通阶梯价
var
jieTiArr
:
Array
<
Any
>
=
[]
///预售阶梯价
var
specalArr
:
Array
<
Any
>
=
[]
}
GeliBusinessPlatform/ViewController/新增规格/PuTongJieTiCell.swift
View file @
9f3a4b1f
...
@@ -8,16 +8,15 @@
...
@@ -8,16 +8,15 @@
import
UIKit
import
UIKit
@objc
protocol
PuTongJieTiCellDelegate
{
@objc
protocol
PuTongJieTiCellDelegate
{
@objc
optional
func
PuTongJieTiDelAction
(
sender
:
UIButton
)
@objc
optional
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
@objc
optional
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
@objc
optional
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
}
}
class
PuTongJieTiCell
:
UITableViewCell
{
class
PuTongJieTiCell
:
UITableViewCell
{
var
delegate
:
PuTongJieTiCellDelegate
?
var
delegate
:
PuTongJieTiCellDelegate
?
@IBAction
func
delAction
(
_
sender
:
UIButton
)
{
@IBAction
func
delAction
(
_
sender
:
UIButton
)
{
delegate
?
.
PuTongJieTiDelAction
?(
sender
:
se
nder
)
delegate
?
.
PuTongJieTiDelAction
?(
sender
:
se
lf
)
}
}
@IBOutlet
weak
var
priceTF
:
UITextField
!
@IBOutlet
weak
var
priceTF
:
UITextField
!
@IBOutlet
weak
var
countTF
:
UITextField
!
@IBOutlet
weak
var
countTF
:
UITextField
!
@IBOutlet
weak
var
titleLbl
:
UILabel
!
@IBOutlet
weak
var
titleLbl
:
UILabel
!
...
...
GeliBusinessPlatform/ViewController/新增规格/YuShouCell.xib
View file @
9f3a4b1f
...
@@ -156,7 +156,7 @@
...
@@ -156,7 +156,7 @@
<color
red=
"0.18000000715255737"
green=
"0.18000000715255737"
blue=
"0.18000000715255737"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
red=
"0.18000000715255737"
green=
"0.18000000715255737"
blue=
"0.18000000715255737"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
</namedColor>
</namedColor>
<namedColor
name=
"标题字颜色"
>
<namedColor
name=
"标题字颜色"
>
<color
red=
"0.180
3921568627451"
green=
"0.1803921568627451"
blue=
"0.1803921568627451
"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
red=
"0.180
00000715255737"
green=
"0.18000000715255737"
blue=
"0.18000000715255737
"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
</namedColor>
</namedColor>
<namedColor
name=
"灰色分界线"
>
<namedColor
name=
"灰色分界线"
>
<color
red=
"0.92941176470588238"
green=
"0.92941176470588238"
blue=
"0.92941176470588238"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
red=
"0.92941176470588238"
green=
"0.92941176470588238"
blue=
"0.92941176470588238"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
...
...
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