OrderAuditListViewController.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. //
  2. // OrderAuditListViewController.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2018/11/12.
  6. // Copyright © 2018 elongtian. All rights reserved.
  7. //
  8. #import "OrderAuditListViewController.h"
  9. #import "OrderAuditDetailHomeViewController.h"
  10. @interface OrderAuditListViewController ()
  11. {
  12. int _pageNumber;
  13. NSString *_isAudit;
  14. NSString *_orderIds;
  15. }
  16. @end
  17. @implementation OrderAuditListViewController
  18. #pragma mark - 公共函数
  19. /**
  20. viewDidLoad
  21. */
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. [self loadNavStyle];
  25. [self initUI];
  26. [self initSlideSlip];
  27. _pageNumber=1;
  28. _isCheckAll=NO;
  29. _auditList=[[NSMutableArray alloc]init];
  30. [self startLoading];
  31. [self loadData];
  32. }
  33. /**
  34. 安全区视图发生变化
  35. */
  36. -(void)viewSafeAreaInsetsDidChange{
  37. _vCustomTableView.frame =CGRectMake(0, 0, self.view.frame.size.width,self.view.safeAreaLayoutGuide.layoutFrame.size.height-40);
  38. _bottomView.frame=CGRectMake(0, self.view.safeAreaLayoutGuide.layoutFrame.size.height-40, self.view.frame.size.width, 40);
  39. [super viewSafeAreaInsetsDidChange];
  40. }
  41. - (void)didReceiveMemoryWarning {
  42. [super didReceiveMemoryWarning];
  43. }
  44. #pragma mark - 委托函数
  45. /**
  46. 加载列表数据成功回调
  47. @param sender <#sender description#>
  48. */
  49. - (void)onLoadFinish:(ASIDownManager *)sender {
  50. int iNewCount = 0;
  51. // 取消进度条
  52. [self stopLoading];
  53. // 服务器返回数据
  54. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  55. // 服务器返回数据状态值
  56. int iStatus = resultModel.status;
  57. // 服务器返回数据消息
  58. NSString *message = resultModel.message;
  59. [ _vCustomTableView FinishLoading];
  60. // 服务器返回数据状态值正确
  61. if (iStatus == 0) {
  62. // 服务器返回数据结果
  63. NSArray *infoArr = (NSArray *)resultModel.result;
  64. if(infoArr != nil && infoArr.count>0)
  65. {
  66. for(int i=0;i<infoArr.count;i++){
  67. NSDictionary *dic=infoArr[i];
  68. OrderAuditListModel *auditListModel=[OrderAuditListModel new];
  69. [auditListModel parseDic:dic];
  70. [_auditList addObject:auditListModel];
  71. }
  72. iNewCount =(int)_auditList.count;
  73. _vCustomTableView.mbMoreHidden = (iNewCount == 0);
  74. [_vCustomTableView reloadData];
  75. if([self isCheckedAll]){
  76. _isCheckAll=YES;
  77. [_btnCheckAll setImage:[UIImage imageNamed:@"order_checked"] forState:UIControlStateNormal];
  78. }
  79. else{
  80. _isCheckAll=NO;
  81. [_btnCheckAll setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  82. }
  83. NSInteger num= [self getCheckedOrderCount:_auditList];
  84. NSString *totalCount=[NSString stringWithFormat:@"%@%ld%@",@"共",(long)num,@"条"];
  85. _lblTotalCount.text=totalCount;
  86. }
  87. else
  88. {
  89. _vCustomTableView.mbMoreHidden=YES;
  90. _vCustomTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  91. if(_auditList!=nil&&_auditList.count>0){
  92. if([self isCheckedAll]){
  93. _isCheckAll=YES;
  94. [_btnCheckAll setImage:[UIImage imageNamed:@"order_checked"] forState:UIControlStateNormal];
  95. }
  96. else{
  97. _isCheckAll=NO;
  98. [_btnCheckAll setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  99. }
  100. }
  101. else{
  102. _isCheckAll=NO;
  103. [_btnCheckAll setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  104. }
  105. NSInteger num= [self getCheckedOrderCount:_auditList];
  106. NSString *totalCount=[NSString stringWithFormat:@"%@%ld%@",@"共",(long)num,@"条"];
  107. _lblTotalCount.text=totalCount;
  108. // 未找到匹配结果
  109. if(_auditList == nil ||_auditList.count == 0){
  110. _vCustomTableView.mTableView.backgroundView = [self noDataViewByFrame:_vCustomTableView.bounds];
  111. [self showAlertViewBackText:@"未找到匹配结果"];
  112. }
  113. }
  114. }
  115. // 服务器返回数据状态值异常
  116. else if(iStatus == ActionResultStatusAuthError
  117. ||iStatus == ActionResultStatusNoLogin
  118. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  119. [_btnCheckAll setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  120. [self showReLoginDialog:message];
  121. }
  122. else{
  123. [_btnCheckAll setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  124. [self showAlertViewText:message];
  125. return;
  126. }
  127. }
  128. /**
  129. 列表加载数据失败回调
  130. @param sender <#sender description#>
  131. */
  132. - (void)onLoadFail:(ASIDownManager *)sender {
  133. [ _vCustomTableView FinishLoading];
  134. [self showAlertViewText:@"网络异常"];
  135. }
  136. /**
  137. 选中产品回调
  138. @param pos <#pos description#>
  139. */
  140. -(void)btnCheckPressed:(NSInteger)pos{
  141. OrderAuditListModel *auditModel= [_auditList objectAtIndex:pos];
  142. auditModel.isChecked= !auditModel.isChecked;
  143. //1.当前所要刷新的cell,传入要刷新的 行数 和 组数
  144. NSIndexPath *indexPath = [NSIndexPath indexPathForRow:pos inSection:0];
  145. //2.将indexPath添加到数组
  146. NSArray <NSIndexPath *> *indexPathArray = @[indexPath];
  147. //3.传入数组,对当前cell进行刷新
  148. [_vCustomTableView.mTableView reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationAutomatic];
  149. if([self isCheckedAll]){
  150. _isCheckAll=YES;
  151. [_btnCheckAll setImage:[UIImage imageNamed:@"order_checked"] forState:UIControlStateNormal];
  152. }
  153. else{
  154. _isCheckAll=NO;
  155. [_btnCheckAll setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  156. }
  157. NSInteger num=[self getCheckedOrderCount:_auditList];
  158. NSString *totalCount=[NSString stringWithFormat:@"%@%ld%@",@"共",(long)num,@"条"];
  159. _lblTotalCount.text=totalCount;
  160. }
  161. /**
  162. 保存成功回调函数
  163. @param sender <#sender description#>
  164. */
  165. - (void)onSaveFinish:(ASIDownManager *)sender {
  166. [self stopLoading];
  167. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  168. int iStatus = resultModel.status;
  169. NSString *message=resultModel.message;
  170. if(iStatus==0){
  171. [self showAlertViewText:@"保存成功"];
  172. if(_auditList!=nil&&_auditList.count>0){
  173. [_auditList removeAllObjects];
  174. [_vCustomTableView reloadData];
  175. _vCustomTableView.mbMoreHidden=YES;
  176. _orderIds=@"";
  177. [self startLoading];
  178. _pageNumber=1;
  179. [self loadData];
  180. }
  181. NSString *sureCount=[NSString stringWithFormat:@"%@%d%@",@"共",0,@"条"];
  182. _lblTotalCount.text=sureCount;
  183. }
  184. // 服务器返回数据状态值异常
  185. else if(iStatus == ActionResultStatusAuthError
  186. ||iStatus == ActionResultStatusNoLogin
  187. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  188. [self showReLoginDialog:message];
  189. }
  190. else{
  191. [self showAlertViewText:message];
  192. return;
  193. }
  194. }
  195. /**
  196. 保存失败回调函数
  197. @param sender <#sender description#>
  198. */
  199. - (void)onSaveFail:(ASIDownManager *)sender {
  200. [self stopLoading];
  201. [self showAlertViewText:@"网络异常"];
  202. }
  203. #pragma mark - tableView回调
  204. /**
  205. 单元格cell个数
  206. @param tableView <#tableView description#>
  207. @param section <#section description#>
  208. @return <#return value description#>
  209. */
  210. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  211. {
  212. return [_auditList count];
  213. }
  214. /**
  215. table view 分区数
  216. @param tableView <#tableView description#>
  217. @return <#return value description#>
  218. */
  219. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  220. return 1;
  221. }
  222. /**
  223. cell 高度
  224. @param tableView <#tableView description#>
  225. @param indexPath <#indexPath description#>
  226. @return <#return value description#>
  227. */
  228. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  229. return 271;
  230. }
  231. /**
  232. 每个单元格cell
  233. @param tableView <#tableView description#>
  234. @param indexPath <#indexPath description#>
  235. @return <#return value description#>
  236. */
  237. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  238. {
  239. static NSString *cellIdentifier = @"OrderAuditListCell";
  240. OrderAuditListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier ];
  241. if (!cell) {
  242. cell = [[OrderAuditListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
  243. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  244. }
  245. else
  246. //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免
  247. {
  248. while ([cell.contentView.subviews lastObject] != nil) {
  249. [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
  250. }
  251. }
  252. _auditModel= [_auditList objectAtIndex:indexPath.row];
  253. cell.delegate = self;
  254. cell.position = (int)indexPath.row;
  255. [cell setOrderAuditCell:_auditModel];
  256. [cell setCheckBackground:_auditModel.isChecked];
  257. return cell;
  258. }
  259. /**
  260. 点击单元格事件
  261. @param tableView tableView description
  262. @param indexPath indexPath description
  263. */
  264. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  265. {
  266. self.hidesBottomBarWhenPushed=YES;
  267. OrderAuditDetailHomeViewController *detailVc = [[OrderAuditDetailHomeViewController alloc] init];
  268. OrderAuditListModel *auditListModel=[_auditList objectAtIndex:indexPath.row];
  269. detailVc.orderId=auditListModel.orderId;
  270. detailVc.auditModel=auditListModel;
  271. [self.navigationController pushViewController:detailVc animated:YES];
  272. }
  273. /**
  274. 取消刷新
  275. @param sender sender description
  276. @return return value description
  277. */
  278. - (BOOL)CanRefreshTableView:(RefreshTableView *)sender {
  279. return YES;
  280. }
  281. /**
  282. 加载更多
  283. @param sender sender description
  284. */
  285. - (void)LoadMoreList:(RefreshTableView *)sender {
  286. _pageNumber++;
  287. [self startLoading];
  288. [self loadData];
  289. }
  290. /**
  291. 下拉刷新
  292. @param sender <#sender description#>
  293. */
  294. - (void)ReloadList:(RefreshTableView *)sender{
  295. _pageNumber = 1;
  296. [_auditList removeAllObjects];
  297. [_vCustomTableView reloadData];
  298. _vCustomTableView.mbMoreHidden=YES;
  299. [self startLoading];
  300. [self loadData];
  301. }
  302. /**
  303. 隐藏键盘
  304. @param scrollView <#scrollView description#>
  305. */
  306. - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
  307. {
  308. [self.view endEditing:YES];
  309. }
  310. #pragma mark - 私有函数
  311. /**
  312. 导航按钮样式
  313. */
  314. - (void)loadNavStyle
  315. {
  316. self.navigationItem.title =@"订单审核";
  317. // 右边
  318. UIView *v = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 42, 12)];
  319. UIButton *btnfilter = [UIButton buttonWithType:UIButtonTypeCustom];
  320. [btnfilter addTarget:self action:@selector(search)
  321. forControlEvents:UIControlEventTouchUpInside];
  322. btnfilter.frame = CGRectMake(0, 0,16, 16);
  323. [btnfilter setTitleColor:NavBarItemColor forState:UIControlStateNormal];
  324. [btnfilter setBackgroundImage:[UIImage imageNamed:@"icon_filter_white"]
  325. forState:UIControlStateNormal];
  326. [v addSubview:btnfilter];
  327. UIButton *filterLbl = [[UIButton alloc]init];
  328. filterLbl.frame=CGRectMake(CGRectGetMaxX(btnfilter.frame)+3,0,28, 16);
  329. [filterLbl setTitle:@"筛选" forState:UIControlStateNormal];
  330. [filterLbl setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  331. filterLbl.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize];
  332. [filterLbl addTarget:self action:@selector(search)
  333. forControlEvents:UIControlEventTouchUpInside];
  334. [v addSubview:filterLbl];
  335. UIBarButtonItem *menubtnAdd = [[UIBarButtonItem alloc] initWithCustomView:v];
  336. self.navigationItem.rightBarButtonItem = menubtnAdd;
  337. //返回
  338. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  339. [button setImage:[UIImage imageNamed:@"icon_back"]
  340. forState:UIControlStateNormal];
  341. [button addTarget:self action:@selector(goBack)
  342. forControlEvents:UIControlEventTouchUpInside];
  343. button.frame = CGRectMake(0, 0,45,22);
  344. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  345. self.navigationItem.leftBarButtonItem = menuButton;
  346. }
  347. -(void)search{
  348. [_filterController show];
  349. }
  350. -(void)loadData{
  351. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  352. [dict setObject:@"GetExamineListIphone" forKey:@"Action"];
  353. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  354. [dict setObject:kkUserCode forKey:@"UserCode"];
  355. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  356. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  357. [dict setObject:[NSString stringWithFormat:@"%d",_pageNumber] forKey:@"PageNum"];
  358. [dict setObject:[NSString stringWithFormat:@"%d",pageSize] forKey:@"PageSize"];
  359. [dict setObject:_orderNo== nil?@"":_orderNo forKey:@"OrderNo"];
  360. [dict setObject:_customerCode == nil?@"":_customerCode forKey:@"CustomerCode"];
  361. [dict setObject:_customerName == nil?@"":_customerName forKey:@"CustomerName"];
  362. [dict setObject:_telephone == nil?@"":_telephone forKey:@"Telephone"];
  363. [dict setObject:_address == nil?@"":_address forKey:@"Address"];
  364. [dict setObject:_beginDate == nil?@"":_beginDate forKey:@"AccountDateFrom"];
  365. [dict setObject:_endDate == nil?@"":_endDate forKey:@"AccountDateEnd"];
  366. [dict setObject:_status == nil?@"4":_status forKey:@"Status"];
  367. [dict setObject:_checkFlag == nil?@"0":_checkFlag forKey:@"CheckFlag"];
  368. _downManager = [[ASIDownManager alloc] init];
  369. _downManager.delegate = self;
  370. _downManager.onRequestSuccess = @selector(onLoadFinish:);
  371. _downManager.onRequestFail = @selector(onLoadFail:);
  372. [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
  373. }
  374. /**
  375. 获取选中的订单
  376. @param goodsList <#goodsList description#>
  377. @return <#return value description#>
  378. */
  379. -(NSInteger) getCheckedOrderCount:(NSMutableArray*)orderList{
  380. int num=0;
  381. NSMutableArray *orderSubmitList=[[NSMutableArray alloc]init];
  382. NSInteger count=orderList.count;
  383. for(int i=0;i<count;i++){
  384. OrderAuditListModel *model= orderList[i];
  385. if(model.isChecked){
  386. num++;
  387. [orderSubmitList addObject:model];
  388. }
  389. }
  390. NSInteger checkedCount=orderSubmitList.count;
  391. return checkedCount;
  392. }
  393. /**
  394. 全选或者反选
  395. @return <#return value description#>
  396. */
  397. -(BOOL)updateAllCellCheck
  398. {
  399. if(!_isCheckAll){
  400. _isCheckAll=YES;
  401. [_btnCheckAll setImage:[UIImage imageNamed:@"order_checked"] forState:UIControlStateNormal];
  402. for(OrderAuditListModel *auditModel in _auditList) {
  403. auditModel.isChecked=YES;
  404. }
  405. }
  406. else
  407. {
  408. [_btnCheckAll setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  409. _isCheckAll=NO;
  410. for(OrderAuditListModel *auditModel in _auditList) {
  411. auditModel.isChecked=NO;
  412. }
  413. }
  414. return NO;
  415. }
  416. /**
  417. 看是否全选
  418. @return <#return value description#>
  419. */
  420. -(BOOL)isCheckedAll
  421. {
  422. BOOL ischecked=YES;
  423. for(OrderAuditListModel *model in _auditList) {
  424. if( !model.isChecked)
  425. {
  426. ischecked=NO;
  427. break;
  428. }
  429. }
  430. return ischecked;
  431. }
  432. /**
  433. 选中所有的项
  434. */
  435. -(void)checkAll
  436. {
  437. [self updateAllCellCheck];
  438. NSInteger num= [self getCheckedOrderCount:_auditList];
  439. NSString *totalCount=[NSString stringWithFormat:@"%@%ld%@",@"共",(long)num,@"条"];
  440. _lblTotalCount.text=totalCount;
  441. [_vCustomTableView reloadData];
  442. }
  443. /**
  444. 初始化ui
  445. */
  446. - (void)initUI{
  447. _vCustomTableView = [[RefreshTableView alloc]
  448. initWithFrame:CGRectMake(0,
  449. 0,
  450. self.view.frame.size.width,
  451. Screen_Height- 40)];
  452. _vCustomTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  453. _vCustomTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  454. _vCustomTableView.backgroundColor = [UIColor whiteColor];
  455. _vCustomTableView.delegate = self;
  456. [self.view addSubview:_vCustomTableView];
  457. self.vCustomTableView.mTableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 49, 0);
  458. //保存
  459. _bottomView=[UIView new];
  460. _bottomView.frame=CGRectMake(0,Screen_Height - 40 -rectNavHeight - rectStatusHeight, self.view.frame.size.width, 40);
  461. [self.view addSubview:_bottomView];
  462. [_bottomView setBackgroundColor:[UIColor whiteColor]];
  463. _btnCheckAll=[UIButton buttonWithType:UIButtonTypeCustom];
  464. _btnCheckAll.frame=CGRectMake(10,8, 25, 25);
  465. [_btnCheckAll setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  466. [_btnCheckAll addTarget:self action:@selector(checkAll)
  467. forControlEvents:UIControlEventTouchUpInside];
  468. [_bottomView addSubview:_btnCheckAll];
  469. UILabel *lblall=[UILabel new];
  470. lblall.frame=CGRectMake(CGRectGetMaxX(_btnCheckAll.frame),8, 40, 25);
  471. lblall.text=@"全选";
  472. [_bottomView addSubview:lblall];
  473. _lblTotalCount=[UILabel new];
  474. _lblTotalCount.frame=CGRectMake(CGRectGetMaxX(lblall.frame),8,Screen_Width-CGRectGetMaxX(lblall.frame)-190, 25);
  475. _lblTotalCount.textColor=[UIColor redColor];
  476. _lblTotalCount.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  477. [_bottomView addSubview:_lblTotalCount];
  478. _auditBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  479. [_auditBtn setTitle:@"审核" forState:UIControlStateNormal];
  480. [_auditBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  481. _auditBtn.frame=CGRectMake(Screen_Width-90,0,90,40);
  482. [_auditBtn setBackgroundColor:[UIColor colorWithRed:189.0/255.0 green:0 blue:7.0/255.0 alpha:1]];
  483. [_auditBtn addTarget:self action:@selector(submitAuditData) forControlEvents:UIControlEventTouchUpInside];
  484. [_bottomView addSubview:_auditBtn];
  485. _giveUpAuditBtn=[UIButton buttonWithType:UIButtonTypeCustom];
  486. [_giveUpAuditBtn setTitle:@"弃审" forState:UIControlStateNormal];
  487. [_giveUpAuditBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  488. _giveUpAuditBtn.frame=CGRectMake(Screen_Width-90*2-10,0,90,40);
  489. [_giveUpAuditBtn setBackgroundColor:[UIColor colorWithRed:189.0/255.0 green:0 blue:7.0/255.0 alpha:1]];
  490. [_giveUpAuditBtn addTarget:self action:@selector(submitGiveUpAuditData) forControlEvents:UIControlEventTouchUpInside];
  491. [_bottomView addSubview:_giveUpAuditBtn];
  492. _pageNumber = 1;
  493. }
  494. -(void)dataSearch{
  495. [_filterController show];
  496. }
  497. -(void)submitAuditData
  498. {
  499. _isAudit=@"1";
  500. [self saveData];
  501. }
  502. -(void)submitGiveUpAuditData{
  503. _isAudit=@"0";
  504. [self saveData];
  505. }
  506. -(void)saveData
  507. {
  508. if(_auditList!=nil&&_auditList.count>0){
  509. NSInteger num= [self getCheckedOrderCount:_auditList];
  510. if(num==0){
  511. [self showAlertViewText:@"请选择单据"];
  512. return;
  513. }
  514. NSMutableArray *checkedOrderList=[[NSMutableArray alloc]init];
  515. for(OrderAuditListModel *model in _auditList){
  516. if(model.isChecked){
  517. NSString *orderIdStr=[NSString stringWithFormat:@"%d", model.orderId];
  518. [checkedOrderList addObject:orderIdStr];
  519. }
  520. }
  521. _orderIds=[checkedOrderList componentsJoinedByString:@","];
  522. }
  523. else{
  524. [self showAlertViewText:@"没有可选择的单据"];
  525. return;
  526. }
  527. [self startLoading];
  528. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  529. [dict setObject:@"SaveOrderCheckIphone" forKey:@"Action"];
  530. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  531. [dict setObject:kkUserCode forKey:@"UserCode"];
  532. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  533. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  534. [dict setObject:_orderIds forKey:@"OrderID"];
  535. [dict setObject:_isAudit forKey:@"IsAudits"];
  536. _downManager = [[ASIDownManager alloc] init];
  537. _downManager.delegate = self;
  538. _downManager.onRequestSuccess = @selector(onSaveFinish:);
  539. _downManager.onRequestFail = @selector(onSaveFail:);
  540. [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
  541. }
  542. /**
  543. 抽屉初始化
  544. */
  545. - (void)initSlideSlip{
  546. // 抽屉对象
  547. __weak typeof(self) weakself = self;
  548. self.filterController = [[SideSlipFilterController alloc]
  549. initWithSponsor:self
  550. resetBlock:^(NSArray *dataList) {
  551. for (SideSlipModel *model in dataList)
  552. {
  553. model.selectedItemList = nil;
  554. model.customDict = nil;
  555. }
  556. }
  557. commitBlock:^(NSArray *dataList) {
  558. // 查询条件
  559. SideSlipModel *serviceRegionModel = dataList[0];
  560. OrderAuditSearchModel *m = [serviceRegionModel.customDict objectForKey:ORDER_AUDIT_SEARCH_RANGE_MODEL];
  561. self.orderNo=m.orderNo;
  562. self.customerCode=m.customerCode;
  563. self.customerName=m.customerName;
  564. self.telephone=m.telephone;
  565. self.address=m.address;
  566. self.beginDate=m.startDate;
  567. self.endDate=m.endDate;
  568. self.status=m.invoiceStatusId;
  569. self.checkFlag=m.auditFlag;
  570. [weakself.filterController dismiss];
  571. self->_pageNumber=1;
  572. if(self->_auditList!=nil&&self->_auditList.count>0){
  573. [self->_auditList removeAllObjects];
  574. [self->_vCustomTableView reloadData];
  575. }
  576. self->_vCustomTableView.mTableView.backgroundView=nil;
  577. [self startLoading];
  578. [self loadData];
  579. }];
  580. _filterController.animationDuration = AnimationDuration;
  581. _filterController.hasHeadView = YES;
  582. _filterController.sideSlipLeading = UIScreenSideSlipLeading*[UIScreen mainScreen].bounds.size.width;
  583. _filterController.dataList = [self packageDataList];
  584. }
  585. /**
  586. 抽屉数据源
  587. @return <#return value description#>
  588. */
  589. - (NSArray *)packageDataList {
  590. NSMutableArray *dataArray = [NSMutableArray array];
  591. SideSlipModel *model = [[SideSlipModel alloc] init];
  592. model.containerCellClass = @"OrderAuditSearchCell";
  593. model.regionTitle = @"查询条件";
  594. [dataArray addObject:model];
  595. return [dataArray mutableCopy];
  596. }
  597. @end