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
Show 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 @@
...
@@ -8,7 +8,11 @@
#import "ICRBaseViewController.h"
#import "ICRBaseViewController.h"
#import "Survey.h"
#import "Survey.h"
#import "ShopDetail.h"
typedef
void
(
^
ChoseShopDetail
)(
ShopDetail
*
shopDetail
);
@interface
ShopDetaileViewController
:
ICRBaseViewController
@interface
ShopDetaileViewController
:
ICRBaseViewController
@property
(
nonatomic
,
strong
)
Survey
*
survey
;
@property
(
nonatomic
,
strong
)
Survey
*
survey
;
@property
(
nonatomic
,
strong
)
ShopDetail
*
shopDetail
;
@property
(
nonatomic
,
strong
)
ChoseShopDetail
choseShopDetail
;
@property
(
nonatomic
,
strong
)
NSString
*
navTitle
;
@property
(
nonatomic
,
strong
)
NSString
*
navTitle
;
@end
@end
XFFruit/ViewControllers/PurchaseNotice/Views/ShopDetaileViewController.m
View file @
d841c414
...
@@ -43,6 +43,16 @@ typedef enum : NSUInteger {
...
@@ -43,6 +43,16 @@ typedef enum : NSUInteger {
UIDatePicker
*
_timePicker
;
UIDatePicker
*
_timePicker
;
BOOL
_isClickStart
;
BOOL
_isClickStart
;
StartTimeView
*
_startTimeView
;
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
*
titleStr
;
@property
(
nonatomic
,
strong
)
NSString
*
productCodeStr
;
@property
(
nonatomic
,
strong
)
NSString
*
productCodeStr
;
...
@@ -64,6 +74,9 @@ typedef enum : NSUInteger {
...
@@ -64,6 +74,9 @@ typedef enum : NSUInteger {
// Do any additional setup after loading the view.
// Do any additional setup after loading the view.
}
}
-
(
void
)
initData
{
-
(
void
)
initData
{
merchandise
=
[[
UITextField
alloc
]
init
];
packageUnit
=
[[
UITextField
alloc
]
init
];
merchandise
.
text
=
packageUnit
.
text
=
NULL
;
_dataArr
=
[
NSMutableArray
array
];
_dataArr
=
[
NSMutableArray
array
];
self
.
users
=
[
NSMutableArray
array
];
self
.
users
=
[
NSMutableArray
array
];
[
_dataArr
addObject
:
@"商品"
];
[
_dataArr
addObject
:
@"商品"
];
...
@@ -72,14 +85,14 @@ typedef enum : NSUInteger {
...
@@ -72,14 +85,14 @@ typedef enum : NSUInteger {
[
_dataArr
addObject
:
@"包装单位"
];
[
_dataArr
addObject
:
@"包装单位"
];
[
_dataArr
addObject
:
@"基础数量"
];
[
_dataArr
addObject
:
@"基础数量"
];
[
_dataArr
addObject
:
@"基础单价"
];
[
_dataArr
addObject
:
@"基础单价"
];
[
_dataArr
addObject
:
@"包装单
位
"
];
[
_dataArr
addObject
:
@"包装单
价
"
];
[
_dataArr
addObject
:
@"总金额"
];
[
_dataArr
addObject
:
@"总金额"
];
[
_dataArr
addObject
:
@"备注"
];
[
_dataArr
addObject
:
@"备注"
];
}
}
-
(
void
)
setupSubviews
-
(
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
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
LeftMargin
))
style
:(
UITableViewStylePlain
)];
_tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
_tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
...
@@ -89,13 +102,13 @@ typedef enum : NSUInteger {
...
@@ -89,13 +102,13 @@ typedef enum : NSUInteger {
UIView
*
footView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenSize
.
width
,
50
)];
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
];
[
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
];
[
footView
addSubview
:
commitBtn
];
// [self.view addSubview:footView];
// [self.view addSubview:footView];
_tableView
.
tableFooterView
=
footView
;
_tableView
.
tableFooterView
=
footView
;
[
self
.
view
addSubview
:
_tableView
];
[
self
.
view
addSubview
:
_tableView
];
...
@@ -109,31 +122,70 @@ typedef enum : NSUInteger {
...
@@ -109,31 +122,70 @@ typedef enum : NSUInteger {
switch
(
btn
.
tag
)
{
switch
(
btn
.
tag
)
{
case
SaveTag
:
case
SaveTag
:
{
{
// if ([self checkSurvey]) {
// if ([self checkSurvey]) {
// [self saveSurvey:@"initial" message:@"正在保存..."];
// [self saveSurvey:@"initial" message:@"正在保存..."];
// }
// }
}
}
break
;
break
;
case
CommitTag
:
case
CommitTag
:
{
{
// if ([self checkSurvey]) {
if
([
self
informationComplete
])
{
// [self saveSurvey:@"submitted" message:@"正在提交..."];
ShopDetail
*
shopDetail
=
self
.
shopDetail
;
// }
self
.
choseShopDetail
(
shopDetail
);
//回调
[
self
PopViewControllerAnimated
:
YES
];
// [self saveSurvey:@"submitted" message:@"正在提交..."];
}
}
}
break
;
break
;
default
:
default
:
break
;
break
;
}
}
}
}
-
(
BOOL
)
checkSurvey
{
-
(
BOOL
)
informationComplete
{
self
.
titleStr
=
_titleField
.
text
;
self
.
shopDetail
=
[[
ShopDetail
alloc
]
init
];
self
.
remarkStr
=
_noteTextView
.
text
;
self
.
shopDetail
.
merchandise
=
merchandise
.
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
)
{
self
.
shopDetail
.
packageSpecification
=
packageSpecification
.
text
;
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示信息"
message
:
@"信息不完整"
delegate
:
nil
cancelButtonTitle
:
@"确定"
otherButtonTitles
:
nil
,
nil
];
self
.
shopDetail
.
packageQuantity
=
packageQuantity
.
text
;
[
alert
show
];
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
NO
;
}
}
return
YES
;
return
YES
;
}
}
...
@@ -225,11 +277,11 @@ typedef enum : NSUInteger {
...
@@ -225,11 +277,11 @@ typedef enum : NSUInteger {
return
_dataArr
.
count
;
return
_dataArr
.
count
;
}
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
// if (indexPath.row == 0){
// if (indexPath.row == 0){
// return TableHeight*2;
// return TableHeight*2;
// }else{
// }else{
return
TableHeight
;
return
TableHeight
;
// }
// }
}
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"cellID"
;
static
NSString
*
cellID
=
@"cellID"
;
...
@@ -255,13 +307,13 @@ typedef enum : NSUInteger {
...
@@ -255,13 +307,13 @@ typedef enum : NSUInteger {
contentLabel
.
font
=
FontSize
(
TitleSize
);
contentLabel
.
font
=
FontSize
(
TitleSize
);
[
cell
.
contentView
addSubview
:
contentLabel
];
[
cell
.
contentView
addSubview
:
contentLabel
];
if
(
indexPath
.
row
==
0
)
{
if
(
indexPath
.
row
==
0
)
{
contentLabel
.
text
=
@"选择商品"
;
_productLabel
=
contentLabel
;
_productLabel
=
contentLabel
;
contentLabel
.
text
=
@"选择商品"
;
[
self
preferDataInProductLabel
];
[
self
preferDataInProductLabel
];
}
else
if
(
indexPath
.
row
==
3
)
}
else
if
(
indexPath
.
row
==
3
)
{
{
contentLabel
.
text
=
@"选择包装单位"
;
_PackagingLable
=
contentLabel
;
_PackagingLable
=
contentLabel
;
contentLabel
.
text
=
@"选择包装单位"
;
[
self
preferDataInProductLabel
];
[
self
preferDataInProductLabel
];
}
}
...
@@ -276,24 +328,31 @@ typedef enum : NSUInteger {
...
@@ -276,24 +328,31 @@ typedef enum : NSUInteger {
_titleField
.
delegate
=
self
;
_titleField
.
delegate
=
self
;
[
cell
.
contentView
addSubview
:
_titleField
];
[
cell
.
contentView
addSubview
:
_titleField
];
if
(
indexPath
.
row
==
1
)
{
if
(
indexPath
.
row
==
1
)
{
packageSpecification
=
_titleField
;
//包装规格
_titleField
.
placeholder
=
@"输入包装规格"
;
_titleField
.
placeholder
=
@"输入包装规格"
;
}
else
if
(
indexPath
.
row
==
2
)
}
else
if
(
indexPath
.
row
==
2
)
{
{
packageQuantity
=
_titleField
;
//包装数量
_titleField
.
placeholder
=
@"输入包装数量"
;
_titleField
.
placeholder
=
@"输入包装数量"
;
}
else
if
(
indexPath
.
row
==
4
)
}
else
if
(
indexPath
.
row
==
4
)
{
{
foundationQuantity
=
_titleField
;
//基础数量
_titleField
.
placeholder
=
@"输入基础数量"
;
_titleField
.
placeholder
=
@"输入基础数量"
;
}
else
if
(
indexPath
.
row
==
5
)
}
else
if
(
indexPath
.
row
==
5
)
{
{
foundationUnitPrice
=
_titleField
;
//基础单价
_titleField
.
placeholder
=
@"输入基础单价"
;
_titleField
.
placeholder
=
@"输入基础单价"
;
}
else
if
(
indexPath
.
row
==
6
)
}
else
if
(
indexPath
.
row
==
6
)
{
{
packageUnitPrice
=
_titleField
;
//包装单价
_titleField
.
placeholder
=
@"输入包装单价"
;
_titleField
.
placeholder
=
@"输入包装单价"
;
}
else
if
(
indexPath
.
row
==
7
)
}
else
if
(
indexPath
.
row
==
7
)
{
{
totalMoney
=
_titleField
;
//总金额
_titleField
.
placeholder
=
@"输入总金额"
;
_titleField
.
placeholder
=
@"输入总金额"
;
}
else
if
(
indexPath
.
row
==
8
)
}
else
if
(
indexPath
.
row
==
8
)
{
{
remark
=
_titleField
;
//备注
_titleField
.
placeholder
=
@"输入备注内容"
;
_titleField
.
placeholder
=
@"输入备注内容"
;
}
}
...
@@ -302,43 +361,14 @@ typedef enum : NSUInteger {
...
@@ -302,43 +361,14 @@ typedef enum : NSUInteger {
}
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
-
(
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
){
ChooseProductViewController
*
cvc
=
[
ChooseProductViewController
new
];
cvc
.
choseBaseInfo
=
^
(
NSArray
*
products
){
Product
*
product
=
products
[
0
];
if
(
indexPath
.
row
==
0
){
if
(
indexPath
.
row
==
0
){
ChooseProductViewController
*
cvc
=
[
ChooseProductViewController
new
];
ChooseProductViewController
*
cvc
=
[
ChooseProductViewController
new
];
cvc
.
choseProduct
=
^
(
Product
*
product
){
cvc
.
choseBaseInfo
=
^
(
NSArray
*
products
){
Product
*
product
=
products
[
0
];
_productLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
product
.
name
,
product
.
code
];
_productLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
product
.
name
,
product
.
code
];
merchandise
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,
product
.
name
,
product
.
code
];
_productLabel
.
textColor
=
HexColor
(
@"444444"
);
_productLabel
.
textColor
=
HexColor
(
@"444444"
);
self
.
productNameStr
=
product
.
name
;
self
.
productNameStr
=
product
.
name
;
self
.
productUuidStr
=
product
.
uuid
;
self
.
productUuidStr
=
product
.
uuid
;
...
@@ -352,12 +382,14 @@ typedef enum : NSUInteger {
...
@@ -352,12 +382,14 @@ typedef enum : NSUInteger {
vc
.
chosePackaging
=
^
(
NSString
*
Packaging
){
vc
.
chosePackaging
=
^
(
NSString
*
Packaging
){
_PackagingLable
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
Packaging
];
_PackagingLable
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
Packaging
];
packageUnit
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
Packaging
];
_PackagingLable
.
textColor
=
HexColor
(
@"444444"
);
_PackagingLable
.
textColor
=
HexColor
(
@"444444"
);
};
};
[
self
PushViewController
:
vc
animated
:
YES
];
[
self
PushViewController
:
vc
animated
:
YES
];
}
}
}
}
...
@@ -474,13 +506,13 @@ typedef enum : NSUInteger {
...
@@ -474,13 +506,13 @@ typedef enum : NSUInteger {
}
}
/*
/*
#pragma mark - Navigation
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
// Pass the selected object to the new view controller.
}
}
*/
*/
@end
@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