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
d5f44a55
Commit
d5f44a55
authored
May 20, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加预售设置开关
parent
d49ad703
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1183 additions
and
1059 deletions
+1183
-1059
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
.../junyelu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+0
-16
GeliBusinessPlatform/Model/GoodsManageMoel/GoodsDetailModel.swift
...nessPlatform/Model/GoodsManageMoel/GoodsDetailModel.swift
+11
-3
GeliBusinessPlatform/ViewController/商品详情/EPViewController.swift
...sinessPlatform/ViewController/商品详情/EPViewController.swift
+1065
-995
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
...orm/ViewController/商品详情/ProductDetailViewController.swift
+4
-16
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
...orm/ViewController/新增规格/CreatNewSpecsViewController.swift
+44
-28
GeliBusinessPlatform/ViewController/新增规格/GuiGeModel.swift
GeliBusinessPlatform/ViewController/新增规格/GuiGeModel.swift
+6
-0
GeliBusinessPlatform/ViewController/新增规格/普通+预售header/TitleAndSwitchHeaderView.swift
...ontroller/新增规格/普通+预售header/TitleAndSwitchHeaderView.swift
+13
-1
GeliBusinessPlatform/ViewController/新增规格/普通+预售header/TitleAndSwitchHeaderView.xib
...wController/新增规格/普通+预售header/TitleAndSwitchHeaderView.xib
+40
-0
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
d5f44a55
No preview for this file type
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
View file @
d5f44a55
...
@@ -24,21 +24,5 @@
...
@@ -24,21 +24,5 @@
continueAfterRunningActions =
"No"
>
continueAfterRunningActions =
"No"
>
</BreakpointContent>
</BreakpointContent>
</BreakpointProxy>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
uuid =
"B223F50A-4F5B-423B-9F6D-A967E5BFB36E"
shouldBeEnabled =
"No"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"575"
endingLineNumber =
"575"
landmarkName =
"YuShouCellSwitchStatus(sender:)"
landmarkType =
"7"
>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Breakpoints>
</Bucket>
</Bucket>
GeliBusinessPlatform/Model/GoodsManageMoel/GoodsDetailModel.swift
View file @
d5f44a55
...
@@ -25,14 +25,18 @@ class GoodsDetailModel: Mappable {
...
@@ -25,14 +25,18 @@ class GoodsDetailModel: Mappable {
}
}
class
GoodsDetailDataModel
:
Mappable
{
class
GoodsDetailDataModel
:
Mappable
{
var
goods_res
:
Array
<
GoodsDetailGoodsResModel
>
?
//商品数据
var
goods_res
:
GoodsDetailGoodsResModel
?
//商品数据
var
sku_res
:
Array
<
GoodsDetailSkuResModel
>
?
//商品sku信息
var
banner_res
:
Array
<
GoodsDetailBannerResModel
>
?
//副图信息
required
init
?(
map
:
Map
)
{
required
init
?(
map
:
Map
)
{
}
}
func
mapping
(
map
:
Map
)
{
func
mapping
(
map
:
Map
)
{
goods_res
<-
map
[
"goods_res"
]
goods_res
<-
map
[
"goods_res"
]
sku_res
<-
map
[
"sku_res"
]
banner_res
<-
map
[
"banner_res"
]
}
}
}
}
...
@@ -40,7 +44,9 @@ class GoodsDetailGoodsResModel: Mappable {
...
@@ -40,7 +44,9 @@ class GoodsDetailGoodsResModel: Mappable {
var
goods_id
:
Int
?
//商品id
var
goods_id
:
Int
?
//商品id
var
goods_name
:
String
?
//商品名
var
goods_name
:
String
?
//商品名
var
cat_id
:
Int
?
//分类id
var
cat_id
:
Int
?
//分类id
var
cat_name
:
String
?
//分类名
var
brand_id
:
Int
?
//品牌id
var
brand_id
:
Int
?
//品牌id
var
brand_name
:
String
?
//品牌名
var
goods_sn
:
String
?
//商品sn
var
goods_sn
:
String
?
//商品sn
var
market_price
:
String
?
//市场价
var
market_price
:
String
?
//市场价
var
shop_price
:
String
?
//(默认)售价(本店售价)
var
shop_price
:
String
?
//(默认)售价(本店售价)
...
@@ -106,6 +112,8 @@ class GoodsDetailGoodsResModel: Mappable {
...
@@ -106,6 +112,8 @@ class GoodsDetailGoodsResModel: Mappable {
set_time
<-
map
[
"set_time"
]
set_time
<-
map
[
"set_time"
]
is_inquiry
<-
map
[
"is_inquiry"
]
is_inquiry
<-
map
[
"is_inquiry"
]
is_qz
<-
map
[
"is_qz"
]
is_qz
<-
map
[
"is_qz"
]
brand_name
<-
map
[
"brand_name"
]
cat_name
<-
map
[
"cat_name"
]
}
}
...
...
GeliBusinessPlatform/ViewController/商品详情/EPViewController.swift
View file @
d5f44a55
...
@@ -13,7 +13,7 @@ import IQKeyboardManagerSwift
...
@@ -13,7 +13,7 @@ import IQKeyboardManagerSwift
import
Dollar
import
Dollar
class
EPViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
,
TitleAndTFCellDelegate
,
YuShouWeiKuanFaHuoCellDelegate
,
UITextFieldDelegate
,
ShowTimeSelectViewDelegate
{
class
EPViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
,
TitleAndTFCellDelegate
,
YuShouWeiKuanFaHuoCellDelegate
,
UITextFieldDelegate
,
ShowTimeSelectViewDelegate
{
@IBOutlet
weak
var
btmBtnViewH
:
NSLayoutConstraint
!
@IBOutlet
weak
var
btmBtnViewH
:
NSLayoutConstraint
!
@IBOutlet
weak
var
tbvBGView
:
UIView
!
@IBOutlet
weak
var
tbvBGView
:
UIView
!
@IBOutlet
weak
var
btmBtnBGView
:
UIView
!
@IBOutlet
weak
var
btmBtnBGView
:
UIView
!
...
@@ -23,1008 +23,1078 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
...
@@ -23,1008 +23,1078 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
var
goods_id
:
Int
?
var
goods_id
:
Int
?
func
GLASClose
(
view
:
GLAlertSelectView
,
selectnum
:
Int
,
selectArr
:
Array
<
Int
>
)
{
func
GLASClose
(
view
:
GLAlertSelectView
,
selectnum
:
Int
,
selectArr
:
Array
<
Int
>
)
{
if
view
.
titleLbl
.
text
==
"请选择商品类型"
{
if
view
.
titleLbl
.
text
==
"请选择商品类型"
{
print
(
itemTypeArr
,
selectArr
)
print
(
itemTypeArr
,
selectArr
)
itemTypeArr
=
selectArr
itemTypeArr
=
selectArr
}
}
if
selectnum
!=
10086
{
if
selectnum
!=
10086
{
if
view
.
titleLbl
.
text
==
"请选择国家"
{
if
view
.
titleLbl
.
text
==
"请选择国家"
{
print
(
itemTypeArr
,
selectArr
)
print
(
itemTypeArr
,
selectArr
)
countrySelect
=
selectnum
countrySelect
=
selectnum
}
}
if
view
.
titleLbl
.
text
==
"请选择运输方式"
{
if
view
.
titleLbl
.
text
==
"请选择运输方式"
{
yunShuType
=
selectnum
yunShuType
=
selectnum
}
}
if
view
.
titleLbl
.
text
==
"请选择商品状态"
{
if
view
.
titleLbl
.
text
==
"请选择商品状态"
{
shangPinStatus
=
selectnum
shangPinStatus
=
selectnum
}
}
}
}
view
.
removeFromSuperview
()
view
.
removeFromSuperview
()
glSelectView
=
nil
glSelectView
=
nil
}
}
let
titleArr
=
[
"商品信息"
,
"商品图片"
,
"商品规格"
,
"预售设置"
,
"其它信息"
,
"商品详情"
]
let
spxxArr
=
[
"商品名称"
,
"商品类型"
,
"商品分类"
,
"品牌"
,
"起卖数量"
,
"是否清真"
,
"是否询价"
]
var
tishixxArr
=
[
"请输入商品名称"
,
"请选择商品类型"
,
"请选择商品分类"
,
"请选择品牌"
,
"请输入起卖数量"
]
var
tishixxArr1
=
[
"请输入关键字"
,
"请输入物流费用"
,
"请选择国家"
,
"请选择商品状态"
,
"请选择运输方式"
]
let
sptpArr
=
[
"商品封面图(限一张)"
,
"商品主图(限五张)"
]
let
qtxxArr
=
[
"关键字"
,
"物流费用"
,
"国家"
,
"商品状态"
,
"运输方式"
]
let
ysszArr
=
[
"用户付款是否需要审核"
,
"预设预付定金时间段"
,
"预设预付尾款时间段"
,
"预设预付尾款发货时间"
]
var
ysszHolder
=
[
"0"
,
"请选择时段"
,
"请选择时段"
,
"0"
]
var
shangPinStatusArr
:
Array
<
GeneralInfoGsModel
>
?
=
[]
var
yunShuTypeArr
=
[
"冷链"
,
"常温"
,
"热链"
]
var
countryArr
=
[
"中国"
]
var
layout
=
UICollectionViewFlowLayout
()
var
glSelectView
:
GLAlertSelectView
?
let
titleArr
=
[
"商品信息"
,
"商品图片"
,
"商品规格"
,
"预售设置"
,
"其它信息"
,
"商品详情"
]
var
selectIdx
:
IndexPath
?
=
IndexPath
(
item
:
0
,
section
:
0
)
//多规格状态下点击collectionCell的row记录
let
spxxArr
=
[
"商品名称"
,
"商品类型"
,
"商品分类"
,
"品牌"
,
"起卖数量"
,
"是否清真"
,
"是否询价"
]
var
tishixxArr
=
[
"请输入商品名称"
,
"请选择商品类型"
,
"请选择商品分类"
,
"请选择品牌"
,
"请输入起卖数量"
]
var
tishixxArr1
=
[
"请输入关键字"
,
"请输入物流费用"
,
"请选择国家"
,
"请选择商品状态"
,
"请选择运输方式"
]
let
sptpArr
=
[
"商品封面图(限一张)"
,
"商品主图(限五张)"
]
let
qtxxArr
=
[
"关键字"
,
"物流费用"
,
"国家"
,
"商品状态"
,
"运输方式"
]
let
ysszArr
=
[
"用户付款是否需要审核"
,
"预设预付定金时间段"
,
"预设预付尾款时间段"
,
"预设预付尾款发货时间"
]
var
ysszHolder
=
[
"0"
,
"请选择时段"
,
"请选择时段"
,
"0"
]
var
shangPinStatusArr
:
Array
<
GeneralInfoGsModel
>
?
=
[]
var
yunShuTypeArr
=
[
"冷链"
,
"常温"
,
"热链"
]
var
countryArr
=
[
"中国"
]
var
layout
=
UICollectionViewFlowLayout
()
var
glSelectView
:
GLAlertSelectView
?
var
selectIdx
:
IndexPath
?
=
IndexPath
(
item
:
0
,
section
:
0
)
//多规格状态下点击collectionCell的row记录
var
isYuShouShangPin
:
Bool
?
//是否为预售商品
var
itemTypeArr
:
Array
<
Int
>
?
=
[]
//多选
var
isYuShou
:
Bool
=
false
//是否预售
var
shangPinStatus
:
Int
?
=
0
//商品状态
var
yunShuType
:
Int
?
=
0
//运输类型
var
maxFiveImgsArr
:
Array
<
UIImage
>
=
[]
//多图
var
singleImgArr
:
Array
<
UIImage
>
=
[]
//单张图
var
itemName
=
""
//商品名称
var
qiMaiShuLiang
=
""
//起卖数量
var
shiFouQZ
=
false
//是否清真
var
shiFouXJ
=
false
//是否询价
var
keyWord
=
""
//关键字
var
wuLiuPrice
=
""
//物流费用
var
countrySelect
:
Int
?
//选择国家
var
guiGeArr
:
Array
<
GuiGeModel
>
=
[]
//规格数组,根据规格资料数量控制右上角新增按钮是否显示
var
shiFouSH
=
false
//是否审核
var
faHuoTime
=
""
//发货时间
//预售时间段
var
dj_time_start
:
Int
?
=
0
var
dj_time_end
:
Int
?
=
0
var
wk_time_start
:
Int
?
=
0
var
wk_time_end
:
Int
?
=
0
var
listTbv
:
UITableView
!
var
isYuShouShangPin
:
Bool
?
//是否为预售商品
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
var
itemTypeArr
:
Array
<
Int
>
?
=
[]
//多选
//MARK:--获取新增商品的基本信息(品牌和分类等)
HUD
.
flash
(
.
progress
)
var
shangPinStatus
:
Int
?
=
0
//商品状态
var
yunShuType
:
Int
?
=
0
//运输类型
//MARK:--新增商品和编辑商品所需要的基本信息(无)就页面不正常显示
var
maxFiveImgsArr
:
Array
<
UIImage
>
=
[]
//多图
// let UserToken = UserDefaults.standard.value(forKey: "user_token")
var
singleImgArr
:
Array
<
UIImage
>
=
[]
//单张图
// GeneralInfo(["user_token":UserToken as Any], success: { (data) in
var
itemName
=
""
//商品名称
// HUD.hide(animated: true)
var
qiMaiShuLiang
=
""
//起卖数量
// self.generalInfoModel = (data as! GeneralInfoModel)
var
shiFouQZ
=
false
//是否清真
// self.shangPinStatusArr = (self.generalInfoModel?.data!.gs)!
var
shiFouXJ
=
false
//是否询价
//
var
keyWord
=
""
//关键字
// }) { (error) in
var
wuLiuPrice
=
""
//物流费用
//
var
countrySelect
:
Int
?
//选择国家
// }
var
guiGeArr
:
Array
<
GuiGeModel
>
=
[]
//规格数组,根据规格资料数量控制右上角新增按钮是否显示
//是否为预售商品
var
shiFouSH
=
false
//是否审核
isYuShouShangPin
=
false
var
faHuoTime
=
""
//发货时间
//预售时间段
navbar
.
title
=
"商品详情"
var
dj_time_start
:
Int
?
=
0
self
.
view
.
addSubview
(
navbar
)
var
dj_time_end
:
Int
?
=
0
if
listTbv
==
nil
{
var
wk_time_start
:
Int
?
=
0
let
tbv
=
UITableView
()
var
wk_time_end
:
Int
?
=
0
tbvBGView
.
addSubview
(
tbv
)
tbv
.
snp
.
makeConstraints
{
(
make
)
in
var
listTbv
:
UITableView
!
make
.
top
.
left
.
bottom
.
right
.
equalTo
(
0
)
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
//MARK:--获取新增商品的基本信息(品牌和分类等)
HUD
.
flash
(
.
progress
)
//是否为预售商品
isYuShouShangPin
=
false
navbar
.
title
=
"商品详情"
self
.
view
.
addSubview
(
navbar
)
//MARK:--新增商品和编辑商品所需要的基本信息(无)就页面不正常显示
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
goodsDetail
([
"user_token"
:
UserToken
,
"goods_id"
:
goods_id
],
success
:
{
(
data
)
in
let
model
=
data
as!
GoodsDetailModel
//商品名
self
.
itemName
=
(
model
.
data
?
.
goods_res
!.
goods_name
)
!
//商品类型
if
model
.
data
?
.
goods_res
!.
is_adsale
==
0
{
self
.
itemTypeArr
=
[
99
,
99
,
99
,
99
]
}
else
{
self
.
itemTypeArr
=
[
1
,
99
,
99
,
99
]
}
if
(
model
.
data
?
.
goods_res
!.
goods_type
)
!
==
1
||
(
model
.
data
?
.
goods_res
!.
goods_type
)
!
==
2
{
self
.
itemTypeArr
?
.
insert
(
1
,
at
:
1
)
self
.
itemTypeArr
?
.
remove
(
at
:
2
)
}
else
{
self
.
itemTypeArr
?
.
insert
((
model
.
data
?
.
goods_res
!.
goods_type
)
!
,
at
:
(
model
.
data
?
.
goods_res
!.
goods_type
)
!-
1
)
self
.
itemTypeArr
?
.
remove
(
at
:
(
model
.
data
?
.
goods_res
!.
goods_type
)
!
)
}
let
contentArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
let
titles
=
NSMutableArray
()
titles
.
removeAllObjects
()
for
num
in
self
.
itemTypeArr
!
{
if
num
!=
99
{
titles
.
add
(
contentArr
[
num
])
}
}
if
titles
.
componentsJoined
(
by
:
","
)
.
contains
(
"预售"
)
{
self
.
isYuShouShangPin
=
true
}
else
{
self
.
isYuShouShangPin
=
false
}
self
.
tishixxArr
.
insert
(
titles
.
componentsJoined
(
by
:
","
),
at
:
1
)
self
.
tishixxArr
.
remove
(
at
:
2
)
//商品分类
print
(
"abc == "
,
model
.
data
?
.
goods_res
!.
cat_name
)
self
.
tishixxArr
.
insert
((
model
.
data
?
.
goods_res
!.
cat_name
)
!
,
at
:
2
)
self
.
tishixxArr
.
remove
(
at
:
3
)
//品牌名
self
.
tishixxArr
.
insert
((
model
.
data
?
.
goods_res
!.
brand_name
)
!
,
at
:
3
)
self
.
tishixxArr
.
remove
(
at
:
4
)
//起卖数量
self
.
qiMaiShuLiang
=
"
\(
model
.
data
!.
goods_res
!.
origin_number
!
)
"
//是否清真
self
.
shiFouQZ
=
true
if
model
.
data
?
.
goods_res
!.
is_qz
==
0
{
self
.
shiFouQZ
=
false
}
//是否询价
self
.
shiFouXJ
=
true
if
model
.
data
?
.
goods_res
!.
is_inquiry
==
0
{
self
.
shiFouXJ
=
false
}
}
listTbv
=
tbv
//是否有封面图
// if model.data?.goods_res?.original_img?.count > 0 {
//
// }
//商品主图
//商品规格
if
(
model
.
data
?
.
sku_res
?
.
count
)
!
>
0
{
self
.
guiGeArr
.
removeAll
()
for
item
in
model
.
data
!.
sku_res
!
{
let
dataSource
=
item
as!
GoodsDetailSkuResModel
let
data
=
GuiGeModel
()
data
.
DJBiLi
=
dataSource
.
pct
!
data
.
danWei
=
dataSource
.
unit
!
data
.
sku_id
=
dataSource
.
sku_id
!
data
.
guiGe
=
dataSource
.
spec_str
!
data
.
isOpenYSSetting
=
false
if
dataSource
.
is_open_adsale
!
==
1
{
data
.
isOpenYSSetting
=
true
}
data
.
isJieTiOpen
=
false
if
dataSource
.
is_tiered
==
1
{
data
.
isJieTiOpen
=
true
}
}
}
if
self
.
listTbv
==
nil
{
let
tbv
=
UITableView
()
self
.
tbvBGView
.
addSubview
(
tbv
)
tbv
.
snp
.
makeConstraints
{
(
make
)
in
make
.
top
.
left
.
bottom
.
right
.
equalTo
(
0
)
}
self
.
listTbv
=
tbv
self
.
listTbv
.
separatorStyle
=
.
none
self
.
listTbv
.
delegate
=
self
self
.
listTbv
.
dataSource
=
self
self
.
listTbv
.
register
(
UINib
(
nibName
:
"TitleAndTFCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndTF"
)
self
.
listTbv
.
register
(
UINib
(
nibName
:
"TitleAndSwitchCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndSwitch"
)
self
.
listTbv
.
register
(
UINib
(
nibName
:
"TitleAndBtnCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndBtn"
)
self
.
listTbv
.
register
(
UINib
(
nibName
:
"AddImgCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"AddImg"
)
self
.
listTbv
.
register
(
UINib
(
nibName
:
"AddGuiGeCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"AddGuiGe"
)
self
.
listTbv
.
register
(
UINib
(
nibName
:
"YuShouWeiKuanFaHuoCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"YuShouWeiKuanFaHuoCell"
)
self
.
listTbv
.
register
(
UINib
(
nibName
:
"ShangPinGguiGeCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"ShangPinGguiGeCell"
)
}
})
{
(
error
)
in
}
}
listTbv
.
separatorStyle
=
.
none
listTbv
.
delegate
=
self
listTbv
.
dataSource
=
self
SetTopFrameView
(
view
:
tbvBGView
,
btmView
:
btmBtnBGView
)
SetTopFrameView
(
view
:
tbvBGView
,
btmView
:
btmBtnBGView
)
listTbv
.
register
(
UINib
(
nibName
:
"TitleAndTFCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndTF"
)
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"
)
}
listTbv
.
register
(
UINib
(
nibName
:
"AddImgCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"AddImg"
)
//MARK: - cell delegate
listTbv
.
register
(
UINib
(
nibName
:
"AddGuiGeCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"AddGuiGe"
)
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
listTbv
.
register
(
UINib
(
nibName
:
"YuShouWeiKuanFaHuoCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"YuShouWeiKuanFaHuoCell"
)
switch
indexPath
.
section
{
listTbv
.
register
(
UINib
(
nibName
:
"ShangPinGguiGeCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"ShangPinGguiGeCell"
)
case
0
:
// Do any additional setup after loading the view.
if
indexPath
.
row
==
0
||
indexPath
.
row
==
4
{
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
//MARK: - cell delegate
cell
.
textTF
.
delegate
=
self
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
switch
indexPath
.
section
{
//商家名称
case
0
:
switch
cell
.
nameLbl
.
text
{
if
indexPath
.
row
==
0
||
indexPath
.
row
==
4
{
case
"商品名称"
:
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
cell
.
textTF
.
text
=
itemName
cell
.
textTF
.
delegate
=
self
cell
.
textTF
.
returnKeyType
=
.
done
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
break
//商家名称
case
"起卖数量"
:
switch
cell
.
nameLbl
.
text
{
cell
.
textTF
.
text
=
qiMaiShuLiang
case
"商品名称"
:
cell
.
textTF
.
keyboardType
=
.
numberPad
cell
.
textTF
.
text
=
itemName
break
cell
.
textTF
.
returnKeyType
=
.
done
default
:
break
break
case
"起卖数量"
:
}
cell
.
textTF
.
text
=
qiMaiShuLiang
cell
.
textTF
.
keyboardType
=
.
numberPad
cell
.
textTF
.
placeholder
=
tishixxArr
[
indexPath
.
row
]
as!
String
break
cell
.
delegate
=
self
default
:
return
cell
break
}
}
if
indexPath
.
row
>
4
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
cell
.
textTF
.
placeholder
=
tishixxArr
[
indexPath
.
row
]
as!
String
cell
.
namelbl
.
text
=
spxxArr
[
indexPath
.
row
]
cell
.
delegate
=
self
cell
.
delegate
=
self
return
cell
switch
cell
.
namelbl
.
text
{
}
case
"是否清真"
:
if
indexPath
.
row
>
4
{
cell
.
infoSw
.
isOn
=
shiFouQZ
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
break
cell
.
namelbl
.
text
=
spxxArr
[
indexPath
.
row
]
case
"是否询价"
:
cell
.
delegate
=
self
cell
.
infoSw
.
isOn
=
shiFouXJ
switch
cell
.
namelbl
.
text
{
break
case
"是否清真"
:
default
:
cell
.
infoSw
.
isOn
=
shiFouQZ
break
break
}
case
"是否询价"
:
return
cell
cell
.
infoSw
.
isOn
=
shiFouXJ
}
break
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
default
:
cell
.
nameLbl
.
text
=
spxxArr
[
indexPath
.
row
]
break
cell
.
contentLbl
.
text
=
tishixxArr
[
indexPath
.
row
]
as!
String
}
cell
.
tag
=
indexPath
.
row
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
.
delegate
=
self
cell
.
isSingle
=
true
return
cell
if
singleImgArr
.
count
>
0
{
case
1
:
cell
.
imgs
=
singleImgArr
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AddImg"
)
as!
AddImgCell
cell
.
addBtn
.
isHidden
=
true
cell
.
nameLbl
.
text
=
sptpArr
[
indexPath
.
row
]
}
else
{
if
indexPath
.
row
==
0
{
cell
.
scrollView
?
.
isHidden
=
true
cell
.
isSingle
=
true
cell
.
addBtn
.
isHidden
=
false
if
singleImgArr
.
count
>
0
{
}
cell
.
imgs
=
singleImgArr
}
else
{
cell
.
addBtn
.
isHidden
=
true
cell
.
isSingle
=
false
}
else
{
if
maxFiveImgsArr
.
count
>
0
{
cell
.
scrollView
?
.
isHidden
=
true
cell
.
imgs
=
maxFiveImgsArr
cell
.
addBtn
.
isHidden
=
false
}
else
{
}
cell
.
scrollView
?
.
isHidden
=
true
}
else
{
cell
.
addBtnX
.
constant
=
15
cell
.
isSingle
=
false
}
if
maxFiveImgsArr
.
count
>
0
{
}
cell
.
imgs
=
maxFiveImgsArr
cell
.
delegate
=
self
}
else
{
cell
.
addBtn
.
tag
=
indexPath
.
row
cell
.
scrollView
?
.
isHidden
=
true
cell
.
isEdit
=
true
cell
.
addBtnX
.
constant
=
15
return
cell
}
case
2
:
}
if
guiGeArr
.
count
>
0
{
cell
.
delegate
=
self
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"ShangPinGguiGeCell"
)
as!
ShangPinGguiGeCell
cell
.
addBtn
.
tag
=
indexPath
.
row
cell
.
delegate
=
self
cell
.
isEdit
=
true
var
dict
:
GuiGeModel
!
return
cell
if
selectIdx
!=
nil
{
case
2
:
print
(
selectIdx
?
.
item
)
if
guiGeArr
.
count
>
0
{
dict
=
guiGeArr
[
selectIdx
!.
item
]
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"ShangPinGguiGeCell"
)
as!
ShangPinGguiGeCell
}
else
{
cell
.
delegate
=
self
var
dict
:
GuiGeModel
!
dict
=
guiGeArr
.
first
if
selectIdx
!=
nil
{
}
print
(
selectIdx
?
.
item
)
dict
=
guiGeArr
[
selectIdx
!.
item
]
cell
.
tempLbl
.
text
=
"冷藏:
\(
dict
.
wenDu
)
℃"
}
else
{
cell
.
weightLbl
.
text
=
"重量(kg):
\(
dict
.
weight
)
kg"
cell
.
guiGeLbl
.
text
=
"规格:
\(
dict
.
guiGe
)
kg/件"
dict
=
guiGeArr
.
first
cell
.
danWeiLbl
.
text
=
"单位:
\(
dict
.
danWei
)
"
}
cell
.
sellPriceLbl
.
text
=
"售价:¥
\(
dict
.
price
)
"
cell
.
tempLbl
.
text
=
"冷藏:
\(
dict
.
wenDu
)
℃"
return
cell
cell
.
weightLbl
.
text
=
"重量(kg):
\(
dict
.
weight
)
kg"
}
cell
.
guiGeLbl
.
text
=
"规格:
\(
dict
.
guiGe
)
kg/件"
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AddGuiGe"
)
as!
AddGuiGeCell
cell
.
danWeiLbl
.
text
=
"单位:
\(
dict
.
danWei
)
"
cell
.
imgBtn
.
addTarget
(
self
,
action
:
#selector(
addGuiGe
)
,
for
:
.
touchUpInside
)
cell
.
sellPriceLbl
.
text
=
"售价:¥
\(
dict
.
price
)
"
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"xinzeng"
),
for
:
.
normal
)
return
cell
return
cell
}
case
3
:
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AddGuiGe"
)
as!
AddGuiGeCell
if
indexPath
.
row
==
0
{
cell
.
imgBtn
.
addTarget
(
self
,
action
:
#selector(
addGuiGe
)
,
for
:
.
touchUpInside
)
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"xinzeng"
),
for
:
.
normal
)
cell
.
namelbl
.
text
=
ysszArr
[
indexPath
.
row
]
cell
.
delegate
=
self
return
cell
cell
.
infoSw
.
isOn
=
shiFouSH
case
3
:
return
cell
if
indexPath
.
row
==
0
{
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndSwitch"
)
as!
TitleAndSwitchCell
if
indexPath
.
row
==
3
{
cell
.
namelbl
.
text
=
ysszArr
[
indexPath
.
row
]
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"YuShouWeiKuanFaHuoCell"
)
as!
YuShouWeiKuanFaHuoCell
cell
.
delegate
=
self
cell
.
nameLbl
.
text
=
ysszArr
[
indexPath
.
row
]
cell
.
infoSw
.
isOn
=
shiFouSH
cell
.
textTF
.
keyboardType
=
.
numberPad
return
cell
cell
.
delegate
=
self
}
cell
.
textTF
.
text
=
faHuoTime
if
indexPath
.
row
==
3
{
return
cell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"YuShouWeiKuanFaHuoCell"
)
as!
YuShouWeiKuanFaHuoCell
}
cell
.
nameLbl
.
text
=
ysszArr
[
indexPath
.
row
]
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
cell
.
textTF
.
keyboardType
=
.
numberPad
cell
.
nameLbl
.
text
=
ysszArr
[
indexPath
.
row
]
cell
.
delegate
=
self
cell
.
delegate
=
self
cell
.
textTF
.
text
=
faHuoTime
cell
.
contentLbl
.
text
=
ysszHolder
[
indexPath
.
row
]
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
.
delegate
=
self
return
cell
cell
.
textTF
.
returnKeyType
=
.
done
case
4
:
switch
cell
.
nameLbl
.
text
{
if
indexPath
.
row
<
2
{
case
"关键字"
:
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTF"
)
as!
TitleAndTFCell
cell
.
textTF
.
text
=
keyWord
cell
.
nameLbl
.
text
=
qtxxArr
[
indexPath
.
row
]
break
cell
.
textTF
.
delegate
=
self
case
"物流费用"
:
cell
.
textTF
.
returnKeyType
=
.
done
cell
.
textTF
.
text
=
wuLiuPrice
switch
cell
.
nameLbl
.
text
{
cell
.
textTF
.
keyboardType
=
.
numbersAndPunctuation
case
"关键字"
:
break
cell
.
textTF
.
text
=
keyWord
default
:
break
break
case
"物流费用"
:
}
cell
.
textTF
.
text
=
wuLiuPrice
cell
.
textTF
.
placeholder
=
tishixxArr1
[
indexPath
.
row
]
as!
String
cell
.
textTF
.
keyboardType
=
.
numbersAndPunctuation
cell
.
tag
=
indexPath
.
row
break
cell
.
delegate
=
self
default
:
return
cell
break
}
else
{
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndBtn"
)
as!
TitleAndBtnCell
cell
.
textTF
.
placeholder
=
tishixxArr1
[
indexPath
.
row
]
as!
String
cell
.
nameLbl
.
text
=
qtxxArr
[
indexPath
.
row
]
cell
.
tag
=
indexPath
.
row
cell
.
tag
=
indexPath
.
row
cell
.
delegate
=
self
cell
.
contentLbl
.
text
=
tishixxArr1
[
indexPath
.
row
]
as!
String
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
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AddGuiGe"
)
as!
AddGuiGeCell
cell
.
contentLbl
.
text
=
tishixxArr1
[
indexPath
.
row
]
as!
String
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"XiaYunDanViewController"
),
for
:
.
normal
)
cell
.
delegate
=
self
cell
.
delegate
=
self
return
cell
cell
.
imgBtn
.
tag
=
indexPath
.
row
}
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"tjxq"
),
for
:
.
normal
)
default
:
cell
.
btmH
.
constant
=
25
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AddGuiGe"
)
as!
AddGuiGeCell
return
cell
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"XiaYunDanViewController"
),
for
:
.
normal
)
}
cell
.
delegate
=
self
}
cell
.
imgBtn
.
tag
=
indexPath
.
row
cell
.
imgBtn
.
setImage
(
UIImage
(
named
:
"tjxq"
),
for
:
.
normal
)
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
cell
.
btmH
.
constant
=
25
return
cell
}
}
//MARK: - 底部广告软文跳转
}
func
AddGuiGeCellClick
(
cell
:
AddGuiGeCell
)
{
print
(
"底部广告软文跳转"
)
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
let
vc
=
LMNoteViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
//MARK: - 底部广告软文跳转
//MARK: -- 点击按钮事件,跳转或者展示选择界面
func
AddGuiGeCellClick
(
cell
:
AddGuiGeCell
)
{
func
btnClick
(
content
:
String
,
cell
:
TitleAndBtnCell
)
{
print
(
"底部广告软文跳转"
)
if
cell
.
nameLbl
.
text
==
"商品类型"
{
let
vc
=
LMNoteViewController
()
if
glSelectView
==
nil
{
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
}
view
.
tag
=
cell
.
tag
//MARK: -- 点击按钮事件,跳转或者展示选择界面
view
.
isMultipleS
=
true
func
btnClick
(
content
:
String
,
cell
:
TitleAndBtnCell
)
{
view
.
isShangPinType
=
true
if
cell
.
nameLbl
.
text
==
"商品类型"
{
view
.
titleLbl
.
text
=
"请选择商品类型"
if
glSelectView
==
nil
{
view
.
delegate
=
self
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
dataArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
view
.
tag
=
cell
.
tag
if
itemTypeArr
?
.
count
==
0
{
view
.
isMultipleS
=
true
for
_
in
view
.
dataArr
{
view
.
isShangPinType
=
true
itemTypeArr
?
.
append
(
99
)
view
.
titleLbl
.
text
=
"请选择商品类型"
}
view
.
delegate
=
self
}
view
.
dataArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
if
itemTypeArr
?
.
count
==
0
{
view
.
selectArray
=
itemTypeArr
for
_
in
view
.
dataArr
{
view
.
tempArr
=
itemTypeArr
itemTypeArr
?
.
append
(
99
)
self
.
view
.
addSubview
(
view
)
}
glSelectView
=
view
}
}
}
view
.
selectArray
=
itemTypeArr
if
cell
.
nameLbl
.
text
==
"商品分类"
{
view
.
tempArr
=
itemTypeArr
let
vc
=
GoodsClassViewController
()
self
.
view
.
addSubview
(
view
)
vc
.
delegate
=
self
glSelectView
=
view
vc
.
selectModel
=
selectGoodsClassModel
}
vc
.
dataModelArray
=
generalInfoModel
?
.
data
?
.
cats
}
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
if
cell
.
nameLbl
.
text
==
"商品分类"
{
}
let
vc
=
GoodsClassViewController
()
if
cell
.
nameLbl
.
text
==
"品牌"
{
vc
.
delegate
=
self
let
vc
=
PinPaiListViewController
()
vc
.
selectModel
=
selectGoodsClassModel
vc
.
isSelectData
=
true
vc
.
dataModelArray
=
generalInfoModel
?
.
data
?
.
cats
vc
.
delegate
=
self
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
vc
.
selectModel
=
selectPinPaiData
}
vc
.
dataModelArray
=
generalInfoModel
?
.
data
?
.
brand
if
cell
.
nameLbl
.
text
==
"品牌"
{
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
let
vc
=
PinPaiListViewController
()
}
vc
.
isSelectData
=
true
if
cell
.
nameLbl
.
text
==
"国家"
{
vc
.
delegate
=
self
if
glSelectView
==
nil
{
vc
.
selectModel
=
selectPinPaiData
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
vc
.
dataModelArray
=
generalInfoModel
?
.
data
?
.
brand
view
.
tag
=
cell
.
tag
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
view
.
titleLbl
.
text
=
"请选择国家"
}
view
.
delegate
=
self
if
cell
.
nameLbl
.
text
==
"国家"
{
view
.
dataArr
=
countryArr
if
glSelectView
==
nil
{
if
countrySelect
!=
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
selectNum
=
countrySelect
!
view
.
tag
=
cell
.
tag
view
.
titleLbl
.
text
=
"请选择国家"
}
view
.
delegate
=
self
self
.
view
.
addSubview
(
view
)
view
.
dataArr
=
countryArr
glSelectView
=
view
if
countrySelect
!=
nil
{
}
view
.
selectNum
=
countrySelect
!
}
if
cell
.
nameLbl
.
text
==
"商品状态"
{
}
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
self
.
view
.
addSubview
(
view
)
view
.
tag
=
cell
.
tag
glSelectView
=
view
view
.
titleLbl
.
text
=
"请选择商品状态"
}
view
.
delegate
=
self
}
if
shangPinStatusArr
!=
nil
{
if
cell
.
nameLbl
.
text
==
"商品状态"
{
var
arr
:
Array
<
String
>
?
=
[]
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
for
item
in
shangPinStatusArr
!
{
view
.
tag
=
cell
.
tag
arr
?
.
append
(
item
.
gs_name
!
)
view
.
titleLbl
.
text
=
"请选择商品状态"
}
view
.
delegate
=
self
view
.
dataArr
=
arr
!
if
shangPinStatusArr
!=
nil
{
}
var
arr
:
Array
<
String
>
?
=
[]
if
shangPinStatus
!=
nil
{
for
item
in
shangPinStatusArr
!
{
view
.
selectNum
=
shangPinStatus
!
arr
?
.
append
(
item
.
gs_name
!
)
}
}
view
.
dataArr
=
arr
!
self
.
view
.
addSubview
(
view
)
}
glSelectView
=
view
if
shangPinStatus
!=
nil
{
}
view
.
selectNum
=
shangPinStatus
!
if
cell
.
nameLbl
.
text
==
"运输方式"
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
}
view
.
tag
=
cell
.
tag
self
.
view
.
addSubview
(
view
)
view
.
titleLbl
.
text
=
"请选择运输方式"
glSelectView
=
view
view
.
delegate
=
self
}
view
.
dataArr
=
yunShuTypeArr
if
cell
.
nameLbl
.
text
==
"运输方式"
{
if
yunShuType
!=
nil
{
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
selectNum
=
yunShuType
!
view
.
tag
=
cell
.
tag
view
.
titleLbl
.
text
=
"请选择运输方式"
}
view
.
delegate
=
self
self
.
view
.
addSubview
(
view
)
view
.
dataArr
=
yunShuTypeArr
glSelectView
=
view
if
yunShuType
!=
nil
{
}
view
.
selectNum
=
yunShuType
!
if
cell
.
nameLbl
.
text
==
"预设预付定金时间段"
{
print
(
"定金时间段"
)
}
let
timeSelectV
=
ShowTimeSelectView
(
frame
:
self
.
view
.
window
!.
bounds
)
self
.
view
.
addSubview
(
view
)
timeSelectV
.
titleLbl
.
text
=
"预设预付定金时间段"
glSelectView
=
view
timeSelectV
.
delegate
=
self
}
self
.
view
.
window
?
.
addSubview
(
timeSelectV
)
if
cell
.
nameLbl
.
text
==
"预设预付定金时间段"
{
isWeiTime
=
false
print
(
"定金时间段"
)
let
timeSelectV
=
ShowTimeSelectView
(
frame
:
self
.
view
.
window
!.
bounds
)
}
timeSelectV
.
titleLbl
.
text
=
"预设预付定金时间段"
if
cell
.
nameLbl
.
text
==
"预设预付尾款时间段"
{
timeSelectV
.
delegate
=
self
print
(
"预付尾款时"
)
self
.
view
.
window
?
.
addSubview
(
timeSelectV
)
let
timeSelectV
=
ShowTimeSelectView
(
frame
:
self
.
view
.
window
!.
bounds
)
isWeiTime
=
false
timeSelectV
.
titleLbl
.
text
=
"预设预付尾款时间段"
timeSelectV
.
delegate
=
self
}
self
.
view
.
window
?
.
addSubview
(
timeSelectV
)
if
cell
.
nameLbl
.
text
==
"预设预付尾款时间段"
{
isWeiTime
=
true
print
(
"预付尾款时"
)
}
let
timeSelectV
=
ShowTimeSelectView
(
frame
:
self
.
view
.
window
!.
bounds
)
}
timeSelectV
.
titleLbl
.
text
=
"预设预付尾款时间段"
timeSelectV
.
delegate
=
self
//MARK:--选择预售时间回调数据
self
.
view
.
window
?
.
addSubview
(
timeSelectV
)
var
isWeiTime
:
Bool
=
false
isWeiTime
=
true
func
showTimeSelectByData
(
timeStr
:
String
,
beginDate
:
Date
,
endginDate
:
Date
)
{
}
let
timeInterval
:
TimeInterval
=
beginDate
.
timeIntervalSince1970
}
let
timeIntervalEnd
:
TimeInterval
=
endginDate
.
timeIntervalSince1970
if
isWeiTime
{
//MARK:--选择预售时间回调数据
ysszHolder
.
insert
(
timeStr
,
at
:
2
)
var
isWeiTime
:
Bool
=
false
ysszHolder
.
remove
(
at
:
3
)
func
showTimeSelectByData
(
timeStr
:
String
,
beginDate
:
Date
,
endginDate
:
Date
)
{
wk_time_start
=
Int
(
timeInterval
)
let
timeInterval
:
TimeInterval
=
beginDate
.
timeIntervalSince1970
wk_time_end
=
Int
(
timeIntervalEnd
)
let
timeIntervalEnd
:
TimeInterval
=
endginDate
.
timeIntervalSince1970
}
else
{
if
isWeiTime
{
ysszHolder
.
insert
(
timeStr
,
at
:
1
)
ysszHolder
.
insert
(
timeStr
,
at
:
2
)
ysszHolder
.
remove
(
at
:
2
)
ysszHolder
.
remove
(
at
:
3
)
dj_time_start
=
Int
(
timeInterval
)
wk_time_start
=
Int
(
timeInterval
)
dj_time_end
=
Int
(
timeIntervalEnd
)
wk_time_end
=
Int
(
timeIntervalEnd
)
}
}
else
{
listTbv
.
reloadData
()
ysszHolder
.
insert
(
timeStr
,
at
:
1
)
ysszHolder
.
remove
(
at
:
2
)
}
dj_time_start
=
Int
(
timeInterval
)
dj_time_end
=
Int
(
timeIntervalEnd
)
//MARK:---选择商品分类返回数据
}
var
selectGoodsClassModel
:
GoodsClassModel
?
=
nil
listTbv
.
reloadData
()
func
blackGoodsClass
(
sender
:
GoodsClassModel
)
{
print
(
"选择商品分类返回数据=
\(
sender
)
"
)
}
selectGoodsClassModel
=
sender
tishixxArr
.
insert
(
sender
.
cat_name
!
,
at
:
2
)
//MARK:---选择商品分类返回数据
tishixxArr
.
remove
(
at
:
3
)
var
selectGoodsClassModel
:
GoodsClassModel
?
=
nil
listTbv
.
reloadData
()
func
blackGoodsClass
(
sender
:
GoodsClassModel
)
{
}
print
(
"选择商品分类返回数据=
\(
sender
)
"
)
//MARK:--选择品牌返回的数据
selectGoodsClassModel
=
sender
var
selectPinPaiData
:
GeneralInfoBrandModel
?
=
nil
tishixxArr
.
insert
(
sender
.
cat_name
!
,
at
:
2
)
func
blackSelectPinPaiData
(
sender
:
GeneralInfoBrandModel
)
{
tishixxArr
.
remove
(
at
:
3
)
print
(
"选择品牌返回的数据=
\(
sender
)
"
)
listTbv
.
reloadData
()
selectPinPaiData
=
sender
}
tishixxArr
.
insert
(
sender
.
brand_name
!
,
at
:
3
)
//MARK:--选择品牌返回的数据
tishixxArr
.
remove
(
at
:
4
)
var
selectPinPaiData
:
GeneralInfoBrandModel
?
=
nil
listTbv
.
reloadData
()
func
blackSelectPinPaiData
(
sender
:
GeneralInfoBrandModel
)
{
print
(
"选择品牌返回的数据=
\(
sender
)
"
)
}
selectPinPaiData
=
sender
//MARK:--图片选择处理
tishixxArr
.
insert
(
sender
.
brand_name
!
,
at
:
3
)
func
AddImgCellBtnClick
(
cell
:
AddImgCell
)
{
tishixxArr
.
remove
(
at
:
4
)
if
cell
.
addBtn
.
tag
==
0
{
//仅一张
listTbv
.
reloadData
()
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
//结果处理
}
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
//MARK:--图片选择处理
let
option
=
PHImageRequestOptions
()
func
AddImgCellBtnClick
(
cell
:
AddImgCell
)
{
option
.
isSynchronous
=
true
if
cell
.
addBtn
.
tag
==
0
{
//仅一张
option
.
isNetworkAccessAllowed
=
true
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
for
asset
in
assets
{
//结果处理
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
// print("上传图片==\(image)")
let
option
=
PHImageRequestOptions
()
self
.
singleImgArr
.
append
(
image
!
)
option
.
isSynchronous
=
true
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
0
)
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
.
listTbv
.
reloadData
()
self
.
singleImgArr
.
append
(
image
!
)
}
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
0
)
}
else
{
//可多张
let
num
=
5
-
maxFiveImgsArr
.
count
})
_
=
self
.
presentHGImagePicker
(
maxSelected
:
num
)
{
(
assets
)
in
}
//结果处理
self
.
listTbv
.
reloadData
()
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
}
let
option
=
PHImageRequestOptions
()
}
else
{
//可多张
option
.
isSynchronous
=
true
let
num
=
5
-
maxFiveImgsArr
.
count
option
.
isNetworkAccessAllowed
=
true
_
=
self
.
presentHGImagePicker
(
maxSelected
:
num
)
{
(
assets
)
in
for
asset
in
assets
{
//结果处理
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
// print("上传图片==\(image)")
let
option
=
PHImageRequestOptions
()
self
.
maxFiveImgsArr
.
append
(
image
!
)
option
.
isSynchronous
=
true
let
index
=
Dollar
.
indexOf
(
self
.
maxFiveImgsArr
,
value
:
image
!
)
option
.
isNetworkAccessAllowed
=
true
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
false
,
tag
:
index
!
)
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
()
let
index
=
Dollar
.
indexOf
(
self
.
maxFiveImgsArr
,
value
:
image
!
)
}
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
false
,
tag
:
index
!
)
}
}
})
//MARK: - 修改图片
}
func
ChangeCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
self
.
listTbv
.
reloadData
()
print
(
sender
.
tag
)
}
if
cell
.
addBtn
.
tag
==
0
{
//仅一张
}
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
}
//结果处理
//MARK: - 修改图片
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
func
ChangeCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
let
option
=
PHImageRequestOptions
()
print
(
sender
.
tag
)
option
.
isSynchronous
=
true
if
cell
.
addBtn
.
tag
==
0
{
//仅一张
option
.
isNetworkAccessAllowed
=
true
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
for
asset
in
assets
{
//结果处理
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
// print("上传图片==\(image)")
let
option
=
PHImageRequestOptions
()
self
.
singleImgArr
.
removeAll
()
option
.
isSynchronous
=
true
self
.
singleImgArr
.
append
(
image
!
)
option
.
isNetworkAccessAllowed
=
true
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
0
)
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
.
listTbv
.
reloadData
()
self
.
singleImgArr
.
append
(
image
!
)
}
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
0
)
}
else
{
//可多张
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
})
//结果处理
}
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
self
.
listTbv
.
reloadData
()
let
option
=
PHImageRequestOptions
()
}
option
.
isSynchronous
=
true
}
else
{
//可多张
option
.
isNetworkAccessAllowed
=
true
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
for
asset
in
assets
{
//结果处理
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
// print("上传图片==\(image)")
let
option
=
PHImageRequestOptions
()
self
.
maxFiveImgsArr
.
insert
(
image
!
,
at
:
sender
.
tag
)
option
.
isSynchronous
=
true
self
.
maxFiveImgsArr
.
remove
(
at
:
sender
.
tag
+
1
)
option
.
isNetworkAccessAllowed
=
true
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
false
,
tag
:
sender
.
tag
)
for
asset
in
assets
{
})
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
}
// print("上传图片==\(image)")
self
.
listTbv
.
reloadData
()
self
.
maxFiveImgsArr
.
insert
(
image
!
,
at
:
sender
.
tag
)
}
self
.
maxFiveImgsArr
.
remove
(
at
:
sender
.
tag
+
1
)
}
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
false
,
tag
:
sender
.
tag
)
}
})
//MARK:--图片上传功能
}
var
original_img
:
String
?
=
""
//商品封面图
self
.
listTbv
.
reloadData
()
var
goods_banner
:
Array
<
String
>
?
=
[
""
,
""
,
""
,
""
,
""
]
//商品副图,多张,最多5张,使用一维数组转json格式
}
func
uploadImg
(
imge
:
UIImage
,
isOriginal
:
Bool
,
tag
:
Int
){
}
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
}
let
upLoadImg
=
imge
as!
UIImage
//MARK:--图片上传功能
var
original_img
:
String
?
=
""
//商品封面图
saveFile
(
image
:
upLoadImg
,
[
"user_token"
:
UserToken
as
Any
],
success
:
{
(
data
)
in
var
goods_banner
:
Array
<
String
>
?
=
[
""
,
""
,
""
,
""
,
""
]
//商品副图,多张,最多5张,使用一维数组转json格式
let
dataM
=
data
as!
SaveFileModel
func
uploadImg
(
imge
:
UIImage
,
isOriginal
:
Bool
,
tag
:
Int
){
if
dataM
.
code
==
1
{
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
print
(
"图片上传成功
\(
dataM
.
data
?
.
url
)
"
)
let
upLoadImg
=
imge
as!
UIImage
if
isOriginal
{
self
.
original_img
=
dataM
.
data
?
.
url
!
saveFile
(
image
:
upLoadImg
,
[
"user_token"
:
UserToken
as
Any
],
success
:
{
(
data
)
in
}
else
{
let
dataM
=
data
as!
SaveFileModel
self
.
goods_banner
?
.
insert
((
dataM
.
data
?
.
url
!
)
!
,
at
:
tag
)
if
dataM
.
code
==
1
{
self
.
goods_banner
?
.
remove
(
at
:
tag
+
1
)
print
(
"图片上传成功
\(
dataM
.
data
?
.
url
)
"
)
}
if
isOriginal
{
}
self
.
original_img
=
dataM
.
data
?
.
url
!
})
{
(
error
)
in
}
else
{
print
(
"图片上传失败
\(
error
)
"
)
self
.
goods_banner
?
.
insert
((
dataM
.
data
?
.
url
!
)
!
,
at
:
tag
)
}
self
.
goods_banner
?
.
remove
(
at
:
tag
+
1
)
}
}
}
//MARK: - 删除图片处理
})
{
(
error
)
in
func
DelImgCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
print
(
"图片上传失败
\(
error
)
"
)
if
cell
.
isSingle
==
true
{
}
singleImgArr
.
remove
(
at
:
sender
.
tag
)
self
.
original_img
=
""
}
listTbv
.
reloadData
()
//MARK: - 删除图片处理
}
else
{
func
DelImgCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
maxFiveImgsArr
.
remove
(
at
:
sender
.
tag
)
if
cell
.
isSingle
==
true
{
self
.
goods_banner
?
.
insert
(
""
,
at
:
5
)
singleImgArr
.
remove
(
at
:
sender
.
tag
)
self
.
goods_banner
?
.
remove
(
at
:
sender
.
tag
)
self
.
original_img
=
""
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
}
else
{
}
maxFiveImgsArr
.
remove
(
at
:
sender
.
tag
)
//MARK: - GLAlertView(单选)下的页面
self
.
goods_banner
?
.
insert
(
""
,
at
:
5
)
func
GLAlertSelectViewClick
(
selectNum
:
Int
,
view
:
GLAlertSelectView
)
{
self
.
goods_banner
?
.
remove
(
at
:
sender
.
tag
)
listTbv
.
reloadData
()
switch
view
.
titleLbl
.
text
{
}
case
"请选择商品状态"
:
}
shangPinStatus
=
selectNum
//MARK: - GLAlertView(单选)下的页面
let
item
=
shangPinStatusArr
!
[
selectNum
]
func
GLAlertSelectViewClick
(
selectNum
:
Int
,
view
:
GLAlertSelectView
)
{
print
(
item
.
gs_name
!
)
tishixxArr1
.
insert
(
item
.
gs_name
!
,
at
:
view
.
tag
)
switch
view
.
titleLbl
.
text
{
tishixxArr1
.
remove
(
at
:
view
.
tag
+
1
)
case
"请选择商品状态"
:
break
shangPinStatus
=
selectNum
case
"请选择运输方式"
:
let
item
=
shangPinStatusArr
!
[
selectNum
]
yunShuType
=
selectNum
print
(
item
.
gs_name
!
)
tishixxArr1
.
insert
(
yunShuTypeArr
[
selectNum
],
at
:
view
.
tag
)
tishixxArr1
.
insert
(
item
.
gs_name
!
,
at
:
view
.
tag
)
tishixxArr1
.
remove
(
at
:
view
.
tag
+
1
)
tishixxArr1
.
remove
(
at
:
view
.
tag
+
1
)
break
break
case
"请选择国家"
:
case
"请选择运输方式"
:
countrySelect
=
selectNum
yunShuType
=
selectNum
tishixxArr1
.
insert
(
countryArr
[
selectNum
],
at
:
view
.
tag
)
tishixxArr1
.
insert
(
yunShuTypeArr
[
selectNum
],
at
:
view
.
tag
)
tishixxArr1
.
remove
(
at
:
view
.
tag
+
1
)
tishixxArr1
.
remove
(
at
:
view
.
tag
+
1
)
break
break
case
"请选择国家"
:
default
:
countrySelect
=
selectNum
break
tishixxArr1
.
insert
(
countryArr
[
selectNum
],
at
:
view
.
tag
)
}
tishixxArr1
.
remove
(
at
:
view
.
tag
+
1
)
glSelectView
?
.
removeFromSuperview
()
break
glSelectView
=
nil
listTbv
.
reloadData
()
default
:
}
break
}
//MARK: - GLAlertView(多选)下的页面
glSelectView
?
.
removeFromSuperview
()
func
GLAlertMoreSelectViewClick
(
sender
:
Array
<
Int
>
,
view
:
UIView
)
{
glSelectView
=
nil
listTbv
.
reloadData
()
itemTypeArr
=
sender
}
let
contentArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
//MARK: - GLAlertView(多选)下的页面
let
titles
=
NSMutableArray
()
func
GLAlertMoreSelectViewClick
(
sender
:
Array
<
Int
>
,
view
:
UIView
)
{
titles
.
removeAllObjects
()
for
num
in
itemTypeArr
!
{
itemTypeArr
=
sender
if
num
!=
99
{
let
str
=
"
\(
sender
.
first
!
)
"
titles
.
add
(
contentArr
[
num
])
if
str
!=
"99"
{
}
isYuShou
=
true
}
}
else
{
isYuShou
=
false
if
titles
.
componentsJoined
(
by
:
","
)
.
contains
(
"预售"
)
{
}
isYuShouShangPin
=
true
let
contentArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
}
else
{
let
titles
=
NSMutableArray
()
isYuShouShangPin
=
false
titles
.
removeAllObjects
()
}
for
num
in
itemTypeArr
!
{
print
(
"isYuShouShangPin == "
,
isYuShouShangPin
)
if
num
!=
99
{
tishixxArr
.
insert
(
titles
.
componentsJoined
(
by
:
","
),
at
:
view
.
tag
)
titles
.
add
(
contentArr
[
num
])
tishixxArr
.
remove
(
at
:
view
.
tag
+
1
)
}
if
itemTypeArr
==
[
99
,
99
,
99
,
99
]
{
}
tishixxArr
.
insert
(
"请选择商品类型"
,
at
:
view
.
tag
)
tishixxArr
.
remove
(
at
:
view
.
tag
+
1
)
if
titles
.
componentsJoined
(
by
:
","
)
.
contains
(
"预售"
)
{
}
isYuShouShangPin
=
true
}
else
{
glSelectView
?
.
removeFromSuperview
()
isYuShouShangPin
=
false
glSelectView
=
nil
}
listTbv
.
reloadData
()
print
(
"isYuShouShangPin == "
,
isYuShouShangPin
)
}
tishixxArr
.
insert
(
titles
.
componentsJoined
(
by
:
","
),
at
:
view
.
tag
)
tishixxArr
.
remove
(
at
:
view
.
tag
+
1
)
if
itemTypeArr
==
[
99
,
99
,
99
,
99
]
{
//MARK: - titleAndTFdelegate
tishixxArr
.
insert
(
"请选择商品类型"
,
at
:
view
.
tag
)
func
textFieldContent
(
content
:
String
,
cell
:
TitleAndTFCell
)
{
tishixxArr
.
remove
(
at
:
view
.
tag
+
1
)
switch
cell
.
nameLbl
.
text
{
}
case
"商品名称"
:
itemName
=
content
glSelectView
?
.
removeFromSuperview
()
break
glSelectView
=
nil
case
"起卖数量"
:
listTbv
.
reloadData
()
qiMaiShuLiang
=
content
}
break
case
"关键字"
:
keyWord
=
content
//MARK: - titleAndTFdelegate
break
func
textFieldContent
(
content
:
String
,
cell
:
TitleAndTFCell
)
{
case
"物流费用"
:
switch
cell
.
nameLbl
.
text
{
wuLiuPrice
=
content
case
"商品名称"
:
break
itemName
=
content
default
:
break
break
case
"起卖数量"
:
}
qiMaiShuLiang
=
content
}
break
//MARK: - 编辑规格
case
"关键字"
:
func
ShangPinGguiGeCellEditAction
(
cell
:
ShangPinGguiGeCell
)
{
keyWord
=
content
let
vc
=
CreatNewSpecsViewController
()
break
vc
.
barTitle
=
"编辑规格"
case
"物流费用"
:
vc
.
datasArr
=
guiGeArr
wuLiuPrice
=
content
vc
.
danWeiArr
=
generalInfoModel
?
.
data
?
.
unit
!
break
default
:
let
dataDict
:
GuiGeModel
!
break
if
selectIdx
?
.
item
!=
nil
{
}
dataDict
=
guiGeArr
[
selectIdx
!.
item
]
}
}
else
{
//MARK: - 编辑规格
dataDict
=
guiGeArr
.
first
func
ShangPinGguiGeCellEditAction
(
cell
:
ShangPinGguiGeCell
)
{
}
let
vc
=
CreatNewSpecsViewController
()
vc
.
barTitle
=
"编辑规格"
vc
.
price
=
dataDict
.
price
vc
.
datasArr
=
guiGeArr
vc
.
guiGe
=
dataDict
.
guiGe
vc
.
danWeiArr
=
generalInfoModel
?
.
data
?
.
unit
!
vc
.
weight
=
dataDict
.
weight
vc
.
wenDu
=
dataDict
.
wenDu
let
dataDict
:
GuiGeModel
!
vc
.
danWei
=
dataDict
.
danWei
if
selectIdx
?
.
item
!=
nil
{
vc
.
isJieTiOpen
=
dataDict
.
isJieTiOpen
dataDict
=
guiGeArr
[
selectIdx
!.
item
]
vc
.
isYuShouSetting
=
isYuShouShangPin
!
}
else
{
vc
.
yuShouPrice
=
dataDict
.
yuShouPrice
dataDict
=
guiGeArr
.
first
vc
.
specalArr
=
dataDict
.
specalArr
}
vc
.
jieTiArr
=
dataDict
.
jieTiArr
vc
.
isOpenYSSetting
=
dataDict
.
isOpenYSSetting
vc
.
price
=
dataDict
.
price
vc
.
selectIdx
=
selectIdx
vc
.
guiGe
=
dataDict
.
guiGe
vc
.
itemDanWeiSelect
=
dataDict
.
itemDanWeiSelect
vc
.
weight
=
dataDict
.
weight
vc
.
tempSelect
=
dataDict
.
tempSelect
vc
.
wenDu
=
dataDict
.
wenDu
vc
.
delegate
=
self
vc
.
danWei
=
dataDict
.
danWei
vc
.
DJBiLi
=
dataDict
.
DJBiLi
vc
.
isJieTiOpen
=
dataDict
.
isJieTiOpen
vc
.
ysKuCun
=
dataDict
.
ysKuCun
vc
.
isYuShouSetting
=
isYuShouShangPin
!
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
vc
.
yuShouPrice
=
dataDict
.
yuShouPrice
}
vc
.
specalArr
=
dataDict
.
specalArr
// //MARK: - 删除规格
vc
.
jieTiArr
=
dataDict
.
jieTiArr
func
CreatNewSpecsViewControllerDeleteAction
(
datas
:
Array
<
GuiGeModel
>
,
selectIdx
:
IndexPath
)
{
vc
.
isOpenYSSetting
=
dataDict
.
isOpenYSSetting
guiGeArr
=
datas
vc
.
selectIdx
=
selectIdx
self
.
selectIdx
=
selectIdx
vc
.
itemDanWeiSelect
=
dataDict
.
itemDanWeiSelect
listTbv
.
reloadData
()
vc
.
tempSelect
=
dataDict
.
tempSelect
}
vc
.
delegate
=
self
vc
.
DJBiLi
=
dataDict
.
DJBiLi
//MARK: - 新增规格
vc
.
ysKuCun
=
dataDict
.
ysKuCun
@objc
func
addGuiGe
(){
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
print
(
"新增规格"
)
}
let
vc
=
CreatNewSpecsViewController
()
// //MARK: - 删除规格
vc
.
barTitle
=
"新增规格"
func
CreatNewSpecsViewControllerDeleteAction
(
datas
:
Array
<
GuiGeModel
>
,
selectIdx
:
IndexPath
)
{
vc
.
delegate
=
self
guiGeArr
=
datas
vc
.
danWeiArr
=
generalInfoModel
?
.
data
!.
unit
self
.
selectIdx
=
selectIdx
vc
.
isYuShouSetting
=
isYuShouShangPin
!
listTbv
.
reloadData
()
vc
.
datasArr
=
guiGeArr
}
vc
.
selectIdx
=
selectIdx
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//MARK: - 新增规格
}
@objc
func
addGuiGe
(){
print
(
"新增规格"
)
//MARK: - 新增、编辑规格数据返回
let
vc
=
CreatNewSpecsViewController
()
func
CreatNewSpecsViewControllerSaveAction
(
datas
:
Array
<
GuiGeModel
>
,
selectIdx
:
IndexPath
)
{
vc
.
barTitle
=
"新增规格"
guiGeArr
=
datas
vc
.
delegate
=
self
self
.
selectIdx
=
selectIdx
vc
.
danWeiArr
=
generalInfoModel
?
.
data
!.
unit
listTbv
.
reloadData
()
vc
.
isYuShouSetting
=
isYuShouShangPin
!
}
vc
.
datasArr
=
guiGeArr
vc
.
selectIdx
=
selectIdx
//MARK: - COLLECTIONVIEW DELEGATE
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
minimumLineSpacingForSectionAt
section
:
Int
)
->
CGFloat
{
}
return
0
}
//MARK: - 新增、编辑规格数据返回
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
func
CreatNewSpecsViewControllerSaveAction
(
datas
:
Array
<
GuiGeModel
>
,
selectIdx
:
IndexPath
)
{
return
guiGeArr
.
count
guiGeArr
=
datas
}
self
.
selectIdx
=
selectIdx
listTbv
.
reloadData
()
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
}
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"ItemCell"
,
for
:
indexPath
)
as!
ItemCell
//MARK: - COLLECTIONVIEW DELEGATE
cell
.
tag
=
indexPath
.
row
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
minimumLineSpacingForSectionAt
section
:
Int
)
->
CGFloat
{
cell
.
nameLbl
.
text
=
"规格"
+
"
\(
indexPath
.
item
+
1
)
"
return
0
}
if
indexPath
==
selectIdx
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
return
guiGeArr
.
count
cell
.
lineView
.
isHidden
=
false
}
}
else
{
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
cell
.
lineView
.
isHidden
=
true
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"ItemCell"
,
for
:
indexPath
)
}
as!
ItemCell
return
cell
cell
.
tag
=
indexPath
.
row
cell
.
nameLbl
.
text
=
"规格"
+
"
\(
indexPath
.
item
+
1
)
"
}
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
indexPath
==
selectIdx
{
selectIdx
=
indexPath
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"蓝色字体颜色"
)
//刷新cell
cell
.
lineView
.
isHidden
=
false
collectionView
.
reloadData
()
}
else
{
listTbv
.
reloadRows
(
at
:
[
IndexPath
(
row
:
0
,
section
:
2
)],
with
:
.
none
)
cell
.
nameLbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
}
cell
.
lineView
.
isHidden
=
true
//MARK: - switchClick
}
func
switchClick
(
content
:
UISwitch
,
cell
:
TitleAndSwitchCell
)
{
return
cell
switch
cell
.
namelbl
.
text
{
case
"是否清真"
:
}
shiFouQZ
=
content
.
isOn
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
break
selectIdx
=
indexPath
case
"是否询价"
:
//刷新cell
shiFouXJ
=
content
.
isOn
collectionView
.
reloadData
()
break
listTbv
.
reloadRows
(
at
:
[
IndexPath
(
row
:
0
,
section
:
2
)],
with
:
.
none
)
case
"用户付款是否需要审核"
:
}
shiFouSH
=
content
.
isOn
//MARK: - switchClick
break
func
switchClick
(
content
:
UISwitch
,
cell
:
TitleAndSwitchCell
)
{
default
:
switch
cell
.
namelbl
.
text
{
break
case
"是否清真"
:
}
shiFouQZ
=
content
.
isOn
}
break
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
case
"是否询价"
:
return
6
shiFouXJ
=
content
.
isOn
}
break
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
case
"用户付款是否需要审核"
:
switch
section
{
shiFouSH
=
content
.
isOn
case
0
:
return
7
break
case
1
:
return
2
default
:
case
2
:
return
1
break
case
3
:
return
4
}
case
4
:
return
5
}
default
:
return
1
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
}
return
6
}
}
//MARK: - tableview footer
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
switch
section
{
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
10
))
case
0
:
return
7
view
.
backgroundColor
=
UIColor
(
named
:
"app底色"
)
case
1
:
return
2
return
view
case
2
:
return
1
}
case
3
:
return
4
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
case
4
:
return
5
if
section
==
3
{
default
:
return
1
if
isYuShouShangPin
==
false
{
}
return
0.001
}
}
//MARK: - tableview footer
}
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
return
10
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
10
))
}
view
.
backgroundColor
=
UIColor
(
named
:
"app底色"
)
//MARK: - tableview header
return
view
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
}
if
section
==
3
{
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
if
isYuShouShangPin
==
false
{
if
section
==
3
{
return
UIView
()
if
isYuShouShangPin
==
false
{
}
return
0.001
}
}
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
39
))
}
let
lbl
=
UILabel
(
frame
:
CGRect
(
x
:
15
,
y
:
15
,
width
:
fullScreenWidth
,
height
:
21
))
return
10
lbl
.
text
=
titleArr
[
section
]
}
lbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
//MARK: - tableview header
lbl
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
15
)
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
view
.
addSubview
(
lbl
)
if
section
==
3
{
if
section
==
2
&&
guiGeArr
.
count
>
0
{
if
isYuShouShangPin
==
false
{
let
btn
=
UIButton
()
return
UIView
()
btn
.
setTitle
(
" 新增"
,
for
:
.
normal
)
}
btn
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
13
)
}
btn
.
setTitleColor
(
UIColor
(
named
:
"蓝色字体颜色"
),
for
:
.
normal
)
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
39
))
btn
.
setImage
(
UIImage
(
named
:
"jiahaoXG"
),
for
:
.
normal
)
let
lbl
=
UILabel
(
frame
:
CGRect
(
x
:
15
,
y
:
15
,
width
:
fullScreenWidth
,
height
:
21
))
view
.
addSubview
(
btn
)
lbl
.
text
=
titleArr
[
section
]
btn
.
sizeToFit
()
lbl
.
textColor
=
UIColor
(
named
:
"标题字颜色"
)
btn
.
snp
.
makeConstraints
{
(
make
)
in
lbl
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
15
)
make
.
centerY
.
equalTo
(
lbl
.
snp_centerY
)
view
.
addSubview
(
lbl
)
make
.
right
.
equalTo
(
-
15
)
if
section
==
2
&&
guiGeArr
.
count
>
0
{
make
.
height
.
equalTo
(
btn
.
frame
.
size
.
height
)
let
btn
=
UIButton
()
make
.
width
.
equalTo
(
btn
.
frame
.
size
.
width
)
btn
.
setTitle
(
" 新增"
,
for
:
.
normal
)
}
btn
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
13
)
let
btn2
=
UIButton
()
btn
.
setTitleColor
(
UIColor
(
named
:
"蓝色字体颜色"
),
for
:
.
normal
)
view
.
addSubview
(
btn2
)
btn
.
setImage
(
UIImage
(
named
:
"jiahaoXG"
),
for
:
.
normal
)
btn2
.
snp
.
makeConstraints
{
(
make
)
in
view
.
addSubview
(
btn
)
make
.
top
.
right
.
bottom
.
equalTo
(
0
)
btn
.
sizeToFit
()
make
.
width
.
equalTo
(
80
)
btn
.
snp
.
makeConstraints
{
(
make
)
in
}
make
.
centerY
.
equalTo
(
lbl
.
snp_centerY
)
btn2
.
addTarget
(
self
,
action
:
#selector(
addGuiGe
)
,
for
:
.
touchUpInside
)
make
.
right
.
equalTo
(
-
15
)
if
guiGeArr
.
count
>
1
{
make
.
height
.
equalTo
(
btn
.
frame
.
size
.
height
)
view
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
80
)
make
.
width
.
equalTo
(
btn
.
frame
.
size
.
width
)
let
collectionView
=
UICollectionView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
0
,
height
:
0
),
collectionViewLayout
:
layout
)
}
collectionView
.
backgroundColor
=
UIColor
.
white
let
btn2
=
UIButton
()
collectionView
.
delegate
=
self
view
.
addSubview
(
btn2
)
collectionView
.
dataSource
=
self
btn2
.
snp
.
makeConstraints
{
(
make
)
in
view
.
addSubview
(
collectionView
)
make
.
top
.
right
.
bottom
.
equalTo
(
0
)
collectionView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
width
.
equalTo
(
80
)
make
.
bottom
.
left
.
right
.
equalTo
(
0
)
}
make
.
height
.
equalTo
(
41
)
btn2
.
addTarget
(
self
,
action
:
#selector(
addGuiGe
)
,
for
:
.
touchUpInside
)
}
if
guiGeArr
.
count
>
1
{
collectionView
.
showsHorizontalScrollIndicator
=
false
view
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
80
)
collectionView
.
isPagingEnabled
=
true
let
collectionView
=
UICollectionView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
0
,
height
:
0
),
collectionViewLayout
:
layout
)
layout
.
itemSize
=
CGSize
(
width
:
fullScreenWidth
*
0.5
,
height
:
41
)
collectionView
.
backgroundColor
=
UIColor
.
white
layout
.
scrollDirection
=
.
horizontal
collectionView
.
delegate
=
self
collectionView
.
collectionViewLayout
=
layout
collectionView
.
dataSource
=
self
collectionView
.
register
(
UINib
(
nibName
:
"ItemCell"
,
bundle
:
nil
),
forCellWithReuseIdentifier
:
"ItemCell"
)
view
.
addSubview
(
collectionView
)
if
guiGeArr
.
count
>
0
{
collectionView
.
snp
.
makeConstraints
{
(
make
)
in
collectionView
.
layoutIfNeeded
()
make
.
bottom
.
left
.
right
.
equalTo
(
0
)
collectionView
.
scrollToItem
(
at
:
selectIdx
!
,
at
:
.
centeredHorizontally
,
animated
:
false
)
make
.
height
.
equalTo
(
41
)
}
}
}
collectionView
.
showsHorizontalScrollIndicator
=
false
}
collectionView
.
isPagingEnabled
=
true
return
view
layout
.
itemSize
=
CGSize
(
width
:
fullScreenWidth
*
0.5
,
height
:
41
)
}
layout
.
scrollDirection
=
.
horizontal
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
collectionView
.
collectionViewLayout
=
layout
if
section
==
3
{
collectionView
.
register
(
UINib
(
nibName
:
"ItemCell"
,
bundle
:
nil
),
forCellWithReuseIdentifier
:
"ItemCell"
)
if
isYuShouShangPin
==
false
{
if
guiGeArr
.
count
>
0
{
return
0.001
collectionView
.
layoutIfNeeded
()
}
collectionView
.
scrollToItem
(
at
:
selectIdx
!
,
at
:
.
centeredHorizontally
,
animated
:
false
)
}
}
if
section
==
2
{
}
if
guiGeArr
.
count
>
1
{
}
return
80
return
view
}
}
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
return
39
if
section
==
3
{
}
if
isYuShouShangPin
==
false
{
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
return
0.001
switch
indexPath
.
section
{
}
case
0
:
return
49
}
case
1
:
return
148.5
if
section
==
2
{
case
2
:
if
guiGeArr
.
count
>
1
{
if
guiGeArr
.
count
>
0
{
return
80
return
146
}
}
}
return
123.5
return
39
case
3
:
}
if
isYuShouShangPin
==
false
{
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
return
0.01
switch
indexPath
.
section
{
}
else
{
case
0
:
return
49
return
49
case
1
:
return
148.5
}
case
2
:
case
4
:
return
49
if
guiGeArr
.
count
>
0
{
default
:
return
146
return
98
}
return
123.5
}
case
3
:
}
if
isYuShouShangPin
==
false
{
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
{
return
0.01
faHuoTime
=
str
}
else
{
print
(
faHuoTime
)
return
49
}
}
override
func
backAction
()
{
case
4
:
return
49
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
default
:
}
return
98
//MARK:--处理规格数据
}
var
specifications
=
""
}
var
shop_price
:
Float
=
0.0
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
{
var
goods_unit
=
""
faHuoTime
=
str
var
sku_info
=
""
print
(
faHuoTime
)
func
getUpSkuInfoByData
(
dataArr
:
Array
<
GuiGeModel
>
)
{
}
var
price
:
Float
=
0.0
override
func
backAction
()
{
var
isgetP
:
Bool
=
false
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
var
model
:
GuiGeModel
?
=
nil
}
var
skuArr
:
Array
<
Any
>
=
[]
func
textFieldShouldReturn
(
_
textField
:
UITextField
)
->
Bool
{
dataArr
.
forEach
{
(
md
)
in
IQKeyboardManager
.
shared
.
resignFirstResponder
()
if
isPurnNumber
(
str
:
md
.
price
)
{
}
if
isgetP
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
let
peiceP
=
Float
(
md
.
price
)
!
//第n个售价(n > 1)
IQKeyboardManager
.
shared
.
resignFirstResponder
()
if
peiceP
<
price
{
}
price
=
peiceP
model
=
md
//MARK:--处理规格数据
}
var
specifications
=
""
}
else
{
var
shop_price
:
Float
=
0.0
price
=
Float
(
md
.
price
)
!
//第一个售价
var
goods_unit
=
""
model
=
md
var
sku_info
=
""
isgetP
=
true
func
getUpSkuInfoByData
(
dataArr
:
Array
<
GuiGeModel
>
)
{
}
var
price
:
Float
=
0.0
}
var
isgetP
:
Bool
=
false
var
model
:
GuiGeModel
?
=
nil
var
skuArr
:
Array
<
Any
>
=
[]
//普通阶梯价
dataArr
.
forEach
{
(
md
)
in
var
is_tiered
=
0
if
isPurnNumber
(
str
:
md
.
price
)
{
var
tiered_pri
:
Dictionary
<
String
,
String
>
=
[:]
if
isgetP
{
let
peiceP
=
Float
(
md
.
price
)
!
//第n个售价(n > 1)
if
md
.
isJieTiOpen
{
if
peiceP
<
price
{
is_tiered
=
1
price
=
peiceP
md
.
jieTiArr
.
forEach
{
(
obj
)
in
model
=
md
let
str
=
obj
as!
String
}
let
arr
=
str
.
components
(
separatedBy
:
"_"
)
}
else
{
let
priceStr
=
arr
[
0
]
price
=
Float
(
md
.
price
)
!
//第一个售价
let
coutStr
=
arr
[
1
]
model
=
md
isgetP
=
true
if
isPurnNumber
(
str
:
priceStr
)
{
}
let
specaP
=
Float
(
priceStr
)
!
}
if
specaP
<
price
{
price
=
specaP
model
=
md
//普通阶梯价
var
is_tiered
=
0
var
tiered_pri
:
Dictionary
<
String
,
String
>
=
[:]
if
md
.
isJieTiOpen
{
is_tiered
=
1
md
.
jieTiArr
.
forEach
{
(
obj
)
in
let
str
=
obj
as!
String
let
arr
=
str
.
components
(
separatedBy
:
"_"
)
let
priceStr
=
arr
[
0
]
let
coutStr
=
arr
[
1
]
if
isPurnNumber
(
str
:
priceStr
)
{
let
specaP
=
Float
(
priceStr
)
!
if
specaP
<
price
{
price
=
specaP
model
=
md
}
}
tiered_pri
.
updateValue
(
priceStr
,
forKey
:
coutStr
)
}
}
//预售价
var
is_adsale_tiered
=
0
var
adsale_tiered_pri
:
Dictionary
<
String
,
String
>
=
[:]
if
md
.
isOpenYSSetting
{
if
isPurnNumber
(
str
:
md
.
yuShouPrice
)
{
let
yushoup
=
Float
(
md
.
yuShouPrice
)
!
if
yushoup
<
price
{
price
=
yushoup
model
=
md
}
}
if
md
.
isJieTiOpen
{
is_adsale_tiered
=
1
//每一个预售阶梯价
md
.
specalArr
.
forEach
{
(
obj
)
in
let
str
=
obj
as!
String
let
arr
=
str
.
components
(
separatedBy
:
"_"
)
let
priceStr
=
arr
[
0
]
let
coutStr
=
arr
[
1
]
if
isPurnNumber
(
str
:
priceStr
)
{
let
specaP
=
Float
(
priceStr
)
!
if
specaP
<
price
{
price
=
specaP
model
=
md
}
}
adsale_tiered_pri
.
updateValue
(
priceStr
,
forKey
:
coutStr
)
}
}
}
}
}
tiered_pri
.
updateValue
(
priceStr
,
forKey
:
coutStr
)
let
pack_attr
=
[
"l"
:
"0"
,
"w"
:
"0"
,
"h"
:
"0"
,
"wg"
:
md
.
weight
,
"v"
:
"0"
]
var
is_open_adsale
=
0
var
adsale_pri
=
""
var
adsale_inventory
=
""
var
pct
=
""
if
md
.
isOpenYSSetting
{
is_open_adsale
=
1
adsale_pri
=
md
.
yuShouPrice
adsale_inventory
=
md
.
ysKuCun
pct
=
md
.
DJBiLi
}
}
var
sku
=
[
"sku_sn"
:
""
,
}
"spec_id"
:
"1"
,
"attr"
:
md
.
guiGe
,
"pack_attr"
:
pack_attr
,
//预售价
"refrigerate"
:
md
.
wenDu
,
var
is_adsale_tiered
=
0
"unit"
:
md
.
danWei
,
var
adsale_tiered_pri
:
Dictionary
<
String
,
String
>
=
[:]
"price"
:
md
.
price
,
if
md
.
isOpenYSSetting
{
"is_tiered"
:
is_tiered
,
if
isPurnNumber
(
str
:
md
.
yuShouPrice
)
{
"is_open_adsale"
:
is_open_adsale
,
let
yushoup
=
Float
(
md
.
yuShouPrice
)
!
"adsale_pri"
:
adsale_pri
,
if
yushoup
<
price
{
"adsale_inventory"
:
adsale_inventory
,
price
=
yushoup
"pct"
:
pct
,
model
=
md
"is_adsale_tiered"
:
is_adsale_tiered
]
as
[
String
:
Any
]
}
}
if
tiered_pri
.
keys
.
count
>
0
{
if
md
.
isJieTiOpen
{
sku
.
updateValue
(
tiered_pri
,
forKey
:
"tiered_pri"
)
is_adsale_tiered
=
1
}
else
{
//每一个预售阶梯价
sku
.
updateValue
(
""
,
forKey
:
"tiered_pri"
)
md
.
specalArr
.
forEach
{
(
obj
)
in
let
str
=
obj
as!
String
}
let
arr
=
str
.
components
(
separatedBy
:
"_"
)
if
adsale_tiered_pri
.
keys
.
count
>
0
{
let
priceStr
=
arr
[
0
]
sku
.
updateValue
(
adsale_tiered_pri
,
forKey
:
"adsale_tiered_pri"
)
let
coutStr
=
arr
[
1
]
}
else
{
sku
.
updateValue
(
""
,
forKey
:
"adsale_tiered_pri"
)
if
isPurnNumber
(
str
:
priceStr
)
{
}
let
specaP
=
Float
(
priceStr
)
!
if
specaP
<
price
{
skuArr
.
append
(
sku
)
price
=
specaP
model
=
md
}
}
if
skuArr
.
count
>
0
{
}
sku_info
=
dataChangeString
(
sender
:
skuArr
)
}
adsale_tiered_pri
.
updateValue
(
priceStr
,
forKey
:
coutStr
)
shop_price
=
price
if
model
!=
nil
{
}
specifications
=
model
!.
guiGe
}
goods_unit
=
model
!.
danWei
}
}
let
pack_attr
=
[
"l"
:
"0"
,
"w"
:
"0"
,
"h"
:
"0"
,
"wg"
:
md
.
weight
,
"v"
:
"0"
]
var
is_open_adsale
=
0
var
adsale_pri
=
""
var
adsale_inventory
=
""
var
pct
=
""
if
md
.
isOpenYSSetting
{
is_open_adsale
=
1
adsale_pri
=
md
.
yuShouPrice
adsale_inventory
=
md
.
ysKuCun
pct
=
md
.
DJBiLi
}
var
sku
=
[
"sku_sn"
:
""
,
"spec_id"
:
"1"
,
"attr"
:
md
.
guiGe
,
"pack_attr"
:
pack_attr
,
"refrigerate"
:
md
.
wenDu
,
"unit"
:
md
.
danWei
,
"price"
:
md
.
price
,
"is_tiered"
:
is_tiered
,
"is_open_adsale"
:
is_open_adsale
,
"adsale_pri"
:
adsale_pri
,
"adsale_inventory"
:
adsale_inventory
,
"pct"
:
pct
,
"is_adsale_tiered"
:
is_adsale_tiered
]
as
[
String
:
Any
]
if
tiered_pri
.
keys
.
count
>
0
{
sku
.
updateValue
(
tiered_pri
,
forKey
:
"tiered_pri"
)
}
else
{
sku
.
updateValue
(
""
,
forKey
:
"tiered_pri"
)
}
if
adsale_tiered_pri
.
keys
.
count
>
0
{
sku
.
updateValue
(
adsale_tiered_pri
,
forKey
:
"adsale_tiered_pri"
)
}
else
{
sku
.
updateValue
(
""
,
forKey
:
"adsale_tiered_pri"
)
}
skuArr
.
append
(
sku
)
}
if
skuArr
.
count
>
0
{
sku_info
=
dataChangeString
(
sender
:
skuArr
)
}
shop_price
=
price
if
model
!=
nil
{
specifications
=
model
!.
guiGe
goods_unit
=
model
!.
danWei
}
}
}
}
}
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
View file @
d5f44a55
...
@@ -60,7 +60,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -60,7 +60,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
var
isYuShouShangPin
:
Bool
?
//是否为预售商品
var
isYuShouShangPin
:
Bool
?
//是否为预售商品
var
itemTypeArr
:
Array
<
Int
>
?
=
[]
//多选
var
itemTypeArr
:
Array
<
Int
>
?
=
[]
//多选
var
isYuShou
:
Bool
=
false
//是否预售
var
shangPinStatus
:
Int
?
=
0
//商品状态
var
shangPinStatus
:
Int
?
=
0
//商品状态
var
yunShuType
:
Int
?
=
0
//运输类型
var
yunShuType
:
Int
?
=
0
//运输类型
var
maxFiveImgsArr
:
Array
<
UIImage
>
=
[]
//多图
var
maxFiveImgsArr
:
Array
<
UIImage
>
=
[]
//多图
...
@@ -770,14 +769,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -770,14 +769,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
//MARK: - GLAlertView(多选)下的页面
//MARK: - GLAlertView(多选)下的页面
func
GLAlertMoreSelectViewClick
(
sender
:
Array
<
Int
>
,
view
:
UIView
)
{
func
GLAlertMoreSelectViewClick
(
sender
:
Array
<
Int
>
,
view
:
UIView
)
{
itemTypeArr
=
sender
itemTypeArr
=
sender
let
str
=
"
\(
sender
.
first
!
)
"
if
str
!=
"99"
{
isYuShou
=
true
}
else
{
isYuShou
=
false
}
let
contentArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
let
contentArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
let
titles
=
NSMutableArray
()
let
titles
=
NSMutableArray
()
titles
.
removeAllObjects
()
titles
.
removeAllObjects
()
...
@@ -838,7 +830,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -838,7 +830,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
else
{
}
else
{
dataDict
=
guiGeArr
.
first
dataDict
=
guiGeArr
.
first
}
}
vc
.
price
=
dataDict
.
price
vc
.
price
=
dataDict
.
price
vc
.
guiGe
=
dataDict
.
guiGe
vc
.
guiGe
=
dataDict
.
guiGe
vc
.
weight
=
dataDict
.
weight
vc
.
weight
=
dataDict
.
weight
...
@@ -856,6 +847,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -856,6 +847,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
vc
.
delegate
=
self
vc
.
delegate
=
self
vc
.
DJBiLi
=
dataDict
.
DJBiLi
vc
.
DJBiLi
=
dataDict
.
DJBiLi
vc
.
ysKuCun
=
dataDict
.
ysKuCun
vc
.
ysKuCun
=
dataDict
.
ysKuCun
vc
.
isYsJieTiOpen
=
dataDict
.
isYsJieTiOpen
vc
.
selectYuShou
=
dataDict
.
selectYuShou
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
// //MARK: - 删除规格
// //MARK: - 删除规格
...
@@ -1058,13 +1051,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -1058,13 +1051,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
override
func
backAction
()
{
override
func
backAction
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
func
textFieldShouldReturn
(
_
textField
:
UITextField
)
->
Bool
{
IQKeyboardManager
.
shared
.
resignFirstResponder
()
}
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
IQKeyboardManager
.
shared
.
resignFirstResponder
()
}
//MARK:--处理规格数据
//MARK:--处理规格数据
var
specifications
=
""
var
specifications
=
""
var
shop_price
:
Float
=
0.0
var
shop_price
:
Float
=
0.0
...
...
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
View file @
d5f44a55
...
@@ -35,16 +35,19 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -35,16 +35,19 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
var
collectView
:
UICollectionView
?
var
collectView
:
UICollectionView
?
var
datasArr
:
Array
<
GuiGeModel
>
=
[]
var
datasArr
:
Array
<
GuiGeModel
>
=
[]
var
dataModel
=
GuiGeModel
()
var
dataModel
=
GuiGeModel
()
let
titleArray
=
[
"售价:"
,
"规格:"
,
"重量:"
,
"温藏:"
,
"单位:"
]
let
titleArray
=
[
"售价:"
,
"规格:"
,
"重量:"
,
"温藏:"
,
"单位:"
]
let
pliceHolderArr
=
[
"请输入商品售价"
,
"请输入商品规格"
,
"请输入商品重量"
,
"请选择商品温藏"
,
"请选择商品单位"
]
let
pliceHolderArr
=
[
"请输入商品售价"
,
"请输入商品规格"
,
"请输入商品重量"
,
"请选择商品温藏"
,
"请选择商品单位"
]
@IBOutlet
weak
var
bottomBtn
:
LGButton
!
@IBOutlet
weak
var
bottomBtn
:
LGButton
!
@IBOutlet
weak
var
listTbv
:
UITableView
!
@IBOutlet
weak
var
listTbv
:
UITableView
!
var
selectIdx
:
IndexPath
?
var
selectIdx
:
IndexPath
?
var
isYuShouSetting
=
false
//打开预售
var
isYuShouSetting
=
false
//打开预售
// var isJieTiJiaSetting = false
var
isJieTiOpen
=
false
//控制阶梯价是否打开
var
isJieTiOpen
=
false
//控制阶梯价是否打开
var
isYsJieTiOpen
=
false
//控制预售阶梯是否打开
var
isOpenYSSetting
=
false
//是否打开预售设置
var
isOpenYSSetting
=
false
//是否打开预售设置
var
selectYuShou
:
Bool
=
false
//是否选择设置预售价格
var
selectYuShou
=
false
//是否选择设置预售价格
//选择页面
//选择页面
var
selectView
:
GLAlertSelectView
?
=
nil
var
selectView
:
GLAlertSelectView
?
=
nil
...
@@ -180,9 +183,12 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -180,9 +183,12 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
dataModel
.
weight
=
weight
dataModel
.
weight
=
weight
dataModel
.
wenDu
=
wenDu
dataModel
.
wenDu
=
wenDu
dataModel
.
danWei
=
danWei
dataModel
.
danWei
=
danWei
dataModel
.
isYsJieTiOpen
=
isYsJieTiOpen
dataModel
.
jieTiArr
=
jieTiArr
as!
Array
<
Any
>
dataModel
.
jieTiArr
=
jieTiArr
as!
Array
<
Any
>
dataModel
.
specalArr
=
specalArr
as!
Array
<
Any
>
dataModel
.
specalArr
=
specalArr
as!
Array
<
Any
>
dataModel
.
yuShouPrice
=
yuShouPrice
dataModel
.
yuShouPrice
=
yuShouPrice
print
(
"save == "
,
selectYuShou
)
dataModel
.
selectYuShou
=
selectYuShou
dataModel
.
itemDanWeiSelect
=
itemDanWeiSelect
dataModel
.
itemDanWeiSelect
=
itemDanWeiSelect
dataModel
.
tempSelect
=
tempSelect
dataModel
.
tempSelect
=
tempSelect
dataModel
.
isJieTiOpen
=
isJieTiOpen
dataModel
.
isJieTiOpen
=
isJieTiOpen
...
@@ -190,10 +196,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -190,10 +196,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
dataModel
.
DJBiLi
=
DJBiLi
dataModel
.
DJBiLi
=
DJBiLi
dataModel
.
ysKuCun
=
ysKuCun
dataModel
.
ysKuCun
=
ysKuCun
if
barTitle
?
.
contains
(
"编辑"
)
==
true
{
if
barTitle
?
.
contains
(
"编辑"
)
==
true
{
datasArr
.
insert
(
dataModel
,
at
:
selectIdx
!.
item
)
datasArr
.
insert
(
dataModel
,
at
:
selectIdx
!.
item
)
datasArr
.
remove
(
at
:
selectIdx
!.
item
+
1
)
datasArr
.
remove
(
at
:
selectIdx
!.
item
+
1
)
}
else
{
}
else
{
datasArr
.
append
(
dataModel
)
datasArr
.
append
(
dataModel
)
selectIdx
?
.
item
=
datasArr
.
count
-
1
selectIdx
?
.
item
=
datasArr
.
count
-
1
...
@@ -240,9 +244,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -240,9 +244,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
if
section
==
2
{
if
section
==
2
{
if
selectYuShou
{
//预售
if
selectYuShou
{
//预售
return
specalArr
.
count
return
specalArr
.
count
}
else
{
//非预售
}
else
{
//非预售
return
jieTiArr
.
count
return
jieTiArr
.
count
}
}
...
@@ -392,11 +394,14 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -392,11 +394,14 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
}
}
if
indexPath
.
section
==
2
{
if
indexPath
.
section
==
2
{
if
isJieTiOpen
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
return
49
}
if
isYsJieTiOpen
&&
selectYuShou
{
return
49
return
49
}
else
{
return
0.001
}
}
return
0.001
}
}
return
49
return
49
}
}
...
@@ -405,30 +410,30 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -405,30 +410,30 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
let
view
=
UIView
()
let
view
=
UIView
()
if
section
==
2
{
//阶梯价设置
if
section
==
2
{
//阶梯价设置
let
view
=
NewCreateHeader
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
if
isYuShouSetting
{
//预售阶梯价
view
.
delegate
=
self
view
.
infoSw
.
isOn
=
isJieTiOpen
if
isJieTiOpen
==
false
{
return
view
}
if
isYuShouSetting
{
//阶梯价
let
view
=
TitleAndSwitchHeaderView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
90
))
let
view
=
TitleAndSwitchHeaderView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
90
))
view
.
delegate
=
self
view
.
delegate
=
self
print
(
"selectYuShou == "
,
selectYuShou
)
view
.
selectYuShou
=
selectYuShou
view
.
selectYuShou
=
selectYuShou
view
.
infoSW
.
isOn
=
isJieTiOpen
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
.
isOn
=
isJieTiOpen
if
isJieTiOpen
==
false
{
return
view
}
return
view
return
view
}
}
return
view
}
}
return
view
return
view
}
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
if
section
!=
0
{
if
section
!=
0
{
if
section
==
2
{
if
section
==
2
{
if
isYuShouSetting
&&
isJieTiOpen
{
if
isYuShouSetting
{
return
90
return
90
}
}
return
59
return
59
...
@@ -440,7 +445,12 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -440,7 +445,12 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
//footer
//footer
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
if
section
==
2
{
if
section
==
2
{
if
isJieTiOpen
{
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
))
let
view
=
NewCreateFooter
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
fullScreenWidth
,
height
:
49
))
view
.
delegate
=
self
view
.
delegate
=
self
return
view
return
view
...
@@ -451,7 +461,10 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -451,7 +461,10 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
if
section
==
2
{
if
section
==
2
{
if
isJieTiOpen
{
if
isJieTiOpen
&&
selectYuShou
==
false
{
return
49
}
if
isYsJieTiOpen
&&
selectYuShou
{
return
49
return
49
}
}
}
}
...
@@ -537,8 +550,11 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -537,8 +550,11 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
func
switchStatus
(
sender
:
UISwitch
)
{
//阶梯价设置
func
switchStatus
(
sender
:
UISwitch
)
{
//阶梯价设置
isJieTiOpen
=
sender
.
isOn
if
sender
.
tag
==
99
{
// isJieTiJiaSetting = sender.isOn
isYsJieTiOpen
=
sender
.
isOn
}
else
{
isJieTiOpen
=
sender
.
isOn
}
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
}
...
@@ -583,11 +599,9 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -583,11 +599,9 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
if
selectYuShou
{
if
selectYuShou
{
specalArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
specalArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
print
(
specalArr
)
specalArr
.
remove
(
at
:
cell
.
tag
+
1
)
specalArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
else
{
}
else
{
jieTiArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
jieTiArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
print
(
jieTiArr
)
jieTiArr
.
remove
(
at
:
cell
.
tag
+
1
)
jieTiArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
}
}
}
...
@@ -638,7 +652,9 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -638,7 +652,9 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
isJieTiOpen
=
dataDict
.
isJieTiOpen
isJieTiOpen
=
dataDict
.
isJieTiOpen
isOpenYSSetting
=
dataDict
.
isOpenYSSetting
isOpenYSSetting
=
dataDict
.
isOpenYSSetting
DJBiLi
=
dataDict
.
DJBiLi
DJBiLi
=
dataDict
.
DJBiLi
isYsJieTiOpen
=
dataDict
.
isYsJieTiOpen
ysKuCun
=
dataDict
.
ysKuCun
ysKuCun
=
dataDict
.
ysKuCun
selectYuShou
=
dataDict
.
selectYuShou
listTbv
.
reloadData
()
listTbv
.
reloadData
()
collectionView
.
reloadData
()
collectionView
.
reloadData
()
}
}
...
...
GeliBusinessPlatform/ViewController/新增规格/GuiGeModel.swift
View file @
d5f44a55
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
import
Foundation
import
Foundation
class
GuiGeModel
:
NSObject
{
class
GuiGeModel
:
NSObject
{
///sku_id
var
sku_id
:
Int
?
///售价
///售价
var
price
:
String
=
""
var
price
:
String
=
""
///规格
///规格
...
@@ -39,4 +41,8 @@ class GuiGeModel: NSObject {
...
@@ -39,4 +41,8 @@ class GuiGeModel: NSObject {
var
isJieTiOpen
:
Bool
=
false
var
isJieTiOpen
:
Bool
=
false
///是否打开预售设置
///是否打开预售设置
var
isOpenYSSetting
:
Bool
=
false
var
isOpenYSSetting
:
Bool
=
false
///是否打开预售阶梯价
var
isYsJieTiOpen
:
Bool
=
false
///是否选择预售阶梯
var
selectYuShou
:
Bool
=
false
}
}
GeliBusinessPlatform/ViewController/新增规格/普通+预售header/TitleAndSwitchHeaderView.swift
View file @
d5f44a55
...
@@ -17,15 +17,17 @@ class TitleAndSwitchHeaderView: UIView {
...
@@ -17,15 +17,17 @@ class TitleAndSwitchHeaderView: UIView {
@IBOutlet
weak
var
bottomLine
:
UIView
!
@IBOutlet
weak
var
bottomLine
:
UIView
!
var
selectYuShou
:
Bool
=
false
{
var
selectYuShou
:
Bool
=
false
{
didSet
{
didSet
{
print
(
"abababababab === "
,
selectYuShou
)
var
sender
=
0
var
sender
=
0
if
selectYuShou
{
if
selectYuShou
{
sender
=
1
sender
=
1
leftBtn
.
setTitleColor
(
UIColor
(
named
:
"标题字颜色"
),
for
:
.
normal
)
leftBtn
.
setTitleColor
(
UIColor
(
named
:
"标题字颜色"
),
for
:
.
normal
)
rightBtn
.
setTitleColor
(
UIColor
(
named
:
"按钮渐变色下,字体颜色"
),
for
:
.
normal
)
rightBtn
.
setTitleColor
(
UIColor
(
named
:
"按钮渐变色下,字体颜色"
),
for
:
.
normal
)
ysSettingView
.
isHidden
=
false
}
else
{
}
else
{
leftBtn
.
setTitleColor
(
UIColor
(
named
:
"按钮渐变色下,字体颜色"
),
for
:
.
normal
)
leftBtn
.
setTitleColor
(
UIColor
(
named
:
"按钮渐变色下,字体颜色"
),
for
:
.
normal
)
rightBtn
.
setTitleColor
(
UIColor
(
named
:
"标题字颜色"
),
for
:
.
normal
)
rightBtn
.
setTitleColor
(
UIColor
(
named
:
"标题字颜色"
),
for
:
.
normal
)
ysSettingView
.
isHidden
=
true
}
}
let
x
=
CGFloat
(
sender
)
*
fullScreenWidth
*
0.5
let
x
=
CGFloat
(
sender
)
*
fullScreenWidth
*
0.5
bottomLine
.
snp
.
updateConstraints
{
(
make
)
in
bottomLine
.
snp
.
updateConstraints
{
(
make
)
in
...
@@ -38,6 +40,8 @@ class TitleAndSwitchHeaderView: UIView {
...
@@ -38,6 +40,8 @@ class TitleAndSwitchHeaderView: UIView {
}
}
var
contentView
:
UIView
!
var
contentView
:
UIView
!
var
delegate
:
TitleAndSwitchHeaderViewDelegate
?
var
delegate
:
TitleAndSwitchHeaderViewDelegate
?
@IBOutlet
weak
var
ysSettingView
:
UIView
!
@IBOutlet
weak
var
ysInfoSw
:
UISwitch
!
@IBOutlet
weak
var
infoSW
:
UISwitch
!
@IBOutlet
weak
var
infoSW
:
UISwitch
!
//初始化时将xib中的view添加进来
//初始化时将xib中的view添加进来
override
init
(
frame
:
CGRect
)
{
override
init
(
frame
:
CGRect
)
{
...
@@ -45,6 +49,14 @@ class TitleAndSwitchHeaderView: UIView {
...
@@ -45,6 +49,14 @@ class TitleAndSwitchHeaderView: UIView {
contentView
=
loadViewFromNib
()
contentView
=
loadViewFromNib
()
addSubview
(
contentView
)
addSubview
(
contentView
)
ysInfoSw
.
transform
=
CGAffineTransform
(
scaleX
:
0.8
,
y
:
0.8
)
ysInfoSw
.
tag
=
99
ysInfoSw
.
addTarget
(
self
,
action
:
#selector(
switchChange(sender:)
)
,
for
:
.
valueChanged
)
contentView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
top
.
right
.
bottom
.
equalToSuperview
()
}
infoSW
.
transform
=
CGAffineTransform
(
scaleX
:
0.8
,
y
:
0.8
)
infoSW
.
transform
=
CGAffineTransform
(
scaleX
:
0.8
,
y
:
0.8
)
infoSW
.
addTarget
(
self
,
action
:
#selector(
switchChange(sender:)
)
,
for
:
.
valueChanged
)
infoSW
.
addTarget
(
self
,
action
:
#selector(
switchChange(sender:)
)
,
for
:
.
valueChanged
)
contentView
.
snp
.
makeConstraints
{
(
make
)
in
contentView
.
snp
.
makeConstraints
{
(
make
)
in
...
...
GeliBusinessPlatform/ViewController/新增规格/普通+预售header/TitleAndSwitchHeaderView.xib
View file @
d5f44a55
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
<outlet
property=
"infoSW"
destination=
"CB7-5d-TkX"
id=
"NR3-4A-D6i"
/>
<outlet
property=
"infoSW"
destination=
"CB7-5d-TkX"
id=
"NR3-4A-D6i"
/>
<outlet
property=
"leftBtn"
destination=
"Foa-mx-5Yx"
id=
"T72-dm-y5o"
/>
<outlet
property=
"leftBtn"
destination=
"Foa-mx-5Yx"
id=
"T72-dm-y5o"
/>
<outlet
property=
"rightBtn"
destination=
"ybR-u7-XP4"
id=
"Dk3-d2-gbZ"
/>
<outlet
property=
"rightBtn"
destination=
"ybR-u7-XP4"
id=
"Dk3-d2-gbZ"
/>
<outlet
property=
"ysInfoSw"
destination=
"GMQ-8b-xpg"
id=
"Qqe-Na-SeV"
/>
<outlet
property=
"ysSettingView"
destination=
"II7-GR-59T"
id=
"7M4-1t-9N5"
/>
</connections>
</connections>
</placeholder>
</placeholder>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
...
@@ -77,12 +79,44 @@
...
@@ -77,12 +79,44 @@
</constraints>
</constraints>
<color
key=
"onTintColor"
name=
"蓝色字体颜色"
/>
<color
key=
"onTintColor"
name=
"蓝色字体颜色"
/>
</switch>
</switch>
<view
hidden=
"YES"
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"II7-GR-59T"
>
<rect
key=
"frame"
x=
"0.0"
y=
"10"
width=
"375"
height=
"52"
/>
<subviews>
<switch
opaque=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"750"
verticalHuggingPriority=
"750"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
on=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"GMQ-8b-xpg"
>
<rect
key=
"frame"
x=
"311"
y=
"10"
width=
"51"
height=
"31"
/>
<color
key=
"onTintColor"
name=
"蓝色字体颜色"
/>
</switch>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
usesAttributedText=
"YES"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"fzO-2v-R5h"
>
<rect
key=
"frame"
x=
"15"
y=
"15"
width=
"105"
height=
"21"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"21"
id=
"dAn-sg-2eN"
/>
</constraints>
<attributedString
key=
"attributedText"
>
<fragment
content=
"预售阶梯价设置"
>
<attributes>
<color
key=
"NSColor"
name=
"标题字颜色"
/>
<font
key=
"NSFont"
size=
"15"
name=
"PingFangSC-Medium"
/>
</attributes>
</fragment>
</attributedString>
<nil
key=
"highlightedColor"
/>
</label>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
cocoaTouchSystemColor=
"whiteColor"
/>
<constraints>
<constraint
firstItem=
"fzO-2v-R5h"
firstAttribute=
"top"
secondItem=
"II7-GR-59T"
secondAttribute=
"top"
constant=
"15"
id=
"Tr9-yg-lIC"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"GMQ-8b-xpg"
secondAttribute=
"trailing"
constant=
"15"
id=
"ZH7-e5-ZP3"
/>
<constraint
firstItem=
"GMQ-8b-xpg"
firstAttribute=
"centerY"
secondItem=
"fzO-2v-R5h"
secondAttribute=
"centerY"
id=
"ipq-Mm-XOP"
/>
<constraint
firstItem=
"fzO-2v-R5h"
firstAttribute=
"leading"
secondItem=
"II7-GR-59T"
secondAttribute=
"leading"
constant=
"15"
id=
"ytg-81-7V9"
/>
</constraints>
</view>
</subviews>
</subviews>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<constraints>
<constraints>
<constraint
firstItem=
"76R-R0-pCI"
firstAttribute=
"top"
secondItem=
"iN0-l3-epB"
secondAttribute=
"top"
id=
"4o5-ak-hVE"
/>
<constraint
firstItem=
"76R-R0-pCI"
firstAttribute=
"top"
secondItem=
"iN0-l3-epB"
secondAttribute=
"top"
id=
"4o5-ak-hVE"
/>
<constraint
firstItem=
"FFu-OD-rc8"
firstAttribute=
"top"
secondItem=
"76R-R0-pCI"
secondAttribute=
"bottom"
constant=
"15"
id=
"HvO-2g-yPj"
/>
<constraint
firstItem=
"FFu-OD-rc8"
firstAttribute=
"top"
secondItem=
"76R-R0-pCI"
secondAttribute=
"bottom"
constant=
"15"
id=
"HvO-2g-yPj"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"FFu-OD-rc8"
secondAttribute=
"trailing"
id=
"JhF-wO-qGP"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"FFu-OD-rc8"
secondAttribute=
"trailing"
id=
"JhF-wO-qGP"
/>
<constraint
firstItem=
"Foa-mx-5Yx"
firstAttribute=
"top"
secondItem=
"II7-GR-59T"
secondAttribute=
"bottom"
id=
"KFe-TD-fPY"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"Foa-mx-5Yx"
secondAttribute=
"bottom"
id=
"LS2-nW-eWp"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"Foa-mx-5Yx"
secondAttribute=
"bottom"
id=
"LS2-nW-eWp"
/>
<constraint
firstItem=
"76R-R0-pCI"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
id=
"LrY-UI-RcR"
/>
<constraint
firstItem=
"76R-R0-pCI"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
id=
"LrY-UI-RcR"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"ybR-u7-XP4"
secondAttribute=
"trailing"
id=
"NLC-no-i4E"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"ybR-u7-XP4"
secondAttribute=
"trailing"
id=
"NLC-no-i4E"
/>
...
@@ -91,12 +125,15 @@
...
@@ -91,12 +125,15 @@
<constraint
firstItem=
"ybR-u7-XP4"
firstAttribute=
"leading"
secondItem=
"Foa-mx-5Yx"
secondAttribute=
"trailing"
id=
"S3X-IS-ztd"
/>
<constraint
firstItem=
"ybR-u7-XP4"
firstAttribute=
"leading"
secondItem=
"Foa-mx-5Yx"
secondAttribute=
"trailing"
id=
"S3X-IS-ztd"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"76R-R0-pCI"
secondAttribute=
"trailing"
id=
"Uth-qd-FUC"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"76R-R0-pCI"
secondAttribute=
"trailing"
id=
"Uth-qd-FUC"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"iUg-fe-DMN"
secondAttribute=
"bottom"
id=
"UyW-VQ-lzx"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"iUg-fe-DMN"
secondAttribute=
"bottom"
id=
"UyW-VQ-lzx"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"II7-GR-59T"
secondAttribute=
"trailing"
id=
"Wsj-kO-7V7"
/>
<constraint
firstItem=
"ybR-u7-XP4"
firstAttribute=
"height"
secondItem=
"Foa-mx-5Yx"
secondAttribute=
"height"
id=
"X7T-nQ-A6m"
/>
<constraint
firstItem=
"ybR-u7-XP4"
firstAttribute=
"height"
secondItem=
"Foa-mx-5Yx"
secondAttribute=
"height"
id=
"X7T-nQ-A6m"
/>
<constraint
firstItem=
"CB7-5d-TkX"
firstAttribute=
"centerY"
secondItem=
"FFu-OD-rc8"
secondAttribute=
"centerY"
id=
"e18-MP-pNs"
/>
<constraint
firstItem=
"CB7-5d-TkX"
firstAttribute=
"centerY"
secondItem=
"FFu-OD-rc8"
secondAttribute=
"centerY"
id=
"e18-MP-pNs"
/>
<constraint
firstItem=
"II7-GR-59T"
firstAttribute=
"top"
secondItem=
"iN0-l3-epB"
secondAttribute=
"top"
constant=
"10"
id=
"eQr-UG-t4i"
/>
<constraint
firstItem=
"FFu-OD-rc8"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
constant=
"15"
id=
"kCT-vS-1St"
/>
<constraint
firstItem=
"FFu-OD-rc8"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
constant=
"15"
id=
"kCT-vS-1St"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"CB7-5d-TkX"
secondAttribute=
"trailing"
constant=
"15"
id=
"ktE-YY-c70"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"CB7-5d-TkX"
secondAttribute=
"trailing"
constant=
"15"
id=
"ktE-YY-c70"
/>
<constraint
firstItem=
"Foa-mx-5Yx"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
id=
"lve-Dd-EFp"
/>
<constraint
firstItem=
"Foa-mx-5Yx"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
id=
"lve-Dd-EFp"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"ybR-u7-XP4"
secondAttribute=
"bottom"
id=
"ras-iE-35P"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"ybR-u7-XP4"
secondAttribute=
"bottom"
id=
"ras-iE-35P"
/>
<constraint
firstItem=
"II7-GR-59T"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
id=
"sgG-cQ-N2v"
/>
<constraint
firstItem=
"iUg-fe-DMN"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
id=
"u3M-i0-jPq"
/>
<constraint
firstItem=
"iUg-fe-DMN"
firstAttribute=
"leading"
secondItem=
"iN0-l3-epB"
secondAttribute=
"leading"
id=
"u3M-i0-jPq"
/>
</constraints>
</constraints>
<freeformSimulatedSizeMetrics
key=
"simulatedDestinationMetrics"
/>
<freeformSimulatedSizeMetrics
key=
"simulatedDestinationMetrics"
/>
...
@@ -113,6 +150,9 @@
...
@@ -113,6 +150,9 @@
<namedColor
name=
"标题字颜色"
>
<namedColor
name=
"标题字颜色"
>
<color
red=
"0.1803921568627451"
green=
"0.1803921568627451"
blue=
"0.1803921568627451"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
red=
"0.1803921568627451"
green=
"0.1803921568627451"
blue=
"0.1803921568627451"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
</namedColor>
</namedColor>
<namedColor
name=
"标题字颜色"
>
<color
red=
"0.18000000715255737"
green=
"0.18000000715255737"
blue=
"0.18000000715255737"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
</namedColor>
<namedColor
name=
"灰色字体颜色"
>
<namedColor
name=
"灰色字体颜色"
>
<color
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
</namedColor>
</namedColor>
...
...
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