Commit 67915edf7807b54333651b0d4091fb31f5d00d02
1 parent
0a5f7c4e
no message
Showing
36 changed files
with
2808 additions
and
80 deletions
CNLiveMyOrder.podspec
| @@ -31,6 +31,7 @@ TODO: Add long description of the pod here. | @@ -31,6 +31,7 @@ TODO: Add long description of the pod here. | ||
| 31 | s.subspec 'View' do |view| | 31 | s.subspec 'View' do |view| |
| 32 | view.dependency 'CNLiveTripartiteManagement/QMUIKit' | 32 | view.dependency 'CNLiveTripartiteManagement/QMUIKit' |
| 33 | view.dependency 'CNLiveMyOrder/Model' | 33 | view.dependency 'CNLiveMyOrder/Model' |
| 34 | + view.dependency 'CNLiveMyOrder/Common' | ||
| 34 | view.dependency 'CNLiveBaseKit' | 35 | view.dependency 'CNLiveBaseKit' |
| 35 | view.dependency 'CNLiveTripartiteManagement/Masonry' | 36 | view.dependency 'CNLiveTripartiteManagement/Masonry' |
| 36 | view.dependency 'CNLiveCommonCategory' | 37 | view.dependency 'CNLiveCommonCategory' |
| @@ -43,14 +44,26 @@ TODO: Add long description of the pod here. | @@ -43,14 +44,26 @@ TODO: Add long description of the pod here. | ||
| 43 | view.dependency 'CNLiveTripartiteManagement/MJExtension' | 44 | view.dependency 'CNLiveTripartiteManagement/MJExtension' |
| 44 | view.dependency 'CNLiveEnvironmentConfiguration' | 45 | view.dependency 'CNLiveEnvironmentConfiguration' |
| 45 | view.dependency 'CNLiveUserManagement' | 46 | view.dependency 'CNLiveUserManagement' |
| 47 | + view.dependency 'CNLiveIMBaseSDK' | ||
| 46 | view.source_files = 'CNLiveMyOrder/Classes/View/*.{h,m}' | 48 | view.source_files = 'CNLiveMyOrder/Classes/View/*.{h,m}' |
| 47 | end | 49 | end |
| 48 | s.subspec 'Controller' do |controller| | 50 | s.subspec 'Controller' do |controller| |
| 49 | #controller.dependency 'CNLiveMyOrder/Model' | 51 | #controller.dependency 'CNLiveMyOrder/Model' |
| 50 | controller.dependency 'CNLiveCommonClass' | 52 | controller.dependency 'CNLiveCommonClass' |
| 51 | controller.dependency 'CNLiveMyOrder/View' | 53 | controller.dependency 'CNLiveMyOrder/View' |
| 54 | + controller.dependency 'CNLiveMyOrder/Common' | ||
| 55 | + controller.dependency 'CNLiveTripartiteManagement/QMUIKit' | ||
| 56 | + controller.dependency 'CNLiveRequestBastKit' | ||
| 57 | + controller.dependency 'CNLiveBaseKit' | ||
| 58 | + controller.dependency 'CNLiveEnvironmentConfiguration' | ||
| 59 | + controller.dependency 'CNLiveUserManagement' | ||
| 60 | + controller.dependency 'CNLiveTripartiteManagement/YYKit' | ||
| 61 | + controller.dependency 'CNLiveIMBaseSDK' | ||
| 52 | controller.source_files = 'CNLiveMyOrder/Classes/Controller/*.{h,m}' | 62 | controller.source_files = 'CNLiveMyOrder/Classes/Controller/*.{h,m}' |
| 53 | end | 63 | end |
| 64 | + s.subspec 'Common' do |common| | ||
| 65 | + common.source_files = 'CNLiveMyOrder/Classes/Common/*.{h,m}' | ||
| 66 | + end | ||
| 54 | s.source_files = 'CNLiveMyOrder/Classes/**/*' | 67 | s.source_files = 'CNLiveMyOrder/Classes/**/*' |
| 55 | 68 | ||
| 56 | s.resource_bundles = { | 69 | s.resource_bundles = { |
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wufukuan.png
0 → 100644
3.35 KB
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wufukuan@2x.png
0 → 100644
6.08 KB
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wufukuan@3x.png
0 → 100644
9 KB
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wupingjia.png
0 → 100644
2.73 KB
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wupingjia@2x.png
0 → 100644
4.7 KB
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wupingjia@3x.png
0 → 100644
6.78 KB
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wushouhuo.png
0 → 100644
2.52 KB
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wushouhuo@2x.png
0 → 100644
4.57 KB
CNLiveMyOrder/Assets/CNLiveMyOrder.bundle/dd_wushouhuo@3x.png
0 → 100644
6.71 KB
CNLiveMyOrder/Classes/Common/CNLiveGetImage.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveGetImage.h | ||
| 3 | +// CNLiveMyOrder | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/6/18. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import <Foundation/Foundation.h> | ||
| 9 | + | ||
| 10 | +NS_ASSUME_NONNULL_BEGIN | ||
| 11 | + | ||
| 12 | +@interface CNLiveGetImage : NSObject | ||
| 13 | ++ (UIImage *)cnliveGetImageWithName:(NSString *)name bundle:(NSString *)bundleName targetClass:(Class)targetClass; | ||
| 14 | +@end | ||
| 15 | + | ||
| 16 | +NS_ASSUME_NONNULL_END |
CNLiveMyOrder/Classes/Common/CNLiveGetImage.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveGetImage.m | ||
| 3 | +// CNLiveMyOrder | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/6/18. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveGetImage.h" | ||
| 9 | + | ||
| 10 | +@implementation CNLiveGetImage | ||
| 11 | ++ (UIImage *)cnliveGetImageWithName:(NSString *)name bundle:(NSString *)bundleName targetClass:(Class)targetClass { | ||
| 12 | + NSInteger scale = [[UIScreen mainScreen]scale]; | ||
| 13 | + NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | ||
| 14 | + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | ||
| 15 | + if (!url) { | ||
| 16 | + return [UIImage new]; | ||
| 17 | + } | ||
| 18 | + NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | ||
| 19 | + if (!targetBundle) { | ||
| 20 | + return [UIImage new]; | ||
| 21 | + } | ||
| 22 | + NSString *imageName = [NSString stringWithFormat:@"%@@%zdx.png",name,scale]; | ||
| 23 | + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | ||
| 24 | + if (image) { | ||
| 25 | + return image; | ||
| 26 | + }else { | ||
| 27 | + if ([UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]) { | ||
| 28 | + return [UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | ||
| 29 | + }else { | ||
| 30 | + return [UIImage new]; | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | +} | ||
| 34 | +@end |
CNLiveMyOrder/Classes/Controller/CNLiveMineOrderController.m
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | #import "CNLiveBaseKit.h" | 10 | #import "CNLiveBaseKit.h" |
| 11 | #import "UIColor+CNLiveExtension.h" | 11 | #import "UIColor+CNLiveExtension.h" |
| 12 | #import "CNLiveOrderListCommonView.h" | 12 | #import "CNLiveOrderListCommonView.h" |
| 13 | +#import "CNLiveOrderDetailController.h" | ||
| 13 | #define Segment_Height 50 | 14 | #define Segment_Height 50 |
| 14 | #define kViewCommonGrayColor [UIColor colorWithRed:0.97 green:0.97 blue:0.97 alpha:1.00] | 15 | #define kViewCommonGrayColor [UIColor colorWithRed:0.97 green:0.97 blue:0.97 alpha:1.00] |
| 15 | @interface CNLiveMineOrderController ()<UIScrollViewDelegate> | 16 | @interface CNLiveMineOrderController ()<UIScrollViewDelegate> |
| @@ -28,7 +29,9 @@ | @@ -28,7 +29,9 @@ | ||
| 28 | @end | 29 | @end |
| 29 | 30 | ||
| 30 | @implementation CNLiveMineOrderController | 31 | @implementation CNLiveMineOrderController |
| 31 | - | 32 | +- (void)dealloc { |
| 33 | + NSLog(@"订单页面走了dealloc了吗"); | ||
| 34 | +} | ||
| 32 | - (instancetype)initWithType:(NSInteger)type { | 35 | - (instancetype)initWithType:(NSInteger)type { |
| 33 | if (self = [super init]) { | 36 | if (self = [super init]) { |
| 34 | _curSeleIndex = type; | 37 | _curSeleIndex = type; |
| @@ -56,6 +59,7 @@ | @@ -56,6 +59,7 @@ | ||
| 56 | [self.scrollView addSubview:self.payTblView]; | 59 | [self.scrollView addSubview:self.payTblView]; |
| 57 | [self.scrollView addSubview:self.goodsTblView]; | 60 | [self.scrollView addSubview:self.goodsTblView]; |
| 58 | [self.scrollView addSubview:self.evaluateTblView]; | 61 | [self.scrollView addSubview:self.evaluateTblView]; |
| 62 | + [self cellDidSelected]; | ||
| 59 | } | 63 | } |
| 60 | /** 添加标题栏 */ | 64 | /** 添加标题栏 */ |
| 61 | - (void)addTitleLables { | 65 | - (void)addTitleLables { |
| @@ -125,6 +129,7 @@ | @@ -125,6 +129,7 @@ | ||
| 125 | // | 129 | // |
| 126 | // } | 130 | // } |
| 127 | } | 131 | } |
| 132 | + | ||
| 128 | #pragma mark - Data | 133 | #pragma mark - Data |
| 129 | //刷新数据 | 134 | //刷新数据 |
| 130 | - (void)refreshData { | 135 | - (void)refreshData { |
| @@ -154,6 +159,14 @@ | @@ -154,6 +159,14 @@ | ||
| 154 | break; | 159 | break; |
| 155 | } | 160 | } |
| 156 | } | 161 | } |
| 162 | +- (void)cellDidSelected { | ||
| 163 | + __weak typeof(self) weakSelf = self; | ||
| 164 | + CNLiveOrderDetailController *vc = [[CNLiveOrderDetailController alloc]init]; | ||
| 165 | + self.allTblView.orderDetaielCellDidSelectedBlock = ^(NSIndexPath * _Nonnull indexPath, NSString * _Nonnull orderId) { | ||
| 166 | + vc.orderId = orderId; | ||
| 167 | + [weakSelf.navigationController pushViewController:vc animated:NO]; | ||
| 168 | + }; | ||
| 169 | +} | ||
| 157 | #pragma mark - Lazy | 170 | #pragma mark - Lazy |
| 158 | - (CNLiveSegmentView *)segmentView{ | 171 | - (CNLiveSegmentView *)segmentView{ |
| 159 | __weak typeof(self) weakSelf = self; | 172 | __weak typeof(self) weakSelf = self; |
| @@ -161,8 +174,7 @@ | @@ -161,8 +174,7 @@ | ||
| 161 | _segmentView = [[CNLiveSegmentView alloc] initWithFrame:CGRectMake(0, kNavigationBarHeight, KScreenWidth, Segment_Height) titles:@[@"全部",@"待付款", @"待收货", @"待评价"] curIndex:_curSeleIndex selectedBlock:^(NSInteger index) { | 174 | _segmentView = [[CNLiveSegmentView alloc] initWithFrame:CGRectMake(0, kNavigationBarHeight, KScreenWidth, Segment_Height) titles:@[@"全部",@"待付款", @"待收货", @"待评价"] curIndex:_curSeleIndex selectedBlock:^(NSInteger index) { |
| 162 | CGFloat x = index * self.view.width; | 175 | CGFloat x = index * self.view.width; |
| 163 | weakSelf.curSeleIndex = index; | 176 | weakSelf.curSeleIndex = index; |
| 164 | - [_scrollView setContentOffset:CGPointMake(x, 0) animated:NO]; | ||
| 165 | - | 177 | + [weakSelf.scrollView setContentOffset:CGPointMake(x, 0) animated:NO]; |
| 166 | [self refreshData]; | 178 | [self refreshData]; |
| 167 | }]; | 179 | }]; |
| 168 | } | 180 | } |
| @@ -189,7 +201,7 @@ | @@ -189,7 +201,7 @@ | ||
| 189 | } | 201 | } |
| 190 | - (CNLiveOrderListCommonView *)allTblView{ | 202 | - (CNLiveOrderListCommonView *)allTblView{ |
| 191 | if (!_allTblView) { | 203 | if (!_allTblView) { |
| 192 | - _allTblView = [[CNLiveOrderListCommonView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, _scrollView.height) orderStatus:@"0"]; | 204 | + _allTblView = [[CNLiveOrderListCommonView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, _scrollView.height) orderStatus:@"0"] ; |
| 193 | } | 205 | } |
| 194 | return _allTblView; | 206 | return _allTblView; |
| 195 | } | 207 | } |
CNLiveMyOrder/Classes/Controller/CNLiveOrderDetailController.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveOrderDetailController.h | ||
| 3 | +// CNLiveMyOrder | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/6/17. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNCommonViewController.h" | ||
| 9 | + | ||
| 10 | +NS_ASSUME_NONNULL_BEGIN | ||
| 11 | + | ||
| 12 | +@interface CNLiveOrderDetailController : CNCommonViewController | ||
| 13 | +@property (nonatomic, strong) NSString *orderId; //订单ID | ||
| 14 | +@property (nonatomic, assign) BOOL fromChat; //是否从聊天页面跳转至订单详情页,yes:是 点击联系达人后pop至chat页面,否则push | ||
| 15 | +@property (nonatomic, strong) NSString *itemId; //确认收货和删除订单时使用,只有从订单管家页面跳转至订单详情页面时传itemId | ||
| 16 | +@end | ||
| 17 | + | ||
| 18 | +NS_ASSUME_NONNULL_END |
CNLiveMyOrder/Classes/Controller/CNLiveOrderDetailController.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveOrderDetailController.m | ||
| 3 | +// CNLiveMyOrder | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/6/17. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveOrderDetailController.h" | ||
| 9 | +#import "CNLiveMineOrderView.h" | ||
| 10 | +#import "CNCutDown.h" | ||
| 11 | +#import "CNLiveOrderDetailContentView.h" | ||
| 12 | +#import "QMUIKit.h" | ||
| 13 | +#import "CNLiveBaseKit.h" | ||
| 14 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | ||
| 15 | +#import "CNUserInfoManager.h" | ||
| 16 | +#import "CNLiveEnvironmentConfiguration.h" | ||
| 17 | +#import "YYKit.h" | ||
| 18 | +#import "MJExtension.h" | ||
| 19 | +#import "CNLiveOrderList.h" | ||
| 20 | +#import "Masonry.h" | ||
| 21 | +#import "CNAddPopFuncView.h" | ||
| 22 | +//#import <FBRetainCycleDetector/FBRetainCycleDetector.h> | ||
| 23 | +#define Default_H 45 | ||
| 24 | +#define OrderIdKey @"OrderIdKey" //订单号 | ||
| 25 | +@interface CNLiveOrderDetailController ()<CNLiveRefundVoucherViewDelegate,CNAddPopFuncViewDelegate> | ||
| 26 | +@property (nonatomic, strong) UIScrollView *scrollView; | ||
| 27 | +@property (strong, nonatomic) UIPageControl * pageControl; | ||
| 28 | +@property (nonatomic, strong) CNAddPopFuncView *popFunItemView; //点击navbar右上角弹出的view | ||
| 29 | +@property (nonatomic, strong) CNLiveOrderDetailStatusView *statusView; //订单状态 | ||
| 30 | +@property (nonatomic, strong) CNLiveRefundFailView *failView; //退款失败 | ||
| 31 | +@property (nonatomic, strong) CNLiveAddressView *addressView; //地址 | ||
| 32 | +@property (nonatomic, strong) CNLiveRefundProcessView *progressView; //退款进度 | ||
| 33 | +@property (nonatomic, strong) CNLiveContactDarenView *contactDarenView; //联系卖家 | ||
| 34 | +@property (nonatomic, strong) CNLiveIconView *iconView; //头像 | ||
| 35 | +@property (nonatomic, strong) CNLiveOrderDetailContentView *kindView; //订单详情 | ||
| 36 | +@property (nonatomic, strong) CNLiveServiceTypeView *serviceView; //服务内容 | ||
| 37 | +@property (nonatomic, strong) CNLiveOrderNormalView *feeView; //服务费 | ||
| 38 | +@property (nonatomic, strong) CNLiveOrderNormalView *freightView; //运费 | ||
| 39 | +@property (nonatomic, strong) CNLiveOrderNormalView *deliveryView; //配送方式 | ||
| 40 | +@property (nonatomic, strong) CNLiveActuallyPaidView *totalView; //总价 | ||
| 41 | +@property (nonatomic, strong) CNLiveOrderNormalView *refunEnableView;; //是否允许退款 | ||
| 42 | +@property (nonatomic, strong) CNLiveRefundReasonAndNoteView *noteView; //退款原因 | ||
| 43 | +@property (nonatomic, strong) CNLiveRefundVoucherView *voucherView; //凭证 | ||
| 44 | +@property (nonatomic, strong) CNLiveFuncView *funcView; //底部工具栏 | ||
| 45 | +@property (nonatomic, strong) CNLiveOrderNormalView *goodsInfoView; //商品信息 | ||
| 46 | +@property (nonatomic, strong) CNLiveOrderTimeView *timeView;//订单时间 | ||
| 47 | +@property (nonatomic, strong) UIView *line1; | ||
| 48 | +@property (nonatomic, strong) UIView *line2; | ||
| 49 | +@property (nonatomic, strong) UIView *line3; | ||
| 50 | +@property (nonatomic, strong) UIView *line4; | ||
| 51 | +@property (nonatomic, strong) UIView *line5; | ||
| 52 | +@property (nonatomic, strong) UIView *line6; | ||
| 53 | +@property (nonatomic, strong) UIView *line7; | ||
| 54 | +@property (nonatomic, strong) CNLiveOrderList *list; | ||
| 55 | +@property (nonatomic, assign) BOOL showFuncView; | ||
| 56 | +@property (nonatomic, assign) BOOL showRejectedView; | ||
| 57 | +@property (nonatomic, assign) BOOL showReason; //是否显示退款原因view | ||
| 58 | +@property (nonatomic, assign) BOOL refund; //是否为退款状态 | ||
| 59 | +@property (nonatomic, assign) BOOL showVoucher; //是否显示凭证view | ||
| 60 | +//@property (nonatomic, strong) CNCutDown *cutdownTimer; | ||
| 61 | +@property (nonatomic, assign) BOOL isShowPicOrVideo; //隐藏状态栏 | ||
| 62 | +@property (nonatomic, strong) NSDictionary *qrParameterDic; // 保存生成的二维码数据 | ||
| 63 | +@property (nonatomic, strong) UIButton *moreBtn;//右上角按钮 | ||
| 64 | +@end | ||
| 65 | + | ||
| 66 | +@implementation CNLiveOrderDetailController | ||
| 67 | +- (void)dealloc | ||
| 68 | +{ | ||
| 69 | + NSLog(@"走了详情页的dealloc了吗"); | ||
| 70 | +// [[NSNotificationCenter defaultCenter] removeObserver:self]; | ||
| 71 | +} | ||
| 72 | +- (void)initSubviews { | ||
| 73 | + [super initSubviews]; | ||
| 74 | + | ||
| 75 | + [self.view addSubview:self.scrollView]; | ||
| 76 | + | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +- (void)viewWillDisappear:(BOOL)animated { | ||
| 80 | + [super viewWillDisappear:animated]; | ||
| 81 | + [QMUITips hideAllToastInView:self.view animated:YES]; | ||
| 82 | +// [_cutdownTimer destroyTimer]; //销毁计时器 | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +- (void)viewWillAppear:(BOOL)animated { | ||
| 86 | + [super viewWillAppear:animated]; | ||
| 87 | + self.navigationController.navigationBarHidden = NO; | ||
| 88 | +} | ||
| 89 | +- (void)viewDidLoad { | ||
| 90 | + [super viewDidLoad]; | ||
| 91 | + self.title = @"订单详情"; | ||
| 92 | + [self initNavBar]; | ||
| 93 | + self.view.backgroundColor = kWeChatBgColor; | ||
| 94 | + _showReason = NO; | ||
| 95 | + _showRejectedView = NO ; | ||
| 96 | + _showFuncView = YES; | ||
| 97 | + _refund = NO; | ||
| 98 | + _showVoucher = NO; | ||
| 99 | + [self loadData]; | ||
| 100 | +// FBRetainCycleDetector *detector = [FBRetainCycleDetector new]; | ||
| 101 | +// [detector addCandidate:self]; | ||
| 102 | +// NSSet *retainCycles = [detector findRetainCycles]; | ||
| 103 | +// NSLog(@"%@", retainCycles); | ||
| 104 | + | ||
| 105 | +} | ||
| 106 | +- (void)initNavBar | ||
| 107 | +{ | ||
| 108 | + _moreBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 109 | + _moreBtn.frame = CGRectMake(0, 0, 30, 30); | ||
| 110 | + [_moreBtn setImage:[UIImage imageNamed:@"dd_gengduo2"] forState:UIControlStateNormal]; | ||
| 111 | + [_moreBtn addTarget:self action:@selector(rightNavItemAction:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 112 | + _moreBtn.hidden = YES; | ||
| 113 | + UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:_moreBtn]; | ||
| 114 | + self.navigationItem.rightBarButtonItem = item; | ||
| 115 | +} | ||
| 116 | +- (void)addSubviews { | ||
| 117 | + | ||
| 118 | + [self.scrollView addSubview:self.statusView]; | ||
| 119 | + [self.scrollView addSubview:self.failView]; | ||
| 120 | + [self.scrollView addSubview:self.addressView]; | ||
| 121 | + [self.scrollView addSubview:self.progressView]; | ||
| 122 | + [self.scrollView addSubview:self.contactDarenView]; | ||
| 123 | + [self.scrollView addSubview:self.goodsInfoView]; | ||
| 124 | + [self.scrollView addSubview:self.iconView]; | ||
| 125 | + [self.scrollView addSubview:self.kindView]; | ||
| 126 | + [self.scrollView addSubview:self.serviceView]; | ||
| 127 | + [self.scrollView addSubview:self.feeView]; | ||
| 128 | + [self.scrollView addSubview:self.freightView]; | ||
| 129 | + [self.scrollView addSubview:self.deliveryView]; | ||
| 130 | + [self.scrollView addSubview:self.totalView]; | ||
| 131 | + [self.scrollView addSubview:self.timeView]; | ||
| 132 | + | ||
| 133 | + [self.scrollView addSubview:self.refunEnableView]; | ||
| 134 | + [self.scrollView addSubview:self.noteView]; | ||
| 135 | + [self.scrollView addSubview:self.voucherView]; | ||
| 136 | + [self.scrollView addSubview:self.funcView]; | ||
| 137 | + | ||
| 138 | + [self.scrollView addSubview:self.line1]; | ||
| 139 | + [self.scrollView addSubview:self.line2]; | ||
| 140 | + [self.scrollView addSubview:self.line3]; | ||
| 141 | + [self.scrollView addSubview:self.line4]; | ||
| 142 | + [self.scrollView addSubview:self.line5]; | ||
| 143 | + [self.scrollView addSubview:self.line6]; | ||
| 144 | + [self.scrollView addSubview:self.line7]; | ||
| 145 | + [self p_addMasonry]; | ||
| 146 | +} | ||
| 147 | +#pragma mark - Masonry | ||
| 148 | +- (void)p_addMasonry { | ||
| 149 | + | ||
| 150 | + [self.statusView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 151 | + make.left.top.mas_equalTo(self.scrollView); | ||
| 152 | + make.width.mas_equalTo(kScreenWidth); | ||
| 153 | + make.height.mas_equalTo(0); | ||
| 154 | + }]; | ||
| 155 | + | ||
| 156 | + [self.addressView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 157 | + make.width.mas_equalTo(kScreenWidth); | ||
| 158 | + }]; | ||
| 159 | + | ||
| 160 | + [self.progressView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 161 | + make.width.mas_equalTo(kScreenWidth); | ||
| 162 | + }]; | ||
| 163 | + | ||
| 164 | + [self.failView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 165 | + make.width.mas_equalTo(kScreenWidth); | ||
| 166 | + }]; | ||
| 167 | + | ||
| 168 | + if (_showRejectedView) { | ||
| 169 | + [self.failView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 170 | + make.left.mas_equalTo(0); | ||
| 171 | + make.top.mas_equalTo(self.statusView.mas_bottom).mas_offset(10); | ||
| 172 | + make.width.mas_equalTo(kScreenWidth); | ||
| 173 | + }]; | ||
| 174 | + } else { | ||
| 175 | + self.failView.hidden = YES; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + if (_refund) { | ||
| 179 | + | ||
| 180 | + self.addressView.hidden = YES; | ||
| 181 | + self.progressView.hidden = NO; | ||
| 182 | + | ||
| 183 | + if (_showRejectedView) { | ||
| 184 | + | ||
| 185 | + [self.progressView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 186 | + make.left.mas_equalTo(0); | ||
| 187 | + make.top.mas_equalTo(self.failView.mas_bottom).mas_offset(10); | ||
| 188 | + make.width.mas_equalTo(kScreenWidth); | ||
| 189 | + make.height.mas_equalTo(170); | ||
| 190 | + }]; | ||
| 191 | + | ||
| 192 | + } else { | ||
| 193 | + | ||
| 194 | + [self.progressView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 195 | + make.left.mas_equalTo(0); | ||
| 196 | + make.top.mas_equalTo(self.statusView.mas_bottom).mas_offset(10); | ||
| 197 | + make.width.mas_equalTo(kScreenWidth); | ||
| 198 | + make.height.mas_equalTo(170); | ||
| 199 | + }]; | ||
| 200 | + | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + [self.contactDarenView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 204 | + make.left.mas_equalTo(0); | ||
| 205 | + make.top.mas_equalTo(self.progressView.mas_bottom).mas_offset(10); | ||
| 206 | + make.width.mas_equalTo(kScreenWidth); | ||
| 207 | + make.height.mas_equalTo(55); | ||
| 208 | + }]; | ||
| 209 | + | ||
| 210 | + } else { | ||
| 211 | + | ||
| 212 | + self.addressView.hidden = NO; | ||
| 213 | + self.progressView.hidden = YES; | ||
| 214 | + | ||
| 215 | + [self.addressView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 216 | + make.left.mas_equalTo(0); | ||
| 217 | + make.top.mas_equalTo(self.statusView.mas_bottom); | ||
| 218 | + make.width.mas_equalTo(kScreenWidth); | ||
| 219 | + }]; | ||
| 220 | + | ||
| 221 | + [self.contactDarenView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 222 | + make.left.mas_equalTo(0); | ||
| 223 | + make.top.mas_equalTo(self.addressView.mas_bottom).mas_offset(10); | ||
| 224 | + make.width.mas_equalTo(kScreenWidth); | ||
| 225 | + make.height.mas_equalTo(55); | ||
| 226 | + }]; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + [self.goodsInfoView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 230 | + make.width.mas_equalTo(kScreenWidth); | ||
| 231 | + }]; | ||
| 232 | + | ||
| 233 | + [self.iconView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 234 | + make.width.mas_equalTo(kScreenWidth); | ||
| 235 | + }]; | ||
| 236 | + | ||
| 237 | + if (_refund) { | ||
| 238 | + | ||
| 239 | + self.iconView.hidden = YES; | ||
| 240 | + _goodsInfoView.hidden = NO; | ||
| 241 | + | ||
| 242 | + [self.goodsInfoView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 243 | + make.left.mas_equalTo(0); | ||
| 244 | + make.top.mas_equalTo(self.contactDarenView.mas_bottom).mas_offset(10); | ||
| 245 | + make.width.mas_equalTo(kScreenWidth); | ||
| 246 | + make.height.mas_equalTo(55); | ||
| 247 | + }]; | ||
| 248 | + | ||
| 249 | + [self.line1 mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 250 | + make.left.mas_equalTo(0); | ||
| 251 | + make.width.mas_equalTo(KScreenWidth); | ||
| 252 | + make.bottom.mas_equalTo(self.goodsInfoView.mas_bottom); | ||
| 253 | + make.height.mas_equalTo(0.5); | ||
| 254 | + }]; | ||
| 255 | + | ||
| 256 | + [self.kindView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 257 | + make.left.mas_equalTo(0); | ||
| 258 | + make.top.mas_equalTo(self.goodsInfoView.mas_bottom); | ||
| 259 | + make.width.mas_equalTo(kScreenWidth); | ||
| 260 | + // make.height.mas_equalTo(95); | ||
| 261 | + }]; | ||
| 262 | + | ||
| 263 | + } else { | ||
| 264 | + | ||
| 265 | + self.iconView.hidden = NO; | ||
| 266 | + _goodsInfoView.hidden = YES; | ||
| 267 | + | ||
| 268 | + [self.iconView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 269 | + make.left.mas_equalTo(0); | ||
| 270 | + make.top.mas_equalTo(self.contactDarenView.mas_bottom).mas_offset(10); | ||
| 271 | + make.width.mas_equalTo(kScreenWidth); | ||
| 272 | + make.height.mas_equalTo(70); | ||
| 273 | + }]; | ||
| 274 | + | ||
| 275 | + [self.line1 mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 276 | + make.left.mas_equalTo(10); | ||
| 277 | + make.width.mas_equalTo(KScreenWidth-20); | ||
| 278 | + make.bottom.mas_equalTo(self.iconView.mas_bottom); | ||
| 279 | + make.height.mas_equalTo(0.5); | ||
| 280 | + }]; | ||
| 281 | + | ||
| 282 | + [self.kindView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 283 | + make.left.mas_equalTo(0); | ||
| 284 | + make.top.mas_equalTo(self.iconView.mas_bottom); | ||
| 285 | + make.width.mas_equalTo(kScreenWidth); | ||
| 286 | + // make.height.mas_equalTo(95); | ||
| 287 | + }]; | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + [self.line2 mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 291 | + make.left.mas_equalTo(10); | ||
| 292 | + make.width.mas_equalTo(KScreenWidth-20); | ||
| 293 | + make.bottom.mas_equalTo(self.kindView.mas_bottom); | ||
| 294 | + make.height.mas_equalTo(0.5); | ||
| 295 | + }]; | ||
| 296 | + | ||
| 297 | + [self.serviceView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 298 | + make.left.mas_equalTo(0); | ||
| 299 | + make.top.mas_equalTo(self.kindView.mas_bottom); | ||
| 300 | + make.width.mas_equalTo(kScreenWidth); | ||
| 301 | + make.height.mas_equalTo(Default_H); | ||
| 302 | + }]; | ||
| 303 | + | ||
| 304 | + [self.line3 mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 305 | + make.left.mas_equalTo(10); | ||
| 306 | + make.width.mas_equalTo(KScreenWidth-20); | ||
| 307 | + make.bottom.mas_equalTo(self.serviceView.mas_bottom); | ||
| 308 | + make.height.mas_equalTo(0.5); | ||
| 309 | + }]; | ||
| 310 | + | ||
| 311 | + [self.feeView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 312 | + make.left.mas_equalTo(0); | ||
| 313 | + make.top.mas_equalTo(self.serviceView.mas_bottom); | ||
| 314 | + make.width.mas_equalTo(kScreenWidth); | ||
| 315 | + make.height.mas_equalTo(Default_H); | ||
| 316 | + }]; | ||
| 317 | + | ||
| 318 | + [self.line4 mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 319 | + make.left.mas_equalTo(10); | ||
| 320 | + make.width.mas_equalTo(KScreenWidth-20); | ||
| 321 | + make.bottom.mas_equalTo(self.feeView.mas_bottom); | ||
| 322 | + make.height.mas_equalTo(0.5); | ||
| 323 | + }]; | ||
| 324 | + | ||
| 325 | + [self.freightView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 326 | + make.left.mas_equalTo(0); | ||
| 327 | + make.top.mas_equalTo(self.feeView.mas_bottom); | ||
| 328 | + make.width.mas_equalTo(kScreenWidth); | ||
| 329 | + make.height.mas_equalTo(Default_H); | ||
| 330 | + }]; | ||
| 331 | + | ||
| 332 | + [self.line5 mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 333 | + make.left.mas_equalTo(10); | ||
| 334 | + make.width.mas_equalTo(KScreenWidth-20); | ||
| 335 | + make.bottom.mas_equalTo(self.freightView.mas_bottom); | ||
| 336 | + make.height.mas_equalTo(0.5); | ||
| 337 | + }]; | ||
| 338 | + | ||
| 339 | + [self.deliveryView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 340 | + make.left.mas_equalTo(0); | ||
| 341 | + make.top.mas_equalTo(self.line5.mas_bottom); | ||
| 342 | + make.width.mas_equalTo(kScreenWidth); | ||
| 343 | + make.height.mas_equalTo(Default_H); | ||
| 344 | + }]; | ||
| 345 | + | ||
| 346 | + [self.refunEnableView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 347 | + make.left.mas_equalTo(0); | ||
| 348 | + make.top.mas_equalTo(self.deliveryView.mas_bottom).mas_offset(10); | ||
| 349 | + make.width.mas_equalTo(kScreenWidth); | ||
| 350 | + make.height.mas_equalTo(Default_H); | ||
| 351 | + }]; | ||
| 352 | + | ||
| 353 | + [self.totalView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 354 | + make.left.mas_equalTo(0); | ||
| 355 | + make.top.mas_equalTo(self.refunEnableView.mas_bottom).mas_offset(10); | ||
| 356 | + make.width.mas_equalTo(kScreenWidth); | ||
| 357 | + }]; | ||
| 358 | + | ||
| 359 | + [self.timeView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 360 | + make.left.mas_equalTo(0); | ||
| 361 | + make.top.mas_equalTo(self.totalView.mas_bottom).mas_offset(10); | ||
| 362 | + make.width.mas_equalTo(kScreenWidth); | ||
| 363 | + }]; | ||
| 364 | + | ||
| 365 | + // if (_showFuncView) { | ||
| 366 | + // [self.line7 mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 367 | + // make.left.mas_equalTo(10); | ||
| 368 | + // make.width.mas_equalTo(KScreenWidth-20); | ||
| 369 | + // make.bottom.mas_equalTo(self.totalView.mas_bottom); | ||
| 370 | + // make.height.mas_equalTo(0.5); | ||
| 371 | + // }]; | ||
| 372 | + // | ||
| 373 | + // } | ||
| 374 | + | ||
| 375 | + [self.noteView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 376 | + make.width.mas_equalTo(kScreenWidth); | ||
| 377 | + }]; | ||
| 378 | + | ||
| 379 | + [self.voucherView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 380 | + make.width.mas_equalTo(kScreenWidth); | ||
| 381 | + }]; | ||
| 382 | + | ||
| 383 | + if (_showReason) { | ||
| 384 | + | ||
| 385 | + self.noteView.hidden = NO; | ||
| 386 | + | ||
| 387 | + [self.noteView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 388 | + make.left.mas_equalTo(0); | ||
| 389 | + make.top.mas_equalTo(self.timeView.mas_bottom).mas_offset(10); | ||
| 390 | + make.width.mas_equalTo(kScreenWidth); | ||
| 391 | + }]; | ||
| 392 | + | ||
| 393 | + if (_showVoucher) { | ||
| 394 | + [self.voucherView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 395 | + make.left.mas_equalTo(0); | ||
| 396 | + make.top.mas_equalTo(self.noteView.mas_bottom).mas_offset(10); | ||
| 397 | + make.width.mas_equalTo(kScreenWidth); | ||
| 398 | + }]; | ||
| 399 | + } | ||
| 400 | + | ||
| 401 | + } | ||
| 402 | + | ||
| 403 | + if (_showFuncView) { | ||
| 404 | + | ||
| 405 | + if (_showReason) { | ||
| 406 | + | ||
| 407 | + if (_showVoucher) { | ||
| 408 | + [self.funcView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 409 | + make.left.mas_equalTo(0); | ||
| 410 | + make.top.mas_equalTo(self.voucherView.mas_bottom).mas_offset(10); | ||
| 411 | + make.width.mas_equalTo(kScreenWidth); | ||
| 412 | + make.height.mas_equalTo(60); | ||
| 413 | + }]; | ||
| 414 | + } else { | ||
| 415 | + [self.funcView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 416 | + make.left.mas_equalTo(0); | ||
| 417 | + make.top.mas_equalTo(self.noteView.mas_bottom).mas_offset(10); | ||
| 418 | + make.width.mas_equalTo(kScreenWidth); | ||
| 419 | + make.height.mas_equalTo(60); | ||
| 420 | + }]; | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + } else { | ||
| 424 | + [self.funcView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 425 | + make.left.mas_equalTo(0); | ||
| 426 | + make.top.mas_equalTo(self.timeView.mas_bottom).mas_offset(10); | ||
| 427 | + make.width.mas_equalTo(kScreenWidth); | ||
| 428 | + make.height.mas_equalTo(60); | ||
| 429 | + }]; | ||
| 430 | + } | ||
| 431 | + } | ||
| 432 | +} | ||
| 433 | +#pragma mark -加载数据 | ||
| 434 | +- (void)loadData { | ||
| 435 | + __weak typeof(self) weakSelf = self; | ||
| 436 | + [self.scrollView removeAllSubviews]; | ||
| 437 | + | ||
| 438 | +// [_cutdownTimer destroyTimer]; | ||
| 439 | + | ||
| 440 | + [QMUITips showLoadingInView:self.view]; | ||
| 441 | + [CNLiveNetworking setupShowDataResult:NO]; | ||
| 442 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 443 | + | ||
| 444 | + NSDictionary *param = @{@"appId":AppId, | ||
| 445 | + @"plat":@"i", | ||
| 446 | + @"orderId":self.orderId?self.orderId:@"", | ||
| 447 | + @"sid":@"10511059" | ||
| 448 | + }; | ||
| 449 | + | ||
| 450 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNOrderCheckUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 451 | + NSLog(@"打印这个页面%@-----%@",responseObject, error); | ||
| 452 | + [QMUITips hideAllToastInView:self.view animated:YES]; | ||
| 453 | + NSDictionary *data = [responseObject objectForKey:@"data"]; | ||
| 454 | + NSString *errMessage =[responseObject objectForKey:@"errorMessage"]; | ||
| 455 | + NSString *errorCode = [NSString stringWithFormat:@"%@",[responseObject objectForKey:@"errorCode"]]; | ||
| 456 | + if (!error) { | ||
| 457 | + if ([errorCode isEqualToString:@"0"]) { | ||
| 458 | + CNLiveOrderList *list = [CNLiveOrderList mj_objectWithKeyValues:data]; | ||
| 459 | + CNLiveOrderListOrderItem *orderItem = list.orderItem; | ||
| 460 | + CNLiveOrderRefundItem *refundItem = list.refundMsg; | ||
| 461 | + weakSelf.qrParameterDic = @{OrderIdKey:orderItem.orderId}; | ||
| 462 | + if (refundItem.imgPathArray.count > 0) { | ||
| 463 | + weakSelf.showVoucher = YES; | ||
| 464 | + weakSelf.voucherView.hidden = NO; | ||
| 465 | + } | ||
| 466 | + else | ||
| 467 | + { | ||
| 468 | + weakSelf.voucherView.hidden = YES; | ||
| 469 | + weakSelf.showVoucher = NO; | ||
| 470 | + } | ||
| 471 | + //用户端申请退款,确认退款,退款失败,退款成功状态下不显示funcView | ||
| 472 | + if (orderItem.status == 8 || | ||
| 473 | + orderItem.status == 9 || | ||
| 474 | + orderItem.status == 11 || | ||
| 475 | + orderItem.status == 12) { | ||
| 476 | + weakSelf.showFuncView = NO; | ||
| 477 | + } | ||
| 478 | + if (!weakSelf.showFuncView) { | ||
| 479 | + weakSelf.funcView.hidden = YES; | ||
| 480 | + } | ||
| 481 | + else | ||
| 482 | + weakSelf.funcView.hidden = NO; | ||
| 483 | + | ||
| 484 | + //为退款状态 | ||
| 485 | + if (orderItem.status >= 8 && orderItem.status <= 12) { | ||
| 486 | + weakSelf.refund = YES; | ||
| 487 | + weakSelf.showReason = YES; | ||
| 488 | + } | ||
| 489 | + else | ||
| 490 | + { | ||
| 491 | + weakSelf.refund = NO; | ||
| 492 | + weakSelf.showReason = NO; | ||
| 493 | + } | ||
| 494 | + | ||
| 495 | + if (orderItem.status == 10) { | ||
| 496 | + weakSelf.showRejectedView = YES; | ||
| 497 | + } | ||
| 498 | + else | ||
| 499 | + weakSelf.showRejectedView = NO; | ||
| 500 | + //没付款之前不显示生成二维码 | ||
| 501 | + if (orderItem.status == 0 || orderItem.status == 1 || | ||
| 502 | + orderItem.status == 2 || orderItem.status == 3 || | ||
| 503 | + orderItem.status == 4) { | ||
| 504 | + weakSelf.moreBtn.hidden = YES; | ||
| 505 | + } | ||
| 506 | + //添加子控件 | ||
| 507 | + [self addSubviews]; | ||
| 508 | + | ||
| 509 | + self.list = list; | ||
| 510 | + | ||
| 511 | + weakSelf.statusView.list = list; | ||
| 512 | + weakSelf.iconView.list = list; | ||
| 513 | + weakSelf.kindView.list = list; | ||
| 514 | + weakSelf.serviceView.list = list; | ||
| 515 | + weakSelf.totalView.list = list; | ||
| 516 | + weakSelf.contactDarenView.list = list; | ||
| 517 | + //如果凭证image数量大于0,显示凭证view | ||
| 518 | + | ||
| 519 | + if (weakSelf.showVoucher) { | ||
| 520 | + weakSelf.voucherView.list = list; | ||
| 521 | + } | ||
| 522 | + if (weakSelf.showRejectedView) { | ||
| 523 | + weakSelf.failView.list = list; | ||
| 524 | + } | ||
| 525 | + | ||
| 526 | + if (weakSelf.showReason) { | ||
| 527 | + weakSelf.noteView.list = list; | ||
| 528 | + } | ||
| 529 | + | ||
| 530 | + if (weakSelf.refund) { | ||
| 531 | + weakSelf.progressView.list = list; | ||
| 532 | + } else { | ||
| 533 | + | ||
| 534 | + if ([NSString isEmpty:list.contactMsg.contactPhone] && [NSString isEmpty:list.defaultContactMsg.defaultContactPhone]) { | ||
| 535 | + weakSelf.addressView.allowEdit = YES; | ||
| 536 | + } | ||
| 537 | + else if (![NSString isEmpty:list.contactMsg.contactPhone]) | ||
| 538 | + { | ||
| 539 | + weakSelf.addressView.list = list; | ||
| 540 | + | ||
| 541 | + } | ||
| 542 | + else if (![NSString isEmpty:list.defaultContactMsg.defaultContactPhone]) | ||
| 543 | + { | ||
| 544 | + weakSelf.addressView.allowEdit = YES; | ||
| 545 | + weakSelf.addressView.list = list; | ||
| 546 | + | ||
| 547 | + } | ||
| 548 | + else { | ||
| 549 | + weakSelf.addressView.list = list; | ||
| 550 | + } | ||
| 551 | + | ||
| 552 | +// [DSAddressRequest postMyFirstAddressWithUid:[IMAPlatform sharedInstance].host.userId result:^(DSAddressModel * _Nonnull addressModel, NSString * _Nonnull errorMessage) { | ||
| 553 | +// [weakSelf.addressView updateFirstAddress:addressModel]; | ||
| 554 | +// }]; | ||
| 555 | + } | ||
| 556 | + if (orderItem.status == 7) { | ||
| 557 | + weakSelf.voucherView.hidden = YES; | ||
| 558 | + [weakSelf.voucherView removeFromSuperview]; | ||
| 559 | + weakSelf.noteView.hidden = YES; | ||
| 560 | + [weakSelf.noteView removeFromSuperview]; | ||
| 561 | + | ||
| 562 | + } | ||
| 563 | + weakSelf.timeView.list = list; | ||
| 564 | + | ||
| 565 | + [weakSelf.feeView setTitle:@"服务费" subTitle:[NSString stringWithFormat:@"%.2f",(float)orderItem.fee]]; | ||
| 566 | + [weakSelf.freightView setTitle:@"运费" subTitle:[NSString stringWithFormat:@"%.2f",(float)orderItem.freight]]; | ||
| 567 | + [weakSelf.refunEnableView setTitle:@"是否可以退款" subTitle:orderItem.refundable == true ? @"是" : @"否"]; | ||
| 568 | + [weakSelf.deliveryView setTitle:@"配送方式" subTitle:orderItem.distributionContent]; | ||
| 569 | + | ||
| 570 | + [weakSelf.view layoutIfNeeded]; | ||
| 571 | + if (!weakSelf.showFuncView) { | ||
| 572 | + if (weakSelf.showVoucher) { | ||
| 573 | + weakSelf.scrollView.contentSize = CGSizeMake(kScreenWidth, weakSelf.voucherView.bottom); | ||
| 574 | + } else { | ||
| 575 | + weakSelf.scrollView.contentSize = CGSizeMake(kScreenWidth, weakSelf.noteView.bottom); | ||
| 576 | + } | ||
| 577 | + } else { | ||
| 578 | + [weakSelf configFuncItems:list]; | ||
| 579 | + weakSelf.scrollView.contentSize = CGSizeMake(kScreenWidth, self.funcView.bottom); | ||
| 580 | + } | ||
| 581 | + } else { | ||
| 582 | + | ||
| 583 | + if (error.code == -1009) { | ||
| 584 | +// [self showErrorRetryType:RetryTypeNoNet noNet:YES]; | ||
| 585 | + } else if (error.code == 405) { | ||
| 586 | + weakSelf.scrollView.backgroundColor = kWhiteColor; | ||
| 587 | + weakSelf.moreBtn.hidden = YES; | ||
| 588 | + [weakSelf showEmptyViewWithImage:[UIImage imageNamed:@"zhuangtai_kong"] text:@"此订单已删除" detailText:@"" buttonTitle:@"" buttonAction:nil]; | ||
| 589 | + } else if (error.code == 402) | ||
| 590 | + { | ||
| 591 | + weakSelf.scrollView.backgroundColor = kWhiteColor; | ||
| 592 | + [weakSelf showEmptyViewWithImage:[UIImage imageNamed:@"zhuangtai_kong"] text:@"个人订单" detailText:@"该订单不是您的个人订单" buttonTitle:@"点击退出" buttonAction:@selector(exitOrderDetail:)]; | ||
| 593 | + }else { | ||
| 594 | +// [self showErrorRetryType:RetryTypeError noNet:NO]; | ||
| 595 | + } | ||
| 596 | + } | ||
| 597 | + } | ||
| 598 | + }]; | ||
| 599 | + | ||
| 600 | +} | ||
| 601 | +#pragma mark -targetAction | ||
| 602 | +- (void)exitOrderDetail:(UIButton *)btn { | ||
| 603 | + [self.navigationController popToRootViewControllerAnimated:NO]; | ||
| 604 | +} | ||
| 605 | +- (void)rightNavItemAction:(UIButton *)sender { | ||
| 606 | + | ||
| 607 | +} | ||
| 608 | +/** | ||
| 609 | + * ((0-待确认,1-允许修改,2-取消订单,3-待支付,4-取消确认, 5-待发货,6-待收货,7-已收货,8-申请退款,9-确认退款,10-拒绝退款,11-退款失败,12-退款成功) | ||
| 610 | + */ | ||
| 611 | +- (void)configFuncItems:(CNLiveOrderList *)list { | ||
| 612 | + | ||
| 613 | + CNLiveOrderListOrderItem *orderItem = list.orderItem; | ||
| 614 | + | ||
| 615 | + if (orderItem.status == 0) { | ||
| 616 | + if ([NSString isEmpty:list.contactMsg.contactPhone]) { | ||
| 617 | + [self funcItemType:6]; | ||
| 618 | + } else { | ||
| 619 | + [self funcItemType:4]; | ||
| 620 | + } | ||
| 621 | + } | ||
| 622 | + | ||
| 623 | + if (orderItem.status == 1) { //待修改 | ||
| 624 | + // [self funcItemType:7]; | ||
| 625 | + } | ||
| 626 | + | ||
| 627 | + if (orderItem.status == 2) { //订单已取消 | ||
| 628 | + _funcView.hidden = YES; | ||
| 629 | + return; | ||
| 630 | + } | ||
| 631 | + | ||
| 632 | + if (orderItem.status == 3) { //待支付 | ||
| 633 | + [self funcItemType:1]; | ||
| 634 | + } | ||
| 635 | + | ||
| 636 | + if (orderItem.status == 4) { //取消确认 | ||
| 637 | + [self funcItemType:5]; | ||
| 638 | + } | ||
| 639 | + | ||
| 640 | + if (orderItem.status == 5) { //待发货 | ||
| 641 | + [self funcItemType:8]; | ||
| 642 | + } | ||
| 643 | + | ||
| 644 | + if ( orderItem.status == 6) { //待收货 | ||
| 645 | + | ||
| 646 | + //待收货状态显示收货倒计时 | ||
| 647 | +// [self initTimer:orderItem.countdown]; | ||
| 648 | + | ||
| 649 | + [self funcItemType:2]; | ||
| 650 | + } | ||
| 651 | + | ||
| 652 | + if (orderItem.status == 7) { //已收货,若已评价显示交易成功,未评价显示待评价 | ||
| 653 | + if (orderItem.commentable == true) { | ||
| 654 | + [self funcItemType:3]; | ||
| 655 | + } else { | ||
| 656 | + [self funcItemType:0]; | ||
| 657 | + } | ||
| 658 | + | ||
| 659 | + } | ||
| 660 | + | ||
| 661 | + if (orderItem.status == 8 || orderItem.status == 9 || orderItem.status == 11) { //确认退款和申请退款为退款中状态 | ||
| 662 | + [self funcItemType:4]; | ||
| 663 | + } | ||
| 664 | + | ||
| 665 | + if (orderItem.status == 10) { //拒绝退款,可再次申请 | ||
| 666 | + [self funcItemType:2]; | ||
| 667 | + } | ||
| 668 | + | ||
| 669 | + if (orderItem.status == 12) { //退款成功 | ||
| 670 | + [self funcItemType:4]; | ||
| 671 | + } | ||
| 672 | +} | ||
| 673 | +//根据订单状态显示功能安按钮 | ||
| 674 | +- (void)funcItemType:(NSInteger)type { | ||
| 675 | + | ||
| 676 | + switch (type) { | ||
| 677 | + case 0: { //交易成功 | ||
| 678 | + | ||
| 679 | + CNLiveMineOrderButtonItem *btnItem1 = [CNLiveMineOrderButtonItem title:@"删除订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeDelete]; | ||
| 680 | + _funcView.funcItems = @[btnItem1]; | ||
| 681 | + | ||
| 682 | + } | ||
| 683 | + break; | ||
| 684 | + | ||
| 685 | + case 1: { //代付款 | ||
| 686 | + | ||
| 687 | + CNLiveMineOrderButtonItem *btnItem2 = [CNLiveMineOrderButtonItem title:@"取消订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeCancel]; | ||
| 688 | + | ||
| 689 | + CNLiveMineOrderButtonItem *btnItem3 = [CNLiveMineOrderButtonItem title:@"付款" type:CNLiveMineOrderButtonTypeRed tag:CNLiveMineOrderButtonItemTypePay]; | ||
| 690 | + | ||
| 691 | + _funcView.funcItems = @[btnItem3, btnItem2]; | ||
| 692 | + | ||
| 693 | + } | ||
| 694 | + break; | ||
| 695 | + | ||
| 696 | + case 2: { //待收货 | ||
| 697 | + | ||
| 698 | + if (self.list.orderItem.refundable == true) { | ||
| 699 | + CNLiveMineOrderButtonItem *btnItem1 = [CNLiveMineOrderButtonItem title:@"申请退款" type:CNLiveMineOrderButtonTypeRed tag:CNLiveMineOrderButtonItemTypeRefund]; | ||
| 700 | + | ||
| 701 | + CNLiveMineOrderButtonItem *btnItem2 = [CNLiveMineOrderButtonItem title:@"我要催单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeReminder]; | ||
| 702 | + | ||
| 703 | + CNLiveMineOrderButtonItem *btnItem3 = [CNLiveMineOrderButtonItem title:@"确认收货" type:CNLiveMineOrderButtonTypeRed tag:CNLiveMineOrderButtonItemTypeConfirmReceipt]; | ||
| 704 | + | ||
| 705 | + _funcView.funcItems = @[btnItem3, btnItem1, btnItem2]; | ||
| 706 | + | ||
| 707 | + } else { | ||
| 708 | + | ||
| 709 | + CNLiveMineOrderButtonItem *btnItem2 = [CNLiveMineOrderButtonItem title:@"我要催单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeReminder]; | ||
| 710 | + | ||
| 711 | + CNLiveMineOrderButtonItem *btnItem3 = [CNLiveMineOrderButtonItem title:@"确认收货" type:CNLiveMineOrderButtonTypeRed tag:CNLiveMineOrderButtonItemTypeConfirmReceipt]; | ||
| 712 | + | ||
| 713 | + _funcView.funcItems = @[btnItem3, btnItem2]; | ||
| 714 | + } | ||
| 715 | + | ||
| 716 | + | ||
| 717 | + } | ||
| 718 | + break; | ||
| 719 | + | ||
| 720 | + case 3: { //待评价 | ||
| 721 | + | ||
| 722 | + CNLiveMineOrderButtonItem *btnItem2 = [CNLiveMineOrderButtonItem title:@"评价" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeEvaluate]; | ||
| 723 | + CNLiveMineOrderButtonItem *btnItem1 = [CNLiveMineOrderButtonItem title:@"删除订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeDelete]; | ||
| 724 | + _funcView.funcItems = @[btnItem2, btnItem1]; | ||
| 725 | + | ||
| 726 | + } | ||
| 727 | + break; | ||
| 728 | + | ||
| 729 | + case 4: { //取消订单 | ||
| 730 | + CNLiveMineOrderButtonItem *btnItem2 = [CNLiveMineOrderButtonItem title:@"取消订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeCancel]; | ||
| 731 | + _funcView.funcItems = @[btnItem2]; | ||
| 732 | + } | ||
| 733 | + break; | ||
| 734 | + | ||
| 735 | + case 5: { //交易关闭 | ||
| 736 | + | ||
| 737 | + CNLiveMineOrderButtonItem *btnItem1 = [CNLiveMineOrderButtonItem title:@"删除订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeDelete]; | ||
| 738 | + | ||
| 739 | + _funcView.funcItems = @[btnItem1]; | ||
| 740 | + | ||
| 741 | + } | ||
| 742 | + break; | ||
| 743 | + | ||
| 744 | + case 6: { //提交订单 | ||
| 745 | + | ||
| 746 | + CNLiveMineOrderButtonItem *btnItem1 = [CNLiveMineOrderButtonItem title:@"取消订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeCancel]; | ||
| 747 | + | ||
| 748 | + CNLiveMineOrderButtonItem *btnItem2 = [CNLiveMineOrderButtonItem title:@"信息有误" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeError]; | ||
| 749 | + | ||
| 750 | + CNLiveMineOrderButtonItem *btnItem3 = [CNLiveMineOrderButtonItem title:@"提交订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeConfirm]; | ||
| 751 | + | ||
| 752 | + _funcView.funcItems = @[btnItem1, btnItem2, btnItem3]; | ||
| 753 | + | ||
| 754 | + } | ||
| 755 | + break; | ||
| 756 | + | ||
| 757 | + case 7: { //待修改显示取消和确认 | ||
| 758 | + | ||
| 759 | + CNLiveMineOrderButtonItem *btnItem1 = [CNLiveMineOrderButtonItem title:@"取消订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeCancel]; | ||
| 760 | + | ||
| 761 | + CNLiveMineOrderButtonItem *btnItem2 = [CNLiveMineOrderButtonItem title:@"提交订单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeConfirm]; | ||
| 762 | + | ||
| 763 | + _funcView.funcItems = @[btnItem1, btnItem2]; | ||
| 764 | + | ||
| 765 | + } | ||
| 766 | + break; | ||
| 767 | + | ||
| 768 | + case 8: { //待发货 | ||
| 769 | + | ||
| 770 | + CNLiveMineOrderButtonItem *btnItem = [CNLiveMineOrderButtonItem title:@"我要催单" type:CNLiveMineOrderButtonTypeGray tag:CNLiveMineOrderButtonItemTypeReminder]; | ||
| 771 | + CNLiveMineOrderButtonItem *btnItem1 = [CNLiveMineOrderButtonItem title:@"申请退款" type:CNLiveMineOrderButtonTypeRed tag:CNLiveMineOrderButtonItemTypeRefund]; | ||
| 772 | + | ||
| 773 | + _funcView.funcItems = @[btnItem1, btnItem]; | ||
| 774 | + | ||
| 775 | + } | ||
| 776 | + break; | ||
| 777 | + | ||
| 778 | + default: | ||
| 779 | + break; | ||
| 780 | + } | ||
| 781 | + | ||
| 782 | +} | ||
| 783 | +#pragma mark - CNAddPopFuncViewDelegate | ||
| 784 | +- (void)popFuncView:(CNAddPopFuncView *)popView indexPath:(NSInteger)row | ||
| 785 | +{ | ||
| 786 | + | ||
| 787 | +} | ||
| 788 | +#pragma mark - | ||
| 789 | +#pragma mark - Getter | ||
| 790 | +- (UIScrollView *)scrollView | ||
| 791 | +{ | ||
| 792 | + if (!_scrollView) { | ||
| 793 | + _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, kNavigationBarHeight, kScreenWidth, KScreenHeight-kNavigationBarHeight)]; | ||
| 794 | + _scrollView.contentSize = CGSizeMake(kScreenWidth, 1000); | ||
| 795 | + _scrollView.backgroundColor = kWeChatBgColor; | ||
| 796 | + } | ||
| 797 | + return _scrollView; | ||
| 798 | +} | ||
| 799 | + | ||
| 800 | +- (CNLiveOrderDetailStatusView *)statusView | ||
| 801 | +{ | ||
| 802 | + if (!_statusView) { | ||
| 803 | + _statusView = [[CNLiveOrderDetailStatusView alloc] init]; | ||
| 804 | + } | ||
| 805 | + return _statusView; | ||
| 806 | +} | ||
| 807 | +- (CNAddPopFuncView *)popFunItemView | ||
| 808 | +{ | ||
| 809 | + if (!_popFunItemView) { | ||
| 810 | + _popFunItemView = [[CNAddPopFuncView alloc] initWithFrame:[UIScreen mainScreen].bounds withIconArray:@[@"dd_createOrderQR"] withTitleArray:@[@"生成二维码"]]; | ||
| 811 | + _popFunItemView.delegate = self; | ||
| 812 | + } | ||
| 813 | + return _popFunItemView; | ||
| 814 | +} | ||
| 815 | +- (CNLiveRefundFailView *)failView | ||
| 816 | +{ | ||
| 817 | + if (!_failView) { | ||
| 818 | + _failView = [[CNLiveRefundFailView alloc] init]; | ||
| 819 | + } | ||
| 820 | + return _failView; | ||
| 821 | +} | ||
| 822 | + | ||
| 823 | +- (CNLiveAddressView *)addressView | ||
| 824 | +{ | ||
| 825 | + if (!_addressView) { | ||
| 826 | + _addressView = [[CNLiveAddressView alloc] init]; | ||
| 827 | +// _addressView.delegate = self; | ||
| 828 | + } | ||
| 829 | + return _addressView; | ||
| 830 | +} | ||
| 831 | + | ||
| 832 | +- (CNLiveContactDarenView *)contactDarenView | ||
| 833 | +{ | ||
| 834 | + if (!_contactDarenView) { | ||
| 835 | + _contactDarenView = [[CNLiveContactDarenView alloc] init]; | ||
| 836 | + } | ||
| 837 | + return _contactDarenView; | ||
| 838 | +} | ||
| 839 | + | ||
| 840 | +- (CNLiveIconView *)iconView | ||
| 841 | +{ | ||
| 842 | + if (!_iconView) { | ||
| 843 | + _iconView = [[CNLiveIconView alloc] init]; | ||
| 844 | + _iconView.smallIcon = NO; | ||
| 845 | + } | ||
| 846 | + return _iconView; | ||
| 847 | +} | ||
| 848 | + | ||
| 849 | +- (CNLiveOrderDetailContentView *)kindView | ||
| 850 | +{ | ||
| 851 | + if (!_kindView) { | ||
| 852 | + _kindView = [[CNLiveOrderDetailContentView alloc] init]; | ||
| 853 | + } | ||
| 854 | + return _kindView; | ||
| 855 | +} | ||
| 856 | + | ||
| 857 | +- (CNLiveServiceTypeView *)serviceView | ||
| 858 | +{ | ||
| 859 | + if (!_serviceView) { | ||
| 860 | + _serviceView = [[CNLiveServiceTypeView alloc] init]; | ||
| 861 | + } | ||
| 862 | + return _serviceView; | ||
| 863 | +} | ||
| 864 | + | ||
| 865 | +- (CNLiveOrderNormalView *)freightView | ||
| 866 | +{ | ||
| 867 | + if (!_freightView) { | ||
| 868 | + _freightView = [[CNLiveOrderNormalView alloc] init]; | ||
| 869 | + } | ||
| 870 | + return _freightView; | ||
| 871 | +} | ||
| 872 | + | ||
| 873 | +- (CNLiveOrderNormalView *)feeView | ||
| 874 | +{ | ||
| 875 | + if (!_feeView) { | ||
| 876 | + _feeView = [[CNLiveOrderNormalView alloc] init]; | ||
| 877 | + } | ||
| 878 | + return _feeView; | ||
| 879 | +} | ||
| 880 | + | ||
| 881 | +- (CNLiveOrderNormalView *)goodsInfoView | ||
| 882 | +{ | ||
| 883 | + if (!_goodsInfoView) { | ||
| 884 | + _goodsInfoView = [[CNLiveOrderNormalView alloc] init]; | ||
| 885 | + [_goodsInfoView setTitle:@"商品信息" subTitle:@""]; | ||
| 886 | + } | ||
| 887 | + return _goodsInfoView; | ||
| 888 | +} | ||
| 889 | + | ||
| 890 | +- (CNLiveActuallyPaidView *)totalView | ||
| 891 | +{ | ||
| 892 | + if (!_totalView) { | ||
| 893 | + _totalView = [[CNLiveActuallyPaidView alloc] init]; | ||
| 894 | + } | ||
| 895 | + return _totalView; | ||
| 896 | +} | ||
| 897 | + | ||
| 898 | +- (CNLiveOrderNormalView *)refunEnableView | ||
| 899 | +{ | ||
| 900 | + if (!_refunEnableView) { | ||
| 901 | + _refunEnableView = [[CNLiveOrderNormalView alloc] init]; | ||
| 902 | + } | ||
| 903 | + return _refunEnableView; | ||
| 904 | +} | ||
| 905 | + | ||
| 906 | +- (CNLiveOrderNormalView *)deliveryView | ||
| 907 | +{ | ||
| 908 | + if (!_deliveryView) { | ||
| 909 | + _deliveryView = [[CNLiveOrderNormalView alloc] init]; | ||
| 910 | + } | ||
| 911 | + return _deliveryView; | ||
| 912 | +} | ||
| 913 | + | ||
| 914 | +- (CNLiveFuncView *)funcView | ||
| 915 | +{ | ||
| 916 | + if (!_funcView) { | ||
| 917 | + _funcView = [[CNLiveFuncView alloc] init]; | ||
| 918 | + } | ||
| 919 | + return _funcView; | ||
| 920 | +} | ||
| 921 | + | ||
| 922 | +- (CNLiveRefundProcessView *)progressView | ||
| 923 | +{ | ||
| 924 | + if (!_progressView) { | ||
| 925 | + _progressView = [[CNLiveRefundProcessView alloc] init]; | ||
| 926 | + } | ||
| 927 | + return _progressView; | ||
| 928 | +} | ||
| 929 | + | ||
| 930 | +- (CNLiveRefundReasonAndNoteView *)noteView | ||
| 931 | +{ | ||
| 932 | + if (!_noteView) { | ||
| 933 | + _noteView = [[CNLiveRefundReasonAndNoteView alloc] init]; | ||
| 934 | + } | ||
| 935 | + return _noteView; | ||
| 936 | +} | ||
| 937 | + | ||
| 938 | +- (CNLiveRefundVoucherView *)voucherView | ||
| 939 | +{ | ||
| 940 | + if (!_voucherView) { | ||
| 941 | + _voucherView = [[CNLiveRefundVoucherView alloc] init]; | ||
| 942 | + _voucherView.delegate = self; | ||
| 943 | + } | ||
| 944 | + return _voucherView; | ||
| 945 | +} | ||
| 946 | + | ||
| 947 | +- (CNLiveOrderTimeView *)timeView | ||
| 948 | +{ | ||
| 949 | + if (!_timeView) { | ||
| 950 | + _timeView = [[CNLiveOrderTimeView alloc] init]; | ||
| 951 | + } | ||
| 952 | + return _timeView; | ||
| 953 | +} | ||
| 954 | + | ||
| 955 | +- (UIView *)line1 | ||
| 956 | +{ | ||
| 957 | + if (!_line1) { | ||
| 958 | + _line1 = [[UIView alloc] init]; | ||
| 959 | + _line1.backgroundColor = KCommonLineColor; | ||
| 960 | + } | ||
| 961 | + return _line1; | ||
| 962 | +} | ||
| 963 | + | ||
| 964 | +- (UIView *)line2 | ||
| 965 | +{ | ||
| 966 | + if (!_line2) { | ||
| 967 | + _line2 = [[UIView alloc] init]; | ||
| 968 | + _line2.backgroundColor = KCommonLineColor; | ||
| 969 | + _line2.hidden = YES; | ||
| 970 | + | ||
| 971 | + } | ||
| 972 | + return _line2; | ||
| 973 | +} | ||
| 974 | + | ||
| 975 | +- (UIView *)line3 | ||
| 976 | +{ | ||
| 977 | + if (!_line3) { | ||
| 978 | + _line3 = [[UIView alloc] init]; | ||
| 979 | + _line3.backgroundColor = KCommonLineColor; | ||
| 980 | + } | ||
| 981 | + return _line3; | ||
| 982 | +} | ||
| 983 | + | ||
| 984 | +- (UIView *)line4 | ||
| 985 | +{ | ||
| 986 | + if (!_line4) { | ||
| 987 | + _line4 = [[UIView alloc] init]; | ||
| 988 | + _line4.backgroundColor = KCommonLineColor; | ||
| 989 | + } | ||
| 990 | + return _line4; | ||
| 991 | +} | ||
| 992 | + | ||
| 993 | +- (UIView *)line5 | ||
| 994 | +{ | ||
| 995 | + if (!_line5) { | ||
| 996 | + _line5 = [[UIView alloc] init]; | ||
| 997 | + _line5.backgroundColor = KCommonLineColor; | ||
| 998 | + } | ||
| 999 | + return _line5; | ||
| 1000 | +} | ||
| 1001 | + | ||
| 1002 | +- (UIView *)line6 | ||
| 1003 | +{ | ||
| 1004 | + if (!_line6) { | ||
| 1005 | + _line6 = [[UIView alloc] init]; | ||
| 1006 | + _line6.backgroundColor = KCommonLineColor; | ||
| 1007 | + } | ||
| 1008 | + return _line6; | ||
| 1009 | +} | ||
| 1010 | + | ||
| 1011 | +- (UIView *)line7 | ||
| 1012 | +{ | ||
| 1013 | + if (!_line7) { | ||
| 1014 | + _line7 = [[UIView alloc] init]; | ||
| 1015 | + _line7.backgroundColor = KCommonLineColor; | ||
| 1016 | + } | ||
| 1017 | + return _line7; | ||
| 1018 | +} | ||
| 1019 | + | ||
| 1020 | +- (void)didReceiveMemoryWarning { | ||
| 1021 | + [super didReceiveMemoryWarning]; | ||
| 1022 | + // Dispose of any resources that can be recreated. | ||
| 1023 | +} | ||
| 1024 | + | ||
| 1025 | + | ||
| 1026 | + | ||
| 1027 | + | ||
| 1028 | +@end |
CNLiveMyOrder/Classes/View/CNAddPopFuncView.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNAddFuncView.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 2018/1/10. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +@class CNAddPopFuncView; | ||
| 12 | +@protocol CNAddPopFuncViewDelegate <NSObject> | ||
| 13 | + | ||
| 14 | +- (void)popFuncView:(CNAddPopFuncView *)popView indexPath:(NSInteger)row; | ||
| 15 | + | ||
| 16 | +@end | ||
| 17 | + | ||
| 18 | +@interface CNAddPopFuncView : UIView | ||
| 19 | + | ||
| 20 | +@property (nonatomic, assign) id<CNAddPopFuncViewDelegate> delegate; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + 初始化 | ||
| 24 | + | ||
| 25 | + @param frame frame | ||
| 26 | + @param arrayIcons 图片数组 | ||
| 27 | + @param arrayTitles 名字数组 | ||
| 28 | + @return self | ||
| 29 | + */ | ||
| 30 | +- (instancetype)initWithFrame:(CGRect)frame withIconArray:(NSArray *)arrayIcons withTitleArray:(NSArray *)arrayTitles; | ||
| 31 | + | ||
| 32 | +- (void)showPopupViewInPosition:(UIButton *)button; | ||
| 33 | + | ||
| 34 | +@end | ||
| 35 | + | ||
| 36 | + | ||
| 37 | +@interface CNAddPopFuncItem : NSObject | ||
| 38 | + | ||
| 39 | +@property (nonatomic, strong) NSString *title; | ||
| 40 | +@property (nonatomic, strong) NSString *icon; | ||
| 41 | + | ||
| 42 | ++ (instancetype)popItemWithIcon:(NSString *)icon title:(NSString *)title; | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + | ||
| 46 | +@end |
CNLiveMyOrder/Classes/View/CNAddPopFuncView.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNAddFuncView.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 2018/1/10. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNAddPopFuncView.h" | ||
| 10 | +#import "CNPopupTableViewCell.h" | ||
| 11 | +#import "CNLiveBaseKit.h" | ||
| 12 | +#import "CNLiveCommonCategory.h" | ||
| 13 | +#import "QMUIKit.h" | ||
| 14 | +static CGFloat devicePadding = 20.0f; | ||
| 15 | +static CGFloat popupViewWidth = 120.0f; | ||
| 16 | +static CGFloat popupViewpadding = 8.0f; | ||
| 17 | +static CGFloat Trianglewidth = 5; | ||
| 18 | +static CGFloat rowHeight = 45.0f; | ||
| 19 | + | ||
| 20 | +@interface CNAddPopFuncView ()<UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate> | ||
| 21 | +{ | ||
| 22 | + NSMutableArray *_listArr; | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +@property (nonatomic, strong) UITableView *tableView; | ||
| 26 | +@property (nonatomic, strong) UIImageView *Triangle; | ||
| 27 | +@property (nonatomic, strong) UIView *bgView; | ||
| 28 | + | ||
| 29 | +@end | ||
| 30 | + | ||
| 31 | +@implementation CNAddPopFuncView | ||
| 32 | + | ||
| 33 | +- (void)dealloc { | ||
| 34 | + NSLog(@"CNAddPopFuncView 走了dealloc了吗"); | ||
| 35 | +} | ||
| 36 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 37 | +{ | ||
| 38 | + self = [super initWithFrame:frame]; | ||
| 39 | + if (self) { | ||
| 40 | + [self addItems]; | ||
| 41 | + [self addSubview:self.bgView]; | ||
| 42 | + [self.bgView addSubview:self.Triangle]; | ||
| 43 | + [self.bgView addSubview:self.tableView]; | ||
| 44 | + | ||
| 45 | + } | ||
| 46 | + return self; | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +- (void)addItems { | ||
| 50 | + | ||
| 51 | + CNAddPopFuncItem *groupChat = [CNAddPopFuncItem popItemWithIcon:@"homepage_groupchat" title:@"发起群聊"]; | ||
| 52 | + CNAddPopFuncItem *addNewFriend = [CNAddPopFuncItem popItemWithIcon:@"homepage_addfriends" title:@"添加好友"]; | ||
| 53 | + CNAddPopFuncItem *scan = [CNAddPopFuncItem popItemWithIcon:@"homepage_RichScan_35x35" title:@"扫一扫"]; | ||
| 54 | + CNAddPopFuncItem *arScan = [CNAddPopFuncItem popItemWithIcon:@"homepage_arScreen" title:@"AR见识"]; | ||
| 55 | + CNAddPopFuncItem *hzScan = [CNAddPopFuncItem popItemWithIcon:@"homepage_farming" title:@"农业智能"]; | ||
| 56 | + | ||
| 57 | + _listArr = [NSMutableArray arrayWithObjects:groupChat, addNewFriend,scan,arScan,hzScan, nil]; | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +- (instancetype)initWithFrame:(CGRect)frame withIconArray:(NSArray *)arrayIcons withTitleArray:(NSArray *)arrayTitles | ||
| 61 | +{ | ||
| 62 | + self = [super initWithFrame:frame]; | ||
| 63 | + if (self) { | ||
| 64 | + [self addItems:arrayIcons andTiles:arrayTitles]; | ||
| 65 | + [self addSubview:self.bgView]; | ||
| 66 | + [self.bgView addSubview:self.Triangle]; | ||
| 67 | + [self.bgView addSubview:self.tableView]; | ||
| 68 | + } | ||
| 69 | + return self; | ||
| 70 | +} | ||
| 71 | +- (void)addItems:(NSArray *)arrayIcons andTiles:(NSArray *)arrayTiles | ||
| 72 | +{ | ||
| 73 | + _listArr = [[NSMutableArray alloc] init]; | ||
| 74 | + for (int i = 0; i < arrayIcons.count; i ++) { | ||
| 75 | + CNAddPopFuncItem *itme = [CNAddPopFuncItem popItemWithIcon:arrayIcons[i] title:arrayTiles[i]]; | ||
| 76 | + [_listArr addObject:itme]; | ||
| 77 | + } | ||
| 78 | +} | ||
| 79 | +- (UIImage *)drawTriangle { | ||
| 80 | + | ||
| 81 | + UIGraphicsBeginImageContextWithOptions( CGSizeMake(2 * Trianglewidth, 2 * Trianglewidth), NO, 0); | ||
| 82 | + | ||
| 83 | + CGContextRef context = UIGraphicsGetCurrentContext(); | ||
| 84 | + | ||
| 85 | + //绘制三角形 | ||
| 86 | + CGContextMoveToPoint(context, Trianglewidth, 3); | ||
| 87 | + CGContextAddLineToPoint(context, 2 * Trianglewidth, 2 * Trianglewidth); | ||
| 88 | + CGContextAddLineToPoint(context, 0, 2 * Trianglewidth); | ||
| 89 | + //关闭路径,闭环,(连接起点和最后一个点) | ||
| 90 | + CGContextSetLineWidth(context, 2); | ||
| 91 | + CGContextClosePath(context); | ||
| 92 | + [RGB(73, 72, 75) setFill]; | ||
| 93 | + | ||
| 94 | + CGContextFillPath(context); | ||
| 95 | + | ||
| 96 | + //获取生成的图片 | ||
| 97 | + UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | ||
| 98 | + return image; | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +- (void)showPopupViewInPosition:(UIButton *)button { | ||
| 102 | + | ||
| 103 | + UIWindow *window = [UIApplication sharedApplication].keyWindow; | ||
| 104 | + CGRect rect = [button convertRect:button.bounds toView:window]; | ||
| 105 | + | ||
| 106 | + //按钮右偏 | ||
| 107 | + CGFloat offsetX = 0; | ||
| 108 | + if (button.frame.size.width/2 + rect.origin.x > [UIScreen mainScreen].bounds.size.width/2) { | ||
| 109 | + offsetX = -10; | ||
| 110 | + }else if (button.frame.size.width/2 + rect.origin.x < [UIScreen mainScreen].bounds.size.width/2) | ||
| 111 | + { | ||
| 112 | + offsetX = 10; | ||
| 113 | + }else{ | ||
| 114 | + offsetX = 0; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + self.Triangle.frame = CGRectMake(rect.origin.x + (button.frame.size.width/2) + offsetX + 2, rect.origin.y + button.frame.size.height, (Trianglewidth + 2) * 2, (Trianglewidth + 2) * 2); | ||
| 118 | + | ||
| 119 | + self.tableView.frame = CGRectMake([UIScreen mainScreen].bounds.size.width-popupViewWidth+offsetX, CGRectGetMaxY(self.Triangle.frame), popupViewWidth, rowHeight * _listArr.count); | ||
| 120 | + | ||
| 121 | + [window addSubview:self]; | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +- (void)clickBgViewToHide { | ||
| 125 | + [self removeFromSuperview]; | ||
| 126 | +} | ||
| 127 | + | ||
| 128 | +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { | ||
| 129 | + | ||
| 130 | + if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) { | ||
| 131 | + return NO; | ||
| 132 | + } | ||
| 133 | + return YES; | ||
| 134 | + | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | + | ||
| 138 | +#pragma mark - | ||
| 139 | +#pragma mark - tableView | ||
| 140 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
| 141 | + return _listArr.count; | ||
| 142 | +} | ||
| 143 | + | ||
| 144 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 145 | + CNPopupTableViewCell *cell = [CNPopupTableViewCell cellWithTableView:tableView]; | ||
| 146 | + cell.item = _listArr[indexPath.row]; | ||
| 147 | + return cell; | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||
| 151 | + [self.tableView qmui_clearsSelection]; | ||
| 152 | + [self clickBgViewToHide]; | ||
| 153 | + if (self.delegate && [self.delegate respondsToSelector:@selector(popFuncView:indexPath:) ]) { | ||
| 154 | + [self.delegate popFuncView:self indexPath:indexPath.row]; | ||
| 155 | + } | ||
| 156 | +} | ||
| 157 | + | ||
| 158 | +#pragma mark - | ||
| 159 | +#pragma mark - getter | ||
| 160 | +- (UITableView *)tableView | ||
| 161 | +{ | ||
| 162 | + if (!_tableView) { | ||
| 163 | + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, popupViewWidth, self.frame.size.height) style:UITableViewStylePlain]; | ||
| 164 | + _tableView.separatorStyle = UITableViewCellSelectionStyleNone; | ||
| 165 | + _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 1)]; | ||
| 166 | + _tableView.layer.cornerRadius = 5; | ||
| 167 | + _tableView.layer.masksToBounds = YES; | ||
| 168 | + _tableView.scrollEnabled = NO; | ||
| 169 | + _tableView.dataSource = self; | ||
| 170 | + _tableView.delegate = self; | ||
| 171 | + _tableView.rowHeight = rowHeight; | ||
| 172 | + _tableView.backgroundColor = RGB(48, 48, 48); | ||
| 173 | + _tableView.clipsToBounds = YES; | ||
| 174 | + _tableView.layer.cornerRadius = 4; | ||
| 175 | + } | ||
| 176 | + return _tableView; | ||
| 177 | +} | ||
| 178 | + | ||
| 179 | +- (UIImageView *)Triangle | ||
| 180 | +{ | ||
| 181 | + if (!_Triangle) { | ||
| 182 | + _Triangle = [[UIImageView alloc] initWithFrame:CGRectZero]; | ||
| 183 | + _Triangle.image = [self drawTriangle]; | ||
| 184 | + } | ||
| 185 | + return _Triangle; | ||
| 186 | +} | ||
| 187 | + | ||
| 188 | +- (UIView *)bgView | ||
| 189 | +{ | ||
| 190 | + if (!_bgView) { | ||
| 191 | + _bgView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; | ||
| 192 | + _bgView.backgroundColor = [UIColor clearColor]; | ||
| 193 | + | ||
| 194 | + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickBgViewToHide)]; | ||
| 195 | + tap.delegate = self; | ||
| 196 | + [_bgView addGestureRecognizer:tap]; | ||
| 197 | + } | ||
| 198 | + return _bgView; | ||
| 199 | +} | ||
| 200 | + | ||
| 201 | +/* | ||
| 202 | +// Only override drawRect: if you perform custom drawing. | ||
| 203 | +// An empty implementation adversely affects performance during animation. | ||
| 204 | +- (void)drawRect:(CGRect)rect { | ||
| 205 | + // Drawing code | ||
| 206 | +} | ||
| 207 | +*/ | ||
| 208 | + | ||
| 209 | +@end | ||
| 210 | + | ||
| 211 | +@implementation CNAddPopFuncItem | ||
| 212 | + | ||
| 213 | ++ (instancetype)popItemWithIcon:(NSString *)icon title:(NSString *)title { | ||
| 214 | + CNAddPopFuncItem *item = [[CNAddPopFuncItem alloc] init]; | ||
| 215 | + item.icon = icon ? icon : @"icon_tabbar_lab_selected"; | ||
| 216 | + item.title = [NSString isEmpty:title] ? @"title" : title; | ||
| 217 | + return item; | ||
| 218 | +} | ||
| 219 | + | ||
| 220 | +@end |
CNLiveMyOrder/Classes/View/CNLiveMineOrderView.m
| @@ -27,6 +27,9 @@ | @@ -27,6 +27,9 @@ | ||
| 27 | @property (nonatomic, strong) UILabel *titleLab; | 27 | @property (nonatomic, strong) UILabel *titleLab; |
| 28 | @end | 28 | @end |
| 29 | @implementation CNLiveMineOrderView | 29 | @implementation CNLiveMineOrderView |
| 30 | +- (void)dealloc { | ||
| 31 | + NSLog(@"CNLiveMineOrderView走了dealloc了吗"); | ||
| 32 | +} | ||
| 30 | - (instancetype)initWithFrame:(CGRect)frame{ | 33 | - (instancetype)initWithFrame:(CGRect)frame{ |
| 31 | self = [super initWithFrame:frame]; | 34 | self = [super initWithFrame:frame]; |
| 32 | if (self) { | 35 | if (self) { |
| @@ -2488,9 +2491,9 @@ | @@ -2488,9 +2491,9 @@ | ||
| 2488 | 2491 | ||
| 2489 | @end | 2492 | @end |
| 2490 | 2493 | ||
| 2491 | -/* | 2494 | + |
| 2492 | #import "CNStarsControl.h" | 2495 | #import "CNStarsControl.h" |
| 2493 | -@interface CNEvaluateStarView ()<CNStarsControlDelegate> | 2496 | +@interface CNLiveEvaluateStarView ()<CNStarsControlDelegate> |
| 2494 | 2497 | ||
| 2495 | @property (nonatomic, strong) CNStarsControl *starsControlView; | 2498 | @property (nonatomic, strong) CNStarsControl *starsControlView; |
| 2496 | @property (nonatomic, strong) UIImageView *iconImgView; | 2499 | @property (nonatomic, strong) UIImageView *iconImgView; |
| @@ -2499,7 +2502,7 @@ | @@ -2499,7 +2502,7 @@ | ||
| 2499 | 2502 | ||
| 2500 | @end | 2503 | @end |
| 2501 | 2504 | ||
| 2502 | -@implementation CNEvaluateStarView | 2505 | +@implementation CNLiveEvaluateStarView |
| 2503 | 2506 | ||
| 2504 | - (instancetype)initWithFrame:(CGRect)frame | 2507 | - (instancetype)initWithFrame:(CGRect)frame |
| 2505 | { | 2508 | { |
| @@ -2514,8 +2517,8 @@ | @@ -2514,8 +2517,8 @@ | ||
| 2514 | return self; | 2517 | return self; |
| 2515 | } | 2518 | } |
| 2516 | 2519 | ||
| 2517 | -- (void)setList:(CNOrderList *)list { | ||
| 2518 | - CNOrderListIconBean *icon = list.iconBean; | 2520 | +- (void)setList:(CNLiveOrderList *)list { |
| 2521 | + CNLiveOrderListIconBean *icon = list.iconBean; | ||
| 2519 | [_iconImgView sd_setImageWithURL:[NSURL URLWithString:icon.image] placeholderImage:kDefaultUserIcon]; | 2522 | [_iconImgView sd_setImageWithURL:[NSURL URLWithString:icon.image] placeholderImage:kDefaultUserIcon]; |
| 2520 | } | 2523 | } |
| 2521 | 2524 | ||
| @@ -2580,13 +2583,13 @@ | @@ -2580,13 +2583,13 @@ | ||
| 2580 | 2583 | ||
| 2581 | #pragma mark - | 2584 | #pragma mark - |
| 2582 | #pragma mark - CNOrderTimeView | 2585 | #pragma mark - CNOrderTimeView |
| 2583 | -@interface CNOrderTimeView () | 2586 | +@interface CNLiveOrderTimeView () |
| 2584 | 2587 | ||
| 2585 | @property (nonatomic, strong) UILabel *timeLab; | 2588 | @property (nonatomic, strong) UILabel *timeLab; |
| 2586 | 2589 | ||
| 2587 | @end | 2590 | @end |
| 2588 | 2591 | ||
| 2589 | -@implementation CNOrderTimeView | 2592 | +@implementation CNLiveOrderTimeView |
| 2590 | 2593 | ||
| 2591 | - (instancetype)initWithFrame:(CGRect)frame | 2594 | - (instancetype)initWithFrame:(CGRect)frame |
| 2592 | { | 2595 | { |
| @@ -2599,9 +2602,9 @@ | @@ -2599,9 +2602,9 @@ | ||
| 2599 | return self; | 2602 | return self; |
| 2600 | } | 2603 | } |
| 2601 | 2604 | ||
| 2602 | -- (void)setList:(CNOrderList *)list { | 2605 | +- (void)setList:(CNLiveOrderList *)list { |
| 2603 | 2606 | ||
| 2604 | - CNOrderListOrderItem *item = list.orderItem; | 2607 | + CNLiveOrderListOrderItem *item = list.orderItem; |
| 2605 | NSMutableString *timeText = [[NSMutableString alloc] init]; | 2608 | NSMutableString *timeText = [[NSMutableString alloc] init]; |
| 2606 | 2609 | ||
| 2607 | //创建时间 | 2610 | //创建时间 |
| @@ -2665,9 +2668,6 @@ | @@ -2665,9 +2668,6 @@ | ||
| 2665 | 2668 | ||
| 2666 | @end | 2669 | @end |
| 2667 | 2670 | ||
| 2668 | -*/ | ||
| 2669 | - | ||
| 2670 | - | ||
| 2671 | 2671 | ||
| 2672 | 2672 | ||
| 2673 | 2673 |
CNLiveMyOrder/Classes/View/CNLiveNoOrderView.h
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | NS_ASSUME_NONNULL_BEGIN | 10 | NS_ASSUME_NONNULL_BEGIN |
| 11 | 11 | ||
| 12 | @interface CNLiveNoOrderView : UIView | 12 | @interface CNLiveNoOrderView : UIView |
| 13 | -- (void)setImageName:(NSString *)imageName title:(NSString *)title customTopH:(CGFloat)topH; | 13 | +- (void)setImageName:(UIImage *)image title:(NSString *)title customTopH:(CGFloat)topH; |
| 14 | @end | 14 | @end |
| 15 | 15 | ||
| 16 | NS_ASSUME_NONNULL_END | 16 | NS_ASSUME_NONNULL_END |
CNLiveMyOrder/Classes/View/CNLiveNoOrderView.m
| @@ -49,9 +49,9 @@ | @@ -49,9 +49,9 @@ | ||
| 49 | 49 | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | -- (void)setImageName:(NSString *)imageName title:(NSString *)title customTopH:(CGFloat)topH{ | 52 | +- (void)setImageName:(UIImage *)image title:(NSString *)title customTopH:(CGFloat)topH{ |
| 53 | self.noOrderLbl.text = title; | 53 | self.noOrderLbl.text = title; |
| 54 | - self.iconView.image = [UIImage imageNamed:imageName]; | 54 | + self.iconView.image = image; |
| 55 | 55 | ||
| 56 | if (topH) { | 56 | if (topH) { |
| 57 | [self.iconView mas_updateConstraints:^(MASConstraintMaker *make) { | 57 | [self.iconView mas_updateConstraints:^(MASConstraintMaker *make) { |
CNLiveMyOrder/Classes/View/CNLiveOrderDetailContentView.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveOrderDetailContentView.h | ||
| 3 | +// CNLiveMyOrder | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/6/17. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import <UIKit/UIKit.h> | ||
| 9 | +#import "CNLiveOrderList.h" | ||
| 10 | +NS_ASSUME_NONNULL_BEGIN | ||
| 11 | + | ||
| 12 | +@interface CNLiveOrderDetailContentView : UIView | ||
| 13 | +@property (nonatomic, strong) CNLiveOrderList *list; | ||
| 14 | + | ||
| 15 | +@end | ||
| 16 | + | ||
| 17 | +NS_ASSUME_NONNULL_END |
CNLiveMyOrder/Classes/View/CNLiveOrderDetailContentView.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveOrderDetailContentView.m | ||
| 3 | +// CNLiveMyOrder | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2019/6/17. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveOrderDetailContentView.h" | ||
| 9 | +#import "Masonry.h" | ||
| 10 | +#import "CNLiveCommonCategory.h" | ||
| 11 | +#import "CNLiveBaseKit.h" | ||
| 12 | +#define Default_Space 15 | ||
| 13 | +//25 | ||
| 14 | +#define OrderContent_H 80 | ||
| 15 | + | ||
| 16 | +@interface OrderDetailContentTitleView : UIView | ||
| 17 | +@property (nonatomic, strong) UILabel *titleLab; | ||
| 18 | +@property (nonatomic, strong) UILabel *quantityLab; | ||
| 19 | +@property (nonatomic, strong) UILabel *priceLab; | ||
| 20 | +@end | ||
| 21 | + | ||
| 22 | +@implementation OrderDetailContentTitleView | ||
| 23 | +- (void)dealloc { | ||
| 24 | + NSLog(@"OrderDetailContentTitleView dealloc走了吗"); | ||
| 25 | +} | ||
| 26 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 27 | +{ | ||
| 28 | + self = [super initWithFrame:frame]; | ||
| 29 | + if (self) { | ||
| 30 | + self.backgroundColor = [UIColor whiteColor]; | ||
| 31 | + [self addSubview:self.titleLab]; | ||
| 32 | + [self addSubview:self.quantityLab]; | ||
| 33 | + [self addSubview:self.priceLab]; | ||
| 34 | + [self p_addMasonry]; | ||
| 35 | + } | ||
| 36 | + return self; | ||
| 37 | +} | ||
| 38 | +- (void)p_addMasonry { | ||
| 39 | + | ||
| 40 | + [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 41 | + make.left.mas_equalTo(self).mas_offset(Default_Space); | ||
| 42 | + make.top.mas_equalTo(self).mas_offset(10); | ||
| 43 | + make.right.mas_equalTo(self.quantityLab.mas_left).mas_offset(-14); | ||
| 44 | + }]; | ||
| 45 | + | ||
| 46 | + [self.priceLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 47 | + make.right.mas_equalTo(self).mas_offset(-Default_Space); | ||
| 48 | + make.top.mas_equalTo(self.titleLab.mas_top); | ||
| 49 | + make.width.mas_equalTo(self.mas_width).multipliedBy(0.2); | ||
| 50 | + }]; | ||
| 51 | + | ||
| 52 | + [self.quantityLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 53 | + make.right.mas_equalTo(self.priceLab.mas_left).mas_offset(-10); | ||
| 54 | + make.top.mas_equalTo(self.titleLab.mas_top); | ||
| 55 | + make.width.mas_equalTo(self.mas_width).multipliedBy(0.2); | ||
| 56 | + }]; | ||
| 57 | + | ||
| 58 | + [self mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 59 | + make.bottom.mas_equalTo(self.titleLab.mas_bottom).mas_offset(5); | ||
| 60 | + }]; | ||
| 61 | +} | ||
| 62 | +#pragma mark - | ||
| 63 | +#pragma mark - Getter | ||
| 64 | +- (UILabel *)titleLab | ||
| 65 | +{ | ||
| 66 | + if (!_titleLab) { | ||
| 67 | + _titleLab = [[UILabel alloc] init]; | ||
| 68 | + _titleLab.text = @"种类"; | ||
| 69 | + _titleLab.font = UIFontCNMake(15); | ||
| 70 | + _titleLab.textColor = KTextBlackColor; | ||
| 71 | + _titleLab.textAlignment = NSTextAlignmentLeft; | ||
| 72 | + } | ||
| 73 | + return _titleLab; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +- (UILabel *)quantityLab | ||
| 77 | +{ | ||
| 78 | + if (!_quantityLab) { | ||
| 79 | + _quantityLab = [[UILabel alloc] init]; | ||
| 80 | + _quantityLab.text = @"数量"; | ||
| 81 | + _quantityLab.font = UIFontCNMake(15); | ||
| 82 | + _quantityLab.textColor = KTextBlackColor; | ||
| 83 | + _quantityLab.textAlignment = NSTextAlignmentCenter; | ||
| 84 | + } | ||
| 85 | + return _quantityLab; | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +- (UILabel *)priceLab | ||
| 89 | +{ | ||
| 90 | + if (!_priceLab) { | ||
| 91 | + _priceLab = [[UILabel alloc] init]; | ||
| 92 | + _priceLab.text = @"价格"; | ||
| 93 | + _priceLab.font = UIFontCNMake(15); | ||
| 94 | + _priceLab.textColor = KTextBlackColor; | ||
| 95 | + _priceLab.textAlignment = NSTextAlignmentRight; | ||
| 96 | + } | ||
| 97 | + return _priceLab; | ||
| 98 | +} | ||
| 99 | +@end | ||
| 100 | +@interface OrderDetailContentItemView : UIView | ||
| 101 | + | ||
| 102 | +@property (nonatomic, strong) UILabel *titleLab; | ||
| 103 | +@property (nonatomic, strong) UILabel *quantityLab; | ||
| 104 | +@property (nonatomic, strong) UILabel *priceLab; | ||
| 105 | +@property (nonatomic, strong) UILabel *bottomLine; | ||
| 106 | + | ||
| 107 | +@property (nonatomic, strong) CNLiveEditGoodsModel *model; | ||
| 108 | + | ||
| 109 | +@end | ||
| 110 | + | ||
| 111 | +@implementation OrderDetailContentItemView | ||
| 112 | + | ||
| 113 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 114 | +{ | ||
| 115 | + self = [super initWithFrame:frame]; | ||
| 116 | + if (self) { | ||
| 117 | + self.backgroundColor = kWhiteColor; | ||
| 118 | + [self addSubview:self.titleLab]; | ||
| 119 | + [self addSubview:self.quantityLab]; | ||
| 120 | + [self addSubview:self.priceLab]; | ||
| 121 | + [self addSubview:self.bottomLine]; | ||
| 122 | + | ||
| 123 | + [self p_addMasonry]; | ||
| 124 | + } | ||
| 125 | + return self; | ||
| 126 | +} | ||
| 127 | + | ||
| 128 | +- (void)setModel:(CNLiveEditGoodsModel *)model { | ||
| 129 | + | ||
| 130 | + _model = model; | ||
| 131 | + _titleLab.text = model.title; | ||
| 132 | + _quantityLab.text = [NSString stringWithFormat:@"x %ld", model.quantity]; | ||
| 133 | + _priceLab.text = [NSString stringWithFormat:@"¥ %.2f", model.price]; | ||
| 134 | + NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:_priceLab.text]; | ||
| 135 | + [string addAttribute:NSFontAttributeName value:UIFontCNMake(13) range:NSMakeRange(0, 1)]; | ||
| 136 | + _priceLab.attributedText = string; | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +- (void)p_addMasonry { | ||
| 140 | + | ||
| 141 | + [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 142 | + make.left.mas_equalTo(20); | ||
| 143 | + make.top.mas_equalTo(20); | ||
| 144 | + make.width.mas_equalTo(KScreenWidth - 50); | ||
| 145 | + make.height.mas_equalTo(14); | ||
| 146 | + }]; | ||
| 147 | + [self.priceLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 148 | + make.left.mas_equalTo(self.titleLab.mas_left); | ||
| 149 | + make.top.mas_equalTo(self.titleLab.mas_bottom).offset(15); | ||
| 150 | + make.width.mas_equalTo(KScreenWidth - 80); | ||
| 151 | + make.height.mas_equalTo(15); | ||
| 152 | + }]; | ||
| 153 | + | ||
| 154 | + [self.quantityLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 155 | + make.right.mas_equalTo(self.mas_right).mas_offset(-14); | ||
| 156 | + make.bottom.mas_equalTo(self.priceLab.mas_bottom); | ||
| 157 | + make.width.mas_equalTo(50); | ||
| 158 | + make.height.mas_equalTo(13); | ||
| 159 | + }]; | ||
| 160 | + [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 161 | + make.left.mas_equalTo(15); | ||
| 162 | + make.bottom.mas_equalTo(self.mas_bottom).offset(-0.5); | ||
| 163 | + make.width.mas_equalTo(KScreenWidth - 30); | ||
| 164 | + make.height.mas_equalTo(0.5); | ||
| 165 | + }]; | ||
| 166 | + return; | ||
| 167 | + [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 168 | + make.left.mas_equalTo(self).mas_offset(Default_Space); | ||
| 169 | + make.centerY.mas_equalTo(self.mas_centerY); | ||
| 170 | + make.right.mas_equalTo(self.quantityLab.mas_left).mas_offset(-10); | ||
| 171 | + }]; | ||
| 172 | + | ||
| 173 | + [self.priceLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 174 | + make.right.mas_equalTo(self).mas_offset(-Default_Space); | ||
| 175 | + make.centerY.mas_equalTo(self.mas_centerY); | ||
| 176 | + make.width.mas_equalTo(self.mas_width).multipliedBy(0.2); | ||
| 177 | + }]; | ||
| 178 | + | ||
| 179 | + [self.quantityLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 180 | + make.right.mas_equalTo(self.priceLab.mas_left).mas_offset(-10); | ||
| 181 | + make.centerY.mas_equalTo(self.mas_centerY); | ||
| 182 | + make.width.mas_equalTo(self.mas_width).multipliedBy(0.2); | ||
| 183 | + }]; | ||
| 184 | + | ||
| 185 | +} | ||
| 186 | + | ||
| 187 | +#pragma mark - | ||
| 188 | +#pragma mark - Getter | ||
| 189 | +- (UILabel *)titleLab | ||
| 190 | +{ | ||
| 191 | + if (!_titleLab) { | ||
| 192 | + _titleLab = [[UILabel alloc] init]; | ||
| 193 | + _titleLab.font = UIFontCNMake(15); | ||
| 194 | + _titleLab.textColor = KGray101Color; | ||
| 195 | + _titleLab.textAlignment = NSTextAlignmentLeft; | ||
| 196 | + } | ||
| 197 | + return _titleLab; | ||
| 198 | +} | ||
| 199 | + | ||
| 200 | +- (UILabel *)quantityLab | ||
| 201 | +{ | ||
| 202 | + if (!_quantityLab) { | ||
| 203 | + _quantityLab = [[UILabel alloc] init]; | ||
| 204 | + _quantityLab.font = UIFontCNMake(15); | ||
| 205 | + _quantityLab.textColor = KGray101Color; | ||
| 206 | + _quantityLab.textAlignment = NSTextAlignmentCenter; | ||
| 207 | + } | ||
| 208 | + return _quantityLab; | ||
| 209 | +} | ||
| 210 | + | ||
| 211 | +- (UILabel *)priceLab | ||
| 212 | +{ | ||
| 213 | + if (!_priceLab) { | ||
| 214 | + _priceLab = [[UILabel alloc] init]; | ||
| 215 | + _priceLab.font = UIFontCNMake(15); | ||
| 216 | + _priceLab.textColor = KGray101Color; | ||
| 217 | + _priceLab.textAlignment = NSTextAlignmentLeft; | ||
| 218 | + } | ||
| 219 | + return _priceLab; | ||
| 220 | +} | ||
| 221 | +- (UILabel *)bottomLine | ||
| 222 | +{ | ||
| 223 | + if (!_bottomLine) { | ||
| 224 | + _bottomLine = [[UILabel alloc] init]; | ||
| 225 | + _bottomLine.backgroundColor = KGray227Color; | ||
| 226 | + } | ||
| 227 | + return _bottomLine; | ||
| 228 | +} | ||
| 229 | +@end | ||
| 230 | +@interface OrderDetailContentCollectView : UIView | ||
| 231 | +@property (nonatomic, strong) NSMutableArray *modelArr; | ||
| 232 | +@property (nonatomic ,strong) NSArray <CNLiveEditGoodsModel *><CNLiveEditGoodsModel>* goodsInfo; | ||
| 233 | + | ||
| 234 | +@end | ||
| 235 | + | ||
| 236 | +@implementation OrderDetailContentCollectView | ||
| 237 | + | ||
| 238 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 239 | +{ | ||
| 240 | + self = [super initWithFrame:frame]; | ||
| 241 | + if (self) { | ||
| 242 | + self.backgroundColor = kWhiteColor; | ||
| 243 | + } | ||
| 244 | + return self; | ||
| 245 | +} | ||
| 246 | + | ||
| 247 | +- (void)setModelArr:(NSMutableArray *)modelArr { | ||
| 248 | + | ||
| 249 | + __block OrderDetailContentItemView *tempView; | ||
| 250 | + | ||
| 251 | + for (int i = 0 ; i < modelArr.count; i ++ ) { | ||
| 252 | + | ||
| 253 | + OrderDetailContentItemView *contentView = [[OrderDetailContentItemView alloc] init]; | ||
| 254 | + contentView.model = (CNLiveEditGoodsModel *)modelArr[i]; | ||
| 255 | + [self addSubview:contentView]; | ||
| 256 | + | ||
| 257 | + [contentView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 258 | + make.left.right.mas_equalTo(self); | ||
| 259 | + make.height.mas_equalTo(OrderContent_H); | ||
| 260 | + if (tempView) { | ||
| 261 | + make.top.mas_equalTo(contentView.mas_bottom); | ||
| 262 | + } else { | ||
| 263 | + make.top.mas_equalTo(0); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + tempView = contentView; | ||
| 267 | + | ||
| 268 | + }]; | ||
| 269 | + | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + [self mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 273 | + make.height.mas_equalTo(OrderContent_H*modelArr.count); | ||
| 274 | + }]; | ||
| 275 | +} | ||
| 276 | + | ||
| 277 | +- (void)setGoodsInfo:(NSArray <CNLiveEditGoodsModel *><CNLiveEditGoodsModel> *)goodsInfo { | ||
| 278 | + | ||
| 279 | + __block OrderDetailContentItemView *tempView; | ||
| 280 | + | ||
| 281 | + for (int i = 0 ; i < goodsInfo.count; i ++ ) { | ||
| 282 | + | ||
| 283 | + OrderDetailContentItemView *contentView = [[OrderDetailContentItemView alloc] init]; | ||
| 284 | + contentView.model = (CNLiveEditGoodsModel *)goodsInfo[i]; | ||
| 285 | + [self addSubview:contentView]; | ||
| 286 | + | ||
| 287 | + [contentView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 288 | + make.left.right.mas_equalTo(self); | ||
| 289 | + make.height.mas_equalTo(OrderContent_H); | ||
| 290 | + if (tempView) { | ||
| 291 | + make.top.mas_equalTo(tempView.mas_bottom); | ||
| 292 | + } else { | ||
| 293 | + make.top.mas_equalTo(0); | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + tempView = contentView; | ||
| 297 | + | ||
| 298 | + }]; | ||
| 299 | + | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + [self mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 303 | + make.height.mas_equalTo(OrderContent_H*[goodsInfo count]); | ||
| 304 | + }]; | ||
| 305 | +} | ||
| 306 | + | ||
| 307 | +@end | ||
| 308 | +@interface CNLiveOrderDetailContentView () | ||
| 309 | + | ||
| 310 | +@property (nonatomic, strong) UILabel *titleLab; | ||
| 311 | +@property (nonatomic, strong) UIView *line; | ||
| 312 | +@property (nonatomic, strong) OrderDetailContentTitleView *contentTitleView; | ||
| 313 | +@property (nonatomic, strong) OrderDetailContentCollectView *contentCollectView; | ||
| 314 | + | ||
| 315 | + | ||
| 316 | +@end | ||
| 317 | + | ||
| 318 | +@implementation CNLiveOrderDetailContentView | ||
| 319 | + | ||
| 320 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 321 | +{ | ||
| 322 | + self = [super initWithFrame:frame]; | ||
| 323 | + if (self) { | ||
| 324 | + self.backgroundColor = kWhiteColor; | ||
| 325 | + [self addSubview:self.titleLab]; | ||
| 326 | + [self addSubview:self.line]; | ||
| 327 | + // [self addSubview:self.contentTitleView]; | ||
| 328 | + [self addSubview:self.contentCollectView]; | ||
| 329 | + [self p_addMasonry]; | ||
| 330 | + } | ||
| 331 | + return self; | ||
| 332 | +} | ||
| 333 | + | ||
| 334 | +- (void)setList:(CNLiveOrderList *)list { | ||
| 335 | + CNLiveOrderListOrderItem *orderItem = list.orderItem; | ||
| 336 | + | ||
| 337 | + if ([orderItem.goodsInfo count] > 0) { | ||
| 338 | + _contentCollectView.goodsInfo = orderItem.goodsInfo; | ||
| 339 | + } else { | ||
| 340 | + NSMutableArray *modelArr = [[NSMutableArray alloc] init]; | ||
| 341 | + CNLiveEditGoodsModel *goodsModel = [[CNLiveEditGoodsModel alloc] init]; | ||
| 342 | + goodsModel.title = orderItem.title; | ||
| 343 | + goodsModel.quantity = orderItem.quantity; | ||
| 344 | + goodsModel.price = orderItem.price; | ||
| 345 | + [modelArr addObject:goodsModel]; | ||
| 346 | + _contentCollectView.modelArr = modelArr; | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + [self mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 350 | + make.bottom.mas_equalTo(self.contentCollectView.mas_bottom).mas_offset(5); | ||
| 351 | + }]; | ||
| 352 | +} | ||
| 353 | + | ||
| 354 | +- (void)p_addMasonry { | ||
| 355 | + | ||
| 356 | + [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 357 | + make.left.mas_equalTo(self).mas_offset(15); | ||
| 358 | + make.top.mas_equalTo(self).mas_offset(15); | ||
| 359 | + }]; | ||
| 360 | + | ||
| 361 | + [self.line mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 362 | + make.top.mas_equalTo(self.titleLab.mas_bottom).mas_offset(15); | ||
| 363 | + make.left.mas_equalTo(10); | ||
| 364 | + make.width.mas_equalTo(KScreenWidth-20); | ||
| 365 | + make.height.mas_equalTo(0.5); | ||
| 366 | + }]; | ||
| 367 | + | ||
| 368 | + | ||
| 369 | + [self.contentCollectView mas_remakeConstraints:^(MASConstraintMaker *make) { | ||
| 370 | + make.top.mas_equalTo(self.line.mas_bottom); | ||
| 371 | + make.left.right.mas_equalTo(self); | ||
| 372 | + }]; | ||
| 373 | +} | ||
| 374 | + | ||
| 375 | +#pragma mark - | ||
| 376 | +#pragma mark - Getter | ||
| 377 | +- (OrderDetailContentTitleView *)contentTitleView | ||
| 378 | +{ | ||
| 379 | + if (!_contentTitleView) { | ||
| 380 | + _contentTitleView = [[OrderDetailContentTitleView alloc] init]; | ||
| 381 | + } | ||
| 382 | + return _contentTitleView; | ||
| 383 | +} | ||
| 384 | + | ||
| 385 | +- (OrderDetailContentCollectView *)contentCollectView | ||
| 386 | +{ | ||
| 387 | + if (!_contentCollectView) { | ||
| 388 | + _contentCollectView = [[OrderDetailContentCollectView alloc] init]; | ||
| 389 | + } | ||
| 390 | + return _contentCollectView; | ||
| 391 | +} | ||
| 392 | + | ||
| 393 | +- (UILabel *)titleLab | ||
| 394 | +{ | ||
| 395 | + if (!_titleLab) { | ||
| 396 | + _titleLab = [[UILabel alloc] init]; | ||
| 397 | + _titleLab.textColor = KTextBlackColor; | ||
| 398 | + _titleLab.font = UIFontCNMake(15); | ||
| 399 | + _titleLab.text = @"商品信息"; | ||
| 400 | + } | ||
| 401 | + return _titleLab; | ||
| 402 | +} | ||
| 403 | +- (UIView *)line | ||
| 404 | +{ | ||
| 405 | + if (!_line) { | ||
| 406 | + _line = [[UIView alloc] init]; | ||
| 407 | + _line.backgroundColor = KCommonLineColor; | ||
| 408 | + } | ||
| 409 | + return _line; | ||
| 410 | +} | ||
| 411 | +@end | ||
| 412 | + | ||
| 413 | + | ||
| 414 | + | ||
| 415 | + | ||
| 416 | + |
CNLiveMyOrder/Classes/View/CNLiveOrderEventHandle.h
| @@ -6,10 +6,75 @@ | @@ -6,10 +6,75 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | #import <Foundation/Foundation.h> | 8 | #import <Foundation/Foundation.h> |
| 9 | +#import "CNLiveOrderList.h" | ||
| 10 | +#import "CNLiveAdminAddressModel.h" | ||
| 11 | +typedef void(^PayBlock)(int code); | ||
| 9 | 12 | ||
| 10 | NS_ASSUME_NONNULL_BEGIN | 13 | NS_ASSUME_NONNULL_BEGIN |
| 11 | 14 | ||
| 12 | @interface CNLiveOrderEventHandle : NSObject | 15 | @interface CNLiveOrderEventHandle : NSObject |
| 16 | +/** | ||
| 17 | +* 提交订单 | ||
| 18 | +*/ | ||
| 19 | ++ (void)submitOrder:(CNLiveOrderList *)orderList address:(CNLiveAdminAddressModel *)model superView:(UIView *)view complete:(void(^)(BOOL ret))complete; | ||
| 20 | +/** | ||
| 21 | + * 删除订单 | ||
| 22 | + */ | ||
| 23 | ++ (void)deleteOrder:(CNLiveOrderList *)orderList itemId:(NSString *)itemId superView:(UIView *)view complete:(void(^)(BOOL ret))complete; | ||
| 24 | +/** | ||
| 25 | + * 催单 | ||
| 26 | + */ | ||
| 27 | ++ (void)reminderOrder:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void(^)(NSString *msg))complete; | ||
| 28 | +/** | ||
| 29 | + * 联系达人 | ||
| 30 | + */ | ||
| 31 | ++ (void)contactUser:(CNLiveOrderList *)orderList pop:(BOOL)pop; | ||
| 32 | +/** | ||
| 33 | + * 退款详情 | ||
| 34 | + */ | ||
| 35 | ++ (void)refundDetail:(CNLiveOrderList *)orderList; | ||
| 36 | +/** | ||
| 37 | + * 订单详情 | ||
| 38 | + */ | ||
| 39 | ++ (void)orderDetail:(CNLiveOrderList *)orderList orderBlock:(void (^)(NSString *orderId))orderBlock; | ||
| 40 | +/** | ||
| 41 | + * 订单详情 | ||
| 42 | + */ | ||
| 43 | ++ (void)orderDetailByOrderId:(NSString *)orderId; | ||
| 44 | +/** | ||
| 45 | + * 申请退款 | ||
| 46 | + */ | ||
| 47 | ++ (void)applyForRefund:(CNLiveOrderList *)orderList; | ||
| 48 | +/** | ||
| 49 | + * 确认收货 | ||
| 50 | + */ | ||
| 51 | ++ (void)confirmRecv:(CNLiveOrderList *)orderList itemId:(NSString *)itemId superView:(UIView *)view complete:(void(^)(BOOL ret))complete; | ||
| 52 | +/** | ||
| 53 | + * 取消订单 | ||
| 54 | + */ | ||
| 55 | ++ (void)cancelOrder:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void(^)(BOOL ret))complete; | ||
| 56 | +/** | ||
| 57 | + * 订单有误 | ||
| 58 | + */ | ||
| 59 | ++ (void)orderError:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void(^)(BOOL ret))complete; | ||
| 60 | +/** | ||
| 61 | + * 确认订单 | ||
| 62 | + */ | ||
| 63 | ++ (void)confirmOrder:(CNLiveOrderList *)orderList superView:(UIView *)view complete:(void(^)(BOOL ret))complete; | ||
| 64 | +/** | ||
| 65 | + * 评论订单 | ||
| 66 | + */ | ||
| 67 | ++ (void)evaluateOrder:(CNLiveOrderList *)orderList; | ||
| 68 | +/** | ||
| 69 | + * 达人主页 | ||
| 70 | + */ | ||
| 71 | ++ (void)darenHome:(CNLiveOrderList *)orderList; | ||
| 72 | + | ||
| 73 | +/** | ||
| 74 | + * 去支付 | ||
| 75 | + */ | ||
| 76 | ++ (void)pay:(CNLiveOrderList *)orderList payBlock:(PayBlock)block; | ||
| 77 | + | ||
| 13 | 78 | ||
| 14 | @end | 79 | @end |
| 15 | 80 |
CNLiveMyOrder/Classes/View/CNLiveOrderEventHandle.m
| @@ -6,7 +6,70 @@ | @@ -6,7 +6,70 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | #import "CNLiveOrderEventHandle.h" | 8 | #import "CNLiveOrderEventHandle.h" |
| 9 | - | 9 | +#import "CNLiveOrderListOrderItem.h" |
| 10 | +#import "QMUIKit.h" | ||
| 11 | +#import "MJExtension.h" | ||
| 12 | +#import "DSAddressModel.h" | ||
| 13 | +#import <CNLiveRequestBastKit/CNLiveNetworking.h> | ||
| 14 | +#import "CNLiveEnvironmentConfiguration.h" | ||
| 10 | @implementation CNLiveOrderEventHandle | 15 | @implementation CNLiveOrderEventHandle |
| 11 | 16 | ||
| 17 | +//订单详情 | ||
| 18 | ++ (void)orderDetail:(CNLiveOrderList *)orderList orderBlock:(void (^)(NSString * _Nonnull))orderBlock{ | ||
| 19 | + CNLiveOrderListOrderItem *item = orderList.orderItem; | ||
| 20 | + | ||
| 21 | + if (orderBlock) { | ||
| 22 | + orderBlock(item.orderId); | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | ++(void)submitOrder:(CNLiveOrderList *)orderList address:(DSAddressModel *)model superView:(UIView *)view complete:(void (^)(BOOL))complete { | ||
| 26 | + [QMUITips showLoadingInView:view]; | ||
| 27 | + CNLiveOrderListOrderItem *orderItem = orderList.orderItem; | ||
| 28 | + | ||
| 29 | + NSMutableArray *jsonArr = [[NSMutableArray alloc] init]; | ||
| 30 | + | ||
| 31 | + for (CNLiveEditGoodsModel *goodsModel in orderList.orderItem.goodsInfo) { | ||
| 32 | + | ||
| 33 | + NSDictionary *goodsDic = @{@"price":[NSString stringWithFormat:@"%.2f",goodsModel.price], | ||
| 34 | + @"title":goodsModel.title, | ||
| 35 | + @"quantity":[NSString stringWithFormat:@"%ld",goodsModel.quantity], | ||
| 36 | + @"goodsId":@"" | ||
| 37 | + }; | ||
| 38 | + [jsonArr addObject:goodsDic]; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + NSString *jsonStr = [jsonArr mj_JSONString]; | ||
| 42 | + | ||
| 43 | + NSDictionary *param = @{@"orderId":orderItem.orderId, | ||
| 44 | + @"category":orderItem.category, | ||
| 45 | + @"fee":[NSString stringWithFormat:@"%.2f", orderItem.fee], | ||
| 46 | + @"freight":[NSString stringWithFormat:@"%.2f", orderItem.freight], | ||
| 47 | + @"contactName":model.name, | ||
| 48 | + @"contactPhone":model.phone, | ||
| 49 | + @"contactAddress":model.address, | ||
| 50 | + @"goodsInfo":jsonStr | ||
| 51 | + }; | ||
| 52 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNOrderModifyUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 53 | + | ||
| 54 | + }]; | ||
| 55 | +} | ||
| 56 | ++ (void)deleteOrder:(CNLiveOrderList *)orderList itemId:(NSString *)itemId superView:(UIView *)view complete:(void (^)(BOOL))complete { | ||
| 57 | + [QMUITips showLoadingInView:view]; | ||
| 58 | + | ||
| 59 | + CNLiveOrderListOrderItem *orderItem = orderList.orderItem; | ||
| 60 | + | ||
| 61 | + NSDictionary *param = @{@"appId":AppId, | ||
| 62 | + @"plat":@"i", | ||
| 63 | + @"sid":@"10511059", | ||
| 64 | + @"orderId":orderItem.orderId ?: @""}; | ||
| 65 | + | ||
| 66 | + NSMutableDictionary *newParam = [[NSMutableDictionary alloc] initWithDictionary:param]; | ||
| 67 | + if (itemId) { | ||
| 68 | + [newParam setObject:itemId forKey:@"itemId"]; | ||
| 69 | + } | ||
| 70 | + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNDeleteOrderUrl Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | ||
| 71 | + | ||
| 72 | + }]; | ||
| 73 | +} | ||
| 12 | @end | 74 | @end |
| 75 | + |
CNLiveMyOrder/Classes/View/CNLiveOrderListCommonView.h
| @@ -6,13 +6,11 @@ | @@ -6,13 +6,11 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | #import <UIKit/UIKit.h> | 8 | #import <UIKit/UIKit.h> |
| 9 | - | ||
| 10 | NS_ASSUME_NONNULL_BEGIN | 9 | NS_ASSUME_NONNULL_BEGIN |
| 11 | - | ||
| 12 | @interface CNLiveOrderListCommonView : UIView | 10 | @interface CNLiveOrderListCommonView : UIView |
| 13 | //订单状态 0-全部,1-代付款,2-待收货,3-待评价,4-全部退款 ,5退款中 | 11 | //订单状态 0-全部,1-代付款,2-待收货,3-待评价,4-全部退款 ,5退款中 |
| 14 | - (instancetype)initWithFrame:(CGRect)frame orderStatus:(NSString *)status; | 12 | - (instancetype)initWithFrame:(CGRect)frame orderStatus:(NSString *)status; |
| 15 | - | 13 | +@property (nonatomic, copy) void (^orderDetaielCellDidSelectedBlock) (NSIndexPath *indexPath,NSString *orderId); //cell被选中 |
| 16 | - (void)refreshData; | 14 | - (void)refreshData; |
| 17 | @end | 15 | @end |
| 18 | 16 |
CNLiveMyOrder/Classes/View/CNLiveOrderListCommonView.m
| @@ -19,14 +19,17 @@ | @@ -19,14 +19,17 @@ | ||
| 19 | #import "MJExtension.h" | 19 | #import "MJExtension.h" |
| 20 | #import "CNLiveEnvironmentConfiguration.h" | 20 | #import "CNLiveEnvironmentConfiguration.h" |
| 21 | #import "CNUserInfoManager.h" | 21 | #import "CNUserInfoManager.h" |
| 22 | +#import "TIMAdapter.h" | ||
| 23 | +#import "CommonLibrary.h" | ||
| 24 | +#import "CNLiveGetImage.h" | ||
| 22 | @interface CNLiveOrderListCommonView ()<UITableViewDelegate,UITableViewDataSource,CNLiveMineOrderTableViewCellDelegate> { | 25 | @interface CNLiveOrderListCommonView ()<UITableViewDelegate,UITableViewDataSource,CNLiveMineOrderTableViewCellDelegate> { |
| 23 | -NSString *_status; //订单状态 0-全部,1-代付款,2-待收货,3-待评价,4-全部退款 ,5退款中(全部只返回123数据) | ||
| 24 | -NSInteger _page; | ||
| 25 | -BOOL _next; | ||
| 26 | } | 26 | } |
| 27 | @property (nonatomic, strong) NSMutableArray *listArr; //数据源 | 27 | @property (nonatomic, strong) NSMutableArray *listArr; //数据源 |
| 28 | @property (nonatomic, strong) UITableView *tableView; | 28 | @property (nonatomic, strong) UITableView *tableView; |
| 29 | @property (nonatomic, strong) CNLiveNoOrderView *noDataView; | 29 | @property (nonatomic, strong) CNLiveNoOrderView *noDataView; |
| 30 | +@property (nonatomic, copy) NSString *status; //订单状态 0-全部,1-代付款,2-待收货,3-待评价,4-全部退款 ,5退款中(全部只返回123数据) | ||
| 31 | +@property (nonatomic, assign) NSInteger page; | ||
| 32 | +@property (nonatomic, assign) BOOL next; | ||
| 30 | @end | 33 | @end |
| 31 | 34 | ||
| 32 | @implementation CNLiveOrderListCommonView | 35 | @implementation CNLiveOrderListCommonView |
| @@ -49,7 +52,7 @@ BOOL _next; | @@ -49,7 +52,7 @@ BOOL _next; | ||
| 49 | } | 52 | } |
| 50 | 53 | ||
| 51 | - (void)requestDataWithPage:(NSInteger)page refresh:(BOOL)refresh { | 54 | - (void)requestDataWithPage:(NSInteger)page refresh:(BOOL)refresh { |
| 52 | - | 55 | + __weak typeof(self) weakSelf = self; |
| 53 | [QMUITips showLoadingInView:self]; | 56 | [QMUITips showLoadingInView:self]; |
| 54 | NSDictionary *param = @{@"appId":AppId, | 57 | NSDictionary *param = @{@"appId":AppId, |
| 55 | @"sid":@"10511059", | 58 | @"sid":@"10511059", |
| @@ -139,19 +142,24 @@ BOOL _next; | @@ -139,19 +142,24 @@ BOOL _next; | ||
| 139 | 142 | ||
| 140 | switch (status) { | 143 | switch (status) { |
| 141 | case 0: | 144 | case 0: |
| 142 | - [self.noDataView setImageName:@"dd_quanbumeiyou" title:@"目前没有订单" customTopH:0]; | 145 | +// [self.noDataView setImageName:[UIImage imageNamed:@"dd_quanbumeiyou"] title:@"目前没有订单" customTopH:0]; |
| 146 | + [self.noDataView setImageName:[CNLiveGetImage cnliveGetImageWithName:@"dd_quanbumeiyou" bundle:@"CNLiveMyOrder.bundle/CNLiveMyOrder" targetClass:[self class]] title:@"目前没有订单" customTopH:0]; | ||
| 147 | + | ||
| 143 | break; | 148 | break; |
| 144 | 149 | ||
| 145 | case 1: | 150 | case 1: |
| 146 | - [self.noDataView setImageName:@"dd_wufukuan" title:@"目前没有订单需要付款" customTopH:0]; | 151 | +// [self.noDataView setImageName:[UIImage imageNamed:@"dd_wufukuan"] title:@"目前没有订单需要付款" customTopH:0]; |
| 152 | + [self.noDataView setImageName:[CNLiveGetImage cnliveGetImageWithName:@"dd_wufukuan" bundle:@"CNLiveMyOrder.bundle/CNLiveMyOrder" targetClass:[self class]] title:@"目前没有订单需要付款" customTopH:0]; | ||
| 147 | break; | 153 | break; |
| 148 | 154 | ||
| 149 | case 2: | 155 | case 2: |
| 150 | - [self.noDataView setImageName:@"dd_wushouhuo" title:@"目前没有订单需要收货" customTopH:0]; | 156 | +// [self.noDataView setImageName:[UIImage imageNamed:@"dd_wushouhuo"] title:@"目前没有订单需要收货" customTopH:0]; |
| 157 | + [self.noDataView setImageName:[CNLiveGetImage cnliveGetImageWithName:@"dd_wushouhuo" bundle:@"CNLiveMyOrder.bundle/CNLiveMyOrder" targetClass:[self class]] title:@"目前没有订单需要收货" customTopH:0]; | ||
| 151 | break; | 158 | break; |
| 152 | 159 | ||
| 153 | case 3: | 160 | case 3: |
| 154 | - [self.noDataView setImageName:@"dd_wupingjia" title:@"目前没有订单需要评价" customTopH:0]; | 161 | +// [self.noDataView setImageName:[UIImage imageNamed:@"dd_wupingjia"] title:@"目前没有订单需要评价" customTopH:0]; |
| 162 | + [self.noDataView setImageName:[CNLiveGetImage cnliveGetImageWithName:@"dd_wupingjia" bundle:@"CNLiveMyOrder.bundle/CNLiveMyOrder" targetClass:[self class]] title:@"目前没有订单需要评价" customTopH:0]; | ||
| 155 | break; | 163 | break; |
| 156 | default: | 164 | default: |
| 157 | break; | 165 | break; |
| @@ -162,92 +170,80 @@ BOOL _next; | @@ -162,92 +170,80 @@ BOOL _next; | ||
| 162 | #pragma mark - | 170 | #pragma mark - |
| 163 | #pragma mark - CNMineOrderTableViewCellDelegate | 171 | #pragma mark - CNMineOrderTableViewCellDelegate |
| 164 | - (void)cellWithOrderModel:(CNLiveOrderList *)model type:(CNLiveMineOrderButtonItemType)type { | 172 | - (void)cellWithOrderModel:(CNLiveOrderList *)model type:(CNLiveMineOrderButtonItemType)type { |
| 165 | - /* | 173 | + |
| 166 | 174 | ||
| 167 | switch (type) { | 175 | switch (type) { |
| 168 | case CNLiveMineOrderButtonItemTypeCancel: { //取消订单 | 176 | case CNLiveMineOrderButtonItemTypeCancel: { //取消订单 |
| 169 | - [CNLiveOrderEventHandle cancelOrder:model superView:self complete:^(BOOL ret) { | ||
| 170 | - if (ret) { | ||
| 171 | - [self refreshData]; | ||
| 172 | - } | ||
| 173 | - }]; | 177 | +// [CNLiveOrderEventHandle cancelOrder:model superView:self complete:^(BOOL ret) { |
| 178 | +// if (ret) { | ||
| 179 | +// [self refreshData]; | ||
| 180 | +// } | ||
| 181 | +// }]; | ||
| 174 | } | 182 | } |
| 175 | break; | 183 | break; |
| 176 | 184 | ||
| 177 | case CNLiveMineOrderButtonItemTypeEvaluate: { //评价订单 | 185 | case CNLiveMineOrderButtonItemTypeEvaluate: { //评价订单 |
| 178 | 186 | ||
| 179 | - [CNLiveOrderEventHandle evaluateOrder:model]; | 187 | +// [CNLiveOrderEventHandle evaluateOrder:model]; |
| 180 | 188 | ||
| 181 | } | 189 | } |
| 182 | break; | 190 | break; |
| 183 | 191 | ||
| 184 | case CNLiveMineOrderButtonItemTypeDelete: { //删除订单 | 192 | case CNLiveMineOrderButtonItemTypeDelete: { //删除订单 |
| 185 | 193 | ||
| 186 | - [CNOrderEventHandle deleteOrder:model itemId:nil superView:self complete:^(BOOL ret) { | 194 | + [CNLiveOrderEventHandle deleteOrder:model itemId:nil superView:self complete:^(BOOL ret) { |
| 187 | if (ret == YES) { | 195 | if (ret == YES) { |
| 188 | [self refreshData]; | 196 | [self refreshData]; |
| 189 | } | 197 | } |
| 190 | }]; | 198 | }]; |
| 191 | - | ||
| 192 | - // [CNOrderEventHandle deleteOrder:model superView:self complete:^(BOOL ret) { | ||
| 193 | - // | ||
| 194 | - // if (ret == YES) { | ||
| 195 | - // [self refreshData]; | ||
| 196 | - // } | ||
| 197 | - // }]; | 199 | + |
| 198 | } | 200 | } |
| 199 | break; | 201 | break; |
| 200 | 202 | ||
| 201 | - case CNMineOrderButtonItemTypeContactDaRen: { //联系达人 | ||
| 202 | - [CNOrderEventHandle contactUser:model pop:NO]; | 203 | + case CNLiveMineOrderButtonItemTypeContactDaRen: { //联系达人 |
| 204 | +// [CNOrderEventHandle contactUser:model pop:NO]; | ||
| 203 | } | 205 | } |
| 204 | break; | 206 | break; |
| 205 | 207 | ||
| 206 | - case CNMineOrderButtonItemTypePay: { //去付款 | 208 | + case CNLiveMineOrderButtonItemTypePay: { //去付款 |
| 207 | weakself | 209 | weakself |
| 208 | - [CNOrderEventHandle pay:model payBlock:^(int code) { | ||
| 209 | - if (code == 0) { | ||
| 210 | - //支付成功 | ||
| 211 | - [weakSelf refreshData]; | ||
| 212 | - } | ||
| 213 | - }]; | 210 | +// [CNOrderEventHandle pay:model payBlock:^(int code) { |
| 211 | +// if (code == 0) { | ||
| 212 | +// //支付成功 | ||
| 213 | +// [weakSelf refreshData]; | ||
| 214 | +// } | ||
| 215 | +// }]; | ||
| 214 | } | 216 | } |
| 215 | break; | 217 | break; |
| 216 | 218 | ||
| 217 | - case CNMineOrderButtonItemTypeReminder: { //催单 | ||
| 218 | - [CNOrderEventHandle reminderOrder:model superView:self complete:^(NSString *msg) { | ||
| 219 | - [[HUDHelper sharedInstance] tipMessage:msg]; | ||
| 220 | - }]; | 219 | + case CNLiveMineOrderButtonItemTypeReminder: { //催单 |
| 220 | +// [CNOrderEventHandle reminderOrder:model superView:self complete:^(NSString *msg) { | ||
| 221 | +// [[HUDHelper sharedInstance] tipMessage:msg]; | ||
| 222 | +// }]; | ||
| 221 | } | 223 | } |
| 222 | break; | 224 | break; |
| 223 | 225 | ||
| 224 | - case CNMineOrderButtonItemTypeRefund: { //申请退款 | ||
| 225 | - [CNOrderEventHandle applyForRefund:model]; | 226 | + case CNLiveMineOrderButtonItemTypeRefund: { //申请退款 |
| 227 | +// [CNOrderEventHandle applyForRefund:model]; | ||
| 226 | } | 228 | } |
| 227 | break; | 229 | break; |
| 228 | 230 | ||
| 229 | - case CNMineOrderButtonItemTypeRefundDetail: { //退款详情 | ||
| 230 | - [CNOrderEventHandle refundDetail:model]; | 231 | + case CNLiveMineOrderButtonItemTypeRefundDetail: { //退款详情 |
| 232 | +// [CNOrderEventHandle refundDetail:model]; | ||
| 231 | } | 233 | } |
| 232 | break; | 234 | break; |
| 233 | 235 | ||
| 234 | - case CNMineOrderButtonItemTypeConfirmReceipt: { //确认收货 | 236 | + case CNLiveMineOrderButtonItemTypeConfirmReceipt: { //确认收货 |
| 235 | 237 | ||
| 236 | - [CNOrderEventHandle confirmRecv:model itemId:nil superView:self complete:^(BOOL ret) { | ||
| 237 | - if (ret) { | ||
| 238 | - [self refreshData]; | ||
| 239 | - } | ||
| 240 | - }]; | ||
| 241 | - | ||
| 242 | - // [CNOrderEventHandle confirmRecv:model superView:self complete:^(BOOL ret) { | ||
| 243 | - // if (ret) { | ||
| 244 | - // [self requestDataWithPage:0 refresh:YES]; | ||
| 245 | - // } | ||
| 246 | - // }]; | 238 | +// [CNOrderEventHandle confirmRecv:model itemId:nil superView:self complete:^(BOOL ret) { |
| 239 | +// if (ret) { | ||
| 240 | +// [self refreshData]; | ||
| 241 | +// } | ||
| 242 | +// }]; | ||
| 247 | } | 243 | } |
| 248 | break; | 244 | break; |
| 249 | 245 | ||
| 250 | - case CNMineOrderButtonItemTypeConfirmLogistics: { //查看物流 | 246 | + case CNLiveMineOrderButtonItemTypeConfirmLogistics: { //查看物流 |
| 251 | 247 | ||
| 252 | } | 248 | } |
| 253 | break; | 249 | break; |
| @@ -255,7 +251,6 @@ BOOL _next; | @@ -255,7 +251,6 @@ BOOL _next; | ||
| 255 | default: | 251 | default: |
| 256 | break; | 252 | break; |
| 257 | } | 253 | } |
| 258 | - */ | ||
| 259 | 254 | ||
| 260 | } | 255 | } |
| 261 | 256 | ||
| @@ -285,12 +280,16 @@ BOOL _next; | @@ -285,12 +280,16 @@ BOOL _next; | ||
| 285 | 280 | ||
| 286 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | 281 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
| 287 | [self.tableView qmui_clearsSelection]; | 282 | [self.tableView qmui_clearsSelection]; |
| 283 | + | ||
| 288 | CNLiveMineOrderTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; | 284 | CNLiveMineOrderTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; |
| 289 | -// [CNLiveOrderEventHandle orderDetail:cell.list]; | 285 | + [CNLiveOrderEventHandle orderDetail:cell.list orderBlock:^(NSString * _Nonnull orderId) { |
| 286 | + if (self.orderDetaielCellDidSelectedBlock) { | ||
| 287 | + self.orderDetaielCellDidSelectedBlock(indexPath, orderId); | ||
| 288 | + } | ||
| 289 | + }]; | ||
| 290 | +// | ||
| 290 | 291 | ||
| 291 | } | 292 | } |
| 292 | - | ||
| 293 | - | ||
| 294 | #pragma mark - | 293 | #pragma mark - |
| 295 | #pragma mark - Getter | 294 | #pragma mark - Getter |
| 296 | - (NSMutableArray *)listArr | 295 | - (NSMutableArray *)listArr |
CNLiveMyOrder/Classes/View/CNPopupTableViewCell.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNPopupTableViewCell.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 2018/1/10. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | +#import "CNAddPopFuncView.h" | ||
| 11 | + | ||
| 12 | +@interface CNPopupTableViewCell : UITableViewCell | ||
| 13 | + | ||
| 14 | +@property (nonatomic, strong) CNAddPopFuncItem *item; | ||
| 15 | + | ||
| 16 | ++ (instancetype)cellWithTableView:(UITableView *)tableView; | ||
| 17 | + | ||
| 18 | +@end |
CNLiveMyOrder/Classes/View/CNPopupTableViewCell.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNPopupTableViewCell.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 2018/1/10. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNPopupTableViewCell.h" | ||
| 10 | +#import "CNLiveBaseKit.h" | ||
| 11 | +#import "Masonry.h" | ||
| 12 | +@interface CNPopupTableViewCell () | ||
| 13 | + | ||
| 14 | +@property (nonatomic, strong) UILabel *titleLab; | ||
| 15 | +@property (nonatomic, strong) UIImageView *iconImg; | ||
| 16 | + | ||
| 17 | +@end | ||
| 18 | + | ||
| 19 | +@implementation CNPopupTableViewCell | ||
| 20 | + | ||
| 21 | ++ (instancetype)cellWithTableView:(UITableView *)tableView { | ||
| 22 | + | ||
| 23 | + static NSString *indentify = @"CNPopupTableViewCell"; | ||
| 24 | + | ||
| 25 | + CNPopupTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentify]; | ||
| 26 | + if (!cell) { | ||
| 27 | + cell = [[CNPopupTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indentify]; | ||
| 28 | + cell.contentView.userInteractionEnabled = YES; | ||
| 29 | + | ||
| 30 | + } | ||
| 31 | + return cell; | ||
| 32 | + | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier | ||
| 36 | +{ | ||
| 37 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | ||
| 38 | + if (self) { | ||
| 39 | + self.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 40 | + self.backgroundColor = RGB(73, 72, 75); | ||
| 41 | + [self.contentView addSubview:self.iconImg]; | ||
| 42 | + [self.contentView addSubview:self.titleLab]; | ||
| 43 | + [self p_addMasonry]; | ||
| 44 | + } | ||
| 45 | + return self; | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +- (void)setItem:(CNAddPopFuncItem *)item { | ||
| 49 | + _titleLab.text = item.title; | ||
| 50 | + _iconImg.image = [UIImage imageNamed:item.icon]; | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +- (void)drawRect:(CGRect)rect { | ||
| 54 | + | ||
| 55 | + CGContextRef context = UIGraphicsGetCurrentContext(); | ||
| 56 | + | ||
| 57 | + CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); | ||
| 58 | + | ||
| 59 | + CGContextFillRect(context, rect); | ||
| 60 | + | ||
| 61 | +// //上分割线, | ||
| 62 | +// CGContextSetStrokeColorWithColor(context, CNLiveColorWithHexString(@"ffffff").CGColor); | ||
| 63 | +// CGContextStrokeRect(context, CGRectMake(14, -1, rect.size.width - 28, 1)); | ||
| 64 | + | ||
| 65 | + //下分割线 | ||
| 66 | + CGContextSetStrokeColorWithColor(context, RGB(195, 195, 195).CGColor); | ||
| 67 | + CGContextStrokeRect(context, CGRectMake(14, rect.size.height, rect.size.width - 28, 1)); | ||
| 68 | + | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | + | ||
| 72 | +#pragma mark - | ||
| 73 | +#pragma mark - Masonry | ||
| 74 | +- (void)p_addMasonry { | ||
| 75 | + | ||
| 76 | + [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 77 | + make.left.mas_equalTo(self.contentView).mas_offset(13); | ||
| 78 | + make.top.mas_equalTo(self.contentView).mas_offset((45-16)/2); | ||
| 79 | + }]; | ||
| 80 | + | ||
| 81 | + [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 82 | + make.left.mas_equalTo(self.iconImg.mas_right).mas_offset(11); | ||
| 83 | + make.centerY.mas_equalTo(self.iconImg.centerY); | ||
| 84 | + }]; | ||
| 85 | + | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +#pragma mark - | ||
| 89 | +#pragma mark - getter | ||
| 90 | +- (UIImageView *)iconImg | ||
| 91 | +{ | ||
| 92 | + if (!_iconImg) { | ||
| 93 | + _iconImg = [[UIImageView alloc] init];//WithFrame:CGRectMake(18, (43-16)/2, 16, 16)]; | ||
| 94 | + } | ||
| 95 | + return _iconImg; | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +- (UILabel *)titleLab | ||
| 99 | +{ | ||
| 100 | + if (!_titleLab) { | ||
| 101 | + _titleLab = [[UILabel alloc] init];//WithFrame:CGRectMake(_iconImg.right+20, 0, self.bounds.size.width-80, self.bounds.size.height)]; | ||
| 102 | + _titleLab.font = [UIFont systemFontOfSize:15]; | ||
| 103 | + _titleLab.textColor = [UIColor whiteColor]; | ||
| 104 | + } | ||
| 105 | + return _titleLab; | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +- (void)awakeFromNib { | ||
| 109 | + [super awakeFromNib]; | ||
| 110 | + // Initialization code | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
| 114 | + [super setSelected:selected animated:animated]; | ||
| 115 | + | ||
| 116 | + // Configure the view for the selected state | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | +@end |
CNLiveMyOrder/Classes/View/CNStarButton.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNStarButton.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 2018/3/12. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <QMUIKit/QMUIKit.h> | ||
| 10 | + | ||
| 11 | +@interface CNStarButton : QMUIButton | ||
| 12 | + | ||
| 13 | +@property (nonatomic, strong) UIImage *normalImage; | ||
| 14 | +@property (nonatomic, strong) UIImage *highlightedImage; | ||
| 15 | +@property (nonatomic, assign) CGFloat fractionPart; | ||
| 16 | + | ||
| 17 | +- (instancetype)initWithSize:(CGSize)size; | ||
| 18 | +- (CGFloat)fractionPartOfPoint:(CGPoint)point; | ||
| 19 | + | ||
| 20 | +@end |
CNLiveMyOrder/Classes/View/CNStarButton.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNStarButton.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 2018/3/12. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNStarButton.h" | ||
| 10 | + | ||
| 11 | +@implementation CNStarButton | ||
| 12 | + | ||
| 13 | +- (instancetype)initWithSize:(CGSize)size{ | ||
| 14 | + if (self = [super initWithFrame:CGRectMake(0, 0, size.width, size.height)]) { | ||
| 15 | + self.backgroundColor = [UIColor clearColor]; | ||
| 16 | + self.qmui_outsideEdge = UIEdgeInsetsMake(-30, -5, -20, -5); | ||
| 17 | + } | ||
| 18 | + return self; | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +- (CGFloat)fractionPartOfPoint:(CGPoint)point{ | ||
| 23 | + CGFloat fractionPart = (point.x - self.frame.origin.x) / self.frame.size.width; | ||
| 24 | + return round(fractionPart * 2) / 2; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | + | ||
| 28 | +#pragma mark - helper | ||
| 29 | + | ||
| 30 | ++ (UIImage *)reSizeImage:(UIImage *)image toSize:(CGSize)reSize{ | ||
| 31 | + UIGraphicsBeginImageContext(reSize); | ||
| 32 | + [image drawInRect:CGRectMake(0, 0, reSize.width, reSize.height)]; | ||
| 33 | + UIImage *reSizeImage = UIGraphicsGetImageFromCurrentImageContext(); | ||
| 34 | + UIGraphicsEndImageContext(); | ||
| 35 | + return reSizeImage; | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | + | ||
| 39 | ++ (UIImage *)croppedImage:(UIImage *)image fraction:(CGFloat)fractonPart{ | ||
| 40 | + CGFloat width = image.size.width * fractonPart * image.scale; | ||
| 41 | + CGRect newFrame = CGRectMake(0, 0, width , image.size.height * image.scale); | ||
| 42 | + CGImageRef resultImage = CGImageCreateWithImageInRect(image.CGImage, newFrame); | ||
| 43 | + UIImage *result = [UIImage imageWithCGImage:resultImage scale:image.scale orientation:image.imageOrientation]; | ||
| 44 | + CGImageRelease(resultImage); | ||
| 45 | + return result; | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +#pragma mark - setter&getter | ||
| 49 | + | ||
| 50 | +- (void)setNormalImage:(UIImage *)normalImage{ | ||
| 51 | + _normalImage = [CNStarButton reSizeImage:normalImage toSize:self.frame.size]; | ||
| 52 | + [self setImage:_normalImage forState:UIControlStateNormal]; | ||
| 53 | + | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +- (void)setHighlightedImage:(UIImage *)highlightedImage{ | ||
| 57 | + _highlightedImage = [CNStarButton reSizeImage:highlightedImage toSize:self.frame.size]; | ||
| 58 | + [self setImage:_highlightedImage forState:UIControlStateSelected]; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | + | ||
| 62 | +- (void)setFractionPart:(CGFloat)fractionPart{ | ||
| 63 | + if (fractionPart == 0) { | ||
| 64 | + return; | ||
| 65 | + } | ||
| 66 | + UIImage *image = [CNStarButton croppedImage:self.highlightedImage fraction:fractionPart]; | ||
| 67 | + self.imageView.contentMode = UIViewContentModeScaleAspectFit; | ||
| 68 | + self.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; | ||
| 69 | + self.contentVerticalAlignment = UIControlContentVerticalAlignmentFill; | ||
| 70 | + [self setImage:image forState:UIControlStateHighlighted]; | ||
| 71 | + [self setBackgroundImage:self.normalImage forState:UIControlStateHighlighted]; | ||
| 72 | + self.selected = NO; | ||
| 73 | + self.highlighted = YES; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | + | ||
| 77 | +@end |
CNLiveMyOrder/Classes/View/CNStarsControl.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNStarsControl.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 2018/3/12. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +@class CNStarsControl; | ||
| 12 | +@protocol CNStarsControlDelegate<NSObject> | ||
| 13 | +@optional | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + 回调星星改变后的分数 | ||
| 17 | + | ||
| 18 | + @param starsControl 星星组件 | ||
| 19 | + @param score 分数 | ||
| 20 | + */ | ||
| 21 | +- (void)starsControl:(CNStarsControl *)starsControl didChangeScore:(CGFloat)score; | ||
| 22 | + | ||
| 23 | +@end | ||
| 24 | + | ||
| 25 | +@interface CNStarsControl : UIControl | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + 初始化一个星星组件,默认5颗星,默认星星的长宽为frame的高度 | ||
| 29 | + | ||
| 30 | + @param frame fram | ||
| 31 | + @param normalImage 普通状态星星 | ||
| 32 | + @param highlightedImage 高亮状态星星 | ||
| 33 | + @return 星星组件 | ||
| 34 | + */ | ||
| 35 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 36 | + noramlStarImage:(UIImage *)normalImage | ||
| 37 | + highlightedStarImage:(UIImage *)highlightedImage; | ||
| 38 | + | ||
| 39 | + | ||
| 40 | +/** | ||
| 41 | + 初始化一个星星组件,默认星星的长宽为frame的高度 | ||
| 42 | + | ||
| 43 | + @param frame frame | ||
| 44 | + @param number 星星数量 | ||
| 45 | + @param normalImage 普通状态星星 | ||
| 46 | + @param highlightedImage 高亮状态星星 | ||
| 47 | + @return 星星组件 | ||
| 48 | + */ | ||
| 49 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 50 | + stars:(NSInteger)number | ||
| 51 | + noramlStarImage:(UIImage *)normalImage | ||
| 52 | + highlightedStarImage:(UIImage *)highlightedImage; | ||
| 53 | + | ||
| 54 | + | ||
| 55 | +/** | ||
| 56 | + 初始化一个星星组件 | ||
| 57 | + | ||
| 58 | + @param frame frame | ||
| 59 | + @param number 星星数目 | ||
| 60 | + @param size 星星大小 | ||
| 61 | + @param normalImage 普通形态星星 | ||
| 62 | + @param highlightedImage 高亮形态星星 | ||
| 63 | + @return 星星组件 | ||
| 64 | + */ | ||
| 65 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 66 | + stars:(NSInteger)number | ||
| 67 | + starSize:(CGSize)size | ||
| 68 | + noramlStarImage:(UIImage *)normalImage | ||
| 69 | + highlightedStarImage:(UIImage *)highlightedImage; | ||
| 70 | + | ||
| 71 | + | ||
| 72 | +@property (nonatomic, weak) id<CNStarsControlDelegate> delegate; | ||
| 73 | +//是否允许小数(1位小数),默认为NO | ||
| 74 | +@property (nonatomic, assign, getter=isAllowFraction) BOOL allowFraction; | ||
| 75 | +//星星组件上的分数,可以直接设置 | ||
| 76 | +@property (nonatomic, assign) CGFloat score; | ||
| 77 | + | ||
| 78 | + | ||
| 79 | +@end |
CNLiveMyOrder/Classes/View/CNStarsControl.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNStarsControl.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 2018/3/12. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNStarsControl.h" | ||
| 10 | +#import "CNStarButton.h" | ||
| 11 | +#import "CNLiveBaseKit.h" | ||
| 12 | +@interface CNStarsControl () | ||
| 13 | + | ||
| 14 | +@property (nonatomic, strong) CNStarButton *currentStar; | ||
| 15 | +@property (nonatomic, assign) NSInteger numberOfStars; | ||
| 16 | +@property (nonatomic, strong) UIImage *normalStarImage; | ||
| 17 | +@property (nonatomic, strong) UIImage *highlightedStarImage; | ||
| 18 | +@property (nonatomic, assign) CGSize starSize; | ||
| 19 | + | ||
| 20 | +@end | ||
| 21 | + | ||
| 22 | +@implementation CNStarsControl | ||
| 23 | + | ||
| 24 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 25 | + stars:(NSInteger)number | ||
| 26 | + starSize:(CGSize)size | ||
| 27 | + noramlStarImage:(UIImage *)normalImage | ||
| 28 | + highlightedStarImage:(UIImage *)highlightedImage{ | ||
| 29 | + if (self = [super initWithFrame:frame]) { | ||
| 30 | + _numberOfStars = number; | ||
| 31 | + _normalStarImage = normalImage; | ||
| 32 | + _highlightedStarImage = highlightedImage; | ||
| 33 | + _starSize = size; | ||
| 34 | + _allowFraction = NO; | ||
| 35 | + self.clipsToBounds = YES; | ||
| 36 | + self.backgroundColor = [UIColor clearColor]; | ||
| 37 | + [self setupView]; | ||
| 38 | + } | ||
| 39 | + return self; | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 43 | + noramlStarImage:(UIImage *)normalImage | ||
| 44 | + highlightedStarImage:(UIImage *)highlightedImage{ | ||
| 45 | + return [self initWithFrame:frame stars:5 starSize:CGSizeMake(frame.size.height, frame.size.height) noramlStarImage:normalImage highlightedStarImage:highlightedImage]; | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | + | ||
| 49 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 50 | + stars:(NSInteger)number | ||
| 51 | + noramlStarImage:(UIImage *)normalImage | ||
| 52 | + highlightedStarImage:(UIImage *)highlightedImage{ | ||
| 53 | + return [self initWithFrame:frame stars:number starSize:CGSizeMake(frame.size.height, frame.size.height) noramlStarImage:normalImage highlightedStarImage:highlightedImage]; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + | ||
| 59 | +- (void)setupView { | ||
| 60 | + for (NSInteger index = 0; index < self.numberOfStars; index++) { | ||
| 61 | + CNStarButton *starButton = [CNStarButton.alloc initWithSize:self.starSize]; | ||
| 62 | + starButton.tag = index; | ||
| 63 | + starButton.normalImage = self.normalStarImage; | ||
| 64 | + starButton.highlightedImage = self.highlightedStarImage; | ||
| 65 | + starButton.userInteractionEnabled = NO; | ||
| 66 | + [self addSubview:starButton]; | ||
| 67 | + } | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | + | ||
| 71 | +- (void)layoutSubviews { | ||
| 72 | + [super layoutSubviews]; | ||
| 73 | + for (NSInteger index = 0; index < self.numberOfStars; index ++) { | ||
| 74 | + CNStarButton *starButton = [self starForTag:index]; | ||
| 75 | + CGFloat newY = (self.frame.size.height - self.starSize.height) / 2; | ||
| 76 | + CGFloat margin = 0; | ||
| 77 | + if (self.numberOfStars > 1) { | ||
| 78 | + margin = (self.frame.size.width - self.starSize.width * self.numberOfStars) / (self.numberOfStars - 1); | ||
| 79 | + } | ||
| 80 | + starButton.frame = CGRectMake((self.starSize.width + margin) * index, newY, self.starSize.width, self.starSize.height); | ||
| 81 | + } | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | + | ||
| 85 | + | ||
| 86 | +- (CNStarButton *)starForPoint:(CGPoint)point { | ||
| 87 | + for (NSInteger i = 0; i < self.numberOfStars; i++) { | ||
| 88 | + CNStarButton *starButton = [self starForTag:i]; | ||
| 89 | +// if (CGRectContainsPoint(starButton.frame, point)) { | ||
| 90 | +// return starButton; | ||
| 91 | +// } | ||
| 92 | + if (CGRectContainsPoint(CGRectMake(starButton.x-5, starButton.y-30, starButton.width+10, starButton.height+30+20), point)) { | ||
| 93 | + return starButton; | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + return nil; | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +- (CNStarButton *)starForTag:(NSInteger)tag { | ||
| 100 | + __block UIView *target; | ||
| 101 | + [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | ||
| 102 | + if (obj.tag == tag) { | ||
| 103 | + target = obj; | ||
| 104 | + *stop = YES; | ||
| 105 | + } | ||
| 106 | + }]; | ||
| 107 | + return (CNStarButton *)target; | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | + | ||
| 111 | +- (void)starsDownToIndex:(NSInteger)index { | ||
| 112 | + for (NSInteger i = self.numberOfStars; i > index; --i) { | ||
| 113 | + CNStarButton *starButton = [self starForTag:i]; | ||
| 114 | + starButton.selected = NO; | ||
| 115 | + starButton.highlighted = NO; | ||
| 116 | + } | ||
| 117 | +} | ||
| 118 | + | ||
| 119 | + | ||
| 120 | + | ||
| 121 | +- (void)starsUpToIndex:(NSInteger)index { | ||
| 122 | + for (NSInteger i = 0; i <= index; i++) { | ||
| 123 | + CNStarButton *starButton = [self starForTag:i]; | ||
| 124 | + starButton.selected = YES; | ||
| 125 | + starButton.highlighted = NO; | ||
| 126 | + } | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | + | ||
| 130 | +#pragma mark -Touch Handling | ||
| 131 | + | ||
| 132 | +- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { | ||
| 133 | + CGPoint point = [touch locationInView:self]; | ||
| 134 | + CNStarButton *pressedStar = [self starForPoint:point]; | ||
| 135 | + if (pressedStar) { | ||
| 136 | + self.currentStar = pressedStar; | ||
| 137 | + NSInteger index = pressedStar.tag; | ||
| 138 | + CGFloat fractionPart = 1; | ||
| 139 | + if (self.isAllowFraction) { | ||
| 140 | + fractionPart = [pressedStar fractionPartOfPoint:point]; | ||
| 141 | + } | ||
| 142 | + self.score = index + fractionPart; | ||
| 143 | + } | ||
| 144 | + return YES; | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | + | ||
| 148 | +- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { | ||
| 149 | + CGPoint point = [touch locationInView:self]; | ||
| 150 | + CNStarButton *pressedStar = [self starForPoint:point]; | ||
| 151 | + if (pressedStar) { | ||
| 152 | + self.currentStar = pressedStar; | ||
| 153 | + NSInteger index = pressedStar.tag; | ||
| 154 | + CGFloat fractionPart = 1; | ||
| 155 | + if (self.isAllowFraction) { | ||
| 156 | + fractionPart = [pressedStar fractionPartOfPoint:point]; | ||
| 157 | + } | ||
| 158 | + self.score = index + fractionPart; | ||
| 159 | + } | ||
| 160 | + else{ | ||
| 161 | + if (point.x < self.currentStar.frame.origin.x) { | ||
| 162 | + self.score = self.currentStar.tag; | ||
| 163 | + } | ||
| 164 | + else if (point.x > (self.currentStar.frame.origin.x + self.currentStar.frame.size.width)){ | ||
| 165 | + self.score = self.currentStar.tag + 1; | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + return YES; | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | + | ||
| 172 | +- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { | ||
| 173 | + [super endTrackingWithTouch:touch withEvent:event]; | ||
| 174 | + if ([self.delegate respondsToSelector:@selector(starsControl:didChangeScore:)]) { | ||
| 175 | + [self.delegate starsControl:self didChangeScore:self.score]; | ||
| 176 | + } | ||
| 177 | +} | ||
| 178 | + | ||
| 179 | + | ||
| 180 | +- (void)cancelTrackingWithEvent:(UIEvent *)event { | ||
| 181 | + [super cancelTrackingWithEvent:event]; | ||
| 182 | + if ([self.delegate respondsToSelector:@selector(starsControl:didChangeScore:)]) { | ||
| 183 | + [self.delegate starsControl:self didChangeScore:self.score]; | ||
| 184 | + } | ||
| 185 | +} | ||
| 186 | + | ||
| 187 | +#pragma mark - getter&setter | ||
| 188 | + | ||
| 189 | +- (void)setScore:(CGFloat)score{ | ||
| 190 | + if (_score == score) { | ||
| 191 | + return; | ||
| 192 | + } | ||
| 193 | + _score = score; | ||
| 194 | + NSInteger index = floor(score); | ||
| 195 | + CGFloat fractionPart = score - index;; | ||
| 196 | + if (!self.isAllowFraction || fractionPart == 0) { | ||
| 197 | + index -= 1; | ||
| 198 | + } | ||
| 199 | + CNStarButton *starButton = [self starForTag:index]; | ||
| 200 | + if (starButton.selected || score == 0) { | ||
| 201 | + [self starsDownToIndex:index]; | ||
| 202 | + } | ||
| 203 | + else{ | ||
| 204 | + [self starsUpToIndex:index]; | ||
| 205 | + } | ||
| 206 | + starButton.fractionPart = fractionPart; | ||
| 207 | +} | ||
| 208 | + | ||
| 209 | + | ||
| 210 | +@end |
Example/CNLiveMyOrder.xcodeproj/project.pbxproj
| @@ -12,6 +12,9 @@ | @@ -12,6 +12,9 @@ | ||
| 12 | 4E70635122B2781800888CE9 /* CNLiveSelectModuleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E70634E22B2781800888CE9 /* CNLiveSelectModuleView.m */; }; | 12 | 4E70635122B2781800888CE9 /* CNLiveSelectModuleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E70634E22B2781800888CE9 /* CNLiveSelectModuleView.m */; }; |
| 13 | 4E70635222B2781800888CE9 /* CNLiveSelectSubView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E70635022B2781800888CE9 /* CNLiveSelectSubView.m */; }; | 13 | 4E70635222B2781800888CE9 /* CNLiveSelectSubView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E70635022B2781800888CE9 /* CNLiveSelectSubView.m */; }; |
| 14 | 4E70635522B2782C00888CE9 /* CNLiveModuleSelectModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E70635422B2782C00888CE9 /* CNLiveModuleSelectModel.m */; }; | 14 | 4E70635522B2782C00888CE9 /* CNLiveModuleSelectModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E70635422B2782C00888CE9 /* CNLiveModuleSelectModel.m */; }; |
| 15 | + 4EB668FD22B785BC00256DDE /* libstdc++.6.0.9.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EB668DF22B7828800256DDE /* libstdc++.6.0.9.tbd */; }; | ||
| 16 | + 4EB668FE22B785C500256DDE /* libstdc++.6.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EB668E122B7829600256DDE /* libstdc++.6.tbd */; }; | ||
| 17 | + 4EB668FF22B785CE00256DDE /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EB668E322B782AE00256DDE /* libstdc++.tbd */; }; | ||
| 15 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; | 18 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; |
| 16 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; | 19 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; |
| 17 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; | 20 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; |
| @@ -50,6 +53,15 @@ | @@ -50,6 +53,15 @@ | ||
| 50 | 4E70635022B2781800888CE9 /* CNLiveSelectSubView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveSelectSubView.m; sourceTree = "<group>"; }; | 53 | 4E70635022B2781800888CE9 /* CNLiveSelectSubView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveSelectSubView.m; sourceTree = "<group>"; }; |
| 51 | 4E70635322B2782C00888CE9 /* CNLiveModuleSelectModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveModuleSelectModel.h; sourceTree = "<group>"; }; | 54 | 4E70635322B2782C00888CE9 /* CNLiveModuleSelectModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveModuleSelectModel.h; sourceTree = "<group>"; }; |
| 52 | 4E70635422B2782C00888CE9 /* CNLiveModuleSelectModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveModuleSelectModel.m; sourceTree = "<group>"; }; | 55 | 4E70635422B2782C00888CE9 /* CNLiveModuleSelectModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveModuleSelectModel.m; sourceTree = "<group>"; }; |
| 56 | + 4EB668DF22B7828800256DDE /* libstdc++.6.0.9.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.6.0.9.tbd"; path = "usr/lib/libstdc++.6.0.9.tbd"; sourceTree = SDKROOT; }; | ||
| 57 | + 4EB668E122B7829600256DDE /* libstdc++.6.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.6.tbd"; path = "usr/lib/libstdc++.6.tbd"; sourceTree = SDKROOT; }; | ||
| 58 | + 4EB668E322B782AE00256DDE /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; }; | ||
| 59 | + 4EB668E522B7830500256DDE /* IMFriendshipExt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IMFriendshipExt.framework; path = Pods/CNLiveIMBaseSDK/CNLiveIMBaseSDK/Classes/IMFriendshipExt.framework; sourceTree = "<group>"; }; | ||
| 60 | + 4EB668E722B783A500256DDE /* IMGroupExt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IMGroupExt.framework; path = Pods/CNLiveIMBaseSDK/CNLiveIMBaseSDK/Classes/IMGroupExt.framework; sourceTree = "<group>"; }; | ||
| 61 | + 4EB668E922B783DE00256DDE /* IMMessageExt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IMMessageExt.framework; path = Pods/CNLiveIMBaseSDK/CNLiveIMBaseSDK/Classes/IMMessageExt.framework; sourceTree = "<group>"; }; | ||
| 62 | + 4EB668EB22B783EF00256DDE /* ImSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImSDK.framework; path = Pods/CNLiveIMBaseSDK/CNLiveIMBaseSDK/Classes/ImSDK.framework; sourceTree = "<group>"; }; | ||
| 63 | + 4EB668ED22B7842C00256DDE /* QALSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QALSDK.framework; path = Pods/CNLiveIMBaseSDK/CNLiveIMBaseSDK/Classes/QALSDK.framework; sourceTree = "<group>"; }; | ||
| 64 | + 4EB668EF22B7843F00256DDE /* TLSSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TLSSDK.framework; path = Pods/CNLiveIMBaseSDK/CNLiveIMBaseSDK/Classes/TLSSDK.framework; sourceTree = "<group>"; }; | ||
| 53 | 5A8205D8E320A4328CC0AB56 /* Pods-CNLiveMyOrder_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveMyOrder_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveMyOrder_Example/Pods-CNLiveMyOrder_Example.release.xcconfig"; sourceTree = "<group>"; }; | 65 | 5A8205D8E320A4328CC0AB56 /* Pods-CNLiveMyOrder_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveMyOrder_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-CNLiveMyOrder_Example/Pods-CNLiveMyOrder_Example.release.xcconfig"; sourceTree = "<group>"; }; |
| 54 | 6003F58A195388D20070C39A /* CNLiveMyOrder_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveMyOrder_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; | 66 | 6003F58A195388D20070C39A /* CNLiveMyOrder_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveMyOrder_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 55 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; | 67 | 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; |
| @@ -83,6 +95,9 @@ | @@ -83,6 +95,9 @@ | ||
| 83 | isa = PBXFrameworksBuildPhase; | 95 | isa = PBXFrameworksBuildPhase; |
| 84 | buildActionMask = 2147483647; | 96 | buildActionMask = 2147483647; |
| 85 | files = ( | 97 | files = ( |
| 98 | + 4EB668FF22B785CE00256DDE /* libstdc++.tbd in Frameworks */, | ||
| 99 | + 4EB668FE22B785C500256DDE /* libstdc++.6.tbd in Frameworks */, | ||
| 100 | + 4EB668FD22B785BC00256DDE /* libstdc++.6.0.9.tbd in Frameworks */, | ||
| 86 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, | 101 | 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, |
| 87 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, | 102 | 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, |
| 88 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, | 103 | 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, |
| @@ -168,6 +183,15 @@ | @@ -168,6 +183,15 @@ | ||
| 168 | 6003F58C195388D20070C39A /* Frameworks */ = { | 183 | 6003F58C195388D20070C39A /* Frameworks */ = { |
| 169 | isa = PBXGroup; | 184 | isa = PBXGroup; |
| 170 | children = ( | 185 | children = ( |
| 186 | + 4EB668EF22B7843F00256DDE /* TLSSDK.framework */, | ||
| 187 | + 4EB668ED22B7842C00256DDE /* QALSDK.framework */, | ||
| 188 | + 4EB668EB22B783EF00256DDE /* ImSDK.framework */, | ||
| 189 | + 4EB668E922B783DE00256DDE /* IMMessageExt.framework */, | ||
| 190 | + 4EB668E722B783A500256DDE /* IMGroupExt.framework */, | ||
| 191 | + 4EB668E522B7830500256DDE /* IMFriendshipExt.framework */, | ||
| 192 | + 4EB668E322B782AE00256DDE /* libstdc++.tbd */, | ||
| 193 | + 4EB668E122B7829600256DDE /* libstdc++.6.tbd */, | ||
| 194 | + 4EB668DF22B7828800256DDE /* libstdc++.6.0.9.tbd */, | ||
| 171 | 6003F58D195388D20070C39A /* Foundation.framework */, | 195 | 6003F58D195388D20070C39A /* Foundation.framework */, |
| 172 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, | 196 | 6003F58F195388D20070C39A /* CoreGraphics.framework */, |
| 173 | 6003F591195388D20070C39A /* UIKit.framework */, | 197 | 6003F591195388D20070C39A /* UIKit.framework */, |
| @@ -265,6 +289,7 @@ | @@ -265,6 +289,7 @@ | ||
| 265 | 6003F5AA195388D20070C39A /* Sources */, | 289 | 6003F5AA195388D20070C39A /* Sources */, |
| 266 | 6003F5AB195388D20070C39A /* Frameworks */, | 290 | 6003F5AB195388D20070C39A /* Frameworks */, |
| 267 | 6003F5AC195388D20070C39A /* Resources */, | 291 | 6003F5AC195388D20070C39A /* Resources */, |
| 292 | + 5489F5FE9807AA264ABFF4FC /* [CP] Embed Pods Frameworks */, | ||
| 268 | ); | 293 | ); |
| 269 | buildRules = ( | 294 | buildRules = ( |
| 270 | ); | 295 | ); |
| @@ -398,9 +423,11 @@ | @@ -398,9 +423,11 @@ | ||
| 398 | "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework", | 423 | "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework", |
| 399 | "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework", | 424 | "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework", |
| 400 | "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework", | 425 | "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework", |
| 426 | + "${BUILT_PRODUCTS_DIR}/FBRetainCycleDetector/FBRetainCycleDetector.framework", | ||
| 401 | "${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework", | 427 | "${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework", |
| 402 | "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework", | 428 | "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework", |
| 403 | "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework", | 429 | "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework", |
| 430 | + "${BUILT_PRODUCTS_DIR}/MLeaksFinder/MLeaksFinder.framework", | ||
| 404 | "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework", | 431 | "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework", |
| 405 | "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework", | 432 | "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework", |
| 406 | "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", | 433 | "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", |
| @@ -420,9 +447,11 @@ | @@ -420,9 +447,11 @@ | ||
| 420 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework", | 447 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework", |
| 421 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework", | 448 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework", |
| 422 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework", | 449 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework", |
| 450 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBRetainCycleDetector.framework", | ||
| 423 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLAnimatedImage.framework", | 451 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FLAnimatedImage.framework", |
| 424 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework", | 452 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework", |
| 425 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework", | 453 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework", |
| 454 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MLeaksFinder.framework", | ||
| 426 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework", | 455 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework", |
| 427 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework", | 456 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework", |
| 428 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", | 457 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", |
| @@ -434,6 +463,30 @@ | @@ -434,6 +463,30 @@ | ||
| 434 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CNLiveMyOrder_Example/Pods-CNLiveMyOrder_Example-frameworks.sh\"\n"; | 463 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CNLiveMyOrder_Example/Pods-CNLiveMyOrder_Example-frameworks.sh\"\n"; |
| 435 | showEnvVarsInLog = 0; | 464 | showEnvVarsInLog = 0; |
| 436 | }; | 465 | }; |
| 466 | + 5489F5FE9807AA264ABFF4FC /* [CP] Embed Pods Frameworks */ = { | ||
| 467 | + isa = PBXShellScriptBuildPhase; | ||
| 468 | + buildActionMask = 2147483647; | ||
| 469 | + files = ( | ||
| 470 | + ); | ||
| 471 | + inputFileListPaths = ( | ||
| 472 | + ); | ||
| 473 | + inputPaths = ( | ||
| 474 | + "${SRCROOT}/Pods/Target Support Files/Pods-CNLiveMyOrder_Tests/Pods-CNLiveMyOrder_Tests-frameworks.sh", | ||
| 475 | + "${BUILT_PRODUCTS_DIR}/FBRetainCycleDetector/FBRetainCycleDetector.framework", | ||
| 476 | + "${BUILT_PRODUCTS_DIR}/MLeaksFinder/MLeaksFinder.framework", | ||
| 477 | + ); | ||
| 478 | + name = "[CP] Embed Pods Frameworks"; | ||
| 479 | + outputFileListPaths = ( | ||
| 480 | + ); | ||
| 481 | + outputPaths = ( | ||
| 482 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBRetainCycleDetector.framework", | ||
| 483 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MLeaksFinder.framework", | ||
| 484 | + ); | ||
| 485 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 486 | + shellPath = /bin/sh; | ||
| 487 | + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CNLiveMyOrder_Tests/Pods-CNLiveMyOrder_Tests-frameworks.sh\"\n"; | ||
| 488 | + showEnvVarsInLog = 0; | ||
| 489 | + }; | ||
| 437 | /* End PBXShellScriptBuildPhase section */ | 490 | /* End PBXShellScriptBuildPhase section */ |
| 438 | 491 | ||
| 439 | /* Begin PBXSourcesBuildPhase section */ | 492 | /* Begin PBXSourcesBuildPhase section */ |
| @@ -574,12 +627,78 @@ | @@ -574,12 +627,78 @@ | ||
| 574 | baseConfigurationReference = 4DED4DC26696E74F8AB61152 /* Pods-CNLiveMyOrder_Example.debug.xcconfig */; | 627 | baseConfigurationReference = 4DED4DC26696E74F8AB61152 /* Pods-CNLiveMyOrder_Example.debug.xcconfig */; |
| 575 | buildSettings = { | 628 | buildSettings = { |
| 576 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 629 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 630 | + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; | ||
| 577 | DEVELOPMENT_TEAM = 94X49GG3ZW; | 631 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 632 | + FRAMEWORK_SEARCH_PATHS = ( | ||
| 633 | + "$(inherited)", | ||
| 634 | + "$(PROJECT_DIR)/Pods/CNLiveIMBaseSDK/CNLiveIMBaseSDK/Classes", | ||
| 635 | + ); | ||
| 578 | GCC_PRECOMPILE_PREFIX_HEADER = YES; | 636 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
| 579 | GCC_PREFIX_HEADER = "CNLiveMyOrder/CNLiveMyOrder-Prefix.pch"; | 637 | GCC_PREFIX_HEADER = "CNLiveMyOrder/CNLiveMyOrder-Prefix.pch"; |
| 580 | INFOPLIST_FILE = "CNLiveMyOrder/CNLiveMyOrder-Info.plist"; | 638 | INFOPLIST_FILE = "CNLiveMyOrder/CNLiveMyOrder-Info.plist"; |
| 581 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; | 639 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; |
| 582 | MODULE_NAME = ExampleApp; | 640 | MODULE_NAME = ExampleApp; |
| 641 | + OTHER_LDFLAGS = ( | ||
| 642 | + "$(inherited)", | ||
| 643 | + "-ObjC", | ||
| 644 | + "-l\"sqlite3\"", | ||
| 645 | + "-l\"sqlite3.0\"", | ||
| 646 | + "-framework", | ||
| 647 | + "\"AFNetworking\"", | ||
| 648 | + "-framework", | ||
| 649 | + "\"CNLiveBaseKit\"", | ||
| 650 | + "-framework", | ||
| 651 | + "\"CNLiveCommonCategory\"", | ||
| 652 | + "-framework", | ||
| 653 | + "\"CNLiveCommonClass\"", | ||
| 654 | + "-framework", | ||
| 655 | + "\"CNLiveCustomUI\"", | ||
| 656 | + "-framework", | ||
| 657 | + "\"CNLiveIMBaseSDK\"", | ||
| 658 | + "-framework", | ||
| 659 | + "\"CNLiveMyOrder\"", | ||
| 660 | + "-framework", | ||
| 661 | + "\"CNLiveRequestBastKit\"", | ||
| 662 | + "-framework", | ||
| 663 | + "\"CNLiveTripartiteManagement\"", | ||
| 664 | + "-framework", | ||
| 665 | + "\"CNLiveUserManagement\"", | ||
| 666 | + "-framework", | ||
| 667 | + "\"CoreGraphics\"", | ||
| 668 | + "-framework", | ||
| 669 | + "\"FLAnimatedImage\"", | ||
| 670 | + "-framework", | ||
| 671 | + "\"Foundation\"", | ||
| 672 | + "-framework", | ||
| 673 | + "\"IMFriendshipExt\"", | ||
| 674 | + "-framework", | ||
| 675 | + "\"IMGroupExt\"", | ||
| 676 | + "-framework", | ||
| 677 | + "\"IMMessageExt\"", | ||
| 678 | + "-framework", | ||
| 679 | + "\"ImSDK\"", | ||
| 680 | + "-framework", | ||
| 681 | + "\"MJExtension\"", | ||
| 682 | + "-framework", | ||
| 683 | + "\"MJRefresh\"", | ||
| 684 | + "-framework", | ||
| 685 | + "\"Masonry\"", | ||
| 686 | + "-framework", | ||
| 687 | + "\"QALSDK\"", | ||
| 688 | + "-framework", | ||
| 689 | + "\"QMUIKit\"", | ||
| 690 | + "-framework", | ||
| 691 | + "\"Realm\"", | ||
| 692 | + "-framework", | ||
| 693 | + "\"SDWebImage\"", | ||
| 694 | + "-framework", | ||
| 695 | + "\"TLSSDK\"", | ||
| 696 | + "-framework", | ||
| 697 | + "\"UIKit\"", | ||
| 698 | + "-framework", | ||
| 699 | + "\"YYKit\"", | ||
| 700 | + "-all_load", | ||
| 701 | + ); | ||
| 583 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | 702 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; |
| 584 | PRODUCT_NAME = "$(TARGET_NAME)"; | 703 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 585 | WRAPPER_EXTENSION = app; | 704 | WRAPPER_EXTENSION = app; |
| @@ -591,12 +710,78 @@ | @@ -591,12 +710,78 @@ | ||
| 591 | baseConfigurationReference = 5A8205D8E320A4328CC0AB56 /* Pods-CNLiveMyOrder_Example.release.xcconfig */; | 710 | baseConfigurationReference = 5A8205D8E320A4328CC0AB56 /* Pods-CNLiveMyOrder_Example.release.xcconfig */; |
| 592 | buildSettings = { | 711 | buildSettings = { |
| 593 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 712 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 713 | + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO; | ||
| 594 | DEVELOPMENT_TEAM = 94X49GG3ZW; | 714 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 715 | + FRAMEWORK_SEARCH_PATHS = ( | ||
| 716 | + "$(inherited)", | ||
| 717 | + "$(PROJECT_DIR)/Pods/CNLiveIMBaseSDK/CNLiveIMBaseSDK/Classes", | ||
| 718 | + ); | ||
| 595 | GCC_PRECOMPILE_PREFIX_HEADER = YES; | 719 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
| 596 | GCC_PREFIX_HEADER = "CNLiveMyOrder/CNLiveMyOrder-Prefix.pch"; | 720 | GCC_PREFIX_HEADER = "CNLiveMyOrder/CNLiveMyOrder-Prefix.pch"; |
| 597 | INFOPLIST_FILE = "CNLiveMyOrder/CNLiveMyOrder-Info.plist"; | 721 | INFOPLIST_FILE = "CNLiveMyOrder/CNLiveMyOrder-Info.plist"; |
| 598 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; | 722 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; |
| 599 | MODULE_NAME = ExampleApp; | 723 | MODULE_NAME = ExampleApp; |
| 724 | + OTHER_LDFLAGS = ( | ||
| 725 | + "$(inherited)", | ||
| 726 | + "-ObjC", | ||
| 727 | + "-l\"sqlite3\"", | ||
| 728 | + "-l\"sqlite3.0\"", | ||
| 729 | + "-framework", | ||
| 730 | + "\"AFNetworking\"", | ||
| 731 | + "-framework", | ||
| 732 | + "\"CNLiveBaseKit\"", | ||
| 733 | + "-framework", | ||
| 734 | + "\"CNLiveCommonCategory\"", | ||
| 735 | + "-framework", | ||
| 736 | + "\"CNLiveCommonClass\"", | ||
| 737 | + "-framework", | ||
| 738 | + "\"CNLiveCustomUI\"", | ||
| 739 | + "-framework", | ||
| 740 | + "\"CNLiveIMBaseSDK\"", | ||
| 741 | + "-framework", | ||
| 742 | + "\"CNLiveMyOrder\"", | ||
| 743 | + "-framework", | ||
| 744 | + "\"CNLiveRequestBastKit\"", | ||
| 745 | + "-framework", | ||
| 746 | + "\"CNLiveTripartiteManagement\"", | ||
| 747 | + "-framework", | ||
| 748 | + "\"CNLiveUserManagement\"", | ||
| 749 | + "-framework", | ||
| 750 | + "\"CoreGraphics\"", | ||
| 751 | + "-framework", | ||
| 752 | + "\"FLAnimatedImage\"", | ||
| 753 | + "-framework", | ||
| 754 | + "\"Foundation\"", | ||
| 755 | + "-framework", | ||
| 756 | + "\"IMFriendshipExt\"", | ||
| 757 | + "-framework", | ||
| 758 | + "\"IMGroupExt\"", | ||
| 759 | + "-framework", | ||
| 760 | + "\"IMMessageExt\"", | ||
| 761 | + "-framework", | ||
| 762 | + "\"ImSDK\"", | ||
| 763 | + "-framework", | ||
| 764 | + "\"MJExtension\"", | ||
| 765 | + "-framework", | ||
| 766 | + "\"MJRefresh\"", | ||
| 767 | + "-framework", | ||
| 768 | + "\"Masonry\"", | ||
| 769 | + "-framework", | ||
| 770 | + "\"QALSDK\"", | ||
| 771 | + "-framework", | ||
| 772 | + "\"QMUIKit\"", | ||
| 773 | + "-framework", | ||
| 774 | + "\"Realm\"", | ||
| 775 | + "-framework", | ||
| 776 | + "\"SDWebImage\"", | ||
| 777 | + "-framework", | ||
| 778 | + "\"TLSSDK\"", | ||
| 779 | + "-framework", | ||
| 780 | + "\"UIKit\"", | ||
| 781 | + "-framework", | ||
| 782 | + "\"YYKit\"", | ||
| 783 | + "-all_load", | ||
| 784 | + ); | ||
| 600 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; | 785 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; |
| 601 | PRODUCT_NAME = "$(TARGET_NAME)"; | 786 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 602 | WRAPPER_EXTENSION = app; | 787 | WRAPPER_EXTENSION = app; |
Example/CNLiveMyOrder/CNLiveAppDelegate.m
| @@ -8,6 +8,10 @@ | @@ -8,6 +8,10 @@ | ||
| 8 | 8 | ||
| 9 | #import "CNLiveAppDelegate.h" | 9 | #import "CNLiveAppDelegate.h" |
| 10 | #import "CNLiveViewController.h" | 10 | #import "CNLiveViewController.h" |
| 11 | +#import "CNLiveNetworking.h" | ||
| 12 | +#import "CNLiveEnvironmentConfiguration.h" | ||
| 13 | +#import <CommonCrypto/CommonDigest.h> | ||
| 14 | +static NSString * uuid; | ||
| 11 | @implementation CNLiveAppDelegate | 15 | @implementation CNLiveAppDelegate |
| 12 | 16 | ||
| 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| @@ -18,10 +22,58 @@ | @@ -18,10 +22,58 @@ | ||
| 18 | UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc]; | 22 | UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc]; |
| 19 | self.window.rootViewController = nav; | 23 | self.window.rootViewController = nav; |
| 20 | [self.window makeKeyAndVisible]; | 24 | [self.window makeKeyAndVisible]; |
| 25 | + [self networkParamAction]; | ||
| 21 | // Override point for customization after application launch. | 26 | // Override point for customization after application launch. |
| 22 | return YES; | 27 | return YES; |
| 23 | } | 28 | } |
| 29 | +- (void)networkParamAction | ||
| 30 | +{ | ||
| 31 | + NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init]; | ||
| 32 | + [mDict setValue:@"10511059" forKey:@"loginSid"]; | ||
| 33 | +#ifdef Environment_ON | ||
| 34 | + [mDict setValue:@"com.cnlive.CNLiveNetAdd"forKey:@"platform_id"]; | ||
| 35 | +#else | ||
| 36 | + [mDict setValue:@"com.cnlive.CNLiveNetAdd.debug"forKey:@"platform_id"]; | ||
| 37 | +#endif | ||
| 38 | + [mDict setValue:[self appUUIDString] forKey:@"uuid"]; | ||
| 39 | + [mDict setValue:@"i" forKey:@"plat"]; | ||
| 40 | + [mDict setValue:@"1.5.3.18.12.10.15"forKey:@"ver"]; | ||
| 41 | + [mDict setObject:AppId forKey:@"appId"]; | ||
| 42 | + [CNLiveNetworking setupDefaultParam:mDict]; | ||
| 43 | + [CNLiveNetworking setupShowResult:NO]; | ||
| 44 | + [CNLiveNetworking setupSignKey:APPKey]; | ||
| 45 | + NSLog(@"打印appkey%@",APPKey); | ||
| 46 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | ||
| 47 | + [CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON]; | ||
| 48 | +} | ||
| 49 | +- (NSString *)appUUIDString | ||
| 50 | +{ | ||
| 51 | + static dispatch_once_t onceToken; | ||
| 52 | + dispatch_once(&onceToken, ^{ | ||
| 53 | + uuid = [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""]; | ||
| 54 | + }); | ||
| 55 | + return uuid; | ||
| 56 | +} | ||
| 24 | 57 | ||
| 58 | ++ (NSString*)sha1:(NSString *)string | ||
| 59 | +{ | ||
| 60 | + NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; | ||
| 61 | + | ||
| 62 | + uint8_t digest[CC_SHA1_DIGEST_LENGTH]; | ||
| 63 | + | ||
| 64 | + CC_SHA1(data.bytes, (unsigned int)data.length, digest); | ||
| 65 | + | ||
| 66 | + NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2]; | ||
| 67 | + | ||
| 68 | + for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) | ||
| 69 | + [output appendFormat:@"%02x", digest[i]]; | ||
| 70 | + | ||
| 71 | + while ([[output substringToIndex:1] isEqualToString:@"0"]) { | ||
| 72 | + output = [[NSMutableString alloc] initWithString:[output substringFromIndex:1]]; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + return output; | ||
| 76 | +} | ||
| 25 | - (void)applicationWillResignActive:(UIApplication *)application | 77 | - (void)applicationWillResignActive:(UIApplication *)application |
| 26 | { | 78 | { |
| 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | 79 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. |
Example/CNLiveMyOrder/Controller/CNLiveViewController.m
| @@ -12,6 +12,8 @@ | @@ -12,6 +12,8 @@ | ||
| 12 | #import "CNLiveSelectModuleView.h" | 12 | #import "CNLiveSelectModuleView.h" |
| 13 | #import "CNLiveBaseKit.h" | 13 | #import "CNLiveBaseKit.h" |
| 14 | #import "CNLiveMineOrderController.h" | 14 | #import "CNLiveMineOrderController.h" |
| 15 | +//#import "TIMAdapter.h" | ||
| 16 | +//#import "CommonLibrary.h" | ||
| 15 | @interface CNLiveViewController () | 17 | @interface CNLiveViewController () |
| 16 | @property (nonatomic, strong) NSArray *orderDataArr; | 18 | @property (nonatomic, strong) NSArray *orderDataArr; |
| 17 | @property (nonatomic, strong) CNLiveSelectModuleView *orderView; | 19 | @property (nonatomic, strong) CNLiveSelectModuleView *orderView; |
| @@ -68,6 +70,7 @@ | @@ -68,6 +70,7 @@ | ||
| 68 | CNLiveMineOrderController *vc = [[CNLiveMineOrderController alloc] initWithType:0]; | 70 | CNLiveMineOrderController *vc = [[CNLiveMineOrderController alloc] initWithType:0]; |
| 69 | // [[AppDelegate sharedAppDelegate] pushViewController:vc withBackTitle:@" "]; | 71 | // [[AppDelegate sharedAppDelegate] pushViewController:vc withBackTitle:@" "]; |
| 70 | [weakSelf.navigationController pushViewController:vc animated:NO]; | 72 | [weakSelf.navigationController pushViewController:vc animated:NO]; |
| 73 | +// [[BaseAppDelegate sharedAppDelegate] pushViewController:vc withBackTitle:@""]; | ||
| 71 | } | 74 | } |
| 72 | break; | 75 | break; |
| 73 | case 1: | 76 | case 1: |
Example/Podfile
| @@ -5,6 +5,16 @@ platform :ios, '9.0' | @@ -5,6 +5,16 @@ platform :ios, '9.0' | ||
| 5 | 5 | ||
| 6 | target 'CNLiveMyOrder_Example' do | 6 | target 'CNLiveMyOrder_Example' do |
| 7 | pod 'CNLiveMyOrder', :path => '../' | 7 | pod 'CNLiveMyOrder', :path => '../' |
| 8 | + #依赖三方私有库,如果里面有.a的时候加上这个 | ||
| 9 | + pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} | ||
| 10 | + end | ||
| 11 | + post_install do |installer| | ||
| 12 | + installer.pods_project.build_configuration_list.build_configurations.each do |configuration| | ||
| 13 | + configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES' | ||
| 14 | + end | ||
| 15 | + end | ||
| 16 | + pod 'MLeaksFinder' | ||
| 17 | + pod 'FBRetainCycleDetector', '~> 0.1.4' | ||
| 8 | #pod 'CNLiveTripartiteManagement/Realm' | 18 | #pod 'CNLiveTripartiteManagement/Realm' |
| 9 | #pod 'CNLiveTripartiteManagement/MJExtension' | 19 | #pod 'CNLiveTripartiteManagement/MJExtension' |
| 10 | #pod 'CNLiveBaseKit' | 20 | #pod 'CNLiveBaseKit' |
| @@ -17,6 +27,16 @@ target 'CNLiveMyOrder_Example' do | @@ -17,6 +27,16 @@ target 'CNLiveMyOrder_Example' do | ||
| 17 | #pod 'CNLiveCustomUI/CNLiveBasicsUI' | 27 | #pod 'CNLiveCustomUI/CNLiveBasicsUI' |
| 18 | target 'CNLiveMyOrder_Tests' do | 28 | target 'CNLiveMyOrder_Tests' do |
| 19 | inherit! :search_paths | 29 | inherit! :search_paths |
| 30 | + #依赖三方私有库,如果里面有.a的时候加上这个 | ||
| 31 | + pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} | ||
| 32 | + end | ||
| 33 | + pod 'MLeaksFinder' | ||
| 34 | + pod 'FBRetainCycleDetector', '~> 0.1.4' | ||
| 35 | +# post_install do |installer| | ||
| 36 | +# installer.pods_project.build_configuration_list.build_configurations.each do |configuration| | ||
| 37 | +# configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES' | ||
| 38 | +# end | ||
| 39 | +# end | ||
| 20 | #pod 'CNLiveTripartiteManagement/Realm' | 40 | #pod 'CNLiveTripartiteManagement/Realm' |
| 21 | #pod 'CNLiveTripartiteManagement/MJExtension' | 41 | #pod 'CNLiveTripartiteManagement/MJExtension' |
| 22 | #pod 'CNLiveBaseKit' | 42 | #pod 'CNLiveBaseKit' |