PurchaseDetailViewController.m 17.6 KB
Newer Older
陈俊俊's avatar
陈俊俊 committed
1 2 3 4 5 6 7 8 9
//
//  PurchaseDetailViewController.m
//  XFFruit
//
//  Created by 陈俊俊 on 15/8/23.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "PurchaseDetailViewController.h"
陈俊俊's avatar
陈俊俊 committed
10 11
#import "ProductBillViewController.h"
#import "PurchaseBillProduct.h"
陈俊俊's avatar
陈俊俊 committed
12
//#import "RejectView.h"
陈俊俊's avatar
陈俊俊 committed
13 14 15 16 17 18 19
#define BottomHeight                                50
#define LeftMargin                                  15
#define LeftWidth                                   100
#define LeftHeight                                  30
#define TopMargin                                   15
#define OneWidth                                    (ScreenSize.width - LeftMargin * 2)
#define TwoWidth                                    ((ScreenSize.width - LeftMargin*3)/2)
n22's avatar
n22 committed
20
typedef enum : NSUInteger {
陈俊俊's avatar
陈俊俊 committed
21 22 23 24 25 26
    CancleTag = 3500,//作废
    EndTag,          //结束
    RejectTag,       //拒绝
    PassTag,         //审核
    SureTag,         //确定

n22's avatar
n22 committed
27 28
} BtnTag;

陈俊俊's avatar
陈俊俊 committed
29
@interface PurchaseDetailViewController ()<UIAlertViewDelegate>
陈俊俊's avatar
陈俊俊 committed
30 31 32 33
{
    UIScrollView *_scrollView;
    UIView *_purchaseView;
    UIView *_bottomView;
陈俊俊's avatar
陈俊俊 committed
34
    ProductBillViewController *_pvc;
n22's avatar
n22 committed
35
    NSArray *_leftArr;
陈俊俊's avatar
陈俊俊 committed
36 37 38
    UIButton *_firstBtn;
    UIButton *_secondBtn;

陈俊俊's avatar
陈俊俊 committed
39 40 41 42 43 44
}
@property (nonatomic,strong)UILabel *billNumberLabel;
@property (nonatomic,strong)UILabel *noticeNumberLabel;
@property (nonatomic,strong)UILabel *createOperNameLabel;
@property (nonatomic,strong)UILabel *checkNameLabel;
@property (nonatomic,strong)UILabel *stateLabel;
n22's avatar
n22 committed
45 46 47
@property (nonatomic,strong)UILabel *lastModifyNameLabel;

@property (nonatomic,strong)UILabel *typeLabel;
陈俊俊's avatar
陈俊俊 committed
48
@property (nonatomic,strong)UILabel *vendorNameLabel;
n22's avatar
n22 committed
49 50 51 52
@property (nonatomic,strong)UILabel *vendorIsSureLabel;
@property (nonatomic,strong)UILabel *warehouseLabel;
@property (nonatomic,strong)UILabel *otherPriceLabel;

陈俊俊's avatar
陈俊俊 committed
53 54
@property (nonatomic,strong)UILabel *totalPriceLabel;
@property (nonatomic,strong)UILabel *noteLabel;
n22's avatar
n22 committed
55

陈俊俊's avatar
陈俊俊 committed
56
//@property (nonatomic,strong)RejectView *rejectView;
陈俊俊's avatar
陈俊俊 committed
57 58

@property (nonatomic,strong)NSString *rejectCause;//拒接原因
陈俊俊's avatar
陈俊俊 committed
59 60 61 62 63 64 65
@end

@implementation PurchaseDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self bulidLayout];
陈俊俊's avatar
陈俊俊 committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
    [self getDataFromServer];
}
- (void)getDataFromServer{
    __weak typeof(self)weakSelf = self;
    void(^succ)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
        __strong __typeof(weakSelf)strongSelf = weakSelf;
        if (data) {
            NSInteger success = [data[@"success"] integerValue];
            NSString *message  = data[@"message"] ;
            if (success == 1) {
                NSDictionary *dictData = data[@"data"];
                PurchaseBill *bill = [[PurchaseBill alloc]init];
                [bill setValuesForKeysWithDictionary:dictData];
                self.bill = bill;
                [strongSelf fetchtPurchaseDetail];
            }else{
                [IBTLoadingView showTips:message];
            }
        }else{
            [IBTLoadingView showTips:@"     无记录     "];
        }
    };
    void(^fail)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
        [IBTLoadingView showTips:data];
    };
    [IBTLoadingView showProgressLabel:@"正在加载..."];
