Commit 3f89c559 authored by Sandy's avatar Sandy

销售录入模块显示/列表界面/新建界面/获取支付方式列表

parent 51cce7a2
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>function</key>
<array>
<dict>
<key>type</key>
<string>4</string>
<key>functionName</key>
<string>销售录入</string>
<key>functionPic</key>
<string>business_salesInput</string>
</dict>
</array>
<key>headerTitle</key>
<string>营运</string>
</dict>
</array>
</plist>
//
// BusinessFunction.h
//
// Created by 杰 张 on 16/7/29
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
业务菜单类型
- functionTypeAnouncement: 公告
- functionTypeMessage: 消息
- functionTypeTodo: 待办
- functionTypeStatement: 对账单
- functionTypeSaleInput: 销售录入
- functionTypeRepair: 工程报修
- functionTypeInspect: 设备巡检
- functionTypeReading: 仪表读数
- functionTypeSuggest: 投诉建议
- functionTypeInspectRepair: 设备报修
- functionTypeOperateInspect: 运营巡检
- functionTypeTenant: 商户沟通
- functionTypeContactExamine: 合同审批
- functionTypeAmmeter: 电表充值
- functionTypeYueXin: 月星家居
*/
typedef NS_ENUM(NSInteger, functionType) {
functionTypeAnouncement = 0,
functionTypeMessage = 1,
functionTypeTodo = 2,
functionTypeStatement = 3,
functionTypeSaleInput = 4,
functionTypeRepair = 5,
functionTypeInspect = 6,
functionTypeReading = 7,
functionTypeSuggest = 8,
functionTypeInspectRepair = 9,
functionTypeOperateInspect = 10,
functionTypeTenant = 11,
functionTypeContactExamine = 12,
functionTypeIndoorMap = 13,
functionTypeAmmeter = 14,
functionTypeYueXin = 15,
functionTypeTennantManagement= 16,
functionTypeBrandManagement = 17
};
@interface BusinessFunction : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *functionPic;
@property (nonatomic, strong) NSString *functionName;
@property (nonatomic, assign) functionType type;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// BusinessFunction.m
//
// Created by 杰 张 on 16/7/29
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "BusinessFunction.h"
NSString *const kBusinessFunctionFunctionPic = @"functionPic";
NSString *const kBusinessFunctionFunctionName = @"functionName";
NSString *const kBusinessFunctionType= @"type";
@interface BusinessFunction ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation BusinessFunction
@synthesize functionPic = _functionPic;
@synthesize functionName = _functionName;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.functionPic = [self objectOrNilForKey:kBusinessFunctionFunctionPic fromDictionary:dict];
self.functionName = [self objectOrNilForKey:kBusinessFunctionFunctionName fromDictionary:dict];
self.type = [dict[@"type"] integerValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.functionPic forKey:kBusinessFunctionFunctionPic];
[mutableDict setValue:self.functionName forKey:kBusinessFunctionFunctionName];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.functionPic = [aDecoder decodeObjectForKey:kBusinessFunctionFunctionPic];
self.functionName = [aDecoder decodeObjectForKey:kBusinessFunctionFunctionName];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_functionPic forKey:kBusinessFunctionFunctionPic];
[aCoder encodeObject:_functionName forKey:kBusinessFunctionFunctionName];
}
- (id)copyWithZone:(NSZone *)zone
{
BusinessFunction *copy = [[BusinessFunction alloc] init];
if (copy) {
copy.functionPic = [self.functionPic copyWithZone:zone];
copy.functionName = [self.functionName copyWithZone:zone];
}
return copy;
}
@end
//
// BusinessFunctionMode.h
//
// Created by 杰 张 on 16/7/29
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BusinessFunction.h"
@interface BusinessFunctionModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSArray<BusinessFunction *> *function;
@property (nonatomic, strong) NSString *headerTitle;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
/**
没有权限控制
*/
- (instancetype)initWithDictionary:(NSDictionary *)dict;
/**
权限控制
*/
- (instancetype)initWithDictionaryPermissionControl:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// BusinessFunctionMode.m
//
// Created by 杰 张 on 16/7/29
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "BusinessFunctionModel.h"
NSString *const kBusinessFunctionModeFunction = @"function";
NSString *const kBusinessFunctionModeHeaderTitle = @"headerTitle";
@interface BusinessFunctionModel ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation BusinessFunctionModel
@synthesize function = _function;
@synthesize headerTitle = _headerTitle;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
NSObject *receivedBusinessFunction = [dict objectForKey:kBusinessFunctionModeFunction];
NSMutableArray *parsedBusinessFunction = [NSMutableArray array];
if ([receivedBusinessFunction isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedBusinessFunction) {
if ([item isKindOfClass:[NSDictionary class]]) {
[parsedBusinessFunction addObject:[BusinessFunction modelObjectWithDictionary:item]];
}
}
} else if ([receivedBusinessFunction isKindOfClass:[NSDictionary class]]) {
[parsedBusinessFunction addObject:[BusinessFunction modelObjectWithDictionary:(NSDictionary *)receivedBusinessFunction]];
}
self.function = [NSArray arrayWithArray:parsedBusinessFunction];
self.headerTitle = [self objectOrNilForKey:kBusinessFunctionModeHeaderTitle fromDictionary:dict];
}
return self;
}
- (instancetype)initWithDictionaryPermissionControl:(NSDictionary *)dict {
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
NSObject *receivedBusinessFunction = [dict objectForKey:kBusinessFunctionModeFunction];
NSMutableArray *parsedBusinessFunction = [NSMutableArray array];
if ([receivedBusinessFunction isKindOfClass:[NSArray class]]) {
for (NSDictionary *item in (NSArray *)receivedBusinessFunction) {
if ([item isKindOfClass:[NSDictionary class]]) {
BusinessFunction *function = [BusinessFunction modelObjectWithDictionary:item];
switch (function.type) {
case functionTypeSaleInput:
{
if (AppGlobal.permission.saleinput.read) {
[parsedBusinessFunction addObject:function];
}
}
break;
default:
break;
}
}
}
} else if ([receivedBusinessFunction isKindOfClass:[NSDictionary class]]) {
[parsedBusinessFunction addObject:[BusinessFunction modelObjectWithDictionary:(NSDictionary *)receivedBusinessFunction]];
}
self.function = [NSArray arrayWithArray:parsedBusinessFunction];
self.headerTitle = [self objectOrNilForKey:kBusinessFunctionModeHeaderTitle fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
NSMutableArray *tempArrayForFunction = [NSMutableArray array];
for (NSObject *subArrayObject in self.function) {
if([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
// This class is a model object
[tempArrayForFunction addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
} else {
// Generic object
[tempArrayForFunction addObject:subArrayObject];
}
}
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForFunction] forKey:kBusinessFunctionModeFunction];
[mutableDict setValue:self.headerTitle forKey:kBusinessFunctionModeHeaderTitle];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.function = [aDecoder decodeObjectForKey:kBusinessFunctionModeFunction];
self.headerTitle = [aDecoder decodeObjectForKey:kBusinessFunctionModeHeaderTitle];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_function forKey:kBusinessFunctionModeFunction];
[aCoder encodeObject:_headerTitle forKey:kBusinessFunctionModeHeaderTitle];
}
- (id)copyWithZone:(NSZone *)zone
{
BusinessFunctionModel *copy = [[BusinessFunctionModel alloc] init];
if (copy) {
copy.function = [self.function copyWithZone:zone];
copy.headerTitle = [self.headerTitle copyWithZone:zone];
}
return copy;
}
@end
......@@ -7,6 +7,8 @@
//
#import "BusinessCollectionViewController.h"
#import "BusinessFunctionModel.h"
#import "SaleInputListViewController.h"
@interface BusinessCollectionViewController ()
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *layout;
......@@ -26,11 +28,92 @@ static NSString *const reuseIdentifier = @"Cell";
self.layout.minimumInteritemSpacing = 10;
self.layout.headerReferenceSize = CGSizeMake(kWidth, 40);
self.collectionView.contentInset = UIEdgeInsetsMake(0, 0, 49, 0);
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"BusinessItems" ofType:@"plist"];
NSArray *arrData = [[NSArray alloc] initWithContentsOfFile:plistPath];
CLog(@"%@", arrData);
self.arrFunction = [NSMutableArray array];
for (NSDictionary *dic in arrData) {
//增加菜单需要在BusinessFunctionModel里面增加枚举项
#ifdef DEBUG
// 没有权限控制
// BusinessFunctionModel *model = [BusinessFunctionModel modelObjectWithDictionary:dic];
//
// 权限控制
BusinessFunctionModel *model = [[BusinessFunctionModel alloc] initWithDictionaryPermissionControl:dic];
#else
BusinessFunctionModel *model = [[BusinessFunctionModel alloc] initWithDictionaryPermissionControl:dic];
#endif
if (model.function.count > 0) {
[self.arrFunction addObject:model];
}
}
}
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *header = nil;
if (kind == UICollectionElementKindSectionHeader) {
header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"businessHeader" forIndexPath:indexPath];
}
UILabel *title = (UILabel *)[header viewWithTag:110];
UIImageView *image = (UIImageView *)[header viewWithTag:111];
[image.image resizableImageWithCapInsets:UIEdgeInsetsMake(0, 39, 0, 40) resizingMode:UIImageResizingModeTile];
NSString *txt = [self.arrFunction[indexPath.section] headerTitle];
title.text = txt;
return header;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return self.arrFunction.count;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
BusinessFunctionModel *model = self.arrFunction[section];
return model.function.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
BusinessFunctionModel *model = self.arrFunction[indexPath.section];
BusinessFunction *founction = model.function[indexPath.row];
UILabel *title = (UILabel *)[cell viewWithTag:110];
title.text = founction.functionName;
UIImageView *img = (UIImageView *)[cell viewWithTag:111];
img.image = [UIImage imageNamed:founction.functionPic];
// Configure the cell
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
BusinessFunctionModel *functions = self.arrFunction[indexPath.section];
BusinessFunction *function = functions.function[indexPath.row];
switch (function.type) {
case functionTypeSaleInput:
{
SaleInputListViewController *saleVC = [SaleInputListViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_SALEINPUT];
[self.navigationController pushViewController:saleVC animated:YES];
}
break;
default:
break;
}
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:NO];
}
- (void)didReceiveMemoryWarning
......
@interface HMSaleInputDetail_contract : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * code;
@property (nonatomic, strong) NSString <Optional> * uuid;
@property (nonatomic, strong) NSString <Optional> * name;
@end
@interface HMSaleInputDetail_store : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * code;
@property (nonatomic, strong) NSString <Optional> * uuid;
@property (nonatomic, strong) NSString <Optional> * name;
@end
@interface HMSaleInputDetail_tenant : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * code;
@property (nonatomic, strong) NSString <Optional> * uuid;
@property (nonatomic, strong) NSString <Optional> * name;
@end
@protocol HMSaleInputDetail_payments
@end
@interface HMSaleInputDetail_payments_payment : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * code;
@property (nonatomic, strong) NSString <Optional> * uuid;
@property (nonatomic, strong) NSString <Optional> * name;
@end
@interface HMSaleInputDetail_payments : ZJBaseModel
@property (nonatomic, strong) NSNumber <Optional> * total;
@property (nonatomic, strong) HMSaleInputDetail_payments_payment <Optional> * payment;
@end
@interface HMSaleInputDetail : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * oper;
@property (nonatomic, strong) NSMutableArray < Optional> * mediaFiles;
@property (nonatomic, strong) NSNumber <Optional> * saleCount;
@property (nonatomic, strong) NSString <Optional> * saleDate;
@property (nonatomic, strong) HMSaleInputDetail_contract <Optional> * contract;
@property (nonatomic, strong) HMSaleInputDetail_store <Optional> * store;
@property (nonatomic, strong) NSString <Optional> * receiver;
@property (nonatomic, strong) NSNumber <Optional> * balance;
@property (nonatomic, strong) HMSaleInputDetail_tenant <Optional> * tenant;
@property (nonatomic, strong) NSMutableArray <HMSaleInputDetail_payments,Optional> * payments;
@end
#import "HMSaleInputDetail.h"
@implementation HMSaleInputDetail
@end
@implementation HMSaleInputDetail_contract
@end
@implementation HMSaleInputDetail_store
@end
@implementation HMSaleInputDetail_tenant
@end
@implementation HMSaleInputDetail_payments
@end
@implementation HMSaleInputDetail_payments_payment
@end
@interface HMSaleInputQuery_dateRange : ZJBaseModel
@property (nonatomic, strong) NSString <Optional> * beginDate;
@property (nonatomic, strong) NSString <Optional> * endDate;
@end
@interface HMSaleInputQuery : ZJBaseModel
@property (nonatomic, strong) HMSaleInputQuery_dateRange <Optional> * dateRange;
@property (nonatomic, strong) NSMutableArray < Optional> * contracts;
@property (nonatomic, strong) NSString <Optional> * state;
@property (nonatomic, strong) NSNumber <Optional> * page;
@property (nonatomic, strong) NSNumber <Optional> * pageSize;
@end
#import "HMSaleInputQuery.h"
@implementation HMSaleInputQuery
@end
@implementation HMSaleInputQuery_dateRange
@end
This diff is collapsed.
//
// SaleInputAddViewController.h
// HDMall
//
// Created by Javen on 2017/7/31.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import "BaseViewController.h"
@interface SaleInputAddViewController : BaseViewController
@end
//
// SaleInputAddViewController.m
// HDMall
//
// Created by Javen on 2017/7/31.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import "SaleInputAddViewController.h"
#import "SaleInputViewModel.h"
#import "SaleInputAmountCollectionViewCell.h"
@interface SaleInputAddViewController ()<UICollectionViewDelegate, UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
@property (weak, nonatomic) IBOutlet UIButton *btnBottom;
@property (strong, nonatomic) SaleInputViewModel *viewModel;
@property (strong, nonatomic) NSMutableArray *arrData;
@end
@implementation SaleInputAddViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
WS(weakSelf);
[self.viewModel httpAllPayments:^(NSMutableArray<HMSaleInputDetail_payments_payment *> *arrPayments) {
weakSelf.arrData = arrPayments;
[weakSelf.collectionView reloadData];
CLog(@"%@", arrPayments);
}];
}
#pragma mark - UICollectionViewDelegateFlowLayout
#pragma mark - item的列间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
return 0;
}
#pragma mark - item的行间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
if (0 == section) {
return 0;
} else {
return 5;
}
}
//定义每个UICollectionView item的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
if (0 == indexPath.section) {
return CGSizeMake(kWidth, 50);
} else {
return CGSizeMake((kWidth - 30) / 2, kAutoValue(120));
}
}
//定义每个UICollectionView section的 margin
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
if (0 == section) {
return UIEdgeInsetsMake(0, 0, 0, 0);
} else {
return UIEdgeInsetsMake(0, 10, 0, 10);
}
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
if (section == 0) {
return CGSizeMake(0, 0);
} else {
return CGSizeMake(kWidth, 50);
}
}
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
UICollectionReusableView *header;
if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"picHeaderView" forIndexPath:indexPath];
}
return header;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.arrData.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
//输入各种支付方式的金额
SaleInputAmountCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"SaleInputAmountCollectionViewCell" forIndexPath:indexPath];
cell.isEdit = self.viewModel.type != SaleInputTypeReadOnly;
[cell configCellWithArray:self.arrData indexPath:indexPath];
// WS(weakSelf);
cell.blockNumberChanged = ^{
// [weakSelf allInputMoney];
};
return cell;
}
//
- (void)httpPayments {
}
ZJLazy(SaleInputViewModel, viewModel);
ZJLazy(NSMutableArray, arrData);
@end
//
// SaleInputListViewController.h
// RealEstateManagement
//
// Created by Javen on 2016/11/2.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BaseListViewController.h"
@interface SaleInputListViewController : BaseListViewController
@end
//
// SaleInputListViewController.m
// RealEstateManagement
//
// Created by Javen on 2016/11/2.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "SaleInputListViewController.h"
#import "SaleInputAddViewController.h"
#import "SaleInputListTableViewCell.h"
//#import "SaleInputDetailModel.h"
//#import "SaleInputDetailViewController.h"
#import "HMSaleInputQuery.h"
@interface SaleInputListViewController ()
@property (strong, nonatomic) HMSaleInputQuery *query;
@end
@implementation SaleInputListViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"销售录入记录";
[self refresh];
self.btnAdd.hidden = !AppGlobal.permission.saleinput.newField;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBar.barTintColor = kMainBlueColor;
}
- (void)httpRequest {
self.query.contracts = [AppGlobal getUserContractUuids];
self.query.page = @(self.page);
self.query.pageSize = @(self.pageSize);
self.query.dateRange = [HMSaleInputQuery_dateRange new];
self.query.dateRange.beginDate = @"2016-07-12";
self.query.dateRange.endDate = @"2017-07-13";
WS(weakSelf);
[ZJHttpManager POST:@"hdmall/api/sale/getList" parameters:self.query.toDictionary complete:^(id responseObject, NSError *error) {
if (kIsResponse) {
}else{
kFalseHttpTips;
self.page--;
}
[weakSelf listTableViewReloadData];
}];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
SaleInputListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SaleInputListTableViewCell" forIndexPath:indexPath];
[cell configCellWithArray:self.arrData indexPath:indexPath];
return cell;
}
- (void)listDidSelect:(id)model {
// SaleInputDetailModel *listModel = model;
// SaleInputDetailViewController *detailVC = [SaleInputDetailViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_SALEINPUT];
// detailVC.detailType = SaleInputDetailTypeReadOnly;
// detailVC.listModel = listModel;
// [self.navigationController pushViewController:detailVC animated:YES];
}
- (void)actionAdd:(UIButton *)sender {
SaleInputAddViewController *addVC = [SaleInputAddViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_SALEINPUT];
[self listPushCustomAnimate:addVC];
}
ZJLazy(HMSaleInputQuery, query);
- (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
//
// SaleInputViewModel.h
// HDMall
//
// Created by Javen on 2017/7/31.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HMSaleInputDetail.h"
typedef NS_ENUM(NSInteger, SaleInputType) {
SaleInputTypeCreate,
SaleInputTypeEdit,
SaleInputTypeReadOnly
};
@interface SaleInputViewModel : NSObject
@property (assign, nonatomic) SaleInputType type;
/**
获取全部支付方式
@param callBack 获取到支付方式的回调(如果arrPayments = nil, 则代表请求失败)
*/
- (void)httpAllPayments:(void (^)(NSMutableArray<HMSaleInputDetail_payments *> *arrPayments))callBack;
@end
//
// SaleInputViewModel.m
// HDMall
//
// Created by Javen on 2017/7/31.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import "SaleInputViewModel.h"
@implementation SaleInputViewModel
/**
获取全部支付方式
@param callBack 获取到支付方式的回调(如果arrPayments = nil, 则代表请求失败)
*/
- (void)httpAllPayments:(void (^)(NSMutableArray<HMSaleInputDetail_payments *> *arrPayments))callBack {
[ZJHttpManager GET:@"hdmall/salesinput/getAllPayments" parameters:nil complete:^(id responseObject, NSError *error) {
if (kIsResponse) {
NSMutableArray *arrData = [HMSaleInputDetail_payments_payment modelsFromArray:responseObject[@"data"]];
//后台返回的结构是HMSaleInputDetail_payments_payment,需要处理一下,变成HMSaleInputDetail_payments才符合使用需求
NSMutableArray *arrPayments = [NSMutableArray array];
for (HMSaleInputDetail_payments_payment *pay in arrData) {
HMSaleInputDetail_payments *payments = [HMSaleInputDetail_payments new];
payments.payment = pay;
[arrPayments addObject:payments];
}
callBack(arrPayments);
}else{
callBack(nil);
kFalseHttpTips;
}
}];
}
@end
//
// SaleInputAmountCollectionViewCell.h
// RealEstateManagement
//
// Created by Javen on 2016/10/11.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "SaleInputViewModel.h"
@interface SaleInputAmountCollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
@property (weak, nonatomic) IBOutlet UITextField *textFieldInput;
@property (nonatomic, strong) HMSaleInputDetail_payments *model;
@property (nonatomic, assign) BOOL isEdit;
@property (nonatomic, copy) void (^blockNumberChanged)(void);
- (void)configCellWithArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath;
@end
//
// SaleInputAmountCollectionViewCell.m
// RealEstateManagement
//
// Created by Javen on 2016/10/11.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "CalculateHelper.h"
#import "SaleInputAmountCollectionViewCell.h"
#import "NSString+Additions.h"
@interface SaleInputAmountCollectionViewCell () <UITextFieldDelegate>
@end
@implementation SaleInputAmountCollectionViewCell
- (void)awakeFromNib
{
[super awakeFromNib];
self.textFieldInput.delegate = self;
[self.textFieldInput addTarget:self action:@selector(textFieldDidChanged:) forControlEvents:UIControlEventEditingChanged];
}
/**
* 设置可编辑状态和不可编辑状态
*/
- (void)setIsEdit:(BOOL)isEdit {
_isEdit = isEdit;
if (isEdit) {
self.textFieldInput.userInteractionEnabled = YES;
self.textFieldInput.textColor = [UIColor blackColor];
}else{
self.textFieldInput.userInteractionEnabled = NO;
self.textFieldInput.textColor = [UIColor lightGrayColor];
}
}
//实时获取变化之后的数据
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
//获取改变之后的字符串
NSMutableString *futureString = [NSMutableString stringWithString:textField.text];
[futureString insertString:string atIndex:range.location];
return [futureString isValidMoneyInput];
}
- (void)textFieldDidChanged:(UITextField *)textField {
self.model.total = [CalculateHelper decimalNumber:textField.text];
self.blockNumberChanged();
}
- (void)textFieldDidBeginEditing:(UITextField *)textField {
textField.textColor = [UIColor blackColor];
if ([textField.text isEqualToString:@"0.00"]) {
textField.text = @"";
}
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
//输入框有文字则显示,避免没输入自动出现0.00的情况
if (textField.text.length > 0) {
if ([textField.text isEqualToString:@"0"]) {
textField.textColor = [UIColor lightGrayColor];
textField.text = @"0.00";
}else{
self.textFieldInput.text = [CalculateHelper getMoneyStringFrom:textField.text];
}
}
}
- (void)configCellWithArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath {
self.model = array[indexPath.row];
self.textFieldInput.text = self.model.total ? [CalculateHelper getMoneyStringFrom:self.model.total] : nil;
if ([self.textFieldInput.text isEqualToString:@"0.00"]) {
self.textFieldInput.textColor = [UIColor lightGrayColor];
}else{
self.textFieldInput.textColor = [UIColor blackColor];
}
self.labelTitle.text = self.model.payment.name;
}
@end
//
// SaleInputListTableViewCell.h
// RealEstateManagement
//
// Created by Javen on 2016/11/2.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
//#import "SaleInputDetailModel.h"
@interface SaleInputListTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *labelTItle;
@property (weak, nonatomic) IBOutlet UILabel *labelBillCount;
@property (weak, nonatomic) IBOutlet UILabel *labelTime;
@property (weak, nonatomic) IBOutlet UILabel *labelBillNumber;
//@property (nonatomic, strong) SaleInputDetailModel *model;
@property (weak, nonatomic) IBOutlet UIImageView *imgState;
- (void)configCellWithArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath;
@end
//
// SaleInputListTableViewCell.m
// RealEstateManagement
//
// Created by Javen on 2016/11/2.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "SaleInputListTableViewCell.h"
@implementation SaleInputListTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)configCellWithArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath {
// self.model = array[indexPath.row];
// self.labelTItle.text = self.model.contract.name;
// self.labelBillCount.text = [NSString stringWithFormat:@"%.0f",self.model.saleCount];
// self.labelTime.text = self.model.saleDate;
// self.imgState.image = [UIImage imageNamed:self.model.stateImageName];
// self.labelBillNumber.text = self.model.billNumber;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// SaleInputTopView.h
// RealEstateManagement
//
// Created by Javen on 2016/10/13.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SaleInputTopView : UIView
/** 选择商铺 */
@property (weak, nonatomic) IBOutlet UIButton *btnStore;
/** 销售日期 */
@property (weak, nonatomic) IBOutlet UITextField *textFieldDate;
/** 今日累计 */
@property (weak, nonatomic) IBOutlet UILabel *labelTodayTotal;
//两个三角
@property (weak, nonatomic) IBOutlet UIImageView *right1;
@property (weak, nonatomic) IBOutlet UIImageView *right2;
@property (nonatomic, copy) void (^blockDidChooseDate)(void);
@end
//
// SaleInputTopView.m
// RealEstateManagement
//
// Created by Javen on 2016/10/13.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "SaleInputTopView.h"
@interface SaleInputTopView ()<UITextFieldDelegate>
@property (strong, nonatomic) UIDatePicker *datePicker;
@end
@implementation SaleInputTopView
- (void)awakeFromNib {
[super awakeFromNib];
// if (kUser.isTenant) {
// self.btnStore.userInteractionEnabled = NO;
// self.right1.hidden = YES;
// }
self.datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, kWidth, 216)];
self.datePicker.maximumDate = [NSDate date];
self.textFieldDate.inputView = self.datePicker;
self.textFieldDate.delegate = self;
self.datePicker.datePickerMode = UIDatePickerModeDate;
self.textFieldDate.text = [self.datePicker.date yearMonthDayString];
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
self.textFieldDate.text = [self.datePicker.date yearMonthDayString];
self.blockDidChooseDate();
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
......@@ -22,6 +22,9 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:NO];
//防止底部出现黑边
self.view.frame = CGRectMake(0, 0, kWidth, kHeight);
[self.view layoutIfNeeded];
}
- (UIStatusBarStyle)preferredStatusBarStyle {
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "business_header_bg.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "business_header_bg@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "business_salesInput.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "business_salesInput@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "add-photo_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "add-photo_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "back_icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "back_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "back_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_addrepair@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_addrepair@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "right_arrow.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"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
......@@ -34,6 +34,7 @@
#import "UIViewController+Additions.h"
#import "NSNumber+Addtions.h"
#import "NSString+Additions.h"
#import "NSDate+Additions.h"
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
......
......@@ -26,6 +26,9 @@
*/
+ (instancetype)modelWithDic:(NSDictionary *)dic;
/** 传入数据数组,返回模型数组 */
+ (NSMutableArray *)modelsFromArray:(NSArray *)array;
/**
模型转模型
......
......@@ -21,6 +21,15 @@
return model;
}
+ (NSMutableArray *)modelsFromArray:(NSArray *)array {
NSMutableArray *arr = [NSMutableArray array];
for (NSDictionary *dict in array) {
id model = [[self class] modelWithDic:dict];
[arr addObject:model];
}
return arr;
}
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{ @"idField" : @"id",
@"newField" : @"new" }];
......
//
// NSDate+Additions.h
// HDMall
//
// Created by Javen on 2017/7/31.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDate (Additions)
/** yyyy-MM-dd HH:mm:ss */
- (NSString *)httpParameterString;
/** yyyy-MM-dd */
- (NSString *)yearMonthDayString;
/** yyyy-MM */
- (NSString *)yearMonthString;
- (NSString *)yearString;
- (NSString *)monthString;
- (NSString *)dayString;
- (NSString *)stringWithFormatter:(NSString *)dateFormatter;
@end
//
// NSDate+Additions.m
// HDMall
//
// Created by Javen on 2017/7/31.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import "NSDate+Additions.h"
@implementation NSDate (Additions)
- (NSString *)httpParameterString {
return [self stringWithFormatter:@"yyyy-MM-dd HH:mm:ss"];
}
- (NSString *)yearMonthDayString {
return [self stringWithFormatter:@"yyyy-MM-dd"];
}
- (NSString *)yearMonthString {
return [self stringWithFormatter:@"yyyy-MM"];
}
- (NSString *)yearString {
NSString *strDate = [self yearMonthDayString];
NSArray *arrDate = [strDate componentsSeparatedByString:@"-"];
return arrDate[0];
}
- (NSString *)monthString {
NSString *strDate = [self yearMonthDayString];
NSArray *arrDate = [strDate componentsSeparatedByString:@"-"];
return arrDate[1];
}
- (NSString *)dayString{
NSString *strDate = [self yearMonthDayString];
NSArray *arrDate = [strDate componentsSeparatedByString:@"-"];
return arrDate[2];
}
- (NSString *)stringWithFormatter:(NSString *)dateFormatter {
if ([dateFormatter length] == 0) {
return nil;
}
// Change to Local time zone
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate:self];
NSDate *localDate = [self dateByAddingTimeInterval: interval];
NSDateFormatter *f = [NSDateFormatter new];
[f setDateFormat:dateFormatter];
return [f stringFromDate:localDate];
}
@end
......@@ -73,7 +73,7 @@
CLPlacemark *placemark = [array objectAtIndex:0];
//获取城市
NSString *city = placemark.locality;
NSString *zipCode = placemark.postalCode;
// NSString *zipCode = placemark.postalCode;
if (!city) {
//四大直辖市的城市信息无法通过locality获得,只能通过获取省份的方法来获得(如果city为空,则可知为直辖市)
city = placemark.administrativeArea;
......
......@@ -29,9 +29,12 @@
/** 权限 */
@property (strong, nonatomic) ZJPermissionManager *permission;
+ (ZJAppInstance *)shareInstance;
/** 获取用户的所有合同uuid */
- (NSMutableArray *)getUserContractUuids;
/** 保存基础信息 */
- (void)saveBaseInfo;
......
......@@ -10,6 +10,7 @@
static NSString *const zj_saved_name = @"zj_saved_name";
static NSString *const zj_saved_pwd = @"zj_saved_pwd";
static NSString *const zj_saved_isMall = @"zj_saved_isMall";
@implementation ZJAppInstance
+ (ZJAppInstance *)shareInstance {
static ZJAppInstance *instance = nil;
......@@ -37,5 +38,13 @@ static NSString *const zj_saved_isMall = @"zj_saved_isMall";
[self.permission updatePermissions:user.permissions];
}
- (NSMutableArray *)getUserContractUuids {
NSMutableArray *arr = [NSMutableArray array];
for (UserInfo_contracts *contract in self.user.contracts) {
[arr addObject:contract.uuid];
}
return arr;
}
ZJLazy(ZJPermissionManager, permission)
@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