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
8d5eb243
Commit
8d5eb243
authored
Jul 14, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wishlist逻辑调整
parent
050f30f1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
16 deletions
+56
-16
KWMBaseVC.h
iCemarose/Class/UI/KWMBaseVC.h
+1
-0
KWMBaseVC.m
iCemarose/Class/UI/KWMBaseVC.m
+15
-0
KWMNewHomeVC.m
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
+3
-0
KWMNewProductVC.m
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
+7
-6
KWMVariantsVC.m
iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
+13
-1
KWMWishListVC.m
iCemarose/Class/UI/NewProduct/KWMWishListVC.m
+16
-9
NewProduct.storyboard
iCemarose/Class/UI/NewProduct/NewProduct.storyboard
+1
-0
No files found.
iCemarose/Class/UI/KWMBaseVC.h
View file @
8d5eb243
...
...
@@ -46,6 +46,7 @@
-
(
void
)
reLoadData
;
-
(
void
)
loadData
;
-
(
BOOL
)
checkLogin
;
-
(
void
)
transparentNavigationBar
;
-
(
void
)
unTransparentNavigationBar
;
...
...
iCemarose/Class/UI/KWMBaseVC.m
View file @
8d5eb243
...
...
@@ -16,6 +16,8 @@
#import "PSPDFAlertView.h"
#import "KWMStringUtil.h"
#import "KWMSuperLoadingView.h"
#import "KWMLoginVC.h"
#import "KWMUserModel.h"
@interface
KWMBaseVC
()
...
...
@@ -287,6 +289,19 @@
NSAssert
(
NO
,
@"调用尚未实现的方法"
);
}
-
(
BOOL
)
checkLogin
{
KWMUserModel
*
user
=
[
KWMUserModel
shareUser
];
if
(
user
.
status
!=
1
)
{
//登录
KWMLoginVC
*
loginVc
=
(
KWMLoginVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMLoginVC
kwmTag
]
fromStoryboard
:
@"Login"
];
UINavigationController
*
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
loginVc
];
[
self
presentViewController
:
nav
animated
:
YES
completion
:
nil
];
return
NO
;
}
else
{
return
YES
;
}
}
//显示错误信息
-
(
void
)
showError
:
(
NSError
*
)
error
{
if
([
error
.
domain
isEqualToString
:
NSURLErrorDomain
])
{
...
...
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
View file @
8d5eb243
...
...
@@ -164,6 +164,9 @@ typedef enum{
-
(
void
)
kwm_onClickWishMenu
{
NSLog
(
@"wishmenu"
);
if
(
!
[
self
checkLogin
]){
return
;
}
KWMWishListVC
*
vc
=
(
KWMWishListVC
*
)[
KWMBaseVC
findControllerBy
:[
KWMWishListVC
kwmTag
]
fromStoryboard
:
@"NewProduct"
];
[
self
.
navigationController
pushViewController
:
vc
animated
:
YES
];
}
...
...
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
View file @
8d5eb243
...
...
@@ -62,8 +62,8 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
productId
=
@
(
7436196294
);
self
.
product
=
nil
;
//
self.productId = @(7436196294);
//
self.product = nil;
[
self
initView
];
}
...
...
@@ -452,7 +452,7 @@
__weak
KWMNewProductVC
*
weakSelf
=
self
;
NSDictionary
*
customerDict
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"customer"
];
BUYCustomer
*
customer
=
[[
BUYCustomer
alloc
]
initWithModelManager
:
self
.
client
.
modelManager
JSONDictionary
:
customerDict
];
BUYProductVariant
*
variant
=
self
.
detailView1
.
variant
;
BUYProductVariant
*
variant
=
self
.
variant
;
if
(
!
customer
||
!
variant
){
return
;
}
...
...
@@ -521,16 +521,17 @@
if
(
!
customer
||
!
self
.
variant
){
return
;
}
BUYProduct
*
product
=
(
self
.
color
&&
self
.
color
.
product
)?
self
.
color
.
product
:
self
.
product
;
NSDictionary
*
parament
=
@{
@"customer_id"
:
customer
.
identifier
.
stringValue
,
@"customer_email"
:
customer
.
email
,
@"customer_name"
:
customer
.
lastName
,
@"product_title"
:
self
.
product
.
title
,
@"product_id"
:
self
.
product
.
identifier
.
stringValue
,
@"product_title"
:
product
.
title
,
@"product_id"
:
product
.
identifier
.
stringValue
,
@"variant_id"
:
self
.
variant
.
identifier
.
stringValue
,
@"variant_sku"
:
self
.
variant
.
sku
,
@"variant_title"
:
self
.
variant
.
title
,
@"product_handle"
:
self
.
product
.
handle
,
@"product_handle"
:
product
.
handle
,
@"shop"
:
Shopify_SHOP_DOMAIN
};
void
(
^
failure
)(
NSURLSessionDataTask
*
,
NSError
*
)
=
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
){
...
...
iCemarose/Class/UI/NewProduct/KWMVariantsVC.m
View file @
8d5eb243
...
...
@@ -26,6 +26,8 @@
@property
(
nonatomic
)
IBOutlet
UILabel
*
lbCount
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIView
*
vCount
;
@property
(
nonatomic
)
NSInteger
count
;
@property
(
nonatomic
)
NSDecimalNumber
*
totalPrice
;
...
...
@@ -140,6 +142,7 @@
if
(
self
.
selectVariant
){
self
.
totalPrice
=
[
self
.
selectVariant
.
price
decimalNumberByMultiplyingBy
:[
NSDecimalNumber
decimalNumberWithDecimal
:
@
(
self
.
count
).
decimalValue
]];
}
self
.
vCount
.
hidden
=
self
.
wish
?
YES
:
NO
;
self
.
lbCount
.
text
=
[
NSString
stringWithFormat
:
@"%ld"
,(
long
)
self
.
count
];
self
.
lbPrice
.
text
=
[[
KWMCurrencyUtil
sharedInstance
]
priceFormatted
:
self
.
totalPrice
];
}
...
...
@@ -193,10 +196,13 @@
* @param sender <#sender description#>
*/
-
(
IBAction
)
onClickComplete
:
(
UIButton
*
)
sender
{
if
(
self
.
selectVariant
==
nil
||
self
.
count
==
0
)
{
if
(
self
.
selectVariant
==
nil
)
{
[
self
showToast
:
@"请选择您想要的规格"
];
return
;
}
if
(
self
.
count
<=
0
&&
self
.
wish
){
[
self
showToast
:
@"商品数量不能为0"
];
}
//购物车页面
if
([
self
.
delegate
respondsToSelector
:
@selector
(
kwm_addShopWithVariantId
:
quantity
:
variant
:
buyNow
:
callback
:
)]){
__weak
id
this
=
self
;
...
...
@@ -387,6 +393,12 @@
if
(
variant
&&
self
.
selectVariant
){
return
[
variant
.
identifier
isEqualToNumber
:
self
.
selectVariant
.
identifier
];
};
if
(
variant
&&
self
.
wish
&&
!
self
.
selectVariant
){
if
([
variant
.
identifier
isEqualToNumber
:
self
.
wish
.
variantId
]){
self
.
selectVariant
=
variant
;
return
YES
;
}
}
return
NO
;
}
...
...
iCemarose/Class/UI/NewProduct/KWMWishListVC.m
View file @
8d5eb243
...
...
@@ -44,18 +44,24 @@
-
(
void
)
initView
{
self
.
title
=
@"我喜欢的"
;
[
self
.
tbvWish
registerNib
:[
UINib
nibWithNibName
:
NSStringFromClass
([
KWMWishCell
class
])
bundle
:
nil
]
forCellReuseIdentifier
:
NSStringFromClass
([
KWMWishCell
class
])];
self
.
wishArray
=
[
NSMutableArray
array
];
self
.
productArray
=
[
NSMutableArray
array
];
[
self
setTotalPrice
];
}
-
(
void
)
removeWish
:
(
NSNumber
*
)
variantId
{
for
(
KWMWish
*
wish
in
self
.
wishArray
){
NSInteger
removeIndex
=
-
1
;
for
(
NSInteger
i
=
0
;
i
<
self
.
wishArray
.
count
;
i
++
){
KWMWish
*
wish
=
[
self
.
wishArray
objectAtIndex
:
i
];
if
([
wish
.
variantId
isEqualToNumber
:
variantId
]){
[
self
.
wishArray
removeObject
:
wish
];
removeIndex
=
i
;
break
;
}
}
if
(
removeIndex
!=
-
1
){
[
self
.
wishArray
removeObjectAtIndex
:
removeIndex
];
[
self
.
tbvWish
reloadData
];
}
}
//计算总价格
...
...
@@ -73,7 +79,7 @@
}
#pragma mark --KWMVariantsVCDelegate
-
(
void
)
kwm_setVariant
:
(
KWMVariantsVC
*
)
variantsVC
variant
:
(
BUYProductVariant
*
)
variant
{
-
(
void
)
kwm_setVariant
:
(
KWMVariantsVC
*
)
variantsVC
variant
:
(
BUYProductVariant
*
)
variant
color
:
(
KWMColor
*
)
color
count
:
(
NSInteger
)
count
{
for
(
KWMWish
*
wish
in
self
.
wishArray
){
if
([
wish
.
variantId
isEqualToNumber
:
variantsVC
.
wish
.
variantId
]){
wish
.
variantId
=
variant
.
identifier
;
...
...
@@ -176,11 +182,11 @@
#pragma mark-- KWMAPIManager
-
(
void
)
requestWishList
{
__weak
KWMWishListVC
*
weakSelf
=
self
;
NSDictionary
*
customerDict
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"customer"
];
BUYCustomer
*
customer
=
[[
BUYCustomer
alloc
]
initWithModelManager
:
self
.
client
.
modelManager
JSONDictionary
:
customerDict
];
if
(
!
customer
){
if
(
!
[
self
checkLogin
]){
return
;
}
NSDictionary
*
customerDict
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"customer"
];
BUYCustomer
*
customer
=
[[
BUYCustomer
alloc
]
initWithModelManager
:
self
.
client
.
modelManager
JSONDictionary
:
customerDict
];
NSDictionary
*
parament
=
@{
@"customer_id"
:
customer
.
identifier
.
stringValue
,
@"customer_email"
:
customer
.
email
,
...
...
@@ -193,8 +199,9 @@
void
(
^
success
)(
NSURLSessionDataTask
*
,
KWMAdditionalListResult
*
)
=
^
(
NSURLSessionDataTask
*
task
,
KWMAdditionalListResult
*
result
){
[
weakSelf
hideLoading
];
if
(
result
&&
result
.
data
){
NSMutableArray
*
wishArray
=
(
NSMutableArray
*
)
result
.
data
;
weakSelf
.
wishArray
=
wishArray
;
NSArray
*
wishArray
=
(
NSArray
*
)
result
.
data
;
[
weakSelf
.
wishArray
removeAllObjects
];
[
weakSelf
.
wishArray
addObjectsFromArray
:
wishArray
];
[
weakSelf
.
tbvWish
reloadData
];
[
weakSelf
requestProductsApi
];
}
...
...
iCemarose/Class/UI/NewProduct/NewProduct.storyboard
View file @
8d5eb243
...
...
@@ -509,6 +509,7 @@
<outlet
property=
"lbCount"
destination=
"GZ8-oT-VCl"
id=
"LiQ-6e-76f"
/>
<outlet
property=
"lbPrice"
destination=
"0UA-fW-OwV"
id=
"ifJ-78-Kc8"
/>
<outlet
property=
"vContentHeight"
destination=
"YBc-tS-Vne"
id=
"qU7-CX-T7w"
/>
<outlet
property=
"vCount"
destination=
"zhl-Qy-ueI"
id=
"DHl-4S-o3l"
/>
</connections>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"MKE-1G-zhs"
userLabel=
"First Responder"
sceneMemberID=
"firstResponder"
/>
...
...
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