Procházet zdrojové kódy

订购页面添加展示修改地址逻辑

jiaxian_he před 10 měsíci
rodič
revize
298aa2e9b7

+ 1 - 0
TOKTOK/TOKTOK/Mine/Order/OrderDetails/XSTTOrderDetailsModel.h

@@ -35,6 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) NSString *xstt_month;
 @property (nonatomic, strong) NSString *xstt_cutOffTime;
 @property (nonatomic, strong) NSArray<XSTTOrderDetailsNodeModel *> *xstt_nodeList;
+@property (nonatomic, strong) NSString *xstt_updateAddressFlag;
 
 @end
 

+ 1 - 1
TOKTOK/TOKTOK/Mine/Order/OrderDetails/XSTTOrderDetailsTableViewCell.h

@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) void (^xstt_buttonAction)(XSTTOrderDetailsTableViewCell *cell);
 
-- (void)reloadData:(XSTTOrderDetailsNodeModel *)data isFirst:(bool)isFirst isLast:(bool)isLast;
+- (void)reloadData:(XSTTOrderDetailsNodeModel *)data isFirst:(bool)isFirst isLast:(bool)isLast showChangeAddress:(bool)showChangeAddress;
 
 @end
 

+ 10 - 5
TOKTOK/TOKTOK/Mine/Order/OrderDetails/XSTTOrderDetailsTableViewCell.m

@@ -104,7 +104,7 @@
     }
 }
 
-- (void)reloadData:(XSTTOrderDetailsNodeModel *)data isFirst:(bool)isFirst isLast:(bool)isLast {
+- (void)reloadData:(XSTTOrderDetailsNodeModel *)data isFirst:(bool)isFirst isLast:(bool)isLast showChangeAddress:(bool)showChangeAddress {
     _title.text = data.xstt_nodeName;
     
     if (isFirst) {
@@ -138,10 +138,15 @@
             _button.hidden = true;
             break;
         case XSTTOrderDetailsNodeActionTypeAddress:
-            _button.hidden = false;
-            [_button setTitle:@"更改收货地址" state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
-            [_button setStatusType:XSTTButtonStatusTypeLineBorder font:xstt_font(11) size:(CGSize){24, 28} corner:-1 calculateLabel:_button.titleLabel];
-            [_button setTitleColor:xstt_000000_color(0.6) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
+            if (showChangeAddress) {
+                _button.hidden = false;
+                [_button setTitle:@"更改收货地址" state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
+                [_button setStatusType:XSTTButtonStatusTypeLineBorder font:xstt_font(11) size:(CGSize){24, 28} corner:-1 calculateLabel:_button.titleLabel];
+                [_button setTitleColor:xstt_000000_color(0.6) state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
+            } else {
+                _button.hidden = true;
+            }
+            
             break;
         case XSTTOrderDetailsNodeActionTypeExpressNumber:
             _button.hidden = false;

+ 1 - 1
TOKTOK/TOKTOK/Mine/Order/OrderDetails/XSTTOrderDetailsTableViewController.h

@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) void (^xstt_chooseNewAddress)(XSTTAddressModel *data);
 
-- (void)reloadData:(NSArray<XSTTOrderDetailsNodeModel *> *)data;
+- (void)reloadData:(NSArray<XSTTOrderDetailsNodeModel *> *)data canChangeAddress:(bool)canChangeAddress;
 
 @end
 

+ 4 - 2
TOKTOK/TOKTOK/Mine/Order/OrderDetails/XSTTOrderDetailsTableViewController.m

@@ -16,6 +16,7 @@
 
 @interface XSTTOrderDetailsTableViewController () {
     NSArray<XSTTOrderDetailsNodeModel *> *_data;
+    bool _canChangeAddress;
 }
 
 @end
@@ -77,8 +78,9 @@
     }];
 }
 
-- (void)reloadData:(NSArray<XSTTOrderDetailsNodeModel *> *)data {
+- (void)reloadData:(NSArray<XSTTOrderDetailsNodeModel *> *)data canChangeAddress:(bool)canChangeAddress {
     _data = data;
+    _canChangeAddress = canChangeAddress;
     [self.tableView reloadData];
 }
 
@@ -119,7 +121,7 @@ static NSString * const reuseIdentifier = @"XSTTOrderDetailsTableViewCell";
             [self buttonAction:cell];
         };
     }
-    [cell reloadData:_data[indexPath.row] isFirst:indexPath.row == 0 isLast:indexPath.row == _data.count - 1];
+    [cell reloadData:_data[indexPath.row] isFirst:indexPath.row == 0 isLast:indexPath.row == _data.count - 1 showChangeAddress:_canChangeAddress];
     return cell;
 }
 

+ 1 - 1
TOKTOK/TOKTOK/Mine/Order/OrderDetails/XSTTOrderDetailsViewController.m

@@ -87,7 +87,7 @@
 - (void)getDataSuccess:(id)data {
     _data = [XSTTOrderDetailsModel getModelWithDictionary:data[@"data"]];
     [self reloadUI];
-    [_tableVC reloadData:_data.xstt_nodeList];
+    [_tableVC reloadData:_data.xstt_nodeList canChangeAddress:!_data.xstt_updateAddressFlag.boolValue];
 }
 
 - (void)getDataFailure:(NSError *)error {