// // ASUserCenterViewController.m // Asteria // // Created by iOS on 2023/5/15. // #import "ASUserCenterViewController.h" #import "ASUserCenterTableHeadView.h" #import "KWMineHomeOrderHeadView.h" #import "KWMineHomeOrderListCell.h" #import "KWMineMoreProductsCell.h" @interface ASUserCenterViewController () @property (nonatomic,strong) UITableView *tableV; @property (nonatomic,strong) ASUserCenterTableHeadView *tableHeadV; @end @implementation ASUserCenterViewController - (void)viewDidLoad { [super viewDidLoad]; __block typeof(self) wSelf = self; [self ucHomeStyle:^{ // TODO: 跳转搜索模块 }]; [self.view addSubview:self.tableV]; [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.customNavBar.mas_bottom); make.leading.trailing.equalTo(self.view); make.bottom.equalTo(self.view); }]; [self.tableHeadV.signV configDayArr:4 currentDay:7 status:false]; } #pragma mark - UITableViewDelegate,UITableViewDataSource - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) { return 3; //self.orderVm.orderList.count; } if (section == 1) { return 1; } return 0; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { KWMineHomeOrderListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"KWMineHomeOrderListCell" forIndexPath:indexPath]; // if (self.orderVm.orderList.count <= indexPath.row) { // return cell; // } // KWMineHomeOrderModel *m = self.orderVm.orderList[indexPath.row]; // [cell setData:m]; // @weakify(self); [cell setViewOrderCall:^{ // if (![weak_self checkLogin:true]) { // return; // } // 查看订单 NSLog(@"查看订单 view order"); // KWM_OrderViewC *vc = [[KWM_OrderViewC alloc]init]; // vc.order_id = m.orderId; // [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES]; }]; return cell; } KWMineMoreProductsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"KWMineMoreProductsCell" forIndexPath:indexPath]; cell.topSpace = 20; KWMineMoreProductModel * model = [KWMineMoreProductModel demoData]; [cell setData: model]; @weakify(self); [cell setProductClick:^(NSInteger i, ASProductBaseModel *m) { // if (![weak_self checkLogin:true]) { // return; // } // 点击推荐商品 // [weak_self goto_WKM_GoodsDetailsC:m.Id]; }]; return cell; } -(void)goto_WKM_GoodsDetailsC:(NSString *)entity_id { } -(void)pushToProductList:(NSString *)name typeid:(NSString *)typeId { if (typeId == nil || [typeId isEqualToString:@""]) { return; } if (name == nil || [name isEqualToString:@""]) { name = @"Products"; } } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if (section == 0) { return 80; } return 0; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { KWMineHomeOrderHeadView *v = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"KWMineHomeOrderHeadView"]; v.backgroundColor = UIColor.whiteColor; // @weakify(self); [v setToAllBlock:^{ // if (![weak_self checkLogin:true]) { // return; // } // KWM_OrderListC *orderC = [[KWM_OrderListC alloc]init]; // [self.navigationController pushViewController:orderC animated:true]; }]; return v; } // MARK: - subViews - (ASUserCenterTableHeadView *)tableHeadV { if (!_tableHeadV) { ASUserCenterTableHeadView *v = [[ASUserCenterTableHeadView alloc] initWithFrame:CGRectZero]; _tableHeadV = v; } return _tableHeadV; } - (UITableView *)tableV { if (!_tableV) { UITableView *v = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; v.tableHeaderView = self.tableHeadV; [v registerClass:[KWMineHomeOrderListCell class] forCellReuseIdentifier:@"KWMineHomeOrderListCell"]; [v registerClass:[KWMineHomeOrderHeadView class] forHeaderFooterViewReuseIdentifier:@"KWMineHomeOrderHeadView"]; [v registerClass:[KWMineMoreProductsCell class] forCellReuseIdentifier:@"KWMineMoreProductsCell"]; v.delegate = self; v.dataSource = self; [v baseSet]; _tableV = v; } return _tableV; } @end