Commit e1c7f866 authored by Sandy's avatar Sandy

界面计算金额、日期选择逻辑等细节调整

parent cb899c68
This diff is collapsed.
......@@ -92,6 +92,10 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ
failure:(void (^)(id))fail;
- (void)postUrl:(NSString *)url params:(id)params success:(void (^)(id data))succ failure:(void (^)(id data))fail;
- (void)getUrl:(NSString *)url params:(id)params success:(void (^)(id data))succ failure:(void (^)(id data))fail;
@end
......
......@@ -20,6 +20,7 @@
#import "IBTCommon.h"
#import "VankeCommonModel.h"
#import "ICRDataBaseController.h"
#import "VankeConfig.h"
//#import "ICRStoreResult.h"
#define MAX_CONCURRENCY_UPLOAD 1
......@@ -705,4 +706,20 @@ acceptTypeJson:YES
// TODO
}
- (void)getUrl:(NSString *)url params:(id)params success:(void (^)(id data))succ failure:(void (^)(id data))fail {
NSString *requestUrl = [VANKE_SERVER_BASE_URL stringByAppendingFormat:@"/%@", @"shop/query"];
[self GET:requestUrl parameters:params needToken:YES acceptTypeJson:YES success:^(AFHTTPRequestOperation *operation, id responseObject) {
succ(responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
fail(error);
}];
}
@end
......@@ -28,6 +28,7 @@
//new HTTP
//#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:8281/cruiser-server/rest"
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self;
// Import Headers
#import "ICRUtilsMacro.h"
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "right_icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "right_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "sales_top_input_pic.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sales_top_input_pic@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -22,7 +22,11 @@
#define VANKE_BAIDU_WEATHER_SERVER_URL @"http://api.map.baidu.com/telematics/v3/weather"
// 后台服务基准地址
#define VANKE_SERVER_BASE_URL @"http://140.206.62.178:8080/wanke-server/rest"
//#define VANKE_SERVER_BASE_URL @"http://140.206.62.178:8080/wanke-server/rest"
// 测试环境
#define VANKE_SERVER_BASE_URL @"http://218.244.151.129:7580/wanke-server/rest"
// 后台多媒体文件基准地址
#define VANKE_SERVER_MEDIA_BASE_URL @"http://140.206.62.178:8080"
......
......@@ -23,6 +23,7 @@
#import "VankeNoticeListBoard_iPhone.h"
#import "VankeStatementListBoard_iPhone.h"
#import "ICRAnnouncementViewController.h"
#import "SalesInputViewController.h"
#pragma mark -
......@@ -123,7 +124,13 @@ ON_SIGNAL3(VankeAffairsBoard_iPhone, btnBill, signal) {
}
ON_SIGNAL3(VankeAffairsBoard_iPhone, btnSaleInput, signal) {
[GEToast showWithText:@"销售录入正在开发中..." bottomOffset:60.0f duration:1.0f];
// [GEToast showWithText:@"销售录入正在开发中..." bottomOffset:60.0f duration:1.0f];
SalesInputViewController *salesVC = [[SalesInputViewController alloc] init];
VankeCommonModel *model = [VankeCommonModel sharedInstance];
[model curUserIsTenant];
[self.navigationController pushViewController:salesVC animated:YES];
}
ON_SIGNAL3(VankeAffairsBoard_iPhone, btnServiceApply, signal) {
......
//
// ChooseShopViewController.h
// vanke
//
// Created by Z on 16/4/19.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void (^block)(NSString *);
@interface ChooseShopViewController : UIViewController
@property (nonatomic, copy) block chooseBlock;
@end
//
// ChooseShopViewController.m
// vanke
//
// Created by Z on 16/4/19.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "ChooseShopViewController.h"
#import "UIImage+Helper.h"
#import "ICRHTTPController.h"
#define kCellId @"searchCell"
@interface ChooseShopViewController ()<UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>
@property (nonatomic, strong) UISearchBar *searchBar;
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, copy) NSString *searchText;
@end
@implementation ChooseShopViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"选择商铺";
[self setUPSearchBar];
[self setUpTableView];
// Do any additional setup after loading the view.
}
- (void)setUPSearchBar {
self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 50)];
self.searchBar.backgroundImage = [UIImage imageWithColor:[UIColor colorWithRed:0.953 green:0.439 blue:0.063 alpha:1.000]];
self.searchBar.tintColor = [UIColor whiteColor];
self.searchBar.placeholder = @"请输入关键字";
self.searchBar.delegate = self;
[self.view addSubview:self.searchBar];
}
#pragma mark =========== searbar delegate ===========
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
[self.view endEditing:YES];
searchBar.showsCancelButton = NO;
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
self.searchText = searchText;
}
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
searchBar.showsCancelButton = YES;
return YES;
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[self searchShopName:self.searchText];
[self.view endEditing:YES];
}
- (void)searchShopName:(NSString *)name {
NSDictionary *param = @{@"codeOrNameLike":name,
@"projectIdEquals":@""};
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl getUrl:@"rest/shop/" params:param success:^(id data){
NSLog(@"d");
} failure:^(id data){
}];
}
- (void)setUpTableView {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.searchBar.bottom, SCREEN_WIDTH, SCREEN_HEIGHT - self.searchBar.bottom - 64) style:UITableViewStylePlain];
// self.tableView.backgroundColor = [UIColor greenColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellId];
[self.view addSubview:self.tableView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
cell.textLabel.text = [NSString stringWithFormat:@"星巴克【A01-0%ld】", (long)indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.chooseBlock(@"选择好了商铺");
[self.navigationController popViewControllerAnimated:YES];
}
- (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
//
// HistoryViewController.h
// vanke
//
// Created by Z on 16/4/18.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HistoryViewController : UIViewController
@end
//
// HistoryViewController.m
// vanke
//
// Created by Z on 16/4/18.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "HistoryViewController.h"
#import "HistoryTopView.h"
#define klineCount 19 //列数
#define kListWidth 100 //一个表格的宽度
#define kListHeight 40
#define kBottomHeight 60 //表格最底部的那行的宽度
@interface HistoryViewController ()<UIScrollViewDelegate>
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) NSArray *titles;
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) HistoryTopView *topView;
@end
@implementation HistoryViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.automaticallyAdjustsScrollViewInsets = NO;
self.title = @"历史";
self.titles = @[@"日期",@"金额(元)",@"现金",@"刷卡",@"优惠券"];
self.view.backgroundColor = [UIColor whiteColor];
[self setUpTopView];
[self setUPScrollView];
// Do any additional setup after loading the view.
}
- (void)setUPScrollView {
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 150, SCREEN_WIDTH, SCREEN_HEIGHT - 150 - 64)];
self.scrollView.contentSize = CGSizeMake(kListWidth * self.titles.count, kListHeight * klineCount + kBottomHeight);
self.scrollView.bounces = NO;
self.scrollView.delegate = self;
//双层for循环,i待代表列数,j代表行数
for (int i = 0; i < self.titles.count; i++) {
for (int j = 0; j < klineCount; j++) {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(kListWidth * i, kListHeight + kListHeight * j, kListWidth, kListHeight)];
label.textAlignment = NSTextAlignmentCenter;
label.text = [NSString stringWithFormat:@"假数据假%d", j];
[self.scrollView insertSubview:label atIndex:0];//防止前面的别挡住
label.backgroundColor = [UIColor colorWithRed:1.000 green:0.976 blue:0.953 alpha:1.000];
if (i == 0) {
label.tag = 3000 + j;
}else if(i == 1){//金额
label.textColor = [UIColor redColor];
}
}
//顶部的浮动视图
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(kListWidth * i, 0, kListWidth, 44)];
label.tag = 1000 + i;
label.text = self.titles[i];
label.font = [UIFont systemFontOfSize:19];
label.textAlignment = NSTextAlignmentCenter;
if (i != 0) {
[self.scrollView insertSubview:label belowSubview:[self.scrollView viewWithTag:1000 + i -1]];//防止前面的别挡住
}else{
[self.scrollView addSubview:label];
}
label.backgroundColor = [UIColor whiteColor];
label.backgroundColor = [UIColor colorWithRed:1.000 green:0.976 blue:0.953 alpha:1.000];
//底部浮动的视图
UILabel *labelBottom = [[UILabel alloc] initWithFrame:CGRectMake(kListWidth * i, self.scrollView.contentOffset.y + self.scrollView.height - kBottomHeight, kListWidth, kBottomHeight)];
labelBottom.text = self.titles[i];
labelBottom.backgroundColor = [UIColor grayColor];
labelBottom.font = [UIFont systemFontOfSize:28];
labelBottom.textAlignment = NSTextAlignmentCenter;
labelBottom.tag = 2000 + i;
[self.scrollView addSubview:labelBottom];
if (i != 0) {
[self.scrollView insertSubview:labelBottom belowSubview:[self.scrollView viewWithTag:2000 + i -1]];//防止前面的别挡住
if (i==1) {
labelBottom.textColor = [UIColor redColor];
}else{
labelBottom.textColor = [UIColor whiteColor];
}
}else{
[self.scrollView addSubview:labelBottom];
}
}
[self.view addSubview:self.scrollView];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
for (int i = 0; i < self.titles.count; i++) {
UILabel *label = (UILabel *)[scrollView viewWithTag:1000 + i];
label.y = scrollView.contentOffset.y;
UILabel *labelBottom = (UILabel *)[scrollView viewWithTag:2000 + i];
labelBottom.y = self.scrollView.contentOffset.y + self.scrollView.height - kBottomHeight;
if (i == 0) {
label.x = scrollView.contentOffset.x;
labelBottom.x = scrollView.contentOffset.x;
}
}
for (int i = 0; i < klineCount; i++) {
UILabel *label = (UILabel *)[scrollView viewWithTag:3000 + i];
label.x = scrollView.contentOffset.x;
}
}
- (void)setUpTopView {
HistoryTopView *topView = [self viewWithNibName:@"HistoryTopView"];
topView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 150 + 64);
self.topView = topView;
self.topView.userInteractionEnabled = YES;
[topView.buttonStartDate addTarget:self action:@selector(startDateAction) forControlEvents:UIControlEventTouchUpInside];
[topView.buttonEndDate addTarget:self action:@selector(endDateAction) forControlEvents:UIControlEventTouchUpInside];
[self setUpDatePicker];
[self.view addSubview:topView];
}
- (void)setUpDatePicker {
UIDatePicker *startDatePicker = [[UIDatePicker alloc] init];
startDatePicker.date = [NSDate dateWithTimeInterval:-60 * 60 * 24 sinceDate:[NSDate date]];
startDatePicker.tag = 1100;
startDatePicker.datePickerMode = UIDatePickerModeDate;
[startDatePicker addTarget:self action:@selector(oneDatePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
self.topView.startDate.inputView = startDatePicker;
UIDatePicker *endDatePicker = [[UIDatePicker alloc] init];
endDatePicker.tag = 1200;
endDatePicker.date = [NSDate date];
endDatePicker.datePickerMode = UIDatePickerModeDate;
[endDatePicker addTarget:self action:@selector(oneDatePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
self.topView.endDate.inputView = endDatePicker;
}
- (void)oneDatePickerValueChanged:(UIDatePicker *)datePicker {
NSDate *date = datePicker.date;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd"];
NSString *strTime = [df stringFromDate:date];
switch (datePicker.tag) {
case 1100:
{
self.topView.startDate.text = strTime;
}
break;
case 1200:
{
self.topView.endDate.text = strTime;
}
break;
default:
break;
}
}
- (void)startDateAction {
NSLog(@"start");
[self.topView startDateBecomeFistRespond];
}
- (void)endDateAction {
NSLog(@"end");
[self.topView endDateBecomeFistRespond];
}
- (id)viewWithNibName:(NSString *)viewName {
NSArray* nibView = [[NSBundle mainBundle] loadNibNamed:viewName owner:nil options:nil];
return [nibView objectAtIndex:0];
}
- (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
//
// SalesInputViewController.h
// vanke
//
// Created by Z on 16/4/15.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "IBTUIViewController.h"
@interface SalesInputViewController : UIViewController
@end
//
// SalesInputViewController.m
// vanke
//
// Created by Z on 16/4/15.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "SalesInputViewController.h"
#import "SalesInputTopView.h"
#import "SalesInputTableViewCell.h"
#import "VankeAppBoard_iPhone.h"
#import "HistoryViewController.h"
#import "ChooseShopViewController.h"
#import "VankeUserLoginAPI.h"
#import "ICRHTTPController.h"
#import "MyToolBar.h"
#import "SalesInputTotalVIew.h"
#import "ICRAppMacro.h"
#define kCellCount 20
#define kCellID @"SalesInputTableViewCell.h"
@interface SalesInputViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) SalesInputTopView *topView;
@property (nonatomic, strong) UIDatePicker *datePicker;
@property (nonatomic, strong) UIImage *navigationbarColorImage;
@property (nonatomic, strong) SalesInputTotalVIew *totalView;
@property (nonatomic, strong) NSString *selectDate;
@property (nonatomic, strong) NSMutableDictionary *cellDataDic;
@end
@implementation SalesInputViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.cellDataDic = [NSMutableDictionary dictionary];
self.view.backgroundColor = [UIColor whiteColor];
[self setUpNavigationBar];
[self setUpTopView];
[self setUpTableView];
[self setUpTotalView];
// Do any additional setup after loading the view.
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[VankeAppBoard_iPhone sharedInstance] hideMenu];
}
ON_WILL_APPEAR( signal )
{
[[VankeAppBoard_iPhone sharedInstance] hideMenu];
}
- (void)setUpTableView {
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 125, SCREEN_WIDTH, SCREEN_HEIGHT - self.topView.bottom) style:UITableViewStylePlain];
self.tableView.contentInset = UIEdgeInsetsMake(179, 0, 0, 0);
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerNib:[UINib nibWithNibName:@"SalesInputTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kCellID];
[self.view addSubview:self.tableView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return kCellCount;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
SalesInputTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID forIndexPath:indexPath];
[cell cellWithArray:[self getCellDataArrWithIndexPath:indexPath]];
WS(weakSelf)
cell.updateCellData = ^(NSArray *dataArr){
NSLog(@"%@", dataArr);
[weakSelf.cellDataDic setObject:dataArr forKey:indexPath];
[weakSelf countTotalMonney];
};
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
- (void)setUpNavigationBar {
self.navigationItem.title = @"销售录入";
self.navigationController.navigationBar.backgroundImage = [UIImage imageWithColor:[UIColor colorWithRed:0.953 green:0.439 blue:0.063 alpha:1.000]];
UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"历史" style:UIBarButtonItemStyleDone target:self action:@selector(goToHistory)];
rightBtn.tintColor = [UIColor whiteColor];
self.navigationItem.rightBarButtonItem = rightBtn;
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
}
- (void)setUpTopView {
SalesInputTopView *topView = [self viewWithNibName:@"SalesInputTopView"];
topView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 125 + 64);
self.topView = topView;
topView.textfieldDate.inputView = self.datePicker;
topView.nameTapActionBlock = ^{
[self chooseShopAction];
};
[self.view addSubview:topView];
}
- (void)setUpTotalView {
self.totalView = [self viewWithNibName:@"SalesInputTotalView"];
self.totalView.frame = CGRectMake(0, -179, SCREEN_WIDTH, 179);
[self.tableView addSubview:self.totalView];
}
- (void)pickerDoneAction {
[self.view endEditing:YES];
}
- (void)chooseShopAction {
ChooseShopViewController *chooseVC = [[ChooseShopViewController alloc] init];
chooseVC.chooseBlock = ^(NSString *string){
[self.topView setShopName:string];
};
[self.navigationController pushViewController:chooseVC animated:YES];
}
- (UIDatePicker *)datePicker {
if (!_datePicker) {
_datePicker = [[UIDatePicker alloc] init];
_datePicker.backgroundColor = [UIColor colorWithWhite:0.902 alpha:1.000];
_datePicker.date = [NSDate date];
_datePicker.datePickerMode = UIDatePickerModeDate;
[_datePicker addTarget:self action:@selector(oneDatePickerValueChanged:) forControlEvents:UIControlEventValueChanged]; // 添加监听器
}
return _datePicker;
}
#pragma mark - 实现oneDatePicker的监听方法
- (void)oneDatePickerValueChanged:(UIDatePicker *) sender {
NSDate *date = sender.date;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd"];
NSString *strTime = [df stringFromDate:date];
self.topView.textfieldDate.text = strTime;
NSLog(@"%@", strTime);
}
- (void)countTotalMonney {
CGFloat count = 0;
for (NSIndexPath *obj in self.cellDataDic.allKeys) {
NSArray *array = [self.cellDataDic objectForKey:obj];
CGFloat monney = [array[0] floatValue];
CGFloat bill = [array[1] floatValue];
count = count + monney * bill;
}
self.totalView.labelTotal.text = [NSString stringWithFormat:@"%.0f",count];
}
- (id)viewWithNibName:(NSString *)viewName {
NSArray* nibView = [[NSBundle mainBundle] loadNibNamed:viewName owner:nil options:nil];
return [nibView objectAtIndex:0];
}
- (NSArray *)getCellDataArrWithIndexPath:(NSIndexPath *)indextPath {
if (![self.cellDataDic objectForKey:indextPath]) {
[self.cellDataDic setObject:@[@"0",@"0"] forKey:indextPath];
}
return [self.cellDataDic objectForKey:indextPath];
}
- (void)goToHistory {
HistoryViewController *history = [[HistoryViewController alloc] init];
[self.navigationController pushViewController:history animated:YES];
}
- (void)setUpData {
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
NSDictionary *myDictionary = @{@"shopCodeEquals" : @"a",
@"beginDateEquals" : @"a",
@"endDateEquals" : @"a",
@"pageNumber" : @0,
@"pageSize" : @0};
}
- (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
//
// HistoryTopView.h
// vanke
//
// Created by Z on 16/4/18.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HistoryTopView : UIView
@property (weak, nonatomic) IBOutlet UIButton *buttonStartDate;
@property (weak, nonatomic) IBOutlet UIButton *buttonEndDate;
@property (weak, nonatomic) IBOutlet UITextField *startDate;
@property (weak, nonatomic) IBOutlet UITextField *endDate;
- (void)startDateBecomeFistRespond;
- (void)endDateBecomeFistRespond;
@end
//
// HistoryTopView.m
// vanke
//
// Created by Z on 16/4/18.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "HistoryTopView.h"
@interface HistoryTopView ()
@property (weak, nonatomic) IBOutlet UIButton *buttonQuery;
@end
@implementation HistoryTopView
-(void)awakeFromNib {
self.buttonQuery.layer.cornerRadius = 5;
}
- (void)startDateBecomeFistRespond {
[self.startDate becomeFirstResponder];
}
- (void)endDateBecomeFistRespond {
[self.endDate becomeFirstResponder];
}
- (IBAction)queryAction:(id)sender {
NSLog(@"查询");
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
This diff is collapsed.
//
// MyToolBar.h
// CapitalChamberlain
//
// Created by Jerry on 15/12/23.
// Copyright © 2015年 SunShine. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MyToolBar : UIToolbar
- (instancetype)initWithFrame:(CGRect)frame target:(id)target lefTitle:(NSString *)leftTitle leftAction:(SEL)leftAcrtion rightTitle:(NSString *)rightTitle rightAction:(SEL)rightAction;
@end
//
// MyToolBar.m
// CapitalChamberlain
//
// Created by Jerry on 15/12/23.
// Copyright © 2015年 SunShine. All rights reserved.
//
#import "MyToolBar.h"
@implementation MyToolBar
- (instancetype)initWithFrame:(CGRect)frame target:(id)target lefTitle:(NSString *)leftTitle leftAction:(SEL)leftAcrtion rightTitle:(NSString *)rightTitle rightAction:(SEL)rightAction
{
self = [super initWithFrame:frame];
if (self) {
[self setBarStyle:UIBarStyleDefault];
// self.backgroundColor = kBackroundColor;
UIBarButtonItem * helloButton = [[UIBarButtonItem alloc]initWithTitle:leftTitle style:UIBarButtonItemStyleBordered target:target action:leftAcrtion];
UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:target action:nil];
UIBarButtonItem * doneButton = [[UIBarButtonItem alloc]initWithTitle:rightTitle style:UIBarButtonItemStyleDone target:target action:rightAction];
[doneButton setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:[UIColor grayColor],NSForegroundColorAttributeName, [UIFont systemFontOfSize:17],NSFontAttributeName ,nil] forState:UIControlStateNormal];
NSArray * buttonsArray = [NSArray arrayWithObjects:helloButton,btnSpace,doneButton,nil];
[self setItems:buttonsArray];
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// SalesInputTableViewCell.h
// vanke
//
// Created by Z on 16/4/18.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void (^myBlock)(NSArray *);
@interface SalesInputTableViewCell : UITableViewCell
@property (nonatomic, copy) myBlock updateCellData;
- (void)cellWithArray:(NSArray *)array;
@end
//
// SalesInputTableViewCell.m
// vanke
//
// Created by Z on 16/4/18.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "SalesInputTableViewCell.h"
@interface SalesInputTableViewCell ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *textFieldAmount;
@property (weak, nonatomic) IBOutlet UITextField *txtfieldSum;
@end
@implementation SalesInputTableViewCell
- (void)awakeFromNib {
self.textFieldAmount.delegate = self;
self.txtfieldSum.delegate = self;
// Initialization code
}
- (void)cellWithArray:(NSArray *)array {
self.textFieldAmount.text = [array[0] isEqualToString:@"0"] ? @"" : array[0];
self.txtfieldSum.text = [array[1] isEqualToString:@"0"] ? @"" : array[0];
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
NSLog(@"textField end editing");
if (([self.txtfieldSum.text isEqualToString:@"0"] || [self.txtfieldSum.text isEqualToString:@""]) && ![self.textFieldAmount.text isEqualToString:@""])
{
self.txtfieldSum.text = @"1";
}else if ([self.textFieldAmount.text isEqualToString:@""]){
self.txtfieldSum.text = @"";
}
self.updateCellData(@[self.textFieldAmount.text, self.txtfieldSum.text]);
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="60" id="KGk-i7-Jjw" customClass="SalesInputTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="59"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="支付方式" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="42B-69-MrJ">
<rect key="frame" x="8" y="19" width="104" height="22"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="0" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DwV-QQ-nIc">
<rect key="frame" x="243" y="7" width="104" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="vCb-q8-qdd"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<textInputTraits key="textInputTraits" keyboardType="numberPad"/>
</textField>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="0" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="IOd-nI-Sgk">
<rect key="frame" x="126" y="7" width="103" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="Tti-cq-XrO"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<textInputTraits key="textInputTraits" keyboardType="numberPad"/>
</textField>
</subviews>
<constraints>
<constraint firstItem="42B-69-MrJ" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="30G-yc-aMR"/>
<constraint firstItem="IOd-nI-Sgk" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="4zD-3a-Npn"/>
<constraint firstItem="DwV-QQ-nIc" firstAttribute="leading" secondItem="IOd-nI-Sgk" secondAttribute="trailing" constant="14" id="IDn-fs-A6c"/>
<constraint firstItem="IOd-nI-Sgk" firstAttribute="leading" secondItem="42B-69-MrJ" secondAttribute="trailing" constant="14" id="K0R-E6-pq2"/>
<constraint firstItem="IOd-nI-Sgk" firstAttribute="width" secondItem="42B-69-MrJ" secondAttribute="width" id="LyE-89-ZUP"/>
<constraint firstItem="DwV-QQ-nIc" firstAttribute="trailing" secondItem="H2p-sc-9uM" secondAttribute="trailingMargin" constant="-20" id="X6v-gb-CsP"/>
<constraint firstItem="DwV-QQ-nIc" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="gLQ-a3-OwZ"/>
<constraint firstItem="IOd-nI-Sgk" firstAttribute="leading" secondItem="42B-69-MrJ" secondAttribute="trailing" constant="14" id="m7d-pg-dI8"/>
<constraint firstItem="DwV-QQ-nIc" firstAttribute="leading" secondItem="IOd-nI-Sgk" secondAttribute="trailing" constant="14" id="nFY-mV-eit"/>
<constraint firstItem="42B-69-MrJ" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="nZ2-4B-4Hr"/>
<constraint firstItem="DwV-QQ-nIc" firstAttribute="width" secondItem="42B-69-MrJ" secondAttribute="width" id="wRK-zA-B9k"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="textFieldAmount" destination="IOd-nI-Sgk" id="5cG-QC-dtr"/>
<outlet property="txtfieldSum" destination="DwV-QQ-nIc" id="sTl-vV-Iet"/>
</connections>
<point key="canvasLocation" x="158.5" y="379"/>
</tableViewCell>
</objects>
</document>
//
// SalesInputTopView.h
// vanke
//
// Created by Z on 16/4/15.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void (^tapBlock)(void);
@interface SalesInputTopView : UIView
@property (nonatomic, copy) tapBlock nameTapActionBlock;
@property (nonatomic, copy) tapBlock dateTapActionBlock;
@property (weak, nonatomic) IBOutlet UITextField *textfieldDate;
- (void)setShopName:(NSString *)name;
- (void)setDate:(NSString *)date;
@end
//
// SalesInputTopView.m
// vanke
//
// Created by Z on 16/4/15.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "SalesInputTopView.h"
@interface SalesInputTopView ()
@property (weak, nonatomic) IBOutlet UILabel *labelShopName;
@end
@implementation SalesInputTopView
- (void)setShopName:(NSString *)name
{
self.labelShopName.text = name;
}
- (void)setDate:(NSString *)date
{
}
- (void)awakeFromNib {
}
- (IBAction)labelNameTapAction:(id)sender {
self.nameTapActionBlock();
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// SalesInputTotalVIew.h
// vanke
//
// Created by Z on 16/4/20.
// Copyright © 2016年 gomore. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SalesInputTotalVIew : UIView
@property (weak, nonatomic) IBOutlet UILabel *labelTotal;
@end
//
// SalesInputTotalVIew.m
// vanke
//
// Created by Z on 16/4/20.
// Copyright © 2016年 gomore. All rights reserved.
//
#import "SalesInputTotalVIew.h"
@interface SalesInputTotalVIew ()
@property (weak, nonatomic) IBOutlet UIView *viewRedBac;
@end
@implementation SalesInputTotalVIew
- (void)awakeFromNib {
self.viewRedBac.layer.cornerRadius = 7;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
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