Browse Source

采美sku bugfix

zhijiezhao 2 years ago
parent
commit
8865c6b894

+ 5 - 3
src/main/java/com/caimei/modules/order/web/NewOrderController.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.order.web;
 package com.caimei.modules.order.web;
 
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.constants.NewPayWay;
 import com.caimei.constants.NewPayWay;
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.dfs.image.beens.ImageUploadInfo;
@@ -398,7 +399,8 @@ public class NewOrderController extends BaseController {
             List<NewOrderProduct> orderProductList = Lists.newArrayList();
             List<NewOrderProduct> orderProductList = Lists.newArrayList();
             for (NewOrderProduct newOrderProduct : newOrder.getOrderProduct()) {
             for (NewOrderProduct newOrderProduct : newOrder.getOrderProduct()) {
                 if (StringUtils.isNotEmpty(newOrderProduct.getEnabledStatus())) {
                 if (StringUtils.isNotEmpty(newOrderProduct.getEnabledStatus())) {
-                    NewOrderProduct o = (NewOrderProduct) JsonMapper.fromJsonString(newOrderProduct.getEnabledStatus(), NewOrderProduct.class);
+//                    NewOrderProduct o = (NewOrderProduct) JsonMapper.fromJsonString(newOrderProduct.getEnabledStatus(), NewOrderProduct.class);
+                    NewOrderProduct o = JSONObject.parseObject(newOrderProduct.getEnabledStatus(), NewOrderProduct.class);
                     JSONObject jsonObject = JSONObject.parseObject(newOrderProduct.getEnabledStatus());
                     JSONObject jsonObject = JSONObject.parseObject(newOrderProduct.getEnabledStatus());
                     String productId = jsonObject.getString("productId");
                     String productId = jsonObject.getString("productId");
                     if (productId != null && !"".equals(productId)) {
                     if (productId != null && !"".equals(productId)) {
@@ -429,8 +431,8 @@ public class NewOrderController extends BaseController {
                         o.setLadderPriceFlag(Integer.valueOf(ladderPriceFlag));
                         o.setLadderPriceFlag(Integer.valueOf(ladderPriceFlag));
                     }
                     }
                     String skuId = jsonObject.getString("skuId");
                     String skuId = jsonObject.getString("skuId");
-                    if("2".equals(o.getProductCategory())){
-                        skuId=newOrderProductDao.findSkuIdByProductId(o.getProductID());
+                    if ("2".equals(o.getProductCategory())) {
+                        skuId = newOrderProductDao.findSkuIdByProductId(o.getProductID());
                     }
                     }
                     if (null == o.getPrice()) {
                     if (null == o.getPrice()) {
                         Double price = newOrderProductDao.findPriceBySku(skuId);
                         Double price = newOrderProductDao.findPriceBySku(skuId);

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/product-new/singlePromotionForm.jsp

@@ -272,7 +272,7 @@
 
 
             $.ajax({
             $.ajax({
                 url: "${ctx}/product/cmPromotions/delPromotion",
                 url: "${ctx}/product/cmPromotions/delPromotion",
-                data: {"id":${cmPromotion.id},"skuId":obj},
+                data: {"id":"${cmPromotion.id || ''}","skuId":obj},
                 type: "POST",
                 type: "POST",
                 async: false,
                 async: false,
                 success: function(data){
                 success: function(data){

+ 32 - 23
src/main/webapp/static/modules/bulkpurchase/orderForm.js

@@ -637,12 +637,11 @@ function resetProductList(setData, ind) {
             setProductList(data, false);
             setProductList(data, false);
         });
         });
     } else {
     } else {
-        debugger;
-        // if(ind){
-        //     productList.forEach(function (data) {
-        //         setProductList(data, false);
-        //     });
-        // }
+        if (ind) {
+            productList.forEach(function (data) {
+                setProductList(data, false);
+            });
+        }
 
 
         var skuId;
         var skuId;
         if (setData.skuStr) {
         if (setData.skuStr) {
@@ -1091,6 +1090,15 @@ function setGiftHtmlList(data, cmPromotion) {
         $('.productTable tbody tr.gift_' + data.skuId).each(function (index, element) {
         $('.productTable tbody tr.gift_' + data.skuId).each(function (index, element) {
             $(this).remove();
             $(this).remove();
         });
         });
+        debugger;
+        var skuStr = "赠品";
+        if (data.skuStr) {
+            var strings = data.skuStr.split("/");
+            var index = strings[1] * 1;
+            skuStr = data.skuList[index].unit;
+        } else {
+            skuStr = data.skuList[0].unit;
+        }
         var present = JSON.parse(JSON.stringify(data));
         var present = JSON.parse(JSON.stringify(data));
         present.productType = 1;
         present.productType = 1;
         present.num = data.presentNum;
         present.num = data.presentNum;
@@ -1101,26 +1109,27 @@ function setGiftHtmlList(data, cmPromotion) {
         var giftStr = "<tr id='product_gift_" + present.productId + "' class='gift gift_" + present.productId +
         var giftStr = "<tr id='product_gift_" + present.productId + "' class='gift gift_" + present.productId +
             "' data-value='" + JSON.stringify(present) + "' data-index='" + product_index + "'>" +
             "' data-value='" + JSON.stringify(present) + "' data-index='" + product_index + "'>" +
             "<td>" + present.productId + "</td>" +
             "<td>" + present.productId + "</td>" +
-            "<td>" + 0 + "</td>" +
+            "<td>" + present.skuId + "</td>" +
             "<td hidden><input type='hidden' name='orderProduct[" + product_index +
             "<td hidden><input type='hidden' name='orderProduct[" + product_index +
             "].enabledStatus' id='orderProduct" + product_index + ".enabledStatus' value='" + JSON.stringify(present) +
             "].enabledStatus' id='orderProduct" + product_index + ".enabledStatus' value='" + JSON.stringify(present) +
             "'/>" + present.shopId + "</td>" +
             "'/>" + present.shopId + "</td>" +
             "<td hidden>" + present.shopName + "</td>" +
             "<td hidden>" + present.shopName + "</td>" +
             "<td class='fix-width'><i class='red'>协商赠品:</i>" + present.name + "</td><td hidden></td>" +
             "<td class='fix-width'><i class='red'>协商赠品:</i>" + present.name + "</td><td hidden></td>" +
-            "<td>" + present.unit + "</td>"
-        "<td>" + present.num + "</td>" +
-        "<td>0</td>" +
-        "<td>100</td>" +
-        "<td>0</td>" +
-        "<td>0</td>" +
-        "<td>0</td>" +
-        "<td>0</td>" +
-        "<td>0</td>" +
-        /*"<td>"+ Math.round(present.shopFee*100)/100 +"</td>"+*/
-        "<td>否</td>" +
-        "<td></td>" +
-        "<td></td>" +
-        "</tr>";
+            "<td>" + present.shopName + "</td>" +
+            "<td>" + skuStr + "</td>" +
+            "<td>" + present.num + "</td>" +
+            "<td>0</td>" +
+            "<td>100</td>" +
+            "<td>0</td>" +
+            "<td>0</td>" +
+            "<td>0</td>" +
+            "<td>0</td>" +
+            "<td>0</td>" +
+            /*"<td>"+ Math.round(present.shopFee*100)/100 +"</td>"+*/
+            "<td>否</td>" +
+            "<td></td>" +
+            "<td></td>" +
+            "</tr>";
         product_index++;
         product_index++;
         appendGiftsList(present, giftStr, cmPromotion);
         appendGiftsList(present, giftStr, cmPromotion);
     }
     }
@@ -1461,8 +1470,8 @@ function setLadderPrice(obj, numVal, index) {
         $("#check-item" + index).parents("tr").find("#price" + index).val(ladderList[resultLadder]["buyPrice"]);
         $("#check-item" + index).parents("tr").find("#price" + index).val(ladderList[resultLadder]["buyPrice"]);
         $("#check-item" + index).parents("tr").find("#priceLabel" + index).text(ladderList[resultLadder]["buyPrice"]);
         $("#check-item" + index).parents("tr").find("#priceLabel" + index).text(ladderList[resultLadder]["buyPrice"]);
         $("#check-item" + index).parents("tr").find("#discountPrice" + index).val(ladderList[resultLadder]["buyPrice"]);
         $("#check-item" + index).parents("tr").find("#discountPrice" + index).val(ladderList[resultLadder]["buyPrice"]);
-        if(numVal<ladderList[0]["buyNum"]){
-            var old=$("#oldPrice"+index).val();
+        if (numVal < ladderList[0]["buyNum"]) {
+            var old = $("#oldPrice" + index).val();
             $("#check-item" + index).parents("tr").find("#price" + index).val(old);
             $("#check-item" + index).parents("tr").find("#price" + index).val(old);
             $("#check-item" + index).parents("tr").find("#priceLabel" + index).text(old);
             $("#check-item" + index).parents("tr").find("#priceLabel" + index).text(old);
             $("#check-item" + index).parents("tr").find("#discountPrice" + index).val(old);
             $("#check-item" + index).parents("tr").find("#discountPrice" + index).val(old);