Commit 79a09d7a authored by linlinjava's avatar linlinjava
Browse files

feat[litemall-wx-api, litemall-vue]: 优化下单逻辑

parent ac81599d
......@@ -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;
}
......
......@@ -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();
}
}
// 团购优惠
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment