Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
b8395d51
Commit
b8395d51
authored
Apr 13, 2018
by
Junling Bu
Browse files
fix[litemall-wx-api, litemall-wx]: 轻微调整。
parent
c98bdc6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAddressController.java
View file @
b8395d51
...
...
@@ -93,15 +93,15 @@ public class WxAddressController {
@GetMapping
(
"detail"
)
public
Object
detail
(
@LoginUser
Integer
userId
,
Integer
id
)
{
if
(
userId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
if
(
id
==
null
){
return
ResponseUtil
.
fail402
();
return
ResponseUtil
.
badArgument
();
}
LitemallAddress
address
=
addressService
.
findById
(
id
);
if
(
address
==
null
){
return
ResponseUtil
.
fail403
();
return
ResponseUtil
.
badArgumentValue
();
}
Map
<
Object
,
Object
>
data
=
new
HashMap
<
Object
,
Object
>();
...
...
@@ -134,10 +134,10 @@ public class WxAddressController {
@PostMapping
(
"save"
)
public
Object
save
(
@LoginUser
Integer
userId
,
@RequestBody
LitemallAddress
address
)
{
if
(
userId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
if
(
address
==
null
){
return
ResponseUtil
.
fail402
();
return
ResponseUtil
.
badArgument
();
}
if
(
address
.
getIsDefault
()){
...
...
@@ -168,10 +168,10 @@ public class WxAddressController {
@PostMapping
(
"delete"
)
public
Object
delete
(
@LoginUser
Integer
userId
,
@RequestBody
LitemallAddress
address
)
{
if
(
userId
==
null
){
return
ResponseUtil
.
fail401
();
return
ResponseUtil
.
unlogin
();
}
if
(
address
==
null
){
return
ResponseUtil
.
fail402
();
return
ResponseUtil
.
badArgument
();
}
addressService
.
delete
(
address
.
getId
());
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java
View file @
b8395d51
...
...
@@ -196,13 +196,13 @@ public class WxOrderController {
orderGoodsVo
.
put
(
"goodsName"
,
orderGoods
.
getGoodsName
());
orderGoodsVo
.
put
(
"number"
,
orderGoods
.
getNumber
());
orderGoodsVo
.
put
(
"picUrl"
,
orderGoods
.
getPicUrl
());
orderGoodsVo
.
put
(
"goodsSpecifitionValues"
,
orderGoods
.
getGoodsSpecificationValues
());
orderGoodsVo
.
put
(
"goodsSpecifi
ca
tionValues"
,
orderGoods
.
getGoodsSpecificationValues
());
orderGoodsVoList
.
add
(
orderGoodsVo
);
}
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"orderInfo"
,
orderVo
);
result
.
put
(
"orderGoods"
,
orderGoodsList
);
result
.
put
(
"orderGoods"
,
orderGoods
Vo
List
);
return
ResponseUtil
.
ok
(
result
);
}
...
...
@@ -217,7 +217,7 @@ public class WxOrderController {
* @param userId 用户ID
* @param body 订单信息,{ cartId:xxx, addressId: xxx, couponId: xxx }
* @return 订单操作结果
* 成功则 { errno: 0, errmsg: '成功', data: { orderI
nfo
: xxx } }
* 成功则 { errno: 0, errmsg: '成功', data: { orderI
d
: xxx } }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@PostMapping
(
"submit"
)
...
...
@@ -262,7 +262,7 @@ public class WxOrderController {
// 根据订单商品总价计算运费,满88则免运费,否则8元;
BigDecimal
freightPrice
=
new
BigDecimal
(
0.00
);
if
(
checkedGoodsPrice
.
compareTo
(
new
BigDecimal
(
88.00
))
==
-
1
){
if
(
checkedGoodsPrice
.
compareTo
(
new
BigDecimal
(
88.00
))
<
0
){
freightPrice
=
new
BigDecimal
(
8.00
);
}
...
...
@@ -313,7 +313,6 @@ public class WxOrderController {
// 商品货品数量减少
for
(
LitemallCart
checkGoods
:
checkedGoodsList
)
{
checkedGoodsPrice
=
checkedGoodsPrice
.
add
(
checkGoods
.
getRetailPrice
().
multiply
(
new
BigDecimal
(
checkGoods
.
getNumber
())));
Integer
productId
=
checkGoods
.
getProductId
();
LitemallProduct
product
=
productService
.
findById
(
productId
);
if
(
product
==
null
){
...
...
@@ -329,7 +328,7 @@ public class WxOrderController {
}
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"orderI
nfo
"
,
order
);
data
.
put
(
"orderI
d
"
,
order
.
getId
()
);
return
ResponseUtil
.
ok
(
data
);
}
...
...
litemall-wx/pages/shopping/checkout/checkout.js
View file @
b8395d51
...
...
@@ -104,7 +104,7 @@ Page({
}
util
.
request
(
api
.
OrderSubmit
,
{
cartId
:
0
,
addressId
:
this
.
data
.
addressId
,
couponId
:
this
.
data
.
couponId
},
'
POST
'
).
then
(
res
=>
{
if
(
res
.
errno
===
0
)
{
const
orderId
=
res
.
data
.
orderI
nfo
.
i
d
;
const
orderId
=
res
.
data
.
orderId
;
// 目前不能支持微信支付,这里仅仅是模拟支付成功,同理,后台也仅仅是返回一个成功的消息而已
wx
.
showModal
({
...
...
Write
Preview
Supports
Markdown
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