NewPurchaseNoticeViewController.m 18.6 KB
Newer Older
朱朝吉's avatar
朱朝吉 committed
1 2 3 4 5 6 7 8 9 10
//
//  NewPurchaseNoticeViewController.m
//  XFFruit
//
//  Created by mac on 15/8/16.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "NewPurchaseNoticeViewController.h"

朱朝吉's avatar
朱朝吉 committed
11 12 13 14 15 16 17
#import "SurveyCell.h"
#import "HPGrowingTextView.h"

#import "ChosePersonViewController.h"
#import "SurveyUser.h"
#import "Survey.h"
#import "PurchaseNoticeCell.h"
zhu's avatar
zhu committed
18
#import "ShopDetaileViewController.h"
zhu's avatar
zhu committed
19
#import "ShopDetail.h"
朱朝吉's avatar
朱朝吉 committed
20
#define LeftMargin 15
zhu's avatar
zhu committed
21 22 23
#define LeftWidth 40
#define RightWidth 30
#define SpaceMargin 1
朱朝吉's avatar
朱朝吉 committed
24 25 26 27 28 29 30 31
#define BtnHeight 44
#define TableHeight 46
#define CornerRadius 5
#define TitleSize 15
#define BtnSize 19
#define TotalHeight 432
#define KeyboardHeight 258
#define DateViewHeight 300
zhu's avatar
zhu committed
32
#define FootOfsetHeight 140
zhu's avatar
zhu committed
33 34
#define BottomViewHeight 60

zhu's avatar
zhu committed
35

zhu's avatar
zhu committed
36 37 38 39
typedef enum : NSUInteger {
    SaveTag = 8000,
    CommitTag,
} BtnTag;
朱朝吉's avatar
朱朝吉 committed
40 41 42 43
@interface NewPurchaseNoticeViewController()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,HPGrowingTextViewDelegate>
{
    UITableView *_tableView;
    NSMutableArray *_dataArr;
zhu's avatar
zhu committed
44
    NSMutableArray *_shopeArr;
朱朝吉's avatar
朱朝吉 committed
45 46 47 48 49 50
    UITextField *_titleField;
    UILabel *_productLabel;
    UILabel *_startDateLabel;
    UILabel *_endDateLabel;
    UILabel *_personLabel;
    HPGrowingTextView *_noteTextView;
zhu's avatar
zhu committed
51
    NSIndexPath *selectedCellIndexPath;
zhu's avatar
zhu committed
52
    NSMutableArray *selectCellAry;
朱朝吉's avatar
朱朝吉 committed
53 54
    BOOL _isClickStart;
    UITableView *mingXiTableView;
zhu's avatar
zhu committed
55 56
    
    
朱朝吉's avatar
朱朝吉 committed
57 58 59 60 61 62 63 64 65 66
}
@property (nonatomic,strong)NSString *titleStr;
@property (nonatomic,strong)NSString *productCodeStr;
@property (nonatomic,strong)NSString *productNameStr;
@property (nonatomic,strong)NSString *productUuidStr;
@property (nonatomic,strong)NSString *beginDateStr;
@property (nonatomic,strong)NSString *endDateStr;
@property (nonatomic,strong)NSString *remarkStr;
@property (nonatomic,strong)NSMutableArray *users;
@property (nonatomic,strong)Survey *survey;
zhu's avatar
zhu committed
67 68 69 70
@property (nonatomic,strong)UILabel *HeardLabel;
@property (nonatomic,strong)UILabel *FootLabel;
@property (nonatomic,strong)UIButton *addDetailedButton;

朱朝吉's avatar
朱朝吉 committed
71

朱朝吉's avatar
朱朝吉 committed
72 73 74 75 76 77 78

@end

@implementation NewPurchaseNoticeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
zhu's avatar
zhu committed
79
    [self setupSubviews];
