Procházet zdrojové kódy

修改盲盒订单页面和地址页面

hjx před 1 rokem
rodič
revize
a2d5238c2d

+ 3 - 0
TOKTOK/TOKTOK/Home/BlindBox/DetailsView/XSTTBlindBoxDetailsModel.h

@@ -6,6 +6,7 @@
 //
 
 #import "XSTTBaseNetworkModel.h"
+#import "XSTTEnumerationProfile.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -28,6 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) NSString *xstt_priceId;
 @property (nonatomic, strong) NSString *xstt_productCunt;
 @property (nonatomic, strong) NSString *xstt_unitType;
+@property (nonatomic, strong) NSString *xstta_cycle;
 
 @end
 
@@ -37,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) NSString *xstt_boxName;
 @property (nonatomic, strong) NSString *xstt_boxNo;
 @property (nonatomic, strong) NSString *xstt_detailBg;
+@property (nonatomic, strong) NSString *xstt_bgColor;
 @property (nonatomic, strong) NSString *xstt_details;
 @property (nonatomic, strong) NSString *xstt_price;
 @property (nonatomic, strong) NSString *xstt_title;

+ 10 - 0
TOKTOK/TOKTOK/Home/BlindBox/DetailsView/XSTTBlindBoxDetailsModel.m

@@ -38,4 +38,14 @@
 
 @implementation XSTTBlindBoxDetailsPriceModel
 
+- (bool)handleAdditionalProperty {
+    _xstta_cycle = @"";
+    if (_xstt_unitType.integerValue == XSTTGoodsUnitTypeDay) {
+        _xstta_cycle = [NSString stringWithFormat:@"%@天", _xstt_productCunt];
+    } else if (_xstt_unitType.integerValue == XSTTGoodsUnitTypeMonth) {
+        _xstta_cycle = [NSString stringWithFormat:@"%@个月", _xstt_productCunt];
+    }
+    return true;
+}
+
 @end

+ 6 - 1
TOKTOK/TOKTOK/Home/BlindBox/DetailsView/XSTTBlindBoxDetailsViewController.m

@@ -40,7 +40,12 @@
 
 #pragma mark - Action
 - (void)buyAction {
-    [self.navigationController pushViewController:XSTTBlindBoxPayViewController.new animated:true];
+    xstt_needLogin(^{
+        XSTTBlindBoxPayViewController *vc = XSTTBlindBoxPayViewController.new;
+        vc.xstt_data = self->_data;
+        [self.navigationController pushViewController:vc animated:true];
+    });
+    
 }
 
 - (void)securityTips {

+ 3 - 0
TOKTOK/TOKTOK/Home/BlindBox/Pay/XSTTBlindBoxPayViewController.h

@@ -6,11 +6,14 @@
 //
 
 #import <UIKit/UIKit.h>
+@class XSTTBlindBoxDetailsModel;
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface XSTTBlindBoxPayViewController : UIViewController
 
+@property (nonatomic, strong) XSTTBlindBoxDetailsModel *xstt_data;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 192 - 115
TOKTOK/TOKTOK/Home/BlindBox/Pay/XSTTBlindBoxPayViewController.m

@@ -9,6 +9,14 @@
 #import "XSTTUIGeneralHeader.h"
 #import "UIViewController+XSTTInitialization.h"
 #import "UIViewController+XSTTNavigationBar.h"
+#import "XSTTBlindBoxDetailsModel.h"
+#import "XSTTPickerViewController.h"
+#import "XSTTAddressListViewController.h"
+#import "XSTTAddressModel.h"
+#import "UIView+XSTTLoadingTipsView.h"
+#import "UIViewController+XSTTNetworkManager.h"
+#import "XSTTEnumerationProfile.h"
+#import "XSTTBusinessManager.h"
 
 #define xstt_blindBoxPayChooseButtonTag 3000
 #define xstt_blindBoxPayChooseIconTag 4000
@@ -19,13 +27,19 @@
     UIButton *_payButton;
     UIView *_headerView;
     UIView *_imformationView;
-    UIView *_addressView;
+    UIButton *_addressView;
     UIView *_paymentMethodView;
     UILabel *_number;
     UIButton *_downButton;
     UIButton *_upButton;
-    UILabel *_address;
+    UILabel *_addressDetails;
+    UILabel *_addressContact;
     NSInteger _choosePay;
+    NSArray *_cycleArray;
+    XSTTBlindBoxDetailsPriceModel *_priceModel;
+    UILabel *_price;
+    UILabel *_cycle;
+    XSTTAddressModel *_addressModel;
 }
 
 @end
