Commit bc476c75 authored by zhu's avatar zhu

保存删除逻辑

parent f7abd79d
...@@ -52,8 +52,8 @@ typedef enum : NSUInteger { ...@@ -52,8 +52,8 @@ typedef enum : NSUInteger {
NSMutableArray *selectCellAry; NSMutableArray *selectCellAry;
BOOL _isClickStart; BOOL _isClickStart;
UITableView *mingXiTableView; UITableView *mingXiTableView;
} }
@property (nonatomic,strong)NSString *titleStr; @property (nonatomic,strong)NSString *titleStr;
@property (nonatomic,strong)NSString *productCodeStr; @property (nonatomic,strong)NSString *productCodeStr;
...@@ -76,7 +76,7 @@ typedef enum : NSUInteger { ...@@ -76,7 +76,7 @@ typedef enum : NSUInteger {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self setupSubviews]; [self setupSubviews];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
-(void)setupSubviews -(void)setupSubviews
...@@ -92,7 +92,7 @@ typedef enum : NSUInteger { ...@@ -92,7 +92,7 @@ typedef enum : NSUInteger {
_tableView.bounces = NO; _tableView.bounces = NO;
_tableView.delegate = self; _tableView.delegate = self;
_tableView.dataSource = self; _tableView.dataSource = self;
mingXiTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 2*LeftMargin+_tableView.frame.size.height, ScreenSize.width, ScreenSize.height-_tableView.height-ScreenSize.height/5)]; mingXiTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 2*LeftMargin+_tableView.frame.size.height, ScreenSize.width, ScreenSize.height-_tableView.height-ScreenSize.height/5)];
mingXiTableView.backgroundColor = [UIColor whiteColor]; mingXiTableView.backgroundColor = [UIColor whiteColor];
mingXiTableView.tag=1002; mingXiTableView.tag=1002;
...@@ -103,7 +103,7 @@ typedef enum : NSUInteger { ...@@ -103,7 +103,7 @@ typedef enum : NSUInteger {
UIView *footView2=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)]; UIView *footView2=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
footView2.backgroundColor=[UIColor clearColor]; footView2.backgroundColor=[UIColor clearColor];
NSArray *ary=[NSArray arrayWithObjects:@"商品",@"价格",@"包装规格",@"包装数量", nil]; NSArray *ary=[NSArray arrayWithObjects:@"商品",@"价格",@"包装规格",@"包装数量", nil];
// NSArray *ary=[NSArray arrayWithObjects: nil]; // NSArray *ary=[NSArray arrayWithObjects: nil];
CGFloat gipWidth = (ScreenSize.width-(((RightWidth+70)+(LeftWidth+35))+(35+70)))/3; CGFloat gipWidth = (ScreenSize.width-(((RightWidth+70)+(LeftWidth+35))+(35+70)))/3;
for (int i=0; i< ary.count;i++ ) { for (int i=0; i< ary.count;i++ ) {
...@@ -120,11 +120,11 @@ typedef enum : NSUInteger { ...@@ -120,11 +120,11 @@ typedef enum : NSUInteger {
if (i==3) { if (i==3) {
lable.frame=CGRectMake(ScreenSize.width-RightWidth-70, 0, 70,TableHeight); lable.frame=CGRectMake(ScreenSize.width-RightWidth-70, 0, 70,TableHeight);
} }
// UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i,0, headWidth, 50)]; // UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i,0, headWidth, 50)];
lable.text=[ary objectAtIndex:i]; lable.text=[ary objectAtIndex:i];
lable.textColor=HexColor(@"444444"); lable.textColor=GXF_CONTENT_COLOR;
[footView2 addSubview:lable]; [footView2 addSubview:lable];
} }
UIView *footView3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)]; UIView *footView3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
...@@ -133,7 +133,7 @@ typedef enum : NSUInteger { ...@@ -133,7 +133,7 @@ typedef enum : NSUInteger {
[self.addDetailedButton setFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)]; [self.addDetailedButton setFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
[self.addDetailedButton setTitle:@"+ 点击添加商品明细" forState:UIControlStateNormal]; [self.addDetailedButton setTitle:@"+ 点击添加商品明细" forState:UIControlStateNormal];
[self.addDetailedButton addTarget:self action:@selector(addShopeDetailed) forControlEvents:UIControlEventTouchUpInside]; [self.addDetailedButton addTarget:self action:@selector(addShopeDetailed) forControlEvents:UIControlEventTouchUpInside];
[self.addDetailedButton setTitleColor:HexColor(@"444444") forState:UIControlStateNormal]; [self.addDetailedButton setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
self.FootLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, footView3.size.height-1, footView3.size.width-2*LeftMargin, 1))]; self.FootLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, footView3.size.height-1, footView3.size.width-2*LeftMargin, 1))];
self.FootLabel.backgroundColor = HexColor(@"e5e5e5"); self.FootLabel.backgroundColor = HexColor(@"e5e5e5");
self.FootLabel.font = FontSize(TitleSize); self.FootLabel.font = FontSize(TitleSize);
...@@ -141,7 +141,7 @@ typedef enum : NSUInteger { ...@@ -141,7 +141,7 @@ typedef enum : NSUInteger {
self.HeardLabel.backgroundColor = HexColor(@"e5e5e5"); self.HeardLabel.backgroundColor = HexColor(@"e5e5e5");
self.HeardLabel.font = FontSize(TitleSize); self.HeardLabel.font = FontSize(TitleSize);
//HexColor(@"e5e5e5") //HexColor(@"e5e5e5")
UIView *footView4 = [[UIView alloc]initWithFrame:CGRectMake(0, ScreenSize.height - BottomViewHeight - 64, ScreenSize.width, BottomViewHeight)]; UIView *footView4 = [[UIView alloc]initWithFrame:CGRectMake(0, ScreenSize.height - BottomViewHeight - 64, ScreenSize.width, BottomViewHeight)];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"50bd62")]; UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"50bd62")];
...@@ -156,13 +156,13 @@ typedef enum : NSUInteger { ...@@ -156,13 +156,13 @@ typedef enum : NSUInteger {
[footView3 addSubview:self.FootLabel]; [footView3 addSubview:self.FootLabel];
mingXiTableView.tableFooterView = footView3; mingXiTableView.tableFooterView = footView3;
mingXiTableView.tableHeaderView=footView2; mingXiTableView.tableHeaderView=footView2;
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
[self.view addSubview:mingXiTableView]; [self.view addSubview:mingXiTableView];
[self.view addSubview:footView4]; [self.view addSubview:footView4];
} }
#pragma mark - 协议方法 #pragma mark - 协议方法
...@@ -171,37 +171,37 @@ typedef enum : NSUInteger { ...@@ -171,37 +171,37 @@ typedef enum : NSUInteger {
return 1; return 1;
}else if ([tableView isEqual:mingXiTableView]) }else if ([tableView isEqual:mingXiTableView])
{ {
return 1; return 1;
} }
return 1; return 1;
} }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if ([tableView isEqual:_tableView]) { if ([tableView isEqual:_tableView]) {
return _dataArr.count; return _dataArr.count;
}else if ([tableView isEqual:mingXiTableView]) }else if ([tableView isEqual:mingXiTableView])
{ {
return _shopeArr.count; return _shopeArr.count;
} }
return 1; return 1;
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([tableView isEqual:_tableView]) { if ([tableView isEqual:_tableView]) {
static NSString *cellID = @"cellID";
SurveyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) { static NSString *cellID = @"cellID";
cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; SurveyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone; if (cell == nil) {
if (indexPath.row >0 && indexPath.row < _dataArr.count - 1) { cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.row >0 && indexPath.row < _dataArr.count - 1) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
[self createViewInCell:cell indexPath:indexPath];
} }
[self createViewInCell:cell indexPath:indexPath]; [cell setTitleStr:_dataArr[indexPath.row]];
} return cell;
[cell setTitleStr:_dataArr[indexPath.row]];
return cell;
}else if ([tableView isEqual:mingXiTableView]) }else if ([tableView isEqual:mingXiTableView])
{ {
...@@ -211,25 +211,26 @@ typedef enum : NSUInteger { ...@@ -211,25 +211,26 @@ typedef enum : NSUInteger {
Cell = [[PurchaseNoticeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID]; Cell = [[PurchaseNoticeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone; tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Cell.selectionStyle = UITableViewCellSelectionStyleNone; Cell.selectionStyle = UITableViewCellSelectionStyleNone;
// Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;向左箭头 // Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;向左箭头
[self showShopDetail:Cell indexPath:indexPath]; // [self showShopDetail:Cell indexPath:indexPath];
} }
[self showShopDetail:Cell indexPath:indexPath];
if (Cell.isSelected==YES) { if (Cell.isSelected==YES) {
Cell.arrowView.image = [UIImage imageNamed:@"arrowdown"]; Cell.arrowView.image = [UIImage imageNamed:@"arrowdown"];
Cell.backgroundColor=XXFBgColor; Cell.backgroundColor=XXFBgColor;
Cell.subSview.hidden=NO; Cell.subSview.hidden=NO;
}else }else
{ {
Cell.arrowView.image = [UIImage imageNamed:@"arrowright"]; Cell.arrowView.image = [UIImage imageNamed:@"arrowright"];
Cell.backgroundColor=[UIColor whiteColor]; Cell.backgroundColor=[UIColor whiteColor];
Cell.subSview.hidden=YES; Cell.subSview.hidden=YES;
} }
[Cell.button addTarget:self action:@selector(didtoucher) forControlEvents:UIControlEventTouchUpInside]; Cell.button.tag=indexPath.row;
[Cell.button addTarget:self action:@selector(didtoucher:) forControlEvents:UIControlEventTouchUpInside];
return Cell; return Cell;
} }
return nil; return nil;
} }
...@@ -245,49 +246,49 @@ typedef enum : NSUInteger { ...@@ -245,49 +246,49 @@ typedef enum : NSUInteger {
{ {
if ([self comperIndexpath:indexPath]) { if ([self comperIndexpath:indexPath]) {
return TableHeight*3; return TableHeight*3;
}else }else
{ {
return TableHeight; return TableHeight;
} }
} }
return TableHeight; return TableHeight;
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if ([tableView isEqual:_tableView]) { if ([tableView isEqual:_tableView]) {
if (indexPath.row == 2 || indexPath.row == 3) {
[self keyboardHidden];
if (indexPath.row == 2) {
_isClickStart = YES;
}else{
_isClickStart = NO;
}
}else if(indexPath.row == 1){ if (indexPath.row == 2 || indexPath.row == 3) {
ChosePersonViewController *cvc = [ChosePersonViewController new]; [self keyboardHidden];
cvc.choseBaseInfo = ^(NSArray *users){ if (indexPath.row == 2) {
NSString *textStr = @""; _isClickStart = YES;
if (self.users.count <=0) { }else{
[self.users removeAllObjects]; _isClickStart = NO;
} }
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");
}; }else if(indexPath.row == 1){
cvc.isMoreChose = NO; ChosePersonViewController *cvc = [ChosePersonViewController new];
[self PushViewController:cvc animated:YES]; 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 = GXF_CONTENT_COLOR;
};
cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES];
}
}else if ([tableView isEqual:mingXiTableView]) }else if ([tableView isEqual:mingXiTableView])
{ {
PurchaseNoticeCell *Cell=(PurchaseNoticeCell*)[mingXiTableView cellForRowAtIndexPath:indexPath ]; PurchaseNoticeCell *Cell=(PurchaseNoticeCell*)[mingXiTableView cellForRowAtIndexPath:indexPath ];
...@@ -299,9 +300,9 @@ typedef enum : NSUInteger { ...@@ -299,9 +300,9 @@ typedef enum : NSUInteger {
[selectCellAry removeObject:indexPath]; [selectCellAry removeObject:indexPath];
} }
selectedCellIndexPath = indexPath; selectedCellIndexPath = indexPath;
[mingXiTableView reloadData]; [mingXiTableView reloadData];
} }
} }
...@@ -311,13 +312,13 @@ typedef enum : NSUInteger { ...@@ -311,13 +312,13 @@ typedef enum : NSUInteger {
if (indexPath.row == 0) { if (indexPath.row == 0) {
_titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)]; _titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
_titleField.textAlignment = NSTextAlignmentRight; _titleField.textAlignment = NSTextAlignmentRight;
_titleField.textColor = HexColor(@"444444"); _titleField.textColor = GXF_CONTENT_COLOR;
_titleField.placeholder = @"输入采购通知标题"; _titleField.placeholder = @"输入采购通知标题";
_titleField.font = FontSize(15); _titleField.font = FontSize(15);
_titleField.returnKeyType = UIReturnKeyDone; _titleField.returnKeyType = UIReturnKeyDone;
_titleField.delegate = self; _titleField.delegate = self;
[cell.contentView addSubview:_titleField]; [cell.contentView addSubview:_titleField];
}else if (indexPath.row == _dataArr.count -1){ }else if (indexPath.row == _dataArr.count -1){
_noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)]; _noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
_noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0); _noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
...@@ -335,7 +336,7 @@ typedef enum : NSUInteger { ...@@ -335,7 +336,7 @@ typedef enum : NSUInteger {
}else{ }else{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))]; UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight; contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb"); contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = FontSize(TitleSize); contentLabel.font = FontSize(TitleSize);
[cell.contentView addSubview:contentLabel]; [cell.contentView addSubview:contentLabel];
if (indexPath.row == 1) { if (indexPath.row == 1) {
...@@ -344,7 +345,7 @@ typedef enum : NSUInteger { ...@@ -344,7 +345,7 @@ typedef enum : NSUInteger {
[self preferDataInPersonLabel]; [self preferDataInPersonLabel];
} }
} }
} }
-(BOOL)comperIndexpath:(NSIndexPath *)indexPath -(BOOL)comperIndexpath:(NSIndexPath *)indexPath
{ {
for (NSIndexPath *path in selectCellAry) { for (NSIndexPath *path in selectCellAry) {
...@@ -366,7 +367,7 @@ typedef enum : NSUInteger { ...@@ -366,7 +367,7 @@ typedef enum : NSUInteger {
} }
} }
_personLabel.text = personStr; _personLabel.text = personStr;
_personLabel.textColor = HexColor(@"444444"); _personLabel.textColor = GXF_CONTENT_COLOR;
} }
if (self.users > 0) { if (self.users > 0) {
...@@ -377,16 +378,17 @@ typedef enum : NSUInteger { ...@@ -377,16 +378,17 @@ typedef enum : NSUInteger {
//添加商品明细 //添加商品明细
-(void)addShopeDetailed -(void)addShopeDetailed
{ {
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init]; ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
// 回调 // 回调
svc.choseShopDetail = ^(ShopDetail *shopDetail){ svc.choseShopDetail = ^(ShopDetail *shopDetail){
[_shopeArr addObject:shopDetail]; [_shopeArr addObject:shopDetail];
[mingXiTableView reloadData]; [mingXiTableView reloadData];
}; };
svc.title = [IBTCommon localizableString:@"AddShopDetail"]; svc.title = [IBTCommon localizableString:@"AddShopDetail"];
[self PushViewController:svc animated:YES]; [self PushViewController:svc animated:YES];
} }
-(void)showShopDetail:(PurchaseNoticeCell*)Cell indexPath:(NSIndexPath *)indexPath -(void)showShopDetail:(PurchaseNoticeCell*)Cell indexPath:(NSIndexPath *)indexPath
{ {
...@@ -396,7 +398,7 @@ typedef enum : NSUInteger { ...@@ -396,7 +398,7 @@ typedef enum : NSUInteger {
Cell.BzggLabel.text=shopDetail.packageSpecification;//包装规格 Cell.BzggLabel.text=shopDetail.packageSpecification;//包装规格
Cell.BzslLabel.text=shopDetail.packageQuantity;//包装数量 Cell.BzslLabel.text=shopDetail.packageQuantity;//包装数量
Cell.packageSpecification.text=shopDetail.packageSpecification;//包装规格 Cell.packageSpecification.text=shopDetail.packageSpecification;//包装规格
Cell.foundationQuantity.text=shopDetail.foundationQuantity;//基础数量 Cell.foundationQuantity.text=shopDetail.foundationQuantity;//基础数量
Cell.packageUnitPrice.text=shopDetail.packageUnitPrice;//包装单价 Cell.packageUnitPrice.text=shopDetail.packageUnitPrice;//包装单价
Cell.remark.text=shopDetail.remark;//备注 Cell.remark.text=shopDetail.remark;//备注
Cell.packageQuantity.text=shopDetail.packageQuantity;//包装数量 Cell.packageQuantity.text=shopDetail.packageQuantity;//包装数量
...@@ -405,13 +407,30 @@ typedef enum : NSUInteger { ...@@ -405,13 +407,30 @@ typedef enum : NSUInteger {
} }
//编辑 //编辑
- (void)didtoucher - (void)didtoucher:(UIButton*)button
{ {
// EditorShopDetail ShopDetail *shopDetail=[_shopeArr objectAtIndex:button.tag];
shopDetail.IsXiuGai=YES;
// EditorShopDetail
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init]; ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
svc.choseShopDetail = ^(ShopDetail *Detail){
if (Detail.IsDeleted) {
[_shopeArr removeObjectAtIndex:button.tag];
}else{
[_shopeArr replaceObjectAtIndex:button.tag withObject:Detail];
}
[mingXiTableView reloadData];
// NSIndexPath *indexPath_1=[NSIndexPath indexPathForRow:button.tag inSection:0];
// NSArray *indexArray=[NSArray arrayWithObject:indexPath_1];
// [mingXiTableView reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationLeft];
};
svc.shopDetail=shopDetail;
svc.title = [IBTCommon localizableString:@"EditorShopDetail"]; svc.title = [IBTCommon localizableString:@"EditorShopDetail"];
[self PushViewController:svc animated:YES]; [self PushViewController:svc animated:YES];
// //
NSLog(@"123213232332323223"); NSLog(@"123213232332323223");
} }
#pragma mark delegate #pragma mark delegate
...@@ -466,13 +485,13 @@ typedef enum : NSUInteger { ...@@ -466,13 +485,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
...@@ -18,5 +18,7 @@ ...@@ -18,5 +18,7 @@
@property (nonatomic,strong)NSString *packageUnitPrice;//包装单价 @property (nonatomic,strong)NSString *packageUnitPrice;//包装单价
@property (nonatomic,strong)NSString *totalMoney;//总金额 @property (nonatomic,strong)NSString *totalMoney;//总金额
@property (nonatomic,strong)NSString *remark;//备注 @property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,assign)BOOL IsDeleted;//是否删除
@property (nonatomic,assign)BOOL IsXiuGai;//是否删除
@end @end
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
// } // }
lable.text=[array objectAtIndex:i]; lable.text=[array objectAtIndex:i];
lable.font=FontSize(TitleSize-2); lable.font=FontSize(TitleSize-2);
[lable setTextColor:HexColor(@"444444")]; [lable setTextColor:GXF_CONTENT_COLOR];
[self.subSview addSubview:lable]; [self.subSview addSubview:lable];
UILabel*shopeLable= [self.shopDetailAry1 objectAtIndex:i]; UILabel*shopeLable= [self.shopDetailAry1 objectAtIndex:i];
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
} }
shopeLable.font=FontSize(TitleSize-2); shopeLable.font=FontSize(TitleSize-2);
[shopeLable setTextColor:HexColor(@"444444")]; [shopeLable setTextColor:GXF_CONTENT_COLOR];
// shopeLable.backgroundColor=[UIColor redColor]; // shopeLable.backgroundColor=[UIColor redColor];
[self.subSview addSubview:shopeLable]; [self.subSview addSubview:shopeLable];
} }
...@@ -113,13 +113,13 @@ ...@@ -113,13 +113,13 @@
lable.text=[array1 objectAtIndex:i]; lable.text=[array1 objectAtIndex:i];
lable.font=FontSize(TitleSize-2); lable.font=FontSize(TitleSize-2);
[lable setTextColor:HexColor(@"444444")]; [lable setTextColor:GXF_CONTENT_COLOR];
[self.subSview addSubview:lable]; [self.subSview addSubview:lable];
UILabel*shopeLable= [self.shopDetailAry2 objectAtIndex:i]; UILabel*shopeLable= [self.shopDetailAry2 objectAtIndex:i];
shopeLable.frame=CGRectMake(lable.frame.origin.x-LeftMargin+lable.frame.size.width, lable.frame.origin.y,(ScreenSize.width-2*LeftMargin)/4, 10); shopeLable.frame=CGRectMake(lable.frame.origin.x-LeftMargin+lable.frame.size.width, lable.frame.origin.y,(ScreenSize.width-2*LeftMargin)/4, 10);
shopeLable.font=FontSize(TitleSize-2); shopeLable.font=FontSize(TitleSize-2);
[shopeLable setTextColor:HexColor(@"444444")]; [shopeLable setTextColor:GXF_CONTENT_COLOR];
// shopeLable.backgroundColor=[UIColor redColor]; // shopeLable.backgroundColor=[UIColor redColor];
[self.subSview addSubview:shopeLable]; [self.subSview addSubview:shopeLable];
} }
......
...@@ -71,7 +71,7 @@ typedef enum : NSUInteger { ...@@ -71,7 +71,7 @@ typedef enum : NSUInteger {
self.title = self.navTitle; self.title = self.navTitle;
[self initData]; [self initData];
[self setupSubviews]; [self setupSubviews];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
- (void)initData{ - (void)initData{
merchandise=[[UITextField alloc]init]; merchandise=[[UITextField alloc]init];
...@@ -88,6 +88,7 @@ typedef enum : NSUInteger { ...@@ -88,6 +88,7 @@ typedef enum : NSUInteger {
[_dataArr addObject:@"包装单价"]; [_dataArr addObject:@"包装单价"];
[_dataArr addObject:@"总金额"]; [_dataArr addObject:@"总金额"];
[_dataArr addObject:@"备注"]; [_dataArr addObject:@"备注"];
} }
-(void)setupSubviews -(void)setupSubviews
...@@ -113,6 +114,27 @@ typedef enum : NSUInteger { ...@@ -113,6 +114,27 @@ typedef enum : NSUInteger {
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
} }
- (void)setviewsData
{
if (self.shopDetail!=nil) {
_productLabel.text=self.shopDetail.merchandise;//商品
merchandise.text=self.shopDetail.merchandise;
packageUnit.text=self.shopDetail.packageUnit;
_PackagingLable.text=self.shopDetail.packageUnit;//包装单位
packageSpecification.text=self.shopDetail.packageSpecification;//包装规格
packageQuantity.text=self.shopDetail.packageQuantity; //包装数量
foundationQuantity.text=self.shopDetail.foundationQuantity; //基础数量
foundationUnitPrice.text=self.shopDetail.foundationUnitPrice; //基础单价
packageUnitPrice.text=self.shopDetail.packageUnitPrice; //包装单价
totalMoney.text=self.shopDetail.totalMoney; //总金额
remark.text=self.shopDetail.remark;
_productLabel.textColor=GXF_CONTENT_COLOR;
_PackagingLable.textColor=GXF_CONTENT_COLOR;
}
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
...@@ -120,8 +142,25 @@ typedef enum : NSUInteger { ...@@ -120,8 +142,25 @@ typedef enum : NSUInteger {
#pragma mark - 按钮点击事件 #pragma mark - 按钮点击事件
- (void)btnClick:(UIButton *)btn{ - (void)btnClick:(UIButton *)btn{
switch (btn.tag) { switch (btn.tag) {
case SaveTag: case SaveTag://删除
{ {
if (self.shopDetail!=nil) {
ShopDetail *shopDetail=self.shopDetail;
if (shopDetail.IsXiuGai==YES) {
shopDetail.IsDeleted=YES;
self.choseShopDetail(shopDetail);//回调
[self PopViewControllerAnimated:YES];
}else
{
[self clearShopDetail];
}
}else
{
[self clearShopDetail];
}
// if ([self checkSurvey]) { // if ([self checkSurvey]) {
// [self saveSurvey:@"initial" message:@"正在保存..."]; // [self saveSurvey:@"initial" message:@"正在保存..."];
// } // }
...@@ -131,6 +170,7 @@ typedef enum : NSUInteger { ...@@ -131,6 +170,7 @@ typedef enum : NSUInteger {
{ {
if ([self informationComplete]) { if ([self informationComplete]) {
ShopDetail *shopDetail=self.shopDetail; ShopDetail *shopDetail=self.shopDetail;
shopDetail.IsDeleted=NO;
self.choseShopDetail(shopDetail);//回调 self.choseShopDetail(shopDetail);//回调
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
// [self saveSurvey:@"submitted" message:@"正在提交..."]; // [self saveSurvey:@"submitted" message:@"正在提交..."];
...@@ -141,6 +181,24 @@ typedef enum : NSUInteger { ...@@ -141,6 +181,24 @@ typedef enum : NSUInteger {
break; break;
} }
} }
- (void)clearShopDetail
{
_productLabel.text=@"选择商品";//商品
merchandise.text=@"";
packageUnit.text=@"";
_PackagingLable.text=@"选择包装单位";//包装单位
packageSpecification.text=@"";//包装规格
packageQuantity.text=@""; //包装数量
foundationQuantity.text=@""; //基础数量
foundationUnitPrice.text=@""; //基础单价
packageUnitPrice.text=@""; //包装单价
totalMoney.text=@""; //总金额
remark.text=@"";
_productLabel.textColor=GXF_PLACEHOLDER_COLOR;
_PackagingLable.textColor=GXF_PLACEHOLDER_COLOR;
}
- (BOOL)informationComplete{ - (BOOL)informationComplete{
self.shopDetail=[[ShopDetail alloc]init]; self.shopDetail=[[ShopDetail alloc]init];
self.shopDetail.merchandise=merchandise.text; self.shopDetail.merchandise=merchandise.text;
...@@ -246,13 +304,13 @@ typedef enum : NSUInteger { ...@@ -246,13 +304,13 @@ typedef enum : NSUInteger {
- (void)clearAllInformation{ - (void)clearAllInformation{
_titleField.text = @""; _titleField.text = @"";
_productLabel.text = @"请输入商品"; _productLabel.text = @"请输入商品";
_productLabel.textColor = HexColor(@"bbbbbb"); _productLabel.textColor = GXF_PLACEHOLDER_COLOR;
_startDateLabel.text = @"选择日期"; _startDateLabel.text = @"选择日期";
_startDateLabel.textColor = HexColor(@"bbbbbb"); _startDateLabel.textColor = GXF_PLACEHOLDER_COLOR;
_endDateLabel.text = @"选择日期"; _endDateLabel.text = @"选择日期";
_endDateLabel.textColor = HexColor(@"bbbbbb"); _endDateLabel.textColor = GXF_PLACEHOLDER_COLOR;
_personLabel.text = @"选择调研人员"; _personLabel.text = @"选择调研人员";
_personLabel.textColor = HexColor(@"bbbbbb"); _personLabel.textColor = GXF_PLACEHOLDER_COLOR;
_noteTextView.text = @""; _noteTextView.text = @"";
//清空数据 //清空数据
self.titleStr = @""; self.titleStr = @"";
...@@ -303,7 +361,7 @@ typedef enum : NSUInteger { ...@@ -303,7 +361,7 @@ typedef enum : NSUInteger {
if (indexPath.row == 0||indexPath.row==3) { if (indexPath.row == 0||indexPath.row==3) {
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))]; UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight; contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb"); contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = FontSize(TitleSize); contentLabel.font = FontSize(TitleSize);
[cell.contentView addSubview:contentLabel]; [cell.contentView addSubview:contentLabel];
if (indexPath.row==0) { if (indexPath.row==0) {
...@@ -321,7 +379,7 @@ typedef enum : NSUInteger { ...@@ -321,7 +379,7 @@ typedef enum : NSUInteger {
{ {
_titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)]; _titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
_titleField.textAlignment = NSTextAlignmentRight; _titleField.textAlignment = NSTextAlignmentRight;
_titleField.textColor = HexColor(@"444444"); _titleField.textColor = GXF_CONTENT_COLOR;
_titleField.placeholder = @"输入调研标题"; _titleField.placeholder = @"输入调研标题";
_titleField.font = FontSize(15); _titleField.font = FontSize(15);
_titleField.returnKeyType = UIReturnKeyDone; _titleField.returnKeyType = UIReturnKeyDone;
...@@ -358,6 +416,7 @@ typedef enum : NSUInteger { ...@@ -358,6 +416,7 @@ typedef enum : NSUInteger {
} }
[self setviewsData];
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
...@@ -368,7 +427,7 @@ typedef enum : NSUInteger { ...@@ -368,7 +427,7 @@ typedef enum : NSUInteger {
Product *product=products [0]; 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]; merchandise.text=[NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_productLabel.textColor = HexColor(@"444444"); _productLabel.textColor = GXF_CONTENT_COLOR;
self.productNameStr = product.name; self.productNameStr = product.name;
self.productUuidStr = product.uuid; self.productUuidStr = product.uuid;
self.productCodeStr = product.code; self.productCodeStr = product.code;
...@@ -382,7 +441,7 @@ typedef enum : NSUInteger { ...@@ -382,7 +441,7 @@ typedef enum : NSUInteger {
_PackagingLable.text = [NSString stringWithFormat:@"%@",Packaging]; _PackagingLable.text = [NSString stringWithFormat:@"%@",Packaging];
packageUnit.text=[NSString stringWithFormat:@"%@",Packaging]; packageUnit.text=[NSString stringWithFormat:@"%@",Packaging];
_PackagingLable.textColor = HexColor(@"444444"); _PackagingLable.textColor = GXF_CONTENT_COLOR;
}; };
...@@ -404,7 +463,7 @@ typedef enum : NSUInteger { ...@@ -404,7 +463,7 @@ typedef enum : NSUInteger {
} }
} }
_personLabel.text = personStr; _personLabel.text = personStr;
_personLabel.textColor = HexColor(@"444444"); _personLabel.textColor = GXF_CONTENT_COLOR;
} }
if (self.users > 0) { if (self.users > 0) {
...@@ -415,7 +474,7 @@ typedef enum : NSUInteger { ...@@ -415,7 +474,7 @@ typedef enum : NSUInteger {
- (void)preferDataInProductLabel{ - (void)preferDataInProductLabel{
if (self.survey) { if (self.survey) {
_productLabel.text = [IBTCommon checkString:self.survey.productName]; _productLabel.text = [IBTCommon checkString:self.survey.productName];
_productLabel.textColor = HexColor(@"444444"); _productLabel.textColor = GXF_CONTENT_COLOR;
self.productCodeStr = [IBTCommon checkString:self.survey.productCode]; self.productCodeStr = [IBTCommon checkString:self.survey.productCode];
self.productNameStr = [IBTCommon checkString:self.survey.productName]; self.productNameStr = [IBTCommon checkString:self.survey.productName];
self.productUuidStr = [IBTCommon checkString:self.survey.productUuid]; self.productUuidStr = [IBTCommon checkString:self.survey.productUuid];
...@@ -445,11 +504,11 @@ typedef enum : NSUInteger { ...@@ -445,11 +504,11 @@ typedef enum : NSUInteger {
} }
- (void)okTimeView:(NSDate *)time{ - (void)okTimeView:(NSDate *)time{
if (_isClickStart) { if (_isClickStart) {
_startDateLabel.textColor = HexColor(@"444444"); _startDateLabel.textColor = GXF_CONTENT_COLOR;
_startDateLabel.text = [IBTCommon stringFromDate:time]; _startDateLabel.text = [IBTCommon stringFromDate:time];
self.beginDateStr = [time httpParameterString]; self.beginDateStr = [time httpParameterString];
}else{ }else{
_endDateLabel.textColor = HexColor(@"444444"); _endDateLabel.textColor = GXF_CONTENT_COLOR;
_endDateLabel.text = [IBTCommon stringFromDate:time]; _endDateLabel.text = [IBTCommon stringFromDate:time];
self.endDateStr = [time httpParameterString]; self.endDateStr = [time httpParameterString];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment