Commit 8157c15b77ac69b64e9a807b33ed7e81dcbc8d0a
1 parent
67915edf
no message
Showing
7 changed files
with
346 additions
and
60 deletions
CNLiveMyOrder/Classes/Controller/CNLiveMineOrderController.m
| ... | ... | @@ -159,13 +159,43 @@ |
| 159 | 159 | break; |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | +#pragma mark -Cell被点击 | |
| 162 | 163 | - (void)cellDidSelected { |
| 163 | 164 | __weak typeof(self) weakSelf = self; |
| 164 | 165 | CNLiveOrderDetailController *vc = [[CNLiveOrderDetailController alloc]init]; |
| 165 | - self.allTblView.orderDetaielCellDidSelectedBlock = ^(NSIndexPath * _Nonnull indexPath, NSString * _Nonnull orderId) { | |
| 166 | - vc.orderId = orderId; | |
| 167 | - [weakSelf.navigationController pushViewController:vc animated:NO]; | |
| 168 | - }; | |
| 166 | + switch (_curSeleIndex) { | |
| 167 | + case 0:{ | |
| 168 | + self.allTblView.orderDetaielCellDidSelectedBlock = ^(NSIndexPath * _Nonnull indexPath, NSString * _Nonnull orderId) { | |
| 169 | + vc.orderId = orderId; | |
| 170 | + [weakSelf.navigationController pushViewController:vc animated:NO]; | |
| 171 | + }; | |
| 172 | + } | |
| 173 | + break; | |
| 174 | + case 1:{ | |
| 175 | + self.payTblView.orderDetaielCellDidSelectedBlock = ^(NSIndexPath * _Nonnull indexPath, NSString * _Nonnull orderId) { | |
| 176 | + vc.orderId = orderId; | |
| 177 | + [weakSelf.navigationController pushViewController:vc animated:NO]; | |
| 178 | + }; | |
| 179 | + } | |
| 180 | + break; | |
| 181 | + case 2:{ | |
| 182 | + self.goodsTblView.orderDetaielCellDidSelectedBlock = ^(NSIndexPath * _Nonnull indexPath, NSString * _Nonnull orderId) { | |
| 183 | + vc.orderId = orderId; | |
| 184 | + [weakSelf.navigationController pushViewController:vc animated:NO]; | |
| 185 | + }; | |
| 186 | + } | |
| 187 | + break; | |
| 188 | + case 3:{ | |
| 189 | + self.payTblView.orderDetaielCellDidSelectedBlock = ^(NSIndexPath * _Nonnull indexPath, NSString * _Nonnull orderId) { | |
| 190 | + vc.orderId = orderId; | |
| 191 | + [weakSelf.navigationController pushViewController:vc animated:NO]; | |
| 192 | + }; | |
| 193 | + } | |
| 194 | + break; | |
| 195 | + default: | |
| 196 | + break; | |
| 197 | + } | |
| 198 | + | |
| 169 | 199 | } |
| 170 | 200 | #pragma mark - Lazy |
| 171 | 201 | - (CNLiveSegmentView *)segmentView{ | ... | ... |
CNLiveMyOrder/Classes/Controller/CNLiveOrderDetailController.m
| ... | ... | @@ -446,7 +446,6 @@ |
| 446 | 446 | @"orderId":self.orderId?self.orderId:@"", |
| 447 | 447 | @"sid":@"10511059" |
| 448 | 448 | }; |
| 449 | - | |
| 450 | 449 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNOrderCheckUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { |
| 451 | 450 | NSLog(@"打印这个页面%@-----%@",responseObject, error); |
| 452 | 451 | [QMUITips hideAllToastInView:self.view animated:YES]; |
| ... | ... | @@ -1019,7 +1018,6 @@ |
| 1019 | 1018 | |
| 1020 | 1019 | - (void)didReceiveMemoryWarning { |
| 1021 | 1020 | [super didReceiveMemoryWarning]; |
| 1022 | - // Dispose of any resources that can be recreated. | |
| 1023 | 1021 | } |
| 1024 | 1022 | |
| 1025 | 1023 | ... | ... |
CNLiveMyOrder/Classes/View/CNLiveMineOrderView.h
| ... | ... | @@ -96,7 +96,6 @@ typedef void(^DarenHomeBlock)(CNLiveOrderList *list); |
| 96 | 96 | |
| 97 | 97 | typedef void(^CNOrderFuncViewBlock)(CNLiveMineOrderButtonItemType tag); |
| 98 | 98 | @interface CNLiveFuncView : UIView |
| 99 | - | |
| 100 | 99 | @property (nonatomic, strong) NSArray<CNLiveMineOrderButtonItem *> *funcItems; |
| 101 | 100 | @property (nonatomic, strong) CNOrderFuncViewBlock funcBlock; |
| 102 | 101 | @end | ... | ... |
CNLiveMyOrder/Classes/View/CNLiveOrderEventHandle.h
| ... | ... | @@ -28,11 +28,11 @@ NS_ASSUME_NONNULL_BEGIN |
| 28 | 28 | /** |
| 29 | 29 | * 联系达人 |
| 30 | 30 | */ |
| 31 | -+ (void)contactUser:(CNLiveOrderList *)orderList pop:(BOOL)pop; | |
| 31 | ++ (void)contactUser:(CNLiveOrderList *)orderList pop:(BOOL)pop jumpBlock:(void(^)(BOOL isPop))jumpBlock; | |
| 32 | 32 | /** |
| 33 | 33 | * 退款详情 |
| 34 | 34 | */ |
| 35 | -+ (void)refundDetail:(CNLiveOrderList *)orderList; | |
| 35 | ++ (void)refundDetail:(CNLiveOrderList *)orderList jumpBlock:(void(^)(NSString *orderId))jumpBlock; | |
| 36 | 36 | /** |
| 37 | 37 | * 订单详情 |
| 38 | 38 | */ |
| ... | ... | @@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN |
| 44 | 44 | /** |
| 45 | 45 | * 申请退款 |
| 46 | 46 | */ |
| 47 | -+ (void)applyForRefund:(CNLiveOrderList *)orderList; | |
| 47 | ++ (void)applyForRefund:(CNLiveOrderList *)orderList jumpBlock:(void (^)(CNLiveOrderList *orderList))jumpBlock; | |
| 48 | 48 | /** |
| 49 | 49 | * 确认收货 |
| 50 | 50 | */ |
| ... | ... | @@ -62,13 +62,13 @@ NS_ASSUME_NONNULL_BEGIN |
| 62 | 62 | */ |
| 63 | 63 | + (void)confirmOrder:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void(^)(BOOL ret))complete; |
| 64 | 64 | /** |
| 65 | - * 评论订单 | |
| 65 | + * 评价订单 | |
| 66 | 66 | */ |
| 67 | -+ (void)evaluateOrder:(CNLiveOrderList *)orderList; | |
| 67 | ++ (void)evaluateOrder:(CNLiveOrderList *)orderList jumpBlock:(void (^)(CNLiveOrderList *orderList))jumpBlock; | |
| 68 | 68 | /** |
| 69 | 69 | * 达人主页 |
| 70 | 70 | */ |
| 71 | -+ (void)darenHome:(CNLiveOrderList *)orderList; | |
| 71 | ++ (void)darenHome:(CNLiveOrderList *)orderList jumpBlock:(void (^)(NSString *userId))jumpBlock; | |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * 去支付 | ... | ... |
CNLiveMyOrder/Classes/View/CNLiveOrderEventHandle.m
| ... | ... | @@ -12,22 +12,13 @@ |
| 12 | 12 | #import "DSAddressModel.h" |
| 13 | 13 | #import <CNLiveRequestBastKit/CNLiveNetworking.h> |
| 14 | 14 | #import "CNLiveEnvironmentConfiguration.h" |
| 15 | +#import "CNUserInfoManager.h" | |
| 15 | 16 | @implementation CNLiveOrderEventHandle |
| 16 | - | |
| 17 | -//订单详情 | |
| 18 | -+ (void)orderDetail:(CNLiveOrderList *)orderList orderBlock:(void (^)(NSString * _Nonnull))orderBlock{ | |
| 19 | - CNLiveOrderListOrderItem *item = orderList.orderItem; | |
| 20 | - | |
| 21 | - if (orderBlock) { | |
| 22 | - orderBlock(item.orderId); | |
| 23 | - } | |
| 24 | -} | |
| 25 | -+(void)submitOrder:(CNLiveOrderList *)orderList address:(DSAddressModel *)model superView:(UIView *)view complete:(void (^)(BOOL))complete { | |
| 26 | - [QMUITips showLoadingInView:view]; | |
| 17 | +#pragma mark -提交订单 | |
| 18 | ++ (void)submitOrder:(CNLiveOrderList *)orderList address:(DSAddressModel *)model superView:(UIView *)view complete:(void (^)(BOOL))complete { | |
| 19 | + [QMUITips showLoadingInView:view]; | |
| 27 | 20 | CNLiveOrderListOrderItem *orderItem = orderList.orderItem; |
| 28 | - | |
| 29 | 21 | NSMutableArray *jsonArr = [[NSMutableArray alloc] init]; |
| 30 | - | |
| 31 | 22 | for (CNLiveEditGoodsModel *goodsModel in orderList.orderItem.goodsInfo) { |
| 32 | 23 | |
| 33 | 24 | NSDictionary *goodsDic = @{@"price":[NSString stringWithFormat:@"%.2f",goodsModel.price], |
| ... | ... | @@ -37,9 +28,7 @@ |
| 37 | 28 | }; |
| 38 | 29 | [jsonArr addObject:goodsDic]; |
| 39 | 30 | } |
| 40 | - | |
| 41 | 31 | NSString *jsonStr = [jsonArr mj_JSONString]; |
| 42 | - | |
| 43 | 32 | NSDictionary *param = @{@"orderId":orderItem.orderId, |
| 44 | 33 | @"category":orderItem.category, |
| 45 | 34 | @"fee":[NSString stringWithFormat:@"%.2f", orderItem.fee], |
| ... | ... | @@ -50,9 +39,23 @@ |
| 50 | 39 | @"goodsInfo":jsonStr |
| 51 | 40 | }; |
| 52 | 41 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNOrderModifyUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { |
| 53 | - | |
| 42 | + [QMUITips hideAllToastInView:view animated:YES]; | |
| 43 | + if (!error) { | |
| 44 | + [QMUITips showSucceed:@"提交成功" inView:view hideAfterDelay:1.5]; | |
| 45 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 46 | + if (complete) { | |
| 47 | + complete(YES); | |
| 48 | + } | |
| 49 | + }); | |
| 50 | + | |
| 51 | + } else { | |
| 52 | + [QMUITips showError:error.localizedDescription inView:view hideAfterDelay:1.5]; | |
| 53 | + } | |
| 54 | 54 | }]; |
| 55 | + | |
| 56 | + | |
| 55 | 57 | } |
| 58 | +#pragma mark -删除订单 | |
| 56 | 59 | + (void)deleteOrder:(CNLiveOrderList *)orderList itemId:(NSString *)itemId superView:(UIView *)view complete:(void (^)(BOOL))complete { |
| 57 | 60 | [QMUITips showLoadingInView:view]; |
| 58 | 61 | |
| ... | ... | @@ -61,15 +64,247 @@ |
| 61 | 64 | NSDictionary *param = @{@"appId":AppId, |
| 62 | 65 | @"plat":@"i", |
| 63 | 66 | @"sid":@"10511059", |
| 64 | - @"orderId":orderItem.orderId ?: @""}; | |
| 67 | + @"orderId":orderItem.orderId ?: @"" | |
| 68 | + }; | |
| 65 | 69 | |
| 66 | 70 | NSMutableDictionary *newParam = [[NSMutableDictionary alloc] initWithDictionary:param]; |
| 67 | 71 | if (itemId) { |
| 68 | 72 | [newParam setObject:itemId forKey:@"itemId"]; |
| 69 | 73 | } |
| 70 | 74 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNDeleteOrderUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { |
| 75 | + if (error) { | |
| 76 | + [QMUITips showError:error.localizedDescription inView:view hideAfterDelay:1.5]; | |
| 77 | + // [QMUITips showError:@"删除失败" inView:view hideAfterDelay:1.5]; | |
| 78 | + if (complete) { | |
| 79 | + complete(NO); | |
| 80 | + } | |
| 81 | + } else { | |
| 82 | + | |
| 83 | + [QMUITips showSucceed:@"删除成功" inView:view hideAfterDelay:1.5]; | |
| 84 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 85 | + if (complete) { | |
| 86 | + complete(YES); | |
| 87 | + } | |
| 88 | + }); | |
| 89 | + } | |
| 90 | + }]; | |
| 91 | +} | |
| 92 | +#pragma mark - 催单 | |
| 93 | ++ (void)reminderOrder:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void (^)(NSString *))complete { | |
| 94 | + [QMUITips showLoadingInView:view]; | |
| 95 | + CNLiveOrderListOrderItem *orderItem = orderList.orderItem; | |
| 96 | + CNLiveOrderListIconBean *user = orderList.iconBean; | |
| 97 | + NSDictionary *param = @{@"appId":AppId, | |
| 98 | + @"plat":@"i", | |
| 99 | + @"sid":@"10511059", | |
| 100 | + @"nickName":CNUserShareModel.nickname ?: @"", | |
| 101 | + @"darenId":user.userId ?: @"", | |
| 102 | + @"orderId":orderItem.orderId ?: @"" | |
| 103 | + }; | |
| 104 | +#ifdef Environment_ON | |
| 105 | +#else | |
| 106 | + param = @{@"appId":AppId, | |
| 107 | + @"plat":@"i", | |
| 108 | + @"test":@"0", | |
| 109 | + @"sid":@"10511059", | |
| 110 | + @"nickName":CNUserShareModel.nickname ?: @"", | |
| 111 | + @"darenId":user.userId ?: @"", | |
| 112 | + @"orderId":orderItem.orderId ?: @"" | |
| 113 | + }; | |
| 114 | +#endif | |
| 115 | + [CNLiveNetworking setupShowDataResult:NO]; | |
| 116 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 117 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNRemindOrderUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 118 | + NSDictionary *data = [responseObject objectForKey:@"data"]; | |
| 119 | + NSString *errMessage =[responseObject objectForKey:@"errorMessage"]; | |
| 120 | + NSString *errorCode = [NSString stringWithFormat:@"%@",[responseObject objectForKey:@"errorCode"]]; | |
| 121 | + if (error) { | |
| 122 | + | |
| 123 | + if ((orderItem.status == 5 || orderItem.status == 10) && error.code == 45000) { | |
| 124 | + | |
| 125 | + if (complete) { | |
| 126 | + complete(@"已经多次提醒达人发货"); | |
| 127 | + } | |
| 128 | + } else if (orderItem.status == 6) { | |
| 129 | + if (complete) { | |
| 130 | + complete(@"您的订单目前处于正常配送中,请耐心等待,保持电话畅通,感谢您的谅解与支持"); | |
| 131 | + } | |
| 132 | + } else { | |
| 133 | + if (complete) { | |
| 134 | + complete(error.domain); | |
| 135 | + } | |
| 136 | + } | |
| 137 | + | |
| 138 | + } else { | |
| 139 | + if ([errorCode isEqualToString:@"0"]) { | |
| 140 | + if (complete) { | |
| 141 | + complete(@"催单成功"); | |
| 142 | + } | |
| 143 | + } | |
| 144 | + } | |
| 145 | + }]; | |
| 146 | +} | |
| 147 | +#pragma mark -联系达人 | |
| 148 | ++ (void)contactUser:(CNLiveOrderList *)orderList pop:(BOOL)pop jumpBlock:(void (^)(BOOL))jumpBlock { | |
| 149 | + if (pop) { | |
| 150 | + if (jumpBlock) { | |
| 151 | + jumpBlock (YES); | |
| 152 | + } | |
| 153 | + return; | |
| 154 | + } | |
| 155 | + CNLiveOrderListIconBean *user = orderList.iconBean; | |
| 156 | +#pragma mark - TODO 这个地方需要聊天 | |
| 157 | +// IMAUser *imUser = [[IMAUser alloc] initWith:user.userId nikeName:user.nickName icon:user.image]; | |
| 158 | +// CNChatViewController *chatVC = [[CNChatViewController alloc] initWithUser:imUser]; | |
| 159 | +// chatVC.isDaren = YES; | |
| 160 | + if (jumpBlock) { | |
| 161 | + jumpBlock(NO); | |
| 162 | + } | |
| 163 | +} | |
| 164 | +#pragma mark -退款详情 | |
| 165 | ++ (void)refundDetail:(CNLiveOrderList *)orderList jumpBlock:(void (^)(NSString * _Nonnull))jumpBlock { | |
| 166 | + CNLiveOrderListOrderItem *item = orderList.orderItem; | |
| 167 | + if (jumpBlock) { | |
| 168 | + jumpBlock(item.orderId); | |
| 169 | + } | |
| 170 | +} | |
| 171 | +#pragma mark -订单详情 | |
| 172 | ++ (void)orderDetail:(CNLiveOrderList *)orderList orderBlock:(void (^)(NSString * _Nonnull))orderBlock{ | |
| 173 | + CNLiveOrderListOrderItem *item = orderList.orderItem; | |
| 174 | + | |
| 175 | + if (orderBlock) { | |
| 176 | + orderBlock(item.orderId); | |
| 177 | + } | |
| 178 | +} | |
| 179 | +#pragma mark -申请退款 | |
| 180 | ++ (void)applyForRefund:(CNLiveOrderList *)orderList jumpBlock:(void (^)(CNLiveOrderList * _Nonnull))jumpBlock { | |
| 181 | + if (jumpBlock) { | |
| 182 | + jumpBlock (orderList); | |
| 183 | + } | |
| 184 | +} | |
| 185 | +#pragma mark -确认退货 | |
| 186 | ++ (void)confirmRecv:(CNLiveOrderList *)orderList itemId:(NSString *)itemId superView:(UIView *)view complete:(void (^)(BOOL))complete { | |
| 187 | + [QMUITips showLoadingInView:view]; | |
| 188 | + CNLiveOrderListOrderItem *orderItem = orderList.orderItem; | |
| 189 | + NSDictionary *param = @{@"appId":AppId, | |
| 190 | + @"plat":@"i", | |
| 191 | + @"sid":@"10511059", | |
| 192 | + @"orderId":orderItem.orderId ?: @"" | |
| 193 | + }; | |
| 194 | + NSMutableDictionary *newParam = [[NSMutableDictionary alloc] initWithDictionary:param]; | |
| 195 | + if (itemId) { | |
| 196 | + [newParam setObject:itemId forKey:@"itemId"]; | |
| 197 | + } | |
| 198 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNConfirmRecvUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 199 | + [QMUITips hideAllToastInView:view animated:YES]; | |
| 71 | 200 | |
| 201 | + if (!error) { | |
| 202 | + [QMUITips showSucceed:@"确认收货成功" inView:view hideAfterDelay:1.5]; | |
| 203 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 204 | + if (complete) { | |
| 205 | + complete(YES); | |
| 206 | + } | |
| 207 | + }); | |
| 208 | + | |
| 209 | + } else { | |
| 210 | + [QMUITips showError:error.localizedDescription inView:view hideAfterDelay:1.5]; | |
| 211 | + if (complete) { | |
| 212 | + complete(NO); | |
| 213 | + } | |
| 214 | + } | |
| 215 | + }]; | |
| 216 | +} | |
| 217 | +#pragma mark - 取消订单 | |
| 218 | ++ (void)cancelOrder:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void (^)(BOOL))complete { | |
| 219 | + [QMUITips showLoadingInView:view]; | |
| 220 | + CNLiveOrderListOrderItem *orderItem = orderList.orderItem; | |
| 221 | + NSDictionary *param = @{@"appId":AppId, | |
| 222 | + @"plat":@"i", | |
| 223 | + @"sid":@"10511059", | |
| 224 | + @"orderId":orderItem.orderId ?: @"" | |
| 225 | + }; | |
| 226 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNOrderCancelUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 227 | + [QMUITips hideAllToastInView:view animated:YES]; | |
| 228 | + if (error) { | |
| 229 | + [QMUITips showError:error.localizedDescription inView:view hideAfterDelay:1.5]; | |
| 230 | + if (complete) { | |
| 231 | + complete(NO); | |
| 232 | + } | |
| 233 | + } else { | |
| 234 | + [QMUITips showSucceed:@"取消成功" inView:view hideAfterDelay:1.5]; | |
| 235 | + if (complete) { | |
| 236 | + complete(YES); | |
| 237 | + } | |
| 238 | + } | |
| 239 | + }]; | |
| 240 | +} | |
| 241 | +#pragma mark - 订单信息有误 | |
| 242 | ++ (void)orderError:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void (^)(BOOL))complete { | |
| 243 | + [QMUITips showLoadingInView:view]; | |
| 244 | + CNLiveOrderListOrderItem *orderItem = orderList.orderItem; | |
| 245 | + NSDictionary *param = @{@"appId":AppId, | |
| 246 | + @"plat":@"i", | |
| 247 | + @"sid":@"10511059", | |
| 248 | + @"orderId":orderItem.orderId ?: @"" | |
| 249 | + }; | |
| 250 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNOrderErrorUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 251 | + [QMUITips hideAllToastInView:view animated:YES]; | |
| 252 | + if (!error) { | |
| 253 | + | |
| 254 | + if (complete) { | |
| 255 | + complete(YES); | |
| 256 | + } | |
| 257 | + | |
| 258 | + } else { | |
| 259 | + [QMUITips showError:error.localizedDescription inView:view hideAfterDelay:1.5]; | |
| 260 | + if (complete) { | |
| 261 | + complete(NO); | |
| 262 | + } | |
| 263 | + } | |
| 264 | + }]; | |
| 265 | +} | |
| 266 | +#pragma mark -确认订单 | |
| 267 | ++ (void)confirmOrder:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void (^)(BOOL))complete { | |
| 268 | + [QMUITips showLoadingInView:view]; | |
| 269 | + CNLiveOrderListOrderItem *orderItem = orderList.orderItem; | |
| 270 | + NSDictionary *param = @{@"appId":AppId, | |
| 271 | + @"plat":@"i", | |
| 272 | + @"sid":@"10511059", | |
| 273 | + @"orderId":orderItem.orderId | |
| 274 | + }; | |
| 275 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNOrderConfirmUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | |
| 276 | + [QMUITips hideAllToastInView:view animated:YES]; | |
| 277 | + if (!error) { | |
| 278 | + if (complete) { | |
| 279 | + complete(YES); | |
| 280 | + } | |
| 281 | + } else { | |
| 282 | + [QMUITips showError:error.localizedDescription inView:view hideAfterDelay:1.5]; | |
| 283 | + if (complete) { | |
| 284 | + complete(NO); | |
| 285 | + } | |
| 286 | + } | |
| 72 | 287 | }]; |
| 73 | 288 | } |
| 289 | +#pragma mark -评价订单 | |
| 290 | ++ (void)evaluateOrder:(CNLiveOrderList *)orderList jumpBlock:(void (^)(CNLiveOrderList * _Nonnull))jumpBlock { | |
| 291 | + if (jumpBlock) { | |
| 292 | + jumpBlock(orderList); | |
| 293 | + } | |
| 294 | +} | |
| 295 | +#pragma mark -跳转达人主页 | |
| 296 | ++ (void)darenHome:(CNLiveOrderList *)orderList jumpBlock:(void (^)(NSString * _Nonnull))jumpBlock { | |
| 297 | + CNLiveOrderListIconBean *user = orderList.iconBean; | |
| 298 | + NSString *userId = user.userId; | |
| 299 | + if (jumpBlock) { | |
| 300 | + jumpBlock (userId); | |
| 301 | + } | |
| 302 | +} | |
| 303 | +#pragma mark -去支付 | |
| 304 | ++ (void)pay:(CNLiveOrderList *)orderList payBlock:(PayBlock)block { | |
| 305 | + | |
| 306 | +} | |
| 307 | + | |
| 308 | + | |
| 74 | 309 | @end |
| 75 | 310 | ... | ... |
CNLiveMyOrder/Classes/View/CNLiveOrderListCommonView.h
| ... | ... | @@ -6,11 +6,17 @@ |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | 8 | #import <UIKit/UIKit.h> |
| 9 | +#import "CNLiveOrderList.h" | |
| 9 | 10 | NS_ASSUME_NONNULL_BEGIN |
| 10 | 11 | @interface CNLiveOrderListCommonView : UIView |
| 11 | 12 | //订单状态 0-全部,1-代付款,2-待收货,3-待评价,4-全部退款 ,5退款中 |
| 12 | 13 | - (instancetype)initWithFrame:(CGRect)frame orderStatus:(NSString *)status; |
| 13 | 14 | @property (nonatomic, copy) void (^orderDetaielCellDidSelectedBlock) (NSIndexPath *indexPath,NSString *orderId); //cell被选中 |
| 15 | +@property (nonatomic, copy) void (^evaluateOrderBlock)(CNLiveOrderList *orderModel); //评价订单跳转 | |
| 16 | +@property (nonatomic, copy) void (^contactUserBlock) (BOOL isPop); //联系达人跳转 | |
| 17 | +@property (nonatomic, copy) void (^applyForRefundBlock)(CNLiveOrderList *orderList); //申请退款 | |
| 18 | +@property (nonatomic, copy) void (^refundDetailBlock)(NSString *orderId); //退款详情 | |
| 19 | + | |
| 14 | 20 | - (void)refreshData; |
| 15 | 21 | @end |
| 16 | 22 | ... | ... |
CNLiveMyOrder/Classes/View/CNLiveOrderListCommonView.m
| ... | ... | @@ -67,47 +67,47 @@ |
| 67 | 67 | if (!error) { |
| 68 | 68 | |
| 69 | 69 | if (refresh) { |
| 70 | - _page = 1; | |
| 71 | - [self.listArr removeAllObjects]; | |
| 72 | - [self.tableView.mj_header endRefreshing]; | |
| 70 | + weakSelf.page = 1; | |
| 71 | + [weakSelf.listArr removeAllObjects]; | |
| 72 | + [weakSelf.tableView.mj_header endRefreshing]; | |
| 73 | 73 | } else { |
| 74 | - [self.tableView.mj_footer endRefreshing]; | |
| 74 | + [weakSelf.tableView.mj_footer endRefreshing]; | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | CNLiveOrderModel *model = [CNLiveOrderModel mj_objectWithKeyValues:[responseObject objectForKey:@"data"]]; |
| 78 | 78 | |
| 79 | - _next = model.hasNext; | |
| 80 | - _tableView.mj_footer.hidden = !_next; | |
| 79 | + weakSelf.next = model.hasNext; | |
| 80 | + weakSelf.tableView.mj_footer.hidden = !_next; | |
| 81 | 81 | |
| 82 | 82 | if (model.orderList.count == 0) { |
| 83 | 83 | //noData |
| 84 | - [self.tableView addSubview:self.noDataView]; | |
| 84 | + [weakSelf.tableView addSubview:self.noDataView]; | |
| 85 | 85 | |
| 86 | 86 | } else { |
| 87 | 87 | |
| 88 | - [self.noDataView removeFromSuperview]; | |
| 88 | + [weakSelf.noDataView removeFromSuperview]; | |
| 89 | 89 | |
| 90 | 90 | for (CNLiveOrderList *orderList in model.orderList) { |
| 91 | - [_listArr addObject:orderList]; | |
| 91 | + [weakSelf.listArr addObject:orderList]; | |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - [self.tableView reloadData]; | |
| 95 | + [weakSelf.tableView reloadData]; | |
| 96 | 96 | |
| 97 | 97 | } else { |
| 98 | 98 | |
| 99 | 99 | [QMUITips showError:error.localizedDescription inView:self hideAfterDelay:1.5]; |
| 100 | 100 | |
| 101 | 101 | if (refresh) { |
| 102 | - [self.tableView.mj_header endRefreshing]; | |
| 102 | + [weakSelf.tableView.mj_header endRefreshing]; | |
| 103 | 103 | } else { |
| 104 | - [self.tableView.mj_footer endRefreshing]; | |
| 104 | + [weakSelf.tableView.mj_footer endRefreshing]; | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (error.code == -1009) { |
| 108 | - [self showErrorRetryType:RetryTypeNoNet]; | |
| 108 | + [weakSelf showErrorRetryType:RetryTypeNoNet]; | |
| 109 | 109 | } else { |
| 110 | - [self showErrorRetryType:RetryTypeError]; | |
| 110 | + [weakSelf showErrorRetryType:RetryTypeError]; | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | } |
| ... | ... | @@ -170,21 +170,24 @@ |
| 170 | 170 | #pragma mark - |
| 171 | 171 | #pragma mark - CNMineOrderTableViewCellDelegate |
| 172 | 172 | - (void)cellWithOrderModel:(CNLiveOrderList *)model type:(CNLiveMineOrderButtonItemType)type { |
| 173 | - | |
| 174 | - | |
| 175 | 173 | switch (type) { |
| 176 | 174 | case CNLiveMineOrderButtonItemTypeCancel: { //取消订单 |
| 177 | -// [CNLiveOrderEventHandle cancelOrder:model superView:self complete:^(BOOL ret) { | |
| 178 | -// if (ret) { | |
| 179 | -// [self refreshData]; | |
| 180 | -// } | |
| 181 | -// }]; | |
| 175 | + [CNLiveOrderEventHandle cancelOrder:model superView:self complete:^(BOOL ret) { | |
| 176 | + if (ret) { | |
| 177 | + [self refreshData]; | |
| 178 | + } | |
| 179 | + }]; | |
| 182 | 180 | } |
| 183 | 181 | break; |
| 184 | 182 | |
| 185 | 183 | case CNLiveMineOrderButtonItemTypeEvaluate: { //评价订单 |
| 186 | 184 | |
| 187 | 185 | // [CNLiveOrderEventHandle evaluateOrder:model]; |
| 186 | + [CNLiveOrderEventHandle evaluateOrder:model jumpBlock:^(CNLiveOrderList * _Nonnull orderList) { | |
| 187 | + if (self.evaluateOrderBlock) { | |
| 188 | + self.evaluateOrderBlock(orderList); | |
| 189 | + } | |
| 190 | + }]; | |
| 188 | 191 | |
| 189 | 192 | } |
| 190 | 193 | break; |
| ... | ... | @@ -202,11 +205,16 @@ |
| 202 | 205 | |
| 203 | 206 | case CNLiveMineOrderButtonItemTypeContactDaRen: { //联系达人 |
| 204 | 207 | // [CNOrderEventHandle contactUser:model pop:NO]; |
| 208 | + [CNLiveOrderEventHandle contactUser:model pop:NO jumpBlock:^(BOOL isPop) { | |
| 209 | + if (self.contactUserBlock) { | |
| 210 | + self.contactUserBlock(NO); | |
| 211 | + } | |
| 212 | + }]; | |
| 205 | 213 | } |
| 206 | 214 | break; |
| 207 | 215 | |
| 208 | 216 | case CNLiveMineOrderButtonItemTypePay: { //去付款 |
| 209 | - weakself | |
| 217 | +// weakself | |
| 210 | 218 | // [CNOrderEventHandle pay:model payBlock:^(int code) { |
| 211 | 219 | // if (code == 0) { |
| 212 | 220 | // //支付成功 |
| ... | ... | @@ -217,29 +225,39 @@ |
| 217 | 225 | break; |
| 218 | 226 | |
| 219 | 227 | case CNLiveMineOrderButtonItemTypeReminder: { //催单 |
| 220 | -// [CNOrderEventHandle reminderOrder:model superView:self complete:^(NSString *msg) { | |
| 221 | -// [[HUDHelper sharedInstance] tipMessage:msg]; | |
| 222 | -// }]; | |
| 228 | + [CNLiveOrderEventHandle reminderOrder:model superView:self complete:^(NSString *msg) { | |
| 229 | + [[HUDHelper sharedInstance] tipMessage:msg]; | |
| 230 | + }]; | |
| 223 | 231 | } |
| 224 | 232 | break; |
| 225 | 233 | |
| 226 | 234 | case CNLiveMineOrderButtonItemTypeRefund: { //申请退款 |
| 227 | 235 | // [CNOrderEventHandle applyForRefund:model]; |
| 236 | + [CNLiveOrderEventHandle applyForRefund:model jumpBlock:^(CNLiveOrderList * _Nonnull orderList) { | |
| 237 | + if (self.applyForRefundBlock) { | |
| 238 | + self.applyForRefundBlock(orderList); | |
| 239 | + } | |
| 240 | + }]; | |
| 228 | 241 | } |
| 229 | 242 | break; |
| 230 | 243 | |
| 231 | 244 | case CNLiveMineOrderButtonItemTypeRefundDetail: { //退款详情 |
| 232 | 245 | // [CNOrderEventHandle refundDetail:model]; |
| 246 | + [CNLiveOrderEventHandle refundDetail:model jumpBlock:^(NSString * _Nonnull orderId) { | |
| 247 | + if (self.refundDetailBlock) { | |
| 248 | + self.refundDetailBlock(orderId); | |
| 249 | + } | |
| 250 | + }]; | |
| 233 | 251 | } |
| 234 | 252 | break; |
| 235 | 253 | |
| 236 | 254 | case CNLiveMineOrderButtonItemTypeConfirmReceipt: { //确认收货 |
| 237 | 255 | |
| 238 | -// [CNOrderEventHandle confirmRecv:model itemId:nil superView:self complete:^(BOOL ret) { | |
| 239 | -// if (ret) { | |
| 240 | -// [self refreshData]; | |
| 241 | -// } | |
| 242 | -// }]; | |
| 256 | + [CNLiveOrderEventHandle confirmRecv:model itemId:@"" superView:self complete:^(BOOL ret) { | |
| 257 | + if (ret) { | |
| 258 | + [self refreshData]; | |
| 259 | + } | |
| 260 | + }]; | |
| 243 | 261 | } |
| 244 | 262 | break; |
| 245 | 263 | ... | ... |