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
f205fe2b
Commit
f205fe2b
authored
Jun 15, 2020
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
供应商列表系列基本完成
parent
4e1eac1a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
594 additions
and
31 deletions
+594
-31
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/Interface/Interface_Z.plist
GeliBusinessPlatform/Interface/Interface_Z.plist
+4
-0
GeliBusinessPlatform/Model/Interface.swift
GeliBusinessPlatform/Model/Interface.swift
+1
-0
GeliBusinessPlatform/Model/UpDataModel.swift
GeliBusinessPlatform/Model/UpDataModel.swift
+1
-1
GeliBusinessPlatform/Model/VendorInterface.swift
GeliBusinessPlatform/Model/VendorInterface.swift
+49
-0
GeliBusinessPlatform/View/Cell/TitleAndOnlyBtnCell.xib
GeliBusinessPlatform/View/Cell/TitleAndOnlyBtnCell.xib
+5
-4
GeliBusinessPlatform/ViewController/供应商管理/GYSGLViewController.swift
...ssPlatform/ViewController/供应商管理/GYSGLViewController.swift
+499
-20
GeliBusinessPlatform/ViewController/供应商管理/GYSGLViewController.xib
...nessPlatform/ViewController/供应商管理/GYSGLViewController.xib
+7
-3
GeliBusinessPlatform/ViewController/供应商管理/GYSListViewController.swift
...Platform/ViewController/供应商管理/GYSListViewController.swift
+27
-3
GeliBusinessPlatform/ViewController/工作中心/WorkCViewController.swift
...essPlatform/ViewController/工作中心/WorkCViewController.swift
+1
-0
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
f205fe2b
No preview for this file type
GeliBusinessPlatform/Interface/Interface_Z.plist
View file @
f205fe2b
...
...
@@ -156,5 +156,9 @@
<string>
Purchase/backOut
</string>
<key>
采购单修改支付状态
</key>
<string>
Purchase/payStatus
</string>
<key>
供应商编辑
</key>
<string>
Vender/vendorEdit
</string>
<key>
新增供应商
</key>
<string>
Vender/vendorAdd
</string>
</dict>
</plist>
GeliBusinessPlatform/Model/Interface.swift
View file @
f205fe2b
...
...
@@ -20,6 +20,7 @@ func login(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@esc
failture
(
error
)
}
}
//MARK:--发送验证码
//params-key(phone(手机号),type( 验证类型,1注册,2修改密码,3登录,4格利商家绑定(修改绑定)格利支付,5格利支付绑定格利商家))
func
sendSmsCaptcha
(
_
params
:[
String
:
Any
],
success
:
@escaping
(
_
res
:
Any
)
->
(),
failture
:
@escaping
(
_
error
:
Error
)
->
())
{
...
...
GeliBusinessPlatform/Model/UpDataModel.swift
View file @
f205fe2b
...
...
@@ -8,7 +8,7 @@
import
Foundation
import
ObjectMapper
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址,删除地址,新增采购单,审核采购单,撤销入库,采购单修改支付状态
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址,删除地址,新增采购单,审核采购单,撤销入库,采购单修改支付状态
,供应商编辑,新增供应商
class
UpDataModel
:
Mappable
{
var
code
:
Int
?
...
...
GeliBusinessPlatform/Model/VendorInterface.swift
View file @
f205fe2b
...
...
@@ -24,3 +24,52 @@ func vendorList(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture
failture
(
error
)
}
}
//MARK:--供应商编辑
//- 说明:供应商信息在列表中已经全部列出,详情功能拿列表数据即可
/*
//user_token(验证token)
ven_id 供应商id
ven_name 供应商名
province 省id
city 市id
district 区id
address 详细地址
contacts_name 联系人
contacts_phone 联系电话
contacts_mobile 联系手机号
zhizhao 营业执照
food_production_license 食品流通许可证
*/
func
vendorEdit
(
_
params
:[
String
:
Any
],
success
:
@escaping
(
_
res
:
Any
)
->
(),
failture
:
@escaping
(
_
error
:
Error
)
->
())
{
NetworkRequest
.
sharedInstance
.
postRequest
(
"供应商编辑"
,
params
,
{
(
rep
:
DataResponse
<
UpDataModel
>
)
in
},
success
:
{
(
data
)
in
success
(
data
)
})
{
(
error
)
in
failture
(
error
)
}
}
//MARK:--新增供应商
//- 说明:供应商信息在列表中已经全部列出,详情功能拿列表数据即可
/*
//user_token(验证token)
ven_name 供应商名
province 省id
city 市id
district 区id
address 详细地址
contacts_name 联系人
contacts_phone 联系电话
contacts_mobile 联系手机号
zhizhao 营业执照
food_production_license 食品流通许可证
*/
func
vendorAdd
(
_
params
:[
String
:
Any
],
success
:
@escaping
(
_
res
:
Any
)
->
(),
failture
:
@escaping
(
_
error
:
Error
)
->
())
{
NetworkRequest
.
sharedInstance
.
postRequest
(
"新增供应商"
,
params
,
{
(
rep
:
DataResponse
<
UpDataModel
>
)
in
},
success
:
{
(
data
)
in
success
(
data
)
})
{
(
error
)
in
failture
(
error
)
}
}
GeliBusinessPlatform/View/Cell/TitleAndOnlyBtnCell.xib
View file @
f205fe2b
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1
5702
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1
6097
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"15704"
/>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"16087"
/>
<capability
name=
"Named colors"
minToolsVersion=
"9.0"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
...
...
@@ -10,7 +11,7 @@
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"default"
indentationWidth=
"10"
rowHeight=
"92"
id=
"KGk-i7-Jjw"
customClass=
"TitleAndOnlyBtnCell"
customModule=
"
GeliBusinessPlatform
"
customModuleProvider=
"target"
>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"default"
indentationWidth=
"10"
rowHeight=
"92"
id=
"KGk-i7-Jjw"
customClass=
"TitleAndOnlyBtnCell"
customModule=
"
TestClass
"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"375"
height=
"100"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
tableViewCell=
"KGk-i7-Jjw"
id=
"H2p-sc-9uM"
>
...
...
@@ -127,7 +128,7 @@
<color
red=
"0.92941176470588238"
green=
"0.92941176470588238"
blue=
"0.92941176470588238"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
</namedColor>
<namedColor
name=
"蓝色字体颜色"
>
<color
red=
"0.27
799999713897705"
green=
"0.56099998950958252"
blue=
"0.889999985694885
25"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
red=
"0.27
843137254901962"
green=
"0.5607843137254902"
blue=
"0.89019607843137
25"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
</namedColor>
</resources>
</document>
GeliBusinessPlatform/ViewController/供应商管理/GYSGLViewController.swift
View file @
f205fe2b
...
...
@@ -8,26 +8,113 @@
import
UIKit
import
LGButton
import
SwiftyJSON
import
Photos
protocol
GYSGLViewControllerDelegate
{
func
GYSGLViewControllerFinish
()
}
class
GYSGLViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndTFAndBtnCellDelegate
,
TitleAndOnlyBtnCellDelegate
,
SJMapViewControllerDelegate
,
UIPickerViewDelegate
,
UIPickerViewDataSource
,
GeliAlertViewDelegate
{
func
sureGeliAlertViewAction
(
sender
:
UIButton
)
{
HUD
.
flash
(
.
progress
)
var
dict
=
[
"user_token"
:
UserToken
as
Any
,
"ven_name"
:
gysName
as
Any
,
"province"
:
provinceIndex
as
Any
,
"city"
:
cityIndex
as
Any
,
"district"
:
areaIndex
as
Any
,
"address"
:
detailDzStr
as
Any
,
"contacts_name"
:
nameStr
as
Any
,
"contacts_phone"
:
telNum
as
Any
,
"contacts_mobile"
:
phoneNum
as
Any
,
"zhizhao"
:
zhizhao
as
Any
,
"food_production_license"
:
food_production_license
as
Any
]
switch
sender
.
tag
{
case
100
:
editField
([
"user_token"
:
UserToken
as
Any
,
"function_id"
:
48
as
Any
,
"prval"
:
ven_id
as
Any
,
"value"
:
2
as
Any
],
success
:
{
(
data
)
in
HUD
.
hide
()
self
.
delegate
?
.
GYSGLViewControllerFinish
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)})
{
(
error
)
in
}
break
case
101
:
dict
[
"ven_id"
]
=
ven_id
vendorEdit
(
dict
,
success
:
{
(
data
)
in
HUD
.
hide
()
HUD
.
flash
(
.
labeledSubSuccess
(
subtitle
:
"编辑成功"
),
delay
:
1.2
)
self
.
delegate
?
.
GYSGLViewControllerFinish
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
err
)
in
}
break
case
102
:
vendorAdd
(
dict
,
success
:
{
(
data
)
in
HUD
.
hide
()
HUD
.
flash
(
.
labeledSubSuccess
(
subtitle
:
"提交成功"
),
delay
:
1.2
)
self
.
delegate
?
.
GYSGLViewControllerFinish
()
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
})
{
(
err
)
in
class
GYSGLViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
TitleAndTFAndBtnCellDelegate
,
TitleAndOnlyBtnCellDelegate
{
}
break
default
:
break
}
}
var
delegate
:
GYSGLViewControllerDelegate
?
func
SJMapViewControllerSelectArd
(
adr
:
String
)
{
detailDzStr
=
adr
listView
.
reloadData
()
}
var
btmView
:
UIView
?
var
bgBtn
:
UIButton
?
//选择的省索引
var
provinceIndex
=
0
//选择的市索引
var
cityIndex
=
0
//选择的区(县)索引
var
areaIndex
=
0
var
gysName
:
String
=
""
var
dzStr
:
String
=
""
var
detailDzStr
:
String
=
""
var
nameStr
:
String
=
""
var
phoneNum
:
String
=
""
var
telNum
:
String
=
""
var
img1
:
UIImage
?
=
nil
var
img2
:
UIImage
?
=
nil
var
img1
=
UIImageView
()
var
img2
=
UIImageView
()
var
zhizhao
=
""
var
food_production_license
=
""
var
ven_id
:
Int
?
var
barT
=
""
let
UserToken
=
UserDefaults
.
standard
.
value
(
forKey
:
"user_token"
)
@IBOutlet
weak
var
listView
:
UITableView
!
@IBOutlet
weak
var
btmBtn
:
LGButton
!
func
rightBtnClick
()
{
let
alertView
=
GeliAlertView
(
frame
:
self
.
view
.
window
!.
bounds
)
alertView
.
delegate
=
self
;
alertView
.
tishiLbl
.
text
=
""
alertView
.
titileLbl
.
text
=
"是否删除供应商?"
alertView
.
rightBtn
.
setAttributedTitle
(
NSAttributedString
(
string
:
"确定"
),
for
:
.
normal
)
alertView
.
rightBtn
.
tag
=
100
self
.
view
.
window
?
.
addSubview
(
alertView
)
}
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
navbar
.
title
=
"供应商信息"
navbar
.
title
=
barT
if
barT
.
contains
(
"编辑"
){
navbar
.
rightTitle
=
"删除"
navbar
.
rightBtnColor
=
UIColor
(
named
:
"#F57575"
)
}
self
.
view
.
addSubview
(
navbar
)
getIndex
()
listView
.
separatorStyle
=
.
none
SetTopFrameView
(
view
:
listView
,
btmView
:
btmBtn
)
...
...
@@ -35,13 +122,6 @@ class GYSGLViewController: BaseViewController,UITableViewDelegate,UITableViewDat
listView
.
register
(
UINib
(
nibName
:
"TitleAndOnlyBtnCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndOnlyBtnCell"
)
listView
.
register
(
UINib
(
nibName
:
"TitleAndTFAndBtnCell"
,
bundle
:
nil
),
forCellReuseIdentifier
:
"TitleAndTFAndBtnCell"
)
if
img1
==
nil
||
img2
==
nil
||
gysName
==
""
||
phoneNum
==
""
||
telNum
==
""
||
nameStr
==
""
||
dzStr
==
""
||
detailDzStr
==
""
{
btmBtn
.
alpha
=
0.5
btmBtn
.
isUserInteractionEnabled
=
false
}
//测试有无图片状态数据
img1
=
UIImage
()
}
let
titleArr
=
[
"基本信息"
,
"联系人信息"
,
"其它信息"
]
//MARK: - cell delegate
...
...
@@ -71,12 +151,12 @@ class GYSGLViewController: BaseViewController,UITableViewDelegate,UITableViewDat
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
indexPath
.
section
==
2
{
if
img1
!=
nil
{
if
img1
.
image
!=
nil
{
if
indexPath
.
row
==
0
{
return
100
}
}
if
img2
!=
nil
{
if
img2
.
image
!=
nil
{
if
indexPath
.
row
==
1
{
return
100
}
...
...
@@ -102,52 +182,451 @@ class GYSGLViewController: BaseViewController,UITableViewDelegate,UITableViewDat
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
switch
indexPath
.
section
{
case
0
:
if
indexPath
.
row
==
1
{
if
indexPath
.
row
==
2
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTFAndBtnCell"
)
as!
TitleAndTFAndBtnCell
cell
.
titleLbl
.
text
=
sec1Arr
[
indexPath
.
row
]
cell
.
textTF
.
placeholder
=
hold1Arr
[
indexPath
.
row
]
if
barT
.
contains
(
"编辑"
){
cell
.
textTF
.
clearButtonMode
=
.
always
}
else
{
cell
.
textTF
.
clearButtonMode
=
.
whileEditing
}
if
detailDzStr
.
count
>
0
{
cell
.
textTF
.
text
=
detailDzStr
}
cell
.
delegate
=
self
return
cell
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTFCell"
)
as!
TitleAndTFCell
cell
.
nameLbl
.
text
=
sec1Arr
[
indexPath
.
row
]
cell
.
textTF
.
placeholder
=
hold1Arr
[
indexPath
.
row
]
if
indexPath
.
row
==
0
{
if
barT
.
contains
(
"编辑"
){
cell
.
textTF
.
clearButtonMode
=
.
always
}
else
{
cell
.
textTF
.
clearButtonMode
=
.
whileEditing
}
if
gysName
.
count
>
0
{
cell
.
textTF
.
text
=
gysName
}
}
else
{
cell
.
textTF
.
isUserInteractionEnabled
=
false
if
dzStr
.
count
>
0
{
cell
.
textTF
.
text
=
dzStr
}
}
return
cell
case
1
:
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndTFCell"
)
as!
TitleAndTFCell
cell
.
nameLbl
.
text
=
sec2Arr
[
indexPath
.
row
]
cell
.
textTF
.
placeholder
=
hold2Arr
[
indexPath
.
row
]
if
barT
.
contains
(
"编辑"
){
cell
.
textTF
.
clearButtonMode
=
.
always
}
else
{
cell
.
textTF
.
clearButtonMode
=
.
whileEditing
}
switch
indexPath
.
row
{
case
0
:
if
nameStr
.
count
>
0
{
cell
.
textTF
.
text
=
nameStr
}
break
case
1
:
if
phoneNum
.
count
>
0
{
cell
.
textTF
.
text
=
phoneNum
}
break
default
:
if
telNum
.
count
>
0
{
cell
.
textTF
.
text
=
telNum
}
break
}
return
cell
default
:
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"TitleAndOnlyBtnCell"
)
as!
TitleAndOnlyBtnCell
cell
.
titleLbl
.
text
=
sec3Arr
[
indexPath
.
row
]
cell
.
button
.
setTitle
(
"上传"
,
for
:
.
normal
)
cell
.
delegate
=
self
if
img1
!=
nil
{
cell
.
tag
=
indexPath
.
row
if
img1
.
image
!=
nil
{
if
indexPath
.
row
==
0
{
cell
.
imgBgView
.
isHidden
=
false
cell
.
imgView
.
image
=
img1
cell
.
imgView
.
image
=
img1
.
image
}
}
if
img2
!=
nil
{
if
img2
.
image
!=
nil
{
if
indexPath
.
row
==
1
{
cell
.
imgBgView
.
isHidden
=
false
cell
.
imgView
.
image
=
img2
cell
.
imgView
.
image
=
img2
.
image
}
}
return
cell
}
}
@objc
func
closeAction
(
sender
:
UIButton
){
bgBtn
?
.
removeFromSuperview
()
btmView
?
.
subviews
.
forEach
({
(
view
)
in
view
.
removeFromSuperview
()
})
btmView
?
.
removeFromSuperview
()
btmView
=
nil
bgBtn
=
nil
}
@objc
func
adrSelectFinish
(
sender
:
UIButton
){
var
proName
=
""
var
cityName
=
""
var
areaName
=
""
let
proDict
=
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
proName
=
proDict
[
"area_name"
]
as!
String
if
(
proDict
[
"city_list"
]
as!
NSArray
)
.
count
>
0
{
let
cityDict
=
(
proDict
[
"city_list"
]
as!
NSArray
)[
cityIndex
]
as!
[
String
:
AnyObject
]
cityName
=
cityDict
[
"area_name"
]
as!
String
if
(
cityDict
[
"district_list"
]
as!
NSArray
)
.
count
>
0
{
let
areaDict
=
(
cityDict
[
"district_list"
]
as!
NSArray
)[
areaIndex
]
as!
Dictionary
<
String
,
Any
>
areaName
=
areaDict
[
"area_name"
]
as!
String
}
}
var
selectAdr
=
proName
if
cityName
.
count
>
0
{
selectAdr
=
proName
+
"-"
+
cityName
if
areaName
.
count
>
0
{
selectAdr
=
proName
+
"-"
+
cityName
+
"-"
+
areaName
}
}
dzStr
=
selectAdr
bgBtn
?
.
removeFromSuperview
()
btmView
?
.
subviews
.
forEach
({
(
view
)
in
view
.
removeFromSuperview
()
})
btmView
?
.
removeFromSuperview
()
btmView
=
nil
bgBtn
=
nil
listView
.
reloadData
()
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
indexPath
.
section
==
0
{
if
indexPath
.
row
==
1
{
if
bgBtn
==
nil
{
let
btn
=
UIButton
()
self
.
view
.
addSubview
(
btn
)
btn
.
backgroundColor
=
UIColor
.
black
btn
.
alpha
=
0.4
btn
.
addTarget
(
self
,
action
:
#selector(
closeAction(sender:)
)
,
for
:
.
touchUpInside
)
btn
.
snp
.
makeConstraints
{
(
make
)
in
make
.
top
.
right
.
bottom
.
left
.
equalTo
(
0
)
}
bgBtn
=
btn
}
if
btmView
==
nil
{
let
view
=
UIView
()
view
.
backgroundColor
=
UIColor
.
white
btmView
=
view
self
.
view
.
addSubview
(
btmView
!
)
btmView
!.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
bottom
.
right
.
equalTo
(
0
)
make
.
height
.
equalTo
(
230
)
}
showAreaSelect
(
view
:
btmView
!
)
let
rightBtn
=
UIButton
()
rightBtn
.
setTitle
(
"确定"
,
for
:
.
normal
)
rightBtn
.
setTitleColor
(
UIColor
(
named
:
"蓝色字体颜色"
),
for
:
.
normal
)
rightBtn
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
15
)
rightBtn
.
addTarget
(
self
,
action
:
#selector(
adrSelectFinish(sender:)
)
,
for
:
.
touchUpInside
)
btmView
?
.
addSubview
(
rightBtn
)
rightBtn
.
snp
.
makeConstraints
{
(
make
)
in
make
.
right
.
equalTo
(
-
15
)
make
.
top
.
equalTo
(
0
)
make
.
height
.
equalTo
(
30
)
make
.
width
.
equalTo
(
50
)
}
let
leftBtn
=
UIButton
()
leftBtn
.
setTitle
(
"取消"
,
for
:
.
normal
)
leftBtn
.
setTitleColor
(
UIColor
(
named
:
"多选按钮字体颜色"
),
for
:
.
normal
)
leftBtn
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
15
)
leftBtn
.
addTarget
(
self
,
action
:
#selector(
closeAction(sender:)
)
,
for
:
.
touchUpInside
)
btmView
?
.
addSubview
(
leftBtn
)
leftBtn
.
snp
.
makeConstraints
{
(
make
)
in
make
.
left
.
equalTo
(
15
)
make
.
top
.
equalTo
(
0
)
make
.
height
.
equalTo
(
30
)
make
.
width
.
equalTo
(
50
)
}
}
}
}
if
indexPath
.
section
==
2
{
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
//结果处理
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
let
option
=
PHImageRequestOptions
()
option
.
isSynchronous
=
true
option
.
isNetworkAccessAllowed
=
true
for
asset
in
assets
{
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
indexPath
.
row
)
})
}
self
.
listView
.
reloadData
()
}
}
}
func
uploadImg
(
imge
:
UIImage
,
isOriginal
:
Bool
,
tag
:
Int
){
let
upLoadImg
=
imge
as!
UIImage
HUD
.
show
(
.
progress
)
saveFile
(
image
:
upLoadImg
,
[
"user_token"
:
UserToken
as
Any
,
"path"
:
"purchaseorder"
as
Any
],
success
:
{
(
data
)
in
let
dataM
=
data
as!
SaveFileModel
if
dataM
.
code
==
1
{
print
(
"图片上传成功
\(
dataM
.
data
?
.
url
)
"
)
if
tag
==
0
{
self
.
zhizhao
=
dataM
.
data
?
.
url
!
as!
String
self
.
img1
.
image
=
upLoadImg
}
else
{
self
.
food_production_license
=
dataM
.
data
?
.
url
!
as!
String
self
.
img2
.
image
=
upLoadImg
}
self
.
listView
.
reloadData
()
HUD
.
hide
()
}
})
{
(
error
)
in
print
(
"图片上传失败
\(
error
)
"
)
}
}
//自定义cell delegate
func
TitleAndOnlyBtnCellEditBtnClick
(
cell
:
TitleAndOnlyBtnCell
)
{
print
(
"编辑图片"
)
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
//结果处理
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
let
option
=
PHImageRequestOptions
()
option
.
isSynchronous
=
true
option
.
isNetworkAccessAllowed
=
true
for
asset
in
assets
{
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
cell
.
tag
)
})
}
self
.
listView
.
reloadData
()
}
}
func
TitleAndOnlyBtnCellBtnClick
(
cell
:
TitleAndOnlyBtnCell
)
{
print
(
"选择图片"
)
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
//结果处理
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
let
option
=
PHImageRequestOptions
()
option
.
isSynchronous
=
true
option
.
isNetworkAccessAllowed
=
true
for
asset
in
assets
{
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
cell
.
tag
)
})
}
self
.
listView
.
reloadData
()
}
}
func
TitleAndTFAndBtnCellBtnClick
()
{
let
vc
=
SJMapViewController
()
vc
.
delegate
=
self
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
func
getIndex
(){
let
path
=
Bundle
.
main
.
path
(
forResource
:
"address_new"
,
ofType
:
"json"
)
let
url
=
URL
(
fileURLWithPath
:
path
!
)
// 带throws的方法需要抛异常
do
{
let
data
=
try
Data
(
contentsOf
:
url
)
let
jsonData
=
JSON
(
data
)
print
(
"地址文件数据"
,
jsonData
[
"data"
])
self
.
addressArray
=
jsonData
[
"data"
]
.
arrayObject
!
for
i
in
0
..<
addressArray
.
count
{
let
item
=
addressArray
[
i
]
as!
Dictionary
<
String
,
Any
>
if
item
[
"area_id"
]
as!
Int
==
provinceIndex
{
let
citys
=
item
[
"city_list"
]
as!
Array
<
Dictionary
<
String
,
Any
>>
if
citys
.
count
==
0
{
provinceIndex
=
i
dzStr
=
item
[
"area_name"
]
!
as!
String
}
for
j
in
0
..<
citys
.
count
{
let
cItem
=
citys
[
j
]
if
cItem
[
"area_id"
]
as!
Int
==
cityIndex
{
let
districts
=
cItem
[
"district_list"
]
as!
Array
<
Dictionary
<
String
,
Any
>>
if
districts
.
count
==
0
{
cityIndex
=
j
dzStr
=
"
\(
item
[
"area_name"
]
!
)
-
\(
cItem
[
"area_name"
]
!
)
"
}
for
k
in
0
..<
districts
.
count
{
let
dItem
=
districts
[
k
]
if
dItem
[
"area_id"
]
as!
Int
==
areaIndex
{
provinceIndex
=
i
cityIndex
=
j
areaIndex
=
k
dzStr
=
"
\(
item
[
"area_name"
]
!
)
-
\(
cItem
[
"area_name"
]
!
)
-
\(
dItem
[
"area_name"
]
!
)
"
break
}
}
}
}
}
}
}
catch
let
error
as
Error
?
{
print
(
"读取本地数据出现错误!"
,
error
as
Any
)
}
}
//MARK:--地址选择器
func
showAreaSelect
(
view
:
UIView
){
//创建选择器
pickerView
=
UIPickerView
()
//将dataSource设置成自己
pickerView
.
dataSource
=
self
//将delegate设置成自己
pickerView
.
delegate
=
self
view
.
addSubview
(
pickerView
)
pickerView
.
snp
.
makeConstraints
{
(
make
)
in
make
.
top
.
equalTo
(
30
)
make
.
left
.
right
.
bottom
.
equalTo
(
0
)
}
pickerView
.
selectRow
(
provinceIndex
,
inComponent
:
0
,
animated
:
false
)
pickerView
(
pickerView
,
didSelectRow
:
provinceIndex
,
inComponent
:
0
)
pickerView
.
selectRow
(
cityIndex
,
inComponent
:
1
,
animated
:
false
)
pickerView
(
pickerView
,
didSelectRow
:
cityIndex
,
inComponent
:
1
)
pickerView
.
selectRow
(
areaIndex
,
inComponent
:
2
,
animated
:
false
)
pickerView
(
pickerView
,
didSelectRow
:
areaIndex
,
inComponent
:
2
)
}
//选择器
var
pickerView
:
UIPickerView
!
//所以地址数据集合
var
addressArray
:
Array
<
Any
>
=
[]
//设置选择框的列数为3列,继承于UIPickerViewDataSource协议
func
numberOfComponents
(
in
pickerView
:
UIPickerView
)
->
Int
{
return
3
}
//设置选择框的行数,继承于UIPickerViewDataSource协议
func
pickerView
(
_
pickerView
:
UIPickerView
,
numberOfRowsInComponent
component
:
Int
)
->
Int
{
if
component
==
0
{
return
self
.
addressArray
.
count
}
else
if
component
==
1
{
print
(
"alkjdflkasd == "
,
provinceIndex
)
let
province
=
self
.
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
return
(
province
[
"city_list"
]
!
as!
NSArray
)
.
count
}
else
{
let
province
=
self
.
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
if
(
province
[
"city_list"
]
as!
NSArray
)
.
count
==
0
{
return
0
}
if
let
city
=
(
province
[
"city_list"
]
as!
NSArray
)[
cityIndex
]
as?
[
String
:
AnyObject
]
{
print
(
city
[
"district_list"
]
as
Any
)
return
(
city
[
"district_list"
]
!
as!
NSArray
)
.
count
}
else
{
return
0
}
}
}
//设置选择框各选项的内容,继承于UIPickerViewDelegate协议
func
pickerView
(
_
pickerView
:
UIPickerView
,
titleForRow
row
:
Int
,
forComponent
component
:
Int
)
->
String
?
{
if
component
==
0
{
let
rowDic
=
self
.
addressArray
[
row
]
as!
Dictionary
<
String
,
Any
>
return
rowDic
[
"area_name"
]
as?
String
}
else
if
component
==
1
{
let
province
=
self
.
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
let
city
=
(
province
[
"city_list"
]
as!
NSArray
)[
row
]
as!
[
String
:
AnyObject
]
return
city
[
"area_name"
]
as?
String
}
else
{
let
province
=
self
.
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
let
city
=
(
province
[
"city_list"
]
as!
NSArray
)[
cityIndex
]
as!
[
String
:
AnyObject
]
let
area
=
(
city
[
"district_list"
]
as!
NSArray
)[
row
]
as!
Dictionary
<
String
,
Any
>
return
area
[
"area_name"
]
as?
String
}
}
//选中项改变事件(将在滑动停止后触发)
func
pickerView
(
_
pickerView
:
UIPickerView
,
didSelectRow
row
:
Int
,
inComponent
component
:
Int
)
{
//根据列、行索引判断需要改变数据的区域
switch
(
component
)
{
case
0
:
provinceIndex
=
row
;
pickerView
.
reloadComponent
(
1
);
pickerView
.
reloadComponent
(
2
);
pickerView
.
selectRow
(
cityIndex
,
inComponent
:
1
,
animated
:
false
)
pickerView
.
selectRow
(
areaIndex
,
inComponent
:
2
,
animated
:
false
)
case
1
:
cityIndex
=
row
;
pickerView
.
reloadComponent
(
2
);
pickerView
.
selectRow
(
areaIndex
,
inComponent
:
2
,
animated
:
false
)
case
2
:
areaIndex
=
row
;
default
:
break
;
}
}
//自定义UIPickerView
func
pickerView
(
_
pickerView
:
UIPickerView
,
viewForRow
row
:
Int
,
forComponent
component
:
Int
,
reusing
view
:
UIView
?)
->
UIView
{
let
genderLbl
=
UILabel
()
genderLbl
.
textAlignment
=
.
center
genderLbl
.
font
=
UIFont
.
systemFont
(
ofSize
:
15
)
genderLbl
.
textColor
=
UIColor
.
init
(
named
:
"标题字颜色"
)
if
component
==
0
{
let
rowDic
=
self
.
addressArray
[
row
]
as!
Dictionary
<
String
,
Any
>
genderLbl
.
text
=
rowDic
[
"area_name"
]
as?
String
}
else
if
component
==
1
{
let
province
=
self
.
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
let
city
=
(
province
[
"city_list"
]
as!
NSArray
)[
row
]
as!
[
String
:
AnyObject
]
genderLbl
.
text
=
city
[
"area_name"
]
as?
String
}
else
{
let
province
=
self
.
addressArray
[
provinceIndex
]
as!
Dictionary
<
String
,
Any
>
let
city
=
(
province
[
"city_list"
]
as!
NSArray
)[
cityIndex
]
as!
[
String
:
AnyObject
]
let
area
=
(
city
[
"district_list"
]
as!
NSArray
)[
row
]
as!
Dictionary
<
String
,
Any
>
genderLbl
.
text
=
area
[
"area_name"
]
as?
String
}
return
genderLbl
}
@IBAction
func
submitAction
(
_
sender
:
Any
)
{
let
alertView
=
GeliAlertView
(
frame
:
self
.
view
.
window
!.
bounds
)
alertView
.
delegate
=
self
;
alertView
.
tishiLbl
.
text
=
""
alertView
.
rightBtn
.
setAttributedTitle
(
NSAttributedString
(
string
:
"确定"
),
for
:
.
normal
)
if
barT
.
contains
(
"编辑"
){
alertView
.
titileLbl
.
text
=
"是否完成编辑?"
alertView
.
rightBtn
.
tag
=
101
}
else
{
alertView
.
titileLbl
.
text
=
"是否添加至供应商列表?"
alertView
.
rightBtn
.
tag
=
102
}
self
.
view
.
window
?
.
addSubview
(
alertView
)
}
}
GeliBusinessPlatform/ViewController/供应商管理/GYSGLViewController.xib
View file @
f205fe2b
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1
5702
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1
6097
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina4_7"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"15704"
/>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"16087"
/>
<capability
name=
"Named colors"
minToolsVersion=
"9.0"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"GYSGLViewController"
customModule=
"
GeliBusinessPlatform
"
customModuleProvider=
"target"
>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"GYSGLViewController"
customModule=
"
TestClass
"
customModuleProvider=
"target"
>
<connections>
<outlet
property=
"btmBtn"
destination=
"UDG-2C-6uA"
id=
"B0W-e7-mba"
/>
<outlet
property=
"listView"
destination=
"dCx-Vv-3aF"
id=
"OCD-Y1-cx8"
/>
...
...
@@ -32,6 +33,9 @@
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute
type=
"boolean"
keyPath=
"gradientHorizontal"
value=
"YES"
/>
</userDefinedRuntimeAttributes>
<connections>
<action
selector=
"submitAction:"
destination=
"-1"
eventType=
"touchUpInside"
id=
"Vr9-L7-cxd"
/>
</connections>
</view>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
usesAttributedText=
"YES"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"wSI-pD-gTn"
>
<rect
key=
"frame"
x=
"0.0"
y=
"618"
width=
"375"
height=
"49"
/>
...
...
GeliBusinessPlatform/ViewController/供应商管理/GYSListViewController.swift
View file @
f205fe2b
...
...
@@ -10,7 +10,11 @@ import UIKit
protocol
GYSListViewControllerDelegate
{
func
GYSListViewControllerGetGYS
(
sender
:
VendorListDataModel
)
}
class
GYSListViewController
:
BaseViewController
,
UITableViewDataSource
,
UITableViewDelegate
,
UISearchBarDelegate
,
SearchBarViewDelegate
{
class
GYSListViewController
:
BaseViewController
,
UITableViewDataSource
,
UITableViewDelegate
,
UISearchBarDelegate
,
SearchBarViewDelegate
,
GYSGLViewControllerDelegate
{
func
GYSGLViewControllerFinish
()
{
listView
.
mj_header
?
.
beginRefreshing
()
}
var
delegate
:
GYSListViewControllerDelegate
?
var
searchV
:
SearchBarView
?
=
nil
var
selectTarget
:
VendorListDataModel
?
...
...
@@ -25,7 +29,6 @@ class GYSListViewController: BaseViewController,UITableViewDataSource,UITableVie
@objc
func
loadData
(){
print
(
"加载数据"
)
page
=
1
let
dict
=
[
"user_token"
:
UserToken
as
Any
,
"keyword"
:
keyWord
as
Any
,
...
...
@@ -123,6 +126,7 @@ class GYSListViewController: BaseViewController,UITableViewDataSource,UITableVie
}
}
else
{
let
vc
=
GYSGLViewController
()
vc
.
barT
=
"新增供应商信息"
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
...
...
@@ -178,8 +182,28 @@ class GYSListViewController: BaseViewController,UITableViewDataSource,UITableVie
//MARK: - CELL DELEGATE
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
barTitle
==
"供应商管理"
{
let
data
=
datas
[
indexPath
.
row
]
let
vc
=
GYSGLViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
vc
.
delegate
=
self
vc
.
barT
=
"编辑供应商信息"
vc
.
gysName
=
data
.
ven_name
!
vc
.
provinceIndex
=
data
.
province
!
vc
.
cityIndex
=
data
.
city
!
vc
.
areaIndex
=
data
.
district
!
vc
.
detailDzStr
=
data
.
address
!
if
data
.
contacts_phone
!=
nil
{
vc
.
telNum
=
data
.
contacts_phone
!
}
vc
.
ven_id
=
data
.
ven_id
!
vc
.
nameStr
=
data
.
contacts_name
!
vc
.
phoneNum
=
data
.
contacts_mobile
!
vc
.
zhizhao
=
data
.
zhizhao
!
vc
.
food_production_license
=
data
.
food_production_license
!
vc
.
img1
.
sd_setImage
(
with
:
URL
(
string
:
SERVERCE_ImageHost
+
data
.
zhizhao
!
),
placeholderImage
:
UIImage
(
named
:
"worktest1"
))
print
(
"img = "
,
SERVERCE_ImageHost
+
data
.
zhizhao
!
)
vc
.
img2
.
sd_setImage
(
with
:
URL
(
string
:
SERVERCE_ImageHost
+
data
.
food_production_license
!
),
placeholderImage
:
UIImage
(
named
:
"worktest1"
))
self
.
navigationController
!.
pushViewController
(
vc
,
animated
:
true
)
}
else
{
selectTarget
=
datas
[
indexPath
.
row
]
listView
.
reloadData
()
...
...
GeliBusinessPlatform/ViewController/工作中心/WorkCViewController.swift
View file @
f205fe2b
...
...
@@ -525,6 +525,7 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
case
93
:
//供应商管理
// HUD.flash(.label("敬请期待"),delay: 1.2)
let
vc
=
GYSListViewController
()
vc
.
barTitle
=
"供应商管理"
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
return
case
113
:
//管理员列表
...
...
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