123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- //
- // ASGoodsDetailsTableView.m
- // Asteria
- //
- // Created by xingyu on 2024/5/17.
- //
- #import "ASGoodsDetailsTableView.h"
- #import "ASGoodsBannerCell.h"
- #import "ASGoodsDetailsSizeCell.h"
- #import "ASGoodsCouponCell.h"
- #import "ASGoodsTitlePriceCell.h"
- #import "ASGoodsGuaranteeInfoCell.h"
- #import "ASGoodsReviewHeadCell.h"
- @interface ASGoodsDetailsTableView()
- @property (nonatomic, assign) BOOL couponSelect;
- @end
- @implementation ASGoodsDetailsTableView
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- NSDictionary *dicData = self.infodata[indexPath.row];
-
- NSObject *objectM = [dicData objectForKey:@"data"];
- NSString *typeStr = [dicData objectForKey:@"type"];
-
- if ([typeStr isEqualToString:@"banner"]) {
- ASGoodsBannerCell *cell = [ASGoodsBannerCell cellWithTableView:tableView CellClass:[ASGoodsBannerCell class]];
-
- [cell configData:(GoodsInformationM *)objectM];
-
- return cell;
- } else if ([typeStr isEqualToString:@"titlePrice"]) {
- ASGoodsTitlePriceCell *cell = [ASGoodsTitlePriceCell cellWithTableView:tableView CellClass:[ASGoodsTitlePriceCell class]];
-
- [cell configData:(GoodsInformationM *)objectM];
-
- @weakify(self)
- cell.currencyparameterClose = ^(NSInteger type, id Data) {
- @strongify(self)
- [self generaltriggermethodType:type data:Data];
- };
-
- return cell;
- } else if ([typeStr isEqualToString:@"coupon"]) {
- ASGoodsCouponCell *cell = [ASGoodsCouponCell cellWithTableView:tableView CellClass:[ASGoodsCouponCell class]];
-
- [cell configData:(GoodsInformationM *)objectM isSelect:self.couponSelect];
-
- @weakify(self)
- cell.currencyparameterClose = ^(NSInteger type, id Data) {
- @strongify(self)
- self.couponSelect = type;
- [self reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- };
-
- return cell;
- } else if ([typeStr isEqualToString:@"size"]) {
- ASGoodsDetailsSizeCell *cell = [ASGoodsDetailsSizeCell cellWithTableView:tableView CellClass:[ASGoodsDetailsSizeCell class]];
-
- [cell configData:(GoodsInformationM *)objectM];
-
- @weakify(self)
- cell.currencyparameterClose = ^(NSInteger type, id Data) {
- @strongify(self)
- [self generaltriggermethodType:type data:Data];
- };
-
- return cell;
- } else if ([typeStr isEqualToString:@"guarantee"]) {
- ASGoodsGuaranteeInfoCell *cell = [ASGoodsGuaranteeInfoCell cellWithTableView:tableView CellClass:[ASGoodsGuaranteeInfoCell class]];
-
- [cell configData:(GoodsInformationM *)objectM];
-
- @weakify(self)
- cell.currencyparameterClose = ^(NSInteger type, id Data) {
- @strongify(self)
- [self generaltriggermethodType:type data:Data];
- };
-
- return cell;
- } else if ([typeStr isEqualToString:@"reviewHead"]) {
- ASGoodsReviewHeadCell *cell = [ASGoodsReviewHeadCell cellWithTableView:tableView CellClass:[ASGoodsReviewHeadCell class]];
-
- [cell configData:(GoodsInformationM *)objectM];
-
- @weakify(self)
- cell.currencyparameterClose = ^(NSInteger type, id Data) {
- @strongify(self)
- [self generaltriggermethodType:type data:Data];
- };
-
- return cell;
- }
-
- return nil;
-
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- // NSObject *objectM = self.infodata[indexPath.row];
- // if([objectM isKindOfClass:[CartTotalsItemsM class]] && self.isFlod){
- // return 0;
- // }
- // return 1;
-
- return UITableViewAutomaticDimension;
- }
- - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 200;
- }
- @end
|