Commit e6ea7308 authored by 曹云霄's avatar 曹云霄

修复热门推荐数据解析错误,修复购物车输入折扣比例偶发崩溃

parent fab2a3a8
......@@ -55,6 +55,6 @@
/**
* 改变京东卡状态后需要刷新
*/
@property (nonatomic,copy) void(^refreshJDCardList)(BOOL isComplete);
@property (nonatomic,copy) void(^refreshJDCardList)(BOOL isComplete,NSString *cardNumber);
@end
......@@ -51,17 +51,17 @@
WS(weakSelf);
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(RECEIVEJDECARD),_cardModel.cardNumber] WithRequestType:ZERO WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(RECEIVEJDECARD),self.cardModel.cardNumber] WithRequestType:ZERO WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (weakSelf.refreshJDCardList) {
weakSelf.refreshJDCardList(YES);
weakSelf.refreshJDCardList(YES,weakSelf.cardModel.cardNumber);
}
}else
{
if (weakSelf.refreshJDCardList) {
weakSelf.refreshJDCardList(YES);
weakSelf.refreshJDCardList(NO,weakSelf.cardModel.cardNumber);
}
}
......
......@@ -68,12 +68,12 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" alpha="0.29999999999999999" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12362514" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z4q-vO-5Wt">
<rect key="frame" x="18" y="265" width="110" height="26"/>
<label opaque="NO" userInteractionEnabled="NO" alpha="0.29999999999999999" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2FF0-3F9D-DCC6-D1CD" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z4q-vO-5Wt">
<rect key="frame" x="18" y="265" width="215" height="26"/>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="6fp-21-x2D"/>
<constraint firstAttribute="width" constant="110" id="yD7-fO-xTg"/>
<constraint firstAttribute="height" constant="26" id="QRy-tb-lRt"/>
<constraint firstAttribute="width" constant="215" id="oIE-kX-N6G"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......@@ -106,14 +106,16 @@
<constraint firstItem="4rL-ti-mfn" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="1KA-cY-Iy4"/>
<constraint firstItem="f9T-ak-TEq" firstAttribute="top" secondItem="4rL-ti-mfn" secondAttribute="bottom" constant="14" id="3UD-nV-ZGF"/>
<constraint firstAttribute="trailing" secondItem="4rL-ti-mfn" secondAttribute="trailing" id="8cB-Ma-qfw"/>
<constraint firstItem="z4q-vO-5Wt" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="18" id="CaL-i2-ql2"/>
<constraint firstAttribute="bottom" secondItem="4rL-ti-mfn" secondAttribute="bottom" constant="61" id="DpK-EL-Z6i"/>
<constraint firstItem="4rL-ti-mfn" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="EAG-QZ-ddA"/>
<constraint firstItem="fSg-ii-Gn4" firstAttribute="top" secondItem="4rL-ti-mfn" secondAttribute="bottom" constant="13" id="Eba-U3-xgV"/>
<constraint firstAttribute="trailing" secondItem="0aw-rU-2w8" secondAttribute="trailing" constant="19" id="FLO-73-7b1"/>
<constraint firstItem="z4q-vO-5Wt" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="18" id="Ibg-pO-sAu"/>
<constraint firstItem="f9T-ak-TEq" firstAttribute="width" secondItem="fSg-ii-Gn4" secondAttribute="width" id="MD2-dC-LcZ"/>
<constraint firstItem="f9T-ak-TEq" firstAttribute="leading" secondItem="fSg-ii-Gn4" secondAttribute="trailing" constant="131" id="O5P-bH-hPu"/>
<constraint firstItem="0aw-rU-2w8" firstAttribute="leading" secondItem="z4q-vO-5Wt" secondAttribute="trailing" constant="168" id="Occ-s2-2SM"/>
<constraint firstItem="f9T-ak-TEq" firstAttribute="height" secondItem="fSg-ii-Gn4" secondAttribute="height" id="P02-TC-Nbq"/>
<constraint firstItem="z4q-vO-5Wt" firstAttribute="top" secondItem="14z-ZJ-5E3" secondAttribute="bottom" constant="91" id="P2w-XZ-nvT"/>
<constraint firstAttribute="trailing" secondItem="f9T-ak-TEq" secondAttribute="trailing" constant="65" id="Ubj-HW-uUA"/>
<constraint firstItem="fSg-ii-Gn4" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="64" id="YaH-SL-lIj"/>
<constraint firstItem="14z-ZJ-5E3" firstAttribute="top" secondItem="CGQ-Gi-Un9" secondAttribute="bottom" constant="99" id="beO-os-gtb"/>
......@@ -121,7 +123,7 @@
<constraint firstItem="14z-ZJ-5E3" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="134" id="ccO-gx-N8z"/>
<constraint firstItem="CGQ-Gi-Un9" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="18" id="eta-0d-eMW"/>
<constraint firstItem="14z-ZJ-5E3" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="19" id="gad-Bc-32l"/>
<constraint firstItem="z4q-vO-5Wt" firstAttribute="top" secondItem="14z-ZJ-5E3" secondAttribute="bottom" constant="91" id="hC3-WA-xfF"/>
<constraint firstItem="fSg-ii-Gn4" firstAttribute="top" secondItem="z4q-vO-5Wt" secondAttribute="bottom" constant="31" id="nCg-zX-rde"/>
<constraint firstItem="0aw-rU-2w8" firstAttribute="top" secondItem="14z-ZJ-5E3" secondAttribute="bottom" constant="84" id="q1e-rl-FWk"/>
<constraint firstAttribute="trailing" secondItem="14z-ZJ-5E3" secondAttribute="trailing" constant="19" id="q4q-Sl-q31"/>
<constraint firstItem="CGQ-Gi-Un9" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="11" id="t35-hH-3J6"/>
......
......@@ -108,7 +108,6 @@
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
NSLog(@"%@",[self.requestModel toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(CARDINFORMATION) WithRequestType:ZERO WithParameter:self.requestModel WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
......@@ -184,9 +183,19 @@
pop.sourceView = settlement.view;
settlement.cardModel = model.eCards[indexPath.row];
WS(weakSelf);
[settlement setRefreshJDCardList:^(BOOL boolValue) {
[settlement setRefreshJDCardList:^(BOOL boolValue,NSString *cardNumber) {
[weakSelf SHOWPrompttext:boolValue?@"领取成功":@"领取失败"];
[weakSelf.dontUseCardCollectionView.mj_header beginRefreshing];
for (GroupByOrderNumber *model in weakSelf.datasArray) {
for (TOJingdongEcardEntity *cardModel in model.eCards) {
if ([cardModel.cardNumber isEqualToString:cardNumber]) {
NSMutableArray *mutableCard = [NSMutableArray array];
[mutableCard addObjectsFromArray:model.eCards];
[mutableCard removeObject:cardModel];
model.eCards = (NSArray<TOJingdongEcardEntity>*)mutableCard;goto end;
}
}
}
end:NSLog(@"跳出");
[[NSNotificationCenter defaultCenter] postNotificationName:VIEWPASSWORD object:nil];
}];
[self presentViewController:settlement animated:YES completion:nil];
......
......@@ -308,22 +308,17 @@
#pragma mark -撤销订单
- (void)undoOrderButtonClick:(NSInteger)cellindex
{
__weak typeof(self) weakSelf = self;
WS(weakSelf);
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:@"请确认是否撤销订单" preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[weakSelf dismissViewControllerAnimated:YES completion:nil];
}]];
[alertVC addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
[alertVC addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[weakSelf CreateMBProgressHUDLoding];
OrderBill *model = [weakSelf.datasArray objectAtIndex_opple:cellindex];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:@"%@%@/%@/%@",SERVERREQUESTURL(RESETORDER),model.order.orderNumber,model.order.orderState,@"005"] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf dismissViewControllerAnimated:YES completion:nil];
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[weakSelf SuccessMBProgressView:@"撤销成功"];
model.order.orderState = @"005";
NSIndexPath *indexapath = [NSIndexPath indexPathForRow:cellindex inSection:0];
......@@ -336,13 +331,12 @@
} WithErrorCodeBlock:^(id errorCodeValue) {
[self RemoveMBProgressHUDLoding];
[self ErrorMBProgressView:@"无网络"];
} WithFailureBlock:^(id error) {
[self ErrorMBProgressView:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}]];
[self presentViewController:alertVC animated:YES completion:nil];
}
......
......@@ -138,7 +138,7 @@ NSString *const lotteryAction = @"lotteryAction";
[super viewDidLoad];
[self uiConfigAction];
[self getOrderDetailsData:NO issueJDECard:ZERO andGuideId:nil andOrderNumber:nil];
[self getOrderDetailsData:nil];
}
#pragma mark - UI
......@@ -157,7 +157,7 @@ NSString *const lotteryAction = @"lotteryAction";
}
#pragma mark -获取订单详情、查询促销信息、领取京东E卡
- (void)getOrderDetailsData:(BOOL)isReceiveJDECard issueJDECard:(NSInteger)denomation andGuideId:(NSString *)guideId andOrderNumber:(NSString *)orderNumber
- (void)getOrderDetailsData:(void(^)())finish
{
dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group);
......@@ -223,29 +223,12 @@ NSString *const lotteryAction = @"lotteryAction";
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
//** 发放京东E卡 */
if (isReceiveJDECard) {
dispatch_group_enter(group);
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(JDECARD),denomation,guideId,orderNumber] WithRequestType:0 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
dispatch_group_leave(group);
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[weakSelf showJEDCard];
}else{
[weakSelf ErrorMBProgressView:@"京东E卡领取失败"];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
dispatch_group_leave(group);
[weakSelf ErrorMBProgressView:NETWORK];
} WithFailureBlock:^(NSError *error) {
dispatch_group_leave(group);
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}
//** 完成后回调 */
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
if (finish) {
finish();
}
[weakSelf.orderDetailsTableview reloadData];
//默认弹出支付框
if (weakSelf.isShowPayButton && [weakSelf.orderDetails.order.orderState isEqualToString:@"001"]) {
......@@ -254,8 +237,31 @@ NSString *const lotteryAction = @"lotteryAction";
});
}
#pragma mark - 方法京东E卡
- (void)issueJDECard:(NSInteger)denomation andGuideId:(NSString *)guideId andOrderNumber:(NSString *)orderNumber
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(JDECARD),denomation,guideId,orderNumber] WithRequestType:0 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[weakSelf showJDECard];
}else{
[weakSelf ErrorMBProgressView:@"京东E卡领取失败"];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}
#pragma mark - 显示京东E卡
- (void)showJEDCard
- (void)showJDECard
{
WS(weakSelf);
JDEcardViewController *jdeCard = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"JDEcardViewController"];
......@@ -350,22 +356,29 @@ NSString *const lotteryAction = @"lotteryAction";
//支付成功
WS(weakSelf);
[settlement setPaySuccessReturnBlock:^{
[weakSelf SuccessMBProgressView:@"支付成功"];
weakSelf.isDelectedButton = NO;
weakSelf.isUserInteractionEnabled = NO;
[weakSelf CreateTableviewHeaderView];
//** 京东E卡 */
for (id object in weakSelf.luckyDrawAndJDECardArray) {
if ([object isKindOfClass:[PromotionalDeductionModel class]]) {
PromotionalDeductionModel *model = (PromotionalDeductionModel *)object;
if ([model.type isEqualToString:JDECardAction]) {
[weakSelf getOrderDetailsData:YES issueJDECard:model.total andGuideId:[Shoppersmanager manager].Shoppers.employee.fid andOrderNumber:self.orderCode];break;
[weakSelf SHOWPrompttext:@"支付成功" ComcpleteBlock:^{
weakSelf.isDelectedButton = NO;
weakSelf.isUserInteractionEnabled = NO;
[weakSelf CreateTableviewHeaderView];
[weakSelf getOrderDetailsData:^{
//** 京东E卡 */
NSInteger totalNumber = 0;//促销卡面额
for (id object in weakSelf.luckyDrawAndJDECardArray) {
if ([object isKindOfClass:[PromotionalDeductionModel class]]) {
PromotionalDeductionModel *model = (PromotionalDeductionModel *)object;
if ([model.type isEqualToString:JDECardAction]) {
totalNumber += model.total;
}
}
}
}
}
if (totalNumber) {
[weakSelf issueJDECard:totalNumber andGuideId:[Shoppersmanager manager].Shoppers.employee.fid andOrderNumber:self.orderCode];
}
}];
}];
//** 无促销的情况 */
if (self.luckyDrawAndJDECardArray.count == 0) {
[weakSelf getOrderDetailsData:NO issueJDECard:ZERO andGuideId:nil andOrderNumber:nil];
[weakSelf getOrderDetailsData:nil];
}
weakSelf.orderDetailsTableview.tableFooterView = nil;
if (weakSelf.DelecteAndPayButtonBlock) {
......
......@@ -151,25 +151,27 @@
#pragma mark -获取热门搜索数据
- (void)getHotSearchdatas
{
WS(weakSelf);
[self CreateMBProgressHUDLoding];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:SERVERREQUESTURL(HOTSEARCH) WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[self RemoveMBProgressHUDLoding];
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
self.response = [[HotFilter alloc]initWithDictionary:returnValue[@"data"] error:nil];
[self.hotCollectionView reloadData];
weakSelf.response = [[HotFilter alloc]initWithDictionary:returnValue[@"data"] error:nil];
[weakSelf.hotCollectionView reloadData];
}else
{
[self ErrorMBProgressView:returnValue[@"message"]];
[weakSelf ErrorMBProgressView:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[self RemoveMBProgressHUDLoding];
[self ErrorMBProgressView:@"无网络"];
} WithFailureBlock:^(id error) {
[self RemoveMBProgressHUDLoding];
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}
......@@ -201,21 +203,26 @@
{
if ([collectionView isEqual:self.hotCollectionView]) {
[self.localSearchArray addObject:[[self.response.list objectAtIndex_opple:indexPath.item] typeName]];
//调用商品控制器
ProductLibraryViewController *productVC = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"productlibrary"];
productVC.selectedCode = [[self.response.list objectAtIndex_opple:indexPath.item] typecode];
[self.navigationController pushViewController:productVC animated:NO];
NSString *typeName = [[self.response.list objectAtIndex_opple:indexPath.item] typeName];
if (![self.localSearchArray containsObject:typeName]) {
[self.localSearchArray addObject:[[self.response.list objectAtIndex_opple:indexPath.item] typeName]];
}
[self callProductControl:[[self.response.list objectAtIndex_opple:indexPath.item] typecode]];
}
else if ([collectionView isEqual:self.historyCollectionView])
{
//调用商品控制器
ProductLibraryViewController *productVC = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"productlibrary"];
productVC.selectedCode = [self.localSearchArray objectAtIndex_opple:indexPath.item];
[self.navigationController pushViewController:productVC animated:NO];
[self callProductControl:[self.localSearchArray objectAtIndex_opple:indexPath.item]];
}
}
#pragma mark - 调用商品控制器
- (void)callProductControl:(NSString *)codeString
{
ProductLibraryViewController *productVC = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"productlibrary"];
productVC.selectedCode = codeString;
[self.navigationController pushViewController:productVC animated:NO];
}
#pragma mark -释放
- (void)dealloc
{
......@@ -241,17 +248,8 @@
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -146,11 +146,11 @@
- (IBAction)addAddressButtonClick:(UIButton *)sender {
NSString *phoneNumber = self.PhoneNumber.text;
if (![BaseViewController isBlankString:self.recipientPerson.text]) {
if ([BaseViewController isBlankString:self.recipientPerson.text]) {
[self ErrorMBProgressView:@"请输入收货人姓名"];
return;
}
if ([BaseViewController isBlankString:phoneNumber] <= 0) {
if ([BaseViewController isBlankString:phoneNumber]) {
[self ErrorMBProgressView:@"手机号码不能为空"];
return;
}
......@@ -159,7 +159,7 @@
[self ErrorMBProgressView:@"手机号码格式不正确"];
return;
}
if (![BaseViewController isBlankString:self.detailsAddress.text]) {
if ([BaseViewController isBlankString:self.detailsAddress.text]) {
[self ErrorMBProgressView:@"请输入详细地址"];
return;
}
......
......@@ -23,6 +23,11 @@
*/
@property (nonatomic,strong) NSMutableArray *shopResponseArray;
/**
* 折扣比例输入
*/
@property (nonatomic,strong) UITextField *textField;
@end
......@@ -58,6 +63,7 @@
[self.shopResponseArray removeAllObjects];
[self InitializeState];
[self getShoppingCardata];
[self QueryShoppingCarNumber];
}
#pragma mark -视图即将消失
......@@ -95,6 +101,9 @@
#pragma mark -<UITextFieldDelegate>
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if (![textField isEqual:self.discountTextField]) {
return YES;
}
if (self.shopResponseArray.count == 0) {
[self ErrorMBProgressView:@"请先添加商品到购物车"];return NO;
}
......@@ -107,18 +116,47 @@
if (array.count == 0) {
[self ErrorMBProgressView:@"没有选中任何商品"];return NO;
}
return YES;
[self inputDiscountNumber];
return NO;
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
#pragma mark - 输入折扣金额
- (void)inputDiscountNumber
{
WS(weakSelf);
UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"提示" message:@"请输入折扣比例(%)" preferredStyle:UIAlertControllerStyleAlert];
[alertControl addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
weakSelf.textField.text = nil;
[weakSelf textFieldEndEditing];
}]];
[alertControl addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
weakSelf.textField = textField;
textField.placeholder = @"请输入";
textField.keyboardType = UIKeyboardTypeNumberPad;
textField.delegate = self;
}];
[alertControl addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[weakSelf textFieldEndEditing];
}]];
[self presentViewController:alertControl animated:YES completion:nil];
}
#pragma mark - 结束编辑
- (void)textFieldEndEditing
{
if ([BaseViewController isBlankString:self.textField.text]) {
return;
}
Shoppersmanager *user = [Shoppersmanager manager];
if ([textField.text integerValue] < [user.Shoppers.lowestDiscount integerValue] && textField.text.length)
if ([self.textField.text integerValue] < [user.Shoppers.lowestDiscount integerValue] && self.textField.text.length)
{
[self SHOWPrompttext:@"当前价格低于你的价格权限!"];return NO;
[self SHOWPrompttext:@"当前价格低于你的价格权限!"];
self.textField.text = nil;
}else {
self.discountTextField.text = self.textField.text;
[self unifiedChangeDiscount:self.textField.text];
}
[self unifiedChangeDiscount:textField.text];
return YES;
}
#pragma mark - 输入折扣比例
......@@ -134,10 +172,10 @@
if ([number isEqualToString:@""]) {
return YES;
}
if (self.discountTextField.text.length == 2) {
if (self.textField.text.length == 2) {
return NO;
}
if(self.discountTextField.text.length == 0 && [number isEqualToString:@"0"])
if(self.textField.text.length == 0 && [number isEqualToString:@"0"])
{
if([number isEqualToString:@"0"]){
return NO;
......@@ -161,6 +199,7 @@
- (void)unifiedChangeDiscount:(NSString *)discount
{
WS(weakSelf);
NSLog(@"----->%@",discount);
NSDecimalNumber *discountNumber = [NSDecimalNumber decimalNumberWithString:discount];
NSDecimalNumber *number = [discountNumber decimalNumberByDividingBy:[NSDecimalNumber decimalNumberWithString:@"100"]];
for (ShopcarModel *model in self.shopResponseArray) {
......
......@@ -308,8 +308,7 @@
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
//搜索
if ([BaseViewController isBlankString:textField.text]) {
if (![BaseViewController isBlankString:textField.text]) {
[textField resignFirstResponder];
//搜索
[[NSNotificationCenter defaultCenter] postNotificationName:SEARCHSTRING object:textField.text];
......
......@@ -13,7 +13,7 @@
<key>CFBundleName</key>
<string>欧立方</string>
<key>CFBundleShortVersionString</key>
<string>1.1.3</string>
<string>1.1.4</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
......
This diff is collapsed.
......@@ -75,7 +75,7 @@
#pragma mark -登陆超时回调
- (void)logintimeoutNotification:(NSNotification *)not
{
__weak typeof(self) weakSelf = self;
WS(weakSelf);
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"登陆超时,请重新登陆" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
[weakSelf dismissViewControllerAnimated:YES completion:nil];
......@@ -88,7 +88,7 @@
[weakSelf restoreRootViewController:loginVC];
}]];
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:alert animated:YES completion:nil];
[weakSelf presentViewController:alert animated:YES completion:nil];
});
}
......@@ -122,6 +122,7 @@
hud.labelText = Text;
hud.animationType = MBProgressHUDAnimationZoom;
hud.mode = MBProgressHUDModeText;
hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.6];
hud.removeFromSuperViewOnHide = YES;
[hud hide:YES afterDelay:1.0f];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
......@@ -193,11 +194,10 @@
}
#pragma mark -渐隐提示框
- (void)SHOWPrompttext:(NSString *)Text
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:SHARED_APPDELEGATE.window animated:YES];
hud.labelText = Text;
hud.margin = 10.f;
hud.color = [[UIColor blackColor] colorWithAlphaComponent:0.5];
......@@ -206,12 +206,9 @@
hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES;
[hud hide:YES afterDelay:1.0f];
}
#pragma mark -结束MJRfresh刷新
- (void)endRefreshingForTableView:(UIScrollView *)TableView
{
......
......@@ -1032,6 +1032,13 @@ NSString * const SORTDIRECTION_DESC = @"desc";
return YES;
}
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"typename": @"typeName",
}];
}
@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