朱朝吉's avatar
朱朝吉 committed
80 81
    // Do any additional setup after loading the view.
}
朱朝吉's avatar
朱朝吉 committed
82 83
-(void)setupSubviews
{
zhu's avatar
zhu committed
84
    selectCellAry=[[NSMutableArray alloc]initWithCapacity:1000];
朱朝吉's avatar
朱朝吉 committed
85
    _dataArr=[[NSMutableArray alloc]initWithObjects:@"标题:",@"采购员:",@"备注:", nil];
zhu's avatar
zhu committed
86
    _shopeArr=[[NSMutableArray alloc]initWithObjects: nil];
朱朝吉's avatar
朱朝吉 committed
87 88
    self.view.backgroundColor  = XXFBgColor;
    
zhu's avatar
zhu committed
89
    _tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, LeftMargin,ScreenSize.width, ScreenSize.height/3-LeftMargin)) style:(UITableViewStylePlain)];
朱朝吉's avatar
朱朝吉 committed
90 91 92 93 94
    _tableView.backgroundColor = [UIColor whiteColor];
    _tableView.tag=1001;
    _tableView.bounces = NO;
    _tableView.delegate = self;
    _tableView.dataSource = self;
zhu's avatar
zhu committed
95
    
zhu's avatar
zhu committed
96
    mingXiTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 2*LeftMargin+_tableView.frame.size.height, ScreenSize.width, ScreenSize.height-_tableView.height-ScreenSize.height/5)];
zhu's avatar
zhu committed
97
    mingXiTableView.backgroundColor = [UIColor whiteColor];
朱朝吉's avatar
朱朝吉 committed
98
    mingXiTableView.tag=1002;
zhu's avatar
zhu committed
99
    mingXiTableView.bounces=NO;
朱朝吉's avatar
朱朝吉 committed
100 101 102
    mingXiTableView.delegate=self;
    mingXiTableView.dataSource=self;
    
zhu's avatar
zhu committed
103 104
    UIView *footView2=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
    footView2.backgroundColor=[UIColor clearColor];
zhu's avatar
zhu committed
105
    NSArray *ary=[NSArray arrayWithObjects:@"商品",@"价格",@"包装规格",@"包装数量", nil];
zhu's avatar
zhu committed
106
    //    NSArray *ary=[NSArray arrayWithObjects: nil];
zhu's avatar
zhu committed
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
    CGFloat gipWidth = (ScreenSize.width-(((RightWidth+70)+(LeftWidth+35))+(35+70)))/3;
    
    for (int i=0; i< ary.count;i++ ) {
        UILabel *lable=[[UILabel alloc]init];
        if (i==0) {
            lable.frame=CGRectMake(LeftWidth, 0, 35,TableHeight);
        }
        if (i==1) {
            lable.frame=CGRectMake(LeftWidth+35+gipWidth, 0, 35,TableHeight);
        }
        if (i==2) {
            lable.frame=CGRectMake(LeftWidth+35+gipWidth+35+gipWidth, 0, 70,TableHeight);
        }
        if (i==3) {
            lable.frame=CGRectMake(ScreenSize.width-RightWidth-70, 0, 70,TableHeight);
        }
zhu's avatar
zhu committed
123
        //        UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i,0, headWidth, 50)];
zhu's avatar
zhu committed
124
        lable.text=[ary objectAtIndex:i];
zhu's avatar
zhu committed
125
        lable.textColor=GXF_CONTENT_COLOR;
zhu's avatar
zhu committed
126
        [footView2 addSubview:lable];
zhu's avatar
zhu committed
127
        
zhu's avatar
zhu committed
128
    }
zhu's avatar
zhu committed
129 130 131 132
    
    UIView *footView3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
    footView3.backgroundColor=[UIColor clearColor];
    self.addDetailedButton=[UIButton  buttonWithType: UIButtonTypeCustom];
