Commit 32fe82f8 authored by Sandy's avatar Sandy

基本完成

parent 294283e9
This diff is collapsed.
......@@ -7,8 +7,28 @@
//
#import "AppDelegate.h"
#import "GuideViewController.h"
#import "UMMobClick/MobClick.h"
#import "BMKMapManager.h"
#import "JPUSHService.h"
#import "UMMobClick/MobClick.h"
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
#import <UserNotifications/UserNotifications.h> // 这里是iOS10需要用到的框架
#endif
static NSString *const JPUSHAPPKEY = @"5dc63eefddc7955ac9985390"; // 极光appKey
static NSString *const channel = @"蒲公英"; // 固定的
#ifdef DEBUG // 开发
static BOOL const isProduction = FALSE; // 极光FALSE为开发环境
#else // 生产
static BOOL const isProduction = TRUE; // 极光TRUE为生产环境
#endif
@interface AppDelegate ()
{
BMKMapManager *_mapManager;
}
@end
......@@ -17,10 +37,99 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
if (!kGlobal.isNoFirst) {
GuideViewController *guideVC = [GuideViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN];
self.window.rootViewController = guideVC;
}
_mapManager = [[BMKMapManager alloc] init];
// 如果要关注网络及授权验证事件,请设定 generalDelegate参数
BOOL ret =
[_mapManager start:@"bLGWFgSNdYqP4Gf1w2IlihLO" generalDelegate:nil];
if (!ret) {
NSLog(@"manager start failed!");
}
[self JPUSHConfigWithOptions:launchOptions];
[self UMConfig];
return YES;
}
- (void)UMConfig {
UMConfigInstance.appKey = @"58623721a40fa342b90010f4";
UMConfigInstance.channelId = @"蒲公英";
UMConfigInstance.ePolicy = REALTIME;
[MobClick setLogEnabled:YES];
[MobClick startWithConfigure:UMConfigInstance];
}
- (void)JPUSHConfigWithOptions:(NSDictionary *)launchOptions {
// 注册apns通知
if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) // iOS10
{
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
JPUSHRegisterEntity *entity = [[JPUSHRegisterEntity alloc] init];
entity.types = UNAuthorizationOptionAlert | UNAuthorizationOptionBadge |
UNAuthorizationOptionSound;
[JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
#endif
} else if ([[UIDevice currentDevice].systemVersion floatValue] >=
8.0) // iOS8, iOS9
{
//可以添加自定义categories
[JPUSHService
registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
UIUserNotificationTypeSound |
UIUserNotificationTypeAlert)
categories:nil];
} else // iOS7
{
// categories 必须为nil
[JPUSHService
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert)
categories:nil];
}
/*
* launchingOption 启动参数.
* appKey 一个JPush 应用必须的,唯一的标识.
* channel 发布渠道. 可选.
* isProduction 是否生产环境. 如果为开发状态,设置为 NO; 如果为生产状态,应改为
* YES.
* advertisingIdentifier 广告标识符(IDFA) 如果不需要使用IDFA,传nil.
* 此接口必须在 App 启动时调用, 否则 JPush SDK 将无法正常工作.
*/
// 如不需要使用IDFA,advertisingIdentifier 可为nil
// 注册极光推送
[JPUSHService setupWithOption:launchOptions
appKey:JPUSHAPPKEY
channel:channel
apsForProduction:isProduction
advertisingIdentifier:nil];
// 2.1.9版本新增获取registration id block接口。
[JPUSHService
registrationIDCompletionHandler:^(int resCode, NSString *registrationID) {
if (resCode == 0) {
// iOS10获取registrationID放到这里了, 可以存到缓存里,
// 用来标识用户单独发送推送
NSLog(@"registrationID获取成功:%@", registrationID);
[[NSUserDefaults standardUserDefaults] setObject:registrationID
forKey:@"registrationID"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else {
NSLog(@"registrationID获取失败,code:%d", resCode);
}
}];
}
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Required - 注册 DeviceToken
[JPUSHService registerDeviceToken:deviceToken];
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
......
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-20@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-20@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-Spotlight-40@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-Spotlight-40@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
}
],
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "Checkmark.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Checkmark@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Checkmark@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "card_input_Bg.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "card_input_Bg@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "card_input_Bg@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "gray_card_bg.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "gray_card_bg@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "gray_card_bg@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "orang_card_bg.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "orang_card_bg@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "orang_card_bg@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "state_used.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "state_used@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "state_used@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "btn_abled.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_abled@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_abled@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "btn_disabled.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_disabled@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_disabled@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "图层-0.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "图层-0@2x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "launcher.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "launcher@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "launcher@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "login_bg.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "login_bg@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "login_bg@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "oil_detail_car.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "oil_detail_car@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "oil_detail_car@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "oil_detail_station.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "oil_detail_station@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "oil_detail_station@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "oil_detail_top.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "oil_detail_top@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "oil_detail_top@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "can_icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "can_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "can_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "引导页1.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "引导页1@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "引导页1@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "引导页2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "引导页2@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "引导页2@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "引导页3.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "引导页3@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "引导页3@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
......@@ -16,12 +20,26 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="launcher" translatesAutoresizingMaskIntoConstraints="NO" id="xCd-jt-tet">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="xCd-jt-tet" secondAttribute="bottom" id="4bJ-4r-9At"/>
<constraint firstItem="xCd-jt-tet" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="EoY-uB-QD4"/>
<constraint firstItem="xCd-jt-tet" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="cKE-9J-i4E"/>
<constraint firstAttribute="trailing" secondItem="xCd-jt-tet" secondAttribute="trailing" id="qdc-x5-Qso"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
<point key="canvasLocation" x="23" y="223"/>
</scene>
</scenes>
<resources>
<image name="launcher" width="360" height="640"/>
</resources>
</document>
This source diff could not be displayed because it is too large. You can view the blob instead.
<?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">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
//
// BillHeaderModel.h
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BillHeaderModel : NSObject
@property (strong, nonatomic) NSString *date;
@property (strong, nonatomic) NSString *total;
@end
//
// BillHeaderModel.m
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BillHeaderModel.h"
@implementation BillHeaderModel
@end
//
// CardJEModel.h
//
// Create by Javen Zhang on 28/12/2016
// Copyright © 2016. All rights reserved.
//
// Model file Generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
#import <UIKit/UIKit.h>
@interface CardJEModel : NSObject
@property (nonatomic, strong) NSString * createBy;
@property (nonatomic, strong) NSString * createDate;
@property (nonatomic, strong) NSString * createName;
@property (nonatomic, strong) NSString * distributeDate;
@property (nonatomic, strong) NSString * endDate;
@property (nonatomic, strong) NSString * idField;
@property (nonatomic, strong) NSString * memberId;
@property (nonatomic, strong) NSString * memberName;
@property (nonatomic, strong) NSString * name;
@property (nonatomic, strong) NSString * orderNumber;
@property (nonatomic, assign) double realPayTotal;
@property (nonatomic, strong) NSString * remak;
@property (nonatomic, strong) NSString * startDate;
@property (nonatomic, strong) NSString * state;
@property (nonatomic, strong) NSString * sysCompanyCode;
@property (nonatomic, strong) NSString * sysOrgCode;
@property (nonatomic, strong) NSString * ticketNumber;
@property (nonatomic, assign) double total;
@property (nonatomic, strong) NSString * type;
@property (nonatomic, strong) NSString * updateBy;
@property (nonatomic, strong) NSString * updateDate;
@property (nonatomic, strong) NSString * updateName;
-(instancetype)initWithDictionary:(NSDictionary *)dictionary;
-(NSDictionary *)toDictionary;
@end
This diff is collapsed.
//
// CardModel.h
// Car
//
// Created by Javen on 2016/12/28.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CardModel : OtherTicketEntity
@end
//
// CardModel.m
// Car
//
// Created by Javen on 2016/12/28.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "CardModel.h"
@implementation CardModel
@end
//
// BillListViewController.h
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BaseListViewController.h"
@interface BillListViewController : BaseListViewController
@end
//
// BillListViewController.m
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BillListViewController.h"
#import "HttpCilent.h"
#import "BillListTableViewCell.h"
#import "BillHeaderModel.h"
@interface BillListViewController ()
@property (nonatomic, strong) NSMutableDictionary *dicMonthData;
@property (nonatomic, strong) NSMutableArray *arrSortedData;
@property (nonatomic, strong) NSMutableArray *arrSortedMonths;
@end
@implementation BillListViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"工分账单";
[self httpRequest];
self.tableView.mj_header = nil;
WS(weakSelf);
self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
weakSelf.page++;
[weakSelf httpRequest];
}];
// Do any additional setup after loading the view.
}
- (void)httpRequest {
NSDictionary *myDictionary = @{@"userId" : kUser.fid,
@"pageNumber" : @(self.page),
@"pageSize" : @(self.pageSize)};
[MBProgressHUD j_loading];
[kHttp POST:kAccountQueryUrl parameters:myDictionary complete:^(id _Nullable response, NSError * _Nullable error) {
[MBProgressHUD j_hideLoadingView];
WS(weakSelf);
if (kRsSuccess(response)) {
for (NSDictionary *dict in response[@"data"][@"records"]) {
StationUserAcctHisEntity *model = [[StationUserAcctHisEntity alloc] initWithDictionary:dict error:nil];
[weakSelf.dicMonthData setObject:model forKey:[model.createDate substringToIndex:7]];
[weakSelf.arrData addObject:model];
}
[weakSelf configData];
[weakSelf listTableViewReloadData];
}else{
kShowRsMsg(response);
if (self.page > 0) {
self.page--;
}
}
}];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.arrSortedMonths.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.arrSortedData[section] count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 30;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 50;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UITableViewCell *header = [tableView dequeueReusableCellWithIdentifier:@"headerCell"];
BillHeaderModel *model = self.arrSortedMonths[section];
UILabel *month = (UILabel *)[header viewWithTag:1111];
month.text = model.date;
UILabel *money = (UILabel *)[header viewWithTag:2222];
money.text = model.total;
return header.contentView;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
BillListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BillListTableViewCell" forIndexPath:indexPath];
[cell configWithArray:self.arrSortedData indexPath:indexPath];
return cell;
}
- (void)listDidSelect:(id)model {
}
- (void)configData {
[self.arrSortedData removeAllObjects];
[self.arrSortedMonths removeAllObjects];
//先把整体倒序排序一遍
NSArray *tempSortData = [self.arrData sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
StationUserAcctHisEntity *a = (StationUserAcctHisEntity *)obj1;
StationUserAcctHisEntity *b = (StationUserAcctHisEntity *)obj2;
return [a.createDate compare:b.createDate];
}];
NSArray *months = self.dicMonthData.allKeys;
NSArray *sortMonths = [months sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
return [obj2 compare:obj1];
}];
NSInteger count = sortMonths.count;
for (NSInteger i = 0; i < count; i++) {
NSDecimalNumber *monthTotal = [CalculateHelper decimalNumber:0];
NSMutableArray *array = [NSMutableArray array];
for (StationUserAcctHisEntity *model in tempSortData) {
NSString *timeStr = [model.createDate substringToIndex:7];
if ([timeStr isEqualToString:sortMonths[i]]) {
CLog(@"%@", model.createDate);
monthTotal = [CalculateHelper add:monthTotal num2:model.occur];
[array addObject:model];
}
}
BillHeaderModel *headerModel = [[BillHeaderModel alloc] init];
headerModel.date = sortMonths[i];
headerModel.total = [CalculateHelper moneyStringWithPrefix:monthTotal];
[self.arrSortedMonths addObject:headerModel];
[self.arrSortedData addObject:array];
}
}
#pragma mark - lazy
- (NSMutableDictionary *)dicMonthData {
if (!_dicMonthData) {
_dicMonthData = [NSMutableDictionary dictionary];
}
return _dicMonthData;
}
- (NSMutableArray *)arrSortedData {
if (!_arrSortedData) {
_arrSortedData = [NSMutableArray array];
}
return _arrSortedData;
}
- (NSMutableArray *)arrSortedMonths {
if (!_arrSortedMonths) {
_arrSortedMonths = [NSMutableArray array];
}
return _arrSortedMonths;
}
- (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
//
// CardViewController.h
// Car
//
// Created by Javen on 2016/12/28.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BaseViewController.h"
@interface CardViewController : BaseViewController
@property (strong, nonatomic) NSString *cardNumber;
@end
//
// CardViewController.m
// Car
//
// Created by Javen on 2016/12/28.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "CardViewController.h"
#import "HttpCilent.h"
#import "CardView.h"
#import "CardModel.h"
@interface CardViewController ()
@property(weak, nonatomic) IBOutlet UITextField *textFieldCardNumber;
@property(weak, nonatomic) IBOutlet CardView *cardView;
@property(weak, nonatomic) IBOutlet UIImageView *imgNoCardBg;
@property(weak, nonatomic) IBOutlet UILabel *labelFindCard;
@property(weak, nonatomic) IBOutlet UIButton *btnConfirm;
@property (strong, nonatomic) CardModel *card;
@end
@implementation CardViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self configUI];
[self noCard];
if (self.cardNumber) {
self.textFieldCardNumber.text = self.cardNumber;
[self httpCardWithNumber:self.cardNumber];
}
}
- (void)noCard {
self.cardView.hidden = YES;
self.labelFindCard.hidden = YES;
self.imgNoCardBg.hidden = NO;
self.btnConfirm.hidden = YES;
}
- (void)findCard {
self.cardView.hidden = NO;
self.labelFindCard.hidden = NO;
self.imgNoCardBg.hidden = YES;
self.btnConfirm.hidden = NO;
}
- (void)configUIWithCard {
[self findCard];
self.cardView.model = self.card;
if ([self.card.state isEqualToString:@"used"]) {
self.btnConfirm.enabled = NO;
}
}
- (void)configUI {
self.title = @"核销卡券";
UIBarButtonItem *rightBtn =
[[UIBarButtonItem alloc] initWithTitle:@"确认查询"
style:UIBarButtonItemStyleDone
target:self
action:@selector(actionCard)];
self.navigationItem.rightBarButtonItem = rightBtn;
}
- (void)httpCardWithNumber:(NSString *)number {
NSString *url = kStrPrefix(number, kGetTicketUrl);
[MBProgressHUD j_loading:@"查询中…"];
WS(weakSelf);
[kHttp GET:url
parameters:nil
complete:^(id _Nullable response, NSError *_Nullable error) {
[MBProgressHUD j_hideLoadingView];
if (kRsSuccess(response)) {
weakSelf.card = [[CardModel alloc] initWithDictionary:response[@"data"] error:nil];
[weakSelf configUIWithCard];
} else {
kShowRsMsg(response);
}
}];
}
- (void)actionCard {
HIDE_KEYBOARD;
kCanNotBeNil(self.textFieldCardNumber.text, @"卡券号不能为空!");
[self httpCardWithNumber:self.textFieldCardNumber.text];
}
/*
扫描二维码
*/
- (IBAction)actionScan:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
/**
确认销券
*/
- (IBAction)actionOffset:(id)sender {
WS(weakSelf);
[self alertTitle:@"确认销券?" msg:nil okAction:^(UIAlertAction * _Nullable action) {
[weakSelf httpCheckCard];
} cancelAction:nil];
}
/**
销券
*/
- (void)httpCheckCard {
CheckTicketRequest *param = [[CheckTicketRequest alloc] init];
[MBProgressHUD j_loading];
param.checkDate = [[NSDate date] httpParameterString];
param.checkManId = kUser.fid;
param.checkManName = kUser.realName;
param.ticketNumber = self.card.ticketNumber;
[kHttp POST:kCheckTicketUrl parameters:[param toDictionary] complete:^(id _Nullable response, NSError * _Nullable error) {
[MBProgressHUD j_hideLoadingView];
if (kRsSuccess(response)) {
[MBProgressHUD j_textOnly:@"销券成功!"];
}else{
kShowRsMsg(response);
}
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
......@@ -7,8 +7,16 @@
//
#import "LeftTableViewController.h"
#import "HttpCilent.h"
#import "ModifyPswTableViewController.h"
#import "BillListViewController.h"
#import "ScanViewController.h"
#import <AudioToolbox/AudioToolbox.h>
@interface LeftTableViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imgUserIcon;
@property (weak, nonatomic) IBOutlet UILabel *labelName;
@property (weak, nonatomic) IBOutlet UILabel *labelScore;
@property (strong, nonatomic) StationUserAcctEntity *acct;
@end
......@@ -16,25 +24,80 @@
- (void)viewDidLoad {
[super viewDidLoad];
//设置文字和图标的颜色
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self httpRequest];
}
- (void)httpRequest {
NSDictionary *param = @{@"userId":kUser.fid};
WS(weakSelf);
[kHttp GET:kAccountGetUrl parameters:param complete:^(id _Nullable response, NSError * _Nullable error) {
if (kRsSuccess(response)) {
weakSelf.acct = [[StationUserAcctEntity alloc] initWithDictionary:response[@"data"] error:nil];
[weakSelf configUIWithAcct];
}
}];
}
- (void)configUIWithAcct {
self.labelName.text = kUser.realName;
self.labelScore.text = [self.acct.balance stringValue];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[kGlobal.sideSlipVC showMainView];
if (indexPath.row == 0) {//流水账单
}else if (indexPath.row == 1) {//金额提现
if (indexPath.row == 0) {//工分账单
BillListViewController *billVC = [BillListViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN];
[kGlobal.mainNaVC pushViewController:billVC animated:YES];
}else if (indexPath.row == 1) {//账户
[MBProgressHUD j_textOnly:@"正在开发中~"];
}else if (indexPath.row == 2) {//核销卡券
[self scanView];
}else if (indexPath.row == 3) {//修改密码
ModifyPswTableViewController *modifyVC = [ModifyPswTableViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN];
[kGlobal.mainNaVC pushViewController:modifyVC animated:YES];
}else if (indexPath.row == 4) {//退出登录
[kGlobal.sideSlipVC dismissViewControllerAnimated:YES completion:nil];
}
}
- (void)scanView {
//设置扫码区域参数
LBXScanViewStyle *style = [[LBXScanViewStyle alloc]init];
style.centerUpOffset = 44;
style.photoframeAngleStyle = LBXScanViewPhotoframeAngleStyle_Inner;
style.photoframeLineW = 2;
style.photoframeAngleW = 18;
style.photoframeAngleH = 18;
style.isNeedShowRetangle = YES;
style.anmiationStyle = LBXScanViewAnimationStyle_LineMove;
style.colorAngle = [UIColor colorWithRed:0./255 green:200./255. blue:20./255. alpha:1.0];
//qq里面的线条图片
UIImage *imgLine = [UIImage imageNamed:@"CodeScan.bundle/qrcode_Scan_weixin_Line"];
// imgLine = [self createImageWithColor:[UIColor colorWithRed:120/255. green:221/255. blue:71/255. alpha:1.0]];
style.animationImage = imgLine;
ScanViewController *vc = [ScanViewController new];
vc.style = style;
//vc.isOpenInterestRect = YES;
[kGlobal.mainNaVC pushViewController:vc animated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......@@ -42,7 +105,7 @@
/*
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:; forIndexPath:indexPath];
// Configure the cell...
......
//
// ScanViewController.h
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "LBXScanViewController.h"
@interface ScanViewController : LBXScanViewController
@end
//
// ScanViewController.m
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "ScanViewController.h"
#import "CardViewController.h"
@interface ScanViewController ()
@property (strong, nonatomic) UIButton *btnGoInput;
@end
@implementation ScanViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"条形码";
// Do any additional setup after loading the view.
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self btnGoInput];
}
- (UIButton *)btnGoInput {
if (!_btnGoInput) {
_btnGoInput = [UIButton buttonWithType:UIButtonTypeCustom];
_btnGoInput.frame = CGRectMake(0, kHeight - 200, 120, 48);
_btnGoInput.backgroundColor = [UIColor grayColor];
[_btnGoInput setTitle:@"手工输入" forState:UIControlStateNormal];
[_btnGoInput setTitleColor:[UIColor colorWithRed:0.89 green:0.44 blue:0.23 alpha:1.00] forState:UIControlStateNormal];
_btnGoInput.layer.cornerRadius = 24;
_btnGoInput.centerX = self.view.centerX;
[_btnGoInput addTarget:self action:@selector(actionGoInput) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_btnGoInput];
}
return _btnGoInput;
}
/**
跳转到手工输入界面
*/
- (void)actionGoInput {
[self goCardVCWithNumber:nil];
}
- (void)goCardVCWithNumber:(NSString *)number {
CardViewController *cardVC = [CardViewController viewControllerWithStoryBoardType:STORYBOARD_TYPE_MAIN];
cardVC.cardNumber = number;
[kGlobal.mainNaVC pushViewController:cardVC animated:YES];
}
#pragma mark -实现类继承该方法,作出对应处理
- (void)scanResultWithArray:(NSArray<LBXScanResult *> *)array {
if (array.count < 1) {
return;
}
//经测试,可以同时识别2个二维码,不能同时识别二维码和条形码
for (LBXScanResult *result in array) {
NSLog(@"scanResult:%@", result.strScanned);
}
LBXScanResult *scanResult = array[0];
NSString *strResult = scanResult.strScanned;
self.scanImage = scanResult.imgScanned;
if (!strResult) {
return;
}
//震动提醒
[LBXScanWrapper systemVibrate];
//声音提醒
[LBXScanWrapper systemSound];
[self goCardVCWithNumber:strResult];
}
- (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
//
// BillListTableViewCell.h
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BillListTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
@property (weak, nonatomic) IBOutlet UILabel *labelDate;
@property (weak, nonatomic) IBOutlet UILabel *labelReduct;
- (void)configWithArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath;
@end
//
// BillListTableViewCell.m
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BillListTableViewCell.h"
@implementation BillListTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)configWithArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath {
StationUserAcctHisEntity *model = array[indexPath.section][indexPath.row];
self.labelDate.text = model.createDate;
self.labelReduct.text = [CalculateHelper moneyStringWithPrefix:model.occur];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// CardView.h
// Car
//
// Created by Javen on 2016/12/28.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CardModel.h"
@interface CardView : UIView
@property (weak, nonatomic) IBOutlet UIImageView *imgBg;
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
@property (weak, nonatomic) IBOutlet UILabel *labelPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelCondition;
@property (weak, nonatomic) IBOutlet UIImageView *imgState;
@property (weak, nonatomic) IBOutlet UILabel *labelDuration;
@property (weak, nonatomic) IBOutlet UILabel *labelCardNumber;
@property (strong, nonatomic) CardModel *model;
@end
//
// CardView.m
// Car
//
// Created by Javen on 2016/12/28.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "CardView.h"
#import "CalculateHelper.h"
@implementation CardView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (void)setModel:(CardModel *)model {
_model = model;
self.labelTitle.text = model.name;
self.labelPrice.text = [model.total stringValue];
self.labelDuration.text = [NSString stringWithFormat:@"%@~%@",[model.startDate substringToIndex:11],[model.endDate substringToIndex:11]];
self.labelCondition.text = model.remak;
self.labelCardNumber.text = kStrPrefix(model.ticketNumber, @"券号:");
if ([model.state isEqualToString:@"used"]) {
[self used];
}else{
[self unUse];
}
}
- (void)unUse {
self.imgBg.image = [UIImage imageNamed:@"orange_card_bg"];
self.imgState.hidden = YES;
}
- (void)used {
self.imgBg.image = [UIImage imageNamed:@"gray_card_bg"];
self.imgState.hidden = NO;
}
@end
//
// GuideViewController.h
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "BaseViewController.h"
@interface GuideViewController : BaseViewController
@end
//
// GuideViewController.m
// Car
//
// Created by Javen on 2016/12/27.
// Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//
#import "GuideViewController.h"
@interface GuideViewController ()<UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIButton *btnSkip;
@property (weak, nonatomic) IBOutlet UIButton *btnOpen;
@end
@implementation GuideViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.btnOpen.hidden = YES;
}
- (IBAction)actionSkip:(id)sender {
kGlobal.isNoFirst = YES;
UINavigationController *loginNaVC = [self storyboardType:STORYBOARD_TYPE_MAIN identifier:@"LoginNavigationViewController"];
[self presentViewController:loginNaVC animated:YES completion:nil];
}
- (IBAction)actionOpen:(id)sender {
kGlobal.isNoFirst = YES;
UINavigationController *loginNaVC = [self storyboardType:STORYBOARD_TYPE_MAIN identifier:@"LoginNavigationViewController"];
[self presentViewController:loginNaVC animated:YES completion:nil];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
NSInteger index = scrollView.contentOffset.x / kWidth;
if (index == 2) {
self.btnOpen.hidden = NO;
}else{
self.btnOpen.hidden = 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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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