-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathOrderVC.m
More file actions
607 lines (538 loc) · 26.2 KB
/
OrderVC.m
File metadata and controls
607 lines (538 loc) · 26.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
//
// OrderVC.m
// DuDu
//
// Created by 教路浩 on 15/12/8.
// Copyright © 2015年 i-chou. All rights reserved.
//
#import "OrderVC.h"
#import "SIAlertView.h"
#import "CouponStore.h"
#import "MainViewController.h"
@interface OrderVC ()
{
UIView *_routeView;
UILabel *_timeLabel;
UILabel *_startLabel;
UILabel *_endLabel;
UIImageView *_timerImageView;
UILabel *_timerLabel;
UIImageView *_bottomLine;
UILabel *_noticeLabel;
UIView *_driverView;
UIImageView *_avator;
UILabel *_driverNameLabel;
UILabel *_carNumLabel;
UILabel *_carStyleLabel;
UILabel *_carColorLabel;
int _timerCount;
NSTimer *_countDownTimer;
NSTimer *_fetchDataTimer;
SIAlertView *_alertView;
SIAlertView *_waitAlertView;
UILabel *_timerTitle;
UIButton *_cancelBtn;
UIWebView *_phoneCallWebView;
}
@end
@implementation OrderVC
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = COLORRGB(0xf0f0f0);
[self setupCancelBtn];
[self.view addSubview:[self routeView]];
[self.view addSubview:[self noticeLabel]];
[self.view addSubview:[self driverView]];
[self showDriverView:NO];
[self showOtherCars:NO];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self flushOrderStatus:nil];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[_alertView removeFromSuperview];
_alertView = nil;
[_waitAlertView removeFromSuperview];
_waitAlertView = nil;
[_countDownTimer invalidate];
_countDownTimer = nil;
[_fetchDataTimer invalidate];
_fetchDataTimer = nil;
}
- (void)cancelDidTapped
{
if (!_waitAlertView) {
_waitAlertView = [[SIAlertView alloc] initWithTitle:@"" andMessage:@"\n您确定要取消订单吗?\n"];
_waitAlertView.messageFont = HSFONT(14);
_waitAlertView.buttonColor = COLORRGB(0xf39a00);
_waitAlertView.buttonFont = HSFONT(15);
_waitAlertView.cancelButtonColor = COLORRGB(0xf39a00);
_waitAlertView.didShowHandler = ^(SIAlertView *alertView) {
};
_waitAlertView.didDismissHandler = ^(SIAlertView *alertView) {
alertView = nil;
};
_waitAlertView.transitionStyle = SIAlertViewTransitionStyleBounce;
__weak id weakSelf = self;
[_waitAlertView addButtonWithTitle:@"取消订单"
type:SIAlertViewButtonTypeDefault
handler:^(SIAlertView *alert) {
[weakSelf cancelOrder];
}];
[_waitAlertView addButtonWithTitle:@"继续等待"
type:SIAlertViewButtonTypeCancel
handler:^(SIAlertView *alert) {
[alert dismissAnimated:YES];
}];
}
[_waitAlertView show];
}
- (UIView *)routeView
{
if (!_routeView) {
_routeView = [[UIView alloc] init];
}
UIImageView *timeImage = [[UIImageView alloc] initWithFrame:ccr(10, 10, 16, 16)];
timeImage.image = IMG(@"tiny_clock");
[_routeView addSubview:timeImage];
_timeLabel = [UILabel labelWithFrame:ccr(36,
10,
SCREEN_WIDTH-36,
16)
color:COLORRGB(0x000000)
font:HSFONT(12)
text:@""
alignment:NSTextAlignmentLeft
numberOfLines:1];
[_routeView addSubview:_timeLabel];
UIImageView *startImage = [[UIImageView alloc] initWithFrame:ccr(timeImage.origin.x,
CGRectGetMaxY(timeImage.frame)+10,
timeImage.width,
timeImage.height)];
startImage.image = IMG(@"tiny_circle_green");
[_routeView addSubview:startImage];
_startLabel = [UILabel labelWithFrame:ccr(_timeLabel.x,
CGRectGetMaxY(_timeLabel.frame)+10,
_timeLabel.width,
16)
color:COLORRGB(0x000000)
font:HSFONT(12)
text:@""
alignment:NSTextAlignmentLeft
numberOfLines:1];
[_routeView addSubview:_startLabel];
UIImageView *endImage = [[UIImageView alloc] initWithFrame:ccr(startImage.origin.x,
CGRectGetMaxY(startImage.frame)+10,
startImage.width,
startImage.height)];
endImage.image = IMG(@"tiny_circle_red");
[_routeView addSubview:endImage];
_endLabel = [UILabel labelWithFrame:ccr(_startLabel.x,
CGRectGetMaxY(_startLabel.frame)+10,
_startLabel.width,
16)
color:COLORRGB(0x000000)
font:HSFONT(12)
text:@""
alignment:NSTextAlignmentLeft
numberOfLines:1];
[_routeView addSubview:_endLabel];
_timerTitle = [UILabel labelWithFrame:ccr(SCREEN_WIDTH-100-10,
_timeLabel.y,
100,
_timeLabel.height)
color:COLORRGB(0x63666b)
font:HSFONT(12)
text:@"嘟嘟为您提供服务"
alignment:NSTextAlignmentRight
numberOfLines:1];
[_routeView addSubview:_timerTitle];
_timerTitle.alpha = 0;
_timerImageView = [[UIImageView alloc] initWithFrame:ccr(
SCREEN_WIDTH-30-40,
CGRectGetMaxY(_timerTitle.frame)+10,
40,
40)];
_timerImageView.image = IMG(@"circle_orange");
_timerImageView.alpha = 0;
[_routeView addSubview:_timerImageView];
_timerLabel = [UILabel labelWithFrame:ccr(0,
0,
_timerImageView.width,
_timerImageView.height
)
color:COLORRGB(0x000000)
font:HSFONT(15)
text:@"--"
alignment:NSTextAlignmentCenter
numberOfLines:1];
[_timerImageView addSubview:_timerLabel];
_routeView.frame = ccr(0,
0,
SCREEN_WIDTH,
CGRectGetMaxY(_endLabel.frame)+20);
return _routeView;
}
- (UILabel *)noticeLabel
{
if (!_noticeLabel) {
_noticeLabel = [UILabel labelWithFrame:ccr(0,
CGRectGetMaxY(_routeView.frame)+10,
SCREEN_WIDTH,
20)
color:COLORRGB(0x63666b)
font:HSFONT(15)
text:@"欢迎使用嘟嘟出行"
alignment:NSTextAlignmentCenter
numberOfLines:0];
}
return _noticeLabel;
}
- (UIButton *)setupCancelBtn
{
if (!_cancelBtn) {
_cancelBtn = [UIButton buttonWithImageName:@""
hlImageName:@""
title:@"取消"
titleColor:COLORRGB(0xffffff)
font:HSFONT(15)
onTapBlock:^(UIButton *btn) {
[self cancelDidTapped];
}];
_cancelBtn.frame = ccr(0, 0, 40, 40);
}
return _cancelBtn;
}
- (UIView *)driverView
{
if (!_driverView) {
_driverView = [[UIView alloc] init];
}
UILabel *driverTitleLabel = [UILabel labelWithFrame:ccr((SCREEN_WIDTH-70)/2, 20, 70, 20)
color:COLORRGB(0xd7d7d7)
font:HSFONT(12)
text:@"车辆信息"
alignment:NSTextAlignmentCenter
numberOfLines:1];
[_driverView addSubview:driverTitleLabel];
UIImageView *leftLine = [[UIImageView alloc] initWithFrame:ccr(driverTitleLabel.x-5-50, 30, 50, 0.5)];
leftLine.backgroundColor = COLORRGB(0xd7d7d7);
[_driverView addSubview:leftLine];
UIImageView *rightLine = [[UIImageView alloc] initWithFrame:ccr(CGRectGetMaxX(driverTitleLabel.frame)+5, leftLine.y, leftLine.width, leftLine.height)];
rightLine.backgroundColor = COLORRGB(0xd7d7d7);
[_driverView addSubview:rightLine];
_avator = [[UIImageView alloc] initWithFrame:ccr(10,
CGRectGetMaxY(driverTitleLabel.frame)+10,
50,
50)];
[_avator setImageWithURL:URL([Utils emptyIfNull:self.orderInfo.driver_photo])
placeholderImage:IMG(@"account")];
_avator.layer.cornerRadius = _avator.width/2;
_avator.layer.masksToBounds = YES;
[_driverView addSubview:_avator];
NSString *driver_acount;
if ([self.orderInfo.car_style_flg intValue] == 2) { //顺风车订单
driver_acount = [NSString stringWithFormat:@"%@(%@)",self.orderInfo.driver_nickname,self.orderInfo.free_ride_telephone];
} else {
driver_acount = [NSString stringWithFormat:@"%@(%@)",self.orderInfo.driver_nickname,self.orderInfo.driver_telephone];
}
_driverNameLabel = [UILabel labelWithFrame:ccr(CGRectGetMaxX(_avator.frame)+10,
_avator.y,
150,
_avator.height/2)
color:COLORRGB(0x000000)
font:HSFONT(12)
text:driver_acount];
[_driverView addSubview:_driverNameLabel];
_carNumLabel = [UILabel labelWithFrame:ccr(_driverNameLabel.x,
CGRectGetMaxY(_driverNameLabel.frame),
60,
_avator.height/2)
color:COLORRGB(0x000000)
font:HSFONT(12)
text:self.orderInfo.car_plate_number];
[_driverView addSubview:_carNumLabel];
_carStyleLabel = [UILabel labelWithFrame:ccr(CGRectGetMaxX(_carNumLabel.frame)+10,
_carNumLabel.y+5,
70,
15)
color:COLORRGB(0x63666b)
font:HSFONT(12)
text:@"未知车型"
alignment:NSTextAlignmentCenter
numberOfLines:1];
_carStyleLabel.layer.borderColor = COLORRGB(0xf39a00).CGColor;
_carStyleLabel.layer.borderWidth = 1;
_carStyleLabel.layer.cornerRadius = 5.0f;
[_driverView addSubview:_carStyleLabel];
UIButton *phoneBtn = [UIButton buttonWithImageName:@"phone-icon2" hlImageName:@"phone-icon2" onTapBlock:^(UIButton *btn) {
if ([self.orderInfo.car_style_flg intValue] == 2) { //顺风车订单
[self makeACall:self.orderInfo.free_ride_telephone];
} else {
[self makeACall:self.orderInfo.driver_telephone];
}
}];
phoneBtn.frame = ccr(SCREEN_WIDTH-35-20, _avator.y+5, 35, 35);
[_driverView addSubview:phoneBtn];
_driverView.frame = ccr(0,
CGRectGetMaxY(_noticeLabel.frame),
SCREEN_WIDTH,
CGRectGetMaxY(_avator.frame));
return _driverView;
}
-(void)makeACall:(NSNumber *)num
{
NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",num]];
if (!_phoneCallWebView) {
_phoneCallWebView = [[UIWebView alloc] initWithFrame:CGRectZero];
[self.view addSubview:_phoneCallWebView];
}
[_phoneCallWebView loadRequest:[NSURLRequest requestWithURL:phoneURL]];
}
- (void)cancelOrder
{
if (![UICKeyChainStore stringForKey:KEY_STORE_ACCESS_TOKEN service:KEY_STORE_SERVICE]) {
[ZBCToast showMessage:@"请先登录"];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
return;
}
[[DuDuAPIClient sharedClient] GET:CANCEL_ORDER(self.orderInfo.order_id) parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
[ZBCToast showMessage:@"订单已取消"];
// [[MainViewController sharedMainViewController] clearData];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)showTimerView:(BOOL)show
{
_timerImageView.alpha = show;
}
- (void)showDriverView:(BOOL)show
{
_driverView.alpha = show;
// if (show) {
// _noticeLabel.y = CGRectGetMaxY(_driverView.frame)+30;
// } else {
// _noticeLabel.y = CGRectGetMaxY(_routeView.frame)+30;
// }
}
- (void)showOtherCars:(BOOL)show
{
for (UIView *view in self.view.subviews) {
if ([view isKindOfClass:[UIButton class]]) {
[view removeFromSuperview];
}
}
if (show) {
for (int i=0; i<self.carStore.cars.count; i++) {
CarModel *car = self.carStore.cars[i];
UIButton *carBtn = [UIButton buttonWithImageName:@"orgbtn"
hlImageName:@"orgbtn_pressed"
title:car.car_style_name
titleColor:COLORRGB(0xffffff)
font:HSFONT(15)
onTapBlock:^(UIButton *btn) {
[self changeOrderToCarStyle:car];
}];
carBtn.frame = ccr(10, CGRectGetMaxY(_noticeLabel.frame) + 10 + 40*i, SCREEN_WIDTH-20, 40);
[self.view addSubview:carBtn];
}
}
}
- (void)flushOrderStatus:(NSTimer *)timer
{
if (![UICKeyChainStore stringForKey:KEY_STORE_ACCESS_TOKEN service:KEY_STORE_SERVICE]) {
[ZBCToast showMessage:@"请先登录"];
[_fetchDataTimer invalidate];
_fetchDataTimer = nil;
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
return;
}
[[DuDuAPIClient sharedClient] GET:FLUSH_ORDER_STATUS([self.orderInfo.order_id intValue]) parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
NSDictionary *dic = [DuDuAPIClient parseJSONFrom:responseObject];
if (dic && dic[@"info"]) {
self.orderInfo.car_position_id = dic[@"info"][@"car_position_id"];
self.orderInfo.car_color = dic[@"info"][@"car_color"];
self.orderInfo.car_style = dic[@"info"][@"car_style_id"];
self.orderInfo.car_style_flg = dic[@"info"][@"car_style_flg"];
self.orderInfo.car_plate_number = dic[@"info"][@"car_plate_number"];
self.orderInfo.driver_nickname = dic[@"info"][@"driver_nickname"];
self.orderInfo.driver_telephone = dic[@"info"][@"driver_telephone"];
self.orderInfo.driver_photo = dic[@"info"][@"driver_photo"];
self.orderInfo.order_status = dic[@"info"][@"order_status"];
self.orderInfo.car_brand = dic[@"info"][@"car_brand"];
self.orderInfo.order_initiate_rate = dic[@"info"][@"order_initiate_rate"];
self.orderInfo.order_mileage = dic[@"info"][@"order_mileage"];
self.orderInfo.order_mileage_money = dic[@"info"][@"order_mileage_money"];
self.orderInfo.order_duration_money = dic[@"info"][@"order_duration_money"];
self.orderInfo.order_allTime = dic[@"info"][@"order_allTime"];
self.orderInfo.order_allMoney = dic[@"info"][@"order_allMoney"];
self.orderInfo.startTimeType = dic[@"info"][@"startTimeType"];
self.orderInfo.location = dic[@"info"][@"location"];
self.orderInfo.free_ride_telephone = dic[@"info"][@"free_ride_telephone"];
} else {
self.orderInfo.car_color = @"";
self.orderInfo.car_brand = @"未知车型";
self.orderInfo.car_plate_number = @"未知车牌号";
self.orderInfo.driver_nickname = @"未知司机";
self.orderInfo.driver_telephone = [NSNumber numberWithInt:0];
}
[self setData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
[self setData];
}];
}
- (void)setData
{
if ([self.orderInfo.order_status intValue] == OrderStatusWatingForDriver) {
[self showRightTitle:YES withButton:_cancelBtn];
if (![self.orderInfo.startTimeType intValue]) {
self.orderStatusInfo = @"嘟嘟正在为您分派司机,请稍候...";
if (!_countDownTimer && self.canTimerShow) {
_timerCount = [CouponStore sharedCouponStore].shareInfo.wait_order_time_seconds;
[_countDownTimer setFireDate:[NSDate distantPast]];
_countDownTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(timerFireMethod:)
userInfo:nil
repeats:YES];
}
} else {
self.orderStatusInfo = @"嘟嘟正在为您分派司机,请稍候...";
}
} else if ([self.orderInfo.order_status intValue] == OrderStatusDriverIsComing) {
self.orderStatusInfo = @"司机正在前往,请耐心等待";
[self showRightTitle:YES withButton:_cancelBtn];
[ZBCToast showMessage:@"司机正在前往,请耐心等待"];
} else if ([self.orderInfo.order_status intValue] == OrderStatusDriverCancel) {
self.orderStatusInfo = @"司机取消订单";
[self showRightTitle:NO withButton:nil];
[ZBCToast showMessage:@"司机取消订单"];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
} else if ([self.orderInfo.order_status intValue] == OrderStatusTravelStart) {
self.orderStatusInfo = @"行程中,嘟嘟正在为您服务";
[self showRightTitle:NO withButton:nil];
[ZBCToast showMessage:@"行程中,嘟嘟正在为您服务"];
} else if ([self.orderInfo.order_status intValue] == OrderStatusComleted) {
self.orderStatusInfo = @"订单完成";
[self showRightTitle:NO withButton:nil];
[[MainViewController sharedMainViewController] clearData];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
} else if ([self.orderInfo.order_status intValue] == OrderStatusWatingForPay) {
self.orderStatusInfo = @"行程结束,请尽快付款";
[self showRightTitle:NO withButton:nil];
// [[MainViewController sharedMainViewController] clearData];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
} else {
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
NSDate *date = [NSDate dateWithTimeIntervalSince1970:[self.orderInfo.startTimeStr floatValue]];
_timeLabel.text = [date displayWithFormat:@"d号H点mm分"];
_startLabel.text = self.orderInfo.star_loc_str;
_endLabel.text = self.orderInfo.dest_loc_str;
_noticeLabel.text = self.orderStatusInfo;
[_avator setImageWithURL:URL([Utils emptyIfNull:self.orderInfo.driver_photo])
placeholderImage:IMG(@"account")];
_carStyleLabel.text = [NSString stringWithFormat:@"%@ %@",self.orderInfo.car_color, self.orderInfo.car_brand];
_carColorLabel.text = self.orderInfo.car_color;
_timerTitle.alpha = 1;
NSString *driver_acount;
if ([self.orderInfo.car_style_flg intValue] == 2) { //顺风车订单
driver_acount = [NSString stringWithFormat:@"%@(%@)",self.orderInfo.driver_nickname,self.orderInfo.free_ride_telephone];
if (_timerImageView.alpha == 0) {
_timerTitle.text= @"顺风车订单";
}
} else {
driver_acount = [NSString stringWithFormat:@"%@(%@)",self.orderInfo.driver_nickname,self.orderInfo.driver_telephone];
if (_timerImageView.alpha == 0) {
_timerTitle.text= @"快车订单";
}
}
_driverNameLabel.text = driver_acount;
_carNumLabel.text = self.orderInfo.car_plate_number;
if (!_fetchDataTimer) {
[_fetchDataTimer setFireDate:[NSDate distantPast]];
_fetchDataTimer = [NSTimer scheduledTimerWithTimeInterval:15.0
target:self
selector:@selector(flushOrderStatus:)
userInfo:nil
repeats:YES];
}
[self showTimerView:([self.orderInfo.order_status intValue]==OrderStatusWatingForDriver && ![self.orderInfo.startTimeType intValue] && self.canTimerShow)];
[self showDriverView:([self.orderInfo.order_status intValue]>OrderStatusWatingForDriver)];
[self showOtherCars:(self.resultStatus==OrderResultHaveOtherCar)];
}
- (void)timerFireMethod:(NSTimer*)theTimer
{
if (_timerCount>0) {
_timerLabel.text = STR_I(_timerCount--);
} else {
_timerLabel.text = @"--";
[_countDownTimer setFireDate:[NSDate distantFuture]];
[_countDownTimer invalidate];
if ([self.orderInfo.order_status intValue] == OrderStatusWatingForDriver) {
if (!_alertView) {
_alertView = [[SIAlertView alloc] initWithTitle:@"亲,很抱歉,让您久等了"
andMessage:@"我们的服务正在逐步完善中,请给我时间\n\n系统会赠送给您优惠券,\n\n是否继续等待嘟嘟为您服务?"];
_alertView.messageFont = HSFONT(13);
_alertView.titleFont = HSFONT(13);
_alertView.titleColor = [UIColor darkGrayColor];
_alertView.buttonColor = COLORRGB(0xf39a00);
_alertView.buttonFont = HSFONT(15);
_alertView.cancelButtonColor = COLORRGB(0xf39a00);
__weak id weakSelf = self;
[_alertView addButtonWithTitle:@"取消订单"
type:SIAlertViewButtonTypeDefault
handler:^(SIAlertView *alert) {
[weakSelf cancelOrder];
}];
[_alertView addButtonWithTitle:@"继续等待"
type:SIAlertViewButtonTypeCancel
handler:^(SIAlertView *alert) {
[alert dismissAnimated:YES];
}];
_alertView.didShowHandler = ^(SIAlertView *alertView) {
};
_alertView.didDismissHandler = ^(SIAlertView *alertView) {
alertView = nil;
};
_alertView.transitionStyle = SIAlertViewTransitionStyleBounce;
}
[_alertView show];
}
}
}
- (void)changeOrderToCarStyle:(CarModel *)car
{
if (![UICKeyChainStore stringForKey:KEY_STORE_ACCESS_TOKEN service:KEY_STORE_SERVICE]) {
[ZBCToast showMessage:@"请先登录"];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
return;
}
[[DuDuAPIClient sharedClient] GET:
ORDER_CHANGE_ORDER_CAR_STYLE([self.orderInfo.order_id stringValue],
[car.car_style_id stringValue])
parameters:nil
success:^(NSURLSessionDataTask *task, id responseObject) {
[self.carStore.cars removeAllObjects];
self.resultStatus = OrderResultChangedCar;
[self setData];
[ZBCToast showMessage:@"修改车型成功,请耐心等候"];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (CGSize)getTextFromLabel:(UILabel *)label
{
CGSize textSize = [label.text sizeWithAttributes:@{NSFontAttributeName:label.font}];
[label sizeToFit];
return textSize;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end