zhu's avatar
zhu committed
133
    [self.addDetailedButton  setFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
zhu's avatar
zhu committed
134 135
    [self.addDetailedButton setTitle:@"+ 点击添加商品明细" forState:UIControlStateNormal];
    [self.addDetailedButton addTarget:self action:@selector(addShopeDetailed) forControlEvents:UIControlEventTouchUpInside];
zhu's avatar
zhu committed
136
    [self.addDetailedButton setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
zhu's avatar
zhu committed
137 138 139 140 141 142 143
    self.FootLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, footView3.size.height-1, footView3.size.width-2*LeftMargin, 1))];
    self.FootLabel.backgroundColor = HexColor(@"e5e5e5");
    self.FootLabel.font = FontSize(TitleSize);
    self.HeardLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, footView3.size.width-2*LeftMargin, 1))];
    self.HeardLabel.backgroundColor = HexColor(@"e5e5e5");
    self.HeardLabel.font = FontSize(TitleSize);
    //HexColor(@"e5e5e5")
zhu's avatar
zhu committed
144
    
zhu's avatar
zhu committed
145 146 147 148 149 150 151 152 153
    
    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")];
    [footView4 addSubview:saveBtn];
    
    UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(saveBtn.frame) + 15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"f69100")];
    [footView4 addSubview:commitBtn];
    
    [self.view addSubview:footView4];
zhu's avatar
zhu committed
154 155 156 157
    [footView3 addSubview:self.addDetailedButton];
    [footView3 addSubview:self.HeardLabel];
    [footView3 addSubview:self.FootLabel];
    
朱朝吉's avatar
朱朝吉 committed
158
    
zhu's avatar
zhu committed
159
    
zhu's avatar
zhu committed
160 161 162
    mingXiTableView.tableFooterView = footView3;
    mingXiTableView.tableHeaderView=footView2;
    [self.view addSubview:_tableView];
朱朝吉's avatar
朱朝吉 committed
163
    [self.view addSubview:mingXiTableView];
zhu's avatar
zhu committed
164
    [self.view addSubview:footView4];
zhu's avatar
zhu committed
165
    
朱朝吉's avatar
朱朝吉 committed
166 167 168 169 170 171 172 173
}

