Commit 1387bc58 authored by Achilles's avatar Achilles

提交列表界面

parent 4bcf1b6c
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
@interface VankeSettlementListAPI : VankeBaseAPI @interface VankeSettlementListAPI : VankeBaseAPI
// 账期等于 // 账期等于
@property (nonatomic, strong) NSString *settleEquals; @property (nonatomic, strong) NSDate *settleEquals;
// 是否已确认 // 是否已确认
@property (nonatomic, assign) BOOL confirmed; @property (nonatomic, assign) BOOL confirmed;
...@@ -56,26 +56,29 @@ ...@@ -56,26 +56,29 @@
@property (nonatomic, strong) NSNumber *amount; @property (nonatomic, strong) NSNumber *amount;
@property (nonatomic, strong) NSString *remark; @property (nonatomic, strong) NSString *remark;
-(NSString*) getPictureUrlOrDefault;
-(NSString*) codeName;
@end @end
// 对账单合计 // 对账单合计
@interface StatementSummary : BeeActiveObject @interface StatementShop : BeeActiveObject
@property (nonatomic, strong) NSString *contract; @property (nonatomic, strong) NSString *contract;
@property (nonatomic, strong) NSString *shopCode;
@property (nonatomic, strong) NSString *shopName;
@property (nonatomic, strong) NSString *picture;
@property (nonatomic, strong) NSString *settle; @property (nonatomic, strong) NSString *settle;
@property (nonatomic, strong) NSNumber *amount; @property (nonatomic, strong) NSNumber *amount;
@property (nonatomic, strong) NSString *state; @property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSArray *items; // SubjectItem @property (nonatomic, strong) NSArray *items; // SubjectItem
-(BOOL) confirmed; -(NSString*) getPictureUrlOrDefault;
-(NSString*) codeName;
@end @end
// 对账单返回
@interface StatementListResponse : VankeResponse @interface StatementListResponse : VankeResponse
@property (nonatomic, strong) NSDate *settle;
@property (nonatomic, strong) NSNumber *amount; @property (nonatomic, strong) NSNumber *amount;
@property (nonatomic, strong) Paging *paging; @property (nonatomic, strong) Paging *paging;
@property (nonatomic, strong) NSArray *records; // StatementSummary @property (nonatomic, strong) NSArray *records; // StatementSummary
......
...@@ -20,24 +20,27 @@ ...@@ -20,24 +20,27 @@
-(void) route:(BeeMessage *)msg { -(void) route:(BeeMessage *)msg {
if (self.sending) if (self.sending)
{ {
// if (![self checkToQuery]) { // if (![self checkToQuery]) {
// return; // return;
// } // }
// [self http_get:@"/statement/query"].PARAM(@"settleEquals", self.settleEquals).PARAM(@"prjectsIn", [self.projectsIn componentsJoinedByString:@";"]).TIMEOUT(10); // [self http_get:@"/statement/query"].PARAM(@"settleEquals", self.settleEquals).PARAM(@"prjectsIn", [self.projectsIn componentsJoinedByString:@";"]).TIMEOUT(10);
[self HTTP_GET:@"http://www.baidu.com"].TIMEOUT(10); [self HTTP_GET:@"http://www.baidu.com"].TIMEOUT(10);
} }
else if (self.succeed) else if (self.succeed)
{ {
NSLog(@"response: %@", self.responseString); NSLog(@"response: %@", self.responseString);
// self.serverResp = [StatementListResponse objectFromDictionary: self.responseJSONDictionary]; // self.serverResp = [StatementListResponse objectFromDictionary: self.responseJSONDictionary];
// if (nil == self.serverResp) // if (nil == self.serverResp)
// { // {
// self.failed = YES; // self.failed = YES;
// return; // return;
// } // }
self.serverResp = [StatementListResponse fakeData];
StatementListResponse *resp = [StatementListResponse fakeData];
resp.settle = self.settleEquals;
self.serverResp = resp;
} else if (self.failed) { } else if (self.failed) {
NSLog(@"response: %@", self.responseString); NSLog(@"response: %@", self.responseString);
self.serverResp = [StatementListResponse objectFromDictionary: self.responseJSONDictionary]; self.serverResp = [StatementListResponse objectFromDictionary: self.responseJSONDictionary];
...@@ -45,7 +48,9 @@ ...@@ -45,7 +48,9 @@
} }
-(BOOL) checkToQuery { -(BOOL) checkToQuery {
if ([VankeUtil isBlankString:self.settleEquals]) { NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
if ([VankeUtil isBlankString:[dateFormatter stringFromDate:self.settleEquals]]) {
[self setClientError: @"账期不能为空"]; [self setClientError: @"账期不能为空"];
return NO; return NO;
} }
...@@ -83,25 +88,16 @@ ...@@ -83,25 +88,16 @@
@synthesize amount = _amount; @synthesize amount = _amount;
@synthesize remark = _remark; @synthesize remark = _remark;
-(NSString*) getPictureUrlOrDefault {
// if ([VankeUtil isBlankString:self.picture]) {
return @"bill.png";
// } else {
// return [NSString stringWithFormat:@"%@/%@", VANKE_SERVER_MEDIA_BASE_URL, self.picture];
// }
}
-(NSString*) codeName {
return [NSString stringWithFormat:@"%@%@", @"", _subject];
}
@end @end
#pragma StatementSummary #pragma StatementShop
@implementation StatementSummary @implementation StatementShop
@synthesize contract = _contract; @synthesize contract = _contract;
@synthesize shopCode = _shopCode;
@synthesize shopName = _shopName;
@synthesize picture = _picture;
@synthesize settle = _settle; @synthesize settle = _settle;
@synthesize amount = _amount; @synthesize amount = _amount;
@synthesize state = _state; @synthesize state = _state;
...@@ -109,8 +105,17 @@ ...@@ -109,8 +105,17 @@
CONVERT_PROPERTY_CLASS(items, SubjectItem) CONVERT_PROPERTY_CLASS(items, SubjectItem)
-(BOOL) confirmed { -(NSString*) getPictureUrlOrDefault {
return [@"confirmed" eq:_state]; return @"bill.png";
// if ([VankeUtil isBlankString:self.picture]) {
// return @"bill.png";
// } else {
// return [NSString stringWithFormat:@"%@/%@", VANKE_SERVER_MEDIA_BASE_URL, self.picture];
// }
}
-(NSString*) codeName {
return [NSString stringWithFormat:@"%@ %@", _shopCode, _shopName];
} }
@end @end
...@@ -119,50 +124,82 @@ CONVERT_PROPERTY_CLASS(items, SubjectItem) ...@@ -119,50 +124,82 @@ CONVERT_PROPERTY_CLASS(items, SubjectItem)
@implementation StatementListResponse @implementation StatementListResponse
@synthesize settle = _settle;
@synthesize amount = _amount; @synthesize amount = _amount;
@synthesize paging = _paging; @synthesize paging = _paging;
@synthesize records = _records; @synthesize records = _records;
CONVERT_PROPERTY_CLASS(records, StatementSummary) CONVERT_PROPERTY_CLASS(records, StatementShop)
-(BOOL) hasMore { -(BOOL) hasMore {
return _paging && _paging.pageSize <= _paging.recordCount; return _paging && _paging.pageSize <= _paging.recordCount;
} }
#define ARC4RANDOM_MAX 0x100000000
+(NSNumber*) randomDouble {
double val = floorf(((double)arc4random() / ARC4RANDOM_MAX) * 10000.0f);
return [NSNumber numberWithDouble:val];
}
+(NSNumber*) randomInt {
double val = floorf(((double)arc4random() / ARC4RANDOM_MAX) * 10000.0f);
return [NSNumber numberWithInt:val];
}
+(instancetype) fakeData { +(instancetype) fakeData {
StatementListResponse *resp = [[StatementListResponse alloc] init]; StatementListResponse *resp = [[StatementListResponse alloc] init];
resp.amount = [self randomDouble];
resp.amount = [NSNumber numberWithInt:1000];
Paging *paging = [[Paging alloc] init]; Paging *paging = [[Paging alloc] init];
paging.page = [NSNumber numberWithInt:1]; paging.page = [NSNumber numberWithInt:1];
paging.pageSize = [NSNumber numberWithInt:10]; paging.pageSize = [NSNumber numberWithInt:10];
paging.pageCount = [NSNumber numberWithInt:10]; paging.pageCount = [NSNumber numberWithInt:10];
paging.recordCount = [NSNumber numberWithInt:99]; paging.recordCount = [NSNumber numberWithInt:11];
resp.paging = paging; resp.paging = paging;
StatementSummary *summary = [[StatementSummary alloc] init]; NSMutableArray *shops = [[NSMutableArray alloc] initWithCapacity:10];
summary.contract = @"112233"; for (int i = 0; i < [paging.pageSize intValue]; ++i) {
summary.settle = @"2015-12-20"; StatementShop *summary = [[StatementShop alloc] init];
summary.amount = [NSNumber numberWithInt:1000]; summary.contract = @"112233";
summary.state = @"confirmed"; summary.shopCode = [NSString stringWithFormat:@"%03d", i];
NSMutableArray *ary = [[NSMutableArray alloc] initWithCapacity:10]; summary.shopName = @"肯得起";
for( int i = 0; i < 10; ++i) { summary.picture = @"";
SubjectItem *item = [[SubjectItem alloc] init]; summary.settle = @"2015-12-20";
item.subject = @"A01-01 星巴克"; double val = floorf(((double)arc4random() / ARC4RANDOM_MAX) * 10000.0f);
item.beginDate = @"2015-12-01"; summary.amount = [NSNumber numberWithDouble:val];
item.endDate = @"2015-12-30";
item.direction = [NSNumber numberWithInt:0]; val = arc4random() % 100;
item.amount = [NSNumber numberWithInt:104001]; if (val > 30) {
item.remark = @"有意见,不同意"; summary.state = @"confirmed";
[ary addObject:item]; } else if (val > 60) {
summary.state = @"unconfirmed";
} else {
summary.state = @"rejected";
}
NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:10];
for( int i = 0; i < 100; ++i) {
SubjectItem *item = [[SubjectItem alloc] init];
item.subject = @"A01-01 星巴克";
item.beginDate = @"2015-12-01";
item.endDate = @"2015-12-30";
item.direction = [NSNumber numberWithInt:0];
val = floorf(((double)arc4random() / ARC4RANDOM_MAX) * 10000.0f);
if (arc4random() % 100 > 50) {
val = -val;
}
item.amount = [NSNumber numberWithDouble:val];
item.remark = @"有意见,不同意";
[items addObject:item];
}
summary.items = items;
[shops addObject:summary];
} }
summary.items = ary;
NSMutableArray *ary2 = [[NSMutableArray alloc] initWithCapacity:1];
[ary2 addObject:summary];
resp.records = ary2;
resp.records = shops;
return resp; return resp;
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
@interface VankeStatementListModel : BeeStreamViewModel @interface VankeStatementListModel : BeeStreamViewModel
// 账期等于 // 账期等于
@property (nonatomic, strong) NSString *settleEquals; @property (nonatomic, strong) NSDate *settleEquals;
// 是否已确认 // 是否已确认
@property (nonatomic, assign) BOOL confirmed; @property (nonatomic, assign) BOOL confirmed;
...@@ -23,8 +23,11 @@ ...@@ -23,8 +23,11 @@
// 商铺名称或代码类似于 // 商铺名称或代码类似于
@property (nonatomic, strong) NSString *shopNameOrCodeLike; @property (nonatomic, strong) NSString *shopNameOrCodeLike;
// 对账单列表 // 商户列表
@property (nonatomic, strong) NSMutableArray *items; // SubjectItem @property (nonatomic, strong) NSMutableArray *shops; // StatementShop
// 最后一次响应结果
@property (nonatomic, strong) StatementListResponse *lastResp;
-(NSInteger) count; -(NSInteger) count;
......
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
@synthesize confirmed = _confirmed; @synthesize confirmed = _confirmed;
@synthesize projectsIn = _projectsIn; @synthesize projectsIn = _projectsIn;
@synthesize shopNameOrCodeLike = _shopNameOrCodeLike; @synthesize shopNameOrCodeLike = _shopNameOrCodeLike;
@synthesize items = _items; @synthesize shops = _shops;
@synthesize lastResp = _lastResp;
- (void)load - (void)load
{ {
self.autoSave = YES; self.autoSave = YES;
self.autoLoad = YES; self.autoLoad = YES;
self.items = [NSMutableArray array]; self.shops = [NSMutableArray array];
} }
- (void)unload - (void)unload
...@@ -32,7 +33,7 @@ ...@@ -32,7 +33,7 @@
self.confirmed = nil; self.confirmed = nil;
self.projectsIn = nil; self.projectsIn = nil;
self.shopNameOrCodeLike = nil; self.shopNameOrCodeLike = nil;
self.items = nil; self.shops = nil;
} }
#pragma mark - paging query #pragma mark - paging query
...@@ -44,9 +45,9 @@ ...@@ -44,9 +45,9 @@
- (void)nextPage - (void)nextPage
{ {
if ( self.items.count ) if ( self.shops.count )
{ {
[self gotoPage:(self.items.count / PER_PAGE + 1)]; [self gotoPage:(self.shops.count / PER_PAGE + 1)];
} }
} }
...@@ -77,24 +78,23 @@ ...@@ -77,24 +78,23 @@
if ( api.succeed ) if ( api.succeed )
{ {
StatementListResponse *resp = (StatementListResponse*) api.serverResp; StatementListResponse *resp = (StatementListResponse*) api.serverResp;
self.lastResp = resp;
if ( nil == resp || nil == resp.records ) if ( nil == resp || nil == resp.records )
{ {
api.failed = YES; api.failed = YES;
} }
else else
{ {
NSArray *records = resp.records;
StatementSummary *firstRecord = (StatementSummary*) [records objectAtIndex:0];
if ( page <= 1 ) if ( page <= 1 )
{ {
[self.items removeAllObjects]; [self.shops removeAllObjects];
[self.items addObjectsFromArray:firstRecord.items]; [self.shops addObjectsFromArray:resp.records];
} }
else else
{ {
[self.items addObjectsFromArray:firstRecord.items]; [self.shops addObjectsFromArray:resp.records];
[self.items unique:^NSComparisonResult(id left, id right) { [self.shops unique:^NSComparisonResult(id left, id right) {
return [((SubjectItem *)left).subject compare:((SubjectItem *)right).subject]; return [((StatementShop*)left).shopCode compare:((StatementShop*)right).shopCode];
}]; }];
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
// //
#import "VankeAffairsBoard_iPhone.h" #import "VankeAffairsBoard_iPhone.h"
#import "VankeUtil.h"
#import "VankeNoticeListBoard_iPhone.h" #import "VankeNoticeListBoard_iPhone.h"
#import "VankeStatementListBoard_iPhone.h" #import "VankeStatementListBoard_iPhone.h"
...@@ -51,13 +52,6 @@ ON_CREATE_VIEWS( signal ) ...@@ -51,13 +52,6 @@ ON_CREATE_VIEWS( signal )
{ {
self.navigationBarShown = YES; self.navigationBarShown = YES;
self.navigationBarTitle = @"事务"; self.navigationBarTitle = @"事务";
UIColor *color = [UIColor colorWithRed:237/255.0 green:27/255.0 blue:35/255.0 alpha:1.0];
if ( IOS7_OR_LATER ) {
self.navigationController.navigationBar.barTintColor = color;
} else {
self.navigationController.navigationBar.tintColor = color;
}
} }
ON_DELETE_VIEWS( signal ) ON_DELETE_VIEWS( signal )
...@@ -70,6 +64,12 @@ ON_LAYOUT_VIEWS( signal ) ...@@ -70,6 +64,12 @@ ON_LAYOUT_VIEWS( signal )
ON_WILL_APPEAR( signal ) ON_WILL_APPEAR( signal )
{ {
UIColor *color = [VankeUtil rgbStringToColor: @"237,27,35"];
if ( IOS7_OR_LATER ) {
self.navigationController.navigationBar.barTintColor = color;
} else {
self.navigationController.navigationBar.tintColor = color;
}
} }
ON_DID_APPEAR( signal ) ON_DID_APPEAR( signal )
......
...@@ -39,7 +39,7 @@ ON_SIGNAL3( BeeUIFootLoader, STATE_CHANGED, signal ) ...@@ -39,7 +39,7 @@ ON_SIGNAL3( BeeUIFootLoader, STATE_CHANGED, signal )
{ {
self.alpha = 1.0f; self.alpha = 1.0f;
self.indicator.animating = YES; self.indicator.animating = YES;
self.state.data = @"Loading..."; self.state.data = @"正在加载中...";
} }
else else
{ {
...@@ -48,12 +48,12 @@ ON_SIGNAL3( BeeUIFootLoader, STATE_CHANGED, signal ) ...@@ -48,12 +48,12 @@ ON_SIGNAL3( BeeUIFootLoader, STATE_CHANGED, signal )
if ( self.more ) if ( self.more )
{ {
self.alpha = 1.0f; self.alpha = 1.0f;
self.state.data = @"Click to load more"; self.state.data = @"点击加载更多";
} }
else else
{ {
self.alpha = 0.0f; self.alpha = 0.0f;
self.state.data = @"No more"; self.state.data = @"没有数据了";
} }
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
font: 13, lighter; font: 13, lighter;
text-color: #fff; text-color: #ccc;
text-align: center; text-align: center;
} }
</style> </style>
......
...@@ -148,8 +148,14 @@ ON_WILL_APPEAR( signal ) ...@@ -148,8 +148,14 @@ ON_WILL_APPEAR( signal )
[self.model firstPage]; [self.model firstPage];
} }
UIColor *color = [VankeUtil rgbStringToColor: @"102,160,255"];
if ( IOS7_OR_LATER ) {
self.navigationController.navigationBar.barTintColor = color;
} else {
self.navigationController.navigationBar.tintColor = color;
}
[BeeUIRouter sharedInstance].view.pannable = YES; [BeeUIRouter sharedInstance].view.pannable = YES;
} }
ON_DID_APPEAR( signal ) ON_DID_APPEAR( signal )
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#import "Bee.h" #import "Bee.h"
#import "VankeBaseBoard.h" #import "VankeBaseBoard.h"
#import "VankeStatementListModel.h" #import "VankeStatementListModel.h"
#import "VankeStatementMonthCell_iPhone.h"
#pragma mark - #pragma mark -
...@@ -27,5 +28,6 @@ AS_MODEL( VankeStatementListModel, model ) ...@@ -27,5 +28,6 @@ AS_MODEL( VankeStatementListModel, model )
AS_OUTLET( BeeUIScrollView, list ) AS_OUTLET( BeeUIScrollView, list )
AS_OUTLET( BeeUISearchBar, searchBar) AS_OUTLET( BeeUISearchBar, searchBar)
AS_OUTLET( VankeStatementMonthCell_iPhone, settlementBar)
@end @end
...@@ -39,6 +39,7 @@ SUPPORT_RESOURCE_LOADING( YES ) ...@@ -39,6 +39,7 @@ SUPPORT_RESOURCE_LOADING( YES )
DEF_MODEL( VankeStatementListModel, model ) DEF_MODEL( VankeStatementListModel, model )
DEF_OUTLET( BeeUIScrollView, list ) DEF_OUTLET( BeeUIScrollView, list )
DEF_OUTLET( BeeUISearchBar, searchBar) DEF_OUTLET( BeeUISearchBar, searchBar)
DEF_OUTLET( VankeStatementMonthCell_iPhone, settlementBar)
- (void)load - (void)load
{ {
...@@ -60,6 +61,13 @@ ON_CREATE_VIEWS( signal ) ...@@ -60,6 +61,13 @@ ON_CREATE_VIEWS( signal )
self.allowedSwipeToBack = YES; self.allowedSwipeToBack = YES;
self.title = @"对账单"; self.title = @"对账单";
UIColor *color = [VankeUtil rgbStringToColor: @"144,76,245"];
if ( IOS7_OR_LATER ) {
self.navigationController.navigationBar.barTintColor = color;
} else {
self.navigationController.navigationBar.tintColor = color;
}
self.list.headerClass = [PullLoader class]; self.list.headerClass = [PullLoader class];
self.list.headerShown = YES; self.list.headerShown = YES;
...@@ -72,9 +80,9 @@ ON_CREATE_VIEWS( signal ) ...@@ -72,9 +80,9 @@ ON_CREATE_VIEWS( signal )
self.list.whenReloading = ^ self.list.whenReloading = ^
{ {
self.list.total = self.model.items.count; self.list.total = self.model.shops.count;
INFO(@"total = %d", self.model.items.count); INFO(@"total = %d", self.model.shops.count);
if (self.model.loaded && self.list.total <= 0) { if (self.model.loaded && self.list.total <= 0) {
self.list.total = 1; self.list.total = 1;
...@@ -92,9 +100,8 @@ ON_CREATE_VIEWS( signal ) ...@@ -92,9 +100,8 @@ ON_CREATE_VIEWS( signal )
item.order = 0; item.order = 0;
item.rule = BeeUIScrollLayoutRule_Fall; item.rule = BeeUIScrollLayoutRule_Fall;
item.clazz = [VankeStatementListItemCell_iPhone class]; item.clazz = [VankeStatementListItemCell_iPhone class];
StatementShop *shop = [self.model.shops safeObjectAtIndex:item.index];
SubjectItem *subItem = [self.model.items safeObjectAtIndex:item.index]; item.data = shop;
item.data = subItem;
} }
} }
}; };
...@@ -125,6 +132,7 @@ ON_CREATE_VIEWS( signal ) ...@@ -125,6 +132,7 @@ ON_CREATE_VIEWS( signal )
// self.model.nameLike = _projectNameLike; // self.model.nameLike = _projectNameLike;
// self.model.salesDateEquals = _salesDate; // self.model.salesDateEquals = _salesDate;
// _searchBar.text = _projectNameLike; // _searchBar.text = _projectNameLike;
_model.settleEquals = [NSDate date];
} }
ON_DELETE_VIEWS( signal ) ON_DELETE_VIEWS( signal )
...@@ -145,6 +153,13 @@ ON_WILL_APPEAR( signal ) ...@@ -145,6 +153,13 @@ ON_WILL_APPEAR( signal )
[self.model firstPage]; [self.model firstPage];
} }
UIColor *color = [VankeUtil rgbStringToColor: @"144,76,245"];
if ( IOS7_OR_LATER ) {
self.navigationController.navigationBar.barTintColor = color;
} else {
self.navigationController.navigationBar.tintColor = color;
}
[BeeUIRouter sharedInstance].view.pannable = YES; [BeeUIRouter sharedInstance].view.pannable = YES;
} }
...@@ -165,8 +180,8 @@ ON_DID_DISAPPEAR( signal ) ...@@ -165,8 +180,8 @@ ON_DID_DISAPPEAR( signal )
ON_SIGNAL3( VankeStatementListBoard_iPhone, searchBar, signal ) ON_SIGNAL3( VankeStatementListBoard_iPhone, searchBar, signal )
{ {
// NSString *nameLike = [VankeUtil trim:_searchBar.text]; NSString *nameLike = [VankeUtil trim:_searchBar.text];
// self.model.nameLike = nameLike; self.model.shopNameOrCodeLike = nameLike;
[self.model firstPage]; [self.model firstPage];
} }
...@@ -186,6 +201,7 @@ ON_SIGNAL3( VankeStatementListModel, RELOADED, signal ) ...@@ -186,6 +201,7 @@ ON_SIGNAL3( VankeStatementListModel, RELOADED, signal )
self.list.footerLoading = NO; self.list.footerLoading = NO;
self.list.footerMore = self.model.more; self.list.footerMore = self.model.more;
[self.list reloadData]; [self.list reloadData];
$(self.settlementBar).DATA(_model.lastResp);
} }
#pragma UISearchBarDelegate #pragma UISearchBarDelegate
...@@ -196,4 +212,27 @@ ON_SIGNAL3( VankeStatementListModel, RELOADED, signal ) ...@@ -196,4 +212,27 @@ ON_SIGNAL3( VankeStatementListModel, RELOADED, signal )
[self.model firstPage]; [self.model firstPage];
} }
#pragma VankeStatementMonthCell_iPhone
ON_SIGNAL3(VankeStatementMonthCell_iPhone, pickerMask, signal) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"\n\n\n\n\n\n\n\n\n\n" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIDatePicker *picker = [[UIDatePicker alloc] init];
[picker setDatePickerMode:UIDatePickerModeDate];
[picker setLocale:[[NSLocale alloc]initWithLocaleIdentifier:@"zh_Hans_CN"]];
[alertController.view addSubview:picker];
[alertController addAction:({
UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
// 立即设置账期
self.model.settleEquals = picker.date;
[self.model firstPage];
}];
action;
})];
UIPopoverPresentationController *popoverController = alertController.popoverPresentationController;
popoverController.sourceView = self.view;
popoverController.sourceRect = [self.view bounds];
[self presentViewController:alertController animated:YES completion:nil];
}
@end @end
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<linear class="wrapper"> <linear class="wrapper">
<image class="bg" /> <image class="bg" />
<list id="list"/> <list id="list"/>
<VankeStatementMonthCell_iPhone id="settlementBar" />
<searchbar id="searchBar" class="search-wrapper" /> <searchbar id="searchBar" class="search-wrapper" />
</linear> </linear>
...@@ -29,17 +30,25 @@ ...@@ -29,17 +30,25 @@
#list { #list {
position: absolute; position: absolute;
left: 0px; left: 0px;
top: 45px; top: 120px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
#settlementBar {
height: 75px;
width: 100%;
position: absolute;
left: 0px;
top: 64px;
}
.search-wrapper { .search-wrapper {
height: 45px; height: 45px;
width: 100%; width: 100%;
position: absolute; position: absolute;
left: 0px; left: 0px;
top: 64px; top: 139px;
placeholder: "请输入商铺名称或代码搜索"; placeholder: "请输入商铺名称或代码搜索";
} }
......
...@@ -40,7 +40,7 @@ DEF_OUTLET(BeeUILabel, lblAmount) ...@@ -40,7 +40,7 @@ DEF_OUTLET(BeeUILabel, lblAmount)
- (void)dataDidChanged - (void)dataDidChanged
{ {
SubjectItem *item = (SubjectItem*) self.data; StatementShop *item = (StatementShop*) self.data;
if (!item) { if (!item) {
return; return;
} }
...@@ -48,7 +48,12 @@ DEF_OUTLET(BeeUILabel, lblAmount) ...@@ -48,7 +48,12 @@ DEF_OUTLET(BeeUILabel, lblAmount)
$(self.imgPhoto).DATA([item getPictureUrlOrDefault]); $(self.imgPhoto).DATA([item getPictureUrlOrDefault]);
$(self.lblName).DATA([item codeName]); $(self.lblName).DATA([item codeName]);
$(self.lblState).DATA(@"已确认"); $(self.lblState).DATA(@"已确认");
$(self.lblAmount).DATA([NSString stringWithFormat:@"%@%.2f元", @"", [item.amount doubleValue]]);
double amount = [item.amount doubleValue];
$(self.lblAmount).DATA([NSString stringWithFormat:@"%@%.2f元", @"", amount]);
if (amount < 0) {
$(self.lblAmount).ADD_CLASS(@"red");
}
} }
- (void)layoutDidFinish - (void)layoutDidFinish
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<label id="lblName" class="name"/> <label id="lblName" class="name"/>
</linear> </linear>
<linear orientation="v" class="col state-col"> <!-- <linear orientation="v" class="col state-col">-->
<label id="lblState" class="state" /> <!-- <label id="lblState" class="state" />-->
</linear> <!-- </linear>-->
<linear orientation="v" class="col amount-col"> <linear orientation="v" class="col amount-col">
<label id="lblAmount" class="amount" /> <label id="lblAmount" class="amount" />
</linear> </linear>
...@@ -71,7 +71,14 @@ ...@@ -71,7 +71,14 @@
.photo-col { .photo-col {
width: 80px; width: 80px;
margin-right: 5px; }
.photo-col .photo {
width: 100%;
height: 100%;
image-mode: fit;
image-loading: white;
padding: 2px;
} }
.name-col { .name-col {
...@@ -82,6 +89,8 @@ ...@@ -82,6 +89,8 @@
.name-col .name { .name-col .name {
word-wrap: break-word; word-wrap: break-word;
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: 15px;
font-style: bold;
} }
.state-col { .state-col {
...@@ -96,13 +105,13 @@ ...@@ -96,13 +105,13 @@
.amount-col .amount { .amount-col .amount {
word-wrap: break-word; word-wrap: break-word;
text-valign: right; text-valign: right;
font-size: 15px;
} }
.photo-col .photo { .amount-col .red {
width: 100%; color: red;
height: 100%;
image-mode: fit;
image-loading: white;
} }
</style> </style>
</ui> </ui>
\ No newline at end of file
...@@ -19,5 +19,17 @@ ...@@ -19,5 +19,17 @@
#pragma mark - #pragma mark -
@class StatementMonth;
@interface VankeStatementMonthCell_iPhone : BeeUICell @interface VankeStatementMonthCell_iPhone : BeeUICell
AS_OUTLET( BeeUILabel, lblYear )
AS_OUTLET( BeeUILabel, lblMonth )
AS_OUTLET( BeeUILabel, lblCount )
AS_OUTLET( BeeUILabel, lblAmount )
AS_OUTLET( BeeUILabel, lblTotalPrefix )
-(void) setSettleDate: (NSDate*) date;
@end @end
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
// //
#import "VankeStatementMonthCell_iPhone.h" #import "VankeStatementMonthCell_iPhone.h"
#import "VankeSettlementListAPI.h"
#pragma mark - #pragma mark -
...@@ -24,8 +25,15 @@ ...@@ -24,8 +25,15 @@
SUPPORT_AUTOMATIC_LAYOUT( YES ) SUPPORT_AUTOMATIC_LAYOUT( YES )
SUPPORT_RESOURCE_LOADING( YES ) SUPPORT_RESOURCE_LOADING( YES )
DEF_OUTLET( BeeUILabel, lblYear )
DEF_OUTLET( BeeUILabel, lblMonth )
DEF_OUTLET( BeeUILabel, lblCount )
DEF_OUTLET( BeeUILabel, lblAmount )
DEF_OUTLET( BeeUILabel, lblTotalPrefix )
- (void)load - (void)load
{ {
} }
- (void)unload - (void)unload
...@@ -34,7 +42,14 @@ SUPPORT_RESOURCE_LOADING( YES ) ...@@ -34,7 +42,14 @@ SUPPORT_RESOURCE_LOADING( YES )
- (void)dataDidChanged - (void)dataDidChanged
{ {
// TODO: fill data StatementListResponse *resp = (StatementListResponse*) self.data;
if (nil == resp) {
return;
}
[self setSettleDate:resp.settle];
$(self.lblCount).DATA([NSString stringWithFormat:@"%d", [resp.paging.recordCount intValue]]);
$(self.lblAmount).DATA(resp.amount.description);
} }
- (void)layoutDidFinish - (void)layoutDidFinish
...@@ -42,4 +57,15 @@ SUPPORT_RESOURCE_LOADING( YES ) ...@@ -42,4 +57,15 @@ SUPPORT_RESOURCE_LOADING( YES )
// TODO: custom layout here // TODO: custom layout here
} }
-(void) setSettleDate: (NSDate*) date {
if (nil == date) {
$(self.lblYear).DATA(@"");
$(self.lblMonth).DATA(@"");
} else {
$(self.lblYear).DATA([NSString stringWithFormat:@"%lu", date.year]);
$(self.lblMonth).DATA([NSString stringWithFormat:@"%lu", date.month]);
}
}
@end @end
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui namespace="VankeStatementMonthCell_iPhone"> <ui namespace="VankeStatementMonthCell_iPhone">
<!-- <linear orientation="h" class="wrapper">
<row></row> <image class="bg"/>
-->
<col class="wrapper"> <linear orientation="v" class="col-wrapper date-col">
<!-- add your UI elements here --> <linear orientation="h" class="col-body">
</col> <linear orientation="h" class="row">
<label class="lbl">账单日期</label>
</linear>
<linear orientation="h" class="row">
<button id="pickerMask" />
<linear orientation="h" class="row-wrapper">
<label id="lblYear" class="lbl year-val"></label>
<label class="lbl year"></label>
<label id="lblMonth" class="lbl mon-val"></label>
<label class="lbl month"></label>
<image id="imgDatePicker" class="date-picker" />
</linear>
</linear>
</linear>
</linear>
<linear orientation="v" class="col-wrapper summary-col">
<linear orientation="h" class="col-body">
<linear orientation="h" class="row">
<linear orientation="h" class="row1-wrapper">
<label class="lbl"></label>
<label id="lblCount" class="lbl"></label>
<label class="lbl">家商铺:</label>
<label id="lblTotalPrefix" class="lbl">应收总额</label>
</linear>
</linear>
<linear orientation="h" class="row">
<linear orientation="h" class="row2-wrapper">
<label id="lblAmount" class="lbl amount"></label>
<label class="lbl unit"></label>
</linear>
</linear>
</linear>
</linear>
</linear>
<style type="text/css"> <style type="text/css">
.wrapper { .wrapper {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.bg {
width: 100%;
height: 100%;
position: absolute;
left: 0px;
top: 0px;
background-color: white;
}
.col-wrapper {
width: 50%;
height: 100%;
v-align: center;
}
.col-wrapper .col-body {
width: 100%;
height: auto;
}
.lbl {
width: auto;
color: #aaaaaa;
font-size: 14px;
}
.row {
width: 100%;
height: 20px;
margin-bottom: 5px;
}
.row-wrapper {
width: auto;
height: 100%;
}
/** 左边日期列 */
.date-col {
padding-left: 10px;
}
.date-col .row {
align: left;
}
.date-col .year-val,
.date-col .mon-val {
color: #904cf5;
font-size: 20px;
font-style: bold;
}
.date-col .month,
.date-col .year {
color: black;
font-size: 12px;
padding-top: 2px;
}
#pickerMask {
position: absolute;
left: 0px;
top: 0px;
height: 100%;
width: 100%;
}
/** 右边汇总列 */
.summary-col {
padding-right: 10px;
}
.summary-col .row {
align: right;
}
.summary-col .row1-wrapper,
.summary-col .row2-wrapper {
width: auto;
}
.summary-col .amount {
color: red;
font-size: 20px;
font-style: bold;
}
.summary-col .unit {
color: black;
font-size: 12px;
padding-top: 2px;
}
</style> </style>
</ui> </ui>
\ No newline at end of file
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