ASUserCenterViewController.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. //
  2. // ASUserCenterViewController.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/5/15.
  6. //
  7. #import "ASUserCenterViewController.h"
  8. #import "ASUserCenterTableHeadView.h"
  9. #import "KWMineHomeOrderHeadView.h"
  10. #import "KWMineHomeOrderListCell.h"
  11. #import "KWMineMoreProductsCell.h"
  12. @interface ASUserCenterViewController ()<UITableViewDelegate,UITableViewDataSource>
  13. @property (nonatomic,strong) UITableView *tableV;
  14. @property (nonatomic,strong) ASUserCenterTableHeadView *tableHeadV;
  15. @end
  16. @implementation ASUserCenterViewController
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. __block typeof(self) wSelf = self;
  20. [self ucHomeStyle:^{
  21. // TODO: 跳转搜索模块
  22. }];
  23. [self.view addSubview:self.tableV];
  24. [self.tableV mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.top.equalTo(self.customNavBar.mas_bottom);
  26. make.leading.trailing.equalTo(self.view);
  27. make.bottom.equalTo(self.view);
  28. }];
  29. [self.tableHeadV.signV configDayArr:4 currentDay:7 status:false];
  30. }
  31. #pragma mark - UITableViewDelegate,UITableViewDataSource
  32. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  33. }
  34. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  35. return 2;
  36. }
  37. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  38. if (section == 0) {
  39. return 3; //self.orderVm.orderList.count;
  40. }
  41. if (section == 1) {
  42. return 1;
  43. }
  44. return 0;
  45. }
  46. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  47. if (indexPath.section == 0) {
  48. KWMineHomeOrderListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"KWMineHomeOrderListCell" forIndexPath:indexPath];
  49. // if (self.orderVm.orderList.count <= indexPath.row) {
  50. // return cell;
  51. // }
  52. // KWMineHomeOrderModel *m = self.orderVm.orderList[indexPath.row];
  53. // [cell setData:m];
  54. // @weakify(self);
  55. [cell setViewOrderCall:^{
  56. // if (![weak_self checkLogin:true]) {
  57. // return;
  58. // }
  59. // 查看订单
  60. NSLog(@"查看订单 view order");
  61. // KWM_OrderViewC *vc = [[KWM_OrderViewC alloc]init];
  62. // vc.order_id = m.orderId;
  63. // [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES];
  64. }];
  65. return cell;
  66. }
  67. KWMineMoreProductsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"KWMineMoreProductsCell" forIndexPath:indexPath];
  68. cell.topSpace = 20;
  69. KWMineMoreProductModel * model = [KWMineMoreProductModel demoData];
  70. [cell setData: model];
  71. @weakify(self);
  72. [cell setProductClick:^(NSInteger i, ASProductBaseModel *m) {
  73. // if (![weak_self checkLogin:true]) {
  74. // return;
  75. // }
  76. // 点击推荐商品
  77. // [weak_self goto_WKM_GoodsDetailsC:m.Id];
  78. }];
  79. return cell;
  80. }
  81. -(void)goto_WKM_GoodsDetailsC:(NSString *)entity_id {
  82. }
  83. -(void)pushToProductList:(NSString *)name typeid:(NSString *)typeId {
  84. if (typeId == nil || [typeId isEqualToString:@""]) {
  85. return;
  86. }
  87. if (name == nil || [name isEqualToString:@""]) {
  88. name = @"Products";
  89. }
  90. }
  91. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  92. if (section == 0) {
  93. return 80;
  94. }
  95. return 0;
  96. }
  97. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  98. KWMineHomeOrderHeadView *v = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"KWMineHomeOrderHeadView"];
  99. v.backgroundColor = UIColor.whiteColor;
  100. // @weakify(self);
  101. [v setToAllBlock:^{
  102. // if (![weak_self checkLogin:true]) {
  103. // return;
  104. // }
  105. // KWM_OrderListC *orderC = [[KWM_OrderListC alloc]init];
  106. // [self.navigationController pushViewController:orderC animated:true];
  107. }];
  108. return v;
  109. }
  110. // MARK: - subViews
  111. - (ASUserCenterTableHeadView *)tableHeadV {
  112. if (!_tableHeadV) {
  113. ASUserCenterTableHeadView *v = [[ASUserCenterTableHeadView alloc] initWithFrame:CGRectZero];
  114. _tableHeadV = v;
  115. }
  116. return _tableHeadV;
  117. }
  118. - (UITableView *)tableV {
  119. if (!_tableV) {
  120. UITableView *v = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  121. v.tableHeaderView = self.tableHeadV;
  122. [v registerClass:[KWMineHomeOrderListCell class] forCellReuseIdentifier:@"KWMineHomeOrderListCell"];
  123. [v registerClass:[KWMineHomeOrderHeadView class] forHeaderFooterViewReuseIdentifier:@"KWMineHomeOrderHeadView"];
  124. [v registerClass:[KWMineMoreProductsCell class] forCellReuseIdentifier:@"KWMineMoreProductsCell"];
  125. v.delegate = self;
  126. v.dataSource = self;
  127. [v baseSet];
  128. _tableV = v;
  129. }
  130. return _tableV;
  131. }
  132. @end