#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    if ([tableView isEqual:_tableView]) {
        return 1;
    }else if ([tableView isEqual:mingXiTableView])
    {
zhu's avatar
zhu committed
174
        return 1;
朱朝吉's avatar
朱朝吉 committed
175 176 177 178 179 180
    }
    
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if ([tableView isEqual:_tableView]) {
zhu's avatar
zhu committed
181
        return _dataArr.count;
朱朝吉's avatar
朱朝吉 committed
182 183
    }else if ([tableView isEqual:mingXiTableView])
    {
zhu's avatar
zhu committed
184
        return _shopeArr.count;
朱朝吉's avatar
朱朝吉 committed
185 186 187 188 189
    }
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if ([tableView isEqual:_tableView]) {
zhu's avatar
zhu committed
190
        
zhu's avatar
zhu committed
191 192 193 194 195 196 197 198 199 200 201
        static NSString *cellID = @"cellID";
        SurveyCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
        
        if (cell == nil) {
            cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
            tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            if (indexPath.row >0 && indexPath.row < _dataArr.count - 1) {
                cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            }
            [self createViewInCell:cell indexPath:indexPath];
朱朝吉's avatar
朱朝吉 committed
202
        }
zhu's avatar
zhu committed
203 204
        [cell setTitleStr:_dataArr[indexPath.row]];
        return cell;
朱朝吉's avatar
朱朝吉 committed
205 206 207 208 209 210 211 212 213
    }else if ([tableView isEqual:mingXiTableView])
    {
        
        static NSString *CellID = @"CellID";
        PurchaseNoticeCell *Cell = [tableView dequeueReusableCellWithIdentifier:CellID];
        if (Cell == nil) {
            Cell = [[PurchaseNoticeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
            tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
            Cell.selectionStyle = UITableViewCellSelectionStyleNone;
zhu's avatar
zhu committed
214 215 216
            
            //            Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;向左箭头
            //            [self  showShopDetail:Cell indexPath:indexPath];
zhu's avatar
zhu committed
217
        }
zhu's avatar
zhu committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231
        [self  showShopDetail:Cell indexPath:indexPath];
        if (Cell.isSelected==YES) {
            Cell.arrowView.image = [UIImage imageNamed:@"arrowdown"];
            Cell.backgroundColor=XXFBgColor;
            Cell.subSview.hidden=NO;
        }else
        {
            Cell.arrowView.image = [UIImage imageNamed:@"arrowright"];
            Cell.backgroundColor=[UIColor whiteColor];
            Cell.subSview.hidden=YES;
            
        }
        Cell.button.tag=indexPath.row;
        [Cell.button addTarget:self action:@selector(didtoucher:) forControlEvents:UIControlEventTouchUpInside];
朱朝吉's avatar
朱朝吉 committed
232
        return Cell;
zhu's avatar
zhu committed
233
        
朱朝吉's avatar
朱朝吉 committed
234 235 236 237 238 239 240 241 242 243 244 245 246
    }
    return nil;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([tableView isEqual:_tableView]) {
        if (indexPath.row == 2){
            return TableHeight*2;
        }else{
            return TableHeight;
        }
        
    }else if ([tableView isEqual:mingXiTableView])
    {
zhu's avatar
zhu committed
247 248
        
        
zhu's avatar
zhu committed
249 250 251 252 253 254 255
        if ([self  comperIndexpath:indexPath]) {
            return TableHeight*3;
        }else
        {
            return TableHeight;
        }
        
朱朝吉's avatar
朱朝吉 committed
256 257 258 259 260 261
    }
    return TableHeight;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([tableView isEqual:_tableView]) {
        
zhu's avatar
zhu committed
262 263 264 265 266 267
        if (indexPath.row == 2 || indexPath.row == 3) {
            [self keyboardHidden];
            if (indexPath.row == 2) {
                _isClickStart = YES;
            }else{
                _isClickStart = NO;
朱朝吉's avatar
朱朝吉 committed
268 269
            }
            
zhu's avatar
zhu committed
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
        }else if(indexPath.row == 1){
            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 = GXF_CONTENT_COLOR;
                
            };
            cvc.isMoreChose = NO;
            [self PushViewController:cvc animated:YES];
        }
zhu's avatar
zhu committed
292 293 294
    }else if ([tableView isEqual:mingXiTableView])
    {
        PurchaseNoticeCell *Cell=(PurchaseNoticeCell*)[mingXiTableView cellForRowAtIndexPath:indexPath ];
zhu's avatar
zhu committed
295 296 297 298 299 300 301 302
        if (Cell.isSelected==NO) {
            Cell.isSelected=YES;
            [selectCellAry addObject:indexPath];
        }else{
            Cell.isSelected=NO;
            [selectCellAry removeObject:indexPath];
        }
        
zhu's avatar
zhu committed
303 304
        selectedCellIndexPath = indexPath;
        
zhu's avatar
zhu committed
305
        
zhu's avatar
zhu committed
306
        [mingXiTableView reloadData];
朱朝吉's avatar
朱朝吉 committed
307 308 309 310 311 312
    }
}


-  (void)createViewInCell:(SurveyCell *)cell indexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
陈俊俊's avatar
陈俊俊 committed
313
        _titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)];
朱朝吉's avatar
朱朝吉 committed
314
        _titleField.textAlignment = NSTextAlignmentRight;
zhu's avatar
zhu committed
315
        _titleField.textColor = GXF_CONTENT_COLOR;
朱朝吉's avatar
朱朝吉 committed
316 317 318 319 320
        _titleField.placeholder = @"输入采购通知标题";
        _titleField.font = FontSize(15);
        _titleField.returnKeyType = UIReturnKeyDone;
        _titleField.delegate = self;
        [cell.contentView addSubview:_titleField];
zhu's avatar
zhu committed
321
        
