Commit 59d665b2 authored by Sandy's avatar Sandy

bug fix

parent 5572cc93
...@@ -81,6 +81,9 @@ ...@@ -81,6 +81,9 @@
8F973C271F21FD54003D3ADB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F973BF01F21F6DD003D3ADB /* Main.storyboard */; }; 8F973C271F21FD54003D3ADB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8F973BF01F21F6DD003D3ADB /* Main.storyboard */; };
8F973C321F21FE32003D3ADB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F973C2F1F21FE32003D3ADB /* AppDelegate.m */; }; 8F973C321F21FE32003D3ADB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F973C2F1F21FE32003D3ADB /* AppDelegate.m */; };
8F973C341F21FE32003D3ADB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F973C301F21FE32003D3ADB /* main.m */; }; 8F973C341F21FE32003D3ADB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F973C301F21FE32003D3ADB /* main.m */; };
8FC2BE8F1F39AC270023FA6B /* SaleInputListViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FC2BE8E1F39AC270023FA6B /* SaleInputListViewModel.m */; };
8FC2BE941F39AC430023FA6B /* ico_make.png in Resources */ = {isa = PBXBuildFile; fileRef = 8FC2BE911F39AC430023FA6B /* ico_make.png */; };
8FC2BE951F39AC430023FA6B /* JSDropDownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FC2BE931F39AC430023FA6B /* JSDropDownMenu.m */; };
8FED0FB41F38602F004916CC /* AboutTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FED0FB31F38602F004916CC /* AboutTableViewController.m */; }; 8FED0FB41F38602F004916CC /* AboutTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FED0FB31F38602F004916CC /* AboutTableViewController.m */; };
8FEF5E641F285E56001496E3 /* CALayer+Addtions.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FEF5E481F285E56001496E3 /* CALayer+Addtions.m */; }; 8FEF5E641F285E56001496E3 /* CALayer+Addtions.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FEF5E481F285E56001496E3 /* CALayer+Addtions.m */; };
8FEF5E661F285E56001496E3 /* ChineseLogHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FEF5E4A1F285E56001496E3 /* ChineseLogHelper.m */; }; 8FEF5E661F285E56001496E3 /* ChineseLogHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FEF5E4A1F285E56001496E3 /* ChineseLogHelper.m */; };
...@@ -267,6 +270,11 @@ ...@@ -267,6 +270,11 @@
8F973C2E1F21FE32003D3ADB /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 8F973C2E1F21FE32003D3ADB /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
8F973C2F1F21FE32003D3ADB /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; 8F973C2F1F21FE32003D3ADB /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
8F973C301F21FE32003D3ADB /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 8F973C301F21FE32003D3ADB /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8FC2BE8D1F39AC270023FA6B /* SaleInputListViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SaleInputListViewModel.h; sourceTree = "<group>"; };
8FC2BE8E1F39AC270023FA6B /* SaleInputListViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SaleInputListViewModel.m; sourceTree = "<group>"; };
8FC2BE911F39AC430023FA6B /* ico_make.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ico_make.png; sourceTree = "<group>"; };
8FC2BE921F39AC430023FA6B /* JSDropDownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDropDownMenu.h; sourceTree = "<group>"; };
8FC2BE931F39AC430023FA6B /* JSDropDownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSDropDownMenu.m; sourceTree = "<group>"; };
8FED0FB21F38602F004916CC /* AboutTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutTableViewController.h; sourceTree = "<group>"; }; 8FED0FB21F38602F004916CC /* AboutTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutTableViewController.h; sourceTree = "<group>"; };
8FED0FB31F38602F004916CC /* AboutTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutTableViewController.m; sourceTree = "<group>"; }; 8FED0FB31F38602F004916CC /* AboutTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutTableViewController.m; sourceTree = "<group>"; };
8FEF5E471F285E56001496E3 /* CALayer+Addtions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer+Addtions.h"; sourceTree = "<group>"; }; 8FEF5E471F285E56001496E3 /* CALayer+Addtions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer+Addtions.h"; sourceTree = "<group>"; };
...@@ -680,6 +688,8 @@ ...@@ -680,6 +688,8 @@
8F4BFCE71F2F07C1003EA16B /* SaleInputViewModel.m */, 8F4BFCE71F2F07C1003EA16B /* SaleInputViewModel.m */,
8FF9F6E11F347517006B0EC0 /* SaleInputState.h */, 8FF9F6E11F347517006B0EC0 /* SaleInputState.h */,
8FF9F6E21F347517006B0EC0 /* SaleInputState.m */, 8FF9F6E21F347517006B0EC0 /* SaleInputState.m */,
8FC2BE8D1F39AC270023FA6B /* SaleInputListViewModel.h */,
8FC2BE8E1F39AC270023FA6B /* SaleInputListViewModel.m */,
); );
path = ViewModels; path = ViewModels;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -788,6 +798,7 @@ ...@@ -788,6 +798,7 @@
8F973C041F21FB67003D3ADB /* Tools */ = { 8F973C041F21FB67003D3ADB /* Tools */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8FC2BE901F39AC430023FA6B /* JSDropDownMenu */,
8FF9F6E71F37FF6C006B0EC0 /* CustomMMSpreadSheetView */, 8FF9F6E71F37FF6C006B0EC0 /* CustomMMSpreadSheetView */,
8F4BFCF51F2F3238003EA16B /* PictureTableViewCell */, 8F4BFCF51F2F3238003EA16B /* PictureTableViewCell */,
8F6C923F1F2AE4AD0060E983 /* LocationHelper */, 8F6C923F1F2AE4AD0060E983 /* LocationHelper */,
...@@ -965,6 +976,16 @@ ...@@ -965,6 +976,16 @@
path = ..; path = ..;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
8FC2BE901F39AC430023FA6B /* JSDropDownMenu */ = {
isa = PBXGroup;
children = (
8FC2BE911F39AC430023FA6B /* ico_make.png */,
8FC2BE921F39AC430023FA6B /* JSDropDownMenu.h */,
8FC2BE931F39AC430023FA6B /* JSDropDownMenu.m */,
);
path = JSDropDownMenu;
sourceTree = "<group>";
};
8FEF5E461F285E56001496E3 /* Category */ = { 8FEF5E461F285E56001496E3 /* Category */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -1132,6 +1153,7 @@ ...@@ -1132,6 +1153,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
8F973C251F21FD54003D3ADB /* LaunchScreen.storyboard in Resources */, 8F973C251F21FD54003D3ADB /* LaunchScreen.storyboard in Resources */,
8FC2BE941F39AC430023FA6B /* ico_make.png in Resources */,
8F250D2F1F297DA80031B4BC /* restrictedshine.tiff in Resources */, 8F250D2F1F297DA80031B4BC /* restrictedshine.tiff in Resources */,
8F250D2D1F297DA80031B4BC /* mask.jpg in Resources */, 8F250D2D1F297DA80031B4BC /* mask.jpg in Resources */,
8F4BFCC71F2EDCD8003EA16B /* BusinessItems.plist in Resources */, 8F4BFCC71F2EDCD8003EA16B /* BusinessItems.plist in Resources */,
...@@ -1211,6 +1233,7 @@ ...@@ -1211,6 +1233,7 @@
8F6C92381F2ADF4F0060E983 /* HomeWeatherBoard.m in Sources */, 8F6C92381F2ADF4F0060E983 /* HomeWeatherBoard.m in Sources */,
8F250D961F29D86E0031B4BC /* ZJPermissionManager.m in Sources */, 8F250D961F29D86E0031B4BC /* ZJPermissionManager.m in Sources */,
8F4BFD061F2F3314003EA16B /* GalleryCollectionViewCell.m in Sources */, 8F4BFD061F2F3314003EA16B /* GalleryCollectionViewCell.m in Sources */,
8FC2BE8F1F39AC270023FA6B /* SaleInputListViewModel.m in Sources */,
8F250D921F29D4B40031B4BC /* UserInfo.m in Sources */, 8F250D921F29D4B40031B4BC /* UserInfo.m in Sources */,
8F1040B91F25C8A000B4C16E /* MineTableViewController.m in Sources */, 8F1040B91F25C8A000B4C16E /* MineTableViewController.m in Sources */,
8F6C923B1F2ADFEC0060E983 /* WeatherModel.m in Sources */, 8F6C923B1F2ADFEC0060E983 /* WeatherModel.m in Sources */,
...@@ -1272,6 +1295,7 @@ ...@@ -1272,6 +1295,7 @@
8FF9F7021F37FF6C006B0EC0 /* MMTopRowCell.m in Sources */, 8FF9F7021F37FF6C006B0EC0 /* MMTopRowCell.m in Sources */,
8F250D271F297DA80031B4BC /* XWInteractiveTransition.m in Sources */, 8F250D271F297DA80031B4BC /* XWInteractiveTransition.m in Sources */,
8F250D391F297DA80031B4BC /* XWCoolAnimator+XWMiddlePageFlip.m in Sources */, 8F250D391F297DA80031B4BC /* XWCoolAnimator+XWMiddlePageFlip.m in Sources */,
8FC2BE951F39AC430023FA6B /* JSDropDownMenu.m in Sources */,
8FF9F7031F37FF6C006B0EC0 /* MMViewController.m in Sources */, 8FF9F7031F37FF6C006B0EC0 /* MMViewController.m in Sources */,
8F250D531F297DA80031B4BC /* XWFilterAnimator+XWRipple.m in Sources */, 8F250D531F297DA80031B4BC /* XWFilterAnimator+XWRipple.m in Sources */,
8F4BFCD61F2EF56A003EA16B /* SaleInputListTableViewCell.m in Sources */, 8F4BFCD61F2EF56A003EA16B /* SaleInputListTableViewCell.m in Sources */,
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="159" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="AOL-sy-21t"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="159" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="AOL-sy-21t">
<rect key="frame" x="0.0" y="20" width="375" height="647"/> <rect key="frame" x="0.0" y="64" width="375" height="603"/>
<color key="backgroundColor" red="0.90188914539999998" green="0.89984929560000004" blue="0.93195199969999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.90188914539999998" green="0.89984929560000004" blue="0.93195199969999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<inset key="separatorInset" minX="15" minY="0.0" maxX="0.0" maxY="0.0"/> <inset key="separatorInset" minX="15" minY="0.0" maxX="0.0" maxY="0.0"/>
<prototypes> <prototypes>
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
<constraints> <constraints>
<constraint firstAttribute="trailing" secondItem="aQG-ol-2ju" secondAttribute="trailing" constant="30" id="3C9-JN-WBq"/> <constraint firstAttribute="trailing" secondItem="aQG-ol-2ju" secondAttribute="trailing" constant="30" id="3C9-JN-WBq"/>
<constraint firstAttribute="trailing" secondItem="AOL-sy-21t" secondAttribute="trailing" id="Kdx-SC-TsM"/> <constraint firstAttribute="trailing" secondItem="AOL-sy-21t" secondAttribute="trailing" id="Kdx-SC-TsM"/>
<constraint firstItem="AOL-sy-21t" firstAttribute="top" secondItem="fKx-QB-8T3" secondAttribute="bottom" id="QOO-8v-8hV"/> <constraint firstItem="AOL-sy-21t" firstAttribute="top" secondItem="fKx-QB-8T3" secondAttribute="bottom" constant="44" id="QOO-8v-8hV"/>
<constraint firstItem="AOL-sy-21t" firstAttribute="leading" secondItem="j2C-xo-rlz" secondAttribute="leading" id="iu7-Rm-0Jn"/> <constraint firstItem="AOL-sy-21t" firstAttribute="leading" secondItem="j2C-xo-rlz" secondAttribute="leading" id="iu7-Rm-0Jn"/>
<constraint firstAttribute="bottom" secondItem="aQG-ol-2ju" secondAttribute="bottom" constant="30" id="mt7-Yx-faA"/> <constraint firstAttribute="bottom" secondItem="aQG-ol-2ju" secondAttribute="bottom" constant="30" id="mt7-Yx-faA"/>
<constraint firstItem="dCI-SM-A4p" firstAttribute="top" secondItem="AOL-sy-21t" secondAttribute="bottom" id="wkx-IT-CW7"/> <constraint firstItem="dCI-SM-A4p" firstAttribute="top" secondItem="AOL-sy-21t" secondAttribute="bottom" id="wkx-IT-CW7"/>
...@@ -1346,7 +1346,7 @@ ...@@ -1346,7 +1346,7 @@
<color key="textColor" red="1" green="0.9999405146" blue="0.99998033050000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="1" green="0.9999405146" blue="0.99998033050000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="商铺" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tk7-yh-1u7"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="合同" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tk7-yh-1u7">
<rect key="frame" x="32" y="31" width="37" height="22"/> <rect key="frame" x="32" y="31" width="37" height="22"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/> <fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="1" green="0.9999405146" blue="0.99998033050000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="1" green="0.9999405146" blue="0.99998033050000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
......
...@@ -24,4 +24,5 @@ ...@@ -24,4 +24,5 @@
- (void)httpPayments; - (void)httpPayments;
- (void)allInputMoney; - (void)allInputMoney;
- (IBAction)actionSubmit:(id)sender;
@end @end
...@@ -18,9 +18,10 @@ ...@@ -18,9 +18,10 @@
[super viewDidLoad]; [super viewDidLoad];
self.title = @"新建销售录入"; self.title = @"新建销售录入";
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 84, 0); self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 84, 0);
UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"历史查询" style:UIBarButtonItemStylePlain target:self action:@selector(actionGoHistory)]; UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"历史" style:UIBarButtonItemStylePlain target:self action:@selector(actionGoHistory)];
self.navigationItem.rightBarButtonItem = rightBtn; self.navigationItem.rightBarButtonItem = rightBtn;
[self httpPayments]; [self httpPayments];
} }
...@@ -104,13 +105,16 @@ ...@@ -104,13 +105,16 @@
- (IBAction)actionSubmit:(id)sender { - (IBAction)actionSubmit:(id)sender {
self.viewModel.request.saleCount = @(self.totalView.textFieldBillCount.text.integerValue); self.viewModel.request.saleCount = @(self.totalView.textFieldBillCount.text.integerValue);
self.viewModel.request.contract = self.topView.contract; self.viewModel.request.contract = self.topView.contract;
self.viewModel.request.saleDate = self.topView.textFieldDate.text;
WS(weakSelf); WS(weakSelf);
//赋值 //赋值
kCanNotBeNil(self.viewModel.request.contract, @"请选择合同"); kCanNotBeNil(self.viewModel.request.contract, @"请选择合同!");
[self alertTitle:@"温馨提示" msg:@"确认提交?" okAction:^(UIAlertAction * _Nullable action) { NSString *msg = [NSString stringWithFormat:@"销售日期:%@\n总金额: %@\n\n确认提交?",self.topView.textFieldDate.text, self.totalView.labelTotal.text];
[self alertTitle:@"温馨提示" msg:msg okAction:^(UIAlertAction * _Nullable action) {
[weakSelf.viewModel httpSubmit:^(BOOL isSuccess) { [weakSelf.viewModel httpSubmit:^(BOOL isSuccess) {
if (isSuccess) { if (isSuccess) {
weakSelf.commplete();
[weakSelf.navigationController popViewControllerAnimated:YES]; [weakSelf.navigationController popViewControllerAnimated:YES];
} }
}]; }];
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
self.topView.right2.hidden = YES; self.topView.right2.hidden = YES;
self.topView.userInteractionEnabled = NO; self.topView.userInteractionEnabled = NO;
self.totalView.textFieldBillCount.userInteractionEnabled = NO; self.totalView.textFieldBillCount.userInteractionEnabled = NO;
self.btnBottom.hidden = YES; [self.btnBottom setTitle:@"返回" forState:UIControlStateNormal];
self.title = @"销售录入详情"; self.title = @"销售录入详情";
WS(weakSelf); WS(weakSelf);
[self.viewModel httpDetailWithUuid:self.listModel.billNumber callBack:^(BOOL isSuccess) { [self.viewModel httpDetailWithUuid:self.listModel.billNumber callBack:^(BOOL isSuccess) {
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
CLog(@"空实现父类httpPayments方法"); CLog(@"空实现父类httpPayments方法");
} }
- (IBAction)actionSubmit:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
...@@ -12,8 +12,11 @@ ...@@ -12,8 +12,11 @@
#import "HMSaleInputDetail.h" #import "HMSaleInputDetail.h"
#import "SaleInputDetailViewController.h" #import "SaleInputDetailViewController.h"
#import "HMSaleInputQuery.h" #import "HMSaleInputQuery.h"
#import "JSDropDownMenu.h"
#import "SaleInputListViewModel.h"
@interface SaleInputListViewController () @interface SaleInputListViewController ()
@property (strong, nonatomic) HMSaleInputQuery *query;
@property (strong, nonatomic) SaleInputListViewModel *viewModel;
@end @end
...@@ -26,6 +29,23 @@ ...@@ -26,6 +29,23 @@
[self refresh]; [self refresh];
self.tableView.rowHeight = 159; self.tableView.rowHeight = 159;
self.btnAdd.hidden = !AppGlobal.permission.saleinput.newField; self.btnAdd.hidden = !AppGlobal.permission.saleinput.newField;
[self configDropMenu];
}
- (void)configDropMenu {
JSDropDownMenu *menu = [[JSDropDownMenu alloc] initWithOrigin:CGPointMake(0, 0) andHeight:45];
menu.indicatorColor = [UIColor colorWithRed:175.0f / 255.0f green:175.0f / 255.0f blue:175.0f / 255.0f alpha:1.0];
menu.separatorColor = [UIColor colorWithRed:210.0f / 255.0f green:210.0f / 255.0f blue:210.0f / 255.0f alpha:1.0];
menu.textColor = [UIColor colorWithRed:83.f / 255.0f green:83.f / 255.0f blue:83.f / 255.0f alpha:1.0f];
menu.dataSource = self.viewModel;
menu.delegate = self.viewModel;
[self.view addSubview:menu];
WS(weakSelf);
self.viewModel.blockRequest = ^{
weakSelf.page = 1;
[weakSelf httpRequest];
};
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
...@@ -34,16 +54,14 @@ ...@@ -34,16 +54,14 @@
} }
- (void)httpRequest { - (void)httpRequest {
self.query.contracts = [AppGlobal getUserContractUuids]; self.viewModel.query.page = @(self.page);
self.query.page = @(self.page); self.viewModel.query.pageSize = @(self.pageSize);
self.query.pageSize = @(self.pageSize);
self.query.dateRange = [HMSaleInputQuery_dateRange new];
self.query.dateRange.beginDate = @"2016-07-12";
self.query.dateRange.endDate = [NSDate date].yearMonthDayString;
WS(weakSelf); WS(weakSelf);
[ZJHttpManager POST:@"hdmall/salesinput/query" parameters:self.query.toDictionary complete:^(id responseObject, NSError *error) { [MBProgressHUD j_loading];
[ZJHttpManager POST:@"hdmall/salesinput/query" parameters:self.viewModel.query.toDictionary complete:^(id responseObject, NSError *error) {
[MBProgressHUD j_hideLoadingView];
if (kIsResponse) { if (kIsResponse) {
if (weakSelf.page == 0) { if (weakSelf.page == 1) {
[weakSelf.arrData removeAllObjects]; [weakSelf.arrData removeAllObjects];
} }
...@@ -75,25 +93,14 @@ ...@@ -75,25 +93,14 @@
- (void)actionAdd:(UIButton *)sender { - (void)actionAdd:(UIButton *)sender {
SaleInputAddViewController *addVC = [SaleInputAddViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_SALEINPUT]; SaleInputAddViewController *addVC = [SaleInputAddViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_SALEINPUT];
WS(weakSelf);
addVC.commplete = ^{
weakSelf.page = 1;
[weakSelf httpRequest];
};
[self listPushCustomAnimate:addVC]; [self listPushCustomAnimate:addVC];
} }
ZJLazy(HMSaleInputQuery, query); ZJLazy(SaleInputListViewModel, viewModel);
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end @end
//
// SaleInputListViewModel.h
// HDMall
//
// Created by Javen on 2017/8/8.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JSDropDownMenu.h"
#import "HMSaleInputQuery.h"
#import "SaleInputState.h"
@interface SaleInputListViewModel : NSObject<JSDropDownMenuDataSource, JSDropDownMenuDelegate>
@property (strong, nonatomic) NSArray *arrDropMenu;
@property (strong, nonatomic) NSArray *arrDateTitles;
@property (strong, nonatomic) NSArray *arrStateTitles;
@property (assign, nonatomic) NSInteger dateTag;
@property (assign, nonatomic) NSInteger stateTag;
@property (strong, nonatomic) HMSaleInputQuery *query;
@property (copy, nonatomic) void (^blockRequest)(void);
@end
//
// SaleInputListViewModel.m
// HDMall
//
// Created by Javen on 2017/8/8.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import "SaleInputListViewModel.h"
#import "NSDate+Additions.h"
#define KDateRangeTypeWeek @"最近一周"
#define KDateRangeTypeOneMonth @"最近一月"
#define KDateRangeTypeThreeMonth @"最近三月"
@implementation SaleInputListViewModel
- (instancetype)init {
self = [super init];
if (self) {
self.arrDateTitles = @[KDateRangeTypeWeek, KDateRangeTypeOneMonth, KDateRangeTypeThreeMonth];
self.arrStateTitles = @[@"全部",@"未生效", @"已生效"];
self.arrDropMenu = @[self.arrDateTitles, self.arrStateTitles];
//第一次请求,默认是最近一周
NSDate *end = [NSDate date];
NSDate *begin = [NSDate dateWithTimeInterval:-7 * 24 * 60 * 60 sinceDate:end];
self.query.contracts = [AppGlobal getUserContractUuids];
self.query.dateRange = [HMSaleInputQuery_dateRange new];
self.query.dateRange.beginDate = begin.yearMonthDayString;
self.query.dateRange.endDate = end.yearMonthDayString;
}
return self;
}
- (NSInteger)numberOfColumnsInMenu:(JSDropDownMenu *)menu {
return 2;
}
- (NSInteger)menu:(JSDropDownMenu *)menu numberOfRowsInColumn:(NSInteger)column leftOrRight:(NSInteger)leftOrRight leftRow:(NSInteger)leftRow {
return [self.arrDropMenu[column] count];
}
- (NSString *)menu:(JSDropDownMenu *)menu titleForColumn:(NSInteger)column {
return [self.arrDropMenu[column] firstObject];
}
- (NSString *)menu:(JSDropDownMenu *)menu titleForRowAtIndexPath:(JSIndexPath *)indexPath {
return [self.arrDropMenu[indexPath.column] objectAtIndex:indexPath.row];
}
- (BOOL)haveRightTableViewInColumn:(NSInteger)column {
return NO;
}
- (CGFloat)widthRatioOfLeftColumn:(NSInteger)column {
return 1;
}
- (NSInteger)currentLeftSelectedRow:(NSInteger)column {
if (column == 0) {
return self.dateTag;
} else {
return self.stateTag;
}
}
- (void)menu:(JSDropDownMenu *)menu didSelectRowAtIndexPath:(JSIndexPath *)indexPath {
NSString *title = [self.arrDropMenu[indexPath.column] objectAtIndex:indexPath.row];
if (indexPath.column == 0) {
self.dateTag = indexPath.row;
NSDate *end = [NSDate date];
NSDate *begin = nil;
if ([title isEqualToString:KDateRangeTypeWeek]) {
begin = [NSDate dateWithTimeInterval:-7 * 24 * 60 * 60 sinceDate:end];
}else if ([title isEqualToString:KDateRangeTypeOneMonth]){
begin = [NSDate dateWithTimeInterval:-30 * 24 * 60 * 60 sinceDate:end];
}else if ([title isEqualToString:KDateRangeTypeThreeMonth]){
begin = [NSDate dateWithTimeInterval:-90 * 24 * 60 * 60 sinceDate:end];
}
self.query.dateRange.beginDate = begin.yearMonthDayString;
self.query.dateRange.endDate = end.yearMonthDayString;
} else {
self.stateTag = indexPath.row;
if (indexPath.row == 0) {
self.query.state = nil;
}else{
self.query.state = [SaleInputState stateWithText:title].code;
}
}
self.blockRequest();
}
ZJLazy(HMSaleInputQuery, query);
@end
...@@ -20,5 +20,7 @@ ...@@ -20,5 +20,7 @@
*/ */
@property (strong, nonatomic) NSDictionary *dicData; @property (strong, nonatomic) NSDictionary *dicData;
//+ (SaleInputState *)stateWithText:(NSString *)text; + (SaleInputState *)stateWithText:(NSString *)text;
+ (NSArray *)allStateCodes;
@end @end
...@@ -26,4 +26,21 @@ ...@@ -26,4 +26,21 @@
self.text = [[self.dicData objectForKey:code] objectForKey:@"text"]; self.text = [[self.dicData objectForKey:code] objectForKey:@"text"];
self.img = [[self.dicData objectForKey:code] objectForKey:@"img"]; self.img = [[self.dicData objectForKey:code] objectForKey:@"img"];
} }
+ (SaleInputState *)stateWithText:(NSString *)text {
SaleInputState *state = [SaleInputState new];
for (NSString *key in state.dicData.allKeys) {
NSDictionary *dic = [state.dicData objectForKey:key];
if ([[dic objectForKey:@"text"] isEqualToString:text]) {
state.code = key;
break;
}
}
return state;
}
+ (NSArray *)allStateCodes {
SaleInputState *state = [SaleInputState new];
return state.dicData.allKeys;
}
@end @end
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
self.request.store = [HMSaleInputDetail_store modelWithDic:AppGlobal.user.store.toDictionary]; self.request.store = [HMSaleInputDetail_store modelWithDic:AppGlobal.user.store.toDictionary];
self.request.receiver = @"contract"; self.request.receiver = @"contract";
self.request.balance = false; self.request.balance = false;
self.request.saleDate = [[NSDate date] yearMonthDayString]; // self.request.saleDate = [[NSDate date] yearMonthDayString];
self.request.payments = (id)[NSMutableArray array]; self.request.payments = (id)[NSMutableArray array];
for (HMSaleInputDetail_payments *payments in self.arrPayments) { for (HMSaleInputDetail_payments *payments in self.arrPayments) {
HMSaleInputDetail_payments *paymentsCopy = [HMSaleInputDetail_payments modelWithDic:payments.toDictionary]; HMSaleInputDetail_payments *paymentsCopy = [HMSaleInputDetail_payments modelWithDic:payments.toDictionary];
......
...@@ -14,24 +14,43 @@ ...@@ -14,24 +14,43 @@
- (void)awakeFromNib { - (void)awakeFromNib {
[super awakeFromNib]; [super awakeFromNib];
self.textFieldDate.type = DateTextFieldYearMonthDay;
self.textFieldDate.rangeType = DateTextFieldRangeBefore;
WS(weakSelf);
self.textFieldDate.blockEndEdit = ^{
kCanNotBeNil(weakSelf.contract.uuid, @"请先选择合同!");
[weakSelf httpToDayData];
};
if (!AppGlobal.isMall) { if (!AppGlobal.isMall) {
self.btnStore.userInteractionEnabled = NO; self.btnStore.userInteractionEnabled = NO;
self.right1.hidden = YES; self.right1.hidden = YES;
UserInfo_contracts *contract = AppGlobal.user.contracts[0]; UserInfo_contracts *contract = AppGlobal.user.contracts[0];
self.contract = [HMSaleInputDetail_contract modelWithDic:contract.toDictionary]; self.contract = [HMSaleInputDetail_contract modelWithDic:contract.toDictionary];
[self.btnStore setTitle:contract.name forState:UIControlStateNormal]; [self.btnStore setTitle:contract.name forState:UIControlStateNormal];
[self actionContract:nil];
}
//如果是每天早晨11点之前进入销售录入页面,则显示日期为昨天
NSDate *dateNow = [NSDate date];
//时间点字符串
NSString *point = [dateNow.yearMonthDayString stringByAppendingString:@" 11:00:00"];
NSDateFormatter *f = [NSDateFormatter new];
[f setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *datePoint = [f dateFromString:point];
NSComparisonResult result = [dateNow compare:datePoint];
if (result == NSOrderedAscending) {//小于
NSDate *yesterDay = [NSDate dateWithTimeInterval:- 24 * 60 * 60 sinceDate:dateNow];
self.textFieldDate.text = yesterDay.yearMonthDayString;
}else{
self.textFieldDate.text = [dateNow yearMonthDayString];
} }
self.textFieldDate.type = DateTextFieldYearMonthDay;
self.textFieldDate.rangeType = DateTextFieldRangeBefore;
WS(weakSelf);
self.textFieldDate.blockEndEdit = ^{
[weakSelf httpToDayData];
};
} }
- (IBAction)actionContract:(id)sender { - (IBAction)actionContract:(id)sender {
if (AppGlobal.user.contracts.count == 1) { if (!AppGlobal.isMall) {
UserInfo_contracts *contract = AppGlobal.user.contracts[0]; UserInfo_contracts *contract = [AppGlobal getTenantContract];
self.contract = [HMSaleInputDetail_contract modelWithDic:contract.toDictionary]; self.contract = [HMSaleInputDetail_contract modelWithDic:contract.toDictionary];
[self.btnStore setTitle:contract.name forState:UIControlStateNormal]; [self.btnStore setTitle:contract.name forState:UIControlStateNormal];
[self httpToDayData]; [self httpToDayData];
...@@ -39,7 +58,8 @@ ...@@ -39,7 +58,8 @@
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"选择合同" message:nil preferredStyle:(UIAlertControllerStyleAlert)]; UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"选择合同" message:nil preferredStyle:(UIAlertControllerStyleAlert)];
for (UserInfo_contracts *contract in AppGlobal.user.contracts) { for (UserInfo_contracts *contract in AppGlobal.user.contracts) {
UIAlertAction *action = [UIAlertAction actionWithTitle:contract.name style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSString *title = [NSString stringWithFormat:@"%@【%@】", contract.name, contract.code];
UIAlertAction *action = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
self.contract = [HMSaleInputDetail_contract modelWithDic:contract.toDictionary]; self.contract = [HMSaleInputDetail_contract modelWithDic:contract.toDictionary];
[self.btnStore setTitle:contract.name forState:UIControlStateNormal]; [self.btnStore setTitle:contract.name forState:UIControlStateNormal];
[self httpToDayData]; [self httpToDayData];
...@@ -58,7 +78,9 @@ ...@@ -58,7 +78,9 @@
* 获取今日的销售录入数据 * 获取今日的销售录入数据
*/ */
- (void)httpToDayData { - (void)httpToDayData {
kCanNotBeNil(self.contract.uuid, @"请选择合同!"); if (self.contract == nil) {
return;
}
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:self.contract.uuid, @"contract", [NSDictionary dictionaryWithObjectsAndKeys:[self.textFieldDate.text stringByAppendingString:@" 00:00:00"], @"beginDate", [self.textFieldDate.text stringByAppendingString:@" 23:59:59"], @"endDate", nil], @"dateRange", nil]; NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:self.contract.uuid, @"contract", [NSDictionary dictionaryWithObjectsAndKeys:[self.textFieldDate.text stringByAppendingString:@" 00:00:00"], @"beginDate", [self.textFieldDate.text stringByAppendingString:@" 23:59:59"], @"endDate", nil], @"dateRange", nil];
[MBProgressHUD j_loading]; [MBProgressHUD j_loading];
WS(weakSelf); WS(weakSelf);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0</string> <string>1.0.0</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>1</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
} }
- (void)listTableViewReloadData { - (void)listTableViewReloadData {
[MBProgressHUD j_hideLoadingView]; // [MBProgressHUD j_hideLoadingView];
self.tableView.emptyDataSetSource = self; self.tableView.emptyDataSetSource = self;
self.tableView.emptyDataSetDelegate = self; self.tableView.emptyDataSetDelegate = self;
[self.tableView reloadData]; [self.tableView reloadData];
......
...@@ -114,4 +114,5 @@ typedef NS_ENUM(NSInteger, STORYBOARD_TYPE_) { ...@@ -114,4 +114,5 @@ typedef NS_ENUM(NSInteger, STORYBOARD_TYPE_) {
*/ */
- (void)hasPermission:(BOOL)permission yes:(void (^__nonnull)(void))yes no:(void (^__nonnull)(void))no; - (void)hasPermission:(BOOL)permission yes:(void (^__nonnull)(void))yes no:(void (^__nonnull)(void))no;
+ (UIViewController *_Nullable)getCurrentVC;
@end @end
...@@ -151,4 +151,43 @@ ...@@ -151,4 +151,43 @@
return [numberPre evaluateWithObject:futureString]; return [numberPre evaluateWithObject:futureString];
} }
//获取当前屏幕显示的viewcontroller
+ (UIViewController *)getCurrentVC
{
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
UIViewController *currentVC = [self getCurrentVCFrom:rootViewController];
return currentVC;
}
+ (UIViewController *)getCurrentVCFrom:(UIViewController *)rootVC
{
UIViewController *currentVC;
if ([rootVC presentedViewController]) {
// 视图是被presented出来的
rootVC = [rootVC presentedViewController];
}
if ([rootVC isKindOfClass:[UITabBarController class]]) {
// 根视图为UITabBarController
currentVC = [self getCurrentVCFrom:[(UITabBarController *)rootVC selectedViewController]];
} else if ([rootVC isKindOfClass:[UINavigationController class]]){
// 根视图为UINavigationController
currentVC = [self getCurrentVCFrom:[(UINavigationController *)rootVC visibleViewController]];
} else {
// 根视图为非导航类
currentVC = rootVC;
}
return currentVC;
}
@end @end
//
// JSDropDownMenu.h
// JSDropDownMenu
//
// Created by Jsfu on 15-1-12.
// Copyright (c) 2015年 jsfu. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
@interface JSIndexPath : NSObject
@property (nonatomic, assign) NSInteger column;
// 0 左边 1 右边
@property (nonatomic, assign) NSInteger leftOrRight;
// 左边行
@property (nonatomic, assign) NSInteger leftRow;
// 右边行
@property (nonatomic, assign) NSInteger row;
- (instancetype)initWithColumn:(NSInteger)column leftOrRight:(NSInteger)leftOrRight leftRow:(NSInteger)leftRow row:(NSInteger)row;
+ (instancetype)indexPathWithCol:(NSInteger)col leftOrRight:(NSInteger)leftOrRight leftRow:(NSInteger)leftRow row:(NSInteger)row;
@end
#pragma mark - data source protocol
@class JSDropDownMenu;
@protocol JSDropDownMenuDataSource <NSObject>
@required
- (NSInteger)menu:(JSDropDownMenu *)menu numberOfRowsInColumn:(NSInteger)column leftOrRight:(NSInteger)leftOrRight leftRow:(NSInteger)leftRow;
- (NSString *)menu:(JSDropDownMenu *)menu titleForRowAtIndexPath:(JSIndexPath *)indexPath;
- (NSString *)menu:(JSDropDownMenu *)menu titleForColumn:(NSInteger)column;
/**
* 表视图显示时,左边表显示比例
*/
- (CGFloat)widthRatioOfLeftColumn:(NSInteger)column;
/**
* 表视图显示时,是否需要两个表显示
*/
- (BOOL)haveRightTableViewInColumn:(NSInteger)column;
/**
* 返回当前菜单左边表选中行
*/
- (NSInteger)currentLeftSelectedRow:(NSInteger)column;
@optional
//default value is 1
- (NSInteger)numberOfColumnsInMenu:(JSDropDownMenu *)menu;
/**
* 是否需要显示为UICollectionView 默认为否
*/
- (BOOL)displayByCollectionViewInColumn:(NSInteger)column;
@end
#pragma mark - delegate
@protocol JSDropDownMenuDelegate <NSObject>
@optional
- (void)menu:(JSDropDownMenu *)menu didSelectRowAtIndexPath:(JSIndexPath *)indexPath;
- (void)menu:(JSDropDownMenu *)menu didTapMenuAtIndex:(NSInteger)index;
@end
#pragma mark - interface
@interface JSDropDownMenu : UIView <UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
@property (nonatomic, weak) id <JSDropDownMenuDataSource> dataSource;
@property (nonatomic, weak) id <JSDropDownMenuDelegate> delegate;
@property (nonatomic, strong) UIColor *indicatorColor;
@property (nonatomic, strong) UIColor *textColor;
@property (nonatomic, strong) UIColor *separatorColor;
@property (nonatomic, copy) void (^blockTapMenu)(NSInteger index);
/**
* the width of menu will be set to screen width defaultly
*
* @param origin the origin of this view's frame
* @param height menu's height
*
* @return menu
*/
- (instancetype)initWithOrigin:(CGPoint)origin andHeight:(CGFloat)height;
- (NSString *)titleForRowAtIndexPath:(JSIndexPath *)indexPath;
- (void)updateMenuTitle:(NSString *)string;
- (void)backgroundTapped:(UITapGestureRecognizer *)paramSender;
@end
This diff is collapsed.
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
/** 获取用户的所有合同uuid */ /** 获取用户的所有合同uuid */
- (NSMutableArray *)getUserContractUuids; - (NSMutableArray *)getUserContractUuids;
/** 获取商户用户的合同(默认是第一个,异常状况会提示 */
- (UserInfo_contracts *)getTenantContract;
/** 保存基础信息 */ /** 保存基础信息 */
- (void)saveBaseInfo; - (void)saveBaseInfo;
......
...@@ -46,5 +46,22 @@ static NSString *const zj_saved_isMall = @"zj_saved_isMall"; ...@@ -46,5 +46,22 @@ static NSString *const zj_saved_isMall = @"zj_saved_isMall";
return arr; return arr;
} }
/** 获取商户用户的合同(默认是第一个) */
- (UserInfo_contracts *)getTenantContract{
if (self.isMall) {
[MBProgressHUD j_warningMessage:@"该用户是商场用户"];
return nil;
}
UserInfo_contracts *contract = [self.user.contracts firstObject];
if (!contract) {
[MBProgressHUD j_warningMessage:@"该商户没有合同"];;
}else if(self.user.contracts.count > 1){
[MBProgressHUD j_warningMessage:@"该商户有多个合同,默认选取第一个"];
}
return contract;
}
ZJLazy(ZJPermissionManager, permission) ZJLazy(ZJPermissionManager, permission)
@end @end
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
return; return;
} }
WS(weakSelf); WS(weakSelf);
[self.manager POST:@"hdmall/media/upload" parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) { [self.manager POST:@"hdmall/media/upload/list" parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
for (ZJBaseFileModel *file in files) { for (ZJBaseFileModel *file in files) {
[formData appendPartWithFileData:file.data //data [formData appendPartWithFileData:file.data //data
name:file.keyName //接口key值 name:file.keyName //接口key值
...@@ -171,10 +171,10 @@ ...@@ -171,10 +171,10 @@
kFalseHttpTips; kFalseHttpTips;
} }
[weakSelf logWithUrl:@"hdmall/media/upload" Method:@"UPLOAD" param:params respones:responseObject]; [weakSelf logWithUrl:@"hdmall/media/upload/list" Method:@"UPLOAD" param:params respones:responseObject];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[MBProgressHUD j_error:@"上传失败" complete:nil]; [MBProgressHUD j_error:@"上传失败" complete:nil];
[weakSelf logWithUrl:@"hdmall/media/upload" Method:@"UPLOAD" param:params respones:error]; [weakSelf logWithUrl:@"hdmall/media/upload/list" Method:@"UPLOAD" param:params respones:error];
}]; }];
} }
......
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