From f5a1de1d33abf9c4baf1c9ca6d64e6a89c6d8b7b Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 12 Jun 2019 16:09:59 +0800 Subject: [PATCH] =?UTF-8?q?add=20good=E5=95=86=E5=93=81=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payment/manage/goods/bean/GoodInfo.java | 9 +++++++++ .../payment/manage/goods/core/GoodManage.java | 2 ++ .../manage/goods/core/impls/GoodManageImpl.java | 8 ++++++++ .../manage/goods/web/GoodManageController.java | 9 ++++++++- src/main/ui/static/payment/good/good-manage.js | 17 +++++++++++++++++ .../static/payment/good/templates/add_good.html | 14 ++++++++++++++ .../payment/good/templates/good_detail.html | 14 ++++++++++++++ .../payment/good/templates/good_edit.html | 14 +++++++++++++- 8 files changed, 85 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/goods/bean/GoodInfo.java b/src/main/java/au/com/royalpay/payment/manage/goods/bean/GoodInfo.java index 77dcd0c8e..fe93653b2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/goods/bean/GoodInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/goods/bean/GoodInfo.java @@ -23,6 +23,7 @@ public class GoodInfo { private int inventory = -1; private String origin; private String type; + private String order_desc; private String description; private List images; // private String image_thumbnail; @@ -130,4 +131,12 @@ public class GoodInfo { public void setActual_cny_price(String actual_cny_price) { this.actual_cny_price = actual_cny_price; } + + public String getOrder_desc() { + return order_desc; + } + + public void setOrder_desc(String order_desc) { + this.order_desc = order_desc; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/goods/core/GoodManage.java b/src/main/java/au/com/royalpay/payment/manage/goods/core/GoodManage.java index 6f4f1e1b5..5c3f388ef 100644 --- a/src/main/java/au/com/royalpay/payment/manage/goods/core/GoodManage.java +++ b/src/main/java/au/com/royalpay/payment/manage/goods/core/GoodManage.java @@ -18,6 +18,8 @@ public interface GoodManage { @Transactional void updateGoodInfo(JSONObject partner, String goodId, GoodInfo goodInfo) throws Exception; + void updateDisplayInventory(JSONObject partner, String goodId, boolean displayInventory); + @Transactional void delete(JSONObject partner, String goodId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/goods/core/impls/GoodManageImpl.java b/src/main/java/au/com/royalpay/payment/manage/goods/core/impls/GoodManageImpl.java index 54c6cc17a..1c8ebfb95 100644 --- a/src/main/java/au/com/royalpay/payment/manage/goods/core/impls/GoodManageImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/goods/core/impls/GoodManageImpl.java @@ -105,6 +105,14 @@ public class GoodManageImpl implements GoodManage { goodMapper.update(updateObject); } + @Override + public void updateDisplayInventory(JSONObject partner,String goodId, boolean displayInventory) { + JSONObject good = goodMapper.findGood(goodId); + Assert.notNull(good); + good.put("inventory_display", displayInventory); + goodMapper.update(good); + } + @Override public void delete(JSONObject partner, String goodId) { JSONObject good = goodMapper.findGood(goodId); diff --git a/src/main/java/au/com/royalpay/payment/manage/goods/web/GoodManageController.java b/src/main/java/au/com/royalpay/payment/manage/goods/web/GoodManageController.java index d11424442..54591db38 100644 --- a/src/main/java/au/com/royalpay/payment/manage/goods/web/GoodManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/goods/web/GoodManageController.java @@ -46,7 +46,6 @@ public class GoodManageController { throw new Exception("商户未知!"); } return goodManage.getGoodDetail(goodId); - } @PartnerMapping(value ="/{goodId}",method = RequestMethod.DELETE) public void deleteGood(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, @PathVariable String goodId) throws Exception { @@ -65,6 +64,14 @@ public class GoodManageController { } + @PartnerMapping(value = "/{goodId}/inventory_display", method = RequestMethod.PUT) + public void updateDisplayInventory(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, @PathVariable String goodId, @RequestBody JSONObject params) throws Exception { + if (partner == null) { + throw new Exception("商户未知!"); + } + goodManage.updateDisplayInventory(partner, goodId,params.getBooleanValue("inventory_display")); + } + @PartnerMapping(value = "/goodOrders", method = RequestMethod.GET) @ResponseBody public JSONObject listGoodOrders(@ModelAttribute(CommonConsts.PARTNER_STATUS) JSONObject partner, GoodOrderQuery goodOrderQuery) { diff --git a/src/main/ui/static/payment/good/good-manage.js b/src/main/ui/static/payment/good/good-manage.js index d89378dca..0bcb5eead 100644 --- a/src/main/ui/static/payment/good/good-manage.js +++ b/src/main/ui/static/payment/good/good-manage.js @@ -120,6 +120,23 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS $scope.good = good.data; var images = good.data.images; $scope.good.images = images ? JSON.parse(images) : []; + $scope.init = { + displayInventory: false + }; + $scope.switchDisplayInventory = function () { + if (!$scope.good) { + return; + } + if (!$scope.init.displayInventory) { + $scope.init.displayInventory = true; + return; + } + $http.put('/sys/client/goods/' + $scope.good.id + '/inventory_display', {inventory_display: $scope.good.inventory_display}).then(function () { + $state.reload(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + }; $scope.editGood = function () { commonDialog.confirm({ title: 'Edit Good', diff --git a/src/main/ui/static/payment/good/templates/add_good.html b/src/main/ui/static/payment/good/templates/add_good.html index 82d0a5f07..b1b042697 100644 --- a/src/main/ui/static/payment/good/templates/add_good.html +++ b/src/main/ui/static/payment/good/templates/add_good.html @@ -171,6 +171,20 @@ +
+ +
+ +
+

Less Than 20 + Characters(including symbols and spaces)

+
+
+
+
diff --git a/src/main/ui/static/payment/good/templates/good_detail.html b/src/main/ui/static/payment/good/templates/good_detail.html index cca67fd90..222fb9f68 100644 --- a/src/main/ui/static/payment/good/templates/good_detail.html +++ b/src/main/ui/static/payment/good/templates/good_detail.html @@ -73,6 +73,13 @@
+
+ +
+ +
+
@@ -88,6 +95,13 @@

+
+ + +
+

+
+
diff --git a/src/main/ui/static/payment/good/templates/good_edit.html b/src/main/ui/static/payment/good/templates/good_edit.html index d280e96e8..3d385bcce 100644 --- a/src/main/ui/static/payment/good/templates/good_edit.html +++ b/src/main/ui/static/payment/good/templates/good_edit.html @@ -189,7 +189,19 @@
- +
+ +
+ +
+

Less Than 20 + Characters(including symbols and spaces)

+
+
+