陈俊俊's avatar
陈俊俊 committed
94
    [[ICRHTTPController sharedController] getPurchaseResultWithPurchaseUuid:self.bill.uuid success:succ failure:fail];
陈俊俊's avatar
陈俊俊 committed
95 96 97 98 99 100 101 102
}


#pragma mark - 视图初始化
- (void)bulidLayout{
    _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 64 - BottomHeight)];
    _scrollView.showsHorizontalScrollIndicator  = NO;
    _scrollView.showsVerticalScrollIndicator = NO;
陈俊俊's avatar
陈俊俊 committed
103
    _scrollView.backgroundColor = XXFBgColor;
陈俊俊's avatar
陈俊俊 committed
104
    [self.view addSubview:_scrollView];
n22's avatar
n22 committed
105 106
    [self createBtn];
    [self createBottomView];
陈俊俊's avatar
陈俊俊 committed
107
    [self createPurchaseView];
陈俊俊's avatar
陈俊俊 committed
108
    
n22's avatar
n22 committed
109 110 111
}

- (void)createBtn{
陈俊俊's avatar
陈俊俊 committed
112
    _firstBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height  - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:0 image:nil title:@"" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
陈俊俊's avatar
陈俊俊 committed
113
    [self.view addSubview:_firstBtn];
陈俊俊's avatar
陈俊俊 committed
114
    
陈俊俊's avatar
陈俊俊 committed
115 116 117 118 119 120 121
    _secondBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(_firstBtn.frame)+ LeftMargin, ScreenSize.height  - 64 - BottomHeight +5, (ScreenSize.width - LeftMargin*3)/2, 40) target:self sel:@selector(btnClick:) tag:0 image:nil title:@"" titleColor:[UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
    [self.view addSubview:_secondBtn];
    [self showBtnByPermissions];
}
//根据权限判断按钮显示
- (void)showBtnByPermissions{
    //逻辑判断按钮显示不显示
陈俊俊's avatar
陈俊俊 committed
122 123
    if ([self.bill.state isEqualToString:PURCHASE_STATE_SUBMITTED]) {//状态已提交 未审批
        if([self checkIsPermission:PURCHASE_PERMISSIONS_MANAGEAPPROVE]){
陈俊俊's avatar
陈俊俊 committed
124 125 126 127 128
            //显示拒绝和审批
            [self changeBtnFrame:_firstBtn title:@"拒绝" originX:LeftMargin width:TwoWidth];
            [self changeBtnFrame:_secondBtn title:@"审核通过" originX:CGRectGetMaxX(_firstBtn.frame) + LeftMargin width:TwoWidth];
            _firstBtn.tag = RejectTag;
            _secondBtn.tag = PassTag;
陈俊俊's avatar
陈俊俊 committed
129 130
        }else{
            [self hiddenTwoBtn];
陈俊俊's avatar
陈俊俊 committed
131
        }
132
    }else if([self.bill.state isEqualToString:PURCHASE_STATE_SHIPPING]){//状态是发运中即已审批
陈俊俊's avatar
陈俊俊 committed
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
        if([self checkIsPermission:PURCHASE_PERMISSIONS_VENDORAPPROVE]){//供应商审批权
            //显示确认按钮
            _firstBtn.hidden = YES;
            [self changeBtnFrame:_secondBtn title:@"确认" originX:LeftMargin width:OneWidth];
            _secondBtn.tag = SureTag;
        }else{
            if ([self checkIsPermission:PURCHASE_PERMISSIONS_FINISH]&&[self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]) {
                //显示结束和作废按钮
                [self changeBtnFrame:_firstBtn title:@"结束" originX:LeftMargin width:TwoWidth];
                [self changeBtnFrame:_secondBtn title:@"作废" originX:CGRectGetMaxX(_firstBtn.frame) + LeftMargin width:TwoWidth];
                _firstBtn.tag = EndTag;
                _secondBtn.tag = CancleTag;
            }else{
                if ([self checkIsPermission:PURCHASE_PERMISSIONS_FINISH]){//结束权
                    //显示结束按钮
                    _firstBtn.hidden = YES;
                    [self changeBtnFrame:_secondBtn title:@"结束" originX:LeftMargin width:OneWidth];
                    _secondBtn.tag = EndTag;
                }else if([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]){//作废权
                    //显示作废按钮
                    _firstBtn.hidden = YES;
                    [self changeBtnFrame:_secondBtn title:@"作废" originX:LeftMargin width:OneWidth];
                    _secondBtn.tag = CancleTag;
陈俊俊's avatar
陈俊俊 committed
156 157
                }else{
                    [self hiddenTwoBtn];
陈俊俊's avatar
陈俊俊 committed
158 159 160 161 162 163 164 165 166 167
                }
            }
        }
    }else if([self.bill.state isEqualToString:PURCHASE_STATE_FINISHED]){//完成
        if ([self checkIsPermission:PURCHASE_PERMISSIONS_ABORT]) {//有作废权的
            //显示作废按钮
            _firstBtn.hidden = YES;
            [self changeBtnFrame:_secondBtn title:@"作废" originX:LeftMargin width:OneWidth];
            _secondBtn.tag = CancleTag;

陈俊俊's avatar
陈俊俊 committed
168 169
        }else{
            [self hiddenTwoBtn];
陈俊俊's avatar
陈俊俊 committed
170
        }
陈俊俊's avatar
陈俊俊 committed
171
    }else if([self.bill.state isEqualToString:PURCHASE_STATE_ABORTED]){//已作废
陈俊俊's avatar
陈俊俊 committed
172
        [self hiddenTwoBtn];
陈俊俊's avatar
陈俊俊 committed
173 174
    }
}
陈俊俊's avatar
陈俊俊 committed
175 176 177 178 179 180 181 182

