|
@@ -13,6 +13,10 @@
|
|
|
#import "XSTTBlindBoxDetailsGoodsTableViewController.h"
|
|
|
#import "XSTTBlindBoxPayViewController.h"
|
|
|
#import "XSTTBlindBoxDetailsTipsViewController.h"
|
|
|
+#import "UIViewController+XSTTNetworkManager.h"
|
|
|
+#import "XSTTBusinessManager.h"
|
|
|
+#import "XSTTBlindBoxDetailsModel.h"
|
|
|
+#import <UIImageView+WebCache.h>
|
|
|
|
|
|
@interface XSTTBlindBoxDetailsViewController ()<UIScrollViewDelegate> {
|
|
|
UIImageView *_topView;
|
|
@@ -20,6 +24,7 @@
|
|
|
UIButton *_buyButton;
|
|
|
UIView *_infoView;
|
|
|
XSTTBlindBoxDetailsGoodsTableViewController *_goodsVC;
|
|
|
+ XSTTBlindBoxDetailsModel *_data;
|
|
|
}
|
|
|
|
|
|
@end
|
|
@@ -28,7 +33,8 @@
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
|
- [self setupUI];
|
|
|
+ self.xstt_isHiddenNavigationBar = true;
|
|
|
+ [self getData];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -42,6 +48,18 @@
|
|
|
}
|
|
|
|
|
|
#pragma mark - Network Action
|
|
|
+- (void)getData {
|
|
|
+ [self networkUseMethod:XSTTNetworkMethodGET loadingTips:XSTTGetDataLoadingCommonTips isLogin:xstt_isLogin() signKey:XSTTNetworkSignKeyApp url:xstt_appUrl(XSTTURLGetBlindBoxDetails) urlParameters:nil parameters:^NSDictionary * _Nonnull{
|
|
|
+ return @{@"boxId": self->_xstt_boxId};
|
|
|
+ } success:^NSString * _Nullable(NSError * _Nonnull error, id _Nullable data) {
|
|
|
+ self->_data = [XSTTBlindBoxDetailsModel getModelWithDictionary:data[@"data"]];
|
|
|
+ [self setupUI];
|
|
|
+ return @"";
|
|
|
+ } failure:^NSString * _Nullable(NSError * _Nonnull error, id _Nullable data) {
|
|
|
+ [self.navigationController popViewControllerAnimated:true];
|
|
|
+ return XSTTGetDataFailureCommonTips;
|
|
|
+ }];
|
|
|
+}
|
|
|
|
|
|
#pragma mark - UIScrollViewDelegate
|
|
|
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|
@@ -52,7 +70,6 @@
|
|
|
|
|
|
#pragma mark - UI
|
|
|
- (void)setupUI {
|
|
|
- self.xstt_isHiddenNavigationBar = true;
|
|
|
[self createBgView];
|
|
|
[self createNavigationBar];
|
|
|
[self scrollViewDidScroll:_bgView];
|
|
@@ -65,11 +82,7 @@
|
|
|
|
|
|
- (void)createTipsView {
|
|
|
UIView *des = [self createTipsViewWithTitle:@"订阅说明" tips:
|
|
|
- @[@"订购的盲盒会有数量限制, 且先到先得, 推荐一次订购多期, 优先参与每期订购活动, 每月酒款会根据相关因素调整",
|
|
|
- @"订购的盲盒会有数量限制, 且先到先得, 推荐一次订购多期, 优先参与每期订购活动, 每月酒款会根据相关因素调整",
|
|
|
- @"到截止日期后的3个工作日内, 我们会将盲盒惊喜陆续配送",
|
|
|
- @"可在“首页-我的-我的订购”中查看当前订阅的进度与详情",
|
|
|
- @"鲜啤酒灌装后, 不可回桶, 故“不支持7天无理由退换”, 望请理解"] line:true];
|
|
|
+ _data.xstt_desList line:true];
|
|
|
[_bgView addSubview:des];
|
|
|
[des makeConstraints:^(JXHConstraintMaker *make) {
|
|
|
make.leading.and.trailing.equalTo(0);
|
|
@@ -101,7 +114,7 @@
|
|
|
|
|
|
UILabel *tempView = nil;
|
|
|
for (NSInteger i = 0; i < tips.count; i ++) {
|
|
|
- UILabel *num = [UILabel convenienceWithFont:xstt_semiboldFont(12) text:[NSString stringWithFormat:@"%ld", i] textColor:xstt_FFFFFF_color(1.f)];
|
|
|
+ UILabel *num = [UILabel convenienceWithFont:xstt_semiboldFont(12) text:[NSString stringWithFormat:@"%ld", i + 1] textColor:xstt_FFFFFF_color(1.f)];
|
|
|
num.backgroundColor = xstt_000000_color(0.87);
|
|
|
num.textAlignment = NSTextAlignmentCenter;
|
|
|
[num setLayerCornerRadius:8 clipToBounds:true];
|
|
@@ -145,6 +158,7 @@
|
|
|
|
|
|
- (void)createGoodsVC {
|
|
|
_goodsVC = XSTTBlindBoxDetailsGoodsTableViewController.new;
|
|
|
+ _goodsVC.xstt_dataArray = _data.xstt_beerList;
|
|
|
[self addChildViewController:_goodsVC];
|
|
|
[_bgView addSubview:_goodsVC.tableView];
|
|
|
[_goodsVC.tableView makeConstraints:^(JXHConstraintMaker *make) {
|
|
@@ -164,14 +178,14 @@
|
|
|
make.top.equalTo(self->_topView.bottom);
|
|
|
}];
|
|
|
|
|
|
- UILabel *title = [UILabel convenienceWithFont:xstt_mediumFont(23) text:@"入门精酿·盲盒订制盲盒订制" textColor:xstt_000000_color(0.87)];
|
|
|
+ UILabel *title = [UILabel convenienceWithFont:xstt_mediumFont(23) text:_data.xstt_boxName textColor:xstt_000000_color(0.87)];
|
|
|
[_infoView addSubview:title];
|
|
|
[title makeConstraints:^(JXHConstraintMaker *make) {
|
|
|
make.leading.equalTo(XSTTMargin);
|
|
|
make.top.equalTo(32);
|
|
|
}];
|
|
|
|
|
|
- UILabel *price = [UILabel convenienceWithFont:xstt_AlipayFont(23) text:@"159.00" textColor:xstt_FF5700_color()];
|
|
|
+ UILabel *price = [UILabel convenienceWithFont:xstt_AlipayFont(23) text:[NSString stringWithFormat:@"%.2lf", _data.xstt_price.floatValue] textColor:xstt_FF5700_color()];
|
|
|
[price setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
|
|
|
[_infoView addSubview:price];
|
|
|
[price makeConstraints:^(JXHConstraintMaker *make) {
|
|
@@ -205,7 +219,7 @@
|
|
|
make.top.equalTo(12);
|
|
|
}];
|
|
|
|
|
|
- UILabel *number = [UILabel convenienceWithFont:xstt_AlipayFont(17) text:@"2023040159期" textColor:xstt_000000_color(0.87)];
|
|
|
+ UILabel *number = [UILabel convenienceWithFont:xstt_AlipayFont(17) text:[NSString stringWithFormat:@"%@期", _data.xstt_boxNo] textColor:xstt_000000_color(0.87)];
|
|
|
[contentView addSubview:number];
|
|
|
[number makeConstraints:^(JXHConstraintMaker *make) {
|
|
|
make.leading.equalTo(numberTtitle);
|
|
@@ -222,14 +236,14 @@
|
|
|
make.top.equalTo(numberTtitle);
|
|
|
}];
|
|
|
|
|
|
- UILabel *time = [UILabel convenienceWithFont:xstt_AlipayFont(17) text:@"2023/03/20" textColor:xstt_000000_color(0.87)];
|
|
|
+ UILabel *time = [UILabel convenienceWithFont:xstt_AlipayFont(17) text:_data.xstt_cutOffTime textColor:xstt_000000_color(0.87)];
|
|
|
[contentView addSubview:time];
|
|
|
[time makeConstraints:^(JXHConstraintMaker *make) {
|
|
|
make.leading.equalTo(timeTtitle);
|
|
|
make.bottom.equalTo(number);
|
|
|
}];
|
|
|
|
|
|
- UILabel *desTitle = [UILabel convenienceWithFont:xstt_lightFont(23) text:@"极致低价·月月惊喜" textColor:xstt_000000_color(0.87)];
|
|
|
+ UILabel *desTitle = [UILabel convenienceWithFont:xstt_lightFont(23) text:_data.xstt_title textColor:xstt_000000_color(0.87)];
|
|
|
[_infoView addSubview:desTitle];
|
|
|
[desTitle makeConstraints:^(JXHConstraintMaker *make) {
|
|
|
make.leading.equalTo(XSTTMargin);
|
|
@@ -237,7 +251,7 @@
|
|
|
}];
|
|
|
|
|
|
UILabel *des = [UILabel convenienceWithFont:xstt_font(15) textColor:xstt_000000_color(0.4) limitWidth:jxh_screenWidth() - XSTTMargin * 2];
|
|
|
- [des setAttributedStringWithText:@"纯粹好原料, 每月享受啤酒真滋味, 不同酒厂、不同风格、口味丰富的精酿鲜啤, 酒厂直供快递到家" lineSpacing:4.5];
|
|
|
+ [des setAttributedStringWithText:_data.xstt_details lineSpacing:4.5];
|
|
|
[_infoView addSubview:des];
|
|
|
[des makeConstraints:^(JXHConstraintMaker *make) {
|
|
|
make.leading.equalTo(XSTTMargin);
|
|
@@ -253,8 +267,8 @@
|
|
|
}];
|
|
|
|
|
|
UIButton *securityButton = [UIButton convenienceWithFont:xstt_font(15) target:self action:@selector(securityTips)];
|
|
|
- [securityButton setTitle:@"·不支持7天无理由退货 ·不支持退换贷" titleColor:xstt_000000_color(0.87) image:jxh_getImage(list_arrow) backgroundImage:nil state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
|
|
|
- [securityButton setImageEdgeInsets:UIEdgeInsetsMake(0, 259, 0, -259)];
|
|
|
+ [securityButton setTitle:@"·不支持7天无理由退换" titleColor:xstt_000000_color(0.87) image:jxh_getImage(list_arrow) backgroundImage:nil state:JXHButtonControlStateNormal | JXHButtonControlStateHighlighted];
|
|
|
+ [securityButton setImageEdgeInsets:UIEdgeInsetsMake(0, 151, 0, -151)];
|
|
|
[securityButton setTitleEdgeInsets:UIEdgeInsetsMake(0, -46, 0, 46)];
|
|
|
[_infoView addSubview:securityButton];
|
|
|
[securityButton makeConstraints:^(JXHConstraintMaker *make) {
|
|
@@ -266,7 +280,7 @@
|
|
|
|
|
|
- (void)createTopView {
|
|
|
_topView = UIImageView.new;
|
|
|
- _topView.image = _xstt_image;
|
|
|
+ [_topView sd_setImageWithURL:[NSURL URLWithString:_data.xstt_detailBg]];
|
|
|
[_bgView addSubview:_topView];
|
|
|
[_topView makeConstraints:^(JXHConstraintMaker *make) {
|
|
|
make.top.and.leading.and.trailing.equalTo(0);
|
|
@@ -291,7 +305,7 @@
|
|
|
CGSize size = (CGSize){jxh_screenWidth() - XSTTMargin * 2, 45};
|
|
|
_buyButton = [UIButton convenienceWithTarget:self action:@selector(buyAction)];
|
|
|
[_buyButton setStatusType:XSTTButtonStatusTypePrimary font:xstt_mediumFont(17) size:size];
|
|
|
- [_buyButton setTitle:@"立即订购 ¥159.00" state:JXHButtonControlStateNormal];
|
|
|
+ [_buyButton setTitle:[NSString stringWithFormat:@"立即订购 ¥%.2lf", _data.xstt_price.floatValue] state:JXHButtonControlStateNormal];
|
|
|
[self.view addSubview:_buyButton];
|
|
|
[_buyButton makeConstraints:^(JXHConstraintMaker *make) {
|
|
|
make.leading.equalTo(XSTTMargin);
|