Commit 6231ba9d authored by Sandy's avatar Sandy

bug fix

parent 59d665b2
......@@ -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"/>
......
......@@ -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
......@@ -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
......@@ -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];
......
......@@ -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;
......
......@@ -28,6 +28,8 @@
* 分页加载一页大小
*/
@property (nonatomic, assign) NSInteger pageSize;
/** 第一页的页码,默认是0 */
@property (assign, nonatomic) NSInteger startPage;
/**
* 启用分页加载模式,此时父类会自动调用网络请求的方法,不需要手动调用httpRequest
*/
......
......@@ -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];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment