Commit fb2ff498 by lee

bug fixs.

parent 7358e811
......@@ -11,6 +11,7 @@ target 'iCemarose' do
pod 'JRSwizzle'
pod 'RegexKitLite'
pod 'SAMKeychain'
pod 'RXCollections','~> 1.0'
pod 'AFNetworking','~> 2.6'
pod 'JSONModel','~> 1.2.0'
......
......@@ -69,6 +69,7 @@
80FBF7E18C063DB9E8DC7502 /* libPods-iCemarose.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 450DA8BB947651E9A9B38BEB /* libPods-iCemarose.a */; };
9B0F56B81ECD3424009FC5FE /* UIViewController+AppearLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0F56B71ECD3424009FC5FE /* UIViewController+AppearLog.m */; };
9B166F511ED6DBCF003E9F03 /* KWMHttpUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B166F501ED6DBCF003E9F03 /* KWMHttpUtil.m */; };
9B53D5D71EE94739005BA6F7 /* KWMValidateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B53D5D61EE94739005BA6F7 /* KWMValidateUtil.m */; };
9BE61CFB1ECD56E70031D21E /* KWMDictioaryResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE61CFA1ECD56E70031D21E /* KWMDictioaryResult.m */; };
9BE61CFE1ECD66BC0031D21E /* KWMShoppingCart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE61CFD1ECD66BC0031D21E /* KWMShoppingCart.m */; };
9BE61D011ECD71610031D21E /* KWMCartResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE61D001ECD71610031D21E /* KWMCartResult.m */; };
......@@ -389,6 +390,8 @@
9B0F56B71ECD3424009FC5FE /* UIViewController+AppearLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+AppearLog.m"; sourceTree = "<group>"; };
9B166F4F1ED6DBCF003E9F03 /* KWMHttpUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMHttpUtil.h; sourceTree = "<group>"; };
9B166F501ED6DBCF003E9F03 /* KWMHttpUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMHttpUtil.m; sourceTree = "<group>"; };
9B53D5D51EE94739005BA6F7 /* KWMValidateUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMValidateUtil.h; sourceTree = "<group>"; };
9B53D5D61EE94739005BA6F7 /* KWMValidateUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMValidateUtil.m; sourceTree = "<group>"; };
9B58353B797587723B0E7515 /* Pods-iCemarose.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iCemarose.debug.xcconfig"; path = "Pods/Target Support Files/Pods-iCemarose/Pods-iCemarose.debug.xcconfig"; sourceTree = "<group>"; };
9BE61CF91ECD56E70031D21E /* KWMDictionaryResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMDictionaryResult.h; sourceTree = "<group>"; };
9BE61CFA1ECD56E70031D21E /* KWMDictioaryResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMDictioaryResult.m; sourceTree = "<group>"; };
......@@ -1122,6 +1125,8 @@
C001BA5B1EB2ED5500B366A8 /* KWMImageBlurUtil.m */,
9B166F4F1ED6DBCF003E9F03 /* KWMHttpUtil.h */,
9B166F501ED6DBCF003E9F03 /* KWMHttpUtil.m */,
9B53D5D51EE94739005BA6F7 /* KWMValidateUtil.h */,
9B53D5D61EE94739005BA6F7 /* KWMValidateUtil.m */,
);
path = Util;
sourceTree = "<group>";
......@@ -2170,6 +2175,7 @@
C0CC140F1D7926DF007B5986 /* KWMBeforePayVC.m in Sources */,
C034E8441D6B10A0006EE129 /* NSObject+Extend.m in Sources */,
80A611B21D6DB0EC00709E09 /* KWMShopCartVC.m in Sources */,
9B53D5D71EE94739005BA6F7 /* KWMValidateUtil.m in Sources */,
9B0F56B81ECD3424009FC5FE /* UIViewController+AppearLog.m in Sources */,
C034E8451D6B10A0006EE129 /* NSString+Extend.m in Sources */,
805C04381DD1FA7100ACC071 /* KWMBrandsTypeResult.m in Sources */,
......
......@@ -41,6 +41,8 @@
@property (weak, nonatomic) IBOutlet UILabel *lbTotalPrice;
@property (weak, nonatomic) IBOutlet UILabel *lbOrderStatus;
@property (nonatomic) NSInteger lineCount;
@property (nonatomic) NSInteger markSection;
......
......@@ -55,6 +55,15 @@
_order = order;
_lbOrderNum.text = [NSString stringWithFormat:@"订单 %@",order.identifier ? order.identifier.stringValue:@""];
_lbTotalPrice.text = [NSString stringWithFormat:@"%@",[KWMStringUtil getEUR2CNYstring:order.totalPrice]];
__block NSInteger fulfilledCount = 0;
[order.lineItems enumerateObjectsUsingBlock:^(BUYLineItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.fulfilledValue) {
fulfilledCount += 1;
}
}];
NSString *fulfillmentStatus = fulfilledCount == 0 ? @"待发货" : fulfilledCount == order.lineItems.count ? @"已发货" : @"部分发货";
self.lbOrderStatus.text = fulfillmentStatus;
}
}
......
......@@ -62,6 +62,12 @@
<action selector="onClickCancelOrder:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="YmH-fe-6Fr"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="订单状态:待发货" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0P3-hV-rZy">
<rect key="frame" x="146" y="8.5" width="94.5" height="18.5"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
......@@ -76,6 +82,8 @@
<constraint firstItem="Dek-dY-0pj" firstAttribute="top" secondItem="AZR-1t-dC0" secondAttribute="top" constant="4" id="c6N-fx-KqC"/>
<constraint firstAttribute="trailing" secondItem="j8B-sN-dbR" secondAttribute="trailing" constant="27" id="clH-J2-ZBI"/>
<constraint firstAttribute="bottom" secondItem="j8B-sN-dbR" secondAttribute="bottom" constant="10" id="lJZ-N9-8Qr"/>
<constraint firstItem="0P3-hV-rZy" firstAttribute="leading" secondItem="jGI-UQ-mqY" secondAttribute="trailing" constant="20" id="oJ4-js-huG"/>
<constraint firstItem="0P3-hV-rZy" firstAttribute="centerY" secondItem="jGI-UQ-mqY" secondAttribute="centerY" id="qEz-3Z-emY"/>
<constraint firstAttribute="trailing" secondItem="Dek-dY-0pj" secondAttribute="trailing" constant="28" id="rRa-ew-Y9e"/>
</constraints>
<variation key="default">
......@@ -175,6 +183,7 @@
<outlet property="ivImage" destination="nIn-Ka-NkB" id="F8N-SG-EIk"/>
<outlet property="lbName" destination="McB-3J-L1c" id="4EG-Sy-vfA"/>
<outlet property="lbOrderNum" destination="jGI-UQ-mqY" id="VhR-UG-Yfj"/>
<outlet property="lbOrderStatus" destination="0P3-hV-rZy" id="5s4-9F-nxf"/>
<outlet property="lbPrice" destination="z2N-M1-Gfa" id="Yv1-fo-azz"/>
<outlet property="lbSize" destination="gA4-v1-va1" id="AOK-wS-nua"/>
<outlet property="lbTotalPrice" destination="j8B-sN-dbR" id="Cvb-47-4VG"/>
......
......@@ -116,7 +116,6 @@
if(!arr){
return orderCell;
}
BUYLineItem *lineItem = [arr objectAtIndex:indexPath.row];
orderCell.lineItem = lineItem;
//当前section行数
......
......@@ -19,6 +19,7 @@
#import "UIColor+SAMAdditions.h"
#import <RegexKitLite/RegexKitLite.h>
#import "KWMHttpUtil.h"
#import "KWMValidateUtil.h"
@interface KWMBeforePayVC ()
......@@ -57,6 +58,47 @@
}
}
- (void)kwm_setAddress:(BUYAddress *)address {
if (!address) {
self.checkout.billingAddress = nil;
self.checkout.shippingAddress = nil;
[self initData];
return;
}
if (!self.checkout) {
self.address = address;
// viewWillAppear中已经调用了 initCheckOut
// [self initCheckOut];
return;
}
if(address.identifier.integerValue != self.checkout.billingAddress.identifier.integerValue){
if(address!=nil && [KWMStringUtil isEmpty:self.address.firstName]){
self.address.firstName = @"";
}
self.checkout.billingAddress = address;
self.checkout.shippingAddress = address;
[self showLoading];
__weak typeof(self) this = self;
[self.client updateCheckout:self.checkout completion:^(NSDictionary *dictionary, BUYCheckout *checkout, NSError *error) {
[this hideLoading];
if (error == nil && checkout) {
this.address = address;
this.checkout = checkout;
[this showToast:@"更新地址成功"];
[this initData];
// [this.userDao saveCheckoutCache:checkout.JSONDictionary];
}
else {
[this showError:error];
// [self showToast:@"更新地址失败"];
NSLog(@"Error applying checkout: %@", error);
}
}];
}
}
//因为没有地址后进入的地址页面
-(void)kwm_getAddress:(BUYAddress *)address{
self.address = address;
......@@ -376,23 +418,28 @@
-(BOOL)checkAddress:(BUYAddress *)address{
if(address == nil){
[self showToast:@"您的地址尚未有任何地址,请前往选择地址"];
return YES;
}else if([KWMStringUtil isEmpty:address.firstName] && [KWMStringUtil isEmpty:address.lastName]){
[self showToast:@"您的地址缺少收件人姓名,请前往完善地址"];
return YES;
}else if([KWMStringUtil isEmpty:address.city]){
[self showToast:@"您的地址缺少所在城市,请前往完善地址"];
return YES;
}else if([KWMStringUtil isEmpty:address.zip]){
[self showToast:@"您的地址缺少邮政编码,请前往完善地址"];
return YES;
}else if([KWMStringUtil isEmpty:address.phone]){
[self showToast:@"您的地址缺少收件人电话号码,请前往完善地址"];
return YES;
}
return NO;
NSString *errorMsg = [KWMValidateUtil validateAddress:address];
if (errorMsg) {
[self showToast:errorMsg];
}
return errorMsg != nil;
// if(address == nil){
// [self showToast:@"您的地址尚未有任何地址,请前往选择地址"];
// return YES;
// }else if([KWMStringUtil isEmpty:address.firstName] && [KWMStringUtil isEmpty:address.lastName]){
// [self showToast:@"您的地址缺少收件人姓名,请前往完善地址"];
// return YES;
// }else if([KWMStringUtil isEmpty:address.city]){
// [self showToast:@"您的地址缺少所在城市,请前往完善地址"];
// return YES;
// }else if([KWMStringUtil isEmpty:address.zip]){
// [self showToast:@"您的地址缺少邮政编码,请前往完善地址"];
// return YES;
// }else if([KWMStringUtil isEmpty:address.phone]){
// [self showToast:@"您的地址缺少收件人电话号码,请前往完善地址"];
// return YES;
// }
// return NO;
}
......@@ -459,6 +506,7 @@
[this requestShippingData];
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[this hideLoading];
[this showError:error];
}];
}
......
......@@ -20,6 +20,13 @@
//订单如果生成成功,则更新订单,并返回该订单
- (void)kwm_selectAddress:(BUYCheckout *)checkout;
/**
* 这里只是一个地址选择 不应该去关心过多的业务 至于后面要怎么样和这个页面无关
*
* @param address <#address description#>
*/
- (void)kwm_setAddress:(BUYAddress *) address;
@end
@interface KWMSelectAddressVC : KWMBasePageVC<KWMAddressCellDelegate,KWMDeleteDelegate,KWMCancelDelegate>
......
......@@ -12,6 +12,7 @@
#import "KWMBeforePayVC.h"
#import "KWMStringUtil.h"
#import "UIViewController+BackButtonHandler.h"
#import "KWMValidateUtil.h"
@interface KWMSelectAddressVC ()
......@@ -178,46 +179,54 @@
}
- (void)updateCheckAddress:(BUYAddress *)address{
[self showLoading];
if(self.checkout == nil){
if(self.delegate != nil){
[self.delegate kwm_getAddress:address];
}
return;
}
if(address == nil){
self.checkout.billingAddress = nil;
self.checkout.shippingAddress = nil;
if(self.delegate != nil){
[self.delegate kwm_selectAddress:self.checkout];
}
return;
}
if(address.identifier.integerValue != self.checkout.billingAddress.identifier.integerValue){
if(address!=nil && [KWMStringUtil isEmpty:self.address.firstName]){
self.address.firstName = @"";
}
self.checkout.billingAddress = address;
self.checkout.shippingAddress = address;
[self showLoading];
[self.client updateCheckout:self.checkout completion:^(NSDictionary *dictionary, BUYCheckout *checkout, NSError *error) {
[self hideLoading];
if (error == nil && checkout) {
self.checkout = checkout;
if(self.delegate != nil){
[self.delegate kwm_selectAddress:checkout];
}
[self showToast:@"更新地址成功"];
[self.navigationController popViewControllerAnimated:YES];
}
else {
[self showError:error];
// [self showToast:@"更新地址失败"];
NSLog(@"Error applying checkout: %@", error);
}
}];
NSString *errorMsg = [KWMValidateUtil validateAddress:address];
if (!errorMsg) {
[self.delegate kwm_setAddress:address];
[self.navigationController popViewControllerAnimated:YES];
}else{
[self showToast:errorMsg];
}
// if(self.checkout == nil){
// if(self.delegate != nil){
// [self.delegate kwm_getAddress:address];
// }
// return;
// }
// if(address == nil){
// self.checkout.billingAddress = nil;
// self.checkout.shippingAddress = nil;
// if(self.delegate != nil){
// [self.delegate kwm_selectAddress:self.checkout];
// }
// return;
// }
// if(address.identifier.integerValue != self.checkout.billingAddress.identifier.integerValue){
// if(address!=nil && [KWMStringUtil isEmpty:self.address.firstName]){
// self.address.firstName = @"";
// }
// self.checkout.billingAddress = address;
// self.checkout.shippingAddress = address;
//
// [self showLoading];
// [self.client updateCheckout:self.checkout completion:^(NSDictionary *dictionary, BUYCheckout *checkout, NSError *error) {
// [self hideLoading];
// if (error == nil && checkout) {
// self.checkout = checkout;
// if(self.delegate != nil){
// [self.delegate kwm_selectAddress:checkout];
// }
// [self showToast:@"更新地址成功"];
// [self.navigationController popViewControllerAnimated:YES];
// }
// else {
// [self showError:error];
//// [self showToast:@"更新地址失败"];
// NSLog(@"Error applying checkout: %@", error);
// }
// }];
// }
}
//删除地址API
......
//
// KWMValidateUtil.h
// iCemarose
//
// Created by lee on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Mobile-Buy-SDK/Buy/BUYAddress.h>
@interface KWMValidateUtil : NSObject
/**
* 验证地址信息
*
* @param address <#address description#>
*
* @return 返回错误信息如果返回nil说明没问题
*/
+ (NSString *) validateAddress:(BUYAddress *) address;
@end
//
// KWMValidateUtil.m
// iCemarose
//
// Created by lee on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMValidateUtil.h"
#import "KWMStringUtil.h"
@implementation KWMValidateUtil
+ (NSString *)validateAddress:(BUYAddress *)address {
if(address == nil){
return @"您的地址尚未有任何地址,请前往选择地址";
}else if([KWMStringUtil isEmpty:address.firstName] && [KWMStringUtil isEmpty:address.lastName]){
return @"您的地址缺少收件人姓名,请前往完善地址";
}else if([KWMStringUtil isEmpty:address.city]){
return @"您的地址缺少所在城市,请前往完善地址";
}else if([KWMStringUtil isEmpty:address.zip]){
return @"您的地址缺少邮政编码,请前往完善地址";
}else if([KWMStringUtil isEmpty:address.phone]){
return @"您的地址缺少收件人电话号码,请前往完善地址";
}
return nil;
}
@end
......@@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2017060617</string>
<string>2017060817</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
......
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