Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
Opple-iOS
Project
Project
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
张杰
Opple-iOS
Commits
065f1661
Commit
065f1661
authored
Aug 08, 2016
by
曹云霄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
727ada4c
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
323 additions
and
355 deletions
+323
-355
AllCustomerViewController.m
Lighting/Class/AllCustomerViewController.m
+16
-16
ChangePasswordViewController.m
Lighting/Class/ChangePasswordViewController.m
+9
-8
ClientViewController.m
Lighting/Class/ClientViewController.m
+9
-13
ClientdetailsViewController.m
Lighting/Class/ClientdetailsViewController.m
+35
-26
CustomerOrderViewController.m
Lighting/Class/CustomerOrderViewController.m
+14
-15
LoginViewController.m
Lighting/Class/Login/LoginViewController.m
+20
-19
OrderdetailsViewController.h
Lighting/Class/OrderdetailsViewController.h
+0
-5
OrderdetailsViewController.m
Lighting/Class/OrderdetailsViewController.m
+0
-3
ProductDetailsViewController.m
Lighting/Class/ProductDetailsViewController.m
+9
-28
ProductLibraryViewController.m
Lighting/Class/ProductLibraryViewController.m
+25
-25
SceneLibraryViewController.m
Lighting/Class/SceneLibraryViewController.m
+17
-15
SettlementViewController.m
Lighting/Class/SettlementViewController.m
+7
-6
AddressViewController.m
Lighting/Class/Shoppingcart/AddressViewController.m
+38
-36
GenerateOrdersViewController.m
Lighting/Class/Shoppingcart/GenerateOrdersViewController.m
+10
-9
ShoppingTableViewCell.h
Lighting/Class/Shoppingcart/ShoppingTableViewCell.h
+2
-2
ShoppingTableViewCell.m
Lighting/Class/Shoppingcart/ShoppingTableViewCell.m
+14
-23
ShoppingViewController.m
Lighting/Class/Shoppingcart/ShoppingViewController.m
+51
-67
UserViewController.m
Lighting/Class/UserViewController.m
+18
-17
project.pbxproj
Lighting/Lighting.xcodeproj/project.pbxproj
+6
-6
PrefixHeader.pch
Lighting/Tools/PrefixHeader.pch
+8
-2
SceneViewController.m
Lighting/Tools/SceneViewController.m
+3
-3
ShoppingBagViewController.m
Lighting/Tools/ShoppingBagViewController.m
+12
-11
No files found.
Lighting/Class/AllCustomerViewController.m
View file @
065f1661
...
...
@@ -108,8 +108,6 @@
self
.
enddateButton
.
layer
.
masksToBounds
=
YES
;
self
.
enddateButton
.
layer
.
cornerRadius
=
10
;
//经销商代码
self
.
conditionModel
.
resellerCodeEquals
=
[[
Shoppersmanager
manager
].
Shoppers
.
employee
.
currentDepart
orgCode
];
//下拉刷新
MjRefreshHeaderCustom
*
headerRefresh
=
[
MjRefreshHeaderCustom
headerWithRefreshingBlock
:
^
{
DataPage
*
page
=
[[
DataPage
alloc
]
init
];
...
...
@@ -117,6 +115,8 @@
page
.
rows
=
KROWS
;
self
.
conditionModel
.
page
=
page
;
[
self
.
allCustomerTableview
.
mj_footer
resetNoMoreData
];
//经销商代码
self
.
conditionModel
.
resellerCodeEquals
=
[[
Shoppersmanager
manager
].
Shoppers
.
employee
.
currentDepart
orgCode
];
[
self
getShoppersAssociatedCustomer
:
self
.
conditionModel
isRemove
:
YES
];
}];
headerRefresh
.
stateLabel
.
hidden
=
YES
;
...
...
@@ -145,20 +145,20 @@
#pragma mark -获取导购关联客户
-
(
void
)
getShoppersAssociatedCustomer
:
(
ConsumerQueryCondition
*
)
condition
isRemove
:
(
BOOL
)
remove
{
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
GETSHOPPERSCONSUMER
)
WithRequestType
:
0
WithParameter
:
condition
WithReturnValueBlock
:^
(
id
returnValue
)
{
self
.
allCustomerTableview
.
emptyDataSetSource
=
s
elf
;
self
.
allCustomerTableview
.
emptyDataSetDelegate
=
s
elf
;
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
endRefreshingForTableView
:
self
.
allCustomerTableview
];
weakSelf
.
allCustomerTableview
.
emptyDataSetSource
=
weakS
elf
;
weakSelf
.
allCustomerTableview
.
emptyDataSetDelegate
=
weakS
elf
;
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
endRefreshingForTableView
:
self
.
allCustomerTableview
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
if
(
remove
)
{
[
s
elf
.
CustomerresultArray
removeAllObjects
];
[
weakS
elf
.
CustomerresultArray
removeAllObjects
];
}
ConsumerPageResult
*
Customerresult
=
[[
ConsumerPageResult
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
s
elf
.
totalPages
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
weakS
elf
.
totalPages
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
for
(
TOConsumerEntity
*
objc
in
Customerresult
.
results
)
{
MyclientEntityModel
*
myclientModel
=
[[
MyclientEntityModel
alloc
]
init
];
...
...
@@ -177,24 +177,24 @@
myclientModel
.
company
=
objc
.
company
;
myclientModel
.
lastVisitedTime
=
objc
.
lastVisitedTime
;
[
s
elf
.
CustomerresultArray
addObject
:
myclientModel
];
[
weakS
elf
.
CustomerresultArray
addObject
:
myclientModel
];
}
[
s
elf
.
allCustomerTableview
reloadData
];
[
weakS
elf
.
allCustomerTableview
reloadData
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
self
endRefreshingForTableView
:
s
elf
.
allCustomerTableview
];
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
allCustomerTableview
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
Lighting/Class/ChangePasswordViewController.m
View file @
065f1661
...
...
@@ -83,28 +83,29 @@
modify
.
employeeId
=
[
Shoppersmanager
manager
].
Shoppers
.
employee
.
fid
;
//修改密码
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
MODIFYPASSWORD
)
WithRequestType
:
0
WithParameter
:
modify
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
//保存最新的账号信息
[
Shoppersmanager
manager
].
passWordString
=
s
elf
.
NewPassWord
.
text
;
[
s
elf
SuccessMBProgressView
:
returnValue
[
@"message"
]];
if
([
s
elf
.
delegate
respondsToSelector
:
@selector
(
cancelButtonClick
)])
{
[
Shoppersmanager
manager
].
passWordString
=
weakS
elf
.
NewPassWord
.
text
;
[
weakS
elf
SuccessMBProgressView
:
returnValue
[
@"message"
]];
if
([
weakS
elf
.
delegate
respondsToSelector
:
@selector
(
cancelButtonClick
)])
{
[
s
elf
.
delegate
cancelButtonClick
];
[
weakS
elf
.
delegate
cancelButtonClick
];
}
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
...
...
Lighting/Class/ClientViewController.m
View file @
065f1661
...
...
@@ -55,20 +55,20 @@
{
if
(
!
_condition
)
{
_condition
=
[[
ConsumerQueryCondition
alloc
]
init
];
DataPage
*
page
=
[[
DataPage
alloc
]
init
];
page
.
sort
=
@"createDate"
;
page
.
order
=
@"desc"
;
self
.
condition
.
page
=
page
;
}
return
_condition
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
[
self
uiConfigAction
];
}
-
(
void
)
viewDidAppear
:
(
BOOL
)
animated
{
[
super
viewDidAppear
:
animated
];
...
...
@@ -117,15 +117,13 @@
//清空当前客户数据
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
ChangeCustomerName
:
)
name
:
@"EMPTYCUSTOMERNAME"
object
:
nil
];
__weak
typeof
(
self
)
weakSelf
=
self
;
WS
(
weakSelf
)
;
//下拉刷新
MjRefreshHeaderCustom
*
headerRefresh
=
[
MjRefreshHeaderCustom
headerWithRefreshingBlock
:
^
{
weakSelf
.
condition
.
resellerCodeEquals
=
[
Shoppersmanager
manager
].
Shoppers
.
employee
.
currentDepart
.
orgCode
;
DataPage
*
page
=
[[
DataPage
alloc
]
init
];
page
.
page
=
1
;
weakSelf
.
condition
.
page
=
page
;
page
.
rows
=
KROWS
;
weakSelf
.
condition
.
page
.
page
=
1
;
weakSelf
.
condition
.
page
.
rows
=
KROWS
;
weakSelf
.
indexPage
=
1
;
[
weakSelf
.
informationTableview
.
mj_footer
resetNoMoreData
];
[
weakSelf
getShoppersAssociatedCustomer
:
weakSelf
.
condition
isRemoveArray
:
YES
];
...
...
@@ -142,10 +140,8 @@
[
weakSelf
.
informationTableview
.
mj_footer
endRefreshingWithNoMoreData
];
}
else
{
DataPage
*
page
=
[[
DataPage
alloc
]
init
];
page
.
page
=
weakSelf
.
indexPage
;
page
.
rows
=
KROWS
;
weakSelf
.
condition
.
page
=
page
;
weakSelf
.
condition
.
page
.
page
=
weakSelf
.
indexPage
;
weakSelf
.
condition
.
page
.
rows
=
KROWS
;
[
weakSelf
getShoppersAssociatedCustomer
:
weakSelf
.
condition
isRemoveArray
:
NO
];
}
}];
...
...
Lighting/Class/ClientdetailsViewController.m
View file @
065f1661
...
...
@@ -179,7 +179,7 @@
}
else
if
(
self
.
orderRecordButton
.
selected
)
//订单记录
{
if
(
++
self
.
orderRecordPage
>
self
.
orderRecordTotalPage
)
{
if
(
++
self
.
orderRecordPage
>
self
.
orderRecordTotalPage
)
{
[
self
.
ClientdetailsTableview
.
mj_footer
endRefreshingWithNoMoreData
];
}
else
{
...
...
@@ -273,6 +273,13 @@
orderdetails
.
isDelectedButton
=
YES
;
orderdetails
.
isShowPrintButton
=
YES
;
}
//撤销、支付回调
[
orderdetails
setDelecteAndPayButtonBlock
:
^
(
NSInteger
cellindex
,
NSString
*
orderSate
)
{
OrderBill
*
model
=
[
self
.
orderRecordArray
objectAtIndex_opple
:
cellindex
];
model
.
order
.
orderState
=
orderSate
;
NSIndexPath
*
indexapath
=
[
NSIndexPath
indexPathForRow
:
cellindex
inSection
:
0
];
[
self
.
ClientdetailsTableview
reloadRowsAtIndexPaths
:@[
indexapath
]
withRowAnimation
:
UITableViewRowAnimationNone
];
}];
[
self
.
navigationController
pushViewController
:
orderdetails
animated
:
YES
];
}
}
...
...
@@ -283,19 +290,20 @@
-
(
void
)
getShoppingCardata
:
(
ShopCartFilter
*
)
shopCar
isRemove
:
(
BOOL
)
remove
{
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
SHOPPINGBAG
)
WithRequestType
:
0
WithParameter
:
shopCar
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
self
endRefreshingForTableView
:
s
elf
.
ClientdetailsTableview
];
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
ClientdetailsTableview
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
if
(
remove
)
{
[
s
elf
.
shopResponseArray
removeAllObjects
];
[
weakS
elf
.
shopResponseArray
removeAllObjects
];
}
ShopCartResponse
*
shopcar
=
[[
ShopCartResponse
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
s
elf
.
shoppingBagTotalPage
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
weakS
elf
.
shoppingBagTotalPage
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
if
(
shopcar
.
shopcart
.
count
==
0
)
{
[
s
elf
PromptinformationViewWithimage
:
TCImage
(
@"ablum-副本"
)
withTitle
:
@"暂无购物袋信息~"
withpoint
:
CGPointMake
(
ScreenHeight
/
2
,
ScreenWidth
/
2
)];
[
self
endRefreshingForTableView
:
s
elf
.
ClientdetailsTableview
];
[
weakS
elf
PromptinformationViewWithimage
:
TCImage
(
@"ablum-副本"
)
withTitle
:
@"暂无购物袋信息~"
withpoint
:
CGPointMake
(
ScreenHeight
/
2
,
ScreenWidth
/
2
)];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
ClientdetailsTableview
];
}
//自定义属性
for
(
TOShopcartEntity
*
objc
in
shopcar
.
shopcart
)
{
...
...
@@ -313,21 +321,21 @@
model
.
goodsNum
=
objc
.
goodsNum
;
model
.
consumerId
=
objc
.
consumerId
;
[
s
elf
.
shopResponseArray
addObject
:
model
];
[
weakS
elf
.
shopResponseArray
addObject
:
model
];
}
[
s
elf
.
ClientdetailsTableview
reloadData
];
[
weakS
elf
.
ClientdetailsTableview
reloadData
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
@@ -337,36 +345,37 @@
-
(
void
)
getGuideAllcustomerOrder
:
(
OrderFilter
*
)
allOrder
isRemove
:
(
BOOL
)
remove
{
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
QUERYORDER
)
WithRequestType
:
0
WithParameter
:
allOrder
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
self
endRefreshingForTableView
:
s
elf
.
ClientdetailsTableview
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
ClientdetailsTableview
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
if
(
remove
)
{
[
s
elf
.
orderRecordArray
removeAllObjects
];
[
weakS
elf
.
orderRecordArray
removeAllObjects
];
}
OrderResponse
*
Allorder
=
[[
OrderResponse
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
s
elf
.
orderRecordTotalPage
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
weakS
elf
.
orderRecordTotalPage
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
if
(
Allorder
.
orderBillList
.
count
==
0
)
{
[
s
elf
PromptinformationViewWithimage
:
TCImage
(
@"changjingtubiao"
)
withTitle
:
@"暂无订单信息~"
withpoint
:
CGPointMake
(
ScreenHeight
/
2
,
ScreenWidth
/
2
)];
[
s
elf
RemoveMBProgressHUDLoding
];
[
self
endRefreshingForTableView
:
s
elf
.
ClientdetailsTableview
];
[
weakS
elf
PromptinformationViewWithimage
:
TCImage
(
@"changjingtubiao"
)
withTitle
:
@"暂无订单信息~"
withpoint
:
CGPointMake
(
ScreenHeight
/
2
,
ScreenWidth
/
2
)];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
ClientdetailsTableview
];
}
for
(
OrderBill
*
model
in
Allorder
.
orderBillList
)
{
[
s
elf
.
orderRecordArray
addObject
:
model
];
[
weakS
elf
.
orderRecordArray
addObject
:
model
];
}
[
s
elf
.
ClientdetailsTableview
reloadData
];
[
weakS
elf
.
ClientdetailsTableview
reloadData
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
Lighting/Class/CustomerOrderViewController.m
View file @
065f1661
...
...
@@ -132,37 +132,37 @@
#pragma mark -获取导购下客户订单 ----isdelecte 表示是否清空数组
-
(
void
)
getGuideAllcustomerOrder
:
(
BOOL
)
isdelecte
WithorderBill
:
(
OrderFilter
*
)
allOrder
{
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
QUERYORDER
)
WithRequestType
:
0
WithParameter
:
allOrder
WithReturnValueBlock
:^
(
id
returnValue
)
{
self
.
customerOrderTableView
.
emptyDataSetSource
=
s
elf
;
self
.
customerOrderTableView
.
emptyDataSetDelegate
=
s
elf
;
[
s
elf
RemoveMBProgressHUDLoding
];
[
self
endRefreshingForTableView
:
s
elf
.
customerOrderTableView
];
weakSelf
.
customerOrderTableView
.
emptyDataSetSource
=
weakS
elf
;
weakSelf
.
customerOrderTableView
.
emptyDataSetDelegate
=
weakS
elf
;
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
customerOrderTableView
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
if
(
isdelecte
)
{
[
s
elf
.
datasArray
removeAllObjects
];
[
weakS
elf
.
datasArray
removeAllObjects
];
}
OrderResponse
*
Allorder
=
[[
OrderResponse
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
s
elf
.
totalPages
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
weakS
elf
.
totalPages
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
for
(
OrderBill
*
model
in
Allorder
.
orderBillList
)
{
[
s
elf
.
datasArray
addObject
:
model
];
[
weakS
elf
.
datasArray
addObject
:
model
];
}
[
s
elf
.
customerOrderTableView
reloadData
];
[
weakS
elf
.
customerOrderTableView
reloadData
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
self
endRefreshingForTableView
:
s
elf
.
customerOrderTableView
];
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
customerOrderTableView
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
@@ -359,7 +359,6 @@
orderdetails
.
isDelectedButton
=
YES
;
orderdetails
.
isShowPrintButton
=
YES
;
}
//撤销、支付回调
[
orderdetails
setDelecteAndPayButtonBlock
:
^
(
NSInteger
cellindex
,
NSString
*
orderSate
)
{
...
...
Lighting/Class/Login/LoginViewController.m
View file @
065f1661
...
...
@@ -164,36 +164,37 @@
LoginInfo
*
login
=
[[
LoginInfo
alloc
]
init
];
login
.
username
=
self
.
userName
.
text
;
login
.
password
=
self
.
passWord
.
text
;
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
LOGIN
)
WithRequestType
:
0
WithParameter
:
login
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
//保持导购信息
LoginResult
*
result
=
[[
LoginResult
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
[
Shoppersmanager
manager
].
Shoppers
=
result
;
[
Shoppersmanager
manager
].
userNameString
=
s
elf
.
userName
.
text
;
[
Shoppersmanager
manager
].
passWordString
=
s
elf
.
passWord
.
text
;
[
Shoppersmanager
manager
].
userNameString
=
weakS
elf
.
userName
.
text
;
[
Shoppersmanager
manager
].
passWordString
=
weakS
elf
.
passWord
.
text
;
//保存用户名密码
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
s
elf
.
userName
.
text
forKey
:
USERNAME
];
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
s
elf
.
passWord
.
text
forKey
:
PASSWORD
];
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
weakS
elf
.
userName
.
text
forKey
:
USERNAME
];
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
weakS
elf
.
passWord
.
text
forKey
:
PASSWORD
];
[[
NSUserDefaults
standardUserDefaults
]
synchronize
];
[
s
elf
SetTheRootViewController
];
[
weakS
elf
SetTheRootViewController
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"网络中断"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"网络中断"
];
}
WithFailureBlock
:^
(
NSError
*
error
)
{
[
s
elf
ErrorMBProgressView
:
error
.
localizedDescription
];
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
error
.
localizedDescription
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
@@ -428,26 +429,26 @@
passwrod
.
fnewPassword
=
self
.
resetPasswordView
.
newpass
.
text
;
passwrod
.
username
=
self
.
userName
.
text
;
passwrod
.
smsCode
=
self
.
identityView
.
verificationCode
.
text
;
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
RESETPASSWORD
)
WithRequestType
:
0
WithParameter
:
passwrod
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
[
s
elf
ErrorMBProgressView
:
@"重置密码成功"
];
self
.
passWord
.
text
=
s
elf
.
resetPasswordView
.
newpass
.
text
;
[
s
elf
judgeUserNameAndPassword
];
[
weakS
elf
ErrorMBProgressView
:
@"重置密码成功"
];
weakSelf
.
passWord
.
text
=
weakS
elf
.
resetPasswordView
.
newpass
.
text
;
[
weakS
elf
judgeUserNameAndPassword
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
NSError
*
error
)
{
[
s
elf
ErrorMBProgressView
:
error
.
localizedDescription
];
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
error
.
localizedDescription
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
Lighting/Class/OrderdetailsViewController.h
View file @
065f1661
...
...
@@ -51,16 +51,11 @@
*/
@property
(
nonatomic
,
assign
)
BOOL
isDelectedButton
;
/**
* 撤销按钮、支付按钮完成回调
*/
@property
(
nonatomic
,
copy
)
void
(
^
DelecteAndPayButtonBlock
)(
NSInteger
cellindex
,
NSString
*
orderState
);
/**
* cell下标
*/
...
...
Lighting/Class/OrderdetailsViewController.m
View file @
065f1661
...
...
@@ -449,17 +449,14 @@
{
[
self
CreateMBProgressHUDLoding
];
[[
NetworkRequestClassManager
Manager
]
NetworkWithDictionaryRequestWithURL
:[
NSString
stringWithFormat
:
@"%@%@/%@/%@"
,
SERVERREQUESTURL
(
RESETORDER
),
_orderCode
,
@"001"
,
@"005"
]
WithRequestType
:
1
WithParameter
:
nil
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
self
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
[
self
SuccessMBProgressView
:
@"撤销成功"
];
UIView
*
view
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
ScreenWidth
,
0
)];
self
.
orderDetailsTableview
.
tableHeaderView
=
view
;
self
.
orderDetailsTableview
.
tableFooterView
=
nil
;
self
.
orderDetails
.
order
.
orderState
=
@"005"
;
[
self
.
orderDetailsTableview
reloadData
];
if
(
self
.
DelecteAndPayButtonBlock
)
{
self
.
DelecteAndPayButtonBlock
(
_cellindex
,
@"005"
);
}
...
...
Lighting/Class/ProductDetailsViewController.m
View file @
065f1661
...
...
@@ -384,11 +384,11 @@
#pragma mark -开发加入购物车动画
-
(
void
)
StartAddShoppingCarAnimationWithimage
:
(
UIImage
*
)
image
withStartpoint
:
(
CGPoint
)
point
withSize
:
(
CGSize
)
size
{
//
//
起点
//起点
CGPoint
startPoint
=
point
;
//
//
终点
//终点
CGPoint
endPoint
=
SHARED_APPDELEGATE
.
shoppingCarPoint
;
//
//
控点
//控点
CGPoint
controlPoint
=
CGPointMake
(
endPoint
.
x
,
startPoint
.
x
);
...
...
@@ -463,33 +463,30 @@
[
self
ErrorMBProgressView
:
@"超过库存"
];
return
;
}
[
self
StartAddShoppingCarAnimationWithimage
:
self
.
headerView
.
goodsImageview
.
image
withStartpoint
:[
self
.
headerView
convertPoint
:[
self
.
headerView
.
goodsImageview
center
]
toView
:
self
.
view
.
window
]
withSize
:
self
.
headerView
.
goodsImageview
.
frame
.
size
];
SaveShoppingCartRequest
*
shopCar
=
[[
SaveShoppingCartRequest
alloc
]
init
];
shopCar
.
consumerId
=
[
Customermanager
manager
].
model
.
fid
;
shopCar
.
goodsId
=
_goodsID
;
shopCar
.
count
=
self
.
headerView
.
goodsNumber
.
text
;
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
ADDSHOPPINGBAG
)
WithRequestType
:
0
WithParameter
:
shopCar
WithReturnValueBlock
:^
(
id
returnValue
)
{
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
NSLog
(
@"添加购物车成功"
);
[
weakSelf
StartAddShoppingCarAnimationWithimage
:
weakSelf
.
headerView
.
goodsImageview
.
image
withStartpoint
:[
weakSelf
.
headerView
convertPoint
:[
weakSelf
.
headerView
.
goodsImageview
center
]
toView
:
weakSelf
.
view
.
window
]
withSize
:
weakSelf
.
headerView
.
goodsImageview
.
frame
.
size
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
self
RemoveMBProgressHUDLoding
];
[
self
ErrorMBProgressView
:
@"无网络"
];
[
weakSelf
RemoveMBProgressHUDLoding
];
[
weakSelf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
self
ErrorMBProgressView
:
@"添加购物车失败"
];
[
weakSelf
ErrorMBProgressView
:
@"添加购物车失败"
];
}];
}
#pragma mark -判断是否为纯数字
-
(
BOOL
)
isPureInt
:
(
NSString
*
)
string
{
NSScanner
*
scan
=
[
NSScanner
scannerWithString
:
string
];
...
...
@@ -498,26 +495,10 @@
}
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
-
(
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
Lighting/Class/ProductLibraryViewController.m
View file @
065f1661
...
...
@@ -172,33 +172,34 @@
-
(
void
)
getGoodsListdatas
:
(
GoodsCondition
*
)
conditon
returnResponse
:
(
void
(
^
)(
GoodsResponse
*
))
finish
{
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
PRODUCTLIST
)
WithRequestType
:
0
WithParameter
:
conditon
WithReturnValueBlock
:^
(
id
returnValue
)
{
self
.
productCollectionView
.
emptyDataSetSource
=
s
elf
;
self
.
productCollectionView
.
emptyDataSetDelegate
=
s
elf
;
[
self
endRefreshingForTableView
:
s
elf
.
productCollectionView
];
[
s
elf
RemoveMBProgressHUDLoding
];
weakSelf
.
productCollectionView
.
emptyDataSetSource
=
weakS
elf
;
weakSelf
.
productCollectionView
.
emptyDataSetDelegate
=
weakS
elf
;
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
productCollectionView
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
GoodsResponse
*
sponse
=
[[
GoodsResponse
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
s
elf
.
totalPages
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
weakS
elf
.
totalPages
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
//返回结果
finish
(
sponse
);
}
else
{
[
s
elf
ErrorMBProgressView
:
@"暂无数据"
];
[
weakS
elf
ErrorMBProgressView
:
@"暂无数据"
];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
ErrorMBProgressView
:
@"网络连接中断"
];
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"网络连接中断"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}
WithFailureBlock
:^
(
NSError
*
error
)
{
[
self
endRefreshingForTableView
:
s
elf
.
productCollectionView
];
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
error
.
localizedDescription
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
productCollectionView
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
error
.
localizedDescription
];
}];
}
...
...
@@ -422,28 +423,26 @@
TOGoodsEntity
*
model
=
[
self
.
datasArray
objectAtIndex_opple
:
indexPath
.
item
];
cell
.
model
=
model
;
cell
.
cellindex
=
indexPath
.
row
;
//加入购物车
__weak
typeof
(
self
)
weakSelf
=
self
;
WS
(
weakSelf
)
;
__weak
typeof
(
ProductCollectionViewCell
*
)
weakCell
=
cell
;
[
cell
setReturnCellCgpoint
:
^
void
(
CGPoint
centerPoint
,
NSInteger
cellindex
,
CGSize
size
)
{
//判断是否有当前客户
if
(
!
[
Shoppersmanager
manager
].
currentCustomer
)
{
[
s
elf
ErrorMBProgressView
:
@"必须设置当前客户"
];
[
weakS
elf
ErrorMBProgressView
:
@"必须设置当前客户"
];
return
;
}
//库存为0时不能加入购物车
if
(
model
.
number
>
=
0
)
{
[
s
elf
ErrorMBProgressView
:
@"此商品库存不足"
];
if
(
model
.
number
=
=
0
)
{
[
weakS
elf
ErrorMBProgressView
:
@"此商品库存不足"
];
return
;
}
TOGoodsEntity
*
model
=
[
s
elf
.
datasArray
objectAtIndex_opple
:
cellindex
];
[
s
elf
addGoodsShoppingbags
:
model
complate
:
^
{
TOGoodsEntity
*
model
=
[
weakS
elf
.
datasArray
objectAtIndex_opple
:
cellindex
];
[
weakS
elf
addGoodsShoppingbags
:
model
complate
:
^
{
NSLog
(
@"加入购物车完成"
);
}];
[
weakSelf
StartAddShoppingCarAnimationWithimage
:
weakCell
.
productImageView
.
image
withStartpoint
:
centerPoint
withSize
:
size
];
}];
}];
return
cell
;
}
...
...
@@ -451,11 +450,11 @@
#pragma mark -开发加入购物车动画
-
(
void
)
StartAddShoppingCarAnimationWithimage
:
(
UIImage
*
)
image
withStartpoint
:
(
CGPoint
)
point
withSize
:
(
CGSize
)
size
{
//起点
//起点
CGPoint
startPoint
=
point
;
//终点
//终点
CGPoint
endPoint
=
SHARED_APPDELEGATE
.
shoppingCarPoint
;
//控点
//控点
CGPoint
controlPoint
=
CGPointMake
(
endPoint
.
x
,
startPoint
.
x
);
UIImageView
*
imageView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
size
.
width
,
size
.
height
)];
...
...
@@ -744,6 +743,7 @@
shopCar
.
consumerId
=
[
Customermanager
manager
].
model
.
fid
;
shopCar
.
goodsId
=
model
.
fid
;
shopCar
.
count
=
@"1"
;
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
ADDSHOPPINGBAG
)
WithRequestType
:
0
WithParameter
:
shopCar
WithReturnValueBlock
:^
(
id
returnValue
)
{
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
...
...
@@ -752,13 +752,13 @@
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
ErrorMBProgressView
:
@"加入购物车失败"
];
[
weakS
elf
ErrorMBProgressView
:
@"加入购物车失败"
];
}];
}
...
...
Lighting/Class/SceneLibraryViewController.m
View file @
065f1661
...
...
@@ -166,20 +166,21 @@
#pragma mark -获取场景筛选数据
-
(
void
)
getdatasAction
{
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
SCENESCREENING
)
WithRequestType
:
1
WithParameter
:
nil
WithReturnValueBlock
:^
(
id
returnValue
)
{
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
s
elf
.
filter
=
[[
SceneFilter
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
weakS
elf
.
filter
=
[[
SceneFilter
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
}];
...
...
@@ -190,35 +191,36 @@
-
(
void
)
getSceneLibrarydatas
:
(
SceneCondition
*
)
condition
isRemove
:
(
BOOL
)
remove
{
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
SCENELIST
)
WithRequestType
:
0
WithParameter
:
condition
WithReturnValueBlock
:^
(
id
returnValue
)
{
self
.
seceneLibararyCollectionView
.
emptyDataSetSource
=
s
elf
;
self
.
seceneLibararyCollectionView
.
emptyDataSetDelegate
=
s
elf
;
[
self
endRefreshingForTableView
:
s
elf
.
seceneLibararyCollectionView
];
[
s
elf
RemoveMBProgressHUDLoding
];
weakSelf
.
seceneLibararyCollectionView
.
emptyDataSetSource
=
weakS
elf
;
weakSelf
.
seceneLibararyCollectionView
.
emptyDataSetDelegate
=
weakS
elf
;
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
seceneLibararyCollectionView
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
if
(
remove
)
{
[
s
elf
.
responseArray
removeAllObjects
];
[
weakS
elf
.
responseArray
removeAllObjects
];
}
SceneResponse
*
response
=
[[
SceneResponse
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
s
elf
.
totalPages
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
weakS
elf
.
totalPages
=
[
returnValue
[
@"data"
][
@"totalpages"
]
intValue
];
for
(
TOSceneEntity
*
model
in
response
.
list
)
{
[
s
elf
.
responseArray
addObject
:
model
];
[
weakS
elf
.
responseArray
addObject
:
model
];
}
[
s
elf
.
seceneLibararyCollectionView
reloadData
];
[
weakS
elf
.
seceneLibararyCollectionView
reloadData
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
self
endRefreshingForTableView
:
s
elf
.
seceneLibararyCollectionView
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
seceneLibararyCollectionView
];
}];
}
...
...
Lighting/Class/SettlementViewController.m
View file @
065f1661
...
...
@@ -327,22 +327,23 @@
order
.
billType
=
@"001"
;
}
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
CONFIRMPAY
)
WithRequestType
:
0
WithParameter
:
order
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
CreateMBProgressHUDLoding
];
[
weakS
elf
CreateMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
NSLog
(
@"支付成功"
);
[
s
elf
ErrorMBProgressView
:
@"支付成功"
];
if
(
s
elf
.
PaySuccessReturnBlock
)
{
s
elf
.
PaySuccessReturnBlock
();
[
weakS
elf
ErrorMBProgressView
:
@"支付成功"
];
if
(
weakS
elf
.
PaySuccessReturnBlock
)
{
weakS
elf
.
PaySuccessReturnBlock
();
}
[
s
elf
dismissViewControllerAnimated
:
YES
completion
:
nil
];
[
weakS
elf
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
id
error
)
{
NSLog
(
@"支付失败"
);
[
s
elf
CreateMBProgressHUDLoding
];
[
weakS
elf
CreateMBProgressHUDLoding
];
}];
}
...
...
Lighting/Class/Shoppingcart/AddressViewController.m
View file @
065f1661
...
...
@@ -186,44 +186,45 @@
}
address
.
address
=
self
.
detailsAddress
.
text
;
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
ADDADDRESS
)
WithRequestType
:
0
WithParameter
:
address
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
AddressModel
*
model
=
[[
AddressModel
alloc
]
init
];
model
.
name
=
s
elf
.
recipientPerson
.
text
;
model
.
miblephone
=
s
elf
.
PhoneNumber
.
text
;
if
([[
self
.
citySelected
currentTitle
]
isEqualToString
:
s
elf
.
provincesString
])
{
model
.
city
=
s
elf
.
citySelected
.
currentTitle
;
model
.
name
=
weakS
elf
.
recipientPerson
.
text
;
model
.
miblephone
=
weakS
elf
.
PhoneNumber
.
text
;
if
([[
weakSelf
.
citySelected
currentTitle
]
isEqualToString
:
weakS
elf
.
provincesString
])
{
model
.
city
=
weakS
elf
.
citySelected
.
currentTitle
;
model
.
province
=
nil
;
}
else
{
model
.
city
=
s
elf
.
citySelected
.
currentTitle
;
model
.
province
=
s
elf
.
provincesString
;
model
.
city
=
weakS
elf
.
citySelected
.
currentTitle
;
model
.
province
=
weakS
elf
.
provincesString
;
}
model
.
address
=
s
elf
.
detailsAddress
.
text
;
model
.
address
=
weakS
elf
.
detailsAddress
.
text
;
model
.
consumerId
=
[
Customermanager
manager
].
model
.
fid
;
model
.
fid
=
returnValue
[
@"data"
];
model
.
isSelected
=
NO
;
//增加地址
if
([
s
elf
.
delegate
respondsToSelector
:
@selector
(
addAddressCell
:)])
{
if
([
weakS
elf
.
delegate
respondsToSelector
:
@selector
(
addAddressCell
:)])
{
[
s
elf
.
delegate
addAddressCell
:
model
];
[
weakS
elf
.
delegate
addAddressCell
:
model
];
}
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
@@ -242,32 +243,32 @@
address
.
province
=
self
.
provincesString
;
}
address
.
fid
=
self
.
model
.
fid
;
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
CHANGEADDRESS
)
WithRequestType
:
0
WithParameter
:
address
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
self
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
AddressModel
*
model
=
[[
AddressModel
alloc
]
init
];
model
.
name
=
s
elf
.
recipientPerson
.
text
;
model
.
miblephone
=
s
elf
.
PhoneNumber
.
text
;
model
.
city
=
s
elf
.
citySelected
.
currentTitle
;
model
.
name
=
weakS
elf
.
recipientPerson
.
text
;
model
.
miblephone
=
weakS
elf
.
PhoneNumber
.
text
;
model
.
city
=
weakS
elf
.
citySelected
.
currentTitle
;
model
.
consumerId
=
[
Customermanager
manager
].
model
.
fid
;
model
.
province
=
self
.
provincesString
?
s
elf
.
provincesString
:
@""
;
model
.
fid
=
s
elf
.
model
.
fid
;
model
.
province
=
weakSelf
.
provincesString
?
weakS
elf
.
provincesString
:
@""
;
model
.
fid
=
weakS
elf
.
model
.
fid
;
model
.
isSelected
=
NO
;
//地址拼接
if
(
!
[
self
.
provincesString
isEqualToString
:[
s
elf
.
citySelected
currentTitle
]])
{
model
.
address
=
[
NSString
stringWithFormat
:
@"%@"
,
s
elf
.
detailsAddress
.
text
];
if
(
!
[
weakSelf
.
provincesString
isEqualToString
:[
weakS
elf
.
citySelected
currentTitle
]])
{
model
.
address
=
[
NSString
stringWithFormat
:
@"%@"
,
weakS
elf
.
detailsAddress
.
text
];
}
else
{
model
.
address
=
[
NSString
stringWithFormat
:
@"%@"
,
s
elf
.
detailsAddress
.
text
];
model
.
address
=
[
NSString
stringWithFormat
:
@"%@"
,
weakS
elf
.
detailsAddress
.
text
];
}
//修改地址
if
([
s
elf
.
delegate
respondsToSelector
:
@selector
(
ChangeAddresscell
:
Withcellindex
:
)])
{
if
([
weakS
elf
.
delegate
respondsToSelector
:
@selector
(
ChangeAddresscell
:
Withcellindex
:
)])
{
[
s
elf
.
delegate
ChangeAddresscell
:
model
Withcellindex
:
_cellindex
];
[
weakS
elf
.
delegate
ChangeAddresscell
:
model
Withcellindex
:
_cellindex
];
}
}
else
...
...
@@ -276,13 +277,13 @@
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
NSLog
(
@"%@"
,
error
);
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
@@ -305,27 +306,28 @@
-
(
void
)
deleteAddressButtonClick
{
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:[
NSString
stringWithFormat
:
@"%@%@"
,
SERVERREQUESTURL
(
REMOVEADDRESS
),
_model
.
fid
]
WithRequestType
:
1
WithParameter
:
nil
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
[
s
elf
SuccessMBProgressView
:
@"删除成功"
];
if
([
s
elf
.
delegate
respondsToSelector
:
@selector
(
delecteCell
:)])
{
[
weakS
elf
SuccessMBProgressView
:
@"删除成功"
];
if
([
weakS
elf
.
delegate
respondsToSelector
:
@selector
(
delecteCell
:)])
{
[
s
elf
.
delegate
delecteCell
:
_model
.
fid
];
[
weakS
elf
.
delegate
delecteCell
:
_model
.
fid
];
}
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
Lighting/Class/Shoppingcart/GenerateOrdersViewController.m
View file @
065f1661
...
...
@@ -409,8 +409,9 @@
orderReceiver
.
goodsNum
=
[
NSString
stringWithFormat
:
@"%ld"
,
allNumber
];
order
.
orderdetailList
=
(
NSArray
<
TOOrderdetailEntity
>
*
)
goodidArr
;
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
CREATEORDER
)
WithRequestType
:
0
WithParameter
:
order
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
//商品购物车id
NSMutableArray
*
codeArrray
=
[
NSMutableArray
array
];
...
...
@@ -418,26 +419,26 @@
[
codeArrray
addObject
:
model
.
fid
?
model
.
fid
:
@" "
];
}
//调用删除购物车
if
(
s
elf
.
DelecteSelectedGoods
)
{
s
elf
.
DelecteSelectedGoods
(
codeArrray
);
if
(
weakS
elf
.
DelecteSelectedGoods
)
{
weakS
elf
.
DelecteSelectedGoods
(
codeArrray
);
}
OrderdetailsViewController
*
orderDetails
=
[[
s
elf
getStoryboardWithName
]
instantiateViewControllerWithIdentifier
:
@"orderdetails"
];
OrderdetailsViewController
*
orderDetails
=
[[
weakS
elf
getStoryboardWithName
]
instantiateViewControllerWithIdentifier
:
@"orderdetails"
];
orderDetails
.
orderCode
=
returnValue
[
@"data"
];
orderDetails
.
sectionTitle
=
@[
@"订单信息"
,
@"客户信息"
,
@"收货信息"
,
@"商品清单"
];
orderDetails
.
isShowattachment
=
NO
;
orderDetails
.
isShowPayButton
=
YES
;
orderDetails
.
isSliding
=
YES
;
//取消滑动返回
[
s
elf
.
navigationController
pushViewController
:
orderDetails
animated
:
YES
];
[
weakS
elf
.
navigationController
pushViewController
:
orderDetails
animated
:
YES
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
return
;
}
...
...
Lighting/Class/Shoppingcart/ShoppingTableViewCell.h
View file @
065f1661
...
...
@@ -14,9 +14,9 @@
@optional
/**
* 当前商品数量、成交价
* 当前商品数量、成交价
,通过返回参数判断是否能修改
*/
-
(
void
)
ChangeGoodsNumber
:
(
int
)
goodsNumber
WithcostPrice
:
(
CGFloat
)
costprice
Withcellindex
:
(
NSInteger
)
cellindex
;
-
(
void
)
ChangeGoodsNumber
:
(
NSInteger
)
goodsNumber
WithcostPrice
:
(
CGFloat
)
costprice
Withcellindex
:
(
NSInteger
)
cellindex
returnValue
:
(
void
(
^
)(
id
value
))
result
;
@end
...
...
Lighting/Class/Shoppingcart/ShoppingTableViewCell.m
View file @
065f1661
...
...
@@ -50,15 +50,11 @@
//sender.tag == 100 减少
//sender.tag == 101 增加
NSLog
(
@"%ld"
,
sender
.
tag
);
NSInteger
goodsNumber
=
[
self
.
goodsNumbersLabe
.
text
integerValue
];
switch
(
sender
.
tag
)
{
case
100
:
//减少
{
if
(
goodsNumber
<=
1
)
{
if
(
self
.
promptStringBlock
)
{
self
.
promptStringBlock
(
@"个数不能小于1"
);
}
...
...
@@ -66,14 +62,12 @@
return
;
}
goodsNumber
--
;
self
.
goodsNumbersLabe
.
text
=
[
NSString
stringWithFormat
:
@"%ld"
,
goodsNumber
];
// self.goodsNumbersLabe.text = [NSString stringWithFormat:@"%ld",goodsNumber];
}
break
;
case
101
:
//增加
{
if
(
goodsNumber
>=
[
_model
.
goods
.
number
integerValue
])
{
//不能大于库存
if
(
self
.
promptStringBlock
)
{
self
.
promptStringBlock
(
@"个数不能大于库存"
);
...
...
@@ -81,18 +75,23 @@
return
;
}
goodsNumber
++
;
self
.
goodsNumbersLabe
.
text
=
[
NSString
stringWithFormat
:
@"%ld"
,
goodsNumber
];
// self.goodsNumbersLabe.text = [NSString stringWithFormat:@"%ld",goodsNumber];
}
break
;
default
:
break
;
}
//改变价格
WS
(
weakSelf
);
self
.
productPriceLabe
.
text
=
[
NSString
stringWithFormat
:
@"¥%.2f"
,[
self
.
goodsNumbersLabe
.
text
integerValue
]
*
[
self
.
clinchTextfield
.
text
floatValue
]];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
ChangeGoodsNumber
:
WithcostPrice
:
Withcellindex
:
)])
{
[
self
.
delegate
ChangeGoodsNumber
:[
self
.
goodsNumbersLabe
.
text
intValue
]
WithcostPrice
:[
self
.
clinchTextfield
.
text
floatValue
]
Withcellindex
:
_cellindex
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
ChangeGoodsNumber
:
WithcostPrice
:
Withcellindex
:
returnValue
:
)])
{
[
self
.
delegate
ChangeGoodsNumber
:
goodsNumber
WithcostPrice
:[
self
.
clinchTextfield
.
text
floatValue
]
Withcellindex
:
_cellindex
returnValue
:^
(
id
value
)
{
if
([
value
isKindOfClass
:[
NSDictionary
class
]])
{
if
([
value
[
@"code"
]
isEqualToNumber
:
@0
])
{
weakSelf
.
goodsNumbersLabe
.
text
=
[
NSString
stringWithFormat
:
@"%ld"
,
goodsNumber
];
}
}
}];
}
}
...
...
@@ -127,8 +126,9 @@
//改变价格
self
.
productPriceLabe
.
text
=
[
NSString
stringWithFormat
:
@"¥%.2f"
,[
self
.
goodsNumbersLabe
.
text
integerValue
]
*
[
textField
.
text
floatValue
]];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
ChangeGoodsNumber
:
WithcostPrice
:
Withcellindex
:
)])
{
[
self
.
delegate
ChangeGoodsNumber
:[
self
.
goodsNumbersLabe
.
text
intValue
]
WithcostPrice
:[
self
.
clinchTextfield
.
text
floatValue
]
Withcellindex
:
_cellindex
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
ChangeGoodsNumber
:
WithcostPrice
:
Withcellindex
:
returnValue
:
)])
{
[
self
.
delegate
ChangeGoodsNumber
:[
self
.
goodsNumbersLabe
.
text
integerValue
]
WithcostPrice
:[
self
.
clinchTextfield
.
text
floatValue
]
Withcellindex
:
_cellindex
returnValue
:^
(
id
value
)
{
}];
}
}
return
YES
;
...
...
@@ -144,13 +144,4 @@
-
(
void
)
setSelected
:
(
BOOL
)
selected
animated
:
(
BOOL
)
animated
{
[
super
setSelected
:
selected
animated
:
animated
];
// Configure the view for the selected state
}
@end
Lighting/Class/Shoppingcart/ShoppingViewController.m
View file @
065f1661
...
...
@@ -109,11 +109,12 @@
Newpage
.
rows
=
99999
;
shopcarNumber
.
dp
=
Newpage
;
[
self
CreateMBProgressHUDLoding
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
SHOPPINGBAG
)
WithRequestType
:
0
WithParameter
:
shopcarNumber
WithReturnValueBlock
:^
(
id
returnValue
)
{
self
.
shoppingTableview
.
emptyDataSetSource
=
s
elf
;
[
self
endRefreshingForTableView
:
s
elf
.
shoppingTableview
];
[
s
elf
RemoveMBProgressHUDLoding
];
weakSelf
.
shoppingTableview
.
emptyDataSetSource
=
weakS
elf
;
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
shoppingTableview
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
ShopCartResponse
*
shopcar
=
[[
ShopCartResponse
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
...
...
@@ -133,25 +134,24 @@
model
.
goodsNum
=
objc
.
goodsNum
;
model
.
consumerId
=
objc
.
consumerId
;
model
.
costPrice
=
objc
.
costPrice
;
[
s
elf
.
shopResponseArray
addObject
:
model
];
[
weakS
elf
.
shopResponseArray
addObject
:
model
];
}
[
s
elf
.
shoppingTableview
reloadData
];
[
weakS
elf
.
shoppingTableview
reloadData
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
self
endRefreshingForTableView
:
s
elf
.
shoppingTableview
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakSelf
endRefreshingForTableView
:
weakS
elf
.
shoppingTableview
];
}];
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
ShoppingTableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"Shopping"
forIndexPath
:
indexPath
];
...
...
@@ -167,7 +167,7 @@
}];
//提示框回调
[
cell
setPromptStringBlock
:
^
(
NSString
*
string
)
{
[
weakSelf
promptCustomerWithString
:
string
];
[
weakSelf
ErrorMBProgressView
:
string
];
}];
return
cell
;
}
...
...
@@ -232,7 +232,6 @@
[
self
ErrorMBProgressView
:
@"没有选中任何商品"
];
return
;
}
//商品总信息占位
ShopcarModel
*
ZhanweiModel
=
[[
ShopcarModel
alloc
]
init
];
[
array
addObject
:
ZhanweiModel
];
...
...
@@ -244,37 +243,38 @@
DeleteCartRequest
*
delecteGoods
=
[[
DeleteCartRequest
alloc
]
init
];
delecteGoods
.
cartIds
=
goodsCode
;
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
REMOVESHOPPINGBAG
)
WithRequestType
:
0
WithParameter
:
delecteGoods
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
[
s
elf
QueryShoppingCarNumber
];
[
weakS
elf
QueryShoppingCarNumber
];
//商品cell
NSMutableArray
*
cellArray
=
[
NSMutableArray
array
];
//删除商品
for
(
int
i
=
0
;
i
<
s
elf
.
shopResponseArray
.
count
;
i
++
)
{
ShopcarModel
*
model
=
[
s
elf
.
shopResponseArray
objectAtIndex_opple
:
i
];
for
(
int
i
=
0
;
i
<
weakS
elf
.
shopResponseArray
.
count
;
i
++
)
{
ShopcarModel
*
model
=
[
weakS
elf
.
shopResponseArray
objectAtIndex_opple
:
i
];
if
([
goodsCode
containsObject
:
model
.
fid
])
{
[
s
elf
.
shopResponseArray
removeObject
:
model
];
[
weakS
elf
.
shopResponseArray
removeObject
:
model
];
NSIndexPath
*
indexpath
=
[
NSIndexPath
indexPathForRow
:
i
inSection
:
0
];
[
cellArray
addObject
:
indexpath
];
}
}
//删除cell
[
s
elf
.
shoppingTableview
deleteRowsAtIndexPaths
:
cellArray
withRowAnimation
:
UITableViewRowAnimationTop
];
[
weakS
elf
.
shoppingTableview
deleteRowsAtIndexPaths
:
cellArray
withRowAnimation
:
UITableViewRowAnimationTop
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}];
...
...
@@ -357,57 +357,55 @@
return
;
}
delecteGoods
.
cartIds
=
codeArr
;
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
REMOVESHOPPINGBAG
)
WithRequestType
:
0
WithParameter
:
delecteGoods
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
[
s
elf
QueryShoppingCarNumber
];
[
weakS
elf
QueryShoppingCarNumber
];
//删除商品
for
(
ShopcarModel
*
model
in
delectemodel
)
{
[
s
elf
.
shopResponseArray
removeObject
:
model
];
[
weakS
elf
.
shopResponseArray
removeObject
:
model
];
}
[
s
elf
.
shoppingTableview
deleteRowsAtIndexPaths
:
delecteArray
withRowAnimation
:
UITableViewRowAnimationLeft
];
[
weakS
elf
.
shoppingTableview
deleteRowsAtIndexPaths
:
delecteArray
withRowAnimation
:
UITableViewRowAnimationLeft
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
1
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
s
elf
.
shoppingTableview
reloadData
];
[
weakS
elf
.
shoppingTableview
reloadData
];
});
[
s
elf
SuccessMBProgressView
:
@"删除成功"
];
[
s
elf
CalculateSelectedGoodsAllprice
];
s
elf
.
allSelectedButton
.
selected
=
NO
;
[
s
elf
.
settlementButton
setTitle
:
@"去结算(0)"
forState
:
UIControlStateNormal
];
[
weakS
elf
SuccessMBProgressView
:
@"删除成功"
];
[
weakS
elf
CalculateSelectedGoodsAllprice
];
weakS
elf
.
allSelectedButton
.
selected
=
NO
;
[
weakS
elf
.
settlementButton
setTitle
:
@"去结算(0)"
forState
:
UIControlStateNormal
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
#pragma mark -改变商品数量
-
(
void
)
ChangeGoodsNumber
:
(
int
)
goodsNumber
WithcostPrice
:
(
CGFloat
)
costprice
Withcellindex
:
(
NSInteger
)
cellindex
-
(
void
)
ChangeGoodsNumber
:
(
NSInteger
)
goodsNumber
WithcostPrice
:
(
CGFloat
)
costprice
Withcellindex
:
(
NSInteger
)
cellindex
returnValue
:
(
void
(
^
)(
id
))
result
{
[
self
CreateMBProgressHUDLoding
];
//保存商品数量
ShopcarModel
*
model
=
[
self
.
shopResponseArray
objectAtIndex_opple
:
cellindex
];
model
.
goodsNum
=
goodsNumber
;
// [self.shopResponseArray replaceObjectAtIndex:cellindex withObject:model];
//保存成交价格
ShopcarModel
*
Newmodel
=
[
self
.
shopResponseArray
objectAtIndex_opple
:
cellindex
];
Newmodel
.
costPrice
=
[
NSNumber
numberWithFloat
:
costprice
];
// [self.shopResponseArray replaceObjectAtIndex:cellindex withObject:Newmodel];
////在服务器保存数量、成交价
//在服务器保存数量、成交价
//购物车ID
NSString
*
carid
=
[[
self
.
shopResponseArray
objectAtIndex_opple
:
cellindex
]
fid
];
//商品id
...
...
@@ -415,25 +413,28 @@
//成交价
NSString
*
costpriceString
=
[
NSString
stringWithFormat
:
@"%.2f"
,
costprice
];
//商品数量
NSString
*
goodsNumberString
=
[
NSString
stringWithFormat
:
@"%d"
,
goodsNumber
];
NSString
*
goodsNumberString
=
[
NSString
stringWithFormat
:
@"%ld"
,(
long
)
goodsNumber
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkWithDictionaryRequestWithURL
:[
NSString
stringWithFormat
:
@"%@%@/%@/%@/%@"
,
SERVERREQUESTURL
(
CHANGESHOPPINGBAGNUMBERPRICE
),
carid
,
goodsis
,
costpriceString
,
goodsNumberString
]
WithRequestType
:
1
WithParameter
:
nil
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
self
RemoveMBProgressHUDLoding
];
[
weakSelf
RemoveMBProgressHUDLoding
];
result
(
returnValue
);
//提供是否支持修改的参数
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
NSLog
(
@"写入服务器成功"
);
[
self
CalculateSelectedGoodsAllprice
];
[
self
QueryShoppingCarNumber
];
[
weakSelf
CalculateSelectedGoodsAllprice
];
[
weakSelf
QueryShoppingCarNumber
];
}
else
{
[
weakSelf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
ErrorMBProgressView
:
@"无网络"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"无网络"
];
}
WithFailureBlock
:^
(
id
error
)
{
NSLog
(
@"%@"
,
error
);
NSLog
(
@"写入服务器失败"
);
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
@@ -452,21 +453,4 @@
}
-
(
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
Lighting/Class/UserViewController.m
View file @
065f1661
...
...
@@ -178,21 +178,22 @@
RsEmployeeRequest
*
employ
=
[[
RsEmployeeRequest
alloc
]
init
];
employ
.
employee
=
[
Shoppersmanager
manager
].
Shoppers
.
employee
;
employ
.
employee
.
picture
=
headerurl
;
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
MODITYSHOPPERSINFORMATION
)
WithRequestType
:
0
WithParameter
:
employ
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
block
();
[
s
elf
SuccessMBProgressView
:
@"修改成功"
];
[
weakS
elf
SuccessMBProgressView
:
@"修改成功"
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}
WithFailureBlock
:^
(
NSError
*
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
@@ -282,31 +283,31 @@
LoginInfo
*
login
=
[[
LoginInfo
alloc
]
init
];
login
.
username
=
self
.
userName
.
text
;
login
.
password
=
self
.
passWord
.
text
;
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
LOGIN
)
WithRequestType
:
0
WithParameter
:
login
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
[
s
elf
SuccessMBProgressView
:
@"登陆成功"
];
[
weakS
elf
SuccessMBProgressView
:
@"登陆成功"
];
LoginResult
*
result
=
[[
LoginResult
alloc
]
initWithDictionary
:
returnValue
[
@"data"
]
error
:
nil
];
[
Shoppersmanager
manager
].
userNameString
=
s
elf
.
userName
.
text
;
[
Shoppersmanager
manager
].
passWordString
=
s
elf
.
passWord
.
text
;
[
Shoppersmanager
manager
].
userNameString
=
weakS
elf
.
userName
.
text
;
[
Shoppersmanager
manager
].
passWordString
=
weakS
elf
.
passWord
.
text
;
[
Shoppersmanager
manager
].
currentCustomer
=
NO
;
[
Shoppersmanager
manager
].
Shoppers
=
result
;
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"CHANGESHOPPERSNAME"
object
:
result
.
employee
.
realName
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"CHANGECUSTOMERNAME"
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"EMPTYCUSTOMERNAME"
object
:
nil
];
//情况当前客户数据
//保存用户名密码
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
s
elf
.
userName
.
text
forKey
:
USERNAME
];
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
s
elf
.
passWord
.
text
forKey
:
PASSWORD
];
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
weakS
elf
.
userName
.
text
forKey
:
USERNAME
];
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
weakS
elf
.
passWord
.
text
forKey
:
PASSWORD
];
[[
NSUserDefaults
standardUserDefaults
]
synchronize
];
[
s
elf
dismissViewControllerAnimated
:
YES
completion
:
nil
];
[
weakS
elf
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
s
elf
recoveryUsernamePasswrod
];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
recoveryUsernamePasswrod
];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
...
...
@@ -315,8 +316,8 @@
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
s
elf
recoveryUsernamePasswrod
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
recoveryUsernamePasswrod
];
}];
}
...
...
Lighting/Lighting.xcodeproj/project.pbxproj
View file @
065f1661
...
...
@@ -1709,8 +1709,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME
=
"Brand Assets"
;
CLANG_ENABLE_OBJC_WEAK
=
YES
;
CODE_SIGN_IDENTITY
=
"iPhone D
istribution: Shanghai Gomore Information Technology Co.,Ltd
"
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone D
istribution: Shanghai Gomore Information Technology Co.,Ltd
"
;
CODE_SIGN_IDENTITY
=
"iPhone D
eveloper: 云霄 曹 (WM8ZU7YY98)
"
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone D
eveloper: 云霄 曹 (WM8ZU7YY98)
"
;
COMPRESS_PNG_FILES
=
NO
;
ENABLE_BITCODE
=
NO
;
FRAMEWORK_SEARCH_PATHS
=
"$(inherited)"
;
...
...
@@ -1753,7 +1753,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER
=
com.gomore.opple
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
PROVISIONING_PROFILE
=
"
10361169-d429-4810-90f6-528335fe4062
"
;
PROVISIONING_PROFILE
=
"
e9bd3600-5e9c-4cd0-a0d5-b7d8b0882ca8
"
;
STRIP_PNG_TEXT
=
NO
;
TARGETED_DEVICE_FAMILY
=
2
;
USER_HEADER_SEARCH_PATHS
=
"$(PODS_ROOT)/**"
;
...
...
@@ -1767,8 +1767,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME
=
"Brand Assets"
;
CLANG_ENABLE_OBJC_WEAK
=
YES
;
CODE_SIGN_IDENTITY
=
"iPhone D
istribution: Shanghai Gomore Information Technology Co.,Ltd
"
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone D
istribution: Shanghai Gomore Information Technology Co.,Ltd
"
;
CODE_SIGN_IDENTITY
=
"iPhone D
eveloper: 云霄 曹 (WM8ZU7YY98)
"
;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]"
=
"iPhone D
eveloper: 云霄 曹 (WM8ZU7YY98)
"
;
COMPRESS_PNG_FILES
=
NO
;
ENABLE_BITCODE
=
NO
;
FRAMEWORK_SEARCH_PATHS
=
"$(inherited)"
;
...
...
@@ -1811,7 +1811,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER
=
com.gomore.opple
;
PRODUCT_NAME
=
"$(TARGET_NAME)"
;
PROVISIONING_PROFILE
=
"
10361169-d429-4810-90f6-528335fe4062
"
;
PROVISIONING_PROFILE
=
"
e9bd3600-5e9c-4cd0-a0d5-b7d8b0882ca8
"
;
STRIP_PNG_TEXT
=
NO
;
TARGETED_DEVICE_FAMILY
=
2
;
USER_HEADER_SEARCH_PATHS
=
"$(PODS_ROOT)/**"
;
...
...
Lighting/Tools/PrefixHeader.pch
View file @
065f1661
...
...
@@ -112,12 +112,12 @@
/**
* 服务器开发地址
*/
//
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://139.196.195.30:8090/opple-web/app%@",URL]
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://139.196.195.30:8090/opple-web/app%@",URL]
/**
* 服务器测试地址
*/
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg-dev.opple.com/opple-web/app%@",URL]
//
#define SERVERREQUESTURL(URL) [NSString stringWithFormat:@"http://dg-dev.opple.com/opple-web/app%@",URL]
///**
// * 服务器正式地址
...
...
@@ -186,6 +186,12 @@
*/
#define LOGINTIMEOUT @"logintimeout"
/**
* 弱引用
*/
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self
...
...
Lighting/Tools/SceneViewController.m
View file @
065f1661
...
...
@@ -232,7 +232,7 @@
#pragma mark -场景数据
-
(
void
)
getDatasAction
{
__weak
typeof
(
self
)
weakSelf
=
self
;
WS
(
weakSelf
)
;
//场景筛选条件
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
SCENESCREENING
)
WithRequestType
:
1
WithParameter
:
nil
WithReturnValueBlock
:^
(
id
returnValue
)
{
...
...
@@ -313,7 +313,7 @@
#pragma mark -获取场景列表数据
-
(
void
)
getSceneLibrarydatas
:
(
SceneCondition
*
)
condition
isRemove
:
(
BOOL
)
remove
{
__weak
typeof
(
self
)
weakSelf
=
self
;
WS
(
weakSelf
)
;
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
SCENELIST
)
WithRequestType
:
0
WithParameter
:
condition
WithReturnValueBlock
:^
(
id
returnValue
)
{
weakSelf
.
sceneOrProductClollectionView
.
emptyDataSetSource
=
weakSelf
;
...
...
@@ -543,7 +543,7 @@
#pragma mark -获取商品列表数据
-
(
void
)
getGoodsListdatas
:
(
GoodsCondition
*
)
conditon
returnResponse
:
(
void
(
^
)(
GoodsResponse
*
))
finish
{
__weak
typeof
(
self
)
weakSelf
=
self
;
WS
(
weakSelf
)
;
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
PRODUCTLIST
)
WithRequestType
:
0
WithParameter
:
conditon
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
weakSelf
endRefreshingForTableView
:
weakSelf
.
sceneOrProductClollectionView
];
...
...
Lighting/Tools/ShoppingBagViewController.m
View file @
065f1661
...
...
@@ -255,26 +255,27 @@
shopCar
.
consumerId
=
[
Customermanager
manager
].
model
.
fid
;
shopCar
.
goodsId
=
[
goodsIds
substringToIndex
:
goodsIds
.
length
-
1
];
shopCar
.
count
=
[
goodsCounts
substringToIndex
:
goodsCounts
.
length
-
1
];
WS
(
weakSelf
);
[[
NetworkRequestClassManager
Manager
]
NetworkRequestWithURL
:
SERVERREQUESTURL
(
ADDSHOPPINGBAG
)
WithRequestType
:
0
WithParameter
:
shopCar
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
if
(
s
elf
.
dismissBlock
)
{
s
elf
.
dismissBlock
();
if
(
weakS
elf
.
dismissBlock
)
{
weakS
elf
.
dismissBlock
();
}
[
s
elf
dismissViewControllerAnimated
:
YES
completion
:
nil
];
[
s
elf
QueryShoppingCarNumber
];
[
s
elf
SuccessMBProgressView
:
@"加入购物车成功"
];
[
weakS
elf
dismissViewControllerAnimated
:
YES
completion
:
nil
];
[
weakS
elf
QueryShoppingCarNumber
];
[
weakS
elf
SuccessMBProgressView
:
@"加入购物车成功"
];
}
else
{
[
s
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
[
weakS
elf
ErrorMBProgressView
:
returnValue
[
@"message"
]];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}
WithFailureBlock
:^
(
id
error
)
{
[
s
elf
ErrorMBProgressView
:
@"加入购物车失败"
];
[
s
elf
RemoveMBProgressHUDLoding
];
[
weakS
elf
ErrorMBProgressView
:
@"加入购物车失败"
];
[
weakS
elf
RemoveMBProgressHUDLoding
];
}];
}
...
...
@@ -292,7 +293,7 @@
#pragma mark -改变商品数量
-
(
void
)
ChangeGoodsNumber
:
(
int
)
goodsNumber
WithcostPrice
:
(
CGFloat
)
costprice
Withcellindex
:
(
NSInteger
)
cellindex
-
(
void
)
ChangeGoodsNumber
:
(
NSInteger
)
goodsNumber
WithcostPrice
:
(
CGFloat
)
costprice
Withcellindex
:
(
NSInteger
)
cellindex
returnValue
:
(
void
(
^
)(
id
))
result
{
ShopcarModel
*
model
=
[
self
.
datasArray
objectAtIndex_opple
:
cellindex
];
//保存商品数量
...
...
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