Commit 38cc7ea4 authored by 曹云霄's avatar 曹云霄

修改项说明:导购抽奖、客户抽奖

parent a44ffd28
......@@ -72,7 +72,7 @@
#pragma mark -UI
- (void)uiConfigAction
{
self.indexPage = 1;
self.indexPage = ONE;
self.allCustomerTableview.dataSource = self;
self.allCustomerTableview.delegate = self;
self.searchTextfield.delegate = self;
......@@ -111,7 +111,7 @@
//下拉刷新
MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
DataPage *page = [[DataPage alloc]init];
page.page = 1;
page.page = ONE;
page.rows = KROWS;
self.conditionModel.page = page;
[self.allCustomerTableview.mj_footer resetNoMoreData];
......
......@@ -7,6 +7,10 @@
//
#import <UIKit/UIKit.h>
#import "LuckDrawResultModel.h"
#import "ShopcarModel.h"
#import "PromotionalDeductionModel.h"
#import "PromotionalGoodsModel.h"
@interface AllpriceTableViewCell : UITableViewCell
......@@ -34,4 +38,14 @@
*/
@property (nonatomic,strong) NSArray *goodsArray;
/**
* 抽奖折扣
*/
@property (nonatomic,copy) LuckDrawResultModel *model;
/**
* 促销金额
*/
@property (nonatomic,copy) NSArray *promotionalArray;
@end
......@@ -7,7 +7,7 @@
//
#import "AllpriceTableViewCell.h"
#import "ShopcarModel.h"
@implementation AllpriceTableViewCell
- (void)awakeFromNib {
......@@ -15,44 +15,63 @@
// Initialization code
}
#pragma mark -赋值
- (void)setGoodsAllprice:(NSArray *)goodsAllprice
{
_goodsAllprice = goodsAllprice;
NSUInteger allNumber = 0;
CGFloat allPrice = 0;
for (ShopcarModel *model in _goodsAllprice) {
allNumber += model.goodsNum;
allPrice += [model.costPrice floatValue] *model.goodsNum;
}
self.goodsAllNumber.text = [NSString stringWithFormat:@"%ld",allNumber];
self.goodsAllPrice.text = [NSString stringWithFormat:@"¥%.2f",allPrice];
}
#pragma mark -数据源赋值
- (void)setGoodsArray:(NSArray *)goodsArray
{
_goodsArray = goodsArray;
NSInteger allNumber = 0;//总数量
CGFloat allPrice = 0;//总价格
CGFloat newPrice = 0;//折后价格
CGFloat deductionPrice = 0;//抵扣金额
for (TOOrderdetailEntity *model in _goodsArray) {
allNumber += [model.goodsNum integerValue];
allPrice += [model.goodsPrice floatValue]*[model.goodsNum intValue];
}
newPrice = allPrice;
/// 抽奖折扣
if ([self.model.number length]) {
newPrice = allPrice * ([self.model.number integerValue]/100.0);
}
/// 全局抵扣
if (self.promotionalArray) {
for (id object in self.promotionalArray) {
if ([object isKindOfClass:[PromotionalDeductionModel class]]) {
PromotionalDeductionModel *model = (PromotionalDeductionModel *)object;
if ([model.type isEqualToString:@"deductionAction"]) {
deductionPrice = model.total;
}
}
}
}
NSString *goodsAllPriceString = nil;
if (deductionPrice && newPrice != allPrice) {
goodsAllPriceString = [NSString stringWithFormat:@"¥%.2f (%.2f x %@ - %.2f)",newPrice-deductionPrice,allPrice,self.model.descriptionString,deductionPrice];
}else if (newPrice == allPrice && !deductionPrice){
goodsAllPriceString = [NSString stringWithFormat:@"¥%.2f",newPrice];
}else if (newPrice == allPrice && deductionPrice){
goodsAllPriceString = [NSString stringWithFormat:@"¥%.2f (%.2f - %.2f)",newPrice-deductionPrice,allPrice,deductionPrice];
}else if (newPrice != allPrice && !deductionPrice){
goodsAllPriceString = [NSString stringWithFormat:@"¥%.2f (%.2f x %@)",newPrice-deductionPrice,allPrice,self.model.descriptionString];
}
self.goodsAllNumber.text = [NSString stringWithFormat:@"%ld",allNumber];
self.goodsAllPrice.text = [NSString stringWithFormat:@"¥%.2f",allPrice];
self.goodsAllPrice.text = goodsAllPriceString;
}
......
......@@ -81,9 +81,18 @@
<constraint firstAttribute="width" constant="100" id="w5u-oL-Y0U"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="q0Y-Z3-9ec">
<rect key="frame" x="403" y="329" width="91" height="33"/>
<state key="normal" image="useing"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="q0Y-Z3-9ec">
<rect key="frame" x="401" y="336" width="91" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="91" id="6t5-W5-gJh"/>
<constraint firstAttribute="height" constant="26" id="DcV-VR-Fik"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="titleEdgeInsets" minX="7" minY="0.0" maxX="8" maxY="0.0"/>
<inset key="imageEdgeInsets" minX="75" minY="-3" maxX="0.0" maxY="-2"/>
<state key="normal" title="去使用" image="goused">
<color key="titleColor" red="0.2901960784" green="0.57254901960000004" blue="0.93725490199999995" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="sureButtonClickAction:" destination="-1" eventType="touchUpInside" id="xP7-jg-LZQ"/>
</connections>
......@@ -95,10 +104,13 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="z5Z-2z-1qL" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="29" id="0gt-6E-uxW"/>
<constraint firstItem="q0Y-Z3-9ec" firstAttribute="top" secondItem="X2G-su-iPO" secondAttribute="bottom" constant="2" id="0m1-SF-kS4"/>
<constraint firstAttribute="trailing" secondItem="FOR-QQ-gKa" secondAttribute="trailing" id="1hS-sz-h5i"/>
<constraint firstAttribute="bottom" secondItem="X2G-su-iPO" secondAttribute="bottom" constant="36" id="4TV-4K-XHc"/>
<constraint firstItem="X2G-su-iPO" firstAttribute="leading" secondItem="z5Z-2z-1qL" secondAttribute="trailing" constant="23" id="5tR-2W-9Ry"/>
<constraint firstAttribute="trailing" secondItem="q0Y-Z3-9ec" secondAttribute="trailing" constant="8" id="FAX-2Y-LYk"/>
<constraint firstAttribute="bottom" secondItem="FAF-XN-Ibv" secondAttribute="bottom" id="ID7-4t-Qds"/>
<constraint firstAttribute="bottom" secondItem="q0Y-Z3-9ec" secondAttribute="bottom" constant="8" id="KBv-97-nTJ"/>
<constraint firstAttribute="trailing" secondItem="X2G-su-iPO" secondAttribute="trailing" constant="18" id="PcV-pO-aDJ"/>
<constraint firstItem="cWQ-HK-qv1" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="QPP-sD-d3D"/>
<constraint firstAttribute="trailing" secondItem="cWQ-HK-qv1" secondAttribute="trailing" id="RaO-A5-Fg4"/>
......@@ -130,10 +142,10 @@
</objects>
<resources>
<image name="bg-w" width="290" height="72"/>
<image name="goused" width="12" height="10"/>
<image name="mask" width="290" height="72"/>
<image name="onehundred" width="290" height="144"/>
<image name="used" width="51" height="51"/>
<image name="useing" width="48" height="10"/>
<image name="京东logo" width="56" height="56"/>
</resources>
</document>
......@@ -56,6 +56,7 @@
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.beenUseCardCollectionView.mj_header beginRefreshing];
}
......@@ -131,7 +132,6 @@
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
NSLog(@"%@",[NSString stringWithFormat:SERVERREQUESTURL(USEJDECARD),JDECardNumber]);
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(USEJDECARD),JDECardNumber] WithCallClass:weakSelf WithRequestType:ZERO WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
......
......@@ -20,6 +20,11 @@
*/
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *dontUseFlowLayout;
/**
* 是否刷新
*/
@property (nonatomic,assign) BOOL isRefreshValue;
......
......@@ -42,7 +42,7 @@
if (!_requestModel) {
_requestModel = [[RsJingDongECardRequest alloc]init];
DataPage *page = [[DataPage alloc]init];
page.page = 0;
page.page = ZERO;
page.rows = 10;
page.order = @"desc";
_requestModel.guideIdEquals = [Shoppersmanager manager].Shoppers.employee.fid;
......@@ -62,7 +62,10 @@
- (void)viewDidAppear:(BOOL)animated
{
[self.dontUseCardCollectionView.mj_header beginRefreshing];
[super viewDidAppear:animated];
if (!self.isRefreshValue) {
[self.dontUseCardCollectionView.mj_header beginRefreshing];
}
}
- (void)viewDidLoad {
......@@ -112,6 +115,7 @@
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
NSLog(@"%@",[self.requestModel toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(CARDINFORMATION) WithCallClass:weakSelf WithRequestType:ZERO WithParameter:self.requestModel WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
......@@ -222,6 +226,7 @@
[DeviceDirectionManager instance].isHorizontal=NO;
[alertView dismissViewControllerAnimated:YES completion:nil];
}]];
self.isRefreshValue = YES;
[self presentViewController:alertView animated:YES completion:nil];
}
......@@ -266,6 +271,8 @@
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
weakSelf.isRefreshValue = NO;
[weakSelf.dontUseCardCollectionView.mj_header beginRefreshing];
[weakSelf SuccessMBProgressView:@"激活成功"];
}else{
......
......@@ -89,7 +89,6 @@
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
NSLog(@"%@",[NSString stringWithFormat:SERVERREQUESTURL(USEJDECARD),JDECardNumber]);
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(USEJDECARD),JDECardNumber] WithCallClass:weakSelf WithRequestType:ZERO WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
......@@ -113,13 +112,10 @@
///@property (nonatomic, strong) NSMutableArray<TOJingdongEcardEntity> *eCards;
/// 手动改为可变数组
for (int i=0; i<self.datasArray.count; i++) {
GroupByOrderNumber *order = self.datasArray[i];
for (int j=0; j<order.eCards.count; j++) {
TOJingdongEcardEntity *ecard = order.eCards[j];
if ([eCardNumber isEqualToString:ecard.cardNumber]) {
ecard.state = @"used";
[self.cardCollectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:j inSection:i]]];
}
TOJingdongEcardEntity *order = self.datasArray[i];
if ([eCardNumber isEqualToString:order.cardNumber]) {
order.state = @"used";
[self.cardCollectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:i inSection:0]]];
}
}
}
......@@ -139,7 +135,7 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
GroupByOrderNumber *model = self.datasArray[indexPath.section];
TOJingdongEcardEntity *model = self.datasArray[indexPath.section];
if ([[self class] isBlankString:model.orderReceiptUrl]) {
[self SHOWPrompttext:@"不能查看未激活卡劵,请先上传小票激活卡劵"];
}else{
......
......@@ -451,7 +451,7 @@
- (void)modifyshoppersInformation:(NSString *)headerurl complete:(void(^)())block
{
[self CreateMBProgressHUDLoding];
MyclientEntityModel *customerEntity = [[MyclientEntityModel alloc]init];
MyclientEntityModel *customerEntity = nil;
customerEntity = [Customermanager manager].model;
customerEntity.picture = headerurl;
WS(weakSelf);
......@@ -481,7 +481,7 @@
- (void)ChangeCustomerName
{
MyclientEntityModel *model = [Customermanager manager].model;
[[NSNotificationCenter defaultCenter] postNotificationName:@"CHANGECUSTOMERNAME" object:model.name];
[[NSNotificationCenter defaultCenter] postNotificationName:CHANGECUSTOMERNAME object:model.name];
}
......
......@@ -204,14 +204,18 @@
orderdetails.orderCode = model.orderNumber;
if ([model.orderState isEqualToString:@"006"] || [model.orderState isEqualToString:@"002"] || [model.orderState isEqualToString:@"003"]) {
orderdetails.isShowPrintButton = YES;
orderdetails.isDelectedButton = NO;
orderdetails.isShowPayButton = NO;
orderdetails.isShowHeaderView = YES;
orderdetails.isUserInteractionEnabled = NO;
}
if ([model.orderState isEqualToString:@"001"]) {//未付款
} else if ([model.orderState isEqualToString:@"001"]) {//未付款
orderdetails.isShowPayButton = YES;
orderdetails.isDelectedButton = YES;
orderdetails.isShowPrintButton = YES;
orderdetails.isShowPrintButton = NO;
orderdetails.isShowHeaderView = YES;
orderdetails.isUserInteractionEnabled = YES;
}else{
orderdetails.isShowHeaderView = NO;
}
//撤销、支付回调
[orderdetails setDelecteAndPayButtonBlock:^(NSInteger cellindex, NSString *orderSate) {
......@@ -351,14 +355,18 @@
orderdetails.orderCode = model.orderNumber;
if ([model.orderState isEqualToString:@"006"] || [model.orderState isEqualToString:@"002"] || [model.orderState isEqualToString:@"003"]) {
orderdetails.isShowPrintButton = YES;
orderdetails.isDelectedButton = NO;
orderdetails.isShowPayButton = NO;
orderdetails.isShowHeaderView = YES;
orderdetails.isUserInteractionEnabled = NO;
}
if ([model.orderState isEqualToString:@"001"]) {
} else if ([model.orderState isEqualToString:@"001"]) {//未付款
orderdetails.isShowPayButton = YES;
orderdetails.isDelectedButton = YES;
orderdetails.isShowPrintButton = YES;
orderdetails.isShowPrintButton = NO;
orderdetails.isShowHeaderView = YES;
orderdetails.isUserInteractionEnabled = YES;
}else{
orderdetails.isShowHeaderView = NO;
}
//撤销、支付回调
[orderdetails setDelecteAndPayButtonBlock:^(NSInteger cellindex, NSString *orderSate) {
......
......@@ -235,7 +235,7 @@
- (void)SelectedControllerWithIndex:(NSString *)Name
{
SHARED_APPDELEGATE.lineView.hidden = YES;
NSInteger selectedIndex;
NSInteger selectedIndex = 0;
if ([Name isEqualToString:@"体验中心"]) {
[[NSNotificationCenter defaultCenter] postNotificationName:OPENFOLLOWHEARTVC object:nil];
......
//
// LuckDrawResultModel.h
// Lighting
//
// Created by 曹云霄 on 2016/11/5.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface LuckDrawResultModel : JSONModel
@property (nonatomic,copy) NSString *lotteryId;
@property (nonatomic,copy) NSString *type;
@property (nonatomic,copy) NSString *number;
@property (nonatomic,copy) NSString *descriptionString;
@property (nonatomic,copy) NSString *drawId;
/**
* 通过抽奖列表结果初始化抽奖结果
*/
+ (LuckDrawResultModel *)initializeWith:(RsAwardDraw *)rsAwardDrawModel;
@end
//
// LuckDrawResultModel.m
// Lighting
//
// Created by 曹云霄 on 2016/11/5.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "LuckDrawResultModel.h"
@implementation LuckDrawResultModel
+(BOOL)propertyIsOptional:(NSString *)propertyName
{
return YES;
}
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc]initWithDictionary:@{@"description":@"descriptionString"}];
}
+ (LuckDrawResultModel *)initializeWith:(RsAwardDraw *)rsAwardDrawModel
{
LuckDrawResultModel *model = [[LuckDrawResultModel alloc]init];
model.lotteryId = rsAwardDrawModel.draw.lotteryId;
model.type = rsAwardDrawModel.award.type;
model.number = [rsAwardDrawModel.award.number stringValue];
model.descriptionString = rsAwardDrawModel.award.fdescription;
model.drawId = rsAwardDrawModel.draw.fid;
return model;
}
@end
//
// LuckyDrawDetailsViewController.h
// Lighting
//
// Created by 曹云霄 on 2016/11/6.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface LuckyDrawDetailsViewController : BaseViewController
/**
* 抽奖详情
*/
@property (weak, nonatomic) IBOutlet UITableView *drawDetailsTableView;
/**
* 区分已抽奖、未抽奖、首页加载两种情况
*/
@property (nonatomic,assign) NSInteger drawValue;
@end
//
// LuckyDrawDetailsViewController.m
// Lighting
//
// Created by 曹云霄 on 2016/11/6.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "LuckyDrawDetailsViewController.h"
#import "NotDrawTableViewCell.h"
#import "CustomWKWebViewController.h"
#import "UsedDrawTableViewCell.h"
#import "LuckDrawResultModel.h"
@interface LuckyDrawDetailsViewController ()<UITableViewDataSource,UITableViewDelegate,DZNEmptyDataSetSource,DZNEmptyDataSetDelegate>
@property (nonatomic,strong) RsLotteryRequest *drawModel;
/**
* 总页数
*/
@property (nonatomic,assign) NSInteger totalPage;
/**
* 数据源
*/
@property (nonatomic,strong) NSMutableArray *datasArray;
@end
@implementation LuckyDrawDetailsViewController
#pragma mark - lazy
- (RsLotteryRequest *)drawModel
{
if (!_drawModel) {
_drawModel = [[RsLotteryRequest alloc]init];
_drawModel.winnerIdEquals = [Shoppersmanager manager].Shoppers.employee.fid;
DataPage *page = [[DataPage alloc]init];
page.rows = 10;
page.page = 0;
_drawModel.page = page;
switch (self.drawValue) {
case 0:
{
_drawModel.stateEquals = nil;
}
break;
case 1:
{
_drawModel.stateEquals = INITIAL;
}
break;
case 2:
{
_drawModel.stateEquals = ACCOMPLISHED;
}
break;
default:
break;
}
}
return _drawModel;
}
- (NSMutableArray *)datasArray
{
if (!_datasArray) {
_datasArray = [NSMutableArray array];
}
return _datasArray;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if (self.drawValue) {
[self.drawDetailsTableView.mj_header beginRefreshing];
}else {
[self getDrawDatas:YES];
}
}
- (void)viewDidLoad {
[super viewDidLoad];
[self uiConfigAction];
[self setupRefreshAction];
}
#pragma mark - UI
- (void)uiConfigAction
{
self.drawDetailsTableView.tableFooterView = [UIView new];
self.drawDetailsTableView.delegate = self;
self.drawDetailsTableView.dataSource = self;
}
#pragma mark - 设置刷新
- (void)setupRefreshAction
{
WS(weakSelf);
MjRefreshHeaderCustom *headerRefresh = [MjRefreshHeaderCustom headerWithRefreshingBlock:^{
weakSelf.drawModel.page.page = 0;
[weakSelf.drawDetailsTableView.mj_footer resetNoMoreData];
[weakSelf getDrawDatas:YES];
}];
headerRefresh.stateLabel.hidden = YES;
headerRefresh.lastUpdatedTimeLabel.hidden = YES;
self.drawDetailsTableView.mj_header = headerRefresh;
MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (++ weakSelf.drawModel.page.page >= weakSelf.totalPage) {
[weakSelf.drawDetailsTableView.mj_footer endRefreshingWithNoMoreData];
}else
{
[weakSelf getDrawDatas:NO];
}
}];
footer.automaticallyHidden = YES;
self.drawDetailsTableView.mj_footer = footer;
}
#pragma mark - 抽奖数据
- (void)getDrawDatas:(BOOL)isRemove
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
NSLog(@"%@",[self.drawModel toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(LOTTERYED) WithCallClass:weakSelf WithRequestType:ZERO WithParameter:self.drawModel WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf endRefreshingForTableView:weakSelf.drawDetailsTableView];
weakSelf.drawDetailsTableView.emptyDataSetSource = weakSelf;
weakSelf.drawDetailsTableView.emptyDataSetDelegate = weakSelf;
if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (isRemove) {
[weakSelf.datasArray removeAllObjects];
}
RsLotteryResponse *drawRecord = [[RsLotteryResponse alloc]initWithDictionary:returnValue[@"data"] error:nil];
[weakSelf.datasArray addObjectsFromArray:drawRecord.list];
weakSelf.totalPage = [returnValue[@"data"][@"totalpages"] integerValue];
[weakSelf.drawDetailsTableView reloadData];
}else {
[weakSelf SHOWPrompttext:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
RsAwardDraw *drawEntity = self.datasArray[indexPath.row];
if ([drawEntity.draw.state isEqualToString:@"initial"]) {
NotDrawTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NotDrawTableViewCell" forIndexPath:indexPath];
cell.orderNumberLabel.text = drawEntity.draw.orderNumber;
cell.drawButton.tag = indexPath.row;
[cell.drawButton addTarget:self action:@selector(drawButtonClickAction:) forControlEvents:UIControlEventTouchUpInside];
if (self.drawValue == 0) {
cell.orderNumberTitle.font = [UIFont systemFontOfSize:12];
cell.drawButton.titleLabel.font = [UIFont systemFontOfSize:12];
cell.orderNumberLabel.font = [UIFont systemFontOfSize:12];
[cell.drawButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(cell).offset(-20);
make.size.mas_equalTo(CGSizeMake(50, 20));
make.centerY.equalTo(cell);
}];
}
return cell;
}
UsedDrawTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UsedDrawTableViewCell" forIndexPath:indexPath];
cell.orderNumber.text = drawEntity.draw.orderNumber;
cell.drawTimeLabel.text = drawEntity.draw.createDate;
cell.trophyLabel.text = drawEntity.draw.awardDescription;
if (self.drawValue == 0) {
cell.drawTimeLabel.hidden = YES;
cell.drawTimeTitle.hidden = YES;
cell.orderNumberTitle.font = [UIFont systemFontOfSize:12];
cell.trophyLabel.font = [UIFont systemFontOfSize:12];
cell.orderNumber.font = [UIFont systemFontOfSize:12];
}
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.datasArray.count;
}
#pragma mark - 去抽奖
- (void)drawButtonClickAction:(UIButton *)sender
{
WS(weakSelf);
RsAwardDraw *drawEntity = self.datasArray[sender.tag];
[self showLuckyDrawControl:drawEntity.draw.lotteryId andOrderNumber:drawEntity.draw.orderNumber andDrawid:drawEntity.draw.fid luckyDrawFinish:^(NSDictionary *dict) {
id json = [NSJSONSerialization JSONObjectWithData:[[dict[@"body"] firstObject] dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:nil];
if (json) {
if ([json isKindOfClass:[NSDictionary class]]) {
[weakSelf SHOWPrompttext:[NSString stringWithFormat:@"恭喜获得%@元红包",dict[@"number"]]];
}
}else {
[weakSelf SHOWPrompttext:@"没有中奖,欢迎再来"];
}
}];
}
#pragma mark - 抽奖界面
- (void)showLuckyDrawControl:(NSString *)lotteryId andOrderNumber:(NSString *)orderNumber andDrawid:(NSString *)drawid luckyDrawFinish:(void(^)(NSDictionary *dict))complete
{
CustomWKWebViewController *wkWebView = [[CustomWKWebViewController alloc]init];
NSString *server = [NSString stringWithFormat:SERVERREQUESTURL(DRAW),lotteryId,drawid,orderNumber];
NSString *newServer = [server stringByReplacingOccurrencesOfString:@"/app" withString:@""];
wkWebView.pdfURLString = newServer;
[wkWebView setLuckyDrawFinishBlock:^(NSDictionary *result) {
complete(result);
}];
[wkWebView setDismissLuckyDrawController:^{
}];
[self presentViewController:wkWebView animated:YES completion:nil];
}
#pragma mark -友好界面
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
{
if (self.drawValue) {
return kNoDataImage;
}
return nil;
}
- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView
{
return YES;
}
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
{
return [[NSAttributedString alloc]initWithString:@"暂无抽奖记录~" attributes:nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
......@@ -8,6 +8,10 @@
#import <Foundation/Foundation.h>
@class lottery;
@protocol lottery @end
@interface LuckyDrawModel : JSONModel
//** 促销对象 */
......@@ -17,7 +21,7 @@
@property (nonatomic, copy) NSString *type;
/// 抽奖ID
@property (nonatomic, copy) NSString *lotteryId;
@property (nonatomic, copy) lottery *lottery;
//** 描述 */
@property (nonatomic, copy) NSString *descriptionString;
......@@ -26,3 +30,12 @@
@property (nonatomic,copy) NSString *priority;
@end
@interface lottery : JSONModel
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *uuid;
@property (nonatomic, copy) NSString *code;
@end
......@@ -21,3 +21,17 @@
}
@end
@implementation lottery
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
return YES;
}
@end
//
// LuckyDrawViewController.h
// Lighting
//
// Created by 曹云霄 on 2016/11/5.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "BaseViewController.h"
@interface LuckyDrawViewController : BaseViewController
/**
* 未抽奖
*/
@property (weak, nonatomic) IBOutlet UIButton *notDrawButton;
/**
* 已抽奖
*/
@property (weak, nonatomic) IBOutlet UIButton *usedDrawButton;
/**
* 指示线
*/
@property (weak, nonatomic) IBOutlet UIView *indicateLineView;
/**
* 背景View
*/
@property (weak, nonatomic) IBOutlet UIView *backGroundView;
@end
//
// LuckyDrawViewController.m
// Lighting
//
// Created by 曹云霄 on 2016/11/5.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "LuckyDrawViewController.h"
#import "LuckyDrawDetailsViewController.h"
@interface LuckyDrawViewController ()
@property (nonatomic,strong) UIViewController *currentVC;
@end
@implementation LuckyDrawViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setupChildrenController];
}
#pragma mark - 添加未抽奖和已抽奖情况
- (void)setupChildrenController
{
/// 未抽奖
LuckyDrawDetailsViewController *notDrawControl = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"LuckyDrawDetailsViewController"];
[self addChildViewController:notDrawControl];
notDrawControl.drawValue = 1;
self.currentVC = notDrawControl;
/// 已抽奖
LuckyDrawDetailsViewController *usedDrawControl = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"LuckyDrawDetailsViewController"];
usedDrawControl.drawValue = 2;
[self addChildViewController:usedDrawControl];
notDrawControl.view.frame = CGRectMake(0, 0, self.backGroundView.mj_w, self.backGroundView.mj_h);
usedDrawControl.view.frame = CGRectMake(0, 0, self.backGroundView.mj_w, self.backGroundView.mj_h);
[self.backGroundView addSubview:notDrawControl.view];
}
#pragma mark - 切换未抽奖和已抽奖
- (void)switchPaymentsVCAndWithdrawalVC:(UIViewController *)newViewController
{
[self transitionFromViewController:self.currentVC toViewController:newViewController duration:0.5 options:UIViewAnimationOptionTransitionNone animations:nil completion:^(BOOL finished) {
if (finished) {
[self.backGroundView addSubview:newViewController.view];
self.currentVC = newViewController;
}
}];
}
#pragma mark - 切换ContentController
- (IBAction)paymentsButtonAndWithdrawalButtonClick:(UIButton *)sender {
switch (sender.tag) {
case 100:
{
self.usedDrawButton.selected = NO;
}
break;
case 101:
{
self.notDrawButton.selected = NO;
}
break;
default:
break;
}
sender.selected = YES;
[self setupInstructionsViewOrigin:sender];
[self switchPaymentsVCAndWithdrawalVC:self.childViewControllers[sender.tag-100]];
}
#pragma mark - 设置指示线的位置
- (void)setupInstructionsViewOrigin:(UIButton *)sender
{
[UIView animateWithDuration:0.5 delay:0.1f usingSpringWithDamping:0.5f initialSpringVelocity:0.5f options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.indicateLineView.frame = CGRectMake(sender.mj_origin.x+(sender.mj_w-self.indicateLineView.mj_w)/2, self.indicateLineView.mj_origin.y, self.indicateLineView.mj_w, 2);
} completion:nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
//
// NotDrawTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 2016/11/6.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NotDrawTableViewCell : UITableViewCell
/**
* 订单编号
*/
@property (weak, nonatomic) IBOutlet UILabel *orderNumberLabel;
/**
* 去抽奖
*/
@property (weak, nonatomic) IBOutlet UIButton *drawButton;
/**
* 订单编号title
*/
@property (weak, nonatomic) IBOutlet UILabel *orderNumberTitle;
@end
//
// NotDrawTableViewCell.m
// Lighting
//
// Created by 曹云霄 on 2016/11/6.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "NotDrawTableViewCell.h"
@implementation NotDrawTableViewCell
- (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
}
@end
......@@ -134,14 +134,18 @@
orderdetails.orderCode = model.orderNumber;
if ([model.orderState isEqualToString:@"006"] || [model.orderState isEqualToString:@"002"] || [model.orderState isEqualToString:@"003"]) {
orderdetails.isShowPrintButton = YES;
orderdetails.isDelectedButton = NO;
orderdetails.isShowPayButton = NO;
orderdetails.isShowHeaderView = YES;
orderdetails.isUserInteractionEnabled = NO;
}
if ([model.orderState isEqualToString:@"001"]) {
} else if ([model.orderState isEqualToString:@"001"]) {//未付款
orderdetails.isShowPayButton = YES;
orderdetails.isDelectedButton = YES;
orderdetails.isShowPrintButton = YES;
orderdetails.isShowPrintButton = NO;
orderdetails.isShowHeaderView = YES;
orderdetails.isUserInteractionEnabled = YES;
}else{
orderdetails.isShowHeaderView = NO;
}
//撤销、支付回调
WS(weakSelf);
......
......@@ -41,9 +41,9 @@
@property (nonatomic,assign) BOOL isShowPrintButton;
/**
* 是否显示撤销订单
* 是否显示headerView
*/
@property (nonatomic,assign) BOOL isDelectedButton;
@property (nonatomic,assign) BOOL isShowHeaderView;
/**
* 撤销按钮、支付按钮完成回调
......
This diff is collapsed.
......@@ -362,7 +362,7 @@
#pragma mark -完成加入购物车动画完成后回调
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
[[NSNotificationCenter defaultCenter]postNotificationName:@"ADDGOODSNUMBER" object:@([self.headerView.goodsNumber.text integerValue])];
[[NSNotificationCenter defaultCenter]postNotificationName:REFRESHSHOPPINGCAR object:@([self.headerView.goodsNumber.text integerValue])];
}
......
......@@ -497,7 +497,7 @@
#pragma mark -完成加入购物车动画完成后回调
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
[[NSNotificationCenter defaultCenter]postNotificationName:@"ADDGOODSNUMBER" object:@(1)];
[[NSNotificationCenter defaultCenter]postNotificationName:REFRESHSHOPPINGCAR object:@(1)];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
......
......@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
/// 京东Eka,折扣金额
@interface PromotionalDeductionModel : JSONModel
//** 促销对象 */
......
......@@ -13,6 +13,8 @@
#import "WithdrawalTableViewController.h"
#import "CardViewController.h"
#import "CardDetailsViewController.h"
#import "LuckyDrawViewController.h"
#import "LuckyDrawDetailsViewController.h"
@interface RebateViewController ()
......@@ -81,6 +83,17 @@
*/
@property (weak, nonatomic) IBOutlet UIView *cardBackgroundView;
/**
* 我的抽奖
*/
@property (weak, nonatomic) IBOutlet UIView *drawBackgroundView;
/**
* 账户金额
*/
@property (weak, nonatomic) IBOutlet UIView *accountAmountView;
@end
......@@ -89,6 +102,7 @@
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] postNotificationName:PROMPTDRAWINFORMATION object:@(0)];
[self getRebateDatasFromUser];
}
......@@ -97,6 +111,7 @@
[self setupChildViewController];
[self uiConfigAction];
[self addConstraint];
}
#pragma mark - UI
......@@ -106,6 +121,22 @@
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:[Shoppersmanager manager].Shoppers.employee.picture] placeholderImage:ReplaceImage];
}
#pragma mark - 添加约束
- (void)addConstraint
{
[self.cardBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(23);
make.top.equalTo(self.accountAmountView.mas_bottom).offset(13);
make.size.mas_equalTo(CGSizeMake((ScreenWidth-23*2-20)/2, 200));
}];
[self.drawBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.cardBackgroundView.mas_right).offset(20);
make.top.equalTo(self.accountAmountView.mas_bottom).offset(13);
make.size.mas_equalTo(CGSizeMake((ScreenWidth-23*2-20)/2, 200));
}];
}
#pragma mark - 设置收支明细、提现进度、卡劵包
- (void)setupChildViewController
{
......@@ -119,10 +150,18 @@
[self.contentBackgroundView addSubview:payments.view];
self.currentVC = payments;
/// 我的卡劵
CardViewController *cardVc = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"CardViewController"];
[self addChildViewController:cardVc];
cardVc.view.frame = CGRectMake(10, 40, (self.cardBackgroundView.mj_w-20)/2, self.cardBackgroundView.mj_h-50);
cardVc.view.frame = CGRectMake(10, 40, (self.cardBackgroundView.mj_w-20), self.cardBackgroundView.mj_h-50);
[self.cardBackgroundView addSubview:cardVc.view];
/// 我的抽奖
LuckyDrawDetailsViewController *draw = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"LuckyDrawDetailsViewController"];
[self addChildViewController:draw];
draw.drawValue = 0;
draw.view.frame = CGRectMake(10, 40, (self.drawBackgroundView.mj_w-20), self.drawBackgroundView.mj_h-50);
[self.drawBackgroundView addSubview:draw.view];
}
......@@ -212,6 +251,13 @@
[self.navigationController pushViewController:cardDetails animated:YES];
}
#pragma mark - 更多抽奖信息
- (IBAction)moreDrawButtonClickAction:(UIButton *)sender {
LuckyDrawViewController *luckDrawDetails = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"LuckyDrawViewController"];
[self.navigationController pushViewController:luckDrawDetails animated:YES];
}
@end
......@@ -199,7 +199,6 @@
for (TOSceneEntity *model in response.list) {
[weakSelf.responseArray addObject:model];
}
[weakSelf.seceneLibararyCollectionView reloadData];
}
else
......@@ -208,11 +207,15 @@
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf endRefreshingForTableView:weakSelf.seceneLibararyCollectionView];
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:NETWORK];
} WithFailureBlock:^(id error) {
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf endRefreshingForTableView:weakSelf.seceneLibararyCollectionView];
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}
......@@ -231,7 +234,6 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
FullScreenViewController *fullScreenVC = [[FullScreenViewController alloc]init];
fullScreenVC.datasArray = self.responseArray;
fullScreenVC.currentindex = indexPath.row;
......
......@@ -7,6 +7,7 @@
//
#import "BaseViewController.h"
#import "LuckDrawResultModel.h"
@interface SettlementViewController : BaseViewController
......@@ -128,5 +129,10 @@
*/
@property (weak, nonatomic) IBOutlet UIScrollView *myScrollView;
/**
* 客户抽奖结果
*/
@property (nonatomic,strong) LuckDrawResultModel *resultModel;
@end
......@@ -105,6 +105,10 @@
}
}
goodAllprice -= totalNumber;
/// 抽奖结果<打折>
if ([self.resultModel.type isEqualToString:@"discount"]) {
goodAllprice = goodAllprice*([self.resultModel.number integerValue]/100.0);
}
self.goodsAllNumber.text = [NSString stringWithFormat:@"%ld",goodsAllNumber];
self.goodsAllPrice.text = [NSString stringWithFormat:@"¥%.2f",goodAllprice];
}
......@@ -302,9 +306,10 @@
- (void)SurePayRequest
{
OrderPayRequest *order = [[OrderPayRequest alloc]init];
order.orderNumber = _orderCode;
order.fnewstate = @"002";
order.oldstate = @"001";
order.orderNumber = self.orderCode;
order.fnewstate = PAYSUCCESS;
order.oldstate = NOTPAY;
order.drawId = self.resultModel.drawId;
/// 查询是否有赠送商品促销
order.realAmount = [NSNumber numberWithFloat:[[self.goodsAllPrice.text substringFromIndex:1] floatValue]];
NSMutableArray *goodsArray = [NSMutableArray array];
......@@ -323,35 +328,31 @@
}
order.promotionGoods = (NSArray<PromotionGoods> *)goodsArray;
/// 查询是否有京东E卡促销
NSInteger totalNumber;//促销卡面额
NSInteger totalNumber = 0;//促销卡面额
for (id object in self.luckyDrawAndJDECardArray) {
if ([object isKindOfClass:[PromotionalDeductionModel class]]) {
PromotionalDeductionModel *model = (PromotionalDeductionModel *)object;
if ([model.type isEqualToString:JDECardAction]) {
if ([model.type isEqualToString:JDECardAction] && [model.body isEqualToString:GUIDE]) {
totalNumber += model.total;
}
}
}
order.jdCardDenomation = totalNumber;
/// 查询是否有客户抽奖机会
/// 查询是否有导购抽奖机会
for (id object in self.luckyDrawAndJDECardArray) {
if ([object isKindOfClass:[LuckyDrawModel class]]) {
LuckyDrawModel *model = (LuckyDrawModel *)object;
if ([model.body isEqualToString:@"consumer"]) {
order.lotteryId = model.lotteryId;
if ([model.body isEqualToString:GUIDE]) {
order.lotteryId = model.lottery.uuid;
}
}
}
//支付类型
if (self.payTreasureButton.selected) {
order.payType = @"005";
}else if (self.WeixiPayButton.selected)
{
}else if (self.WeixiPayButton.selected){
order.payType = @"006";
}else
{
}else{
order.payType = [self PayTypeSelected:self.payTypeButton.currentTitle];
}
//是否开票
......@@ -363,7 +364,6 @@
}
//发票类型
if ([self.invoiceType.currentTitle isEqualToString:@"公司发票"] && [order.isbill isEqualToString:@"Y"]) {
order.billType = @"002";
if (self.invoiceHeader.text.length == 0 || !self.invoiceHeader.text) {
[self ErrorMBProgressView:@"发票抬头不能为空"];
......@@ -374,10 +374,9 @@
{
order.billType = @"001";
}
[self CreateMBProgressHUDLoding];
WS(weakSelf);
NSLog(@"%@",[order toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(CONFIRMPAY) WithCallClass:weakSelf WithRequestType:0 WithParameter:order WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
......
......@@ -308,7 +308,7 @@
{
[self CreateMBProgressHUDLoding];
WS(weakSelf);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",SERVERREQUESTURL(REMOVEADDRESS),_model.fid] WithCallClass:weakSelf WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",SERVERREQUESTURL(REMOVEADDRESS),_model.fid] WithCallClass:weakSelf WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
......
......@@ -430,6 +430,7 @@
orderDetails.orderCode = returnValue[@"data"];
orderDetails.isShowPayButton = YES;
orderDetails.isUserInteractionEnabled = YES;
orderDetails.isShowHeaderView = YES;
orderDetails.isSliding = YES;//取消滑动返回
[weakSelf.navigationController pushViewController:orderDetails animated:YES];
......
......@@ -89,8 +89,6 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self uiConfigAction];
[self addViewcontroller];
......
......@@ -24,12 +24,11 @@
self.backgroundColor = kTCColor(255, 255, 255);
[self uiConfigAction];
[self addNSNotificationCenter];
}
return self;
}
#pragma mark -布局
- (void)uiConfigAction
{
......@@ -99,38 +98,60 @@
SHARED_APPDELEGATE.lineView = self.underlineView;
_underlineView.backgroundColor = kMainBlueColor;
[self addSubview:self.underlineView];
//刷新购物车数量 、直接赋值
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshGoodsNumber:) name:REFRESHSHOPPINGCAR object:nil];
}
#pragma mark - 监听通知
- (void)addNSNotificationCenter
{
//刷新购物车数量
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(AddGoodsNumber:) name:@"ADDGOODSNUMBER" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshGoodsNumber:) name:REFRESHSHOPPINGCAR object:nil];
//重置购物车数量
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetGoodNumber:) name:ADDSHOPPINGCAR object:nil];
//更改用户名
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ChangeCustomerName:) name:@"CHANGECUSTOMERNAME" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ChangeCustomerName:) name:CHANGECUSTOMERNAME object:nil];
//更改导购名
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ChangeShoppersName:) name:@"CHANGESHOPPERSNAME" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ChangeShoppersName:) name:CHANGESHOPPERSNAME object:nil];
//提示抽奖信息
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(promptDrawInformation:) name:PROMPTDRAWINFORMATION object:nil];
}
#pragma mark -刷新购物车显示数量
- (void)refreshGoodsNumber:(NSNotification *)objc
- (void)refreshGoodsNumber:(NSNotification *)object
{
CustomButton *button = (CustomButton *)[self viewWithTag:103];
button.instructionsNumber = [objc.object integerValue];
NSInteger number = [object.object integerValue];
if (number) {
button.instructionsNumber += number;
}else {
button.instructionsNumber = 0;
}
}
#pragma mark -增加购物车数量
- (void)AddGoodsNumber:(NSNotification *)objc
#pragma mark - 重置购物车显示数量
- (void)resetGoodNumber:(NSNotification *)object
{
CustomButton *button = (CustomButton *)[self viewWithTag:103];
button.instructionsNumber += [objc.object integerValue];
NSInteger number = [object.object integerValue];
button.instructionsNumber = number;
}
#pragma mark - 提示抽奖机会
- (void)promptDrawInformation:(NSNotification *)object
{
CustomButton *button = (CustomButton *)[self viewWithTag:101];
NSInteger number = [object.object integerValue];
if (number) {
button.instructionsNumber += number;
}else{
button.instructionsNumber = 0;
}
}
#pragma mark -更改当前用户名
- (void)ChangeCustomerName:(NSNotification *)Not
- (void)ChangeCustomerName:(NSNotification *)object
{
UIButton *button = [self viewWithTag:102];
NSString *userName = Not.object;
NSString *userName = object.object;
if (userName.length == 0 || !userName) {
userName = @"我的客户";
}
......@@ -138,10 +159,10 @@
}
#pragma mark -更改导购名字
- (void)ChangeShoppersName:(NSNotification *)not
- (void)ChangeShoppersName:(NSNotification *)object
{
UIButton *button = [self viewWithTag:101];
NSString *userName = not.object;
NSString *userName = object.object;
if (userName.length == 0 || !userName) {
userName = @"导购";
}
......@@ -153,7 +174,6 @@
- (void)QrCodeButtonClickAction
{
if ([self.delegate respondsToSelector:@selector(QrcodeButtonClick)]) {
[self.delegate QrcodeButtonClick];
}
}
......@@ -162,23 +182,18 @@
- (void)ButtonClick:(UIButton *)button
{
if (button.tag == 102 || button.tag == 103) {
if (!(button.tag == 103 && ![Shoppersmanager manager].currentCustomer)) {
self.underlineView.hidden = NO;
//下划线动画
[UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
CGRect frame = self.underlineView.frame;
frame.origin.x = button.frame.origin.x+(ButtonWIDTH-50)/2;
self.underlineView.frame = frame;
} completion:nil];
}
}
//点击代理
if ([self.delegate respondsToSelector:@selector(ButtonClickAction:withButton:)]) {
[self.delegate ButtonClickAction:button.tag withButton:button];
}
}
......
//
// UsedDrawTableViewCell.h
// Lighting
//
// Created by 曹云霄 on 2016/11/6.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UsedDrawTableViewCell : UITableViewCell
/**
* 订单编号
*/
@property (weak, nonatomic) IBOutlet UILabel *orderNumber;
/**
* 抽奖时间
*/
@property (weak, nonatomic) IBOutlet UILabel *drawTimeLabel;
/**
* 奖品
*/
@property (weak, nonatomic) IBOutlet UILabel *trophyLabel;
/**
* 抽奖时间title
*/
@property (weak, nonatomic) IBOutlet UILabel *drawTimeTitle;
/**
* 订单编号title
*/
@property (weak, nonatomic) IBOutlet UILabel *orderNumberTitle;
@end
//
// UsedDrawTableViewCell.m
// Lighting
//
// Created by 曹云霄 on 2016/11/6.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "UsedDrawTableViewCell.h"
@implementation UsedDrawTableViewCell
- (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
}
@end
......@@ -215,7 +215,7 @@
[Shoppersmanager manager].currentCustomer = NO;
[Customermanager manager].model = nil;
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
LoginViewController *loginVC = [storyboard instantiateViewControllerWithIdentifier:@"Login"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:USERNAME];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PASSWORD];
......@@ -287,7 +287,7 @@
[Shoppersmanager manager].passWordString = weakSelf.passWord.text;
[Shoppersmanager manager].currentCustomer = NO;
[Shoppersmanager manager].Shoppers = result;
[[NSNotificationCenter defaultCenter] postNotificationName:@"CHANGESHOPPERSNAME" object:result.employee.realName];
[[NSNotificationCenter defaultCenter] postNotificationName:CHANGESHOPPERSNAME object:result.employee.realName];
[[NSNotificationCenter defaultCenter] postNotificationName:@"CHANGECUSTOMERNAME" object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"EMPTYCUSTOMERNAME" object:nil];//情况当前客户数据
//保存用户名密码
......
This diff is collapsed.
......@@ -53,7 +53,7 @@
#pragma mark -设置根视图
- (void)RootViewcontroller
{
UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIStoryboard *story = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
LoginViewController *login = [story instantiateViewControllerWithIdentifier:@"Login"];
self.window.rootViewController = login;
}
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "bg-img 副本.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "goused.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "goused@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "goused@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",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -13,7 +13,7 @@
<key>CFBundleName</key>
<string>欧立方</string>
<key>CFBundleShortVersionString</key>
<string>1.1.4</string>
<string>1.1.5</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
......@@ -69,9 +69,9 @@
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<string>StoryboardwithCYX</string>
<key>UIMainStoryboardFile~ipad</key>
<string>Main</string>
<string>StoryboardwithCYX</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
......
This diff is collapsed.
This diff is collapsed.
/Users/caoyunxiao/Desktop/Opple-iOS/Pods/IQKeyboardManager/IQKeyboardManager/Resources/IQKeyboardManager.bundle
/Users/caoyunxiao/Desktop/Opple-iOS/Pods/MJRefresh/MJRefresh/MJRefresh.bundle
/Users/caoyunxiao/Desktop/Opple-iOS/Pods/UMengSocial/Umeng_SDK_Social_iOS_ARM64_5.0/UMSocial_Sdk_5.0/UMSocialSDKResourcesNew.bundle
/Users/caoyunxiao/Desktop/Opple-iOS/Pods/UMengSocial/Umeng_SDK_Social_iOS_ARM64_5.0/UMSocial_Sdk_Extra_Frameworks/TencentOpenAPI/TencentOpenApi_IOS_Bundle.bundle
/Users/caoyunxiao/Desktop/Opple-iOS/Pods/UMengSocial/Umeng_SDK_Social_iOS_ARM64_5.0/UMSocial_Sdk_Extra_Frameworks/SinaSSO/WeiboSDK.bundle
......@@ -81,6 +81,12 @@
*/
- (void)RemovePromptinformationView;
/**
* 提示框
*
*/
- (void)promptCustomerTitle:(NSString *)title finish:(void(^)())complete;
/**
* 查询订单状态图片
......
......@@ -68,13 +68,6 @@
return _webView;
}
- (UIPrintInteractionController *)printControl
{
if (!_printControl) {
_printControl = [UIPrintInteractionController sharedPrintController];
}
return _printControl;
}
- (void)viewDidLoad {
......@@ -95,7 +88,7 @@
[weakSelf dismissViewControllerAnimated:YES completion:nil];
[Shoppersmanager manager].currentCustomer = NO;
[Customermanager manager].model = nil;
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
LoginViewController *loginVC = [storyboard instantiateViewControllerWithIdentifier:@"Login"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:USERNAME];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:PASSWORD];
......@@ -183,7 +176,7 @@
#pragma mark -显示成功的提示框
- (void)SuccessMBProgressView:(NSString *)successString
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
hud.mode = MBProgressHUDModeCustomView;
UIImage *image = [[UIImage imageNamed:@"Checkmark"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
hud.customView = [[UIImageView alloc] initWithImage:image];
......@@ -196,7 +189,7 @@
#pragma mark -显示信息的提示框
- (void)ErrorMBProgressView:(NSString *)errorString
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
hud.labelText = errorString;
hud.margin = 10.f;
hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
......@@ -258,7 +251,6 @@
pic.printInfo = printInfo;
pic.showsPageRange = YES;
pic.printingItem = mypdfdata;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
if (completed)
{
......@@ -271,9 +263,7 @@
failed();
}
};
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
[pic presentAnimated:YES completionHandler:completionHandler];
}
}
......@@ -283,10 +273,11 @@
#pragma mark 调用airPrint无线打印机
- (void)callAirprintWithURL:(NSURL *)datasurl SuccessBlock:(void (^)())success ErrorBlock:(void (^)())failed
{
self.printControl.delegate = self;
UIPrintInteractionController *printControl = [UIPrintInteractionController sharedPrintController];
printControl.delegate = self;
[self.webView loadRequest:[NSURLRequest requestWithURL:datasurl]];//网页
self.webView.navigationDelegate = self;
self.printControl.printFormatter = [self.webView viewPrintFormatter];//布局打印视图绘制的内容。
printControl.printFormatter = [self.webView viewPrintFormatter];//布局打印视图绘制的内容。
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"订单明细";
......@@ -306,7 +297,6 @@
}
};
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
[self.printControl presentAnimated:YES completionHandler:completionHandler];
}
}
......@@ -337,6 +327,17 @@
[self.view addSubview:self.promptView];
}
#pragma mark - 提示框
- (void)promptCustomerTitle:(NSString *)title finish:(void (^)())complete
{
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:title preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if (complete) {
complete();
}
}]];
[self presentViewController:alertVC animated:YES completion:nil];
}
#pragma mark -删除提示文本、图片
- (void)RemovePromptinformationView
......@@ -446,7 +447,7 @@
if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSLog(@"更新购物车数量成功");
[[NSNotificationCenter defaultCenter]postNotificationName:REFRESHSHOPPINGCAR object:returnValue[@"data"]];
[[NSNotificationCenter defaultCenter]postNotificationName:ADDSHOPPINGCAR object:returnValue[@"data"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
......
......@@ -262,6 +262,11 @@ extern NSString *const DRAW;
* 拼接订单详情URL(打印/预览)
*/
extern NSString *const ORDERDETAILSURL;
/**
* 抽奖结果查询
*/
extern NSString *const LOTTERYED;
/*****************************************接口地址*****************************************/
......@@ -315,6 +320,16 @@ extern NSString *const WXCardAction;
*/
extern NSString *const JDECardAction;
/**
* 导购
*/
extern NSString *const GUIDE;
/**
* 消费者
*/
extern NSString *const CONSUMER;
/**
* 折扣金额
*/
......@@ -330,7 +345,69 @@ extern NSString *const goodsAction;
*/
extern NSString *const lotteryAction;
/**
* 未付款
*/
extern NSString *const NOTPAY;
/**
* 已付款
*/
extern NSString *const PAYSUCCESS;
/**
* 已发货
*/
extern NSString *const SHIPPED;
/**
* 已退货
*/
extern NSString *const RETURN;
/**
* 已作废
*/
extern NSString *const CANCEL;
/**
* 已完成
*/
extern NSString *const COMPLETED;
/**
* 已抽奖未使用
*/
extern NSString *const ACCOMPLISHED;
/**
未抽奖
*/
extern NSString *const INITIAL;
/**
* 刷新购物车
*/
extern NSString *const REFRESHSHOPPINGCAR;
/**
* 增加购物车
*/
extern NSString *const ADDSHOPPINGCAR;
/**
* 更改用户名
*/
extern NSString *const CHANGECUSTOMERNAME;
/**
* 更改导购名
*/
extern NSString *const CHANGESHOPPERSNAME;
/**
* 提示抽奖信息
*/
extern NSString *const PROMPTDRAWINFORMATION;
......@@ -261,6 +261,11 @@ NSString *const DRAW = @"/tOLotteryController.do?lotteryAward&lotteryId=%@&drawI
* 拼接订单详情URL(打印/预览)
*/
NSString *const ORDERDETAILSURL = @"/tOOrderController.do?htmlOfPdf&reseller_id=%@&order_number=%@";
/**
* 抽奖结果查询
*/
NSString *const LOTTERYED = @"/lottery/query";
/*****************************************接口地址*****************************************/
......@@ -304,7 +309,6 @@ NSString *const OPENCONTROLLER = @"openController";
*/
NSString *const OPENFOLLOWHEARTVC = @"FollowHeartVC";
/**
* 微信卡劵
*/
......@@ -313,7 +317,17 @@ NSString *const WXCardAction = @"WXCardAction";
/**
* 京东E卡
*/
NSString *const JDECardAction = @"JDECardAction";
NSString *const JDECardAction = @"jdECardAction";
/**
* 导购
*/
NSString *const GUIDE = @"guide";
/**
* 消费者
*/
NSString *const CONSUMER = @"consumer";
/**
* 折扣金额
......@@ -330,6 +344,70 @@ NSString *const goodsAction = @"goodsAction";
*/
NSString *const lotteryAction = @"lotteryAction";
/**
* 未付款
*/
NSString *const NOTPAY = @"001";
/**
* 已付款
*/
NSString *const PAYSUCCESS = @"002";
/**
* 已发货
*/
NSString *const SHIPPED = @"003";
/**
* 已退货
*/
NSString *const RETURN = @"004";
/**
* 已作废
*/
NSString *const CANCEL = @"005";
/**
* 已完成
*/
NSString *const COMPLETED = @"006";
/**
* 已抽奖未使用
*/
NSString *const ACCOMPLISHED = @"accomplished";
/**
未抽奖
*/
NSString *const INITIAL = @"initial";
/**
* 刷新购物车
*/
NSString *const REFRESHSHOPPINGCAR = @"GOODSNUMBER";
/**
* 增加购物车
*/
NSString *const ADDSHOPPINGCAR = @"ADDGOODS";
/**
* 更改用户名
*/
NSString *const CHANGECUSTOMERNAME = @"CHANGECUSTOMERNAME";
/**
* 更改导购名
*/
NSString *const CHANGESHOPPERSNAME = @"CHANGESHOPPERSNAME";
/**
* 提示抽奖信息
*/
NSString *const PROMPTDRAWINFORMATION = @"PROMPTDRAWINFORMATION";
......@@ -23,7 +23,10 @@
*/
@property (nonatomic,copy) void(^luckyDrawFinishBlock)(NSDictionary *luckyDrawResultDict);
/**
* 退出抽奖界面
*/
@property (nonatomic,copy) void(^dismissLuckyDrawController)();
@end
......@@ -47,6 +47,11 @@
#pragma mark -UI
- (void)uiConfigAction
{
NSSet *websiteDataTypes = [NSSet setWithArray:@[WKWebsiteDataTypeDiskCache,WKWebsiteDataTypeMemoryCache,]];
NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
NSLog(@"清除缓存成功");
}];
self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:self.config];
[self.view addSubview:self.webView];
self.webView.navigationDelegate = self;
......@@ -59,11 +64,11 @@
UIButton *dismissButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.view addSubview:dismissButton];
[dismissButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(100);
make.top.mas_equalTo(100);
make.size.mas_equalTo(CGSizeMake(60, 60));
make.left.mas_equalTo(40);
make.top.mas_equalTo(40);
make.size.mas_equalTo(CGSizeMake(50, 50));
}];
[dismissButton setBackgroundImage:TCImage(@"10-副本-3") forState:UIControlStateNormal];
[dismissButton setBackgroundImage:TCImage(@"1") forState:UIControlStateNormal];
[dismissButton addTarget:self action:@selector(dismissButtonClick) forControlEvents:UIControlEventTouchUpInside];
}
......@@ -83,7 +88,12 @@
#pragma mark -dismiss
- (void)dismissButtonClick
{
[self dismissViewControllerAnimated:YES completion:nil];
WS(weakSelf);
[self dismissViewControllerAnimated:YES completion:^{
if (weakSelf.dismissLuckyDrawController) {
weakSelf.dismissLuckyDrawController();
}
}];
}
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation
......
......@@ -81,10 +81,9 @@
*/
#define RightWidth 200
/**
* 0
*/
#define ZERO 0
#define ONE 1
/**
* 断网标示
......@@ -148,10 +147,6 @@
*/
#define REPLACEIMAGE [UIImage imageNamed:@"bg-img 副本"]
/**
* 刷新购物车通知
*/
#define REFRESHSHOPPINGCAR @"GOODSNUMBER"
/**
* 保存用户名key
......
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