CustomerBalanceViewController.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. //
  2. // CustomerBalanceViewController.m
  3. // IBOSS
  4. //
  5. // Created by apple on 2017/5/15.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:客户往来余额控制器
  9. //
  10. #import "CustomerBalanceViewController.h"
  11. #import "CustomerBalanceDetailViewController.h"
  12. #import "CustomerBalanceSearchModel.h"
  13. #import "CustomerBalanceCell.h"
  14. @interface CustomerBalanceViewController ()<UITableViewDelegate,UITableViewDataSource>{
  15. //TableView对象
  16. UITableView *_vTableView;
  17. // 头部合计信息
  18. UIView *_headView;
  19. }
  20. /**
  21. 数据源高度数据
  22. */
  23. @property (strong,nonatomic) NSMutableDictionary *heights;
  24. /**
  25. 原始数据源
  26. */
  27. @property (strong,nonatomic) NSMutableArray *arrDataList;
  28. /**
  29. 请求数据对象
  30. */
  31. @property (nonatomic,strong) ASIDownManager *downManager;
  32. @end
  33. @implementation CustomerBalanceViewController
  34. #pragma mark - 公共函数
  35. /**
  36. viewDidLoad函数
  37. */
  38. - (void)viewDidLoad {
  39. [super viewDidLoad];
  40. [self loadNavStyle];
  41. [self initUI];
  42. self.isBalance=@"";
  43. [self initSlideSlip];
  44. }
  45. /**
  46. 安全区视图发生变化
  47. */
  48. -(void)viewSafeAreaInsetsDidChange{
  49. _vTableView.frame = self.view.safeAreaLayoutGuide.layoutFrame;
  50. [super viewSafeAreaInsetsDidChange];
  51. }
  52. /**
  53. didReceiveMemoryWarning函数
  54. */
  55. - (void)didReceiveMemoryWarning {
  56. [super didReceiveMemoryWarning];
  57. }
  58. /**
  59. dealloc
  60. */
  61. - (void)dealloc{
  62. self.arrDataList = nil;
  63. self.filterController = nil;
  64. }
  65. #pragma mark - 数据源list属性
  66. /**
  67. 高度
  68. @return <#return value description#>
  69. */
  70. - (NSMutableDictionary *)heights{
  71. if (_heights == nil){
  72. _heights = [NSMutableDictionary dictionary];
  73. }
  74. return _heights;
  75. }
  76. /**
  77. 原始数据源
  78. @return <#return value description#>
  79. */
  80. - (NSMutableArray *)arrDataList{
  81. if(_arrDataList == nil){
  82. _arrDataList = [[NSMutableArray alloc]init];
  83. }
  84. return _arrDataList;
  85. }
  86. #pragma mark - 委托回调函数
  87. #pragma mark 委托接口回调函数
  88. /**
  89. 调用接口成功回调
  90. @param sender <#sender description#>
  91. */
  92. - (void)onLoadFinish:(ASIDownManager *)sender {
  93. // 取消进度条
  94. [self cancel];
  95. // 服务器返回数据
  96. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  97. // 服务器返回数据状态值
  98. int iStatus = resultModel.status;
  99. // 服务器返回数据消息
  100. NSString *message = resultModel.message;
  101. // 服务器返回数据状态值正确
  102. if (iStatus == 0)
  103. {
  104. NSArray *retArr = (NSArray *)resultModel.result;
  105. [self.arrDataList removeAllObjects];
  106. // 返回结果
  107. if(retArr != nil)
  108. {
  109. [self.arrDataList addObjectsFromArray:retArr];
  110. _vTableView.tableHeaderView = nil;
  111. _vTableView.backgroundView = nil;
  112. //无数据 关宏厚2017-7-6
  113. if(self.arrDataList.count == 0)
  114. {
  115. //无数据 关宏厚2017-7-6
  116. _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  117. // 有刷新数据的时候
  118. if(self.arrDataList == nil || self.arrDataList.count == 0){
  119. _vTableView.backgroundView =_noDataView;
  120. [self showAlertViewBackText:@"未找到匹配结果"];
  121. }
  122. }
  123. else
  124. {
  125. _vTableView.tableHeaderView = _headView;
  126. double totalReceivableValue = 0;
  127. double totalDepositValue = 0;
  128. double totalEarnestValue = 0;
  129. for (int i = 0; i < self.arrDataList.count; i++) {
  130. NSDictionary *dicValue = self.arrDataList[i];
  131. totalReceivableValue = totalReceivableValue + [[dicValue objectForKey:@"AccountReceivable"] doubleValue];
  132. totalDepositValue = totalDepositValue + [[dicValue objectForKey:@"DepositReceived"] doubleValue];
  133. totalEarnestValue = totalEarnestValue + [[dicValue objectForKey:@"Earnest"] doubleValue];
  134. }
  135. // self.lblReceivable.text = [NSString stringWithFormat:@"¥%.2f",totalReceivableValue];
  136. // self.lblDeposit.text = [NSString stringWithFormat:@"¥%.2f",totalDepositValue];
  137. // self.lblEarnest.text = [NSString stringWithFormat:@"¥%.2f",totalEarnestValue];
  138. // self.lblReceivableAndDepositAndEarnest.text = [NSString stringWithFormat:@"¥%.2f",totalReceivableValue-totalDepositValue-totalEarnestValue];
  139. self.lblReceivable.text=[Util positiveFormat:[NSString stringWithFormat:@"%.2f",totalReceivableValue]];
  140. self.lblDeposit.text =[Util positiveFormat:[NSString stringWithFormat:@"%.2f",totalDepositValue]];
  141. self.lblEarnest.text=[Util positiveFormat:[NSString stringWithFormat:@"%.2f",totalEarnestValue]];
  142. self.lblReceivableAndDepositAndEarnest.text=[Util positiveFormat:[NSString stringWithFormat:@"%.2f",totalReceivableValue-totalDepositValue-totalEarnestValue]];
  143. }
  144. [_vTableView reloadData];
  145. }
  146. }
  147. // 服务器返回数据状态值异常
  148. else if(iStatus == ActionResultStatusAuthError
  149. ||iStatus == ActionResultStatusNoLogin
  150. ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
  151. [self showReLoginDialog:message];
  152. }
  153. else {
  154. [_vTableView reloadData];
  155. [self showAlertViewText:message];
  156. }
  157. }
  158. /**
  159. 调用接口失败回调
  160. @param sender <#sender description#>
  161. */
  162. - (void)onLoadFail:(ASIDownManager *)sender {
  163. [self cancel];
  164. [_vTableView reloadData];
  165. [self showAlertViewText:@"网络异常"];
  166. }
  167. #pragma mark - 委托tablview回调函数
  168. /**
  169. 行数
  170. @param tableView tableView description
  171. @param section section description
  172. @return return value description
  173. */
  174. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  175. {
  176. return [self.arrDataList count];
  177. }
  178. /**
  179. Sections数
  180. @param tableView <#tableView description#>
  181. @return <#return value description#>
  182. */
  183. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  184. return 1;
  185. }
  186. /**
  187. 高度
  188. @param tableView <#tableView description#>
  189. @param indexPath <#indexPath description#>
  190. @return <#return value description#>
  191. */
  192. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  193. return [self.heights[@(indexPath.row)]floatValue];
  194. }
  195. /**
  196. 预估高度
  197. @param tableView <#tableView description#>
  198. @param indexPath <#indexPath description#>
  199. @return <#return value description#>
  200. */
  201. - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
  202. return 170;
  203. }
  204. /**
  205. 单元格
  206. @param tableView <#tableView description#>
  207. @param indexPath <#indexPath description#>
  208. @return <#return value description#>
  209. */
  210. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  211. {
  212. static NSString *cellIdentifier = @"CustomerBalanceCell";
  213. CustomerBalanceCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  214. if (!cell) {
  215. cell = [[CustomerBalanceCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
  216. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  217. }
  218. else
  219. //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免
  220. {
  221. while ([cell.contentView.subviews lastObject] != nil) {
  222. [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
  223. }
  224. }
  225. NSDictionary *dic= _arrDataList[indexPath.row];
  226. [cell initUI:dic];
  227. // 存储高度
  228. self.heights[@(indexPath.row)] = @(cell.height);
  229. return cell;
  230. }
  231. /**
  232. 单元格选择事件
  233. @param tableView <#tableView description#>
  234. @param indexPath <#indexPath description#>
  235. */
  236. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  237. {
  238. NSDictionary *dic= _arrDataList[indexPath.row];
  239. if(dic != nil)
  240. {
  241. NSString *customerid = [[dic objectForKey:@"CustomerID"] stringValue];
  242. if (customerid == nil || customerid.length == 0) {
  243. return;
  244. }
  245. self.hidesBottomBarWhenPushed=YES;
  246. CustomerBalanceDetailViewController *detailVC = [[CustomerBalanceDetailViewController alloc]init];
  247. detailVC.sCustomerName = [dic objectForKey:@"CustomerName"];
  248. detailVC.sChannelName = [dic objectForKey:@"ChannelName"];
  249. detailVC.sAccountOrganizationName = [dic objectForKey:@"AccountOrganizationName"];
  250. detailVC.sOrganizationName = [dic objectForKey:@"OrganizationName"];
  251. detailVC.sDictionaryValue = [dic objectForKey:@"DictionaryValue"];
  252. detailVC.sStaffName = [dic objectForKey:@"SalesManName"];
  253. detailVC.sDistrictName = [dic objectForKey:@"DistrictName"];
  254. detailVC.sCreditLine = [NSString stringWithFormat:@"%.f",[[dic objectForKey:@"CreditLine"]floatValue]];
  255. detailVC.sAddress = [dic objectForKey:@"Address"];
  256. detailVC.sTelephone = [dic objectForKey:@"Telephone"];
  257. detailVC.sSecondaryStaffName=[dic objectForKey:@"SecondaryStaffArray"];
  258. detailVC.sEarnest = [NSString stringWithFormat:@"%.2f",[[dic objectForKey:@"Earnest"]floatValue]];
  259. detailVC.sAmountReceivable = [NSString stringWithFormat:@"%.2f",[[dic objectForKey:@"AccountReceivable"]floatValue]];
  260. detailVC.sDepositReceived = [NSString stringWithFormat:@"%.2f",[[dic objectForKey:@"DepositReceived"]floatValue]];
  261. [self.navigationController pushViewController:detailVC animated:YES];
  262. }
  263. }
  264. #pragma mark - 私有函数
  265. /**
  266. 初始化ui
  267. */
  268. - (void)initUI {
  269. CGFloat height = 210;
  270. self.navigationItem.title = @"客户往来余额表";
  271. self.view.backgroundColor = [UIColor whiteColor];
  272. //分割线
  273. UIView *viewBackgroud = [UIView new];
  274. viewBackgroud.frame = CGRectMake(0, 0, Screen_Width, 0);
  275. viewBackgroud.backgroundColor = LineBackgroundColor;
  276. [self.view addSubview:viewBackgroud];
  277. _vTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0, Screen_Width, Screen_Height )];
  278. _vTableView.rowHeight = UITableViewAutomaticDimension;
  279. _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  280. _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  281. _vTableView.backgroundColor = [UIColor whiteColor];
  282. _vTableView.delegate = self;
  283. _vTableView.dataSource=self;
  284. _vTableView.tableHeaderView = nil;
  285. _noDataView = [self noDataViewByFrame:_vTableView.bounds];
  286. _vTableView.backgroundView =[self backGroundPromptViewByFrame:_vTableView.bounds promptStr:@"请筛选后查询"];;
  287. [self.view addSubview:_vTableView];
  288. //头布局
  289. _headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, Screen_Width, height)];
  290. UIButton *btnHead = [UIButton buttonWithType:UIButtonTypeCustom];
  291. btnHead.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  292. CGFloat titleHeight = 50;
  293. CGFloat lblx = 20;
  294. CGFloat lblwidth = 130;
  295. CGFloat fontsize = 14;
  296. //CGFloat valuex = 125;
  297. CGFloat valuey = 10;
  298. CGFloat valuewidth = 200;
  299. CGFloat valueheight = 25;
  300. CGFloat heightLine =1;
  301. //总合计 —————————
  302. UIView *vtotal = [UIView new];
  303. vtotal.frame=CGRectMake(0, 0, Screen_Width, titleHeight);
  304. [_headView addSubview:vtotal];
  305. UILabel *lbtotal = [UILabel new];
  306. lbtotal.frame=CGRectMake(lblx, valuey, lblwidth, valueheight);
  307. lbtotal.font = [UIFont boldSystemFontOfSize:fontsize];
  308. lbtotal.text = @"合计";
  309. [vtotal addSubview:lbtotal];
  310. //分割线
  311. viewBackgroud = [UIView new];
  312. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vtotal.frame), Screen_Width, heightLine);
  313. viewBackgroud.backgroundColor = LineBackgroundColor;
  314. [_headView addSubview:viewBackgroud];
  315. //应收款 —————————
  316. UIView *vtotalreceivable = [UIView new];
  317. vtotalreceivable.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  318. [_headView addSubview:vtotalreceivable];
  319. UIImageView *imgview = [UIImageView new];
  320. imgview.frame=CGRectMake(lblx, valuey+5, 21, 20);
  321. [imgview setImage:[UIImage imageNamed:@"balance_receivable"]];
  322. [vtotalreceivable addSubview:imgview];
  323. UILabel *lblText = [UILabel new];
  324. lblText.frame=CGRectMake(CGRectGetMaxX(imgview.frame)+5, valuey+3, lblwidth, valueheight);
  325. lblText.font = [UIFont systemFontOfSize:fontsize];
  326. lblText.text = @"应收款";
  327. [vtotalreceivable addSubview:lblText];
  328. self.lblReceivable = [UILabel new];
  329. self.lblReceivable.frame=CGRectMake(Screen_Width - valuewidth - lblx, valuey+3, valuewidth, valueheight);
  330. self.lblReceivable.font = [UIFont systemFontOfSize:fontsize];
  331. //lblreceivable = @"¥0";
  332. self.lblReceivable.textAlignment = NSTextAlignmentRight;
  333. [vtotalreceivable addSubview:self.lblReceivable];
  334. viewBackgroud = [UIView new];
  335. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vtotalreceivable.frame), Screen_Width, heightLine);
  336. viewBackgroud.backgroundColor = LineBackgroundColor;
  337. [_headView addSubview:viewBackgroud];
  338. //预收款 —————————
  339. UIView *vtotaldeposit = [UIView new];
  340. vtotaldeposit.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  341. [_headView addSubview:vtotaldeposit];
  342. UIImageView *imgviewReceivable = [UIImageView new];
  343. imgviewReceivable.frame=CGRectMake(lblx, valuey+5, 20, 20);
  344. [imgviewReceivable setImage:[UIImage imageNamed:@"balance_deposit"]];
  345. [vtotaldeposit addSubview:imgviewReceivable];
  346. lblText = [UILabel new];
  347. lblText.frame=CGRectMake(CGRectGetMaxX(imgviewReceivable.frame)+5, valuey+3, lblwidth, valueheight);
  348. lblText.font = [UIFont systemFontOfSize:fontsize];
  349. lblText.text = @"预收款";
  350. [vtotaldeposit addSubview:lblText];
  351. self.lblDeposit = [UILabel new];
  352. self.lblDeposit.frame=CGRectMake(Screen_Width - valuewidth - lblx, valuey+3, valuewidth, valueheight);
  353. self.lblDeposit.font = [UIFont systemFontOfSize:fontsize];
  354. //lbldeposit = @"¥0";
  355. self.lblDeposit.textAlignment = NSTextAlignmentRight;
  356. [vtotaldeposit addSubview:self.lblDeposit];
  357. viewBackgroud = [UIView new];
  358. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vtotaldeposit.frame), Screen_Width,heightLine);
  359. viewBackgroud.backgroundColor = LineBackgroundColor;
  360. [_headView addSubview:viewBackgroud];
  361. //定金 —————————
  362. UIView *vtotalearnest = [UIView new];
  363. vtotalearnest.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  364. [_headView addSubview:vtotalearnest];
  365. UIImageView *imgviewProfit = [UIImageView new];
  366. imgviewProfit.frame=CGRectMake(lblx, valuey+5, 20, 20);
  367. [imgviewProfit setImage:[UIImage imageNamed:@"balance_earnest"]];
  368. [vtotalearnest addSubview:imgviewProfit];
  369. lblText = [UILabel new];
  370. lblText.frame=CGRectMake(CGRectGetMaxX(imgviewReceivable.frame)+5, valuey+3, lblwidth, valueheight);
  371. lblText.font = [UIFont systemFontOfSize:fontsize];
  372. lblText.text = @"定金";
  373. [vtotalearnest addSubview:lblText];
  374. self.lblEarnest = [UILabel new];
  375. self.lblEarnest.frame=CGRectMake(Screen_Width - valuewidth - lblx, valuey+3, valuewidth, valueheight);
  376. self.lblEarnest.font = [UIFont systemFontOfSize:fontsize];
  377. //lbtotalProfitValue = @"¥0";
  378. self.lblEarnest.textAlignment = NSTextAlignmentRight;
  379. [vtotalearnest addSubview:self.lblEarnest];
  380. viewBackgroud = [UIView new];
  381. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vtotalearnest.frame), Screen_Width,heightLine);
  382. viewBackgroud.backgroundColor = LineBackgroundColor;
  383. [_headView addSubview:viewBackgroud];
  384. // 应收款-预存款-定金 —————————
  385. UIView *vreceivableAndDepositAndEarnest = [UIView new];
  386. vreceivableAndDepositAndEarnest.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, titleHeight);
  387. [_headView addSubview:vreceivableAndDepositAndEarnest];
  388. imgview = [UIImageView new];
  389. imgview.frame=CGRectMake(lblx, valuey+5, 20, 20);
  390. [imgview setImage:[UIImage imageNamed:@"order_sale_total"]];
  391. [vreceivableAndDepositAndEarnest addSubview:imgview];
  392. lblText = [UILabel new];
  393. lblText.frame=CGRectMake(CGRectGetMaxX(imgviewReceivable.frame)+5, valuey+3, 200, valueheight);
  394. lblText.font = [UIFont systemFontOfSize:fontsize];
  395. lblText.text = @"应收款-预存款-定金";
  396. [vreceivableAndDepositAndEarnest addSubview:lblText];
  397. self.lblReceivableAndDepositAndEarnest = [UILabel new];
  398. self.lblReceivableAndDepositAndEarnest.frame=CGRectMake(CGRectGetMaxY(lblText.frame), valuey+3, Screen_Width - CGRectGetMaxY(lblText.frame) - lblx, valueheight);
  399. self.lblReceivableAndDepositAndEarnest.font = [UIFont systemFontOfSize:fontsize];
  400. //lbtotalProfitValue = @"¥0";
  401. self.lblReceivableAndDepositAndEarnest.textAlignment = NSTextAlignmentRight;
  402. [vreceivableAndDepositAndEarnest addSubview:self.lblReceivableAndDepositAndEarnest];
  403. _headView.frame = CGRectMake(0, 0, Screen_Width, CGRectGetMaxY(vreceivableAndDepositAndEarnest.frame));
  404. }
  405. /**
  406. 进度条隐藏
  407. */
  408. - (void)cancel {
  409. [self stopLoading];
  410. }
  411. /**
  412. 加载数据
  413. */
  414. - (void)reloadData
  415. {
  416. [self startLoading];
  417. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  418. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  419. [dict setObject:@"GetCustomerBalanceIphone" forKey:@"Action"];
  420. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  421. [dict setObject:kkUserCode forKey:@"UserCode"];
  422. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  423. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  424. [dict setObject:self.sOrg forKeyedSubscript:@"OrganizationID"];
  425. [dict setObject:self.sStaff forKeyedSubscript:@"Reporter"];
  426. [dict setObject:self.sSummaryType forKeyedSubscript:@"SortType"];
  427. [dict setObject:self.sCustomerAddress forKeyedSubscript:@"Address"];
  428. [dict setObject:self.isBalance forKeyedSubscript:@"IsBalanceFee"];
  429. [dict setObject:self.sCustomerCode forKeyedSubscript:@"CustomerCode"];
  430. [dict setObject:self.sCustomerName forKeyedSubscript:@"CustomerName"];
  431. [dict setObject:self.sSecondaryStaff forKeyedSubscript:@"SecondaryStaff"];
  432. self.downManager = [[ASIDownManager alloc] init];
  433. self.downManager.delegate = self;
  434. self.downManager.onRequestSuccess = @selector(onLoadFinish:);
  435. self.downManager.onRequestFail = @selector(onLoadFail:);
  436. [self.downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  437. }
  438. /**
  439. 返回
  440. */
  441. - (void)goBack
  442. {
  443. [self.navigationController popViewControllerAnimated:YES];
  444. }
  445. /**
  446. 导航按钮样式
  447. */
  448. - (void)loadNavStyle
  449. {
  450. //右边
  451. UIView *v = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 42, 16)];
  452. UIButton *btnfilter = [UIButton buttonWithType:UIButtonTypeCustom];
  453. [btnfilter addTarget:self action:@selector(search)
  454. forControlEvents:UIControlEventTouchUpInside];
  455. btnfilter.frame = CGRectMake(0, 0, 16, 16);
  456. [btnfilter setTitleColor:NavBarItemColor forState:UIControlStateNormal];
  457. [btnfilter setBackgroundImage:[UIImage imageNamed:@"icon_filter_white"]
  458. forState:UIControlStateNormal];
  459. [v addSubview:btnfilter];
  460. UIButton *filterLbl = [[UIButton alloc]init];
  461. filterLbl.frame=CGRectMake(CGRectGetMaxX(btnfilter.frame)+3,0,28, 16);
  462. [filterLbl setTitle:@"筛选" forState:UIControlStateNormal];
  463. [filterLbl setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  464. filterLbl.titleLabel.font = [UIFont systemFontOfSize:ButtonFontOfSize];
  465. [filterLbl addTarget:self action:@selector(search)
  466. forControlEvents:UIControlEventTouchUpInside];
  467. [v addSubview:filterLbl];
  468. UIBarButtonItem *menubtnAdd = [[UIBarButtonItem alloc] initWithCustomView:v];
  469. self.navigationItem.rightBarButtonItem = menubtnAdd;
  470. //返回
  471. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  472. [button setImage:[UIImage imageNamed:@"icon_back"] forState:UIControlStateNormal];
  473. [button addTarget:self action:@selector(goBack)
  474. forControlEvents:UIControlEventTouchUpInside];
  475. button.frame = CGRectMake(0, 0,45,22);
  476. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  477. self.navigationItem.leftBarButtonItem = menuButton;
  478. }
  479. /**
  480. 抽屉弹出
  481. */
  482. - (void)search{
  483. [_filterController show];
  484. }
  485. /**
  486. 抽屉初始化
  487. */
  488. - (void)initSlideSlip{
  489. // 抽屉对象
  490. __weak typeof(self) weakself=self;
  491. self.filterController = [[SideSlipFilterController alloc] initWithSponsor:self resetBlock:^(NSArray *dataList) {
  492. for (SideSlipModel *model in dataList) {
  493. //selectedItem
  494. model.selectedItemList = nil;
  495. model.customDict = nil;
  496. }
  497. } commitBlock:^(NSArray *dataList) {
  498. // 查询条件
  499. SideSlipModel *serviceRegionModel = dataList[0];
  500. CustomerBalanceSearchModel *m = [serviceRegionModel.customDict objectForKey:CUSTOMER_BALANCE_SEARCH_RANGE_MODEL];
  501. self.sOrg = m.sOrg;
  502. self.sStaff = m.sStaff;
  503. self.sSummaryType = m.sSummaryType;
  504. self.sSecondaryStaff=m.sSecondaryStaff;
  505. self.sCustomerCode=m.sCustomerCode;
  506. self.sCustomerName=m.sCustomerName;
  507. self.isBalance=m.filter;
  508. self.sCustomerAddress=m.sCustomerAddress;
  509. [weakself.filterController dismiss];
  510. [self reloadData];
  511. }];
  512. _filterController.animationDuration = AnimationDuration;
  513. _filterController.hasHeadView = YES;
  514. _filterController.sideSlipLeading = UIScreenSideSlipLeading * [UIScreen mainScreen].bounds.size.width;
  515. _filterController.dataList = [self packageDataList];
  516. }
  517. /**
  518. 数据源
  519. @return <#return value description#>
  520. */
  521. - (NSArray *)packageDataList {
  522. NSMutableArray *dataArray = [NSMutableArray array];
  523. SideSlipModel *model = [[SideSlipModel alloc] init];
  524. model.containerCellClass = @"CustomerBalanceSearchCell";
  525. model.regionTitle = @"查询条件";
  526. [dataArray addObject:model];
  527. return [dataArray mutableCopy];
  528. }
  529. @end