朱朝吉's avatar
朱朝吉 committed
322
    }else if (indexPath.row == _dataArr.count -1){
陈俊俊's avatar
陈俊俊 committed
323
        _noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight)];
朱朝吉's avatar
朱朝吉 committed
324 325 326 327 328 329 330 331 332 333 334 335 336
        _noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
        _noteTextView.minNumberOfLines = 1;
        _noteTextView.maxNumberOfLines = 4;
        _noteTextView.font = FontSize(15);
        _noteTextView.textAlignment = NSTextAlignmentRight;
        _noteTextView.delegate = self;
        _noteTextView.returnKeyType = UIReturnKeyDone;
        _noteTextView.placeholder = @"输入备注内容";
        [cell.contentView addSubview:_noteTextView];
        CGRect lineFrame =  cell.lineLabel.frame;
        lineFrame.origin.y = TableHeight*2-1;
        cell.lineLabel.frame = lineFrame;
    }else{
陈俊俊's avatar
陈俊俊 committed
337
        UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))];
朱朝吉's avatar
朱朝吉 committed
338
        contentLabel.textAlignment= NSTextAlignmentRight;
zhu's avatar
zhu committed
339
        contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
朱朝吉's avatar
朱朝吉 committed
340 341 342 343 344 345 346 347
        contentLabel.font = FontSize(TitleSize);
        [cell.contentView addSubview:contentLabel];
        if (indexPath.row == 1) {
            contentLabel.text = @"选择采购员";
            _personLabel = contentLabel;
            [self preferDataInPersonLabel];
        }
    }
