Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
xffruit
Commits
d841c414
Commit
d841c414
authored
Sep 07, 2015
by
陈俊俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
f0b12a27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
71 deletions
+107
-71
ShopDetaileViewController.h
...trollers/PurchaseNotice/Views/ShopDetaileViewController.h
+4
-0
ShopDetaileViewController.m
...trollers/PurchaseNotice/Views/ShopDetaileViewController.m
+103
-71
No files found.
XFFruit/ViewControllers/PurchaseNotice/Views/ShopDetaileViewController.h
View file @
d841c414
...
...
@@ -8,7 +8,11 @@
#import "ICRBaseViewController.h"
#import "Survey.h"
#import "ShopDetail.h"
typedef
void
(
^
ChoseShopDetail
)(
ShopDetail
*
shopDetail
);
@interface
ShopDetaileViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
Survey
*
survey
;
@property
(
nonatomic
,
strong
)
ShopDetail
*
shopDetail
;
@property
(
nonatomic
,
strong
)
ChoseShopDetail
choseShopDetail
;
@property
(
nonatomic
,
strong
)
NSString
*
navTitle
;
@end
XFFruit/ViewControllers/PurchaseNotice/Views/ShopDetaileViewController.m
View file @
d841c414
...
...
@@ -43,6 +43,16 @@ typedef enum : NSUInteger {
UIDatePicker
*
_timePicker
;
BOOL
_isClickStart
;
StartTimeView
*
_startTimeView
;
UITextField
*
merchandise
;
//商品
UITextField
*
packageSpecification
;
//包装规格
UITextField
*
packageQuantity
;
//包装数量
UITextField
*
packageUnit
;
//包装单位
UITextField
*
foundationQuantity
;
//基础数量
UITextField
*
foundationUnitPrice
;
//基础单价
UITextField
*
packageUnitPrice
;
//包装单价
UITextField
*
totalMoney
;
//总金额
UITextField
*
remark
;
//备注
}
@property
(
nonatomic
,
strong
)
NSString
*
titleStr
;
@property
(
nonatomic
,
strong
)
NSString
*
productCodeStr
;
...
...
@@ -64,6 +74,9 @@ typedef enum : NSUInteger {
// Do any additional setup after loading the view.
}
-
(
void
)
initData
{
merchandise
=
[[
UITextField
alloc
]
init
];
packageUnit
=
[[
UITextField
alloc
]
init
];
merchandise
.
text
=
packageUnit
.
text
=
NULL
;
_dataArr
=
[
NSMutableArray
array
];
self
.
users
=
[
NSMutableArray
array
];
[
_dataArr
addObject
:
@"商品"
];
...
...
@@ -72,14 +85,14 @@ typedef enum : NSUInteger {
[
_dataArr
addObject
:
@"包装单位"
];
[
_dataArr
addObject
:
@"基础数量"
];
[
_dataArr
addObject
:
@"基础单价"
];
[
_dataArr
addObject
:
@"包装单
位
"
];
[
_dataArr
addObject
:
@"包装单
价
"
];
[
_dataArr
addObject
:
@"总金额"
];
[
_dataArr
addObject
:
@"备注"
];
}
-
(
void
)
setupSubviews
{
// self.view.backgroundColor = XXFBgColor;
// self.view.backgroundColor = XXFBgColor;
_tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
LeftMargin
))
style
:(
UITableViewStylePlain
)];
_tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
...
...
@@ -89,16 +102,16 @@ typedef enum : NSUInteger {
UIView
*
footView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
50
)];
UIButton
*
saveBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
10
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
BtnHeight
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
SaveTag
image
:
nil
title
:
@"
保存
"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
CornerRadius
bgColor
:
GXF_SAVE_COLOR
];
UIButton
*
saveBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
10
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
BtnHeight
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
SaveTag
image
:
nil
title
:
@"
删除
"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
CornerRadius
bgColor
:
GXF_SAVE_COLOR
];
[
footView
addSubview
:
saveBtn
];
UIButton
*
commitBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
saveBtn
.
frame
.
origin
.
x
+
saveBtn
.
frame
.
size
.
width
+
LeftMargin
,
10
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
BtnHeight
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
CommitTag
image
:
nil
title
:
@"
提交
"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
CornerRadius
bgColor
:
GXF_COMMIT_COLOR
];
UIButton
*
commitBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
saveBtn
.
frame
.
origin
.
x
+
saveBtn
.
frame
.
size
.
width
+
LeftMargin
,
10
,
(
ScreenSize
.
width
-
LeftMargin
*
3
)
/
2
,
BtnHeight
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
CommitTag
image
:
nil
title
:
@"
保存
"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
CornerRadius
bgColor
:
GXF_COMMIT_COLOR
];
[
footView
addSubview
:
commitBtn
];
// [self.view addSubview:footView];
// [self.view addSubview:footView];
_tableView
.
tableFooterView
=
footView
;
[
self
.
view
addSubview
:
_tableView
];
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
...
...
@@ -109,31 +122,70 @@ typedef enum : NSUInteger {
switch
(
btn
.
tag
)
{
case
SaveTag
:
{
// if ([self checkSurvey]) {
// [self saveSurvey:@"initial" message:@"正在保存..."];
// }
// if ([self checkSurvey]) {
// [self saveSurvey:@"initial" message:@"正在保存..."];
// }
}
break
;
case
CommitTag
:
{
// if ([self checkSurvey]) {
// [self saveSurvey:@"submitted" message:@"正在提交..."];
// }
if
([
self
informationComplete
])
{
ShopDetail
*
shopDetail
=
self
.
shopDetail
;
self
.
choseShopDetail
(
shopDetail
);
//回调
[
self
PopViewControllerAnimated
:
YES
];
// [self saveSurvey:@"submitted" message:@"正在提交..."];
}
}
break
;
default
:
break
;
}
}
-
(
BOOL
)
checkSurvey
{
self
.
titleStr
=
_titleField
.
text
;
self
.
remarkStr
=
_noteTextView
.
text
;
if
(
self
.
titleStr
.
length
==
0
||
self
.
productUuidStr
.
length
==
0
||
self
.
productNameStr
.
length
==
0
||
self
.
productCodeStr
.
length
==
0
||
self
.
users
.
count
<=
0
||
self
.
beginDateStr
.
length
==
0
||
self
.
endDateStr
.
length
==
0
)
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示信息"
message
:
@"信息不完整"
delegate
:
nil
cancelButtonTitle
:
@"确定"
otherButtonTitles
:
nil
,
nil
];
[
alert
show
];
-
(
BOOL
)
informationComplete
{
self
.
shopDetail
=
[[
ShopDetail
alloc
]
init
];
self
.
shopDetail
.
merchandise
=
merchandise
.
text
;
self
.
shopDetail
.
packageSpecification
=
packageSpecification
.
text
;
self
.
shopDetail
.
packageQuantity
=
packageQuantity
.
text
;
self
.
shopDetail
.
packageUnit
=
packageUnit
.
text
;
self
.
shopDetail
.
foundationQuantity
=
foundationQuantity
.
text
;
self
.
shopDetail
.
foundationUnitPrice
=
foundationUnitPrice
.
text
;
self
.
shopDetail
.
packageUnitPrice
=
packageUnitPrice
.
text
;
self
.
shopDetail
.
totalMoney
=
totalMoney
.
text
;
self
.
shopDetail
.
remark
=
remark
.
text
;
if
(
merchandise
.
text
.
length
==
0
)
{
ShowMessage
(
@"商品不能为空"
);
return
NO
;
}
if
(
packageSpecification
.
text
.
length
==
0
)
{
ShowMessage
(
@"包装规格不能为空"
);
return
NO
;
}
if
(
packageQuantity
.
text
.
length
==
0
)
{
ShowMessage
(
@"包装数量不能为空"
);
return
NO
;
}
if
(
packageUnit
.
text
.
length
==
0
)
{
ShowMessage
(
@"包装单位不能为空"
);
return
NO
;
}
if
(
foundationQuantity
.
text
.
length
==
0
)
{
ShowMessage
(
@"基础数量不能为空"
);
return
NO
;
}
if
(
foundationUnitPrice
.
text
.
length
==
0
)
{
ShowMessage
(
@"基础单价不能为空"
);
return
NO
;
}
if
(
packageUnitPrice
.
text
.
length
==
0
)
{
ShowMessage
(
@"总金额不能为空"
);
return
NO
;
}
if
(
remark
.
text
.
length
==
0
)
{
ShowMessage
(
@"备注不能为空"
);
return
NO
;
}
return
YES
;
}
...
...
@@ -225,11 +277,11 @@ typedef enum : NSUInteger {
return
_dataArr
.
count
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
// if (indexPath.row == 0){
// return TableHeight*2;
// }else{
return
TableHeight
;
// }
// if (indexPath.row == 0){
// return TableHeight*2;
// }else{
return
TableHeight
;
// }
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"cellID"
;
...
...
@@ -255,13 +307,13 @@ typedef enum : NSUInteger {
contentLabel
.
font
=
FontSize
(
TitleSize
);
[
cell
.
contentView
addSubview
:
contentLabel
];
if
(
indexPath
.
row
==
0
)
{
contentLabel
.
text
=
@"选择商品"
;
_productLabel
=
contentLabel
;
contentLabel
.
text
=
@"选择商品"
;
[
self
preferDataInProductLabel
];
}
else
if
(
indexPath
.
row
==
3
)
{
contentLabel
.
text
=
@"选择包装单位"
;
_PackagingLable
=
contentLabel
;
contentLabel
.
text
=
@"选择包装单位"
;
[
self
preferDataInProductLabel
];
}
...
...
@@ -276,69 +328,47 @@ typedef enum : NSUInteger {
_titleField
.
delegate
=
self
;
[
cell
.
contentView
addSubview
:
_titleField
];
if
(
indexPath
.
row
==
1
)
{
packageSpecification
=
_titleField
;
//包装规格
_titleField
.
placeholder
=
@"输入包装规格"
;
}
else
if
(
indexPath
.
row
==
2
)
{
packageQuantity
=
_titleField
;
//包装数量
_titleField
.
placeholder
=
@"输入包装数量"
;
}
else
if
(
indexPath
.
row
==
4
)
{
foundationQuantity
=
_titleField
;
//基础数量
_titleField
.
placeholder
=
@"输入基础数量"
;
}
else
if
(
indexPath
.
row
==
5
)
{
foundationUnitPrice
=
_titleField
;
//基础单价
_titleField
.
placeholder
=
@"输入基础单价"
;
}
else
if
(
indexPath
.
row
==
6
)
{
packageUnitPrice
=
_titleField
;
//包装单价
_titleField
.
placeholder
=
@"输入包装单价"
;
}
else
if
(
indexPath
.
row
==
7
)
{
totalMoney
=
_titleField
;
//总金额
_titleField
.
placeholder
=
@"输入总金额"
;
}
else
if
(
indexPath
.
row
==
8
)
{
remark
=
_titleField
;
//备注
_titleField
.
placeholder
=
@"输入备注内容"
;
}
}
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
2
||
indexPath
.
row
==
3
)
{
[
self
keyboardHidden
];
if
(
indexPath
.
row
==
2
)
{
_isClickStart
=
YES
;
}
else
{
_isClickStart
=
NO
;
}
[
self
startDatePickView
];
}
else
if
(
indexPath
.
row
==
4
){
ChosePersonViewController
*
cvc
=
[
ChosePersonViewController
new
];
cvc
.
choseBaseInfo
=
^
(
NSArray
*
users
){
NSString
*
textStr
=
@""
;
if
(
self
.
users
.
count
<=
0
)
{
[
self
.
users
removeAllObjects
];
}
for
(
SurveyUser
*
user
in
users
)
{
if
(
textStr
.
length
==
0
)
{
textStr
=
[
textStr
stringByAppendingFormat
:
@"%@"
,
user
.
userName
];
}
else
{
textStr
=
[
textStr
stringByAppendingFormat
:
@"、%@"
,
user
.
userName
];
}
[
self
.
users
addObject
:[
user
dictForCommit
]];
}
_personLabel
.
text
=
textStr
;
_personLabel
.
textColor
=
HexColor
(
@"444444"
);
};
cvc
.
isMoreChose
=
YES
;
[
self
PushViewController
:
cvc
animated
:
YES
];
}
else
if
(
indexPath
.
row
==
1
){
if
(
indexPath
.
row
==
0
){
ChooseProductViewController
*
cvc
=
[
ChooseProductViewController
new
];
cvc
.
choseBaseInfo
=
^
(
NSArray
*
products
){
Product
*
product
=
products
[
0
];
if
(
indexPath
.
row
==
0
){
ChooseProductViewController
*
cvc
=
[
ChooseProductViewController
new
];
cvc
.
choseProduct
=
^
(
Product
*
product
){
_productLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
product
.
name
,
product
.
code
];
merchandise
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
product
.
name
,
product
.
code
];
_productLabel
.
textColor
=
HexColor
(
@"444444"
);
self
.
productNameStr
=
product
.
name
;
self
.
productUuidStr
=
product
.
uuid
;
...
...
@@ -348,16 +378,18 @@ typedef enum : NSUInteger {
[
self
PushViewController
:
cvc
animated
:
YES
];
}
else
if
(
indexPath
.
row
==
3
)
{
SelectCompanyViewController
*
vc
=
[
SelectCompanyViewController
new
];
SelectCompanyViewController
*
vc
=
[
SelectCompanyViewController
new
];
vc
.
chosePackaging
=
^
(
NSString
*
Packaging
){
_PackagingLable
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
Packaging
];
packageUnit
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
Packaging
];
_PackagingLable
.
textColor
=
HexColor
(
@"444444"
);
};
[
self
PushViewController
:
vc
animated
:
YES
];
}
}
...
...
@@ -474,13 +506,13 @@ typedef enum : NSUInteger {
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
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