Browse Source

逻辑修改

hyq 5 years ago
parent
commit
1e04070b15

+ 7 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/storeProductStock.html

@@ -369,6 +369,13 @@
     <img class="upLogo align-center-middle" src="" >
 </div>
 
+<div id="qrcode2" style="display: none;padding: 10px;">
+    <div id="qrcodeCanvas2" style="margin: 20px 0 0 55px"></div>
+</div>
+<div id="qrcImg2" style="display:none">
+    <img class="qrcImg align-center" height="300px" width="300px" src="">
+</div>
+
 <script src="${rc.contextPath}/js/shop/storeProductStock.js?_${date.systemTime}"></script>
 </body>
 

+ 13 - 11
kmall-admin/src/main/webapp/js/shop/storeProductStock.js

@@ -6,7 +6,7 @@ $(function () {
         colModel: [
             {label: 'ID', name: 'id', index: 'id', hidden: true, key: true},
             {label: '商品商户编号', name: 'goods_merch_sn', index: 'goods_merch_sn', hidden: true},
-            {label: '所属商户', name: 'merchName', index: 'merchName', width: 100, align: 'center'},
+            {label: '所属商户', name: 'merchName', index: 'merchName', width: 70, align: 'center'},
             {label: '所属门店', name: 'storeName', index: 'storeName', width: 80, align: 'center'},
             {label: '商品类型', name: 'categoryName', index: 'categoryName', width: 80, align: 'center'},
             {
@@ -41,14 +41,14 @@ $(function () {
                     return '-';
                 }},
             {label: '门店库存', name: 'stockNum', index: 'stockNum', width: 70, align: 'center'},
-            {label: '零售价格', name: 'retailPrice', index: 'retailPrice', width: 70, align: 'center'},
+            {label: '零售价格', name: 'retailPrice', index: 'retailPrice', width: 60, align: 'center'},
             // {label: '市场价', name: 'marketPrice', index: 'marketPrice', width: 80, align: 'center'},
             // {label: '库存价格', name: 'stockPrice', index: 'stockPrice', width: 80},
             {
                 label: '销售量',
                 name: 'sellVolume',
                 index: 'a.sell_volume',
-                width: 70,
+                width: 60,
                 sortable: true, align: 'center',
                 onSortCol: function (index, colindex, sortorder) {
                     //列排序事件
@@ -56,7 +56,7 @@ $(function () {
                 }
             },
             {
-                label: '操作', width: 70, align: 'center', sortable: false, formatter: function (value, col, row) {
+                label: '操作', width: 120, align: 'center', sortable: false, formatter: function (value, col, row) {
                 let htmlStr = '';
                 if (row.goodsBizType == '02' || row.goodsBizType == '10') {
                     htmlStr = "<button class='btn btn-outline btn-primary' " +
@@ -64,7 +64,9 @@ $(function () {
                 }
                 if (row.goodsBizType == '00') {
                     htmlStr = "<button class='btn btn-outline btn-primary' " +
-                        "onclick='vm.putOn(" + row.id + ")'><i class='fa fa-qrcode'></i>二维码</button>";
+                        "onclick='vm.qrcodeCanvas(" + row.goodsId + ",\""+ row.storeId +"\",\""+row.goodsMerchSn+"\",\""+row.merchSn+"\")'><i class='fa fa-qrcode'></i>二维码</button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
+                    "<button class='btn btn-outline btn-primary' " +
+                        "onclick='vm.putOn(" + row.id + ")'><i class='fa fa-qrcode'></i>投放</button>";
                 }
                 return htmlStr;
             }
@@ -666,23 +668,23 @@ var vm = new Vue({
             $("#qrcodeCanvas").html("");
             $.get("../productstorerela/qrcodeCanvas/" + id, function (r) {
                 var qrcSrc = r.url;
-                $("#qrcImg .qrcImg").attr("src", qrcSrc);
-                $("#qrcodeCanvas").html($("#qrcImg").html());
+                $("#qrcImg2 .qrcImg").attr("src", qrcSrc);
+                $("#qrcodeCanvas2").html($("#qrcImg2").html());
                 openWindow({
                     title: "二维码",
                     area: ['450px', '450px'],
-                    content: jQuery("#qrcode"),
+                    content: jQuery("#qrcode2"),
                     // btn: ["打印"],
                     btn1: function (index) {
-                        $("#qrcImg").show();
+                        $("#qrcImg2").show();
                         // $("#qrcImg").print({});
-                        $("#qrcImg").hide();
+                        $("#qrcImg2").hide();
                         layer.close(index);
                     }
                 });
             });
 
-            $("#qrcImg").hide();
+            $("#qrcImg2").hide();
         }
     },
     mounted() {

+ 5 - 1
kmall-api/src/main/java/com/kmall/api/api/ApiCatalogController.java

@@ -47,7 +47,11 @@ public class ApiCatalogController extends ApiBaseAction {
         params.put("sidx", "sort_order");
         params.put("order", "asc");
         params.put("parent_id", 0);
-        params.put("store_id", storeId);
+        if(storeId == null) {
+            params.put("store_id", getStoreId());
+        }else{
+            params.put("store_id", storeId);
+        }
         //查询列表数据
         List<CategoryVo> data = categoryService.queryList(params);
         //

+ 1 - 1
kmall-api/src/main/java/com/kmall/api/api/ApiGoodsController.java

@@ -496,7 +496,7 @@ public class ApiGoodsController extends ApiBaseAction {
     public Object count(@LoginUser UserVo loginUser) {
         Map<String, Object> resultObj = Maps.newHashMap();
         Map param = Maps.newHashMap();
-        param.put("storeId", getStoreId());
+        param.put("store_id", getStoreId());
         param.put("notGoodsBizType", true);
         param.put("is_delete", 0);
         param.put("is_on_sale", 1);

+ 10 - 0
kmall-api/src/main/java/com/kmall/api/entity/mk/MkStoreCampMinusVo.java

@@ -114,6 +114,8 @@ public class MkStoreCampMinusVo implements Serializable {
 
     private Integer goodsId;
 
+    private Integer[] goodsIds;
+
     public Integer getGoodsId() {
         return goodsId;
     }
@@ -122,6 +124,14 @@ public class MkStoreCampMinusVo implements Serializable {
         this.goodsId = goodsId;
     }
 
+    public Integer[] getGoodsIds() {
+        return goodsIds;
+    }
+
+    public void setGoodsIds(Integer[] goodsIds) {
+        this.goodsIds = goodsIds;
+    }
+
     public Long getEnd_time() {//todo 配置结束时间的倒计时时间
         if (getIsPast().equalsIgnoreCase(Dict.isPast.item_0.getItem()) && getIsValid().equalsIgnoreCase(Dict.isValid.item_0.getItem())) {
             end_time = getCampEndTime().getTime() + 60 * 15 * 1000;

+ 1 - 1
kmall-api/src/main/java/com/kmall/api/service/ApiCartService.java

@@ -576,7 +576,7 @@ public class ApiCartService {
      */
     private Map checkedCampMinus(List<CampMinusDto> campList, CampMinusDto campMinusDto, BigDecimal actualPrice, Integer campId, Integer isLoadStatus){
         Map campMap = new HashMap();
-        if(campList != null && campList.size() > 0){
+        if(campList != null && campList.size() > 0 && isLoadStatus != null){
             if(isLoadStatus == 0){ //0则为进入页面加载优惠信息,默认选择最高层级促销活动
                 campMinusDto = campList.get(0);
                 if(campMinusDto.getCampMinusId().compareTo(0) > 0){

+ 21 - 3
kmall-api/src/main/java/com/kmall/api/service/mk/ApiMkStoreCampMinusService.java

@@ -359,9 +359,13 @@ public class ApiMkStoreCampMinusService {
      */
     private BigDecimal getTotalByGoodsId(List<CartVo> cartGoodsList, MkStoreCampMinusVo minusVo){
         BigDecimal total = new BigDecimal(0);
-        for (CartVo vo: cartGoodsList) {
-            if(minusVo.getGoodsId().compareTo(vo.getGoods_id().intValue()) == 0 && minusVo.getStoreId().compareTo(vo.getStore_id().intValue()) == 0 && minusVo.getGoodsBizType().equalsIgnoreCase(vo.getGoodsBizType())){
-                total = total.add(vo.getRetail_price().multiply(BigDecimal.valueOf(vo.getNumber())));
+        Integer goodsId[] = minusVo.getGoodsIds();
+        for(int i = 0; i<goodsId.length;i++) {
+            for (CartVo vo:cartGoodsList) {
+//            CartVo vo = cartGoodsList.get(i);
+                if (goodsId[i].compareTo(vo.getGoods_id().intValue()) == 0 && minusVo.getStoreId().compareTo(vo.getStore_id().intValue()) == 0 && minusVo.getGoodsBizType().equalsIgnoreCase(vo.getGoodsBizType())) {
+                    total = total.add(vo.getRetail_price().multiply(BigDecimal.valueOf(vo.getNumber())));
+                }
             }
         }
         return total;
@@ -401,12 +405,26 @@ public class ApiMkStoreCampMinusService {
         List<CartVo> cartList = userCouponDto.getCartGoodsList();
         String bizType = userCouponDto.getBizType();
         List<MkStoreCampMinusVo> mkStoreCampMinusList = new ArrayList<>();
+        Integer count = 0;
+        List<CartVo> cartBizList = new ArrayList<>();
         for(CartVo cartVo: cartList){
             if(bizType.equalsIgnoreCase(cartVo.getGoodsBizType())) {
+                count++;
+                cartBizList.add(cartVo);
+            }
+        }
+        Integer[] goodsIds = new Integer[count];
+        for(int i=0;i<cartBizList.size();i++){
+            CartVo cartVo = cartBizList.get(i);
+            if(bizType.equalsIgnoreCase(cartVo.getGoodsBizType())) {
                 Integer goodsId = Integer.parseInt(String.valueOf(cartVo.getGoods_id()));
                 mkStoreCampMinusList = queryStoreCampMinusByGoodsId(storeId, userId, goodsId);
+                goodsIds[i] = goodsId;
             }
         }
+        for(MkStoreCampMinusVo vo : mkStoreCampMinusList){
+            vo.setGoodsIds(goodsIds);
+        }
         Map map = new HashMap();
         map.put("mkStoreCampMinusList", mkStoreCampMinusList);
         return map;