zhu's avatar
zhu committed
348
}
zhu's avatar
zhu committed
349 350 351 352 353 354 355 356 357
-(BOOL)comperIndexpath:(NSIndexPath *)indexPath
{
    for (NSIndexPath *path in selectCellAry) {
        if (path.row == indexPath.row) {
            return YES;
        }
    }
    return NO;
}
朱朝吉's avatar
朱朝吉 committed
358 359 360 361 362 363 364 365 366 367 368 369
- (void)preferDataInPersonLabel{
    if (self.survey) {
        if (self.survey.users.count > 0) {
            NSString *personStr = @"";
            for (SurveyUser * surveyUser in self.survey.users) {
                if (personStr.length == 0) {
                    personStr = [personStr stringByAppendingFormat:@"%@",surveyUser.userName];
                }else {
                    personStr = [personStr stringByAppendingFormat:@"、%@",surveyUser.userName];
                }
            }
            _personLabel.text = personStr;
zhu's avatar
zhu committed
370
            _personLabel.textColor = GXF_CONTENT_COLOR;
朱朝吉's avatar
朱朝吉 committed
371 372 373 374 375 376 377
            
        }
        if (self.users > 0) {
            [self.users addObjectsFromArray:self.survey.users];
        }
    }
}
zhu's avatar
zhu committed
378 379 380
//添加商品明细
-(void)addShopeDetailed
{
zhu's avatar
zhu committed
381
    
zhu's avatar
zhu committed
382
    ShopDetaileViewController *svc = [[ShopDetaileViewController    alloc] init];
zhu's avatar
zhu committed
383 384 385 386 387
    // 回调
    svc.choseShopDetail = ^(ShopDetail *shopDetail){
        [_shopeArr addObject:shopDetail];
        [mingXiTableView reloadData];
    };
zhu's avatar
zhu committed
388
    
zhu's avatar
zhu committed
389 390
    svc.title = [IBTCommon localizableString:@"AddShopDetail"];
    [self PushViewController:svc animated:YES];
zhu's avatar
zhu committed
391
    
zhu's avatar
zhu committed
392 393 394 395 396 397 398 399 400
}
-(void)showShopDetail:(PurchaseNoticeCell*)Cell indexPath:(NSIndexPath *)indexPath
{
    ShopDetail *shopDetail=[_shopeArr objectAtIndex:indexPath.row];
    Cell.SpLabel.text=shopDetail.merchandise;//商品
    Cell.DjLabel.text=shopDetail.packageUnitPrice;//包装单价
    Cell.BzggLabel.text=shopDetail.packageSpecification;//包装规格
    Cell.BzslLabel.text=shopDetail.packageQuantity;//包装数量
    Cell.packageSpecification.text=shopDetail.packageSpecification;//包装规格
zhu's avatar
zhu committed
401
    Cell.foundationQuantity.text=shopDetail.foundationQuantity;//基础数量
zhu's avatar
zhu committed
402 403 404 405 406 407
    Cell.packageUnitPrice.text=shopDetail.packageUnitPrice;//包装单价
    Cell.remark.text=shopDetail.remark;//备注
    Cell.packageQuantity.text=shopDetail.packageQuantity;//包装数量
    Cell.foundationUnitPrice.text=shopDetail.foundationUnitPrice;//基础单价
    Cell.totalMoney.text=shopDetail.totalMoney;//总金额
    
zhu's avatar
zhu committed
408 409
}
//编辑
zhu's avatar
zhu committed
410
- (void)didtoucher:(UIButton*)button
zhu's avatar
zhu committed
411
{
zhu's avatar
zhu committed
412 413 414
    ShopDetail *shopDetail=[_shopeArr objectAtIndex:button.tag];
    shopDetail.IsXiuGai=YES;
    //    EditorShopDetail
zhu's avatar
zhu committed
415
    ShopDetaileViewController *svc = [[ShopDetaileViewController    alloc] init];
zhu's avatar
zhu committed
416 417 418 419
    svc.choseShopDetail = ^(ShopDetail *Detail){
        if (Detail.IsDeleted) {
            [_shopeArr removeObjectAtIndex:button.tag];
        }else{
zhu's avatar
zhu committed
420
            [_shopeArr replaceObjectAtIndex:button.tag withObject:Detail];
zhu's avatar
zhu committed
421 422 423 424 425 426 427 428 429 430
        }
        
        [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;
zhu's avatar
zhu committed
431 432
    svc.title = [IBTCommon localizableString:@"EditorShopDetail"];
    [self PushViewController:svc animated:YES];
zhu's avatar
zhu committed
433
    //
zhu's avatar
zhu committed
434 435
    NSLog(@"123213232332323223");
}
朱朝吉's avatar
朱朝吉 committed
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
#pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
    [_noteTextView resignFirstResponder];
    [self setTableFrame:LeftMargin];
    return YES;
}
- (void)growingTextViewDidBeginEditing:(HPGrowingTextView *)growingTextView{
    CGFloat offset = ScreenSize.height - TotalHeight - KeyboardHeight;
    if (offset < 0) {//上移
        [self setTableFrame:LeftMargin+offset];
    }
}
- (void)setTableFrame:(CGFloat)tabelH{
    [UIView animateWithDuration:0.25 animations:^{
        CGRect tableFrame = _tableView.frame;
        tableFrame.origin.y = tabelH;
        _tableView.frame = tableFrame;
    }];
}

- (void)keyboardHidden{
    [_titleField resignFirstResponder];
    [_noteTextView resignFirstResponder];
    [self setTableFrame:LeftMargin];
}
zhu's avatar
zhu committed
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
- (void)btnClick:(UIButton *)btn{
    switch (btn.tag) {
        case SaveTag:
        {
            //            if ([self checkSurvey]) {
            //                [self saveSurvey:@"initial" message:@"正在保存..."];
            //            }
        }
            break;
        case CommitTag:
        {
            //            if ([self checkSurvey]) {
            //                [self saveSurvey:@"submitted" message:@"正在提交..."];
            //            }
        }
            break;
        default:
            break;
    }
}
朱朝吉's avatar
朱朝吉 committed
481 482 483 484 485 486 487

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
zhu's avatar
zhu committed
488 489 490 491 492 493 494 495
 #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.
 }
 */
朱朝吉's avatar
朱朝吉 committed
496 497

@end