Aucune description

OrderDetailController.m 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. //
  2. // OrdeDetailController.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/6/22.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "OrderDetailController.h"
  9. #import "LogisticsItem.h"
  10. #import "FKOrderGoodItem.h"
  11. #import "SubmitPaymentItem.h"
  12. #import "FKOrderSupplierItem.h"
  13. #import "FKSupplierDetailItem.h"
  14. #import "FKOrderAddressCell.h"
  15. #import "FKOrderSupplierStatusCell.h"
  16. #import "FKOrderDetailLogisticsCell.h"
  17. #import "FKOrderDetailProductCell.h"
  18. #import "FKOrderDetailActionCell.h"
  19. #import "PindanCommonCell.h"
  20. #import "FKOrderDetailTotalPriceCell.h"
  21. #import "FKOrderDetailSummaryCell.h"
  22. #import "FKOrderDetailPriceView.h"
  23. #import "FKOrderDetailRequest.h"
  24. #import "FKOrderDetailReform.h"
  25. #import "OrderDetailBottomVIew.h"
  26. #import "FKSignDoneView.h"
  27. #import "FLThirdPayHelper.h"
  28. #import "UIExtendAlertView.h"
  29. #import "ShakeRedPacketController.h"
  30. #import "ChatViewController.h"
  31. #import "OrderPayController.h"
  32. #import "PindanDetailController.h"
  33. #import "FKProDetailController.h"
  34. #import "FKGroupOrderController.h"
  35. #import "FKGroupDetailController.h"
  36. #import "LogisticsViewController.h"
  37. #import "FKRefundDetailController.h"
  38. #import "FKWeakTimerTarget.h"
  39. @interface OrderDetailController ()
  40. <UITableViewDataSource, UITableViewDelegate, UIAlertViewDelegate, FLNetworkDelegate>
  41. @property (nonatomic, strong) NSString *orderID;
  42. @property (nonatomic, strong) FKBaseOrderViewModel *viewModel;
  43. @property (nonatomic, strong) UITableView *tableView;
  44. @property (nonatomic, strong) OrderDetailBottomVIew *bottomView;
  45. @property (nonatomic, strong) FKOrderDetailPriceView *detailPriceView;
  46. @property (nonatomic, assign) NSTimeInterval timeInterval;
  47. @end
  48. @implementation OrderDetailController
  49. - (instancetype)initWithOrderID:(NSString *)orderID {
  50. self = [super init];
  51. if (self) {
  52. _orderID = orderID;
  53. }
  54. return self;
  55. }
  56. - (void)loadView {
  57. [super loadView];
  58. [self addAllSubviews];
  59. }
  60. - (void)viewDidLoad {
  61. [super viewDidLoad];
  62. self.view.backgroundColor = [UIColor colorWithRed:235/255.0f green:235/255.0f blue:241/255.0f alpha:1.0];
  63. if (self.openURLPara) {
  64. _orderID = self.openURLPara[@"order_id"];
  65. }
  66. [self configTableViewCell];
  67. }
  68. - (void)dealloc {
  69. }
  70. - (void)viewWillAppear:(BOOL)animated {
  71. [super viewWillAppear:animated];
  72. [self.navigationController setNavigationBarHidden:NO animated:YES];
  73. self.navigationItem.title = @"订单详情";
  74. [self requestOrderDetail];
  75. }
  76. - (void)viewDidAppear:(BOOL)animated {
  77. [super viewDidAppear:animated];
  78. }
  79. - (void)viewWillDisappear:(BOOL)animated {
  80. [super viewWillDisappear:animated];
  81. }
  82. #pragma mark - Request
  83. - (void)requestOrderDetail {
  84. if (_orderID.length > 0) {
  85. [self.hudView show:YES];
  86. [FKOrderDetailRequest requestOrderDetail:FKOrderRequestDetail orderID:_orderID delegate:self];
  87. }
  88. }
  89. #pragma mark - Response
  90. - (void)networkDidReceiveError:(NSError*)error identify:(int)identify header:(MSGHeader*)header {
  91. [self.hudView hide:NO];
  92. [FLProgressHUDHelper showText:header.msg inView:self.view];
  93. }
  94. - (void)networkDidSuccessResponse:(NSDictionary*)response identify:(int)identify header:(MSGHeader*)header{
  95. [self.hudView hide:NO];
  96. if (header.code.intValue == RESPONSE_MSG_NORMAL) {
  97. if (identify == FKOrderRequestDetail) {
  98. OrderDetailItem *orderDetailItem = [FKOrderDetailReform parserOrderDetailItem:response];
  99. self.viewModel = [[FKNormalOrderViewModel alloc] initWithOrderID:orderDetailItem.orderID];
  100. self.viewModel.orderDetailItem = orderDetailItem;
  101. // 获取BottomView高度
  102. if ([self.viewModel respondsToSelector:@selector(bottomViewHeight)]) {
  103. CGFloat height = [self.viewModel bottomViewHeight];
  104. [self remakeBottomViewHeight:height];
  105. // 判断是否需要开启失效倒计时
  106. if (height > 0) {
  107. NSTimeInterval interval = [self.viewModel countDownTimeInterval];
  108. if (interval > 0) {
  109. // 防止多次启用倒计时
  110. if (self.timeInterval == 0) {
  111. self.timeInterval = interval;
  112. self.bottomView.textLabel.text = [NSString stringWithFormat:@"失效倒计时:%@",
  113. [self.viewModel countDownTimeString:self.timeInterval]];
  114. [FKWeakTimerTarget scheduledTimerWithTimeInterval:1.0
  115. target:self
  116. selector:@selector(timeCountDownCallback)
  117. userInfo:nil
  118. repeats:YES];
  119. }
  120. } else {
  121. self.bottomView.textLabel.text = @"";
  122. }
  123. }
  124. }
  125. // 普通订单和团订单设置BottomView标题
  126. if ([self.viewModel respondsToSelector:@selector(bottomViewTitle)]) {
  127. NSString *title = [self.viewModel bottomViewTitle];
  128. [self.bottomView.paymentButton setTitle:title
  129. forState:UIControlStateNormal];
  130. }
  131. [self.tableView reloadData];
  132. } else if (identify == FKOrderRequestConfirm) {
  133. NSString *score = [NSString stringWithFormat:@"%@", response[@"data"][@"score"]];
  134. [FKSignDoneView showInView:self.view.window
  135. withNextDay:nil
  136. score:score
  137. bgImage:[UIImage imageNamed:@"sign_bg2"]
  138. completion:nil];
  139. [self requestOrderDetail];
  140. }
  141. } else {
  142. [FLProgressHUDHelper showText:header.msg inView:self.view];
  143. }
  144. }
  145. #pragma mark - tableView dataSource & delegate
  146. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  147. if ([self.viewModel respondsToSelector:@selector(numberOfSectionsInTableView)]) {
  148. return [self.viewModel numberOfSectionsInTableView];
  149. }
  150. return 0;
  151. }
  152. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  153. if ([self.viewModel respondsToSelector:@selector(numberOfRowsInSection:)]) {
  154. return [self.viewModel numberOfRowsInSection:section];
  155. }
  156. return 0;
  157. }
  158. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  159. return 10;
  160. }
  161. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
  162. return CGFLOAT_MIN;
  163. }
  164. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  165. kOrderCellType cellType = kOrderCellTypeNone;
  166. if ([self.viewModel respondsToSelector:@selector(orderCellTypeAtIndexPath:)]) {
  167. cellType = [self.viewModel orderCellTypeAtIndexPath:indexPath];
  168. }
  169. switch (cellType) {
  170. case kOrderCellTypeAddress:
  171. return [FKOrderAddressCell heightWithAddress:[self.viewModel.orderDetailItem.address detailAddressWithNoTip]
  172. idNum:[self.viewModel idCardNum]];
  173. case kOrderCellTypeStatus:
  174. return 60;
  175. case kOrderCellTypeLogistics:
  176. return 60;
  177. case kOrderCellTypeSpecs:
  178. return (95 + 2);
  179. case kOrderCellTypeAction:
  180. return (50 - 2);
  181. case kOrderCellTypeRefundChargeClear:
  182. case kOrderCellTypeChargeClear:
  183. return 44;
  184. case kOrderCellTypeMessage:
  185. return [PindanBaseCell cellHeightForMessage:[self.viewModel priceDetailTitle:cellType].string];
  186. case kOrderCellTypeTotalPrice:
  187. return (10 + 40);
  188. case kOrderCellTypeRefundTotalPrice:
  189. return (10 + 30);
  190. case kOrderCellTypeSummary:
  191. return 110;
  192. default:
  193. return 28;
  194. break;
  195. }
  196. }
  197. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  198. id<FKOrderDetailCellDelegate> cell;
  199. if ([self.viewModel respondsToSelector:@selector(orderCellTypeAtIndexPath:)]) {
  200. kOrderCellType cellType = [self.viewModel orderCellTypeAtIndexPath:indexPath];
  201. NSString *identify = [self.viewModel orderCellIdentifyWith:cellType];
  202. cell = [self.tableView dequeueReusableCellWithIdentifier:identify];
  203. switch (cellType) {
  204. case kOrderCellTypeStatus:
  205. case kOrderCellTypeLogistics:
  206. case kOrderCellTypeAddress:
  207. case kOrderCellTypeSpecs:
  208. case kOrderCellTypeTotalPrice:
  209. case kOrderCellTypeRefundTotalPrice:
  210. case kOrderCellTypeSummary:
  211. case kOrderCellTypeAction: {
  212. if ([cell respondsToSelector:@selector(configOrderDetailCell:viewModel:)]) {
  213. [cell configOrderDetailCell:indexPath viewModel:self.viewModel];
  214. }
  215. if ([cell isKindOfClass:[FKOrderDetailSummaryCell class]]) {
  216. FKOrderDetailSummaryCell *headerCell = (FKOrderDetailSummaryCell *)cell;
  217. [headerCell.serviceButton addTarget:self action:@selector(clickConnectServiceAction) forControlEvents:UIControlEventTouchUpInside];
  218. }
  219. if ([cell isKindOfClass:[FKOrderDetailActionCell class]]) {
  220. FKOrderDetailActionCell *actionCell = (FKOrderDetailActionCell *)cell;
  221. // actionCell.logisticsDetailButton.tag = indexPath.section;
  222. actionCell.priceDetailButton.tag = indexPath.section;
  223. actionCell.refundDetailButton.tag = indexPath.section;
  224. actionCell.confirmReceiptButton.tag = indexPath.section;
  225. // [actionCell.logisticsDetailButton addTarget:self action:@selector(clickLogisticsAction:) forControlEvents:UIControlEventTouchUpInside];
  226. [actionCell.priceDetailButton addTarget:self action:@selector(clickPriceDetailAction:) forControlEvents:UIControlEventTouchUpInside];
  227. [actionCell.refundDetailButton addTarget:self action:@selector(clickRefundPriceDetailAction:) forControlEvents:UIControlEventTouchUpInside];
  228. [actionCell.confirmReceiptButton addTarget:self action:@selector(clickConfirmReceiptAction:) forControlEvents:UIControlEventTouchUpInside];
  229. }
  230. break;
  231. }
  232. case kOrderCellTypeChargeClear:
  233. case kOrderCellTypeRefundChargeClear: {
  234. if ([cell respondsToSelector:@selector(configOrderDetailPriceCell:text:)]) {
  235. [cell configOrderDetailPriceCell:[self.viewModel chargeClearTitleWith:cellType] text:nil];
  236. }
  237. if ([cell isKindOfClass:[PindanCommonCell class]]) {
  238. PindanCommonCell *commonCell = (PindanCommonCell *)cell;
  239. commonCell.bottomLine.hidden = NO;
  240. }
  241. break;
  242. }
  243. case kOrderCellTypeProductPrice:
  244. case kOrderCellTypeRefundProductPrice:
  245. case kOrderCellTypeOfficialCarriage:
  246. case kOrderCellTypeRefundOfficialCarriage:
  247. case kOrderCellTypeInternationCarriage:
  248. case kOrderCellTypeRefundInternationCarriage:
  249. case kOrderCellTypeTaxFee:
  250. case kOrderCellTypeRefundTaxFee:
  251. case kOrderCellTypeServiceFee:
  252. case kOrderCellTypeDerateFee:
  253. case kOrderCellTypeRefundDerateFee:
  254. case kOrderCellTypeMessage: {
  255. if ([cell respondsToSelector:@selector(configOrderDetailPriceCell:text:)]) {
  256. [cell configOrderDetailPriceCell:[self.viewModel priceDetailTitle:cellType]
  257. text:[self.viewModel priceDetailText:cellType]];
  258. }
  259. if ([cell isKindOfClass:[PindanBaseCell class]]) {
  260. PindanBaseCell *commonCell = (PindanBaseCell *)cell;
  261. commonCell.bottomLine.hidden = YES;
  262. }
  263. break;
  264. }
  265. default:
  266. break;
  267. }
  268. }
  269. if (!cell) {
  270. cell = (id<FKOrderDetailCellDelegate>)[[UITableViewCell alloc] init];
  271. }
  272. return (UITableViewCell*)cell;
  273. }
  274. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  275. UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
  276. if ([cell isKindOfClass:[FKOrderDetailProductCell class]]){
  277. FKOrderGoodItem *goodItem = [self.viewModel goodItemAtIndexPath:indexPath];
  278. if((kOrderType)goodItem.objectType.intValue == kOrderTypeProduct) {
  279. FKProDetailController *controller = [[FKProDetailController alloc] initWithProductID:goodItem.objectID
  280. selectSpecId:goodItem.goodsID];
  281. controller.hidesBottomBarWhenPushed = YES;
  282. [self.navigationController pushViewController:controller animated:YES];
  283. } else {
  284. PindanDetailController *controller = [[PindanDetailController alloc] initWithUserID:goodItem.userID
  285. postID:goodItem.objectID];
  286. controller.hidesBottomBarWhenPushed = YES;
  287. [self.navigationController pushViewController:controller animated:YES];
  288. }
  289. } else if ([cell isKindOfClass:[FKOrderDetailLogisticsCell class]]) {
  290. [self pushLogisticsViewController:indexPath.section];
  291. }
  292. }
  293. #pragma mark - Action
  294. - (IBAction)clickLogisticsAction:(UIButton *)sender {
  295. [self pushLogisticsViewController:sender.tag];
  296. }
  297. - (void)pushLogisticsViewController:(NSInteger)section {
  298. FKOrderSupplierItem *item = [self.viewModel supplierItemAtIndex:(section - 1)];
  299. FKSupplierDetailItem *detailItem = item.supplierDetailItem;
  300. LogisticsItem *logisticsItem = item.logisticsItem;
  301. if (detailItem.waybillID.length == 0) {
  302. [FLProgressHUDHelper showText:@"暂未查询到物流信息" inView:self.view];
  303. } else {
  304. LogisticsViewController *controller = [LogisticsViewController new];
  305. controller.waybillID = detailItem.waybillID;
  306. controller.logisticsID = logisticsItem.itemID;
  307. controller.hidesBottomBarWhenPushed = YES;
  308. [self.navigationController pushViewController:controller animated:YES];
  309. }
  310. }
  311. - (IBAction)clickRefundPriceDetailAction:(UIButton *)sender {
  312. FKOrderSupplierItem *item = [self.viewModel supplierItemAtIndex:(sender.tag - 1)];
  313. FKSupplierDetailItem *detailItem = item.supplierDetailItem;
  314. FKRefundDetailController *controller = [[FKRefundDetailController alloc] initWithPaymentID:detailItem.itemID];
  315. controller.hidesBottomBarWhenPushed = YES;
  316. [self.navigationController pushViewController:controller animated:YES];
  317. }
  318. - (IBAction)clickPriceDetailAction:(UIButton *)sender {
  319. FKOrderSupplierItem *item = [self.viewModel supplierItemAtIndex:(sender.tag - 1)];
  320. FKSupplierDetailItem *supplierDetailItem = item.supplierDetailItem;
  321. self.detailPriceView.totalPriceLabel.text = [self convertFenStringToYuan:supplierDetailItem.totalPrice];
  322. self.detailPriceView.officialPostageLabel.text = [self convertFenStringToYuan:supplierDetailItem.officialPostage];
  323. self.detailPriceView.internationalPostageLabel.text = [self convertFenStringToYuan:supplierDetailItem.internationalPostage];
  324. self.detailPriceView.taxFeeLabel.text = [self convertFenStringToYuan:supplierDetailItem.taxFee];
  325. self.detailPriceView.serviceFeeLabel.text = [self convertFenStringToYuan:supplierDetailItem.serviceFee];
  326. self.detailPriceView.derateLabel.text = [NSString stringWithFormat:@"-%@", [self convertFenStringToYuan:supplierDetailItem.derateFee]];
  327. [self.view.window addSubview:self.detailPriceView];
  328. }
  329. - (IBAction)clickConfirmReceiptAction:(UIButton *)sender {
  330. UIExtendAlertView *alert = [[UIExtendAlertView alloc] initWithTitle:nil
  331. message:@"是否确认收货?"
  332. delegate:self
  333. cancelButtonTitle:@"否"
  334. otherButtonTitles:@"是", nil];
  335. alert.delegate = self;
  336. // alert.userInfo = @{@"type": FKPersonOrderCancelAction};
  337. alert.tag = (sender.tag - 1);
  338. [alert show];
  339. }
  340. - (void)clickBottomButtonAction {
  341. if ([self.viewModel getOrderStatus] == FKOrderStatusUnpay) {
  342. SubmitPaymentItem *paymentItem = [[SubmitPaymentItem alloc]init];
  343. paymentItem.orderID = self.viewModel.orderDetailItem.orderID;
  344. paymentItem.successController = FKOrderPaymentSuccessControllerRedpacket;
  345. OrderPayController *orderPayController = [[OrderPayController alloc] initWithPaymentItem:paymentItem];
  346. NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
  347. for (UIViewController *controller in viewControllers) {
  348. if ([controller isKindOfClass:[OrderPayController class]]){
  349. [viewControllers removeObject:controller];
  350. break;
  351. }
  352. }
  353. [viewControllers addObject:orderPayController];
  354. [self.navigationController setViewControllers:viewControllers animated:YES];
  355. }
  356. }
  357. - (void)clickConnectServiceAction {
  358. OrderDetailItem *item = self.viewModel.orderDetailItem;
  359. ChatViewController *chatController = [[ChatViewController alloc] initWithChatter:item.serveUserItem.userId
  360. isGroup:NO];
  361. chatController.naviTitle = self.viewModel.orderDetailItem.serveUserItem.nickName;
  362. chatController.receiverHeadURL = item.serveUserItem.headerPic;
  363. chatController.msgExtData = [self connectCustomerExtData:item];
  364. [self.navigationController pushViewController:chatController animated:YES];
  365. // 行为统计
  366. NSString *jsonStr = [FLRequestHelper JSONStringWithKeys:@[@"order_id"]
  367. values:@[self.viewModel.orderDetailItem.orderID]];
  368. [BehaviorTrackManger requestBehaviorType:kBehaviorOrderServe jsonString:jsonStr];
  369. }
  370. #pragma mark - Alert View Delegate
  371. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
  372. if (buttonIndex == 1) {
  373. if ([alertView isKindOfClass:[UIExtendAlertView class]]) {
  374. FKOrderSupplierItem *item = [self.viewModel supplierItemAtIndex:alertView.tag];
  375. FKSupplierDetailItem *detailItem = item.supplierDetailItem;
  376. if (detailItem.itemID.length > 0) {
  377. [FKOrderDetailRequest requestConfirmReceive:FKOrderRequestConfirm orderID:detailItem.itemID deleagate:self];
  378. }
  379. }
  380. }
  381. }
  382. #pragma mark - Method
  383. - (void)timeCountDownCallback {
  384. self.timeInterval = (self.timeInterval - 1);
  385. self.bottomView.textLabel.text = [NSString stringWithFormat:@"失效倒计时:%@",
  386. [self.viewModel countDownTimeString:self.timeInterval]];
  387. if (self.timeInterval <= 0) {
  388. [self remakeBottomViewHeight:0];
  389. [self.viewModel setOrderAsInvalid];
  390. [self.tableView reloadData];
  391. }
  392. }
  393. - (NSString *)convertFenStringToYuan:(NSString *)string {
  394. return [NSString stringWithFormat:@"¥%.2f", string.floatValue/100.0];
  395. }
  396. #pragma mark - Private
  397. - (void)remakeBottomViewHeight:(CGFloat)height {
  398. [self.bottomView mas_remakeConstraints:^(MASConstraintMaker *make) {
  399. make.left.right.bottom.equalTo(self.view);
  400. make.height.equalTo(@(height));
  401. }];
  402. }
  403. - (NSDictionary *)connectCustomerExtData:(OrderDetailItem *)item {
  404. return @{EXT_MSG_ORDER_TITLE: [NSString stringWithFormat:@"订单号:%@", item.paymentNO],
  405. EXT_MSG_GOODS_ID_V2: self.viewModel.orderDetailItem.orderID,
  406. EXT_QUEUE_NAME : QueueNameShouhou};
  407. }
  408. - (void)configTableViewCell {
  409. [self.tableView registerClass:[FKOrderAddressCell class] forCellReuseIdentifier:FKOrderDetailReceiverAddressCellIdentify];
  410. [self.tableView registerClass:[FKOrderSupplierStatusCell class] forCellReuseIdentifier:FKOrderSupplierStatusCellIdentify];
  411. [self.tableView registerClass:[FKOrderDetailLogisticsCell class] forCellReuseIdentifier:FKOrderDetailLogisticsCellIdentify];
  412. [self.tableView registerClass:[FKOrderDetailProductCell class] forCellReuseIdentifier:FKOrderDetailProductDetailCellIdentify];
  413. [self.tableView registerClass:[FKOrderDetailActionCell class] forCellReuseIdentifier:FKOrderDetailActionCellIdentify];
  414. [self.tableView registerClass:[FKOrderDetailTotalPriceCell class] forCellReuseIdentifier:FKOrderDetailTotalPriceCellIdentify];
  415. [self.tableView registerClass:[PindanBaseCell class] forCellReuseIdentifier:FKOrderDetailPindanBaseCellIdentify];
  416. [self.tableView registerClass:[PindanCommonCell class] forCellReuseIdentifier:FKOrderDetailPindanCommonCellIdentify];
  417. [self.tableView registerClass:[FKOrderDetailSummaryCell class] forCellReuseIdentifier:FKOrderDetailSummaryCellIdentify];
  418. }
  419. #pragma mark - Layout
  420. - (void)addAllSubviews {
  421. [self.view addSubview:self.bottomView];
  422. [self.bottomView mas_remakeConstraints:^(MASConstraintMaker *make) {
  423. make.left.right.bottom.equalTo(self.view);
  424. make.height.equalTo(@(0));
  425. }];
  426. [self.view addSubview:self.tableView];
  427. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  428. make.left.top.right.equalTo(self.view);
  429. make.bottom.equalTo(self.bottomView.mas_top);
  430. }];
  431. }
  432. #pragma mark - Property
  433. - (UITableView *)tableView {
  434. if (_tableView == nil) {
  435. _tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
  436. _tableView.dataSource = self;
  437. _tableView.delegate = self;
  438. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  439. _tableView.sectionFooterHeight = 0;
  440. _tableView.backgroundColor = COMMON_TABLEVIEW_BACKGROUND_COLOR;
  441. if (@available(iOS 11.0, *)) {
  442. _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  443. }
  444. }
  445. return _tableView;
  446. }
  447. - (OrderDetailBottomVIew *)bottomView {
  448. if (_bottomView == nil) {
  449. _bottomView = [[OrderDetailBottomVIew alloc]init];
  450. [_bottomView.paymentButton addTarget:self
  451. action:@selector(clickBottomButtonAction)
  452. forControlEvents:UIControlEventTouchUpInside];
  453. }
  454. return _bottomView;
  455. }
  456. - (FKOrderDetailPriceView *)detailPriceView {
  457. if (!_detailPriceView) {
  458. _detailPriceView = [[FKOrderDetailPriceView alloc] init];
  459. _detailPriceView.frame = CGRectMake(0, 0, UISCREENWIDTH, UISCREENHEIGH);
  460. _detailPriceView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
  461. }
  462. return _detailPriceView;
  463. }
  464. @end