diff --git a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAddressController.java b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAddressController.java index 2177f660..22da12ea 100644 --- a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAddressController.java +++ b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxAddressController.java @@ -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 data = new HashMap(); @@ -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()); diff --git a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java index 4314fa0f..55ee63c5 100644 --- a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java +++ b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java @@ -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("goodsSpecificationValues", orderGoods.getGoodsSpecificationValues()); orderGoodsVoList.add(orderGoodsVo); } Map result = new HashMap<>(); result.put("orderInfo", orderVo); - result.put("orderGoods", orderGoodsList); + result.put("orderGoods", orderGoodsVoList); 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: { orderInfo: xxx } } + * 成功则 { errno: 0, errmsg: '成功', data: { orderId: 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 data = new HashMap<>(); - data.put("orderInfo", order); + data.put("orderId", order.getId()); return ResponseUtil.ok(data); } diff --git a/litemall-wx/pages/shopping/checkout/checkout.js b/litemall-wx/pages/shopping/checkout/checkout.js index 54e1118b..b1b97d21 100644 --- a/litemall-wx/pages/shopping/checkout/checkout.js +++ b/litemall-wx/pages/shopping/checkout/checkout.js @@ -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.orderInfo.id; + const orderId = res.data.orderId; // 目前不能支持微信支付,这里仅仅是模拟支付成功,同理,后台也仅仅是返回一个成功的消息而已 wx.showModal({