- (void)hiddenTwoBtn{
    _firstBtn.hidden = YES;
    _secondBtn.hidden = YES;
    CGRect scrollViewFrame = _scrollView.frame;
    scrollViewFrame.size.height = ScreenSize.height - 64;
    _scrollView.frame = scrollViewFrame;
}
陈俊俊's avatar
陈俊俊 committed
183 184 185 186 187 188 189 190 191 192 193 194 195
//改变按钮的位置
- (void)changeBtnFrame:(UIButton *)btn title:(NSString *)title originX:(CGFloat)originX width:(CGFloat)width{
    CGRect btnFrame = btn.frame;
    btnFrame.origin.x = originX;
    btnFrame.size.width = width;
    btn.frame = btnFrame;
    [btn setTitle:title forState:UIControlStateNormal];
}
- (BOOL)checkIsPermission:(NSString *)permission{
    for (NSString *per in [ICRUserUtil sharedInstance].permissions) {
        if ([per isEqualToString:permission]) {
            return YES;
        }
n22's avatar
n22 committed
196
    }
陈俊俊's avatar
陈俊俊 committed
197
    return NO;
陈俊俊's avatar
陈俊俊 committed
198
}
n22's avatar
n22 committed
199

陈俊俊's avatar
陈俊俊 committed
200
- (void)btnClick:(UIButton *)btn{
陈俊俊's avatar
陈俊俊 committed
201
    CLog(@"%ld",(long)btn.tag);
陈俊俊's avatar
陈俊俊 committed
202 203 204
    switch (btn.tag) {
        case CancleTag:
        {
陈俊俊's avatar
陈俊俊 committed
205
            CLog(@"作废");
陈俊俊's avatar
陈俊俊 committed
206 207 208 209
            UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认作废" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
            alertView.delegate = self;
            alertView.tag = CancleTag;
            [alertView show];
陈俊俊's avatar
陈俊俊 committed
210 211 212 213
        }
            break;
        case EndTag:
        {
陈俊俊's avatar
陈俊俊 committed
214
            CLog(@"结束");
陈俊俊's avatar
陈俊俊 committed
215 216 217 218
            UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认结束" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
            alertView.delegate = self;
            alertView.tag = EndTag;
            [alertView show];
陈俊俊's avatar
陈俊俊 committed
219 220 221 222
        }
            break;
        case RejectTag:
        {
陈俊俊's avatar
陈俊俊 committed
223
            CLog(@"拒绝");
陈俊俊's avatar
陈俊俊 committed
224 225 226 227
            UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认拒绝" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
            alertView.delegate = self;
            alertView.tag = RejectTag;
            [alertView show];
陈俊俊's avatar
陈俊俊 committed
228 229 230 231
        }
            break;
        case PassTag:
        {
陈俊俊's avatar
陈俊俊 committed
232
            CLog(@"审核通过");
陈俊俊's avatar
陈俊俊 committed
233 234 235 236
            UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:@"请确认通过" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
            alertView.delegate = self;
            alertView.tag = PassTag;
            [alertView show];
陈俊俊's avatar
陈俊俊 committed
237 238 239 240
        }
            break;
        case SureTag:
        {
陈俊俊's avatar
陈俊俊 committed
241 242
            CLog(@"确认");
            [self dealByAction:PURCHASE_ACTION_VENDORCONFIRM];
陈俊俊's avatar
陈俊俊 committed
243 244 245 246 247
        }
            break;
        default:
            break;
    }
n22's avatar
n22 committed
248
}
陈俊俊's avatar
陈俊俊 committed
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
- (void)dealByAction:(NSString *)action{
    //保存
    void(^succ)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
        if (data) {
            NSInteger success = [data[@"success"] integerValue];
            NSString *message = data[@"message"];
            if (success == 1) {
                [ICRUserUtil sharedInstance].needFresh = YES;
                [self PopViewControllerAnimated:YES];
            }else{
                [IBTLoadingView showTips:message];
            }
        }else{
            [IBTLoadingView showTips:@"操作异常"];
        }
    };
    void(^fail)(id) = ^(id data) {
        [IBTLoadingView hideHUDWithText:nil];
        [IBTLoadingView showTips:data];
    };
    [IBTLoadingView showProgressLabel:@"正在加载..."];
    [[ICRHTTPController sharedController]dealByActionWithPurchaseUuid:self.bill.uuid action:action remark:[IBTCommon checkString:self.rejectCause] version:self.bill.version success:succ failure:fail];
}
n22's avatar
n22 committed
273 274

