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
79a09d7a
Commit
79a09d7a
authored
Mar 30, 2022
by
linlinjava
Browse files
feat[litemall-wx-api, litemall-vue]: 优化下单逻辑
parent
ac81599d
Changes
2
Hide whitespace changes
Inline
Side-by-side
litemall-vue/src/views/order/checkout.vue
View file @
79a09d7a
...
...
@@ -107,7 +107,7 @@ export default {
onSubmit
()
{
const
{
AddressId
,
CartId
,
CouponId
,
UserCouponId
}
=
getLocalStorage
(
'
AddressId
'
,
'
CartId
'
,
'
CouponId
'
,
'
UserCouponId
'
);
if
(
AddressId
===
null
)
{
if
(
AddressId
===
null
||
AddressId
===
"
0
"
)
{
Toast
.
fail
(
'
请设置收货地址
'
);
return
;
}
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCartController.java
View file @
79a09d7a
...
...
@@ -413,7 +413,10 @@ public class WxCartController {
// 收货地址
LitemallAddress
checkedAddress
=
null
;
if
(
addressId
==
null
||
addressId
.
equals
(
0
))
{
if
(
addressId
!=
null
&&
!
addressId
.
equals
(
0
))
{
checkedAddress
=
addressService
.
query
(
userId
,
addressId
);
}
if
(
checkedAddress
==
null
)
{
checkedAddress
=
addressService
.
findDefault
(
userId
);
// 如果仍然没有地址,则是没有收货地址
// 返回一个空的地址id=0,这样前端则会提醒添加地址
...
...
@@ -424,13 +427,6 @@ public class WxCartController {
}
else
{
addressId
=
checkedAddress
.
getId
();
}
}
else
{
checkedAddress
=
addressService
.
query
(
userId
,
addressId
);
// 如果null, 则报错
if
(
checkedAddress
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
}
}
// 团购优惠
...
...
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