Commit d711926b by 刘卓鑫

提交多彩洗衣代码

parent 73552bc3
......@@ -3,4 +3,17 @@
uuid = "C4FA1D40-0820-4DB8-948B-CEB11FFE9947"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "3E6B07A2-DF06-4544-AD09-D2200F31F394"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
scope = "1"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
//
//
......@@ -512,10 +512,15 @@
if ([[UIApplication sharedApplication] canOpenURL:URL]) {
[[UIApplication sharedApplication] openURL:URL];
} else {
ZXBannerJumpViewController *jumpVc = [[ZXBannerJumpViewController alloc] init];
jumpVc.jumpUrl = [@"https:" stringByAppendingString:item.coupon_share_url];
jumpVc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:jumpVc animated:YES];
if (jumpUrl && ![jumpUrl isEqualToString:@""]) {
ZXBannerJumpViewController *jumpVc = [[ZXBannerJumpViewController alloc] init];
jumpVc.jumpUrl = jumpUrl;
jumpVc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:jumpVc animated:YES];
} else {
[ZXTool showText:@"活动已下架,请关注后续活动!"];
}
}
});
return;
......
//
//
// ZXLocationViewController.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/21.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DC_ZXLocationViewController : UIViewController
@end
//
//
// ZXWashCloseViewController.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/19.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DC_ZXWashCloseViewController : UIViewController
@end
//
//
// ZXWashOperationViewController.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashOperationModel.h"
@interface DC_ZXWashOperationViewController : UIViewController
@property (nonatomic, strong) DC_ZXWashOperationModel *model;
@end
//
//
// ZXWashOrderDetailViewController.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/25.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashOrderModel.h"
@interface DC_ZXWashOrderDetailViewController : UIViewController
///** 蓝牙模式 0:无蓝牙;1:纯蓝牙;2:蓝牙+其他 */
@property (nonatomic, assign) NSInteger bluetoothMode;
@property (nonatomic, strong) DC_ZXWashOrderModel *order;
@end
//
//
// ZXWashRecordViewController.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/21.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DC_ZXWashRecordViewController : UIViewController
@end
//
//
// ZXWashRecordViewController.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/21.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashRecordViewController.h"
#import "DC_ZXWashMyInvitorCell.h"
#import "DC_ZXWashService.h"
#import "DC_ZXWashOrderListModel.h"
#import "enlargeClickRegionBtn.h"
@interface DC_ZXWashRecordViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *myTableview;
@property (nonatomic, strong) DC_ZXWashService *washService;
@property (nonatomic, strong) enlargeClickRegionBtn *goTop;
@end
@implementation DC_ZXWashRecordViewController
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear: animated];
self.tabBarController.tabBar.hidden = NO;
if (@available(iOS 11, *)) {
[UIScrollView appearance].contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; //iOS11 解决SafeArea的问题,同时能解决pop时上级页面scrollView抖动的问题
}
}
- (void)viewDidLoad {
[super viewDidLoad];
[self createNabar];
self.washService = [[DC_ZXWashService alloc] init];
[self loadNewData];//加载最新数据
}
#pragma mark - ========== 创建导航栏 ==========
- (void) createNabar {
UIImageView *nabar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kTopHeight)];
nabar.backgroundColor = [UIColor whiteColor];
nabar.userInteractionEnabled = YES;
nabar.image = kToppicBgImage;
[self.view addSubview:nabar];
UILabel *naTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, kScreenWidth, kNavBarHeight)];
naTitle.backgroundColor = [UIColor clearColor];
naTitle.textAlignment = NSTextAlignmentCenter;
naTitle.textColor = [UIColor whiteColor];
naTitle.font = [UIFont boldSystemFontOfSize:17 * k6Scale];
naTitle.userInteractionEnabled = YES;
[nabar addSubview:naTitle];
naTitle.text = @"预约记录";
enlargeClickRegionBtn *back = [[enlargeClickRegionBtn alloc] init];
[back setImage:[UIImage imageNamed:@"nav_return"] forState:UIControlStateNormal];
[naTitle addSubview:back];
[back mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(naTitle.mas_left).offset(5 * k6Scale);
make.width.height.mas_equalTo(30 * k6Scale);
make.centerY.equalTo(naTitle);
}];
@weakify(self);
[[back rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
[self.navigationController popViewControllerAnimated:YES];
[self.parentViewController.childViewControllers[0] removeFromParentViewController];
[self.parentViewController.childViewControllers[1] removeFromParentViewController];
[self.parentViewController.childViewControllers[2] removeFromParentViewController];
}];
CGFloat bottomMargin = 0;
if (iPhoneX) {
bottomMargin = 34;
}
self.myTableview = [[UITableView alloc] initWithFrame:CGRectMake(0, kTopHeight , kScreenWidth, kScreenHeight - kTopHeight - 49 - bottomMargin) style:UITableViewStylePlain];
[self.view addSubview:self.myTableview];
self.myTableview.delegate = self;
self.myTableview.dataSource = self;
self.myTableview.separatorStyle = UITableViewCellSeparatorStyleNone;
self.myTableview.backgroundColor = RGB(237, 237, 237);
if (@available(iOS 11.0, *)) {
self.myTableview.estimatedRowHeight = 0;
self.myTableview.estimatedSectionFooterHeight = 0;
self.myTableview.estimatedSectionHeaderHeight = 0;
self.myTableview.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
//下拉刷新
self.myTableview.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
//上拉加载
self.myTableview.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)]; self.myTableview.showsVerticalScrollIndicator = NO;
//添加到顶部按钮
self.goTop = [[enlargeClickRegionBtn alloc] init];
[self.view addSubview:self.goTop];
[self.goTop setBackgroundImage:[UIImage imageNamed:@"wash-up"] forState:UIControlStateNormal];
CGFloat bottom = 0;
if (iPhoneX) {
bottom = 34;
}
[self.goTop mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.view.mas_bottom).offset(-(bottom + 49 + 30 * k6Scale));
make.right.equalTo(self.view.mas_right).offset(-30 * k6Scale);
make.width.height.mas_equalTo(40 * k6Scale);
}];
[[self.goTop rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
[self.myTableview setContentOffset:CGPointMake(0, 0) animated:YES];
}];
self.goTop.hidden = YES;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
self.goTop.hidden = scrollView.contentOffset.y <= 0;
}
#pragma mark - ========== 下拉刷新 上拉加载 ==========
- (void) loadNewData {
@weakify(self);
[self.washService loadWashRecordListWithIsNewData:YES completedBlock:^(BOOL isNeedReload) {
@strongify(self);
[ZXTool hideLoadingAnimation];
[self.myTableview.mj_header endRefreshing];
if (isNeedReload) {
[self.myTableview.mj_footer endRefreshing];
[self.myTableview reloadData];
} else {
[self.myTableview.mj_footer endRefreshingWithNoMoreData];
}
}];
}
- (void) loadMoreData {
@weakify(self);
[self.washService loadWashRecordListWithIsNewData:NO completedBlock:^(BOOL isNeedReload) {
@strongify(self);
[ZXTool hideLoadingAnimation];
[self.myTableview.mj_header endRefreshing];
if (isNeedReload) {
[self.myTableview.mj_footer endRefreshing];
[self.myTableview reloadData];
} else {
[self.myTableview.mj_footer endRefreshingWithNoMoreData];
}
}];
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.washService.myInvitorList.count;
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
DC_ZXWashMyInvitorCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DC_ZXWashMyInvitorCell"];
if (cell == nil) {
cell = [[DC_ZXWashMyInvitorCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DC_ZXReChooseCell"];
}
DC_ZXWashOrderListModel *model = self.washService.myInvitorList[indexPath.row];
cell.model = model;
return cell;
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return ((kScreenWidth - 24 * k6Scale) * 0.64) + 10 * k6Scale;
}
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
//
//
// ZXWashTabbarViewController.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/21.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DC_ZXWashTabbarViewController : UITabBarController
@end
//
//
// ZXWashTabbarViewController.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/21.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashTabbarViewController.h"
#import "DC_ZXWashCloseViewController.h"
#import "DC_ZXWashRecordViewController.h"
#import "DC_ZXLocationViewController.h"
@interface DC_ZXWashTabbarViewController ()
@end
@implementation DC_ZXWashTabbarViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.tabBarController.tabBar.hidden = YES;
self.tabBar.hidden = NO;
self.tabBar.backgroundColor = [UIColor whiteColor];
DC_ZXWashCloseViewController *washVc = [[DC_ZXWashCloseViewController alloc] init];
DC_ZXLocationViewController *locationVC = [[DC_ZXLocationViewController alloc] init];
DC_ZXWashRecordViewController *recordVC = [[DC_ZXWashRecordViewController alloc] init];
[self addChildViewController:washVc];
[self addChildViewController:locationVC];
[self addChildViewController:recordVC];
washVc.tabBarItem.title = @"洗衣";
washVc.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab_laundry_check"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
washVc.tabBarItem.image = [UIImage imageNamed:@"tab_laundry_default"];
locationVC.tabBarItem.title = @"常用位置";
locationVC.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab_position_check"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
locationVC.tabBarItem.image = [UIImage imageNamed:@"tab_position_default"];
recordVC.tabBarItem.title = @"洗衣记录";
recordVC.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab_Laundryrecord_check"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
recordVC.tabBarItem.image = [UIImage imageNamed:@"tab_Laundryrecord_default"];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:kRGB(51, 51, 51), NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 1)];
line.backgroundColor = RGB(243, 243, 243);
[self.tabBar addSubview:line];
// self.tabBar.layer.shadowColor = [UIColor colorWithHexString:@"#FF0000"].CGColor;
// // 设置阴影偏移量
// self.tabBar.layer.shadowOffset = CGSizeMake(0,3 * k6Scale);
// // 设置阴影透明度
// self.tabBar.layer.shadowOpacity = 0.2;
// // 设置阴影半径
// self.tabBar.layer.shadowRadius = 4 * k6Scale;
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:kRGB(238, 125, 31),NSForegroundColorAttributeName, nil]forState:UIControlStateSelected];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
//
//
// ZXPreOrderModel.h
// ColorfulSchool
//
// Created by liuZX on 2018/7/4.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
// 预约订单模型
#import "JKDBModel.h"
@interface DC_ZXPreOrderModel : JKDBModel
/** 蓝牙模式 0:无蓝牙;1:纯蓝牙;2:蓝牙+其他 */
@property (nonatomic, assign) NSInteger bluetoothMode;
/** 设备号 */
@property (nonatomic, copy) NSString *deviceCode;
/** 设备名称 */
@property (nonatomic, copy) NSString *deviceName;
/** 预约失效时间 */
@property (nonatomic, copy) NSString *endDate;
/** 订单金额 */
@property (nonatomic, assign) CGFloat money;
/** 订单编号 */
@property (nonatomic, copy) NSString *orderCode;
/** 设备位置 */
@property (nonatomic, copy) NSString *position;
/** 预约的功能服务 */
@property (nonatomic, strong) NSArray *services;
/** 预约开始时间 */
@property (nonatomic, copy) NSString *startDate;
/** 订单状态 0:预约中;1:已使用;2:预约超期 */
@property (nonatomic, assign) NSInteger status;
@end
@interface DC_ZXPreOrder_ServiceModel : JKDBModel
/** 订单号 */
@property (nonatomic, copy) NSString *orderCode;
/** 功能程序洗涤时长,单位:分钟 */
@property (nonatomic, assign) NSInteger duration;
/** 功能服务id */
@property (nonatomic, assign) NSInteger id;
/** modelServiceConfigId */
@property (nonatomic, assign) NSInteger modelServiceConfigId;
/** 功能服务名称 */
@property (nonatomic, copy) NSString *name;
/** 功能服务价格 */
@property (nonatomic, assign) CGFloat price;
@end
//
//
// ZXPreOrderModel.m
// ColorfulSchool
//
// Created by liuZX on 2018/7/4.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXPreOrderModel.h"
@implementation DC_ZXPreOrderModel
/* 数组中存储模型数据,需要说明数组中存储的模型数据类型 */
+(NSDictionary *)mj_objectClassInArray
{
return @{@"services" : @"DC_ZXPreOrder_ServiceModel"};
}
@end
@implementation DC_ZXPreOrder_ServiceModel
@end
//
//
// ZXWashLocationModel.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/29.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "JKDBModel.h"
@interface DC_ZXWashLocationModel : JKDBModel
@property (nonatomic, copy) NSString *id;
@property (nonatomic, copy) NSString *name;
//文字高度
@property (nonatomic, assign) CGFloat contentH;
@end
//
// ZXWashLocationModel.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/29.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashLocationModel.h"
@implementation DC_ZXWashLocationModel
@end
//
//
// ZXWashMerthinModel.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/28.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "JKDBModel.h"
@interface DC_ZXWashMerthinModel : JKDBModel
//设备号
@property (nonatomic, copy) NSString *deviceCode;
//蓝牙模式 0:无蓝牙;1:纯蓝牙;2:蓝牙+其他
@property (nonatomic, assign) NSInteger bluetoothMode;
/** 设备名称 */
@property (nonatomic, copy) NSString *deviceName;
//是否运行中
@property (nonatomic, assign) NSInteger isRunning;
/** 位置 */
@property (nonatomic, copy) NSString *position;
@end
//
//
// ZXWashMerthinModel.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/28.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashMerthinModel.h"
@implementation DC_ZXWashMerthinModel
@end
//
//
// ZXWashOperationModel.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/29.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "JKDBModel.h"
@interface DC_washPayWay : NSObject
/** 是否为第三方支付类型,默认:1-是 */
@property (nonatomic, assign) NSInteger partyPayment;
/** 支付方式ID */
@property (nonatomic, assign) NSInteger paymentWayId;
/** 支付方式名称 */
@property (nonatomic, copy) NSString *paymentWayName;
//是否选中
@property (nonatomic, assign) BOOL isSelect;
@end
@interface DC_requiredPrograms : NSObject
/** 功能程序洗涤时长,单位:分钟 */
@property (nonatomic, assign) NSInteger duration;
/** 功能服务id */
@property (nonatomic, assign) NSInteger id;
/** modelServiceConfigId */
@property (nonatomic, assign) NSInteger modelServiceConfigId;
/** 功能服务名称 */
@property (nonatomic, copy) NSString *name;
/** 功能服务价格 */
@property (nonatomic, assign) CGFloat price;
//是否选中
@property (nonatomic, assign) BOOL isSelect;
@end
@interface DC_optionalPrograms : NSObject
/** 功能程序洗涤时长,单位:分钟 */
@property (nonatomic, assign) NSInteger duration;
/** 功能服务id */
@property (nonatomic, assign) NSInteger id;
/** modelServiceConfigId */
@property (nonatomic, assign) NSInteger modelServiceConfigId;
/** 功能服务名称 */
@property (nonatomic, copy) NSString *name;
/** 功能服务价格 */
@property (nonatomic, assign) CGFloat price;
//是否选中
@property (nonatomic, assign) BOOL isSelect;
@end
@interface DC_ZXWashOperationModel : JKDBModel
/** 蓝牙模式 0:无蓝牙;1:纯蓝牙;2:蓝牙+其他 */
@property (nonatomic, assign) NSInteger bluetoothMode;
/** 设备号 */
@property (nonatomic, copy) NSString *deviceCode;
/** 设备名称 */
@property (nonatomic, copy) NSString *deviceName;
/** 是否开启预约功能 */
@property (nonatomic, assign) BOOL enabledAppoint;
/** 设备位置 */
@property (nonatomic, copy) NSString *position;
@property (nonatomic, strong) NSArray *optionalPrograms;
//系统支付
@property (nonatomic, strong) NSArray *paymentWaysInner;
//第三方支付
@property (nonatomic, strong) NSArray *paymentWaysOuter;
@property (nonatomic, strong) NSArray *requiredPrograms;
@end
//
//
// ZXWashOperationModel.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/29.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashOperationModel.h"
@implementation DC_washPayWay
@end
@implementation DC_requiredPrograms
@end
@implementation DC_optionalPrograms
@end
@implementation DC_ZXWashOperationModel
/* 数组中存储模型数据,需要说明数组中存储的模型数据类型 */
+(NSDictionary *)mj_objectClassInArray
{
return @{@"optionalPrograms" : @"DC_optionalPrograms", @"paymentWaysInner" : @"DC_washPayWay", @"paymentWaysOuter" : @"DC_washPayWay",@"requiredPrograms" : @"DC_requiredPrograms"};
}
@end
//
//
// ZXWashOrderListModel.h
// ColorfulSchool
//
// Created by liuZX on 2018/7/4.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "JKDBModel.h"
@interface DC_ZXWashOrderListModel : JKDBModel
/** 蓝牙模式 0:无蓝牙;1:纯蓝牙;2:蓝牙+其他 */
@property (nonatomic, assign) NSInteger bluetoothMode;
/** 设备号 */
@property (nonatomic, copy) NSString *deviceCode;
/** 设备名称 */
@property (nonatomic, copy) NSString *deviceName;
/** 预约失效时间 */
@property (nonatomic, copy) NSString *endDate;
/** 订单金额 */
@property (nonatomic, assign) CGFloat money;
/** 订单编号 */
@property (nonatomic, copy) NSString *orderCode;
/** 设备位置 */
@property (nonatomic, copy) NSString *position;
/** 预约的功能服务 */
@property (nonatomic, strong) NSArray *services;
/** 订单状态 0:预约中;1:已使用;2:预约超期 */
@property (nonatomic, assign) NSInteger status;
/** 预约开始时间 */
@property (nonatomic, copy) NSString *startDate;
@end
@interface DC_ZXWashOrderList_ServiceModel : JKDBModel
/** 功能程序洗涤时长,单位:分钟 */
@property (nonatomic, assign) NSInteger duration;
/** 功能服务id */
@property (nonatomic, assign) NSInteger op_id;
/** 功能服务名称 */
@property (nonatomic, copy) NSString *name;
/** 功能服务价格 */
@property (nonatomic, assign) CGFloat price;
@end
//
//
// ZXWashOrderListModel.m
// ColorfulSchool
//
// Created by liuZX on 2018/7/4.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashOrderListModel.h"
@implementation DC_ZXWashOrderListModel
/* 数组中存储模型数据,需要说明数组中存储的模型数据类型 */
+(NSDictionary *)mj_objectClassInArray
{
return @{@"services" : @"DC_ZXWashOrderList_ServiceModel"};
}
@end
@implementation DC_ZXWashOrderList_ServiceModel
@end
//
//
// ZXWashOrderModel.h
// ColorfulSchool
//
// Created by liuZX on 2018/7/4.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "JKDBModel.h"
@interface DC_ZXWashOrderModel : JKDBModel
/** 超时时间,单位分钟 */
@property (nonatomic, assign) NSInteger appointmentTimeout;
/** 设备号 */
@property (nonatomic, copy) NSString *deviceCode;
/** 设备名称 */
@property (nonatomic, copy) NSString *deviceName;
/** 总金额,最多2位小数 */
@property (nonatomic, assign) CGFloat money;
/** 订单编号 */
@property (nonatomic, copy) NSString *orderCode;
/** 订单类型,1即时订单,2预约订单 */
@property (nonatomic, assign) NSInteger orderType;
/** 支付超时时间,单位秒 */
@property (nonatomic, assign) NSInteger payTimeout;
/** 支付方式ID */
@property (nonatomic, assign) NSInteger paymentWayId;
/** 设备位置 */
@property (nonatomic, copy) NSString *position;
/** 消费的服务类型ID */
@property (nonatomic, assign) NSInteger serviceId;
/** 支付的功能服务 */
@property (nonatomic, strong) NSArray *services;
@end
@interface DC_ZXWashOrder_ServiceModel : JKDBModel
/** 功能程序洗涤时长,单位:分钟 */
@property (nonatomic, assign) NSInteger duration;
/** 功能服务id */
@property (nonatomic, assign) NSInteger id;
/** 功能服务名称 */
@property (nonatomic, copy) NSString *name;
/** 功能服务价格 */
@property (nonatomic, assign) CGFloat price;
@end
//
//
// ZXWashOrderModel.m
// ColorfulSchool
//
// Created by liuZX on 2018/7/4.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashOrderModel.h"
@implementation DC_ZXWashOrderModel
/* 数组中存储模型数据,需要说明数组中存储的模型数据类型 */
+(NSDictionary *)mj_objectClassInArray
{
return @{@"services" : @"DC_ZXWashOrder_ServiceModel"};
}
@end
@implementation DC_ZXWashOrder_ServiceModel
@end
//
//
// AppointView.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/27.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXPreOrderModel.h"
@interface DC_AppointView : UIView
- (instancetype) initWithFrame:(CGRect)frame preOrder:(DC_ZXPreOrderModel *) preOrder;
@end
//
//
// CountingDownView.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DC_CountingDownView : UIView
//回调是否显示 如果不需要显示 才回调
- (void) createTimerWithTimeIntervel:(long long) intervel isShowBlock:(dispatch_block_t) show;
@end
//
//
// CountingDownView.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_CountingDownView.h"
@interface DC_CountingDownView()
@property (nonatomic, strong) dispatch_source_t timer;
@property (nonatomic, strong) UILabel *countingLabel;
@end
@implementation DC_CountingDownView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.countingLabel = [[UILabel alloc] init];
self.countingLabel.textColor = RGB(210, 0, 16);
self.countingLabel.font = kFontSize(15 * k6Scale);
[self addSubview:self.countingLabel];
[self.countingLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self).offset(3 * k6Scale);
make.left.equalTo(self.mas_left);
}];
}
return self;
}
/**
* 倒计时
*
* @param endTime 截止的时间戳
*
* @return 返回的剩余时间
*/
- (NSString*)remainingTimeMethodAction:(long long)endTime isShowBlock:(dispatch_block_t) show
{
//得到当前时间
NSDate *nowData = [NSDate date];
NSDate *endData=[NSDate dateWithTimeIntervalSince1970:endTime];
NSCalendar* chineseClendar = [ [ NSCalendar alloc ] initWithCalendarIdentifier:NSGregorianCalendar];
NSUInteger unitFlags =
NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit | NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit;
NSDateComponents *cps = [chineseClendar components:unitFlags fromDate:nowData toDate: endData options:0];
NSInteger Hour = [cps hour];
NSInteger Min = [cps minute];
NSInteger Sec = [cps second];
NSInteger Day = [cps day];
NSInteger lessMin = Day * 24 + Hour * 60 + Min;
NSString *countdown;
if (lessMin) {
countdown = [NSString stringWithFormat:@"*请在%zi秒内完成支付", (lessMin * 60 + Sec)];
} else {
countdown = [NSString stringWithFormat:@"*请在%zi秒内完成支付", (Sec)];
}
if (lessMin<1 && Sec<=0) {
//如果已经小于1了 说明已经结束
countdown = @"*已超时,请重新下单。";
show();
//此时关闭timer
dispatch_cancel(self.timer);
self.timer = nil;
}
return countdown;
}
//销毁定时器
- (void)destoryTimer {
if (self.timer) {
//此时关闭timer
dispatch_cancel(self.timer);
self.timer = nil;
}
}
- (void) createTimerWithTimeIntervel:(long long) intervel isShowBlock:(dispatch_block_t) show {
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
//马上启动:DISPATCH_TIME_NOW
dispatch_time_t start = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0*NSEC_PER_SEC));
uint64_t interval = (uint64_t)(1*NSEC_PER_SEC);
//设置启动时间和间隔
dispatch_source_set_timer(_timer, start, interval, 1);
@weakify(self);
dispatch_source_set_event_handler(_timer, ^{
@strongify(self);
NSString *text = [self remainingTimeMethodAction:intervel isShowBlock:show];
dispatch_async(dispatch_get_main_queue(), ^{
self.countingLabel.text = text;
});
});
//开启
dispatch_resume(_timer);
}
@end
//
//
// ShowMsgView.h
// ColorfulSchool
//
// Created by liuZX on 2018/7/6.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DC_ShowMsgView : UIView
- (instancetype)initWithFrame:(CGRect)frame msg:(NSString *) msg;
- (void) show;
@end
//
//
// ShowMsgView.m
// ColorfulSchool
//
// Created by liuZX on 2018/7/6.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ShowMsgView.h"
@implementation DC_ShowMsgView
- (instancetype)initWithFrame:(CGRect)frame msg:(NSString *) msg {
if (self= [super initWithFrame:frame]) {
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.2];
CGFloat bgH = 152 * k6Scale;
UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 270 * k6Scale, bgH)];
[self addSubview:bgView];
bgView.center = self.center;
bgView.backgroundColor = [UIColor whiteColor];
bgView.layer.cornerRadius = 15 * k6Scale;
bgView.layer.masksToBounds = YES;
UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, bgH - 45 * k6Scale, 270 * k6Scale, 1)];
line.backgroundColor = RGB(242, 242, 242);
[bgView addSubview:line];
UILabel *bottomLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, bgH - 44 * k6Scale, 270 * k6Scale, 44 * k6Scale)];
[bgView addSubview:bottomLabel];
bottomLabel.backgroundColor = [UIColor clearColor];
bottomLabel.textAlignment = NSTextAlignmentCenter;
bottomLabel.textColor = [UIColor colorWithHexString:@"#333333"];
bottomLabel.font = kFontSize(16 * k6Scale);
bottomLabel.text = @"确定";
bottomLabel.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
[bottomLabel addGestureRecognizer:tap];
__weak typeof(self) weakSelf = self;
[[tap rac_gestureSignal] subscribeNext:^(id x) {
[weakSelf removeFromSuperview];
weakSelf.hidden = YES;
}];
UIImageView *imageV = [[UIImageView alloc] init];
[bgView addSubview:imageV];
UIImage *III = [UIImage imageNamed:@"Projectileframe_bear"];
imageV.image = III;
[imageV mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(bgView.mas_left).offset(20 * k6Scale);
make.top.equalTo(bgView.mas_top).offset(30 * k6Scale);
make.bottom.equalTo(line.mas_top).offset(-15 * k6Scale);
make.width.equalTo(imageV.mas_height).multipliedBy(III.size.width / III.size.height);
}];
UILabel *msgLbel = [[UILabel alloc] init];
[bgView addSubview:msgLbel];
msgLbel.textColor = [UIColor colorWithHexString:@"#333333"];
msgLbel.font = kFontSize(14 * k6Scale);
msgLbel.text = msg;
msgLbel.numberOfLines = 0;
[msgLbel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(imageV.mas_right).offset(10 * k6Scale);
make.right.equalTo(bgView.mas_right).offset(-10 * k6Scale);
make.centerY.equalTo(imageV.mas_centerY);
}];
}
return self;
}
- (void) show {
[[UIApplication sharedApplication].keyWindow addSubview:self];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.hidden == NO) {
[self removeFromSuperview];
self.hidden = YES;
}
});
}
@end
//
//
// WashCLoseTableViewCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashMerthinModel.h"
@interface DC_WashCLoseTableViewCell : UITableViewCell
@property (nonatomic, strong) DC_ZXWashMerthinModel *model;
@end
//
//
// WashCLoseTableViewCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_WashCLoseTableViewCell.h"
#import "DC_CountingDownView.h"
@interface DC_WashCLoseTableViewCell()
@property (nonatomic, strong) UILabel *numberLabel;
@property (nonatomic, strong) UILabel *addressLabel;
@property (nonatomic, strong) UIImageView *menuImageView;
//@property (nonatomic, strong) CountingDownView *countingDownView;
@end
@implementation DC_WashCLoseTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
UIImageView *image1 = [[UIImageView alloc] init];
image1.image = [UIImage imageNamed:@"washer"];
UILabel *label1 = [[UILabel alloc] init];
label1.textColor = RGB(153, 153, 153);
label1.font = kFontSize(13 *k6Scale);
label1.text = @"设备编码";
UIImageView *image2 = [[UIImageView alloc] init];
image2.image = [UIImage imageNamed:@"place"];
UILabel *label2 = [[UILabel alloc] init];
label2.textColor = RGB(153, 153, 153);
label2.font = kFontSize(13 *k6Scale);
label2.text = @"设备位置";
// self.countingDownView = [[CountingDownView alloc] init];
self.numberLabel = [[UILabel alloc] init];
self.numberLabel.textColor = RGB(51, 51, 51);
self.numberLabel.font = kFontSize(15 *k6Scale);
self.addressLabel = [[UILabel alloc] init];
self.addressLabel.textColor = RGB(136, 136, 136);
self.addressLabel.numberOfLines = 0;
self.addressLabel.font = kFontSize(12 *k6Scale);
self.menuImageView = [[UIImageView alloc] init];
UIImageView *line = [[UIImageView alloc] init];
line.image = [UIImage imageNamed:@"wash-line"];
line.contentMode = UIViewContentModeScaleAspectFill;
line.clipsToBounds = YES;
[self.contentView addSubview:image1];
[self.contentView addSubview:image2];
[self.contentView addSubview:label1];
[self.contentView addSubview:label2];
[self.contentView addSubview:line];
[self.contentView addSubview:self.numberLabel];
[self.contentView addSubview:self.addressLabel];
[self.contentView addSubview:self.menuImageView];
// [self.contentView addSubview:self.countingDownView];
[image1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10 * k6Scale);
make.top.equalTo(self.contentView.mas_top).offset(10 * k6Scale);
make.width.height.mas_equalTo(12 * k6Scale);
}];
[image2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10 * k6Scale);
make.top.equalTo(image1.mas_bottom).offset(10 * k6Scale);
make.width.height.mas_equalTo(12 * k6Scale);
}];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(12 * k6Scale);
make.right.equalTo(self.contentView.mas_right).offset(-12 * k6Scale); make.bottom.equalTo(self.contentView.mas_bottom);
make.height.mas_equalTo(1);
}];
[label1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(image1.mas_right).offset(10 * k6Scale);
make.centerY.equalTo(image1.mas_centerY);
}];
[label2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(image2.mas_right).offset(10 * k6Scale);
make.centerY.equalTo(image2.mas_centerY);
}];
[self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(label1.mas_right).offset(13 * k6Scale);
make.centerY.equalTo(label1.mas_centerY);
}];
[self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(label2.mas_right).offset(13 * k6Scale);
make.centerY.equalTo(label2.mas_centerY).offset(1 * k6Scale);
}];
[self.menuImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-16 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
make.width.height.mas_equalTo(48 * k6Scale);
}];
// [self.countingDownView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.right.top.bottom.equalTo(self.contentView);
// make.width.mas_equalTo(84 * k6Scale);
// }];
}
return self;
}
- (void)setModel:(DC_ZXWashMerthinModel *)model {
_model = model;
self.numberLabel.text = model.deviceCode;
if (_model.isRunning) {
//显示使用中
self.menuImageView.image = [UIImage imageNamed:@"btn_inuse"];
} else {
self.menuImageView.image = [UIImage imageNamed:@"btn_go"];
}
self.addressLabel.text = _model.position;
}
@end
//
//
// WashSegHeader.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef enum : NSUInteger {
ZXWashHeaderChooseFree = 0 , //空闲
ZXWashHeaderChooseWillOver, //将要结束
ZXWashHeaderChooseDeal, //筛选
} ZXWashHeaderChooseType;
@protocol washHeaderChooseDelegate<NSObject>
- (void) chooseItemWithChooseType:(ZXWashHeaderChooseType) type;
@end
@interface DC_WashSegHeader : UITableViewHeaderFooterView
@property (nonatomic, weak) id<washHeaderChooseDelegate> delegate;
@end
//
//
// WashSegHeader.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_WashSegHeader.h"
@implementation DC_WashSegHeader
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
self.contentView.backgroundColor = [UIColor whiteColor];
UIButton *free = [[UIButton alloc] init];
free.titleLabel.font = kFontSize(16 * k6Scale);
[free setTitleColor:RGB(102, 102, 102) forState:UIControlStateNormal];
[free setTitleColor:RGB(238, 125, 31) forState:UIControlStateDisabled];
[free setTitle:@"空闲中" forState:UIControlStateNormal];
[self.contentView addSubview:free];
UIButton *willFree = [[UIButton alloc] init];
willFree.titleLabel.font = kFontSize(16 * k6Scale);
[willFree setTitleColor:RGB(102, 102, 102) forState:UIControlStateNormal];
[willFree setTitleColor:RGB(238, 125, 31) forState:UIControlStateDisabled];
[willFree setTitle:@"将结束" forState:UIControlStateNormal];
[self.contentView addSubview:willFree];
//筛选
UIButton *choose = [[UIButton alloc] init];
choose.titleLabel.font = kFontSize(13 * k6Scale);
[choose setTitleColor:RGB(102, 102, 102) forState:UIControlStateNormal];
[choose setTitleColor:RGB(238, 125, 31) forState:UIControlStateDisabled];
[choose setTitle:@"位置筛选" forState:UIControlStateNormal];
[self.contentView addSubview:choose];
[free mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(10 * k6Scale);
make.top.bottom.equalTo(self.contentView);
make.width.mas_equalTo(55 * k6Scale);
}];
UIView *line = [UIView new];
[self.contentView addSubview:line];
line.backgroundColor = RGB(242, 242, 242);
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(free.mas_right).offset(10 * k6Scale);
make.centerY.equalTo(free.mas_centerY);
make.height.mas_equalTo(20 * k6Scale);
make.width.mas_equalTo(1);
}];
UIView *bottomLine = [UIView new];
[self.contentView addSubview:bottomLine];
bottomLine.backgroundColor = RGB(242, 242, 242);
[bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.contentView);
make.height.mas_equalTo(1);
}];
[willFree mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(line.mas_right).offset(10 * k6Scale);
make.top.bottom.equalTo(self.contentView);
make.width.mas_equalTo(55 * k6Scale);
}];
[choose mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right);
make.top.bottom.equalTo(self.contentView);
make.width.mas_equalTo(100 * k6Scale);
}];
free.enabled = NO;
@weakify(self);
[[free rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(UIButton *x) {
@strongify(self);
free.enabled = NO;
willFree.enabled = YES;
if ([self.delegate respondsToSelector:@selector(chooseItemWithChooseType:)]) {
[self.delegate chooseItemWithChooseType:ZXWashHeaderChooseFree];
}
}];
[[willFree rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(UIButton *x) {
@strongify(self);
free.enabled = YES;
willFree.enabled = NO;
if ([self.delegate respondsToSelector:@selector(chooseItemWithChooseType:)]) {
[self.delegate chooseItemWithChooseType:ZXWashHeaderChooseWillOver];
}
}];
[[choose rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(UIButton *x) {
@strongify(self);
if ([self.delegate respondsToSelector:@selector(chooseItemWithChooseType:)]) {
[self.delegate chooseItemWithChooseType:ZXWashHeaderChooseDeal];
}
}];
}
return self;
}
@end
//
//
// ZXChooseCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashLocationModel.h"
@interface DC_ZXChooseCell : UITableViewCell
@property (nonatomic, strong) DC_ZXWashLocationModel *model;
@end
//
//
// ZXChooseCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXChooseCell.h"
@interface DC_ZXChooseCell()
@property (nonatomic, strong) UILabel *contentLabel;
@end
@implementation DC_ZXChooseCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.contentLabel = [UILabel new];
[self.contentView addSubview:self.contentLabel];
self.contentLabel.textColor = RGB(102, 102, 102);
self.contentLabel.font = kFontSize(13 * k6Scale);
self.contentLabel.numberOfLines = 0;
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.right.equalTo(self.contentView.mas_right).offset(-10 * k6Scale); make.centerY.equalTo(self.contentView.mas_centerY);
}];
UIImageView *bo = [[UIImageView alloc] init];
[self.contentView addSubview:bo];
bo.image = [UIImage imageNamed:@"wash-line"];
bo.contentMode = UIViewContentModeScaleAspectFill;
bo.clipsToBounds = YES;
[bo mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.right.equalTo(self.contentView.mas_right);
make.height.mas_equalTo(1);
make.bottom.equalTo(self.contentView.mas_bottom);
}];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)setModel:(DC_ZXWashLocationModel *)model {
_model = model;
self.contentLabel.text = _model.name;
}
@end
//
//
// ZXChooseView.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/27.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashLocationModel.h"
typedef void(^operationSearch)(DC_ZXWashLocationModel *item);
@interface DC_ZXChooseView : UIView
//已经选择的集合
@property (nonatomic, strong) NSArray *reChooseList;
@property (nonatomic, copy) operationSearch search;
@end
//
//
// ZXChooseView.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/27.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXChooseView.h"
#import "enlargeClickRegionBtn.h"
#import "DC_ZXReChooseCell.h"
#import "DC_ZXChooseCell.h"
#import "DC_ZXWashService.h"
#import "DC_ZXWashLocationModel.h"
#import "ZXLoading.h"
@interface DC_ZXChooseView ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *myTableview;
@property (nonatomic, strong) DC_ZXWashService *washService;
@property (nonatomic, strong) ZXLoading *loading;
//数据源
@property (nonatomic, strong) NSMutableArray *dataArray;
@end
@implementation DC_ZXChooseView
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[[UIApplication sharedApplication].keyWindow endEditing:YES];
self.hidden = YES;
[self removeFromSuperview];
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return section?self.dataArray.count:self.reChooseList.count;
}
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *header = [UIView new];
header.backgroundColor = [UIColor whiteColor];
UILabel *l = [[UILabel alloc] initWithFrame: CGRectMake(10 * k6Scale, 0, kScreenWidth - 75 * k6Scale, 30 * k6Scale)];
[header addSubview:l];
l.font = kFontSize(12 * k6Scale);
l.textColor = RGB(153, 153, 153);
l.text = section?@"搜索结果":@"已选择";
return header;
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section) {
DC_ZXChooseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DC_ZXChooseCell"];
if (cell == nil) {
cell = [[DC_ZXChooseCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DC_ZXChooseCell"];
}
DC_ZXWashLocationModel *m = self.dataArray[indexPath.row];
cell.model = m;
return cell;
}
DC_ZXReChooseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ZXReChooseCell"];
if (cell == nil) {
cell = [[DC_ZXReChooseCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ZXReChooseCell"];
}
DC_ZXWashLocationModel *m = self.reChooseList[indexPath.row];
cell.model = m;
return cell;
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return indexPath.section?50 * k6Scale:60* k6Scale;
}
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 30 * k6Scale;
}
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
if (@available(iOS 11, *)) {
[UIScrollView appearance].contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; //iOS11 解决SafeArea的问题,同时能解决pop时上级页面scrollView抖动的问题
}
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.2];
UIView *holder = [[UIView alloc] initWithFrame:CGRectMake(55 * k6Scale, 183 * k6Scale + kTopHeight, kScreenWidth-50 * k6Scale, kScreenHeight - (176 * k6Scale + kTopHeight))];
holder.layer.cornerRadius = 5 * k6Scale;
holder.layer.masksToBounds = YES;
[self addSubview:holder];
holder.backgroundColor = [UIColor whiteColor];
enlargeClickRegionBtn *cancel = [[enlargeClickRegionBtn alloc] init];
[holder addSubview:cancel];
cancel.layer.cornerRadius = 4;
cancel.layer.masksToBounds = YES;
[cancel setBackgroundImage:[UIImage imageNamed:@"btn_cancel"] forState:UIControlStateNormal];
[cancel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(holder.mas_right).offset(-15 * k6Scale);
make.width.height.mas_offset(40 * k6Scale);
make.top.equalTo(holder.mas_top).offset(15 * k6Scale);
}];
@weakify(self);
[[cancel rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
self.hidden = YES;
[self removeFromSuperview];
}];
UIView *holderView = [UIView new];
holderView.backgroundColor = [[UIColor colorWithHexString:@"#999999"] colorWithAlphaComponent:0.1];;
[holder addSubview:holderView];
[holderView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(holder.mas_left).offset(10 * k6Scale);
make.right.equalTo(cancel.mas_left).offset(-10 * k6Scale);
make.centerY.equalTo(cancel.mas_centerY);
make.height.mas_equalTo(40 * k6Scale);
}];
holderView.layer.cornerRadius= 4;
holderView.layer.masksToBounds = YES;
UITextField *field = [[UITextField alloc] init];
[holderView addSubview:field];
[field mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(holderView.mas_left).offset(10 * k6Scale);
make.right.equalTo(holderView.mas_right).offset(-10 * k6Scale);
make.top.bottom.equalTo(holderView);
}];
field.font= kFontSize(13 * k6Scale);
field.textColor = RGB(51,51, 51);
field.placeholder = @"请输入设备地址搜索";
__weak typeof(field) weakField = field;
[field.rac_textSignal subscribeNext:^(NSString *x){
@strongify(self);
if (x.length > 30) {
[ZXTool showText:@"输入地址长度不能超过30!"];
weakField.text = [x substringToIndex:30];
return ;
}
if ([x isEqualToString:@""]) {
[self.dataArray removeAllObjects];
[self.dataArray addObjectsFromArray:self.washService.allMerthinList];
[self.myTableview reloadData];
return ;
}
//这里触发检索
NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"fd_location LIKE[cd] '*%@*'", x]];
NSArray *results = [self.washService.allMerthinList filteredArrayUsingPredicate:predicate];
[self.dataArray removeAllObjects];
[self.dataArray addObjectsFromArray:results];
[self.myTableview reloadData];
}];
self.myTableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 65 * k6Scale, kScreenWidth - 55 * k6Scale, kScreenHeight - (183 * k6Scale + kTopHeight) - 60 * k6Scale) style:UITableViewStylePlain];
[holder addSubview:self.myTableview];
self.myTableview.delegate = self;
self.myTableview.dataSource = self;
self.myTableview.separatorStyle = UITableViewCellSeparatorStyleNone;
self.myTableview.showsVerticalScrollIndicator = NO;
self.loading = [[ZXLoading alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self addSubview:self.loading];
[self.loading show];
self.washService = [[DC_ZXWashService alloc] init];
[self.washService fetchCollectionLocationCompletedBlock:^(BOOL isNeedReload) {
@strongify(self);
[ZXTool hideLoadingAnimation];
if (isNeedReload) {
[self.dataArray removeAllObjects];
[self.dataArray addObjectsFromArray:self.washService.allMerthinList];
[self.myTableview reloadData];
}
[self.loading hide];
self.loading.hidden = YES;
}];
}
return self;
}
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section) {
//添加
DC_ZXWashLocationModel *mo = self.washService.allMerthinList[indexPath.row];
if (self.search) {
self.search(mo);
}
} else {
if (self.search) {
self.search(nil);
}
}
self.hidden = YES;
[self removeFromSuperview];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (NSMutableArray *)dataArray {
if (_dataArray == nil) {
_dataArray = [[NSMutableArray alloc] init];
}
return _dataArray;
}
@end
//
//
// ZXReChooseCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashLocationModel.h"
@interface DC_ZXReChooseCell : UITableViewCell
@property (nonatomic, strong) DC_ZXWashLocationModel *model;
@end
//
//
// ZXReChooseCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/20.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXReChooseCell.h"
#import "enlargeClickRegionBtn.h"
@interface DC_ZXReChooseCell()
@property (nonatomic, strong) UILabel *contentLabel;
@end
@implementation DC_ZXReChooseCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
UIView *holder = [UIView new];
[self.contentView addSubview:holder];
holder.backgroundColor = RGB(245, 222, 205);
[holder mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView.mas_top).offset(5 * k6Scale);
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.height.mas_equalTo(40 * k6Scale);
make.right.equalTo(self.contentView.mas_right).offset(-50 * k6Scale);
}];
holder.layer.cornerRadius = 5 * k6Scale;
holder.layer.masksToBounds = YES;
UIView *line = [UIView new];
[self.contentView addSubview:line];
line.backgroundColor = RGB(242, 242, 242);
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.contentView);
make.height.mas_equalTo(1);
}];
self.contentLabel = [UILabel new];
[holder addSubview:self.contentLabel];
self.contentLabel.textColor = RGB(51, 51, 51);
self.contentLabel.font = kFontSize(12 * k6Scale);
self.contentLabel.numberOfLines = 0;
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(holder.mas_left).offset(10 * k6Scale);
make.right.equalTo(holder.mas_right).offset(-16 * k6Scale);
make.centerY.equalTo(holder.mas_centerY);
}];
enlargeClickRegionBtn *deleteBtn = [[enlargeClickRegionBtn alloc] init];
[holder addSubview:deleteBtn];
deleteBtn.userInteractionEnabled = NO;
[deleteBtn setBackgroundImage:[UIImage imageNamed:@"btn_Select_cancel"] forState:UIControlStateNormal];
[deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.equalTo(holder);
make.width.height.mas_equalTo(20 * k6Scale);
}];
}
return self;
}
- (void)setModel:(DC_ZXWashLocationModel *)model {
_model = model;
self.contentLabel.text = _model.name;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
//
// ZXWashAimiPayCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashOperationModel.h"
@interface DC_ZXWashAimiPayCell : UITableViewCell
@property (nonatomic, strong) DC_washPayWay *pay;
@property (nonatomic, copy) dispatch_block_t reachge;
@end
//
//
// ZXWashAimiPayCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashAimiPayCell.h"
#import "enlargeClickRegionBtn.h"
@interface DC_ZXWashAimiPayCell()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UIImageView *iconImageview;
@property (nonatomic, strong) enlargeClickRegionBtn *chooseBtn;
@property (nonatomic, strong) UIView *v1;
@property (nonatomic, strong) enlargeClickRegionBtn *ho;
@end
@implementation DC_ZXWashAimiPayCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.v1 = [UIView new];
self.v1.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:self.v1];
[self.v1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self.contentView);
make.height.mas_equalTo(45 * k6Scale);
}];
self.iconImageview = [[UIImageView alloc] init];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.font = kFontSize(13 * k6Scale);
self.nameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.ho = [[enlargeClickRegionBtn alloc] init];
[self.contentView addSubview:self.ho];
[self.ho setTitle:@"去购买" forState:UIControlStateNormal];
self.ho.titleLabel.font = kFontSize(11*k6Scale);
self.ho.layer.borderWidth = 1;
self.ho.layer.borderColor = [UIColor colorWithHexString:@"#ff8830"].CGColor;
self.ho.layer.cornerRadius = 10*k6Scale;
self.ho.layer.masksToBounds = YES;
[self.ho setTitleColor:[UIColor colorWithHexString:@"#ff8830"] forState:UIControlStateNormal];
@weakify(self);
[[self.ho rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
if (self.reachge) {
self.reachge();
}
}];
self.chooseBtn = [[enlargeClickRegionBtn alloc] init];
[self.chooseBtn setBackgroundImage:[UIImage imageNamed:@"Radio_Check"] forState:UIControlStateSelected];
[self.chooseBtn setBackgroundImage:[UIImage imageNamed:@"Radio_default"] forState:UIControlStateNormal];
self.chooseBtn.userInteractionEnabled = NO;
[self.v1 addSubview:self.iconImageview];
[self.v1 addSubview:self.nameLabel];
[self.v1 addSubview:self.chooseBtn];
[self.iconImageview mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.width.height.mas_equalTo(22 * k6Scale); make.centerY.equalTo(self.v1.mas_centerY);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconImageview.mas_right).offset(10 * k6Scale);
make.centerY.equalTo(self.v1.mas_centerY);
}];
[self.chooseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.centerY.equalTo(self.v1.mas_centerY);
make.width.height.mas_equalTo(17 * k6Scale);
}];
[self.ho mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.chooseBtn.mas_left).offset(-30 * k6Scale);
make.centerY.equalTo(self.v1.mas_centerY);
make.width.mas_equalTo(50 * k6Scale);
make.height.mas_equalTo(20 * k6Scale);
}];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)setPay:(DC_washPayWay *)pay {
_pay = pay;
self.nameLabel.text = _pay.paymentWayName;
if (_pay.isSelect) {
self.v1.backgroundColor = [UIColor colorWithHexString:@"#fff4ec"];
} else {
self.v1.backgroundColor = [UIColor whiteColor];
}
if (_pay.paymentWayId == 6) {
self.iconImageview.image = [UIImage imageNamed:@"aimi_icon"];
self.ho.hidden = NO;
} else {
self.iconImageview.image = [UIImage imageNamed:@"赠送豆icon"];
self.ho.hidden = YES;
}
self.chooseBtn.selected = _pay.isSelect;
}
@end
//
//
// ZXWashBucketCleanCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
// 桶清洁
#import <UIKit/UIKit.h>
#import "DC_ZXWashOperationModel.h"
@interface DC_ZXWashBucketCleanCell : UITableViewCell
@property (nonatomic, strong) DC_optionalPrograms *option;
@end
//
//
// ZXWashBucketCleanCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashBucketCleanCell.h"
#import "enlargeClickRegionBtn.h"
@interface DC_ZXWashBucketCleanCell()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *moneyLabel;
@property (nonatomic, strong) enlargeClickRegionBtn *chooseBtn;
@end
@implementation DC_ZXWashBucketCleanCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.font = kFontSize(13 * k6Scale);
self.nameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.font = kFontSize(13 * k6Scale);
self.moneyLabel.textAlignment = NSTextAlignmentRight;
self.moneyLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.chooseBtn = [[enlargeClickRegionBtn alloc] init];
[self.chooseBtn setBackgroundImage:[UIImage imageNamed:@"checkbox_Check"] forState:UIControlStateSelected];
[self.chooseBtn setBackgroundImage:[UIImage imageNamed:@"checkbox_default"] forState:UIControlStateNormal];
self.chooseBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.nameLabel];
[self.contentView addSubview:self.moneyLabel];
[self.contentView addSubview:self.chooseBtn];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
}];
[self.chooseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
make.width.height.mas_equalTo(17 * k6Scale);
}];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.chooseBtn.mas_left).offset(-35 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
}];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)setOption:(DC_optionalPrograms *)option {
_option = option;
self.nameLabel.text = _option.name;
if (_option.price > 0) {
self.moneyLabel.text = [NSString stringWithFormat:@"¥ %.2f", _option.price];
} else {
self.moneyLabel.text = @"免费";
}
if (_option.isSelect) {
self.contentView.backgroundColor = [UIColor colorWithHexString:@"#fff4ec"];
self.moneyLabel.textColor = [UIColor colorWithHexString:@"#cd0000"];
} else {
self.contentView.backgroundColor = [UIColor whiteColor];
self.moneyLabel.textColor = [UIColor colorWithHexString:@"#333333"];
}
self.chooseBtn.selected = _option.isSelect;
}
@end
//
//
// ZXWashMyInvitorCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/21.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashOrderListModel.h"
@interface DC_ZXWashMyInvitorCell : UITableViewCell
@property (nonatomic, strong) DC_ZXWashOrderListModel *model;
@end
//
//
// ZXWashOperationCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
// 洗衣功能
#import <UIKit/UIKit.h>
#import "DC_ZXWashOperationModel.h"
#import "DC_ZXWashService.h"
@interface DC_ZXWashOperationCell : UITableViewCell
@property (nonatomic, strong) DC_requiredPrograms *require;
@end
//
//
// ZXWashOperationCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashOperationCell.h"
#import "enlargeClickRegionBtn.h"
@interface DC_ZXWashOperationCell()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *moneyLabel;
@property (nonatomic, strong) enlargeClickRegionBtn *chooseBtn;
@end
@implementation DC_ZXWashOperationCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.font = kFontSize(13 * k6Scale);
self.nameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.font = kFontSize(13 * k6Scale);
self.timeLabel.textColor = [UIColor colorWithHexString:@"#999999"];
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.font = kFontSize(13 * k6Scale);
self.moneyLabel.textAlignment = NSTextAlignmentRight;
self.moneyLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.chooseBtn = [[enlargeClickRegionBtn alloc] init];
[self.chooseBtn setBackgroundImage:[UIImage imageNamed:@"Radio_Check"] forState:UIControlStateSelected];
[self.chooseBtn setBackgroundImage:[UIImage imageNamed:@"Radio_default"] forState:UIControlStateNormal];
self.chooseBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.nameLabel];
[self.contentView addSubview:self.timeLabel];
[self.contentView addSubview:self.moneyLabel];
[self.contentView addSubview:self.chooseBtn];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(135 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
}];
[self.chooseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
make.width.height.mas_equalTo(17 * k6Scale);
}];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.chooseBtn.mas_left).offset(-35 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
}];
}
return self;
}
- (void)setRequire:(DC_requiredPrograms *)require {
_require = require;
self.nameLabel.text = _require.name;
self.timeLabel.text = [NSString stringWithFormat:@"%ld分钟", (long)_require.duration];
if (_require.price > 0) {
self.moneyLabel.text = [NSString stringWithFormat:@"¥ %.2f", _require.price];
} else {
self.moneyLabel.text = @"免费";
}
if (_require.isSelect) {
self.contentView.backgroundColor = [UIColor colorWithHexString:@"#fff4ec"];
self.moneyLabel.textColor = [UIColor colorWithHexString:@"#cd0000"];
self.chooseBtn.selected = YES;
} else {
self.contentView.backgroundColor = [UIColor whiteColor];
self.moneyLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.chooseBtn.selected = NO;
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
//
// ZXWashOrderPayCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/25.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashOrderModel.h"
@interface DC_ZXWashOrderPayCell : UITableViewCell
@property (nonatomic, strong) DC_ZXWashOrderModel *order;
@end
//
//
// ZXWashOrderPayCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/25.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashOrderPayCell.h"
@interface DC_ZXWashOrderPayCell() {
UILabel *label2;
}
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UIImageView *iconImageview;
@end
@implementation DC_ZXWashOrderPayCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
UILabel *label1 = [[UILabel alloc] init];
label1.font = kFontSize(13 * k6Scale);
label1.textColor = [UIColor colorWithHexString:@"#999999"];
[self.contentView addSubview:label1];
label1.text = @"支付方式:";
self.iconImageview = [[UIImageView alloc] init];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.font = kFontSize(13 * k6Scale);
self.nameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
[self.contentView addSubview:self.iconImageview];
[self.contentView addSubview:self.nameLabel];
[label1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.top.equalTo(self.contentView.mas_top);
make.height.mas_equalTo(k6Scale * 45);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.centerY.equalTo(label1.mas_centerY);
}];
[self.iconImageview mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.nameLabel.mas_left).offset(-6 * k6Scale);
make.width.height.mas_equalTo(22 * k6Scale); make.centerY.equalTo(self.nameLabel.mas_centerY);
}];
UIView *line = [[UIView alloc] init];
line.backgroundColor = kRGB(242, 242, 242);
[self.contentView addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.top.equalTo(label1.mas_bottom);
make.height.mas_equalTo(1);
}];
label2 = [[UILabel alloc] init];
label2.font = kFontSize(11 * k6Scale);
label2.textColor = [UIColor colorWithHexString:@"#333333"];
label2.numberOfLines = 0;
[self.contentView addSubview:label2];
[label2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(line.mas_left);
make.right.equalTo(line.mas_right);
make.top.equalTo(line.mas_bottom).offset(15 * k6Scale);
}];
}
return self;
}
- (void)setOrder:(DC_ZXWashOrderModel *)order {
_order = order;
if (_order.orderType==1) {
label2.text = @"";
} else {
label2.text = [NSString stringWithFormat:@"*注:本次支付为预约设备功能使用费用,预约时间为%ld分钟,超出预约时间,费用不做退还,请谨慎下单!", _order.appointmentTimeout];
}
if (_order.paymentWayId == 6) {
self.iconImageview.image = [UIImage imageNamed:@"aimi_icon"];
self.nameLabel.text = @"艾米币支付";
}else if (_order.paymentWayId == 2) {
//微信支付
self.iconImageview.image = [UIImage imageNamed:@"weixin"];
self.nameLabel.text = @"微信支付";
} else if (_order.paymentWayId == 3) {
//支付宝支付
self.iconImageview.image = [UIImage imageNamed:@"zhifubao"];
self.nameLabel.text = @"支付宝支付";
} else if (_order.paymentWayId == 4) {
//京东支付
self.iconImageview.image = [UIImage imageNamed:@"JD"];
self.nameLabel.text = @"京东支付";
} else {
self.iconImageview.image = [UIImage imageNamed:@"赠送豆icon"];
self.nameLabel.text = @"洗衣豆支付";
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
//
// ZXWashOrderShowCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/25.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashOrderModel.h"
@interface DC_ZXWashOrderShowCell : UITableViewCell
@property (nonatomic, strong) DC_ZXWashOrderModel *order;
@end
//
//
// ZXWashOrderShowCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/25.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashOrderShowCell.h"
@interface DC_ZXWashOrderShowCell()
@property (nonatomic, strong) UILabel *numberLabel;
@property (nonatomic, strong) UILabel *addressLabel;
@property (nonatomic, strong) UILabel *operationLabel;
@property (nonatomic, strong) UILabel *moneyLabel;
@end
@implementation DC_ZXWashOrderShowCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
UIImageView *imageH = [[UIImageView alloc] init];
imageH.image = [UIImage imageNamed:@"Laundryrecord_picture"];
[self.contentView addSubview:imageH];
[imageH mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.top.equalTo(self.contentView.mas_top).offset(15 * k6Scale);
make.width.height.mas_equalTo(43.5 * k6Scale);
}];
//设备编号
self.numberLabel = [UILabel new];
[self.contentView addSubview:self.numberLabel];
self.numberLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.numberLabel.font = kFontSize(11 * k6Scale);
[self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(imageH.mas_right).offset(10 * k6Scale);
make.top.equalTo(imageH.mas_top);
}];
//地址
self.addressLabel = [UILabel new];
[self.contentView addSubview:self.addressLabel];
self.addressLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.addressLabel.font = kFontSize(11 * k6Scale);
[self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(imageH.mas_right).offset(10 * k6Scale);
make.bottom.equalTo(imageH.mas_bottom);
}];
UIView *line = [[UIView alloc] init];
line.backgroundColor = RGB(242, 242, 242);
[self.contentView addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.top.equalTo(imageH.mas_bottom).offset(15 * k6Scale);
make.height.mas_equalTo(1);
}];
UILabel *label1 = [UILabel new];
[self.contentView addSubview:label1];
label1.textColor = RGB(153, 153, 153);
label1.font = kFontSize(13 * k6Scale);
label1.text = @"洗衣功能:";
[label1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(imageH.mas_left);
make.top.equalTo(line.mas_bottom);
make.height.mas_equalTo(45 * k6Scale);
}];
self.operationLabel = [UILabel new];
[self.contentView addSubview:self.operationLabel];
self.operationLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.operationLabel.font = kFontSize(14 * k6Scale);
self.operationLabel.textAlignment = NSTextAlignmentRight;
[self.operationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.centerY.equalTo(label1.mas_centerY);
}];
UIView *line1 = [[UIView alloc] init];
line1.backgroundColor = RGB(242, 242, 242);
[self.contentView addSubview:line1];
[line1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.top.equalTo(label1.mas_bottom);
make.height.mas_equalTo(1);
}];
self.moneyLabel = [UILabel new];
[self.contentView addSubview:self.moneyLabel];
self.moneyLabel.font = kFontSize(12 * k6Scale);
self.moneyLabel.textAlignment = NSTextAlignmentRight;
self.moneyLabel.textColor = [UIColor colorWithHexString:@"#cd0000"];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.top.equalTo(line1.mas_bottom);
make.height.mas_equalTo(50 * k6Scale);
}];
UILabel *label2 = [UILabel new];
[self.contentView addSubview:label2];
label2.textColor = RGB(153, 153, 153);
label2.font = kFontSize(13 * k6Scale);
label2.text = @"订单合计:";
[label2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.moneyLabel.mas_left).offset(-20 * k6Scale);
make.centerY.equalTo(self.moneyLabel.mas_centerY);
}];
}
return self;
}
- (void)setOrder:(DC_ZXWashOrderModel *)order {
_order = order;
self.numberLabel.text = [NSString stringWithFormat:@"设备编号: %@(%@)", order.deviceCode, order.deviceName];
self.addressLabel.text = [NSString stringWithFormat:@"设备地址: %@", _order.position];
NSMutableArray *lll = [NSMutableArray new];
for (DC_ZXWashOrder_ServiceModel *service in _order.services) {
NSString *s = [NSString stringWithFormat:@"%@ %.2f元", service.name, service.price];
[lll addObject:s];
}
self.operationLabel.text = [lll componentsJoinedByString:@" "];
NSString *moneyStr = [NSString stringWithFormat:@"%.2f", _order.money];
self.moneyLabel.attributedText = [ZXTool replaceWithStr:[NSString stringWithFormat:@"¥ %@元", moneyStr] subStr:[moneyStr substringToIndex:1] replaceStrFont:19 * k6Scale color:[UIColor colorWithHexString:@"#cd0000"] lineSpaceing:0];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
//
// ZXWashPayWayCell.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DC_ZXWashOperationModel.h"
@interface DC_ZXWashPayWayCell : UITableViewCell
@property (nonatomic, strong) DC_washPayWay *pay;
@end
//
//
// ZXWashPayWayCell.m
// ColorfulSchool
//
// Created by liuZX on 2018/6/22.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import "DC_ZXWashPayWayCell.h"
#import "enlargeClickRegionBtn.h"
@interface DC_ZXWashPayWayCell()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UIImageView *iconImageview;
@property (nonatomic, strong) enlargeClickRegionBtn *chooseBtn;
@end
@implementation DC_ZXWashPayWayCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.iconImageview = [[UIImageView alloc] init];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.font = kFontSize(13 * k6Scale);
self.nameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
self.chooseBtn = [[enlargeClickRegionBtn alloc] init];
[self.chooseBtn setBackgroundImage:[UIImage imageNamed:@"Radio_Check"] forState:UIControlStateSelected];
[self.chooseBtn setBackgroundImage:[UIImage imageNamed:@"Radio_default"] forState:UIControlStateNormal];
self.chooseBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.iconImageview];
[self.contentView addSubview:self.nameLabel];
[self.contentView addSubview:self.chooseBtn];
[self.iconImageview mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).offset(20 * k6Scale);
make.width.height.mas_equalTo(22 * k6Scale); make.centerY.equalTo(self.contentView.mas_centerY);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.iconImageview.mas_right).offset(10 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
}];
[self.chooseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).offset(-20 * k6Scale);
make.centerY.equalTo(self.contentView.mas_centerY);
make.width.height.mas_equalTo(17 * k6Scale);
}];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)setPay:(DC_washPayWay *)pay {
_pay = pay;
if (_pay.paymentWayId == 2) {
//微信支付
self.iconImageview.image = [UIImage imageNamed:@"weixin"];
} else if (_pay.paymentWayId == 3) {
//支付宝支付
self.iconImageview.image = [UIImage imageNamed:@"zhifubao"];
} else if (_pay.paymentWayId == 4) {
//京东支付
self.iconImageview.image = [UIImage imageNamed:@"JD"];
} else {
//
self.iconImageview.image = [UIImage imageNamed:@"赠送豆icon"];
}
self.nameLabel.text = _pay.paymentWayName;
if (_pay.isSelect) {
self.contentView.backgroundColor = [UIColor colorWithHexString:@"#fff4ec"];
} else {
self.contentView.backgroundColor = [UIColor whiteColor];
}
self.chooseBtn.selected = _pay.isSelect;
}
@end
//
//
// DCWashBluetoothManager.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/11/6.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol DCWashBluetoothManagerDelegate <NSObject>
//已经就绪 开始调用接口 status 0其他 1代表蓝牙和socket都连接成功 2代表服务器通知
- (void) startFireInterfaceByStatus:(NSInteger) status;
//蓝牙连接失败
- (void) connectBluetoothFaliure;
@end
NS_ASSUME_NONNULL_BEGIN
@interface DCWashBluetoothManager : NSObject
/* 自定义初始化方法
* deviceCode蓝牙设备编码
* isOnlyBluetooth蓝牙设备是否是纯蓝牙
* socketUrl socket连接地址
* socketPort socket连接端口号
*/
- (instancetype) initWithBluetoothDeviceCode:(NSString *) deviceCode
isOnlyBluetooth:(BOOL) isOnlyBluetooth
socketUrl:(NSString *) socketUrl
socketPort:(NSInteger) port;
//第一次进入 主动连接蓝牙和socket
- (void) firstInConnectBluetoothAndSocket;
//点击开始按钮 主动连接蓝牙和socket
- (void) startConnectBluetoothAndSocket;
/** DCWashBluetoothManagerDelegate */
@property (nonatomic, weak) id<DCWashBluetoothManagerDelegate> delegate;
//主动断开 所有链接 在接口调用失败的时候使用
- (void) cutBluetoothAndSocketConnect;
@end
NS_ASSUME_NONNULL_END
//
//
// ZXWashService.h
// ColorfulSchool
//
// Created by liuZX on 2018/6/28.
// Copyright © 2018年 Colorful Any Door. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "DC_ZXWashOperationModel.h"
#import "DC_ZXWashOrderModel.h"
#import "DC_ZXPreOrderModel.h"
typedef enum : NSUInteger {
DC_ZXWashMerthinOnline,//使用中
DC_ZXWashMerthinOffline, //空闲中
} DC_ZXWashMerthinType;
typedef void(^completedBlock)(BOOL isNeedReload);
typedef void(^washOperation)(DC_ZXWashOperationModel *model);
typedef void(^createOrder)(DC_ZXWashOrderModel *order);
typedef void(^requestPay)(id payPara);
@interface DC_ZXWashService : NSObject
/**维修电话列表*/
@property (nonatomic, strong) NSMutableArray *repairMobineList;
/**使用中的设备列表*/
@property (nonatomic, strong) NSMutableArray *onlineList;
/**空闲中的设备列表*/
@property (nonatomic, strong) NSMutableArray *offlineList;
/**所有设备列表*/
@property (nonatomic, strong) NSMutableArray *allMerthinList;
/**常用设备列表*/
@property (nonatomic, strong) NSMutableArray *collectionList;
/**我的预约列表*/
@property (nonatomic, strong) NSMutableArray *myInvitorList;
/**我的订单列表*/
@property (nonatomic, strong) NSMutableArray *myOrderList;
/** 当前的预约订单 */
@property (nonatomic, strong) DC_ZXPreOrderModel *currentPreOrder;
//加载最新设备列表
- (void)loadNewMerchinListWithType:(DC_ZXWashMerthinType)type
positionId:(NSString *) positionId
completedBlock:(completedBlock)completedBlock;
//加载更多设备列表
- (void)loadMoreMerchinListWithType:(DC_ZXWashMerthinType)type positionId:(NSString *) positionId completedBlock:(completedBlock)completedBlock;
//常用位置查询
- (void) fetchCollectionLocationCompletedBlock:(completedBlock) completedBlock;
//增加常用我位置
- (void) addCollectionLocationWithAddress:(NSString *) address completedBlock:(completedBlock) completedBlock;
//删除常用位置
- (void)deleteCollectionLocationWithAddress:(NSString *)address completedBlock:(completedBlock) completedBlock;
/**选中洗衣机*/
- (void) checkMerthinWithMerthinCode:(NSString *) code completedBlock:(washOperation) completedBlock;
/**创建订单*/
+ (void) createOrderWithPara:(NSDictionary *) para completedBlock:(createOrder) order;
//发起支付
+ (void) postPayWithPara:(NSDictionary *) para requestPay:(requestPay) payPara;
//单独加载预约订单信息
+(void) loadPreOrderInfoCompletedBlock:(completedBlock)completedBlock;
/*
*获取洗衣记录
*/
- (void) loadWashRecordListWithIsNewData:(BOOL) isNewData completedBlock:(completedBlock) completedBlock;
/**开始洗衣*/
+(void) startWashWithEquipmentId:(NSInteger) equipmentId orderId:(NSInteger) orderId completedBlock:(completedBlock) completedBlock;
@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