- (void)createBottomView{
陈俊俊's avatar
陈俊俊 committed
275
    _bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width, 300)];
n22's avatar
n22 committed
276 277
    _bottomView.backgroundColor = [UIColor whiteColor];
    [_scrollView addSubview:_bottomView];
陈俊俊's avatar
陈俊俊 committed
278
    
陈俊俊's avatar
陈俊俊 committed
279
    _pvc = [[ProductBillViewController alloc]init];
n22's avatar
n22 committed
280 281 282 283 284 285 286 287
    [self addChildViewController:_pvc];
    
    _pvc.viewFrame = _bottomView.bounds;
    _pvc.isHiddenEdit = YES;
    [_bottomView addSubview:_pvc.view];
}

- (void)createPurchaseView{
陈俊俊's avatar
陈俊俊 committed
288 289
    _leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"状态:",@"类型:",@"供应商:",@"供应商确认:",@"收货仓库:",@"其他费用:",@"总金额:",@"备注:"];

n22's avatar
n22 committed
290
    _purchaseView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*_leftArr.count +LeftMargin)];
陈俊俊's avatar
陈俊俊 committed
291 292 293
    _purchaseView.backgroundColor = [UIColor whiteColor];
    [_scrollView addSubview:_purchaseView];
    
n22's avatar
n22 committed
294
    for (NSInteger i = 0 ; i < _leftArr.count; i++) {
陈俊俊's avatar
陈俊俊 committed
295
        UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, 10 + LeftHeight *i, LeftWidth, LeftHeight)];
