|
@@ -13,6 +13,7 @@
|
|
#import "ASGoodsDetailsVM.h"
|
|
#import "ASGoodsDetailsVM.h"
|
|
|
|
|
|
#import "ASAddGiftGoodsView.h"
|
|
#import "ASAddGiftGoodsView.h"
|
|
|
|
+#import "ASMyCartNoDataView.h"
|
|
|
|
|
|
#import "ASGoodsDetailsViewController.h"
|
|
#import "ASGoodsDetailsViewController.h"
|
|
|
|
|
|
@@ -37,6 +38,9 @@
|
|
@property (nonatomic, assign) int index;
|
|
@property (nonatomic, assign) int index;
|
|
@property (nonatomic, assign) int giftShowCount;
|
|
@property (nonatomic, assign) int giftShowCount;
|
|
|
|
|
|
|
|
+//空页面
|
|
|
|
+@property (nonatomic, strong) ASMyCartNoDataView *noDataView;
|
|
|
|
+
|
|
@end
|
|
@end
|
|
|
|
|
|
@implementation Cart_MyCartC
|
|
@implementation Cart_MyCartC
|
|
@@ -52,6 +56,9 @@
|
|
}
|
|
}
|
|
- (void)initSubviews {
|
|
- (void)initSubviews {
|
|
[super initSubviews];
|
|
[super initSubviews];
|
|
|
|
+
|
|
|
|
+ self.view.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
|
|
|
|
+
|
|
[self.view addSubview:self.topBgV];
|
|
[self.view addSubview:self.topBgV];
|
|
[self.topBgV addSubview:self.top_totalLab];
|
|
[self.topBgV addSubview:self.top_totalLab];
|
|
[self.topBgV addSubview:self.top_priceLab];
|
|
[self.topBgV addSubview:self.top_priceLab];
|
|
@@ -66,6 +73,8 @@
|
|
make.centerY.equalTo(self.topBgV);
|
|
make.centerY.equalTo(self.topBgV);
|
|
}];
|
|
}];
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
IPhoneXHeigh
|
|
IPhoneXHeigh
|
|
[self setupTableV:[MyCarlTableV class] Frame:CGRectMake(0, CGRectGetMaxY(self.topBgV.frame), KScreenWidth, KScreenHeight-securityBottom_H - 65- CGRectGetMaxY(self.topBgV.frame)-self.postBtn.mj_h)];
|
|
[self setupTableV:[MyCarlTableV class] Frame:CGRectMake(0, CGRectGetMaxY(self.topBgV.frame), KScreenWidth, KScreenHeight-securityBottom_H - 65- CGRectGetMaxY(self.topBgV.frame)-self.postBtn.mj_h)];
|
|
self.TableV.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
|
|
self.TableV.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
|
|
@@ -76,6 +85,10 @@
|
|
self.addGiftParamArr = [[NSMutableArray alloc] initWithCapacity:1];
|
|
self.addGiftParamArr = [[NSMutableArray alloc] initWithCapacity:1];
|
|
self.index = 0;
|
|
self.index = 0;
|
|
self.giftShowCount = 0;
|
|
self.giftShowCount = 0;
|
|
|
|
+
|
|
|
|
+ self.topBgV.hidden = YES;
|
|
|
|
+ self.postBtn.hidden = YES;
|
|
|
|
+ self.TableV.hidden = YES;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -103,7 +116,7 @@
|
|
[self reqNet_DEL_cartsMineCoupons];
|
|
[self reqNet_DEL_cartsMineCoupons];
|
|
}
|
|
}
|
|
} else if ([data isKindOfClass:[MyCartGrandTotalCellData class]]){
|
|
} else if ([data isKindOfClass:[MyCartGrandTotalCellData class]]){
|
|
- MyCartGrandTotalCellData *totalData = (MyCartGrandTotalCellData *)data;
|
|
|
|
|
|
+// MyCartGrandTotalCellData *totalData = (MyCartGrandTotalCellData *)data;
|
|
|
|
|
|
[self requestLostExtraFee:num];
|
|
[self requestLostExtraFee:num];
|
|
}
|
|
}
|
|
@@ -208,45 +221,75 @@
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
if([mark isEqualToString:Cart_cartsMineTotals]){
|
|
if([mark isEqualToString:Cart_cartsMineTotals]){
|
|
if(sucessOrFail){
|
|
if(sucessOrFail){
|
|
- CartTotalsM *model = [arry firstObject];
|
|
|
|
- self.totalsM = model;
|
|
|
|
- self.top_totalLab.text = [NSString stringWithFormat:@"%@ pcs | total",model.items_qty];
|
|
|
|
- self.top_priceLab.text =[NSString stringWithFormat:@"%@%@",model.currency_symbol,model.subtotal];
|
|
|
|
- [self.TableV.infodata removeAllObjects];
|
|
|
|
- self.TableV.infodata = [NSMutableArray arrayWithArray:model.items];
|
|
|
|
|
|
|
|
- self.couponCellM.couponAry =[NSMutableArray arrayWithArray: [ASNetTools shared].xxx_couponAry];
|
|
|
|
- self.couponCellM.coupon_code = model.coupon_code;
|
|
|
|
- self.couponCellM.discount_amount = model.discount_amount;
|
|
|
|
- self.couponCellM.currency_symbol = model.currency_symbol;
|
|
|
|
- [self.TableV.infodata addObject:self.couponCellM];
|
|
|
|
|
|
|
|
- self.totalCellM.total_segments = [NSMutableArray arrayWithArray:model.total_segments];
|
|
|
|
- self.totalCellM.currency_symbol = model.currency_symbol;
|
|
|
|
- [self.TableV.infodata addObject:self.totalCellM];
|
|
|
|
|
|
|
|
- MyCartPayTypeCellData *data = [[MyCartPayTypeCellData alloc]init];
|
|
|
|
- data.final_prices_f = [model.subtotal floatValue];
|
|
|
|
- data.currency_symbol = model.currency_symbol;
|
|
|
|
- [self.TableV.infodata addObject:data];
|
|
|
|
|
|
|
|
- //手动添加赠品功能
|
|
|
|
- [self.addGiftParamArr removeAllObjects];
|
|
|
|
|
|
|
|
- NSDictionary *freeData = (NSDictionary *)[[self.totalsM.extension_attributes objectForKey:@"free_data"] mj_JSONObject];
|
|
|
|
- BOOL is_show = [[freeData objectForKey:@"is_show"] boolValue];
|
|
|
|
- if (is_show && self.giftShowCount< 1) {//显示存在赠品
|
|
|
|
- NSArray *productArr = [freeData objectForKey:@"products"];
|
|
|
|
- if (productArr.count > 0) { //存在赠品
|
|
|
|
- for (int i = 0; i < productArr.count; i++) {
|
|
|
|
- NSDictionary *productDic = productArr[i];
|
|
|
|
- NSString *entity_id = productDic[@"entity_id"];
|
|
|
|
- [self reqNet_GoodsDetails_productGetProduct:entity_id];
|
|
|
|
|
|
+ CartTotalsM *model = [arry firstObject];
|
|
|
|
+ self.totalsM = model;
|
|
|
|
+
|
|
|
|
+ if (AS_Array_valid(self.totalsM.items)) {
|
|
|
|
+ //空页面
|
|
|
|
+ self.noDataView.hidden = YES;
|
|
|
|
+ self.TableV.hidden = NO;
|
|
|
|
+ self.topBgV.hidden = NO;
|
|
|
|
+ self.postBtn.hidden = NO;
|
|
|
|
+
|
|
|
|
+ self.top_totalLab.text = [NSString stringWithFormat:@"%@ pcs | total",model.items_qty];
|
|
|
|
+ self.top_priceLab.text =[NSString stringWithFormat:@"%@%@",model.currency_symbol,model.subtotal];
|
|
|
|
+ [self.TableV.infodata removeAllObjects];
|
|
|
|
+ self.TableV.infodata = [NSMutableArray arrayWithArray:model.items];
|
|
|
|
+
|
|
|
|
+ self.couponCellM.couponAry =[NSMutableArray arrayWithArray: [ASNetTools shared].xxx_couponAry];
|
|
|
|
+ self.couponCellM.coupon_code = model.coupon_code;
|
|
|
|
+ self.couponCellM.discount_amount = model.discount_amount;
|
|
|
|
+ self.couponCellM.currency_symbol = model.currency_symbol;
|
|
|
|
+ [self.TableV.infodata addObject:self.couponCellM];
|
|
|
|
+
|
|
|
|
+ self.totalCellM.total_segments = [NSMutableArray arrayWithArray:model.total_segments];
|
|
|
|
+ self.totalCellM.currency_symbol = model.currency_symbol;
|
|
|
|
+ [self.TableV.infodata addObject:self.totalCellM];
|
|
|
|
+
|
|
|
|
+ MyCartPayTypeCellData *data = [[MyCartPayTypeCellData alloc]init];
|
|
|
|
+ data.final_prices_f = [model.subtotal floatValue];
|
|
|
|
+ data.currency_symbol = model.currency_symbol;
|
|
|
|
+ [self.TableV.infodata addObject:data];
|
|
|
|
+
|
|
|
|
+ //手动添加赠品功能
|
|
|
|
+ [self.addGiftParamArr removeAllObjects];
|
|
|
|
+
|
|
|
|
+ NSDictionary *freeData = (NSDictionary *)[[self.totalsM.extension_attributes objectForKey:@"free_data"] mj_JSONObject];
|
|
|
|
+ BOOL is_show = [[freeData objectForKey:@"is_show"] boolValue];
|
|
|
|
+ if (is_show && self.giftShowCount< 1) {//显示存在赠品
|
|
|
|
+ NSArray *productArr = [freeData objectForKey:@"products"];
|
|
|
|
+ if (productArr.count > 0) { //存在赠品
|
|
|
|
+ for (int i = 0; i < productArr.count; i++) {
|
|
|
|
+ NSDictionary *productDic = productArr[i];
|
|
|
|
+ NSString *entity_id = productDic[@"entity_id"];
|
|
|
|
+ [self reqNet_GoodsDetails_productGetProduct:entity_id];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ [self.TableV reloadData];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ //空页面
|
|
|
|
+ self.noDataView.hidden = NO;
|
|
|
|
+ self.TableV.hidden = YES;
|
|
|
|
+ self.topBgV.hidden = YES;
|
|
|
|
+ self.postBtn.hidden = YES;
|
|
}
|
|
}
|
|
|
|
|
|
- [self.TableV reloadData];
|
|
|
|
|
|
+ } else {
|
|
|
|
+ //空页面
|
|
|
|
+ self.noDataView.hidden = NO;
|
|
|
|
+ self.TableV.hidden = YES;
|
|
|
|
+ self.topBgV.hidden = YES;
|
|
|
|
+ self.postBtn.hidden = YES;
|
|
|
|
+
|
|
}
|
|
}
|
|
}else if ([mark isEqualToString:Cart_cartsMineItems_Post]
|
|
}else if ([mark isEqualToString:Cart_cartsMineItems_Post]
|
|
|| [mark isEqualToString:DEL_cartsMineItems]
|
|
|| [mark isEqualToString:DEL_cartsMineItems]
|
|
@@ -393,4 +436,14 @@
|
|
return _addGiftView;
|
|
return _addGiftView;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+- (ASMyCartNoDataView *)noDataView {
|
|
|
|
+ if (!_noDataView) {
|
|
|
|
+ IPhoneXHeigh
|
|
|
|
+ _noDataView = [[ASMyCartNoDataView alloc] initWithFrame:CGRectMake(0, securitytop_Y, KScreenWidth, KScreenHeight - securitytop_Y - securityBottom_H)];
|
|
|
|
+ _noDataView.hidden = YES;
|
|
|
|
+ [self.view addSubview:_noDataView];
|
|
|
|
+ }
|
|
|
|
+ return _noDataView;
|
|
|
|
+}
|
|
|
|
+
|
|
@end
|
|
@end
|