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
29f9ccc3
Commit
29f9ccc3
authored
May 19, 2020
by
刘俊宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接新增商品ing
parent
e4cda593
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
567 additions
and
84 deletions
+567
-84
GeliBusinessPlatform.xcodeproj/project.pbxproj
GeliBusinessPlatform.xcodeproj/project.pbxproj
+4
-0
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
...ata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/Define/Define.swift
GeliBusinessPlatform/Define/Define.swift
+1
-1
GeliBusinessPlatform/View/AlertView/GLAlertSelectView.swift
GeliBusinessPlatform/View/AlertView/GLAlertSelectView.swift
+1
-0
GeliBusinessPlatform/View/TimeSelectView/ShowTimeSelectView.swift
...nessPlatform/View/TimeSelectView/ShowTimeSelectView.swift
+145
-0
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
...orm/ViewController/商品详情/ProductDetailViewController.swift
+346
-80
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
...orm/ViewController/新增规格/CreatNewSpecsViewController.swift
+1
-0
GeliBusinessPlatform/ViewController/蓝牙连接/BluetoothConnectViewController.swift
.../ViewController/蓝牙连接/BluetoothConnectViewController.swift
+69
-3
No files found.
GeliBusinessPlatform.xcodeproj/project.pbxproj
View file @
29f9ccc3
...
...
@@ -325,6 +325,7 @@
F933F6CF2452C68B00189561
/* PKHUDErrorView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F933F6BE2452C68B00189561
/* PKHUDErrorView.swift */
;
};
F933F6D22452DAE100189561
/* TabBarContentClassView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F933F6D12452DAE000189561
/* TabBarContentClassView.swift */
;
};
F93E31F724721C4200524DFC
/* EditOGPAdModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F93E31F624721C4200524DFC
/* EditOGPAdModel.swift */
;
};
F93E31FD24727A2D00524DFC
/* ShowTimeSelectView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F93E31FC24727A2D00524DFC
/* ShowTimeSelectView.swift */
;
};
F94A314724624E9500FEC38E
/* GetGelipayInfoModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F94A314624624E9500FEC38E
/* GetGelipayInfoModel.swift */
;
};
F94A314924624FA400FEC38E
/* ShopAdministratorInfoModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F94A314824624FA400FEC38E
/* ShopAdministratorInfoModel.swift */
;
};
F94A314B246250DB00FEC38E
/* GoodsDetailModel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F94A314A246250DB00FEC38E
/* GoodsDetailModel.swift */
;
};
...
...
@@ -812,6 +813,7 @@
F933F6BF2452C68B00189561
/* PKHUD.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
PKHUD.h
;
sourceTree
=
"<group>"
;
};
F933F6D12452DAE000189561
/* TabBarContentClassView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TabBarContentClassView.swift
;
sourceTree
=
"<group>"
;
};
F93E31F624721C4200524DFC
/* EditOGPAdModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
EditOGPAdModel.swift
;
sourceTree
=
"<group>"
;
};
F93E31FC24727A2D00524DFC
/* ShowTimeSelectView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ShowTimeSelectView.swift
;
sourceTree
=
"<group>"
;
};
F94A314624624E9500FEC38E
/* GetGelipayInfoModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GetGelipayInfoModel.swift
;
sourceTree
=
"<group>"
;
};
F94A314824624FA400FEC38E
/* ShopAdministratorInfoModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ShopAdministratorInfoModel.swift
;
sourceTree
=
"<group>"
;
};
F94A314A246250DB00FEC38E
/* GoodsDetailModel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
GoodsDetailModel.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1972,6 +1974,7 @@
F950FDE92451920200C40530
/* DIYCalendarCell.swift */
,
F9956B1B2463D941001A617D
/* WorkSelectTimeView.xib */
,
F9956B1D2463D94E001A617D
/* WorkSelectTimeView.swift */
,
F93E31FC24727A2D00524DFC
/* ShowTimeSelectView.swift */
,
);
path
=
TimeSelectView
;
sourceTree
=
"<group>"
;
...
...
@@ -2684,6 +2687,7 @@
F950FDA92451613500C40530
/* GetMobileModel.swift in Sources */
,
F94A314724624E9500FEC38E
/* GetGelipayInfoModel.swift in Sources */
,
E0B5307E247266F400FFCC15
/* DKXDAdrCell.swift in Sources */
,
F93E31FD24727A2D00524DFC
/* ShowTimeSelectView.swift in Sources */
,
E0B94623245671E100FBEC9A
/* DaiKeXiaDanGouWuViewController.swift in Sources */
,
E0A320C52456D01300AF321C
/* DaiKeXiaDanFooterView.swift in Sources */
,
E0336DD5244EC40000380BE9
/* CreatNewSpecsViewController.swift in Sources */
,
...
...
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
View file @
29f9ccc3
No preview for this file type
GeliBusinessPlatform/Define/Define.swift
View file @
29f9ccc3
...
...
@@ -124,7 +124,7 @@ func isPurnInt(string: String) -> Bool {
return
scan
.
scanInt
(
&
val
)
&&
scan
.
isAtEnd
}
//MARK:--是否是正确的数值
func
isPurnNumber
(
str
:
String
)
->
Bool
{
if
isPurnInt
(
string
:
str
)
||
isPurnFloat
(
string
:
str
){
return
true
...
...
GeliBusinessPlatform/View/AlertView/GLAlertSelectView.swift
View file @
29f9ccc3
...
...
@@ -36,6 +36,7 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
var
tempNum
:
Int
?
var
tempArr
:
Array
<
Int
>
?
=
[]
var
selectLblText
:
String
?
=
""
var
isShangPinType
:
Bool
=
false
var
kuWeiArr
=
Array
<
Any
>
(){
didSet
{
var
tbvH
=
CGFloat
(
kuWeiArr
.
count
*
49
)
...
...
GeliBusinessPlatform/View/TimeSelectView/ShowTimeSelectView.swift
0 → 100644
View file @
29f9ccc3
//
// ShowTimeSelectView.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/5/18.
// Copyright © 2020 junye lu. All rights reserved.
//
import
UIKit
protocol
ShowTimeSelectViewDelegate
{
func
showTimeSelectByData
(
timeStr
:
String
,
beginDate
:
Date
,
endginDate
:
Date
)
}
class
ShowTimeSelectView
:
UIView
,
TimeSelectViewDelgate
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
self
.
backgroundColor
=
UIColor
.
clear
blackView
.
backgroundColor
=
UIColor
.
init
(
named
:
"提示视图背景色"
)
blackView
.
addTarget
(
self
,
action
:
#selector(
hideAction(sender:)
)
,
for
:
.
touchUpInside
)
self
.
addSubview
(
blackView
)
blackView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
top
.
bottom
.
right
.
equalToSuperview
()
}
self
.
addSubview
(
contetV
)
self
.
addSubview
(
sureBtn
)
contetV
.
backgroundColor
=
UIColor
.
white
contetV
.
layer
.
cornerRadius
=
5
contetV
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
equalToSuperview
()
make
.
bottom
.
equalTo
(
sureBtn
.
snp_top
)
.
offset
(
3*
glscale
)
make
.
height
.
equalTo
(
340*
glscale
)
}
sureBtn
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
height
.
equalTo
(
TabHeight
)
}
sureBtn
.
setTitle
(
"确定"
,
for
:
.
normal
)
sureBtn
.
addTarget
(
self
,
action
:
#selector(
sureAction(sender:)
)
,
for
:
.
touchUpInside
)
sureBtn
.
backgroundColor
=
UIColor
.
init
(
named
:
"蓝色字体颜色"
)
sureBtn
.
setTitleColor
(
UIColor
.
white
,
for
:
.
normal
)
sureBtn
.
titleLabel
?
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
17
)
titleLbl
.
text
=
"选择时间段"
titleLbl
.
textColor
=
UIColor
.
init
(
named
:
"标题字颜色"
)
titleLbl
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
15
)
contetV
.
addSubview
(
titleLbl
)
titleLbl
.
snp
.
makeConstraints
{
(
make
)
in
make
.
top
.
equalTo
(
15*
glscale
)
make
.
centerX
.
equalToSuperview
()
}
let
lineV
=
UIView
()
lineV
.
backgroundColor
=
UIColor
.
init
(
named
:
"灰色分界线"
)
contetV
.
addSubview
(
lineV
)
lineV
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
right
.
equalToSuperview
()
make
.
top
.
equalTo
(
titleLbl
.
snp_bottom
)
.
offset
(
15*
glscale
)
make
.
height
.
equalTo
(
1
)
}
let
kuangV
=
UIView
()
kuangV
.
layer
.
borderColor
=
UIColor
.
init
(
named
:
"灰色字体颜色"
)?
.
cgColor
kuangV
.
layer
.
borderWidth
=
1
kuangV
.
layer
.
cornerRadius
=
3
contetV
.
addSubview
(
kuangV
)
kuangV
.
snp
.
makeConstraints
{
(
make
)
in
make
.
height
.
equalTo
(
32*
glscale
)
make
.
width
.
equalTo
(
180*
glscale
)
make
.
left
.
equalTo
(
15*
glscale
)
make
.
top
.
equalTo
(
lineV
.
snp_bottom
)
.
offset
(
15*
glscale
)
}
clearBtn
.
setImage
(
UIImage
.
init
(
named
:
"workTimeDel"
),
for
:
.
normal
)
clearBtn
.
addTarget
(
self
,
action
:
#selector(
clearBtnAction(sender:)
)
,
for
:
.
touchUpInside
)
contetV
.
addSubview
(
clearBtn
)
clearBtn
.
snp
.
makeConstraints
{
(
make
)
in
make
.
right
.
equalTo
(
kuangV
.
snp_right
)
.
offset
(
-
7*
glscale
)
make
.
centerY
.
equalTo
(
kuangV
)
}
timeLbl
.
text
=
"-"
timeLbl
.
font
=
UIFont
.
systemFont
(
ofSize
:
13
)
timeLbl
.
textColor
=
UIColor
.
init
(
named
:
"标题字颜色"
)
contetV
.
addSubview
(
timeLbl
)
timeLbl
.
snp
.
makeConstraints
{
(
make
)
in
make
.
centerY
.
equalTo
(
kuangV
)
make
.
left
.
equalTo
(
kuangV
.
snp_left
)
.
offset
(
10*
glscale
)
}
calendarV
.
moreSelection
=
true
contetV
.
addSubview
(
calendarV
)
calendarV
.
delegate
=
self
}
let
blackView
=
UIButton
(
type
:
.
custom
)
let
sureBtn
=
UIButton
(
type
:
.
custom
)
let
contetV
=
UIView
()
let
titleLbl
=
UILabel
()
let
timeLbl
=
UILabel
()
let
clearBtn
=
UIButton
(
type
:
.
custom
)
let
calendarV
=
TimeSelectView
(
frame
:
CGRect
(
x
:
0
,
y
:
105*
glscale
,
width
:
fullScreenWidth
,
height
:
235*
glscale
))
var
delegate
:
ShowTimeSelectViewDelegate
?
var
BeginDate
:
Date
!
=
nil
var
EndDate
:
Date
!
=
nil
func
selectMoreDate
(
beginDate
:
Date
,
endginDate
:
Date
)
{
print
(
"选择日期·····"
)
let
timeInterval
:
TimeInterval
=
beginDate
.
timeIntervalSince1970
let
timeIntervalEnd
:
TimeInterval
=
endginDate
.
timeIntervalSince1970
timeLbl
.
text
=
dayByDouble
(
sender
:
timeInterval
)
+
"-"
+
dayByDouble
(
sender
:
timeIntervalEnd
)
EndDate
=
endginDate
BeginDate
=
beginDate
}
@objc
func
sureAction
(
sender
:
UIButton
)
{
print
(
"确定日期·····"
)
if
EndDate
==
nil
{
HUD
.
flash
(
.
label
(
"请选择时间段"
),
delay
:
1.2
)
return
}
self
.
delegate
?
.
showTimeSelectByData
(
timeStr
:
timeLbl
.
text
!
,
beginDate
:
BeginDate
,
endginDate
:
EndDate
)
self
.
removeFromSuperview
()
}
@objc
func
clearBtnAction
(
sender
:
UIButton
){
print
(
"清除日期·····"
)
EndDate
=
nil
BeginDate
=
nil
timeLbl
.
text
=
"-"
calendarV
.
clearTheSelect
()
}
@objc
func
hideAction
(
sender
:
UIButton
){
self
.
removeFromSuperview
()
}
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
}
}
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
View file @
29f9ccc3
...
...
@@ -10,8 +10,9 @@ import UIKit
import
LGButton
import
Photos
import
IQKeyboardManagerSwift
import
Dollar
class
ProductDetailViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
,
TitleAndTFCellDelegate
,
YuShouWeiKuanFaHuoCellDelegate
,
UITextFieldDelegate
{
class
ProductDetailViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndBtnCellDelegate
,
GLAlertSelectViewDelegate
,
GoodsClassViewControllerDelegate
,
PinPaiListViewControllerDelegate
,
AddImgCellDelegate
,
AddGuiGeCellDelegate
,
CreatNewSpecsViewControllerDelegate
,
ShangPinGguiGeCellDelegate
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
TitleAndSwitchCellDelegate
,
TitleAndTFCellDelegate
,
YuShouWeiKuanFaHuoCellDelegate
,
UITextFieldDelegate
,
ShowTimeSelectViewDelegate
{
func
GLASClose
(
view
:
GLAlertSelectView
,
selectnum
:
Int
,
selectArr
:
Array
<
Int
>
)
{
if
view
.
titleLbl
.
text
==
"请选择商品类型"
{
print
(
itemTypeArr
,
selectArr
)
...
...
@@ -33,9 +34,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
glSelectView
=
nil
}
let
titleArr
=
[
"商品信息"
,
"商品图片"
,
"商品规格"
,
"预售设置"
,
"其它信息"
,
"商品详情"
]
let
spxxArr
=
[
"商品名称"
,
"商品类型"
,
"商品分类"
,
"品牌"
,
"起卖数量"
,
"是否清真"
,
"是否询价"
]
var
tishixxArr
=
[
"请输入商品名称"
,
"请选择商品类型"
,
"请选择商品分类"
,
"请选择品牌"
,
"请输入起卖数量"
]
...
...
@@ -43,7 +41,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let
sptpArr
=
[
"商品封面图(限一张)"
,
"商品主图(限五张)"
]
let
qtxxArr
=
[
"关键字"
,
"物流费用"
,
"国家"
,
"商品状态"
,
"运输方式"
]
let
ysszArr
=
[
"用户付款是否需要审核"
,
"预设预付定金时间段"
,
"预设预付尾款时间段"
,
"预设预付尾款发货时间"
]
let
ysszHolder
=
[
"0"
,
"请选择时段"
,
"请选择时段"
,
"0"
]
var
ysszHolder
=
[
"0"
,
"请选择时段"
,
"请选择时段"
,
"0"
]
var
shangPinStatusArr
:
Array
<
GeneralInfoGsModel
>
?
=
[]
var
yunShuTypeArr
=
[
"冷链"
,
"常温"
,
"热链"
]
var
countryArr
=
[
"中国"
]
...
...
@@ -57,8 +55,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
var
itemTypeArr
:
Array
<
Int
>
?
=
[]
//多选
var
isYuShou
:
Bool
=
false
//是否预售
var
shangPinStatus
:
Int
?
//商品状态
var
yunShuType
:
Int
?
//运输类型
var
shangPinStatus
:
Int
?
=
0
//商品状态
var
yunShuType
:
Int
?
=
0
//运输类型
var
maxFiveImgsArr
:
Array
<
UIImage
>
=
[]
//多图
var
singleImgArr
:
Array
<
UIImage
>
=
[]
//单张图
var
itemName
=
""
//商品名称
...
...
@@ -71,97 +69,164 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
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
//MARK:--保存按钮
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
print
(
"保存按钮submitAction"
)
print
(
itemName
)
//商品名称
print
(
itemTypeArr
)
//商品类型
print
(
qiMaiShuLiang
)
//起卖数量
print
(
singleImgArr
.
count
)
//商品封面图
print
(
shiFouQZ
)
//是否清真
print
(
shiFouXJ
)
//是否询价
print
(
maxFiveImgsArr
)
//商品主图
print
(
shiFouSH
)
print
(
guiGeArr
)
//商品规格
print
(
keyWord
)
//关键字
print
(
wuLiuPrice
)
//物流费用
print
(
shangPinStatus
)
//商品状态
print
(
yunShuType
)
//运输方式
print
(
countrySelect
)
//选择国家
if
itemName
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请输入商品名称"
),
delay
:
1.2
)
return
}
if
itemTypeArr
==
[]
||
itemTypeArr
==
[
99
,
99
,
99
,
99
]
{
HUD
.
flash
(
.
label
(
"请选择商品类型"
),
delay
:
1.2
)
return
}
//待补充
if
itemName
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请输入商品名称"
),
delay
:
1.2
)
return
}
//待补充
if
itemName
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请输入商品名称"
),
delay
:
1.2
)
return
}
if
itemTypeArr
==
[
99
,
99
,
99
,
99
]
{
HUD
.
flash
(
.
label
(
"请选择商品类型"
),
delay
:
1.2
)
return
}
if
qiMaiShuLiang
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请输入起卖数量"
),
delay
:
1.2
)
return
}
// print(guiGeArr)//商品规格
// if itemName.count == 0 {
// HUD.flash(.label("请输入商品名称"), delay: 1.2)
// return
// }
// if itemTypeArr == [] || itemTypeArr == [99,99,99,99] {
// HUD.flash(.label("请选择商品类型"), delay: 1.2)
// return
// }
// //待补充
// if itemName.count == 0 {
// HUD.flash(.label("请输入商品名称"), delay: 1.2)
// return
// }
//
// if itemTypeArr == [99,99,99,99] {
// HUD.flash(.label("请选择商品类型"), delay: 1.2)
// return
// }
// if selectGoodsClassModel == nil {
// HUD.flash(.label("请选择商品分类"), delay: 1.2)
// return
// }
// if selectPinPaiData == nil {
// HUD.flash(.label("请选择品牌"), delay: 1.2)
// return
// }
// if qiMaiShuLiang.count == 0 {
// HUD.flash(.label("请输入起卖数量"), delay: 1.2)
// return
// }
//
// if singleImgArr.count == 0 {
// HUD.flash(.label("请选择商品封面图"), delay: 1.2)
// return
// }
//
// if maxFiveImgsArr.count == 0 {
// HUD.flash(.label("请选择商品主图"), delay: 1.2)
// return
// }
//
// if guiGeArr.count == 0 {
// HUD.flash(.label("请填写商品规格"), delay: 1.2)
// return
// }
// if isYuShouShangPin! {
// if faHuoTime.count == 0 {
// HUD.flash(.label("请输入尾款发货时间"), delay: 1.2)
// return
// }
// }
// if keyWord.count == 0 {
// HUD.flash(.label("请输入关键字"), delay: 1.2)
// return
// }
// if wuLiuPrice.count == 0 {
// HUD.flash(.label("请输入物流费用"), delay: 1.2)
// return
// }
// if countrySelect == nil {
// HUD.flash(.label("请选择国家"), delay: 1.2)
// return
// }
// if shangPinStatus == nil {
// HUD.flash(.label("请选择商品状态"), delay: 1.2)
// return
// }
//
// if yunShuType == nil {
// HUD.flash(.label("请选择运输方式"), delay: 1.2)
// return
// }
if
singleImgArr
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请选择商品封面图"
),
delay
:
1.2
)
return
}
//MARK:---新增商品接口
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
if
maxFiveImgsArr
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请选择商品主图"
),
delay
:
1.2
)
return
var
is_qz
=
0
if
shiFouQZ
{
is_qz
=
1
}
if
guiGeArr
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请填写商品规格"
),
delay
:
1.2
)
return
var
is_inquiry
=
0
if
shiFouXJ
{
is_inquiry
=
1
}
var
is_adsale
=
0
if
isYuShouShangPin
!
{
if
faHuoTime
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请输入发货时间"
),
delay
:
1.2
)
return
is_adsale
=
1
}
var
need_check
=
0
if
shiFouSH
{
need_check
=
1
}
if
keyWord
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请输入关键字"
),
delay
:
1.2
)
return
}
if
wuLiuPrice
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请输入物流费用"
),
delay
:
1.2
)
return
}
if
countrySelect
==
nil
{
HUD
.
flash
(
.
label
(
"请选择国家"
),
delay
:
1.2
)
return
}
if
shangPinStatus
==
nil
{
HUD
.
flash
(
.
label
(
"请选择商品状态"
),
delay
:
1.2
)
return
var
gs_id
=
1
if
self
.
shangPinStatusArr
!.
count
>
0
{
let
model
=
self
.
shangPinStatusArr
!
[
shangPinStatus
!
]
gs_id
=
model
.
gs_id
!
}
if
yunShuType
==
nil
{
HUD
.
flash
(
.
label
(
"请选择运输方式"
),
delay
:
1.2
)
return
}
let
transportation
=
yunShuType
!
+
1
var
lastGoodsBanner
:
Array
<
String
>
=
[]
self
.
goods_banner
?
.
forEach
({
(
str
)
in
if
str
.
count
>
0
{
lastGoodsBanner
.
append
(
str
)
}
})
var
goods_bannerStr
:
String
=
""
if
lastGoodsBanner
.
count
>
0
{
goods_bannerStr
=
dataChangeString
(
sender
:
lastGoodsBanner
)
}
getUpSkuInfoByData
(
dataArr
:
guiGeArr
)
let
dic
=
[
"user_token"
:
UserToken
as
Any
,
//验证token
"cat_id"
:
selectGoodsClassModel
?
.
cat_id
as
Any
,
//分类ID
"brand_id"
:
selectPinPaiData
?
.
brand_id
as
Any
,
// 品牌ID
"goods_name"
:
itemName
,
//商品名称
"is_qz"
:
is_qz
as
Any
,
//是否清真商品,1是0非
"goods_type"
:
""
,
//商品类型,普通2现货3期货4团购
"is_adsale"
:
is_adsale
as
Any
,
//商品类型字段,预售专用,选定”预售”则值为1,否则值为0
"is_inquiry"
:
is_inquiry
as
Any
,
//是否询价:1是0非
"origin_number"
:
qiMaiShuLiang
as
Any
,
//起购数量
"need_check"
:
need_check
as
Any
,
//付款是否需要审核, 1是0非
"dj_time_start"
:
dj_time_start
as
Any
,
//预设预付定金开始时间,时间戳,预售专用
"dj_time_end"
:
dj_time_end
as
Any
,
//预设预付定金结束时间,时间戳,预售专用
"wk_time_start"
:
wk_time_start
as
Any
,
//预设预付尾款开始时间,时间戳,预售专用
"wk_time_end"
:
wk_time_end
as
Any
,
//预设预付尾款结束时间,时间戳,预售专用
"set_time"
:
faHuoTime
as
Any
,
//预付尾款后几天后发货
"keywords"
:
keyWord
as
Any
,
//关键字
"logistics"
:
wuLiuPrice
as
Any
,
//物流费用
"coun_id"
:
"1"
,
//国家id 1(中国)
"gs_id"
:
gs_id
as
Any
,
//商品状态
"transportation"
:
transportation
as
Any
,
//运输方式,1冷链,2常温,3热链
"goods_desc"
:
""
,
//商品详情 html p标签
"specifications"
:
specifications
as
Any
,
//默认规格,选sku中最低价格(需判定阶梯价)的 规格值
"shop_price"
:
shop_price
as
Any
,
//默认售价,选sku中最低价格(需判定阶梯价)的价格
"goods_unit"
:
goods_unit
as
Any
,
//默认商品单位,选sku中最低价格(需判定阶梯价)的单位
"original_img"
:
original_img
as
Any
,
//商品封面图
"goods_banner"
:
goods_bannerStr
as
Any
,
//商品副图,多张,最多5张,使用一维数组转json格式
"sku_info"
:
sku_info
as
Any
]
print
(
dic
)
//MARK:--新增商品接口
goodsAdd
(
dic
,
success
:
{
(
data
)
in
})
{
(
error
)
in
}
}
@IBOutlet
weak
var
submitBtn
:
LGButton
!
...
...
@@ -174,6 +239,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
super
.
viewDidLoad
()
//MARK:--获取新增商品的基本信息(品牌和分类等)
HUD
.
flash
(
.
progress
)
//MARK:--新增商品和编辑商品所需要的基本信息(无)就页面不正常显示
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
GeneralInfo
([
"user_token"
:
UserToken
as
Any
],
success
:
{
(
data
)
in
HUD
.
hide
(
animated
:
true
)
...
...
@@ -370,6 +437,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
//MARK: - 底部广告软文跳转
func
AddGuiGeCellClick
(
cell
:
AddGuiGeCell
)
{
print
(
"底部广告软文跳转"
)
let
vc
=
LMNoteViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
//MARK: -- 点击按钮事件,跳转或者展示选择界面
func
btnClick
(
content
:
String
,
cell
:
TitleAndBtnCell
)
{
...
...
@@ -378,6 +447,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let
view
=
GLAlertSelectView
(
frame
:
self
.
view
.
bounds
)
view
.
tag
=
cell
.
tag
view
.
isMultipleS
=
true
view
.
isShangPinType
=
true
view
.
titleLbl
.
text
=
"请选择商品类型"
view
.
delegate
=
self
view
.
dataArr
=
[
"预售"
,
"普通"
,
"期货"
,
"团购"
]
...
...
@@ -457,10 +527,41 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
if
cell
.
nameLbl
.
text
==
"预设预付定金时间段"
{
print
(
"定金时间段"
)
let
timeSelectV
=
ShowTimeSelectView
(
frame
:
self
.
view
.
window
!.
bounds
)
timeSelectV
.
titleLbl
.
text
=
"预设预付定金时间段"
timeSelectV
.
delegate
=
self
self
.
view
.
window
?
.
addSubview
(
timeSelectV
)
isWeiTime
=
false
}
if
cell
.
nameLbl
.
text
==
"预设预付尾款时间段"
{
print
(
"预付尾款时"
)
let
timeSelectV
=
ShowTimeSelectView
(
frame
:
self
.
view
.
window
!.
bounds
)
timeSelectV
.
titleLbl
.
text
=
"预设预付尾款时间段"
timeSelectV
.
delegate
=
self
self
.
view
.
window
?
.
addSubview
(
timeSelectV
)
isWeiTime
=
true
}
}
//MARK:--选择预售时间回调数据
var
isWeiTime
:
Bool
=
false
func
showTimeSelectByData
(
timeStr
:
String
,
beginDate
:
Date
,
endginDate
:
Date
)
{
let
timeInterval
:
TimeInterval
=
beginDate
.
timeIntervalSince1970
let
timeIntervalEnd
:
TimeInterval
=
endginDate
.
timeIntervalSince1970
if
isWeiTime
{
ysszHolder
.
insert
(
timeStr
,
at
:
2
)
ysszHolder
.
remove
(
at
:
3
)
wk_time_start
=
Int
(
timeInterval
)
wk_time_end
=
Int
(
timeIntervalEnd
)
}
else
{
ysszHolder
.
insert
(
timeStr
,
at
:
1
)
ysszHolder
.
remove
(
at
:
2
)
dj_time_start
=
Int
(
timeInterval
)
dj_time_end
=
Int
(
timeIntervalEnd
)
}
listTbv
.
reloadData
()
}
//MARK:---选择商品分类返回数据
...
...
@@ -495,6 +596,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
self
.
singleImgArr
.
append
(
image
!
)
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
0
)
})
}
self
.
listTbv
.
reloadData
()
...
...
@@ -511,6 +614,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
self
.
maxFiveImgsArr
.
append
(
image
!
)
let
index
=
Dollar
.
indexOf
(
self
.
maxFiveImgsArr
,
value
:
image
!
)
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
false
,
tag
:
index
!
)
})
}
self
.
listTbv
.
reloadData
()
...
...
@@ -532,6 +638,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
// print("上传图片==\(image)")
self
.
singleImgArr
.
removeAll
()
self
.
singleImgArr
.
append
(
image
!
)
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
0
)
})
}
self
.
listTbv
.
reloadData
()
...
...
@@ -548,19 +656,46 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
// print("上传图片==\(image)")
self
.
maxFiveImgsArr
.
insert
(
image
!
,
at
:
sender
.
tag
)
self
.
maxFiveImgsArr
.
remove
(
at
:
sender
.
tag
+
1
)
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
false
,
tag
:
sender
.
tag
)
})
}
self
.
listTbv
.
reloadData
()
}
}
}
//MARK:--图片上传功能
var
original_img
:
String
?
=
""
//商品封面图
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
saveFile
(
image
:
upLoadImg
,
[
"user_token"
:
UserToken
as
Any
],
success
:
{
(
data
)
in
let
dataM
=
data
as!
SaveFileModel
if
dataM
.
code
==
1
{
print
(
"图片上传成功
\(
dataM
.
data
?
.
url
)
"
)
if
isOriginal
{
self
.
original_img
=
dataM
.
data
?
.
url
!
}
else
{
self
.
goods_banner
?
.
insert
((
dataM
.
data
?
.
url
!
)
!
,
at
:
tag
)
self
.
goods_banner
?
.
remove
(
at
:
tag
+
1
)
}
}
})
{
(
error
)
in
print
(
"图片上传失败
\(
error
)
"
)
}
}
//MARK: - 删除图片处理
func
DelImgCellBtnClick
(
sender
:
UIButton
,
cell
:
AddImgCell
)
{
if
cell
.
isSingle
==
true
{
singleImgArr
.
remove
(
at
:
sender
.
tag
)
self
.
original_img
=
""
listTbv
.
reloadData
()
}
else
{
maxFiveImgsArr
.
remove
(
at
:
sender
.
tag
)
self
.
goods_banner
?
.
insert
(
""
,
at
:
5
)
self
.
goods_banner
?
.
remove
(
at
:
sender
.
tag
)
listTbv
.
reloadData
()
}
}
...
...
@@ -890,4 +1025,135 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
IQKeyboardManager
.
shared
.
resignFirstResponder
()
}
//MARK:--处理规格数据
var
specifications
=
""
var
shop_price
:
Float
=
0.0
var
goods_unit
=
""
var
sku_info
=
""
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
if
isPurnNumber
(
str
:
md
.
price
)
{
if
isgetP
{
let
peiceP
=
Float
(
md
.
price
)
!
//第n个售价(n > 1)
if
peiceP
<
price
{
price
=
peiceP
model
=
md
}
}
else
{
price
=
Float
(
md
.
price
)
!
//第一个售价
model
=
md
isgetP
=
true
}
}
//普通阶梯价
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
)
}
}
}
let
pack_attr
=
[
"l"
:
"0"
,
"w"
:
"0"
,
"h"
:
"0"
,
"w"
:
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
}
let
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
,
"tiered_pri"
:
tiered_pri
,
"is_open_adsale"
:
is_open_adsale
,
"adsale_pri"
:
adsale_pri
,
"adsale_inventory"
:
adsale_inventory
,
"pct"
:
pct
,
"adsale_tiered_pri"
:
adsale_tiered_pri
,
"is_adsale_tiered"
:
is_adsale_tiered
]
as
[
String
:
Any
]
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/新增规格/CreatNewSpecsViewController.swift
View file @
29f9ccc3
...
...
@@ -355,6 +355,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
item
=
jieTiArr
[
indexPath
.
row
]
as!
NSString
}
if
item
!=
""
{
//MARK:--阶梯价格切割
let
arr
=
item
.
components
(
separatedBy
:
"_"
)
cell
.
priceTF
.
text
=
arr
[
0
]
cell
.
countTF
.
text
=
arr
[
1
]
...
...
GeliBusinessPlatform/ViewController/蓝牙连接/BluetoothConnectViewController.swift
View file @
29f9ccc3
...
...
@@ -8,7 +8,7 @@
import
UIKit
import
Dollar
class
BluetoothConnectViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
{
class
BluetoothConnectViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
CBPeripheralDelegate
{
...
...
@@ -64,6 +64,13 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
self
.
selectDataArray
.
insert
(
peripheral
!
,
at
:
0
)
self
.
tableView
.
reloadData
()
HUD
.
flash
(
.
labeledSubSuccess
(
subtitle
:
"连接成功"
),
delay
:
1.5
)
//停在扫描?
self
.
baby
?
.
cancelScan
()
peripheral
?
.
delegate
=
self
//[peripheral discoverServices:@[[CBUUID UUIDWithString:SERVICE_UUID]]];
//外设发现服务,传nil代表不过滤,一次性读出外设的所有服务
peripheral
?
.
discoverServices
(
nil
)
})
baby
?
.
setBlockOnFailToConnect
({
(
central
,
peripheral
,
error
)
in
...
...
@@ -80,6 +87,57 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
})
//获取外围设备服务和特征1
// baby?.discoverServices()//发现Services
// baby?.setBlockOnDiscoverServices({ (peripheral, error) in
// //遍历服务
// peripheral?.services?.forEach({ (service) in
// print("遍历发现的服务\(service)")
// peripheral?.discoverCharacteristics(nil, for: service)
// })
// })
}
//MARK:--发现外围设备服务1
func
peripheral
(
_
peripheral
:
CBPeripheral
,
didDiscoverServices
error
:
Error
?)
{
//遍历服务
print
(
"-发现外围设备服务1"
)
peripheral
.
services
?
.
forEach
({
(
service
)
in
print
(
"遍历发现的服务
\(
service
)
"
)
peripheral
.
discoverCharacteristics
(
nil
,
for
:
service
)
//服务注册
})
}
//MARK:--发现外围设备特征2
func
peripheral
(
_
peripheral
:
CBPeripheral
,
didDiscoverCharacteristicsFor
service
:
CBService
,
error
:
Error
?)
{
print
(
"-发现外围设备特征2"
)
if
error
==
nil
{
service
.
characteristics
?
.
forEach
({
(
characteristic
)
in
print
(
"遍历特征
\(
characteristic
.
uuid
)
"
)
//要跟UUID
peripheral
.
setNotifyValue
(
true
,
for
:
characteristic
)
//特征注册
})
}
}
//MARK:--外设返回数据(回调)
func
peripheral
(
_
peripheral
:
CBPeripheral
,
didUpdateValueFor
characteristic
:
CBCharacteristic
,
error
:
Error
?)
{
let
data
=
characteristic
.
value
let
resultByte
=
data
?
.
bytes
print
(
"外设回调数据----
\(
data
)
==
\(
resultByte
)
"
)
if
data
!.
count
>=
1
{
if
resultByte
!
[
0
]
==
16
{
print
(
"---打印机打开--"
)
}
else
if
resultByte
!
[
0
]
==
1
{
print
(
"---打印机缺纸--"
)
}
}
}
func
peripheral
(
_
peripheral
:
CBPeripheral
,
didWriteValueFor
characteristic
:
CBCharacteristic
,
error
:
Error
?)
{
print
(
"写入数据的回调么"
)
}
...
...
@@ -87,8 +145,16 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
@IBAction
func
searchAction
(
_
sender
:
Any
)
{
print
(
"搜索"
)
baby
?
.
scanForPeripherals
()
baby
?
.
begin
()
//临时处理给外设写入数据
let
byte
=
[
0x1B
,
0x68
]
let
data
=
Data
.
init
(
bytes
:
byte
,
count
:
3
)
let
currPeripheral
:
CBPeripheral
=
self
.
selectDataArray
[
0
]
//写入数据
// currPeripheral.writeValue(data, for: <#T##CBCharacteristic#>, type: CBCharacteristicWriteType)
// baby?.scanForPeripherals()
// baby?.begin()
}
//MARK: -Cell delegate
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
...
...
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