@@ -40,32 +54,53 @@
 
 - (void)initData {
     _choosePay = -1;
+    if (_xstt_data.xstt_priceList.count <= 0) {
+        [self.navigationController popViewControllerAnimated:true];
+        return;
+    }
+    NSMutableArray *data = NSMutableArray.new;
+    for (XSTTBlindBoxDetailsPriceModel *model in _xstt_data.xstt_priceList) {
+        [data addObject:model.xstta_cycle];
+    }
+    _cycleArray = data;
+    _priceModel = _xstt_data.xstt_priceList[0];
 }
 
 #pragma mark - Action
 - (void)payAction:(UIButton *)sender {
-    
+    if (!_addressModel) {
+        [self.view showToastWithTitle:@"请填写收货地址"];
+        return;
+    }
+    [self createOrder];
 }
 
 - (void)chooseAddress:(UIButton *)sender {
-    
+    XSTTAddressListViewController *vc = XSTTAddressListViewController.new;
+    vc.xstt_type = XSTTAddressListViewTypeChoose;
+    @weakify(self)
+    vc.xstt_choseAddress = ^(XSTTAddressModel * _Nonnull data) {
+        @strongify(self)
+        [self refreshAddress:data];
+    };
+    [self.navigationController pushViewController:vc animated:true];
 }
 
-- (void)countDown:(UIButton *)sender {
-    NSInteger num = _number.text.integerValue;
-    num -= 1;
-    _number.text = [NSString stringWithFormat:@"%ld", num];
-    _upButton.enabled = true;
-    if (num == 1) _downButton.enabled = false;
-}
-
-- (void)countUp:(UIButton *)sender {
-    NSInteger num = _number.text.integerValue;
-    num += 1;
-    _number.text = [NSString stringWithFormat:@"%ld", num];
-    _downButton.enabled = true;
-    if (num == 3) _upButton.enabled = false;
-}
+//- (void)countDown:(UIButton *)sender {
+//    NSInteger num = _number.text.integerValue;
+//    num -= 1;
+//    _number.text = [NSString stringWithFormat:@"%ld", num];
+//    _upButton.enabled = true;
+//    if (num == 1) _downButton.enabled = false;
+//}
+//
+//- (void)countUp:(UIButton *)sender {
+//    NSInteger num = _number.text.integerValue;
+//    num += 1;
+//    _number.text = [NSString stringWithFormat:@"%ld", num];
+//    _downButton.enabled = true;
+//    if (num == 3) _upButton.enabled = false;
+//}
 
 - (void)choose:(UIButton *)sender {
     NSInteger i = sender.tag - xstt_blindBoxPayChooseButtonTag;
@@ -80,7 +115,35 @@
     
 }
 
+- (void)chooseCycle {
+    XSTTPickerViewController *vc = XSTTPickerViewController.new;
+    vc.xstt_dataArray = @[_cycleArray];
+    @weakify(self)
+    vc.xstt_finishChose = ^(XSTTPickerView * _Nonnull pickerView) {
+        @strongify(self)
+        [self completeToChoseCycleWithPickerView:pickerView];
+    };
+    [self presentViewController:vc animated:false completion:nil];
+}
+
+- (void)completeToChoseCycleWithPickerView:(XSTTPickerView *)pickerView {
+    _priceModel = _xstt_data.xstt_priceList[pickerView.xstt_choseArray[0].integerValue];
+    [self setPrice];
+}
+
 #pragma mark - Network Action
