diff --git a/HDMall/CodeClass/Business/SaleInput/SaleInput.storyboard b/HDMall/CodeClass/Business/SaleInput/SaleInput.storyboard index b20228a10110687a3287e6b9cd9564df7837613d..a6b9cf5a96883ce58d15dd7adc019e6d992d35f1 100644 --- a/HDMall/CodeClass/Business/SaleInput/SaleInput.storyboard +++ b/HDMall/CodeClass/Business/SaleInput/SaleInput.storyboard @@ -42,8 +42,8 @@ <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="æ—¶é—´:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ufl-0t-iXS"> - <rect key="frame" x="20" y="71" width="37.5" height="24"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="销售日期:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ufl-0t-iXS"> + <rect key="frame" x="20" y="71" width="82" height="24"/> <constraints> <constraint firstAttribute="height" constant="24" id="duB-sd-UUp"/> </constraints> @@ -70,8 +70,8 @@ <constraint firstAttribute="height" constant="1" id="FZa-Q2-AEM"/> </constraints> </view> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="笔数:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bSa-gd-kdW"> - <rect key="frame" x="20" y="39" width="37.5" height="24"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="本å•åˆè®¡:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bSa-gd-kdW"> + <rect key="frame" x="20" y="39" width="70" height="24"/> <constraints> <constraint firstAttribute="height" constant="24" id="bd4-Cd-bLl"/> </constraints> @@ -80,7 +80,7 @@ <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="照明设施更æ¢" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UcL-xw-odG"> - <rect key="frame" x="68" y="39.5" width="98" height="23"/> + <rect key="frame" x="100.5" y="39.5" width="98" height="23"/> <constraints> <constraint firstAttribute="height" constant="23" id="h8V-ZS-zlt"/> </constraints> @@ -89,7 +89,7 @@ <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2014-04-15 11:30:34" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wyu-19-g9E"> - <rect key="frame" x="68" y="71.5" width="154" height="23"/> + <rect key="frame" x="100.5" y="71.5" width="154" height="23"/> <constraints> <constraint firstAttribute="height" constant="23" id="0Jy-zb-mks"/> </constraints> @@ -345,7 +345,7 @@ <color key="textColor" red="1" green="0.9999405146" blue="0.99998033050000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="今日累计" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bgO-nZ-r8L"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="当日累计" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bgO-nZ-r8L"> <rect key="frame" x="16" y="8" width="90" height="23"/> <constraints> <constraint firstAttribute="width" constant="90" id="b5i-PM-bLs"/> @@ -873,7 +873,7 @@ <color key="textColor" red="1" green="0.9999405146" blue="0.99998033050000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="今日累计" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ncf-YV-5FB"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="当日累计" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ncf-YV-5FB"> <rect key="frame" x="16" y="8" width="90" height="23"/> <constraints> <constraint firstAttribute="width" constant="90" id="eaQ-85-hMH"/> diff --git a/HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputAddViewController.m b/HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputAddViewController.m index 374df67a1b88391dafa99049eecb9c0d1289b776..539a920a86f7822a647119ddbd6ddf023d591d12 100644 --- a/HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputAddViewController.m +++ b/HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputAddViewController.m @@ -18,10 +18,6 @@ [super viewDidLoad]; self.title = @"新建销售录入"; self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 84, 0); - UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"历å²" style:UIBarButtonItemStylePlain target:self action:@selector(actionGoHistory)]; - self.navigationItem.rightBarButtonItem = rightBtn; - - [self httpPayments]; } @@ -109,6 +105,12 @@ WS(weakSelf); //赋值 kCanNotBeNil(self.viewModel.request.contract, @"请选择åˆåŒ!"); + NSDecimalNumber *limit = [CalculateHelper sub:@0 num2:self.topView.labelTodayTotal.text]; + NSDecimalNumber *billTotal = [CalculateHelper decimalNumber:self.totalView.labelTotal.text]; + if ([billTotal compare:limit] == NSOrderedAscending) { + [MBProgressHUD j_warningMessage:[NSString stringWithFormat:@"本å•åˆè®¡å¿…é¡»å°äºŽ%@å…ƒ", limit.stringValue]]; + return; + } NSString *msg = [NSString stringWithFormat:@"销售日期:%@\n总金é¢ï¼š %@\n\n确认æäº¤ï¼Ÿ",self.topView.textFieldDate.text, self.totalView.labelTotal.text]; [self alertTitle:@"温馨æç¤º" msg:msg okAction:^(UIAlertAction * _Nullable action) { @@ -122,14 +124,5 @@ } cancelAction:nil]; } -/** - * 跳转查看历å²ç•Œé¢ - */ -- (void)actionGoHistory { - SaleInputHistoryViewController *historyVC = [SaleInputHistoryViewController viewControllerWithStoryBoardType:(STORYBOARD_TYPE_SALEINPUT)]; - historyVC.contract = self.topView.contract; - [self.navigationController pushViewController:historyVC animated:YES]; -} - ZJLazy(SaleInputViewModel, viewModel); @end diff --git a/HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputListViewController.m b/HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputListViewController.m index 7e580c24a420ef6ac0dc4e950883055a94c06bda..22bc786e9e6c184faa882e7f91a55f47baf3b386 100644 --- a/HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputListViewController.m +++ b/HDMall/CodeClass/Business/SaleInput/ViewControllers/SaleInputListViewController.m @@ -14,6 +14,7 @@ #import "HMSaleInputQuery.h" #import "JSDropDownMenu.h" #import "SaleInputListViewModel.h" +#import "SaleInputHistoryViewController.h" @interface SaleInputListViewController () @property (strong, nonatomic) SaleInputListViewModel *viewModel; @@ -24,10 +25,13 @@ - (void)viewDidLoad { [super viewDidLoad]; + self.startPage = 1; // Do any additional setup after loading the view. self.title = @"销售录入记录"; [self refresh]; self.tableView.rowHeight = 159; + UIBarButtonItem *btnRight = [[UIBarButtonItem alloc] initWithTitle:@"历å²" style:UIBarButtonItemStyleDone target:self action:@selector(actionGoHistory)]; + self.navigationItem.rightBarButtonItem = btnRight; self.btnAdd.hidden = !AppGlobal.permission.saleinput.newField; [self configDropMenu]; } @@ -43,7 +47,7 @@ WS(weakSelf); self.viewModel.blockRequest = ^{ - weakSelf.page = 1; + weakSelf.page = weakSelf.startPage; [weakSelf httpRequest]; }; } @@ -95,12 +99,23 @@ SaleInputAddViewController *addVC = [SaleInputAddViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_SALEINPUT]; WS(weakSelf); addVC.commplete = ^{ - weakSelf.page = 1; + weakSelf.page = weakSelf.startPage; [weakSelf httpRequest]; }; [self listPushCustomAnimate:addVC]; } +/** + * 跳转查看历å²ç•Œé¢ + */ +- (void)actionGoHistory { + SaleInputHistoryViewController *historyVC = [SaleInputHistoryViewController viewControllerWithStoryBoardType:(STORYBOARD_TYPE_SALEINPUT)]; + if (!AppGlobal.isMall) { + historyVC.contract = [HMSaleInputDetail_contract modelWithDic:[AppGlobal getTenantContract].toDictionary]; + } + [self.navigationController pushViewController:historyVC animated:YES]; +} + ZJLazy(SaleInputListViewModel, viewModel); @end diff --git a/HDMall/CodeClass/Business/SaleInput/ViewModels/SaleInputViewModel.m b/HDMall/CodeClass/Business/SaleInput/ViewModels/SaleInputViewModel.m index 0d4adcca2bd9f111596150c7275c2da59179578b..1954a277595fb548c0cb01ae844a24b5bd318e46 100644 --- a/HDMall/CodeClass/Business/SaleInput/ViewModels/SaleInputViewModel.m +++ b/HDMall/CodeClass/Business/SaleInput/ViewModels/SaleInputViewModel.m @@ -41,7 +41,6 @@ self.request.store = [HMSaleInputDetail_store modelWithDic:AppGlobal.user.store.toDictionary]; self.request.receiver = @"contract"; self.request.balance = false; -// self.request.saleDate = [[NSDate date] yearMonthDayString]; self.request.payments = (id)[NSMutableArray array]; for (HMSaleInputDetail_payments *payments in self.arrPayments) { HMSaleInputDetail_payments *paymentsCopy = [HMSaleInputDetail_payments modelWithDic:payments.toDictionary]; diff --git a/HDMall/CodeClass/Business/SaleInput/Views/SaleInputListTableViewCell.m b/HDMall/CodeClass/Business/SaleInput/Views/SaleInputListTableViewCell.m index 3ba4df08bd1e0131bf839ab8fd41cda984f40c35..1d637f93452d1a2eedaf8d07d25c86fe03bb2e24 100644 --- a/HDMall/CodeClass/Business/SaleInput/Views/SaleInputListTableViewCell.m +++ b/HDMall/CodeClass/Business/SaleInput/Views/SaleInputListTableViewCell.m @@ -7,7 +7,7 @@ // #import "SaleInputListTableViewCell.h" - +#import "CalculateHelper.h" @implementation SaleInputListTableViewCell - (void)awakeFromNib { @@ -18,7 +18,11 @@ - (void)configCellWithArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath { self.model = array[indexPath.row]; self.labelTItle.text = self.model.contract.name; - self.labelBillCount.text = [NSString stringWithFormat:@"%ld",self.model.saleCount.integerValue]; + NSDecimalNumber *total = nil; + for (HMSaleInputDetail_payments *cellModel in self.model.payments) { + total = [CalculateHelper calculateNum1:total num2:cellModel.total type:CalculateTypeAdd]; + } + self.labelBillCount.text = [NSString stringWithFormat:@"%@",total.moneyValue]; self.labelTime.text = self.model.saleDate; self.imgState.image = [UIImage imageNamed:self.model.z_state.img]; self.labelBillNumber.text = self.model.billNumber; diff --git a/HDMall/Tools/BaseClass/BaseListViewController.h b/HDMall/Tools/BaseClass/BaseListViewController.h index 26522ba957445b53e0d4b3f6fced17f3a9dae8fe..51acbc8c0bc2712a93b59f11480e65f16316ab5c 100644 --- a/HDMall/Tools/BaseClass/BaseListViewController.h +++ b/HDMall/Tools/BaseClass/BaseListViewController.h @@ -28,6 +28,8 @@ * åˆ†é¡µåŠ è½½ä¸€é¡µå¤§å° */ @property (nonatomic, assign) NSInteger pageSize; +/** 第一页的页ç ,默认是0 */ +@property (assign, nonatomic) NSInteger startPage; /** * å¯ç”¨åˆ†é¡µåŠ è½½æ¨¡å¼ï¼Œæ¤æ—¶çˆ¶ç±»ä¼šè‡ªåŠ¨è°ƒç”¨ç½‘ç»œè¯·æ±‚çš„æ–¹æ³•ï¼Œä¸éœ€è¦æ‰‹åŠ¨è°ƒç”¨httpRequest */ diff --git a/HDMall/Tools/BaseClass/BaseListViewController.m b/HDMall/Tools/BaseClass/BaseListViewController.m index 5e22321482ce068f5a2e5434778fa3171aed2d56..5a76ffdf95e8ca858456f2a98aa8047cacde6aa9 100644 --- a/HDMall/Tools/BaseClass/BaseListViewController.m +++ b/HDMall/Tools/BaseClass/BaseListViewController.m @@ -18,7 +18,7 @@ - (void)viewDidLoad { [super viewDidLoad]; - + self.startPage = 0; self.pageSize = 15; self.tableView.delegate = self; self.tableView.dataSource = self; @@ -65,7 +65,7 @@ - (void)paggingMode { WS(weakSelf); self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ - weakSelf.page = 1; + weakSelf.page = weakSelf.startPage; [weakSelf.arrData removeAllObjects]; /** * å类里é¢è¦é‡å†™httpRequest方法 @@ -159,13 +159,13 @@ [self.tableView.mj_footer endRefreshing]; } - if (self.arrData.count < self.pageSize * (self.page + 1)) { + if (self.arrData.count < self.pageSize * (self.page + 1 - self.startPage)) { [self.tableView.mj_footer endRefreshingWithNoMoreData]; } else { [self.tableView.mj_footer resetNoMoreData]; } - if (self.arrData.count > 0 && self.page == 0) { + if (self.arrData.count > 0 && self.page == self.startPage) { [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO]; }