LiveOrderDetailVC.m 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. //
  2. // LiveOrderDetailVC.m
  3. // YBVideo
  4. //
  5. // Created by ybRRR on 2023/7/13.
  6. // Copyright © 2023 cat. All rights reserved.
  7. //
  8. #import "LiveOrderDetailVC.h"
  9. #import "UpHotCell.h"
  10. #import <YCMenuView.h>
  11. #import "addHotVideoVC.h"
  12. #import "UpHotView.h"
  13. #import "YBLiveVC.h"
  14. #import "YBVipVC.h"
  15. typedef NS_ENUM(NSInteger,YBSelType){
  16. TypeSel_Live,
  17. TypeSel_Video,
  18. };
  19. @interface LiveOrderDetailVC ()<UITableViewDelegate, UITableViewDataSource,upHotCellDelegate>
  20. {
  21. UIButton *selectBtn;
  22. NSString *typeStr;
  23. int pageIndex;
  24. }
  25. @property (nonatomic, strong)UITableView *listTable;
  26. @property(nonatomic,strong)UIView *tabHeaderView;
  27. @property(nonatomic,strong)NSArray *selectArr;
  28. @property(nonatomic, strong)NSMutableArray *dataArr;
  29. @property (nonatomic, strong)UpHotView *hotView;
  30. @end
  31. @implementation LiveOrderDetailVC
  32. //- (void)viewDidLoad {
  33. // [super viewDidLoad];
  34. // self.view.backgroundColor = UIColor.redColor;
  35. // self.naviView.hidden = YES;
  36. //}
  37. - (void)viewWillAppear:(BOOL)animated{
  38. [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
  39. }
  40. - (void)viewWillDisappear:(BOOL)animated{
  41. [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
  42. }
  43. -(void)getOrderList{
  44. NSDictionary *dic = @{@"uid":[Config getOwnID],@"token":[Config getOwnToken],@"status":typeStr,@"p":@(pageIndex)};
  45. [YBNetworking postWithUrl:@"Popular.getHotLiveOrders" Dic:dic Suc:^(int code, id info, NSString *msg) {
  46. [_listTable.mj_header endRefreshing];
  47. [_listTable.mj_footer endRefreshing];
  48. if (code == 0) {
  49. NSArray *listarr = info;
  50. if (pageIndex == 1) {
  51. [_dataArr removeAllObjects];
  52. }
  53. [_dataArr addObjectsFromArray:listarr];
  54. [_listTable reloadData];
  55. if (_dataArr.count > 0){
  56. [PublicView hiddenTextNoData:_listTable];
  57. } else{
  58. [PublicView showTextNoData:_listTable text1:@"" text2:YZMsg(@"暂无数据") centerY:0.8];
  59. }
  60. }
  61. } Fail:^(id fail) {
  62. [_listTable.mj_header endRefreshing];
  63. [_listTable.mj_footer endRefreshing];
  64. }];
  65. }
  66. -(void)creatNavi {
  67. // UIView *navi = [[UIView alloc]initWithFrame:CGRectMake(0, 0, _window_width, 64+statusbarHeight)];
  68. // navi.backgroundColor = [UIColor whiteColor];
  69. // [self.view addSubview:navi];
  70. //
  71. // UIButton *left_btn = [UIButton buttonWithType:UIButtonTypeCustom];
  72. // left_btn.frame = CGRectMake(10, 22+statusbarHeight, 40, 40);
  73. // left_btn.contentEdgeInsets = UIEdgeInsetsMake(5, 5, 5, 5);
  74. // [left_btn setImage:[UIImage imageNamed:@"pubBlack_back"] forState:0];
  75. // [left_btn addTarget:self action:@selector(clickLeftBtn) forControlEvents:UIControlEventTouchUpInside];
  76. // [navi addSubview:left_btn];
  77. //
  78. // UILabel *midLabel = [[UILabel alloc]initWithFrame:CGRectMake(_window_width/2-80, 22+statusbarHeight, 160, 40)];
  79. // midLabel.textAlignment = NSTextAlignmentCenter;
  80. // midLabel.textColor = RGB_COLOR(@"#323232", 1);
  81. // midLabel.font = [UIFont boldSystemFontOfSize:17];
  82. // midLabel.text = YZMsg(@"明细");
  83. // [navi addSubview:midLabel];
  84. }
  85. - (void)clickLeftBtn{
  86. [self.navigationController popViewControllerAnimated:YES];
  87. }
  88. - (void)viewDidLoad {
  89. [super viewDidLoad];
  90. self.naviView.hidden = YES;
  91. typeStr = @"0";
  92. pageIndex = 1;
  93. _dataArr = [NSMutableArray array];
  94. // [self creatNavi];
  95. self.view.backgroundColor =RGB_COLOR(@"#fafafa", 1);
  96. [self.view addSubview:self.listTable];
  97. [self getOrderList];
  98. }
  99. -(UITableView *)listTable {
  100. if (!_listTable) {
  101. //5个像素间隔
  102. _listTable = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, _window_width, _window_height-64-statusbarHeight-ShowDiff) style:UITableViewStylePlain];
  103. _listTable.delegate = self;
  104. _listTable.dataSource = self;
  105. _listTable.separatorStyle = UITableViewCellStyleDefault;
  106. _listTable.backgroundColor = RGB_COLOR(@"#fafafa", 1);
  107. _listTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  108. pageIndex = 1;
  109. [self getOrderList];
  110. }];
  111. _listTable.mj_footer = [MJRefreshFooter footerWithRefreshingBlock:^{
  112. pageIndex +=1;
  113. [self getOrderList];
  114. }];
  115. }
  116. return _listTable;
  117. }
  118. -(UIView *)tabHeaderView {
  119. if (!_tabHeaderView) {
  120. _tabHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, _window_width, 50)];
  121. _tabHeaderView.backgroundColor = RGB_COLOR(@"#fafafa", 1);
  122. UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 180, 50)];
  123. title.font = SYS_Font(15);
  124. title.text = YZMsg(@"我的直播订单");
  125. title.textColor = [UIColor blackColor];
  126. [_tabHeaderView addSubview:title];
  127. selectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  128. selectBtn.frame = CGRectMake(_window_width-90, 0, 75, 50);
  129. [selectBtn setTitle:YZMsg(@"未完成") forState:0];
  130. [selectBtn setImage:[UIImage imageNamed:@"hot_down"] forState:0];
  131. [selectBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, - selectBtn.imageView.image.size.width, 0, selectBtn.imageView.image.size.width)];
  132. [selectBtn setImageEdgeInsets:UIEdgeInsetsMake(0, selectBtn.titleLabel.bounds.size.width, 0, -selectBtn.titleLabel.bounds.size.width)];
  133. selectBtn.titleLabel.font = SYS_Font(15);
  134. selectBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
  135. [selectBtn setTitleColor:GrayText forState:0];
  136. selectBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
  137. [selectBtn addTarget:self action:@selector(selectBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  138. [_tabHeaderView addSubview:selectBtn];
  139. }
  140. return _tabHeaderView;
  141. }
  142. -(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  143. return self.tabHeaderView;
  144. }
  145. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  146. return 50;
  147. }
  148. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  149. {
  150. return _dataArr.count;
  151. }
  152. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  153. {
  154. return 220;
  155. }
  156. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  157. {
  158. UpHotCell *cell = [UpHotCell cellWithTab:tableView andIndexPath:indexPath];
  159. cell.delegate = self;
  160. cell.livedataDic = _dataArr[indexPath.row];
  161. cell.statuStr =typeStr;
  162. cell.gdy_tfsjL.text = YZMsg(@"曝光量");
  163. cell.gdy_playNumL.text = YZMsg(@"预计进场人数");
  164. cell.gdy_RealTimeL.text = YZMsg(@"直播时间");
  165. cell.gdy_realPlayNUmL.text = YZMsg(@"实际曝光量");
  166. return cell;
  167. }
  168. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  169. {
  170. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  171. }
  172. -(void)selectBtnClick:(UIButton *)sender{
  173. // 创建YCMenuAction
  174. YCMenuAction *action = [YCMenuAction actionWithTitle:YZMsg(@"已完成") image:nil handler:^(YCMenuAction *action) {
  175. NSLog(@"点击了%@",action.title);
  176. [selectBtn setTitle:YZMsg(action.title) forState:0];
  177. typeStr = @"1";
  178. pageIndex = 1;
  179. [self getOrderList];
  180. }];
  181. YCMenuAction *action1 = [YCMenuAction actionWithTitle:YZMsg(@"未完成") image:nil handler:^(YCMenuAction *action) {
  182. NSLog(@"点击了%@",action.title);
  183. [selectBtn setTitle:YZMsg(action.title) forState:0];
  184. typeStr = @"0";
  185. pageIndex = 1;
  186. [self getOrderList];
  187. }];
  188. // 按钮(YCMenuAction)的集合
  189. self.selectArr = @[action,action1];
  190. // 创建YCMenuView(根据关联点或者关联视图)
  191. YCMenuView *view = [YCMenuView menuWithActions:self.selectArr width:120 relyonView:sender];
  192. // 自定义设置
  193. view.menuColor = [UIColor whiteColor];
  194. view.separatorColor = [UIColor clearColor];
  195. view.maxDisplayCount = 5; // 最大展示数量(其他的需要滚动才能看到)
  196. view.offset = 0; // 关联点和弹出视图的偏移距离
  197. view.textColor = [UIColor grayColor];
  198. view.textFont = [UIFont boldSystemFontOfSize:14];
  199. view.menuCellHeight = 44;
  200. view.dismissOnselected = YES;
  201. view.dismissOnTouchOutside = YES;
  202. // 显示
  203. [view show];
  204. }
  205. -(void)clickReUpliveOrder
  206. {
  207. NSString *liveLimit = minstr([YBPower getLiveStatus]);
  208. NSString *liveMsg = minstr([YBPower getLiveMsg]);
  209. if ([liveLimit isEqual:@"1"]) {
  210. [MBProgressHUD showMessage:@""];
  211. [YBNetworking postWithUrl:@"Live.getLiveParameters" Dic:@{} Suc:^(int code, id info, NSString *msg) {
  212. [MBProgressHUD hideHUD];
  213. if (code == 0) {
  214. NSDictionary *infoDic = [info firstObject];
  215. YBLiveVC *liveVC = [[YBLiveVC alloc]init];
  216. liveVC.pushSettingDic = [infoDic valueForKey:@"ios"];
  217. liveVC.has_hotliveorder = minstr([infoDic valueForKey:@"has_hotliveorder"]);
  218. liveVC.hotliveorderDic =[infoDic valueForKey:@"hotliveorder"];
  219. // 是否禁止开播
  220. BOOL isBan = minstr([infoDic valueForKey:@"liveban_score"]);
  221. [YBPower saveBanLiveStatus:isBan];
  222. NSString *banStr = minstr([infoDic valueForKey:@"liveban_msg"]);
  223. [YBPower saveBanLiveMsg:banStr];
  224. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:liveVC animated:YES];
  225. }else {
  226. [MBProgressHUD showPop:msg];
  227. }
  228. } Fail:^(id fail) {
  229. [MBProgressHUD hideHUD];
  230. }];
  231. }else {
  232. [self showAlert:TypeSel_Live andAlertMsg:liveMsg];
  233. //[MBProgressHUD showPop:liveMsg];
  234. }
  235. // YBWeakSelf;
  236. // _hotView = [[UpHotView alloc]initWithFrame:CGRectMake(0, 0, _window_width, _window_height)];
  237. // _hotView.closeEvent = ^(NSString *status, NSString *orderid) {
  238. // if([status isEqual:@"确定"]){
  239. //// uphotOrderId = orderid;
  240. // }
  241. // [weakSelf.hotView removeFromSuperview];
  242. // weakSelf.hotView = nil;
  243. //
  244. // };
  245. // [self.view addSubview:_hotView];
  246. }
  247. -(void)showAlert:(YBSelType)selType andAlertMsg:(NSString *)alertMsg; {
  248. NSDictionary *contentDic = @{@"title":@"",
  249. @"msg":alertMsg,
  250. @"left":YZMsg(@"取消"),
  251. @"right":(selType == TypeSel_Live)?YZMsg(@"权限说明"):YZMsg(@"开通会员")};
  252. [YBAlertView showAlertView:contentDic complete:^(int eventType) {
  253. if (eventType == 1) {
  254. NSString *url = [NSString stringWithFormat:@"%@/appapi/liveauthority/index?uid=%@&token=%@",h5url,[Config getOwnID],[Config getOwnToken]];
  255. if (selType == TypeSel_Video) {
  256. //url = [NSString stringWithFormat:@"%@/Appapi/Auth/index?uid=%@&token=%@",h5url,[Config getOwnID],[Config getOwnToken]];;
  257. YBVipVC *vipVC = [[YBVipVC alloc]init];
  258. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:vipVC animated:YES];
  259. }else {
  260. PubH5 *h5VC = [[PubH5 alloc]init];
  261. h5VC.url = url;
  262. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:h5VC animated:YES];
  263. }
  264. }
  265. }];
  266. }
  267. -(void)reUpOrderClick:(NSDictionary *)dic
  268. {
  269. [MBProgressHUD showMessage:@""];
  270. [YBNetworking postWithUrl:@"Video.getVideo" Dic:@{@"videoid":minstr([dic valueForKey:@"videoid"]),@"mobileid":[PublicObj getDeviceUUID]} Suc:^(int code, id info, NSString *msg) {
  271. [MBProgressHUD hideHUD];
  272. if (code == 0) {
  273. NSDictionary *infoDic = [info firstObject];
  274. addHotVideoVC *hot = [[addHotVideoVC alloc]init];
  275. hot.videoInfo = infoDic;
  276. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:hot animated:YES];
  277. }else {
  278. [MBProgressHUD showPop:msg];
  279. }
  280. } Fail:^(id fail) {
  281. [MBProgressHUD hideHUD];
  282. }];
  283. }
  284. @end