+- (void)createOrder {
+    @weakify(self)
+    [self networkUseMethod:XSTTNetworkMethodPOST loadingTips:@"正在创建订单" isLogin:true signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(XSTTURLCreateOrder) urlParameters:nil parameters:^NSDictionary * _Nonnull{
+        @strongify(self)
+        return @{@"userAddressId": self->_addressModel.xstt_userAddressId, @"outId": self->_priceModel.xstt_priceId, @"num": @"1", @"type": @(XSTTOrderTypeBlindBox), @"deviceNo": xstt_deviceUUID()};
+    } success:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        return @"";
+    } failure:^NSString * _Nullable(NSError * _Nonnull error, id  _Nullable data) {
+        return @"创建订单失败";
+    }];
+}
+
 #pragma mark - UIScrollViewDelegate
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
     CGFloat contentOffset = scrollView.contentOffset.y;
@@ -104,9 +167,22 @@
     [self createBottomView];
     [self createBgView];
     [self createHeaderView];
-    [self createImformationView];
     [self createAddressView];
+    [self createImformationView];
     [self createPaymentMethodView];
+    [self setPrice];
+}
+
+- (void)refreshAddress:(XSTTAddressModel *)data {
+    _addressModel = data;
+    _addressDetails.text = data.xstt_detailAddress;
+    _addressContact.text = [NSString stringWithFormat:@"%@ %@", data.xstt_name, data.xstt_phone];
+}
+
+- (void)setPrice {
+    [_payButton setTitle:[NSString stringWithFormat:@"立即支付 ¥%.2lf", _priceModel.xstt_price.floatValue] state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
+    _price.text = [NSString stringWithFormat:@"¥%.2lf", _priceModel.xstt_price.floatValue];
+    _cycle.text = _priceModel.xstta_cycle;
 }
 
 - (void)createImformationView {
@@ -114,17 +190,25 @@
     [_bgView addSubview:_imformationView];
     [_imformationView makeConstraints:^(JXHConstraintMaker *make) {
         make.leading.and.trailing.equalTo(0);
-        make.top.equalTo(self->_headerView.bottom);
-        make.height.equalTo(180);
+        make.top.equalTo(self->_addressView.bottom);
+        make.height.equalTo(56 * 2 + 12 * 2);
     }];
     
-    NSArray *titles = @[@"盲盒价格", @"订购周期", @"订购数量"];
-    for (NSInteger i = 0; i < 3; i ++) {
+    UIView *inteval = UIView.new;
+    inteval.backgroundColor = xstt_F7F7F7_color();
+    [_imformationView addSubview:inteval];
+    [inteval makeConstraints:^(JXHConstraintMaker *make) {
+        make.leading.and.trailing.and.top.equalTo(0);
+        make.height.equalTo(12);
+    }];
+    
+    NSArray *titles = @[@"盲盒价格", @"订购周期"];
+    for (NSInteger i = 0; i < 2; i ++) {
         UIView *view = UIView.new;
         [_imformationView addSubview:view];
         [view makeConstraints:^(JXHConstraintMaker *make) {
             make.leading.and.trailing.equalTo(0);
-            make.top.equalTo(i * 56);
+            make.top.equalTo(i * 56 + 12);
             make.height.equalTo(56);
         }];
         
@@ -137,73 +221,81 @@
         
         switch (i) {
             case 0: {
-                UILabel *price = [UILabel convenienceWithFont:xstt_AlipayFont(17) text:@"¥159.00" textColor:xstt_FF5700_color()];
-                [view addSubview:price];
-                [price makeConstraints:^(JXHConstraintMaker *make) {
+                _price = [UILabel convenienceWithFont:xstt_AlipayFont(17) text:@"" textColor:xstt_FF5700_color()];
+                [view addSubview:_price];
+                [_price makeConstraints:^(JXHConstraintMaker *make) {
                     make.trailing.equalTo(-XSTTMargin);
                     make.centerY.equalTo(1);
                 }];
             }
                 break;
             case 1: {
-                UILabel *cycle = [UILabel convenienceWithFont:xstt_font(17) text:@"2个月" textColor:xstt_000000_color(0.87)];
-                [view addSubview:cycle];
-                [cycle makeConstraints:^(JXHConstraintMaker *make) {
-                    make.trailing.equalTo(-XSTTMargin);
+                _cycle = [UILabel convenienceWithFont:xstt_font(17) text:@"" textColor:xstt_000000_color(0.87)];
+                [view addSubview:_cycle];
+                [_cycle makeConstraints:^(JXHConstraintMaker *make) {
+                    make.trailing.equalTo(-32);
+                    make.centerY.equalTo(0);
+                }];
+                
+                UIImageView *arrow = [[UIImageView alloc] initWithImage:jxh_getImage(list_arrow)];
+                [view addSubview:arrow];
+                [arrow makeConstraints:^(JXHConstraintMaker *make) {
+                    make.trailing.equalTo(-8);
                     make.centerY.equalTo(0);
                 }];
+                [view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(chooseCycle)]];
             }
                 break;
             case 2: {
-                UIView *numberView = UIView.new;
-                [numberView setLayerBorderWidth:1.2 borderColor:xstt_000000_color(0.08)];
-                [numberView setLayerCornerRadius:12 clipToBounds:false];
-                [view addSubview:numberView];
-                [numberView makeConstraints:^(JXHConstraintMaker *make) {
-                    make.trailing.equalTo(-XSTTMargin);
-                    make.centerY.equalTo(0);
-                    make.size.equalTo((CGSize){88, 24});
-                }];
-                
-                UIView *leftLine = [numberView createLineWithLocation:JXHLineLocationLeft locationOffset:24 headOffset:0 footOffset:0];
-                leftLine.backgroundColor = xstt_000000_color(0.08);
-                [leftLine makeConstraints:^(JXHConstraintMaker *make) {
-                    make.width.update(1.2);
-                }];
-                UIView *rightLine = [numberView createLineWithLocation:JXHLineLocationRight locationOffset:24 headOffset:0 footOffset:0];
-                rightLine.backgroundColor = xstt_000000_color(0.08);
-                [rightLine makeConstraints:^(JXHConstraintMaker *make) {
-                    make.width.update(1.2);
-                }];
-                
-                _downButton = [UIButton convenienceWithTarget:self action:@selector(countDown:)];
-                [_downButton setImage:jxh_getImage(blind_box_pay_count_down_b) state:JXHButtonControlStateNormal];
-                [_downButton setImage:jxh_getImage(blind_box_pay_count_down_g) state:JXHButtonControlStateDisabled];
-                [_downButton setImageEdgeInsets:(UIEdgeInsets){0, 1, 0, -1}];
-                _downButton.enabled = false;
-                [numberView addSubview:_downButton];
-                [_downButton makeConstraints:^(JXHConstraintMaker *make) {
-                    make.leading.and.top.equalTo(0);
-                    make.size.equalTo(24);
-                }];
-                
-                _upButton = [UIButton convenienceWithTarget:self action:@selector(countUp:)];
-                [_upButton setImage:jxh_getImage(blind_box_pay_count_up_b) state:JXHButtonControlStateNormal];
-                [_upButton setImage:jxh_getImage(blind_box_pay_count_up_g) state:JXHButtonControlStateDisabled];
-                [_upButton setImageEdgeInsets:(UIEdgeInsets){0, -1, 0, 1}];
-                [numberView addSubview:_upButton];
-                [_upButton makeConstraints:^(JXHConstraintMaker *make) {
-                    make.trailing.and.top.equalTo(0);
-                    make.size.equalTo(24);
-                }];
-                
-                _number = [UILabel convenienceWithFont:xstt_AlipayFont(15) text:@"1" textColor:xstt_000000_color(0.87) textAlignment:NSTextAlignmentCenter];
-                [numberView addSubview:_number];
-                [_number makeConstraints:^(JXHConstraintMaker *make) {
-                    make.centerY.equalTo(1);
-                    make.leading.equalTo(leftLine.trailing);
-                    make.trailing.equalTo(rightLine.leading);
-                }];
+//                UIView *numberView = UIView.new;
+//                [numberView setLayerBorderWidth:1.2 borderColor:xstt_000000_color(0.08)];
+//                [numberView setLayerCornerRadius:12 clipToBounds:false];
+//                [view addSubview:numberView];
+//                [numberView makeConstraints:^(JXHConstraintMaker *make) {
+//                    make.trailing.equalTo(-XSTTMargin);
+//                    make.centerY.equalTo(0);
+//                    make.size.equalTo((CGSize){88, 24});
+//                }];
+//
+//                UIView *leftLine = [numberView createLineWithLocation:JXHLineLocationLeft locationOffset:24 headOffset:0 footOffset:0];
+//                leftLine.backgroundColor = xstt_000000_color(0.08);
+//                [leftLine makeConstraints:^(JXHConstraintMaker *make) {
+//                    make.width.update(1.2);
+//                }];
+//                UIView *rightLine = [numberView createLineWithLocation:JXHLineLocationRight locationOffset:24 headOffset:0 footOffset:0];
+//                rightLine.backgroundColor = xstt_000000_color(0.08);
+//                [rightLine makeConstraints:^(JXHConstraintMaker *make) {
+//                    make.width.update(1.2);
+//                }];
+//
+//                _downButton = [UIButton convenienceWithTarget:self action:@selector(countDown:)];
+//                [_downButton setImage:jxh_getImage(blind_box_pay_count_down_b) state:JXHButtonControlStateNormal];
+//                [_downButton setImage:jxh_getImage(blind_box_pay_count_down_g) state:JXHButtonControlStateDisabled];
+//                [_downButton setImageEdgeInsets:(UIEdgeInsets){0, 1, 0, -1}];
+//                _downButton.enabled = false;
+//                [numberView addSubview:_downButton];
+//                [_downButton makeConstraints:^(JXHConstraintMaker *make) {
+//                    make.leading.and.top.equalTo(0);
+//                    make.size.equalTo(24);
+//                }];
+//
+//                _upButton = [UIButton convenienceWithTarget:self action:@selector(countUp:)];
+//                [_upButton setImage:jxh_getImage(blind_box_pay_count_up_b) state:JXHButtonControlStateNormal];
+//                [_upButton setImage:jxh_getImage(blind_box_pay_count_up_g) state:JXHButtonControlStateDisabled];
+//                [_upButton setImageEdgeInsets:(UIEdgeInsets){0, -1, 0, 1}];
+//                [numberView addSubview:_upButton];
+//                [_upButton makeConstraints:^(JXHConstraintMaker *make) {
+//                    make.trailing.and.top.equalTo(0);
+//                    make.size.equalTo(24);
+//                }];
+//
+//                _number = [UILabel convenienceWithFont:xstt_AlipayFont(15) text:@"1" textColor:xstt_000000_color(0.87) textAlignment:NSTextAlignmentCenter];
+//                [numberView addSubview:_number];
+//                [_number makeConstraints:^(JXHConstraintMaker *make) {
+//                    make.centerY.equalTo(1);
+//                    make.leading.equalTo(leftLine.trailing);
+//                    make.trailing.equalTo(rightLine.leading);
+//                }];
                 
             }
                 break;
@@ -213,7 +305,7 @@
         }
     }
     
-    UIView *inteval = UIView.new;
+    inteval = UIView.new;
     inteval.backgroundColor = xstt_F7F7F7_color();
     [_imformationView addSubview:inteval];
     [inteval makeConstraints:^(JXHConstraintMaker *make) {
@@ -223,49 +315,36 @@
 }
 
 - (void)createAddressView {
-    _addressView = UIView.new;
+    _addressView = [UIButton convenienceWithTarget:self action:@selector(chooseAddress:)];
     [_bgView addSubview:_addressView];
     [_addressView makeConstraints:^(JXHConstraintMaker *make) {
         make.leading.and.trailing.equalTo(0);
-        make.top.equalTo(self->_imformationView.bottom);
-        make.height.equalTo(68);
+        make.top.equalTo(self->_headerView.bottom);
+        make.height.equalTo(80);
     }];
     
-    UIButton *addressButton = [UIButton convenienceWithTarget:self action:@selector(chooseAddress:)];
-    [_addressView addSubview:addressButton];
-    [addressButton makeConstraints:^(JXHConstraintMaker *make) {
-        make.leading.and.trailing.and.top.equalTo(0);
-        make.height.equalTo(56);
-    }];
     
-    UILabel *title = [UILabel convenienceWithFont:xstt_font(17) text:@"收货信息" textColor:xstt_000000_color(0.87)];
-    [addressButton addSubview:title];
-    [title makeConstraints:^(JXHConstraintMaker *make) {
+    _addressDetails = [UILabel convenienceWithFont:xstt_mediumFont(17) text:@"请先填写收货地址" textColor:xstt_000000_color(0.87)];
+    [_addressView addSubview:_addressDetails];
+    [_addressDetails makeConstraints:^(JXHConstraintMaker *make) {
         make.leading.equalTo(XSTTMargin);
-        make.centerY.equalTo(0);
+        make.top.equalTo(16);
+        make.trailing.lessThanOrEqualTo(-50);
     }];
     
     UIImageView *arrow = [[UIImageView alloc] initWithImage:jxh_getImage(list_arrow)];
-    [addressButton addSubview:arrow];
+    [_addressView addSubview:arrow];
     [arrow makeConstraints:^(JXHConstraintMaker *make) {
         make.trailing.equalTo(-8);
-        make.centerY.equalTo(0);
-    }];
-    
-    _address = [UILabel convenienceWithFont:xstt_font(17) text:@"暂无" textColor:xstt_000000_color(0.4)];
-    [addressButton addSubview:_address];
-    [_address makeConstraints:^(JXHConstraintMaker *make) {
-        make.trailing.equalTo(arrow.leading).offset(-1);
-        make.leading.greaterThanOrEqualTo(title.trailing).offset(XSTTMargin);
-        make.centerY.equalTo(0);
+        make.top.equalTo(16);
     }];
     
-    UIView *inteval = UIView.new;
-    inteval.backgroundColor = xstt_F7F7F7_color();
-    [_addressView addSubview:inteval];
-    [inteval makeConstraints:^(JXHConstraintMaker *make) {
-        make.leading.and.trailing.and.bottom.equalTo(0);
-        make.height.equalTo(12);
+    _addressContact = [UILabel convenienceWithFont:xstt_font(13) text:@"你还未添加相关信息" textColor:xstt_000000_color(0.4)];
+    [_addressView addSubview:_addressContact];
+    [_addressContact makeConstraints:^(JXHConstraintMaker *make) {
+        make.trailing.lessThanOrEqualTo(-50);
+        make.leading.equalTo(XSTTMargin);
+        make.bottom.equalTo(-16);
     }];
 }
 
@@ -274,7 +353,7 @@
     [_bgView addSubview:_paymentMethodView];
     [_paymentMethodView makeConstraints:^(JXHConstraintMaker *make) {
         make.leading.and.trailing.equalTo(0);
-        make.top.equalTo(self->_addressView.bottom);
+        make.top.equalTo(self->_imformationView.bottom);
         make.bottom.equalTo(0);
     }];
     
@@ -353,7 +432,7 @@
 
 - (void)createHeaderView {
     _headerView = UIView.new;
-    _headerView.backgroundColor = self.xstt_navigationBar.backgroundColor = xstt_E1F962_color();
+    _headerView.backgroundColor = self.xstt_navigationBar.backgroundColor = [UIColor colorWithHexString:_xstt_data.xstt_bgColor];
     [_bgView addSubview:_headerView];
     [_headerView makeConstraints:^(JXHConstraintMaker *make) {
         make.leading.and.trailing.and.top.equalTo(0);
@@ -440,8 +519,6 @@
         make.height.equalTo(45);
         make.centerY.equalTo(0);
     }];
-    
-    [_payButton setTitle:@"立即支付 ¥299.00" state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
 }
 
 @end

+ 3 - 0
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewController.h

@@ -6,11 +6,14 @@
 //
 
 #import "XSTTTableViewController.h"
+@class XSTTAddressModel;
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface XSTTAddressListTableViewController : XSTTTableViewController
 
+@property (nonatomic, strong, nullable) void (^xstt_choseAddress)(XSTTAddressModel *data);
+
 - (void)getList;
 
 @end

+ 4 - 0
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListTableViewController.m

@@ -118,6 +118,10 @@ static NSString * const reuseIdentifier = @"XSTTAddressListTableViewCell";
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     [tableView deselectRowAtIndexPath:indexPath animated:false];
+    if (_xstt_choseAddress) {
+        _xstt_choseAddress(_dataArray[indexPath.row]);
+        [self.navigationController popViewControllerAnimated:true];
+    }
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {

+ 9 - 0
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListViewController.h

@@ -6,11 +6,20 @@
 //
 
 #import <UIKit/UIKit.h>
+@class XSTTAddressModel;
 
 NS_ASSUME_NONNULL_BEGIN
 
+typedef NS_ENUM(NSUInteger, XSTTAddressListViewType) {
+    XSTTAddressListViewTypeShow,
+    XSTTAddressListViewTypeChoose
+};
+
 @interface XSTTAddressListViewController : UIViewController
 
+@property (nonatomic, assign) XSTTAddressListViewType xstt_type;
+@property (nonatomic, strong, nullable) void (^xstt_choseAddress)(XSTTAddressModel *data);
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 3 - 0
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressListViewController.m

@@ -45,6 +45,9 @@
 
 - (void)createTableVC {
     _tableVC = XSTTAddressListTableViewController.new;
+    if (_xstt_type == XSTTAddressListViewTypeChoose) {
+        _tableVC.xstt_choseAddress = _xstt_choseAddress;
+    }
     [self addChildViewController:_tableVC];
     [self.view addSubview:_tableVC.tableView];
     [_tableVC.tableView makeConstraints:^(JXHConstraintMaker *make) {

+ 1 - 0
TOKTOK/TOKTOK/Mine/Address/AddressList/XSTTAddressModel.m

@@ -18,6 +18,7 @@
 }
 
 - (bool)handleAdditionalProperty {
+    [super handleAdditionalProperty];
     if (_xstt_phone.length == 11) {
         _xstta_showPhone = [NSString stringWithFormat:@"%@ %@ %@", [_xstt_phone substringWithRange:NSMakeRange(0, 3)], [_xstt_phone substringWithRange:NSMakeRange(3, 4)], [_xstt_phone substringWithRange:NSMakeRange(7, 4)]];
     } else {

+ 3 - 1
TOKTOK/TOKTOK/Mine/MineView/XSTTMineTableViewController.m

@@ -164,7 +164,9 @@ static NSString * const reuseIdentifier = @"XSTTMineTableViewCell";
             break;
         case XSTTMineTableViewItemTypeAddress: {
             xstt_needLogin(^{
-                [self.navigationController pushViewController:XSTTAddressListViewController.new animated:true];
+                XSTTAddressListViewController *vc = XSTTAddressListViewController.new;
+                vc.xstt_type = XSTTAddressListViewTypeShow;
+                [self.navigationController pushViewController:vc animated:true];
             });
         }
             break;

+ 19 - 9
TOKTOK/TOKTOK/Public/Profile/XSTTEnumerationProfile.h

@@ -29,13 +29,6 @@ typedef NS_ENUM(NSUInteger, XSTTTabBarType) {
     XSTTTabBarTypeMine,
 };
 
-#pragma mark - User
-typedef NS_ENUM(NSUInteger, XSTTGenderType) {
-    XSTTGenderTypeFemale = 1,
-    XSTTGenderTypeMale,
-    XSTTGenderTypeUnknown
-};
-
 #pragma mark - Message
 typedef NS_ENUM(NSUInteger, XSTTUserMessageType) {
     XSTTUserMessageTypeLike = 2,
@@ -54,7 +47,13 @@ typedef NS_ENUM(NSUInteger, XSTTLoggingStatus) {
     XSTTLoggingStatusCancel = 2
 };
 
-#pragma mark - socialCircle
+typedef NS_ENUM(NSUInteger, XSTTGenderType) {
+    XSTTGenderTypeFemale = 1,
+    XSTTGenderTypeMale,
+    XSTTGenderTypeUnknown
+};
+
+#pragma mark - SocialCircle
 typedef NS_ENUM(NSUInteger, XSTTSocialCircleType) {
     XSTTSocialCircleTypeImage = 1,
     XSTTSocialCircleTypeVideo,
@@ -66,8 +65,19 @@ typedef NS_ENUM(NSUInteger, XSTTLikeType) {
     XSTTLikeTypeComment,
 };
 
+#pragma mark - Goods
+typedef NS_ENUM(NSUInteger, XSTTGoodsUnitType) {
+    XSTTGoodsUnitTypeDay = 0,
+    XSTTGoodsUnitTypeMonth,
+    XSTTGoodsUnitTypeLitre = 3
+};
+
+#pragma mark - Order
+typedef NS_ENUM(NSUInteger, XSTTOrderType) {
+    XSTTOrderTypeBlindBox = 1
+};
 
-#pragma mark - report
+#pragma mark - Report
 typedef NS_ENUM(NSUInteger, XSTTReportType) {
     XSTTReportTypeIllegal,//违法违规
     XSTTReportTypePorn,//色情低俗

+ 3 - 0
TOKTOK/TOKTOK/Public/Profile/XSTTURLApiProfile.h

@@ -75,6 +75,9 @@ CONST_STRING_INTERFACE XSTTURLGetStoreList;//门店列表
 CONST_STRING_INTERFACE XSTTURLGetBlindBoxList;//盲盒列表
 CONST_STRING_INTERFACE XSTTURLGetBlindBoxDetails;//盲盒详情
 
+#pragma mark - 订单相关
+CONST_STRING_INTERFACE XSTTURLCreateOrder;//创建订单
+
 #pragma mark - 地址相关
 CONST_STRING_INTERFACE XSTTURLCreateNewAddress;//新增地址
 CONST_STRING_INTERFACE XSTTURLGetAddressDetails;//地址详情

+ 3 - 0
TOKTOK/TOKTOK/Public/Profile/XSTTURLApiProfile.m

@@ -111,6 +111,9 @@ CONST_STRING XSTTURLGetStoreList = @"/stores/list";//门店列表
 CONST_STRING XSTTURLGetBlindBoxList = @"/box/list";//盲盒列表
 CONST_STRING XSTTURLGetBlindBoxDetails = @"/box/detail";//盲盒详情
 
+#pragma mark - 订单相关
+CONST_STRING XSTTURLCreateOrder = @"/order/create";//创建订单
+
 #pragma mark - 地址相关
 CONST_STRING XSTTURLCreateNewAddress = @"/user/address/create";//新增地址
 CONST_STRING XSTTURLGetAddressDetails = @"/user/address/detail";//地址详情