陈俊俊's avatar
陈俊俊 committed
296
        leftLabel.font = GXF_SEVENTEENTH_SIZE;
n22's avatar
n22 committed
297
        leftLabel.text = _leftArr[i];
陈俊俊's avatar
陈俊俊 committed
298
        leftLabel.textColor = GXF_DETAIL_COLOR;
陈俊俊's avatar
陈俊俊 committed
299 300 301
        [_purchaseView addSubview:leftLabel];
        
        UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), 10 + LeftHeight *i, _purchaseView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)];
陈俊俊's avatar
陈俊俊 committed
302 303
        rightLabel.font = GXF_SEVENTEENTH_SIZE;
        rightLabel.textColor = GXF_DETAIL_COLOR;
n22's avatar
n22 committed
304
        
陈俊俊's avatar
陈俊俊 committed
305 306 307 308 309 310
        if (i == 0) {
            self.billNumberLabel = rightLabel;
        }else if (i == 1) {
            self.noticeNumberLabel = rightLabel;
        }else if(i == 2){
            self.createOperNameLabel = rightLabel;
陈俊俊's avatar
陈俊俊 committed
311 312 313 314 315 316 317 318 319 320
        }else if(i == 3){
            self.stateLabel = rightLabel;
        }else if(i == 4){
            self.typeLabel = rightLabel;
        }else if(i == 5){
            self.vendorNameLabel = rightLabel;
        }else if(i == 6){
            self.vendorIsSureLabel = rightLabel;
        }else if(i == 7){
            self.warehouseLabel = rightLabel;
n22's avatar
n22 committed
321 322 323
        }else if(i == _leftArr.count - 3){
            self.otherPriceLabel = rightLabel;
        }else if(i == _leftArr.count - 2){
陈俊俊's avatar
陈俊俊 committed
324
            self.totalPriceLabel = rightLabel;
n22's avatar
n22 committed
325
        }else if(i == _leftArr.count - 1){
陈俊俊's avatar
陈俊俊 committed
326 327 328 329 330 331 332 333 334
            rightLabel.numberOfLines = 0;
            self.noteLabel = rightLabel;
        }
        [_purchaseView addSubview:rightLabel];
    }
}

