Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ios1x
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
ios1x
Commits
5aa0904e
Commit
5aa0904e
authored
Jun 30, 2017
by
lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
u
parent
2d878d7a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
33 deletions
+65
-33
KWMShoppingCart.h
iCemarose/Class/Model/KWMShoppingCart.h
+2
-0
KWMShoppingCart.m
iCemarose/Class/Model/KWMShoppingCart.m
+23
-1
KWMProductDetailView.m
iCemarose/Class/UI/Product/Cell/KWMProductDetailView.m
+29
-28
KWMBeforePayVC.m
iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
+8
-2
KWMCurrencyUtil.m
iCemarose/Class/Util/KWMCurrencyUtil.m
+2
-1
Header-Prefix.h
iCemarose/Header-Prefix.h
+1
-1
No files found.
iCemarose/Class/Model/KWMShoppingCart.h
View file @
5aa0904e
...
@@ -30,4 +30,6 @@ typedef void(^ShoppingCartCallBack) (NSError *error,KWMCartResult *cart);
...
@@ -30,4 +30,6 @@ typedef void(^ShoppingCartCallBack) (NSError *error,KWMCartResult *cart);
-
(
void
)
deleteProductWithVariantId
:(
NSNumber
*
)
variantId
callback
:
(
ShoppingCartCallBack
)
callback
;
-
(
void
)
deleteProductWithVariantId
:(
NSNumber
*
)
variantId
callback
:
(
ShoppingCartCallBack
)
callback
;
-
(
void
)
clearCartWithCallback
:(
ShoppingCartCallBack
)
callback
;
@end
@end
iCemarose/Class/Model/KWMShoppingCart.m
View file @
5aa0904e
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#import "KWMCartResult.h"
#import "KWMCartResult.h"
#import "KWMShopCartData.h"
#import "KWMShopCartData.h"
#import <RegexKitLite/RegexKitLite.h>
#import <RegexKitLite/RegexKitLite.h>
#import <RXCollections/RXCollection.h>
@interface
KWMShoppingCart
()
@interface
KWMShoppingCart
()
...
@@ -142,7 +143,7 @@
...
@@ -142,7 +143,7 @@
// callback(error,nil);
// callback(error,nil);
}];
}];
[
self
addTasksObject
:
task
];
[
self
addTasksObject
:
task
];
for
(
int
i
=
0
;
i
<
quantites
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
quantites
.
count
&&
self
.
items
.
count
;
i
++
)
{
[
self
changeLocalCartWithVariantId
:
variantIds
[
i
]
quantity
:
quantites
[
i
].
integerValue
flag
:
quantites
[
i
].
integerValue
?
2
:
0
];
[
self
changeLocalCartWithVariantId
:
variantIds
[
i
]
quantity
:
quantites
[
i
].
integerValue
flag
:
quantites
[
i
].
integerValue
?
2
:
0
];
}
}
callback
(
nil
,
self
.
result
);
callback
(
nil
,
self
.
result
);
...
@@ -152,6 +153,27 @@
...
@@ -152,6 +153,27 @@
[
self
changeProductWithVariantId
:
variantId
quantity
:
0
callback
:
callback
];
[
self
changeProductWithVariantId
:
variantId
quantity
:
0
callback
:
callback
];
}
}
-
(
void
)
clearCartWithCallback
:
(
ShoppingCartCallBack
)
callback
{
NSMutableArray
*
quantity
=
[
NSMutableArray
new
];
NSArray
*
ids
=
[
self
.
items
rx_mapWithBlock
:
^
id
(
KWMShopCartModel
*
each
)
{
[
quantity
addObject
:
@
(
0
)];
return
each
.
identifier
;
}];
[
self
setResult
:[
KWMCartResult
new
]];
__weak
typeof
(
self
)
this
=
self
;
id
task
=
[[
KWMAPIManager
sharedManager
]
updateProductWithVariantIds
:
ids
quantities
:
quantity
success
:^
(
NSURLSessionDataTask
*
task
,
KWMCartResult
*
result
)
{
[
this
missionCompleted
];
// if (version == this.version) {
[[
KWMShoppingCart
sharedInstance
]
setResult
:
result
];
callback
(
nil
,
result
);
// }
}
failure
:^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
)
{
[
this
missionCompleted
];
callback
(
error
,
nil
);
}];
[
self
addTasksObject
:
task
];
}
-
(
KWMCartResult
*
)
changeLocalCartWithVariantId
:
(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
flag
:
(
NSInteger
)
flag
{
-
(
KWMCartResult
*
)
changeLocalCartWithVariantId
:
(
NSNumber
*
)
variantId
quantity
:
(
NSInteger
)
quantity
flag
:
(
NSInteger
)
flag
{
NSMutableArray
<
KWMShopCartModel
*>
*
items
=
self
.
items
;
NSMutableArray
<
KWMShopCartModel
*>
*
items
=
self
.
items
;
NSInteger
count
=
self
.
result
.
item_count
.
integerValue
;
NSInteger
count
=
self
.
result
.
item_count
.
integerValue
;
...
...
iCemarose/Class/UI/Product/Cell/KWMProductDetailView.m
View file @
5aa0904e
...
@@ -184,8 +184,9 @@
...
@@ -184,8 +184,9 @@
[
self
.
btnBrand
setTitle
:
product
.
vendor
forState
:
UIControlStateNormal
];
[
self
.
btnBrand
setTitle
:
product
.
vendor
forState
:
UIControlStateNormal
];
self
.
lbName
.
text
=
product
.
title
;
self
.
lbName
.
text
=
product
.
title
;
BUYProductVariant
*
productVariant
=
product
.
variants
.
firstObject
;
BUYProductVariant
*
productVariant
=
product
.
variants
.
firstObject
;
NSAttributedString
*
detailAttr
=
[[
NSAttributedString
alloc
]
initWithData
:[
self
.
product
.
htmlDescription
dataUsingEncoding
:
NSUnicodeStringEncoding
]
options
:@{
NSDocumentTypeDocumentAttribute
:
NSHTMLTextDocumentType
}
documentAttributes
:
nil
error
:
nil
];
// 2017-06-30 暂时注释
self
.
lbDetail
.
attributedText
=
detailAttr
;
// NSAttributedString *detailAttr = [[NSAttributedString alloc] initWithData:[self.product.htmlDescription dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
// self.lbDetail.attributedText = detailAttr;
// self.lbPrice.text = [KWMStringUtil getEUR2CNYstring:productVariant.price];
// self.lbPrice.text = [KWMStringUtil getEUR2CNYstring:productVariant.price];
self
.
lbPrice
.
text
=
productVariant
.
price
.
priceValueFormatted
;
self
.
lbPrice
.
text
=
productVariant
.
price
.
priceValueFormatted
;
if
(
productVariant
.
compareAtPrice
)
{
if
(
productVariant
.
compareAtPrice
)
{
...
@@ -222,32 +223,32 @@
...
@@ -222,32 +223,32 @@
}
}
-
(
void
)
onClickPrice
:
(
UITapGestureRecognizer
*
)
tapGesture
{
-
(
void
)
onClickPrice
:
(
UITapGestureRecognizer
*
)
tapGesture
{
if
(
self
.
product
==
nil
){
//
if(self.product == nil){
return
;
//
return;
}
//
}
self
.
isShowCNY
=
!
self
.
isShowCNY
;
//
self.isShowCNY = !self.isShowCNY;
BUYProductVariant
*
productVariant
=
self
.
product
.
variants
.
firstObject
;
//
BUYProductVariant *productVariant= self.product.variants.firstObject;
if
(
self
.
isShowCNY
){
//
if(self.isShowCNY){
self
.
lbUnit
.
text
=
@"¥"
;
//
self.lbUnit.text = @"¥";
// self.lbPrice.text = [KWMStringUtil getEUR2CNYstring:productVariant.price];
//
//
self.lbPrice.text = [KWMStringUtil getEUR2CNYstring:productVariant.price];
self
.
lbPrice
.
text
=
productVariant
.
price
.
priceValueFormatted
;
//
self.lbPrice.text = productVariant.price.priceValueFormatted;
if
(
productVariant
.
compareAtPrice
)
{
//
if (productVariant.compareAtPrice) {
// NSString *priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
//
//
NSString *priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
NSString
*
priceString
=
productVariant
.
compareAtPrice
.
priceValueFormatted
;
//
NSString *priceString = productVariant.compareAtPrice.priceValueFormatted;
NSDictionary
*
attribtDic
=
@{
NSStrikethroughStyleAttributeName
:
[
NSNumber
numberWithInteger
:
NSUnderlineStyleSingle
]};
//
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString
*
attribtStr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
priceString
attributes
:
attribtDic
];
//
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic];
self
.
lbOldPrice
.
attributedText
=
attribtStr
;
//
self.lbOldPrice.attributedText = attribtStr;
}
//
}
}
else
{
//
}else{
self
.
lbUnit
.
text
=
@"€"
;
//
self.lbUnit.text = @"€";
self
.
lbPrice
.
text
=
productVariant
.
price
.
stringValue
;
//
self.lbPrice.text = productVariant.price.stringValue;
if
(
productVariant
.
compareAtPrice
)
{
//
if (productVariant.compareAtPrice) {
NSString
*
priceString
=
[
NSString
stringWithFormat
:
@"€%@"
,
productVariant
.
compareAtPrice
.
stringValue
];
//
NSString *priceString = [NSString stringWithFormat:@"€%@",productVariant.compareAtPrice.stringValue];
NSDictionary
*
attribtDic
=
@{
NSStrikethroughStyleAttributeName
:
[
NSNumber
numberWithInteger
:
NSUnderlineStyleSingle
]};
//
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString
*
attribtStr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
priceString
attributes
:
attribtDic
];
//
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic];
self
.
lbOldPrice
.
attributedText
=
attribtStr
;
//
self.lbOldPrice.attributedText = attribtStr;
}
//
}
}
//
}
}
}
...
...
iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
View file @
5aa0904e
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#import "KWMValidateUtil.h"
#import "KWMValidateUtil.h"
#import "KWMPayUtil.h"
#import "KWMPayUtil.h"
#import "KWMShopCartData.h"
#import "KWMShopCartData.h"
#import "KWMShoppingCart.h"
@interface
KWMBeforePayVC
()
@interface
KWMBeforePayVC
()
@property
(
nonatomic
)
BUYCustomer
*
customer
;
@property
(
nonatomic
)
BUYCustomer
*
customer
;
...
@@ -719,8 +720,13 @@
...
@@ -719,8 +720,13 @@
-
(
void
)
clearCheckout
{
-
(
void
)
clearCheckout
{
self
.
cartCookie
=
nil
;
self
.
cartCookie
=
nil
;
[
KWMHttpUtil
deleteCookie
:
@"cart"
];
[[
KWMShoppingCart
sharedInstance
]
clearCartWithCallback
:
^
(
NSError
*
error
,
KWMCartResult
*
cart
)
{
[[
KWMShopCartData
alloc
]
removeAllItems
];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[
KWMHttpUtil
deleteCookie
:
@"cart"
];
// });
}];
// [KWMHttpUtil deleteCookie:@"cart"];
// [[KWMShopCartData alloc] removeAllItems];
[
self
.
userDao
deleteCheckoutCache
];
[
self
.
userDao
deleteCheckoutCache
];
}
}
...
...
iCemarose/Class/Util/KWMCurrencyUtil.m
View file @
5aa0904e
...
@@ -71,7 +71,8 @@
...
@@ -71,7 +71,8 @@
-
(
NSDecimalNumber
*
)
calcPriceByCurrencyCode
:
(
NSDecimalNumber
*
)
price
{
-
(
NSDecimalNumber
*
)
calcPriceByCurrencyCode
:
(
NSDecimalNumber
*
)
price
{
if
([[
self
getCurrencyCode
]
isEqualToString
:
@"CNY"
])
{
if
([[
self
getCurrencyCode
]
isEqualToString
:
@"CNY"
])
{
NSDecimalNumber
*
rate
=
[[
KWMUserDao
shareDao
]
exchangeRate
];
NSDecimalNumber
*
rate
=
[[
KWMUserDao
shareDao
]
exchangeRate
];
price
=
[[
rate
decimalNumberByMultiplyingBy
:
price
]
decimalNumberByMultiplyingBy
:[
NSDecimalNumber
decimalNumberWithString
:
@"1.03"
]];
// price = [[rate decimalNumberByMultiplyingBy:price] decimalNumberByMultiplyingBy:[NSDecimalNumber decimalNumberWithString:@"1.03"]];
price
=
[
rate
decimalNumberByMultiplyingBy
:
price
];
}
}
return
price
;
return
price
;
}
}
...
...
iCemarose/Header-Prefix.h
View file @
5aa0904e
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
#define Shopify_SHOP_DOMAIN @"cemarose.myshopify.com"
#define Shopify_SHOP_DOMAIN @"cemarose.myshopify.com"
#define Shopify_API_KEY @"c2f6fae97741ea6db4cad7ae8f70fef3"
#define Shopify_API_KEY @"c2f6fae97741ea6db4cad7ae8f70fef3"
#define Shopify_APP_ID @"8"
#define Shopify_APP_ID @"8"
#end
#end
if
//软键盘输入限制
//软键盘输入限制
#define NUM @"0123456789"
#define NUM @"0123456789"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment