add good商品可配置项

master
luoyang 5 years ago
parent d2b5923c95
commit f5a1de1d33

@ -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<JSONObject> 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;
}
}

@ -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);
}

@ -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);

@ -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) {

@ -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',

@ -171,6 +171,20 @@
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.description.$invalid && goodForm.description.$dirty}">
<label class="control-label col-sm-2" for="order-desc-input"> Order Description</label>
<div class="col-sm-8">
<input class="form-control" ng-model="good.order_desc"
name="description" id="order-desc-input" maxlength="20">
<div ng-messages="goodForm.description.$error"
ng-if="goodForm.description.$dirty">
<p class="small text-danger" ng-message="maxlength">Less Than 20
Characters(including symbols and spaces)</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.description.$invalid && goodForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input"> Description</label>

@ -73,6 +73,13 @@
<img ng-src="{{image.url}}" class="col-sm-3 col-xs-5">
</div>
</div>
<div class="form-group" ng-if="good.inventory !=-1">
<label class="control-label col-sm-2">Display Inventory</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="good.inventory_display" bs-switch
switch-change="switchDisplayInventory()">
</div>
</div>
<div class="form-group" ng-if="good.inventory !=-1">
<label class="control-label col-sm-2">Inventory</label>
@ -88,6 +95,13 @@
<p class="form-control-static" ng-bind="good.origin"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Order Description</label>
<div class="col-sm-10">
<p class="form-control-static" ng-bind="good.order_desc"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Description</label>

@ -189,7 +189,19 @@
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.description.$invalid && goodForm.description.$dirty}">
<label class="control-label col-sm-2" for="order-desc-input"> Order Description</label>
<div class="col-sm-8">
<input class="form-control" ng-model="good.order_desc"
name="description" id="order-desc-input" maxlength="20">
<div ng-messages="goodForm.description.$error"
ng-if="goodForm.description.$dirty">
<p class="small text-danger" ng-message="maxlength">Less Than 20
Characters(including symbols and spaces)</p>
</div>
</div>
</div>
<div class="form-group"
ng-class="{'has-error':goodForm.description.$invalid && goodForm.description.$dirty}">
<label class="control-label col-sm-2" for="desc-input"> Description</label>

Loading…
Cancel
Save