- (void)fetchtPurchaseDetail{
    self.billNumberLabel.text = [IBTCommon checkString:self.bill.billNumber];
n22's avatar
n22 committed
335
    if ([self.bill.state isEqualToString:PURCHASE_STATE_INITIAL]) {
陈俊俊's avatar
陈俊俊 committed
336 337
        self.stateLabel.textColor = [UIColor redColor];
        self.stateLabel.text = @"未提交";
n22's avatar
n22 committed
338
    }else if ([self.bill.state isEqualToString:PURCHASE_STATE_SUBMITTED]) {
陈俊俊's avatar
陈俊俊 committed
339
        self.stateLabel.textColor = [UIColor greenColor];
陈俊俊's avatar
陈俊俊 committed
340
        self.stateLabel.text = @"未审批";
n22's avatar
n22 committed
341
    }else if ([self.bill.state isEqualToString:PURCHASE_STATE_REJECTED]) {
陈俊俊's avatar
陈俊俊 committed
342 343
        self.stateLabel.textColor = [UIColor grayColor];
        self.stateLabel.text = @"已拒绝";
n22's avatar
n22 committed
344
    }else if ([self.bill.state isEqualToString:PURCHASE_STATE_SHIPPING]) {
陈俊俊's avatar
陈俊俊 committed
345 346
        self.stateLabel.textColor = [UIColor grayColor];
        self.stateLabel.text = @"发运中";
陈俊俊's avatar
陈俊俊 committed
347
    }else if ([self.bill.state isEqualToString:PURCHASE_STATE_ABORTED]) {
348 349
        self.stateLabel.textColor = [UIColor grayColor];
        self.stateLabel.text = @"已作废";
n22's avatar
n22 committed
350
    }else if ([self.bill.state isEqualToString:PURCHASE_STATE_FINISHED]) {
陈俊俊's avatar
陈俊俊 committed
351 352 353
        self.stateLabel.textColor = [UIColor blackColor];
        self.stateLabel.text = @"已完成";
    }
陈俊俊's avatar
陈俊俊 committed
354
    self.noticeNumberLabel.text = (self.bill.noticeNumber.length == 0) ? @"无":(self.bill.noticeNumber);
陈俊俊's avatar
陈俊俊 committed
355 356 357
    self.createOperNameLabel.text = [IBTCommon checkString:self.bill.create_operName];
    self.checkNameLabel.text = [IBTCommon checkString:self.bill.vendor_name];
    self.vendorNameLabel.text = [IBTCommon checkString:self.bill.vendor_name];
n22's avatar
n22 committed
358
    self.totalPriceLabel.text = [IBTCommon checkString:[self.bill.total stringValue]];
陈俊俊's avatar
陈俊俊 committed
359
    self.noteLabel.text = [NSString stringWithFormat:@"%@",self.bill.remark?self.bill.remark:@"无"];
陈俊俊's avatar
陈俊俊 committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373
    self.lastModifyNameLabel.text = [IBTCommon checkString:self.bill.lastModify_operName];
    NSString *type = [self.bill.type isEqualToString:GXF_Critical] ? @"紧急" : @"普通";
    self.typeLabel.text = type;
    self.vendorIsSureLabel.text = self.bill.vendorConfirmTime.length > 0 ? @"是":@"否";
    self.warehouseLabel.text = [IBTCommon checkString:self.bill.receiveWrh_name];
    self.otherPriceLabel.text = [self.bill.charge stringValue];
    NSMutableArray *productArr = [NSMutableArray array];
    for (NSDictionary *billDict in self.bill.products) {
        PurchaseBillProduct *billProbuct = [PurchaseBillProduct new];
        [billProbuct setValuesForKeysWithDictionary:billDict];
        [productArr addObject:billProbuct];
    }
    _pvc.productArr = productArr;
    [_pvc.tableView reloadData];
n22's avatar
n22 committed
374
    
陈俊俊's avatar
陈俊俊 committed
375 376 377 378 379 380 381 382 383 384 385
    [self setNoteHeight];
}

- (void)setNoteHeight
{
    CGFloat height =  [self.noteLabel calculateHeight];
    
    CGRect noteFrame = self.noteLabel.frame;
    noteFrame.size.height = height;
    self.noteLabel.frame = noteFrame;
    
n22's avatar
n22 committed
386
    CGFloat totalHeight = height + LeftHeight*_leftArr.count;
陈俊俊's avatar
陈俊俊 committed
387 388 389 390 391 392 393 394 395 396 397 398
    CGRect purchaseFrame = _purchaseView.frame;
    purchaseFrame.size.height = totalHeight;
    _purchaseView.frame = purchaseFrame;
    
    
    CGRect bottomFrame = _bottomView.frame;
    bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin;
    _bottomView.frame = bottomFrame;
    
    _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
}

陈俊俊's avatar
陈俊俊 committed
399 400 401 402
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (alertView.tag == CancleTag) {
        if (buttonIndex == 1) {
            [self dealByAction:PURCHASE_ACTION_ABORT];//作废
陈俊俊's avatar
陈俊俊 committed
403

陈俊俊's avatar
陈俊俊 committed
404 405 406 407 408
        }
    }else if (alertView.tag == EndTag){
        if (buttonIndex == 1) {
            [self dealByAction:PURCHASE_ACTION_FINISH];//结束
        }
陈俊俊's avatar
陈俊俊 committed
409 410 411 412 413 414 415 416
    }else if(alertView.tag == RejectTag){
        if (buttonIndex == 1) {
            [self dealByAction:PURCHASE_ACTION_REJECT];
        }
    }else if(alertView.tag == PassTag){
        if (buttonIndex == 1) {
            [self dealByAction:PURCHASE_ACTION_APPROVE];
        }
陈俊俊's avatar
陈俊俊 committed
417 418
    }
}
陈俊俊's avatar
陈俊俊 committed
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#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