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
102eb481
Commit
102eb481
authored
May 27, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改输入限制
parent
94a17559
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
34 deletions
+63
-34
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/View/Cell/YuShouWeiKuanFaHuoCell.swift
GeliBusinessPlatform/View/Cell/YuShouWeiKuanFaHuoCell.swift
+12
-5
GeliBusinessPlatform/ViewController/商品详情/EPViewController.swift
...sinessPlatform/ViewController/商品详情/EPViewController.swift
+3
-5
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
...orm/ViewController/商品详情/ProductDetailViewController.swift
+3
-5
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
...orm/ViewController/新增规格/CreatNewSpecsViewController.swift
+18
-11
GeliBusinessPlatform/ViewController/新增规格/PuTongJieTiCell.swift
...usinessPlatform/ViewController/新增规格/PuTongJieTiCell.swift
+27
-8
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
102eb481
No preview for this file type
GeliBusinessPlatform/View/Cell/YuShouWeiKuanFaHuoCell.swift
View file @
102eb481
...
@@ -10,7 +10,7 @@ import UIKit
...
@@ -10,7 +10,7 @@ import UIKit
protocol
YuShouWeiKuanFaHuoCellDelegate
{
protocol
YuShouWeiKuanFaHuoCellDelegate
{
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
}
}
class
YuShouWeiKuanFaHuoCell
:
UITableViewCell
{
class
YuShouWeiKuanFaHuoCell
:
UITableViewCell
,
UITextFieldDelegate
{
var
delegate
:
YuShouWeiKuanFaHuoCellDelegate
?
var
delegate
:
YuShouWeiKuanFaHuoCellDelegate
?
@IBOutlet
weak
var
textTF
:
UITextField
!
@IBOutlet
weak
var
textTF
:
UITextField
!
@IBOutlet
weak
var
nameLbl
:
UILabel
!
@IBOutlet
weak
var
nameLbl
:
UILabel
!
...
@@ -18,14 +18,21 @@ class YuShouWeiKuanFaHuoCell: UITableViewCell {
...
@@ -18,14 +18,21 @@ class YuShouWeiKuanFaHuoCell: UITableViewCell {
override
func
awakeFromNib
()
{
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
super
.
awakeFromNib
()
self
.
selectionStyle
=
.
none
self
.
selectionStyle
=
.
none
textTF
.
addTarget
(
self
,
action
:
#selector(
textChange(tf:)
)
,
for
:
.
allEditingEvents
)
textTF
.
delegate
=
self
// Initialization code
// Initialization code
}
}
@objc
func
textChange
(
tf
:
UITextField
){
func
textFieldDidEndEditing
(
_
textField
:
UITextField
)
{
if
tf
.
text
!=
nil
{
delegate
?
.
YuShouWeiKuanFaHuoCellString
(
str
:
tf
.
text
!
)
if
isPurnInt
(
string
:
textField
.
text
!
)
{
delegate
?
.
YuShouWeiKuanFaHuoCellString
(
str
:
formatShowNumber
(
value
:
textField
.
text
!
))
}
else
{
HUD
.
flash
(
.
label
(
"请输入正确的数据"
),
delay
:
1.2
)
textField
.
text
=
"0"
}
}
}
}
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
super
.
setSelected
(
selected
,
animated
:
animated
)
super
.
setSelected
(
selected
,
animated
:
animated
)
...
...
GeliBusinessPlatform/ViewController/商品详情/EPViewController.swift
View file @
102eb481
...
@@ -1506,11 +1506,9 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
...
@@ -1506,11 +1506,9 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}
}
}
}
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
{
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
{
if
isPurnInt
(
string
:
str
)
{
faHuoTime
=
formatShowNumber
(
value
:
str
)
faHuoTime
=
str
}
else
{
HUD
.
flash
(
.
label
(
"请输入正确的数据"
),
delay
:
1.2
)
}
}
}
override
func
backAction
()
{
override
func
backAction
()
{
if
editBtn
?
.
titleLabel
!.
text
==
"保存"
{
if
editBtn
?
.
titleLabel
!.
text
==
"保存"
{
...
...
GeliBusinessPlatform/ViewController/商品详情/ProductDetailViewController.swift
View file @
102eb481
...
@@ -1103,11 +1103,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -1103,11 +1103,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
}
}
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
{
func
YuShouWeiKuanFaHuoCellString
(
str
:
String
)
{
if
isPurnInt
(
string
:
str
)
{
faHuoTime
=
formatShowNumber
(
value
:
str
)
faHuoTime
=
str
}
else
{
HUD
.
flash
(
.
label
(
"请输入正确的数据"
),
delay
:
1.2
)
}
}
}
override
func
backAction
()
{
override
func
backAction
()
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
...
...
GeliBusinessPlatform/ViewController/新增规格/CreatNewSpecsViewController.swift
View file @
102eb481
...
@@ -188,7 +188,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -188,7 +188,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
}
}
}
}
if
specalArr
.
count
>
0
{
if
specalArr
.
count
>
0
{
for
item
in
specalArr
{
for
item
in
specalArr
{
let
str
=
item
as!
String
let
str
=
item
as!
String
...
@@ -394,7 +394,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -394,7 +394,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
cell
.
tag
=
indexPath
.
row
cell
.
tag
=
indexPath
.
row
cell
.
countTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
countTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
priceTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
priceTF
.
isUserInteractionEnabled
=
isAllEditing
cell
.
isYuShou
=
selectYuShou
cell
.
countTF
.
text
=
""
cell
.
countTF
.
text
=
""
cell
.
priceTF
.
text
=
""
cell
.
priceTF
.
text
=
""
var
item
:
NSString
=
""
var
item
:
NSString
=
""
...
@@ -651,17 +651,24 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
...
@@ -651,17 +651,24 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
listTbv
.
reloadData
()
listTbv
.
reloadData
()
}
}
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
{
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
{
jieTiArr
.
remove
(
at
:
sender
.
tag
)
if
selectYuShou
{
listTbv
.
reloadData
()
specalArr
.
remove
(
at
:
sender
.
tag
)
}
listTbv
.
reloadData
()
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
if
selectYuShou
{
specalArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
specalArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
else
{
}
else
{
jieTiArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
jieTiArr
.
remove
(
at
:
sender
.
tag
)
jieTiArr
.
remove
(
at
:
cell
.
tag
+
1
)
listTbv
.
reloadData
(
)
}
}
}
func
PuTongJieTiContentSp
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
specalArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
specalArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
{
jieTiArr
.
insert
(
"
\(
price
)
_
\(
count
)
"
,
at
:
cell
.
tag
)
jieTiArr
.
remove
(
at
:
cell
.
tag
+
1
)
}
}
func
selectYuShou
(
sender
:
UIButton
)
{
func
selectYuShou
(
sender
:
UIButton
)
{
...
...
GeliBusinessPlatform/ViewController/新增规格/PuTongJieTiCell.swift
View file @
102eb481
...
@@ -10,6 +10,7 @@ import UIKit
...
@@ -10,6 +10,7 @@ import UIKit
@objc
protocol
PuTongJieTiCellDelegate
{
@objc
protocol
PuTongJieTiCellDelegate
{
@objc
optional
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
@objc
optional
func
PuTongJieTiDelAction
(
sender
:
PuTongJieTiCell
)
@objc
optional
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
@objc
optional
func
PuTongJieTiContent
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
@objc
optional
func
PuTongJieTiContentSp
(
price
:
String
,
count
:
String
,
cell
:
PuTongJieTiCell
)
@objc
optional
func
PuTongJieTiClickDone
()
@objc
optional
func
PuTongJieTiClickDone
()
}
}
class
PuTongJieTiCell
:
UITableViewCell
,
UITextFieldDelegate
{
class
PuTongJieTiCell
:
UITableViewCell
,
UITextFieldDelegate
{
...
@@ -21,31 +22,49 @@ class PuTongJieTiCell: UITableViewCell,UITextFieldDelegate {
...
@@ -21,31 +22,49 @@ class PuTongJieTiCell: UITableViewCell,UITextFieldDelegate {
@IBOutlet
weak
var
priceTF
:
UITextField
!
@IBOutlet
weak
var
priceTF
:
UITextField
!
@IBOutlet
weak
var
countTF
:
UITextField
!
@IBOutlet
weak
var
countTF
:
UITextField
!
@IBOutlet
weak
var
titleLbl
:
UILabel
!
@IBOutlet
weak
var
titleLbl
:
UILabel
!
@IBOutlet
weak
var
btn
:
UIButton
!
@IBOutlet
weak
var
btn
:
UIButton
!
var
isYuShou
:
Bool
?
override
func
awakeFromNib
()
{
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
super
.
awakeFromNib
()
selectionStyle
=
.
none
selectionStyle
=
.
none
priceTF
.
addTarget
(
self
,
action
:
#selector(
textChange(textF:)
)
,
for
:
.
editingChanged
)
countTF
.
addTarget
(
self
,
action
:
#selector(
textChange(textF:)
)
,
for
:
.
editingChanged
)
priceTF
.
tag
=
0
priceTF
.
tag
=
0
countTF
.
tag
=
1
countTF
.
tag
=
1
countTF
.
keyboardType
=
.
numberPad
countTF
.
keyboardType
=
.
numberPad
priceTF
.
keyboardType
=
.
decimalPad
priceTF
.
keyboardType
=
.
decimalPad
priceTF
.
returnKeyType
=
.
done
priceTF
.
returnKeyType
=
.
done
priceTF
.
delegate
=
self
priceTF
.
delegate
=
self
countTF
.
delegate
=
self
// Initialization code
// Initialization code
}
}
func
textFieldDidEndEditing
(
_
textField
:
UITextField
)
{
if
textField
==
priceTF
{
//价格
if
isPurnNumber
(
str
:
textField
.
text
!
)
==
false
{
HUD
.
flash
(
.
label
(
"请输入正确的价格"
),
delay
:
1.2
)
textField
.
text
=
"0"
return
}
priceTF
.
text
=
formatShowNumber
(
value
:
textField
.
text
!
)
}
else
{
//数量
if
isPurnInt
(
string
:
textField
.
text
!
)
==
false
{
HUD
.
flash
(
.
label
(
"请输入正确的数量"
),
delay
:
1.2
)
textField
.
text
=
"1"
return
}
countTF
.
text
=
formatShowNumber
(
value
:
textField
.
text
!
)
}
if
isYuShou
!
{
delegate
?
.
PuTongJieTiContentSp
?(
price
:
priceTF
.
text
!
,
count
:
countTF
.
text
!
,
cell
:
self
)
}
else
{
delegate
?
.
PuTongJieTiContent
?(
price
:
priceTF
.
text
!
,
count
:
countTF
.
text
!
,
cell
:
self
)
}
}
func
textFieldShouldReturn
(
_
textField
:
UITextField
)
->
Bool
{
func
textFieldShouldReturn
(
_
textField
:
UITextField
)
->
Bool
{
((
delegate
?
.
PuTongJieTiClickDone
?())
!=
nil
)
((
delegate
?
.
PuTongJieTiClickDone
?())
!=
nil
)
}
}
@objc
func
textChange
(
textF
:
UITextField
){
delegate
?
.
PuTongJieTiContent
?(
price
:
priceTF
.
text
!
,
count
:
countTF
.
text
!
,
cell
:
self
)
}
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
super
.
setSelected
(
selected
,
animated
:
animated
)
super
.
setSelected
(
selected
,
animated
:
animated
)
// Configure the view for the selected state
// Configure the view for the selected state
}
}
...
...
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