Forráskód Böngészése

采美sku/呵呵sku bugfix

zhijiezhao 2 éve
szülő
commit
04c047e7ff
27 módosított fájl, 298 hozzáadás és 199 törlés
  1. 1 1
      src/main/java/com/caimei/modules/bulkpurchase/service/PurchaseProductService.java
  2. 3 1
      src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java
  3. 22 22
      src/main/java/com/caimei/modules/bulkpurchase/web/PurchaseProductController.java
  4. 1 1
      src/main/java/com/caimei/modules/hehe/service/CmHeheProductService.java
  5. 2 0
      src/main/java/com/caimei/modules/order/dao/NewOrderProductDao.java
  6. 6 0
      src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java
  7. 23 18
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  8. 4 1
      src/main/java/com/caimei/modules/order/web/NewOrderController.java
  9. 4 0
      src/main/java/com/caimei/modules/product/dao/ProductDao.java
  10. 9 0
      src/main/java/com/caimei/modules/product/entity/CmPromotion.java
  11. 26 3
      src/main/java/com/caimei/modules/product/service/ProductService.java
  12. 5 4
      src/main/resources/mappings/modules/bulkpurchase/PurchaseProductMapper.xml
  13. 1 2
      src/main/resources/mappings/modules/hehe/HeheProductMapper.xml
  14. 5 1
      src/main/resources/mappings/modules/order/OrderProductMapper.xml
  15. 3 1
      src/main/resources/mappings/modules/product/CmPromotionMapper.xml
  16. 10 6
      src/main/resources/mappings/modules/product/ProductMapper.xml
  17. 1 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp
  18. 112 87
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductForm.jsp
  19. 1 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductList.jsp
  20. 1 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp
  21. 11 10
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheCollageProductForm.jsp
  22. 2 2
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductForm.jsp
  23. 3 1
      src/main/webapp/WEB-INF/views/modules/hehe/heheDiscountActivityProductForm.jsp
  24. 7 0
      src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp
  25. 5 4
      src/main/webapp/WEB-INF/views/modules/product-new/productList.jsp
  26. 0 8
      src/main/webapp/WEB-INF/views/modules/product-new/recommend.jsp
  27. 30 26
      src/main/webapp/static/modules/bulkpurchase/orderForm.js

+ 1 - 1
src/main/java/com/caimei/modules/bulkpurchase/service/PurchaseProductService.java

@@ -39,7 +39,7 @@ public class PurchaseProductService extends CrudService<PurchaseProductDao, Purc
     }
 
     public List<PurchaseProduct> findSencondProductPage(PurchaseProduct purchaseProduct) {
-    return purchaseProductDao.findSencondProductPage(purchaseProduct);
+        return purchaseProductDao.findSencondProductPage(purchaseProduct);
     }
 
 

+ 3 - 1
src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java

@@ -165,7 +165,9 @@ public class CmRefundsProductController extends BaseController {
                 cmReturnedPurchase.setFreeRefundFee(cmReturnedPurchase.getRefundFee());
             }
             NewOrder newOrder = newOrderService.getNewOrder(cmReturnedPurchase);
-
+            List<NewShopOrder> newShopOrderss = newOrder.getNewShopOrders();
+            newShopOrderss.removeIf(s -> s.getShopID() == 998);
+            newOrder.setNewShopOrders(newShopOrderss);
             //统计订单已支付金额
             Double yizhifu = 0d;
             Double totalDiscount = 0d;

+ 22 - 22
src/main/java/com/caimei/modules/bulkpurchase/web/PurchaseProductController.java

@@ -331,9 +331,9 @@ public class PurchaseProductController extends BaseController {
             Product product = productDao.get(purchaseProduct.getProductId().toString());
             if (product != null) {
                 List<CmSku> skus = productDao.findSkuList(product.getProductID());
-                product.setSkuId(skus.get(0).getSkuId());
-                product.setPrice(skus.get(0).getPrice());
-                product.setSkuList(skus);
+                purchaseProduct.setSkuId(skus.get(0).getSkuId());
+                purchaseProduct.setPrice(skus.get(0).getPrice().toString());
+                purchaseProduct.setSkuList(skus);
                 CmSvipProduct svipProduct = purchaseProductService.getSvipProduct(purchaseProduct.getProductId(), purchaseProduct.getUserId());
                 CmPromotion productPromotion = cmPromotionService.findProductPromotion(product.getShopID().toString(), Long.parseLong(product.getProductID().toString()));
                 if (null != svipProduct && 1 == svipProduct.getSvipPriceFlag()) {
@@ -342,26 +342,26 @@ public class PurchaseProductController extends BaseController {
                 } else if (productPromotion != null) {
                     purchaseProduct.setCmPromotion(productPromotion);
                 } else {
-                    if ("1".equals(product.getLadderPriceFlag())) {
-                        purchaseProduct.setLadderPriceFlag(1);
-                        // 查询阶梯价格
-                        List<ProductLadderPrice> ladderPriceList = purchaseProductService.findLadderPriceList(purchaseProduct.getProductId());
-                        if (null != ladderPriceList && ladderPriceList.size() > 0) {
-                            purchaseProduct.setPrice(ladderPriceList.get(0).getBuyPrice().toString());
-                            purchaseProduct.setNum(ladderPriceList.get(0).getBuyNum().toString());
-                            IntStream.range(0, ladderPriceList.size()).forEach(i -> {
-                                if (i == ladderPriceList.size() - 1) {
-                                    ladderPriceList.get(i).setBuyNumRangeShow("≥" + ladderPriceList.get(i).getBuyNum());
-                                } else {
-                                    String buyNumRangeShow = ladderPriceList.get(i).getBuyNum() + "~" + (ladderPriceList.get(i + 1).getBuyNum() - 1);
-                                    ladderPriceList.get(i).setBuyNumRangeShow(buyNumRangeShow);
-                                }
-                            });
-                            purchaseProduct.setLadderPriceList(ladderPriceList);
-                        } else {
+//                    if ("1".equals(product.getLadderPriceFlag())) {
+//                        purchaseProduct.setLadderPriceFlag(1);
+//                        // 查询阶梯价格
+//                        List<ProductLadderPrice> ladderPriceList = purchaseProductService.findLadderPriceList(purchaseProduct.getProductId());
+//                        if (null != ladderPriceList && ladderPriceList.size() > 0) {
+//                            purchaseProduct.setPrice(ladderPriceList.get(0).getBuyPrice().toString());
+//                            purchaseProduct.setNum(ladderPriceList.get(0).getBuyNum().toString());
+//                            IntStream.range(0, ladderPriceList.size()).forEach(i -> {
+//                                if (i == ladderPriceList.size() - 1) {
+//                                    ladderPriceList.get(i).setBuyNumRangeShow("≥" + ladderPriceList.get(i).getBuyNum());
+//                                } else {
+//                                    String buyNumRangeShow = ladderPriceList.get(i).getBuyNum() + "~" + (ladderPriceList.get(i + 1).getBuyNum() - 1);
+//                                    ladderPriceList.get(i).setBuyNumRangeShow(buyNumRangeShow);
+//                                }
+//                            });
+//                            purchaseProduct.setLadderPriceList(ladderPriceList);
+//                        } else {
                             purchaseProduct.setLadderPriceFlag(0);
-                        }
-                    }
+//                        }
+//                    }
                 }
             }
         }

+ 1 - 1
src/main/java/com/caimei/modules/hehe/service/CmHeheProductService.java

@@ -152,7 +152,7 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
     }
 
     public List<CmSku> getProductSku(Integer productId) {
-        List<CmSku> skuList = productDao.findSkuList(productId);
+        List<CmSku> skuList = productDao.findHeHeSku(productId);
         skuList.forEach(s -> s.setLadderPriceList(cmHeheProductDao.findLadderList(s.getSkuId())));
         return skuList;
     }

+ 2 - 0
src/main/java/com/caimei/modules/order/dao/NewOrderProductDao.java

@@ -106,4 +106,6 @@ public interface NewOrderProductDao extends CrudDao<NewOrderProduct> {
 
 
     Double findPriceBySku(String skuId);
+
+    String findSkuIdByProductId(Integer productID);
 }

+ 6 - 0
src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java

@@ -1,6 +1,7 @@
 package com.caimei.modules.order.entity;
 
 import com.caimei.modules.product.entity.CmPromotion;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.OrderProductLadderPrice;
 import com.caimei.po.ProductLadderPrice;
 import com.caimei.utils.AppUtils;
@@ -119,6 +120,11 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     private Double svipReduction;//超级会员优惠
     private Double svipTaxReduction;//超级会员税费优惠
     private String splitCode;// 商品分账号
+    private String skuStr;
+    private List<CmSku> skuList;
+
+
+
 
     public Integer getLadderPriceFlag() {
         return ladderPriceFlag;

+ 23 - 18
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -26,10 +26,7 @@ import com.caimei.modules.order.utils.RandomCode;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.dao.CmSecondHandDetailDao;
 import com.caimei.modules.product.dao.ProductDao;
-import com.caimei.modules.product.entity.CmPromotion;
-import com.caimei.modules.product.entity.CmSecondHandDetail;
-import com.caimei.modules.product.entity.OrderProductLadderPrice;
-import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.product.entity.*;
 import com.caimei.modules.user.dao.CmUserDao;
 import com.caimei.modules.user.dao.MessageCenterDao;
 import com.caimei.modules.user.dao.NewCmClubDao;
@@ -182,7 +179,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             if (newOrder.getAffirmPaymentFlag() == null) {
                 newOrder.setAffirmPaymentFlag("0");
             }
-            if(newOrder.getPromotionalGiftsCount() !=null ){
+            if (newOrder.getPromotionalGiftsCount() != null) {
                 // 有赠品不能线上支付
                 if (newOrder.getPresentCount() > 0 || newOrder.getPromotionalGiftsCount() > 0) {
                     onlinePay = false;
@@ -245,7 +242,6 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 o.setUseBalanceAmount(0D);//余额
                 o.setIsGiftProduct("0");//【旧】赠品标识
                 Product product = productDao.get(o.getProductID() + "");
-                o.setProductUnit(product.getUnit());
                 o.setProductImage(AppUtils.getProductImageURL(product.getMainImage(), 0, ""));
                 Integer shopID = o.getShopID() == null ? product.getShopID() : o.getShopID();
                 String name = "";
@@ -769,14 +765,15 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                                     }
                                 }
                             }
-                        } else { // 表单订单商品ID为空  可能是新增  但是 增加的是同样的商品的话 会覆盖原来的商品 也相当于是 修改
+                        } else {
+                            // 表单订单商品ID为空  可能是新增  但是 增加的是同样的商品的话 会覆盖原来的商品 也相当于是 修改
                             // 可能存在一种情况  就是原来存在的商品  又被重新添加了一次
                             // 这时,页面传过来的商品的 product.getOrderProductID() == null
                             // 所以 不能直接通过 product.getOrderProductID() == null 条件来决定是否insert
-                            // 还需要对比一下productID
+                            // 还需要对比一下skuId
                             if (CollectionUtils.isNotEmpty(dbOrderProducts)) {
                                 for (NewOrderProduct dbProduct : dbOrderProducts) {
-                                    if (dbProduct.getProductID().intValue() == product.getProductID().intValue() && product.getProductType().equals(dbProduct.getProductType())) {
+                                    if (dbProduct.getSkuId().intValue() == product.getSkuId().intValue() && product.getProductType().equals(dbProduct.getProductType())) {
                                         product.setOrderID(newOrder.getOrderID());
                                         product.setOrderNo(dbProduct.getOrderNo());
                                         product.setShopOrderID(dbProduct.getShopOrderID());
@@ -1025,6 +1022,14 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     public double getOrderProductCostPrice(NewOrderProduct o, Integer userID) {
         //获取产品表的成本
         Product product = productDao.get(String.valueOf(o.getProductID()));
+        CmSku s = productDao.findSkuById(o.getSkuId());
+        product.setCostCheckFlag(s.getCostCheckFlag().toString());
+        o.setProductUnit(s.getUnit());
+        if (1 == s.getCostCheckFlag()) {
+            product.setCostPrice(s.getCostPrice().toString());
+        } else {
+            product.setCostProportional(s.getCostProportional().toString());
+        }
         Float costPrice = 0.0f;//成本价
         //判断是否选中固定成本价
         if (null != product.getCostPrice() && org.apache.commons.lang3.StringUtils.equals("1", product.getCostCheckFlag()) && StringUtils.isNotEmpty(product.getCostPrice())) {
@@ -1243,7 +1248,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             //获取订单商品
             List<NewOrderProduct> list = new ArrayList<>();
             List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(newOrder.getOrderID());
-            Integer count=newOrderDao.findShopOrderSize(newOrder.getOrderID());
+            Integer count = newOrderDao.findShopOrderSize(newOrder.getOrderID());
             if (count > 1) {
                 newOrder.setRechargeGoods(3);
             }
@@ -1385,8 +1390,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 }
             }
             List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(cmReturnedPurchase.getOrderID());
-            if(null!=cmReturnedPurchase.getOnlineShopOrderId()&&0<cmReturnedPurchase.getOnlineShopOrderId()){
-                 shopOrders = newShopOrderDao.findListByShopOrderId(cmReturnedPurchase.getOnlineShopOrderId());
+            if (null != cmReturnedPurchase.getOnlineShopOrderId() && 0 < cmReturnedPurchase.getOnlineShopOrderId()) {
+                shopOrders = newShopOrderDao.findListByShopOrderId(cmReturnedPurchase.getOnlineShopOrderId());
             }
             if (CollectionUtils.isNotEmpty(shopOrders)) {
                 for (NewShopOrder shopOrder : shopOrders) {
@@ -1727,14 +1732,14 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //24小时制
 
                 Date dat = new Date();
-                Date d=new Date();
+                Date d = new Date();
                 dat.setTime(autoCloseTimeMills);
                 System.out.println("时间戳转日期格式:" + simpleDateFormat.format(dat));
-                Long s=(d.getTime()-dat.getTime())/24/60/60/1000;
-                if(s>cfg.getValue()){
+                Long s = (d.getTime() - dat.getTime()) / 24 / 60 / 60 / 1000;
+                if (s > cfg.getValue()) {
                     //推送信息中心-交易物流
                     String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(dat);
-                    MessageCenter messageCenter=new MessageCenter();
+                    MessageCenter messageCenter = new MessageCenter();
                     messageCenter.setShopId(null);
                     messageCenter.setClubId(shopOrder.getClubID());
                     messageCenter.setUserType(1);
@@ -1786,7 +1791,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                     }
                     String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
                     //推送信息中心-交易物流
-                    MessageCenter messageCenter=new MessageCenter();
+                    MessageCenter messageCenter = new MessageCenter();
                     messageCenter.setShopId(null);
                     messageCenter.setClubId(order.getClubID());
                     messageCenter.setUserType(1);
@@ -1828,7 +1833,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
 
                 String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
                 //推送信息中心-交易物流
-                MessageCenter messageCenter=new MessageCenter();
+                MessageCenter messageCenter = new MessageCenter();
                 messageCenter.setShopId(null);
                 messageCenter.setClubId(order.getClubID());
                 messageCenter.setUserType(1);

+ 4 - 1
src/main/java/com/caimei/modules/order/web/NewOrderController.java

@@ -429,6 +429,9 @@ public class NewOrderController extends BaseController {
                         o.setLadderPriceFlag(Integer.valueOf(ladderPriceFlag));
                     }
                     String skuId = jsonObject.getString("skuId");
+                    if("2".equals(o.getProductCategory())){
+                        skuId=newOrderProductDao.findSkuIdByProductId(o.getProductID());
+                    }
                     if (null == o.getPrice()) {
                         Double price = newOrderProductDao.findPriceBySku(skuId);
                         o.setPrice(price);
@@ -445,7 +448,7 @@ public class NewOrderController extends BaseController {
                             o.setShouldPayTotalTax(o.getTotalAddedValueTax());
                         }
                     } else {
-                        o.setSkuId(0);
+                        o.setSkuId(productDao.findSkuIdByPromotionsId(o.getPromotionsId()));
                         o.setPreferential(0d);
                         o.setDiscount(100d);
                         o.setDiscountFee(0d);

+ 4 - 0
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -213,4 +213,8 @@ public interface ProductDao extends CrudDao<Product> {
     void updateCmSku(CmSku cmSku);
 
     CmSku findSku(Integer productId);
+
+    CmSku findSkuById(Integer skuId);
+
+    Integer findSkuIdByPromotionsId(Integer promotionsId);
 }

+ 9 - 0
src/main/java/com/caimei/modules/product/entity/CmPromotion.java

@@ -12,6 +12,7 @@ import java.util.List;
 public class CmPromotion extends DataEntity<CmPromotion> {
     private static final long serialVersionUID = 1L;
 
+    private String unit;
     /**
      * 赠品的skuId,商品无需
      */
@@ -150,6 +151,14 @@ public class CmPromotion extends DataEntity<CmPromotion> {
      */
     private String searchDbFlag;
 
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
     public Integer getSkuId() {
         return skuId;
     }

+ 26 - 3
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -442,9 +442,7 @@ public class ProductService extends CrudService<ProductDao, Product> {
             productDao.updateMainImage(product);
         } else {
             productDao.updateByPrimaryKeySelective(product);
-            //删除旧sku,insert新的
-            productDao.deleteSkus(product.getProductID());
-            addSkus(product);
+            updateSku(product);
         }
         ProductDetailInfo queryProductDetailInfo = productDao.queryProductDetailInfo(product.getProductID());
         if (queryProductDetailInfo != null) {
@@ -454,6 +452,31 @@ public class ProductService extends CrudService<ProductDao, Product> {
         }
     }
 
+    private void updateSku(Product product) {
+        List<CmSku> skuList = product.getSkuList();
+        if(null!=skuList&&skuList.size()>0){
+            productDao.deleteLadderPriceById(product.getProductID());
+            skuList.forEach(s->{
+                s.setProductId(product.getProductID());
+                if(null!=s.getSkuId()){
+                    productDao.updateCmSku(s);
+                }else{
+                    productDao.insertSku(s);
+                }
+                if (null != s.ladderPriceFlag() && 1 == s.ladderPriceFlag()) {
+                    List<CmLadderPrice> cmLadderPrices = s.ladderPriceList();
+                    for (int i = 0; i < cmLadderPrices.size(); i++) {
+                        if (0 == i || "0".equals(cmLadderPrices.get(i).delFlag())) {
+                            cmLadderPrices.get(i).setProductId(product.getProductID());
+                            cmLadderPrices.get(i).setSkuId(s.getSkuId());
+                            productDao.insertCmLadderPrice(cmLadderPrices.get(i));
+                        }
+                    }
+                }
+            });
+        }
+    }
+
     public void addSkus(Product product) {
         //保存sku
         List<CmSku> skuList = product.getSkuList();

+ 5 - 4
src/main/resources/mappings/modules/bulkpurchase/PurchaseProductMapper.xml

@@ -155,12 +155,13 @@
           AND delFlag = 0
     </select>
     <select id="findSencondProductPage" resultType="com.caimei.modules.bulkpurchase.entity.PurchaseProduct">
-        SELECT b.name shopName ,b.`shopID` shopId,a.name purchaseProductName,
-        a.price,a.`productID` productId,a.productCode productNo,a.mainImage image
-        ,a.costCheckFlag costCheckFlag,a.costPrice costPrice,a.costProportional costProportional, a.normalPrice
-        ,a.productCategory as "productCategory",cshd.secondHandType as "secondHandType",a.ladderPriceFlag
+        SELECT b.name as shopName ,b.`shopID` as shopId,a.name purchaseProductName,
+        cs.price,a.`productID` as productId,a.productCode productNo,a.mainImage image
+        ,cs.costCheckFlag,cs.costPrice,cs.costProportional, cs.normalPrice
+        ,a.productCategory as "productCategory",cshd.secondHandType as "secondHandType",cs.ladderPriceFlag
         ,a.includedTax,a.invoiceType
         FROM product a LEFT JOIN shop b ON b.shopID=a.shopID
+        left join cm_sku cs on a.productID=cs.productId
         left join cm_second_hand_detail cshd on cshd.productID = a.productID
         <where>
             <if test="purchaseProductName != null and purchaseProductName != ''">

+ 1 - 2
src/main/resources/mappings/modules/hehe/HeheProductMapper.xml

@@ -22,8 +22,7 @@
 		a.updateTime AS "updateTime",
 		a.isDelete AS "isDelete",
 		p.name AS "name",
-		p.mainImage AS "mainImage",
-		p.minBuyNumber AS "minBuyNumber"
+		p.mainImage AS "mainImage"
     </sql>
     <sql id="heheProductJoins">
         LEFT JOIN product p on p.productID = a.productID

+ 5 - 1
src/main/resources/mappings/modules/order/OrderProductMapper.xml

@@ -627,5 +627,9 @@
         from cm_sku
         where skuId = #{skuId}
     </select>
-
+    <select id="findSkuIdByProductId" resultType="java.lang.String">
+        select skuId
+        from cm_sku
+        where productId = #{productID}
+    </select>
 </mapper>

+ 3 - 1
src/main/resources/mappings/modules/product/CmPromotionMapper.xml

@@ -362,10 +362,12 @@
                prp.productId,
                prp.supplierId,
                pr.discount,
-               cpg.skuId
+               cpg.skuId,
+               cs.unit
         from cm_promotions pr
                  left join cm_promotions_product prp on pr.id = prp.promotionsId
                  LEFT JOIN cm_promotions_gift cpg ON pr.id = cpg.promotionsId
+                 left join cm_sku cs on cpg.skuId = cs.skuId
         where (prp.productId = #{productId}
             or prp.supplierId = #{shopId})
           and (pr.status = 1 or (pr.status = 2 and (NOW() between pr.beginTime and pr.endTime)))

+ 10 - 6
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -1411,7 +1411,6 @@
                cpr.recommendProductID AS recommendProductID,
                cpr.sort               AS sort,
                pro.name               AS productName,
-               pro.unit               AS unit,
                pro.mainImage          AS img,
                cpr.shopName           AS shopName
         from cm_product_recommend cpr
@@ -1430,7 +1429,6 @@
         select
         a.productID AS productID,
         a.name AS productName,
-        a.unit AS unit,
         a.mainImage AS img,
         s.name AS shopName
         from product a
@@ -1798,7 +1796,6 @@
     <select id="findRecommendBySys" resultType="com.caimei.modules.product.entity.CmProductRecommend">
         select p.productID AS recommendProductID,
                p.name      AS productName,
-               p.unit      AS unit,
                p.mainImage AS img,
                s.name      AS shopName
         from product p
@@ -1814,7 +1811,6 @@
         select p.productID       AS id,
                1                 AS type,
                p.name            AS name,
-               p.unit            AS unit,
                p.mainImage       AS img,
                s.name            AS shopName,
                p.productCategory as "productCategory"
@@ -1829,7 +1825,6 @@
         p.productID AS id,
         1 AS type,
         p.name AS name,
-        p.unit AS unit,
         p.mainImage AS img,
         s.name AS shopName,
         p.productCategory as "productCategory"
@@ -2053,10 +2048,19 @@
         where productId = #{productId}
     </select>
     <select id="findSku" resultType="com.caimei.modules.product.entity.CmSku">
-        select price, costPrice, costCheckFlag, costProportional
+        select price, costPrice, costCheckFlag, costProportional,normalPrice
         from cm_sku
         where productId=#{productId}
         order by price asc
         limit 1
     </select>
+    <select id="findSkuById" resultType="com.caimei.modules.product.entity.CmSku">
+        select price, costPrice, costCheckFlag, costProportional,unit
+        from cm_sku
+        where skuId=#{skuId}
+    </select>
+    <select id="findSkuIdByPromotionsId" resultType="java.lang.Integer">
+        select skuId from cm_promotions_gift
+        where promotionsId=#{promotionsId}
+    </select>
 </mapper>

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp

@@ -446,6 +446,7 @@
                             <td>购买数量(赠品数)X${cmReturnedPurchaseProduct.num}(${cmReturnedPurchaseProduct.presentNum})</td>
                         </tr>
                         <tr>
+                            <td>规格:${cmReturnedPurchaseProduct.unit}</td>
                             <td>税率:${cmReturnedPurchaseProduct.taxRate}</td>
                             <td>税费:¥${cmReturnedPurchaseProduct.totalAddedValueTax}</td>
                             <td colspan="2">总额:¥${cmReturnedPurchaseProduct.totalFee}</td>

+ 112 - 87
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductForm.jsp

@@ -120,14 +120,14 @@
             <th class="hide"><input class="check-item" type="hidden" name="cmClub" id="check-item0"
                                     value='${fns:toJson(purchaseProduct)}'/></th>
             <td>${purchaseProduct.productId}</td>
-            <td>${purchaseProduct.skuId}</td>
+            <td id="skuId">${purchaseProduct.skuId}</td>
             <td id="purchaseProductName"
                 title="${prchaseProduct.purchaseProductName}">${fns:abbr(purchaseProduct.purchaseProductName,16)}</td>
             <td id="productNo">${purchaseProduct.productNo}</td>
             <td id="shopName" title="${purchaseProduct.shopName}">${fns:abbr(purchaseProduct.shopName,10)}</td>
             <td>
                 <input id="hideSkus" value='${fns:toJson(purchaseProduct.skuList)}' hidden/>
-                <select onchange="checkSkuValue(${state.index});" id="ints${state.index}">
+                <select onchange="checkSkuValue();" id="ints0">
                     <c:forEach items="${purchaseProduct.skuList}" var="skus" varStatus="ind">
                         <option value="${skus.skuId}/${ind.index}">${skus.unit}</option>
                     </c:forEach>
@@ -135,7 +135,7 @@
             </td>
             <td><label id="priceLabel0"
                        style="text-decoration: ${purchaseProduct.svipPriceFlag eq 1 or purchaseProduct.cmPromotion.mode eq 1?'line-through':''}">${purchaseProduct.price}</label>
-                <label id="svipDiscountPrice0"  style="display:none">${purchaseProduct.svipDiscountPrice}</label>
+                <label id="svipDiscountPrice0" style="display:none">${purchaseProduct.svipDiscountPrice}</label>
                 <label style="color: red">
                     <c:if test="${(purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2)
                          or purchaseProduct.svipPriceFlag eq 1}">
@@ -156,17 +156,17 @@
             <td><input type="text" name="discount" id="discount0"
                        value="${empty purchaseProduct.discount ?100:(purchaseProduct.discount)}"
                        onchange="discountPriceVal(0)"
-                        ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
-                        or purchaseProduct.ladderPriceFlag eq 1
-                        or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
+            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
+                    or purchaseProduct.ladderPriceFlag eq 1
+                    or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
                        style="width: 50px">%
             </td>
             <td><input name="discountPrice" id="discountPrice0"
                        value="${empty purchaseProduct.discount ?(purchaseProduct.svipPriceFlag eq 1?purchaseProduct.svipDiscountPrice: purchaseProduct.price):(purchaseProduct.discount)}"
                        onchange="countDiscount(0)"
-                        ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
-                        or purchaseProduct.ladderPriceFlag eq 1
-                        or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
+            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
+                    or purchaseProduct.ladderPriceFlag eq 1
+                    or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
                        style="width: 80px;text-decoration: ${purchaseProduct.cmPromotion.mode eq 1?'line-through':''}">
                 <c:if test="${purchaseProduct.ladderPriceFlag eq 1}"><br>
                     <a href="javascript:;" class="ladderPrice"><span>阶梯价格</span>
@@ -206,7 +206,8 @@
                        value="${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?0:(purchaseProduct.includedTax != '' and purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)?'---': purchaseProduct.taxRate}"
                 ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?'readonly="readonly"':''}
                 ${purchaseProduct.includedTax eq 1?'readonly="readonly"':(purchaseProduct.includedTax ne '' and (purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3) )?'readonly="readonly"':''}
-                       onchange="taxRateVal(0)" style="width: 50px">${(purchaseProduct.includedTax != '' and purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)?'':'%'}
+                       onchange="taxRateVal(0)"
+                       style="width: 50px">${(purchaseProduct.includedTax != '' and purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)?'':'%'}
                 <input type="hidden" name="taxRate" id="taxRate0">
             </td>
             <td>
@@ -283,58 +284,77 @@
                 </c:if>
             </td>
 
-        <%--以下三个应付不显示,但是内容值参与计算并保存---关闭控制入口移动到财务管理中控制20181201--%>
-        <td style="display: none"><input type="text" name="shopFee1" id="shopFee10" value= "${purchaseProduct.shopFee}" class="required1 " onchange="shopFee(0)"  style="width: 50px">
-        </td>
-        <td style="display: none">
-            <input type="text" name="otherFee1" id="otherFee10" value= "${purchaseProduct.otherFee}" class="required2 " onchange="otherFee(0)"  style="width: 50px">
-        </td>
-        <td style="display: none">
-            <input name="cmFee1" id="cmFee10" value= "${purchaseProduct.cmFee}" class="required3 "  readonly style="width: 60px">
-        </td>
-        <%--促销活动mode--%>
-        <td style="display: none">
-            <input name="mode"  id="mode0" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.mode: '0'}" readonly  style="width: 80px">
-        </td>
-        <%--促销活动touchPrice--%>
-        <td style="display: none">
-            <input name="touchPrice"  id="touchPrice0" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.touchPrice: '0'}" readonly  style="width: 80px">
-        </td>
-        <%--促销活动reducedPrice--%>
-        <td style="display: none">
-            <input name="touchPrice"  id="reducedPrice0" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.reducedPrice: '0'}" readonly  style="width: 80px">
-        </td>
-        <%--name--%>
-        <td style="display: none">
-            <input name="name"  id="promotionName0" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.name: '0'}" readonly  style="width: 80px">
-        </td>
-        <%--promotionsId--%>
-        <td style="display: none">
-            <input name="promotionsId"  id="promotionsId0" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.id: '0'}" readonly  style="width: 80px">
-        </td>
-        <%--${ctx}--%>
-        <td style="display: none">
-            <input name="ctx"  id="ctx0" value="${ctx}" readonly  style="width: 80px">
-        </td>
-        <td style="display: none">
-            <input type="text" name="svipReduction" id="svipReduction0" value="${purchaseProduct.svipReduction ne null?purchaseProduct.svipReduction:'0'}">
-        </td>
-        <td style="display: none">
-            <input name="svipTaxReduction" id="svipTaxReduction0" value="${purchaseProduct.svipTaxReduction ne null?purchaseProduct.svipTaxReduction:'0'}">
-        </td>
-        <td style="display: none">
-            <input name="svipPriceFlag" id="svipPriceFlag0" value="${purchaseProduct.svipPriceFlag ne null?purchaseProduct.svipPriceFlag:'0'}">
-        </td>
-        <td style="display: none">
-            <input name="svipPriceType" id="svipPriceType0" value="${purchaseProduct.svipPriceType ne null?purchaseProduct.svipPriceType:'0'}">
-        </td>
-<%--        成本价--%>
-        <td style="display: none">
-            <input name="costPrice"  id="costPrice${state.index}" value="${purchaseProduct.costPrice}" readonly  style="width: 80px">
-        </td>
-    </tr>
-    </tbody>
-</table>
+            <%--以下三个应付不显示,但是内容值参与计算并保存---关闭控制入口移动到财务管理中控制20181201--%>
+            <td style="display: none"><input type="text" name="shopFee1" id="shopFee10"
+                                             value="${purchaseProduct.shopFee}" class="required1 " onchange="shopFee(0)"
+                                             style="width: 50px">
+            </td>
+            <td style="display: none">
+                <input type="text" name="otherFee1" id="otherFee10" value="${purchaseProduct.otherFee}"
+                       class="required2 " onchange="otherFee(0)" style="width: 50px">
+            </td>
+            <td style="display: none">
+                <input name="cmFee1" id="cmFee10" value="${purchaseProduct.cmFee}" class="required3 " readonly
+                       style="width: 60px">
+            </td>
+            <%--促销活动mode--%>
+            <td style="display: none">
+                <input name="mode" id="mode0"
+                       value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.mode: '0'}" readonly
+                       style="width: 80px">
+            </td>
+            <%--促销活动touchPrice--%>
+            <td style="display: none">
+                <input name="touchPrice" id="touchPrice0"
+                       value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.touchPrice: '0'}"
+                       readonly style="width: 80px">
+            </td>
+            <%--促销活动reducedPrice--%>
+            <td style="display: none">
+                <input name="touchPrice" id="reducedPrice0"
+                       value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.reducedPrice: '0'}"
+                       readonly style="width: 80px">
+            </td>
+            <%--name--%>
+            <td style="display: none">
+                <input name="name" id="promotionName0"
+                       value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.name: '0'}" readonly
+                       style="width: 80px">
+            </td>
+            <%--promotionsId--%>
+            <td style="display: none">
+                <input name="promotionsId" id="promotionsId0"
+                       value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.id: '0'}" readonly
+                       style="width: 80px">
+            </td>
+            <%--${ctx}--%>
+            <td style="display: none">
+                <input name="ctx" id="ctx0" value="${ctx}" readonly style="width: 80px">
+            </td>
+            <td style="display: none">
+                <input type="text" name="svipReduction" id="svipReduction0"
+                       value="${purchaseProduct.svipReduction ne null?purchaseProduct.svipReduction:'0'}">
+            </td>
+            <td style="display: none">
+                <input name="svipTaxReduction" id="svipTaxReduction0"
+                       value="${purchaseProduct.svipTaxReduction ne null?purchaseProduct.svipTaxReduction:'0'}">
+            </td>
+            <td style="display: none">
+                <input name="svipPriceFlag" id="svipPriceFlag0"
+                       value="${purchaseProduct.svipPriceFlag ne null?purchaseProduct.svipPriceFlag:'0'}">
+            </td>
+            <td style="display: none">
+                <input name="svipPriceType" id="svipPriceType0"
+                       value="${purchaseProduct.svipPriceType ne null?purchaseProduct.svipPriceType:'0'}">
+            </td>
+            <%--        成本价--%>
+            <td style="display: none">
+                <input name="costPrice" id="costPrice${state.index}" value="${purchaseProduct.costPrice}" readonly
+                       style="width: 80px">
+            </td>
+        </tr>
+        </tbody>
+    </table>
 </div>
 <script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/orderForm.js?version=<%=Math.random()%>"></script>
 <script type="text/javascript">
@@ -358,11 +378,17 @@
     });
 
     function initData() {
-        debugger
         var data = window.parent.window.getCurPurchaseProduct('${purchaseProduct.productId}');
-        console.log("kaifa ", data)
-        var $checkItem = $("#check-item0");
-        $($checkItem).val(data);
+        var $checkItem = $("#check-item0").val();
+        var skus = JSON.parse($("#hideSkus").val());
+        var skuStr = skus[0].skuId + "/" + "0";
+        $checkItem["skuStr"] = skuStr;
+        var c=JSON.parse(data);
+        c.skuList=JSON.parse($("#hideSkus").val());
+        c.skuStr=skuStr=skuStr;
+
+
+        $("#check-item0").val(JSON.stringify(c));
         var obj = JSON.parse(data);
         $("#purchaseProductName").text(obj.name);
         $("#productNo").text(obj.productNo);
@@ -386,11 +412,11 @@
         var buyAgainFlag = obj.buyAgainFlag;
         if (null != buyAgainFlag && 1 == buyAgainFlag) {//表示可以复购
 //                 $("#buyAgainFlag0").val(1);
-            $('.select2-chosen').text('是')
+//             $('.select2-chosen').text('是')
 //                $("#buyAgainFlag0 option[value='"+1+"']").attr("selected","selected");
         } else {
 //                $("#buyAgainFlag0").val(0);
-            $('.select2-chosen').text('否')
+//             $('.select2-chosen').text('否')
 //                $("#buyAgainFlag0 option[value='"+0+"']").attr("selected","selected");
         }
         if (Number(obj.discount) < 100 && (obj.promotionsId != null && obj.promotionsId != 0 && obj.promotionsId != '')) {
@@ -410,6 +436,7 @@
         var items = new Array();
         var product = $('.check-item').val();
         var json = JSON.parse(product);
+        console.log("我看------"+product);
 
         var shopFee = json.shopFee1;
         var otherFee = json.otherFee1;
@@ -447,21 +474,19 @@
         });
     }
 
-    function checkSkuValue(ind) {
-        var c = "#" + "ints" + ind;
-        var skuStr = $(c).val();
-        var $checkItem = eval('(' + $("#check-item" + ind).val() + ')');
+    function checkSkuValue() {
+        var skuStr = $("#ints0").val();
+        var $checkItem = eval('(' + $("#check-item0").val() + ')');
         $checkItem["skuStr"] = skuStr;
         //切换价格
-        var price = "priceLabel" + ind;//单价
-        var singlePrice = "#" + "discountPrice" + ind;
-        var totalFee = "#" + "totalFee" + ind;
+        var price = "priceLabel0";//单价
+        var singlePrice = "#" + "discountPrice0";
+        var totalFee = "#" + "totalFee0";
         var skus = JSON.parse($("#hideSkus").val());
         var skuIndex = skuStr.split("/")[1];
-        debugger;
         console.log(skus[skuIndex].skuId);
-        $checkItem["skuId"] =skus[skuIndex].skuId;
-        $("#skuId" + ind).text(skus[skuIndex].skuId);
+        $checkItem["skuId"] = skus[skuIndex].skuId;
+        $("#skuId").text(skus[skuIndex].skuId);
         //页面价格赋值
         document.getElementById(price).innerHTML = skus[skuIndex].price;
         $(singlePrice).val(skus[skuIndex].price);
@@ -470,33 +495,33 @@
         $checkItem["price"] = skus[skuIndex].price;
         $checkItem["discountPrice"] = skus[skuIndex].price * discount / 100;
         $checkItem["totalFee"] = skus[skuIndex].price;
-        $("#discountPrice" + ind).val(skus[skuIndex].price * discount / 100);
+        $("#discountPrice0").val(skus[skuIndex].price * discount / 100);
         var tax = 0;
         var invoiceType = $checkItem["invoiceType"];
         var discountPrice = $checkItem["discountPrice"];
         var taxRate = $checkItem["taxRate"];
         var productId = $checkItem["productId"];
         var num = $checkItem["num"];
-        var includedTax=$checkItem["includedTax"];
-        var base =skus[skuIndex].price* discount / 100;
+        var includedTax = $checkItem["includedTax"];
+        var base = skus[skuIndex].price * discount / 100;
         if (productId >= 6060 && productId <= 6069) {
             tax = 0;
-        } else if ("3"===invoiceType) {
+        } else if ("3" === invoiceType) {
             tax = "---";
         } else {
             tax = discountPrice * taxRate / 100;
-            if("0"===includedTax){
+            if ("0" === includedTax) {
                 base += discountPrice * taxRate / 100;
             }
         }
         $checkItem["addedValueTax"] = tax;
         $checkItem["totalAddedValueTax"] = tax * num;
-        $("#addedValueTax" + ind).val(tax);
-        $("#totalAddedValueTax" + ind).val(tax * num);
+        $("#addedValueTax0").val(tax);
+        $("#totalAddedValueTax0").val(tax * num);
         var total = base * num;
-        $("#totalFee" + ind).val(total);
+        $("#totalFee0").val(total);
         $checkItem["totalFee"] = total;
-        $("#check-item" + ind).val(JSON.stringify($checkItem));
+        $("#check-item0").val(JSON.stringify($checkItem));
     }
 </script>
 </body>

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductList.jsp

@@ -306,6 +306,7 @@
             $("#skuId" + ind).text(skus[skuIndex].skuId);
             //页面价格赋值
             document.getElementById(price).innerHTML = skus[skuIndex].price;
+            $("#price"+ind).val(skus[skuIndex].price);
             $(singlePrice).val(skus[skuIndex].price);
             $(totalFee).val(skus[skuIndex].price);
             var discount = $checkItem["discount"];

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp

@@ -490,6 +490,7 @@
                                 <td>购买数量(赠品数)X${cmReturnedPurchaseProduct.num}(${cmReturnedPurchaseProduct.presentNum})</td>
                             </tr>
                             <tr>
+                                <td>规格:${cmReturnedPurchaseProduct.unit}</td>
                                 <td>税率:${cmReturnedPurchaseProduct.taxRate}</td>
                                 <td>税费:¥${cmReturnedPurchaseProduct.totalAddedValueTax}</td>
                                 <td colspan="2">总额:¥${cmReturnedPurchaseProduct.totalFee}</td>

+ 11 - 10
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheCollageProductForm.jsp

@@ -149,25 +149,26 @@
             $("#limitedNum").attr('readonly', false);
             $("#limitedNum").attr('required', true);
         }
-        if(null!=va && 1===va){
+        if (null != va && 1 === va) {
             //sku填充
             $.ajax({
-                url: "${ctx}/hehe/cmHeheCollageProduct/getSku?productId="+productId,
+                url: "${ctx}/hehe/cmHeheCollageProduct/getSku?productId=" + productId,
                 type: "GET",
                 dataType: "json",
                 data: "",
                 success: function (res) {
                     console.log(res);
-                    var html='';
+                    var html = '';
                     for (let i = 0; i < res.length; i++) {
                         console.log(res[i])
-                        html+='<label class="control-label"><font color="red">*</font>规格:规格'+(i+1)+'</label>';
-                        html+='<div class="controls" style="display:flex"><div>';
-                        html+='<label class="control-label"><font color="red">*</font>售价:</label>';
-                        html+="<input name='skus["+(i)+"].price' value='"+res[i].price+"' disabled='true' type='number' style='width: 90px' class='input-xlarge number'/>";
-                        html+='</div><div><label class="control-label"><font color="red">*</font>拼团价格:</label>';
-                        html+="<input name='skus["+(i)+"'].collagePrice' style='width: 90px;' type='number' class='input-xlarge number required'/>";
-                        html+='</div></div>';
+                        html += '<label class="control-label"><font color="red">*</font>规格:规格' + (i + 1) + '</label>';
+                        html += "<input type='hidden' name='skus[" + (i) + "].skuId' value='" + res[i].skuId + "'>";
+                        html += '<div class="controls" style="display:flex"><div>';
+                        html += '<label class="control-label"><font color="red">*</font>售价:</label>';
+                        html += "<input name='skus[" + (i) + "].price' value='" + res[i].price + "' disabled='true' type='number' style='width: 90px' class='input-xlarge number'/>";
+                        html += '</div><div><label class="control-label"><font color="red">*</font>拼团价格:</label>';
+                        html += "<input name='skus[" + (i) + "].collagePrice' style='width: 90px;' type='number' class='input-xlarge number required'/>";
+                        html += '</div></div>';
                     }
                     $("#skus").html(html);
                 }

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductForm.jsp

@@ -342,7 +342,7 @@
                             <label><font color="red">*</font>成本价:${sku.costPrice}</label>
                         </c:if>
                         <c:if test="${sku.costCheckFlag eq 2}">
-                            <label><font color="red">*</font>成本比例百分比:${sku.costProportional}</label>
+                            <label><font color="red">*</font>成本比例百分比:${sku.costProportional}%</label>
                         </c:if>
                     </div>
                 </div>
@@ -497,7 +497,7 @@
                             for (let i = 0; i < skus.length; i++) {
                                 var unit=i+1;
                                 var cost = skus[i].costCheckFlag == 1 ? '固定成本' : '比例成本';
-                                var costShow = skus[i].costCheckFlag == 1 ? '<label><font color="red">*</font>成本价:' + skus[i].costPrice + '</label>' : '<label><font color="red">*</font>成本比例百分比:' + skus[i].costProportional + '</label>';
+                                var costShow = skus[i].costCheckFlag == 1 ? '<label><font color="red">*</font>成本价:' + skus[i].costPrice + '</label>' : '<label><font color="red">*</font>成本比例百分比:' + skus[i].costProportional + '%</label>';
                                 html += '<div><input type="number" style="display:none" value="' + skus[i].skuId + '" name="skus[' + i + '].skuId">';
                                 html += '<label class="control-label"><font color="red">*</font>规格:规格' + unit;
                                 html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>';

+ 3 - 1
src/main/webapp/WEB-INF/views/modules/hehe/heheDiscountActivityProductForm.jsp

@@ -155,7 +155,7 @@
         });
     }
 
-    function getSkus(productId){
+    function getSkus(productId) {
         //渲染限时特价sku
         $.ajax({
             url: "${ctx}/hehe/heheDiscountActivityProduct/getSku?productId=" + productId,
@@ -169,6 +169,7 @@
                     console.log(res[i])
                     html += '<div class="control-group"  style="display:flex">';
                     html += "<input type='hidden' value='" + res[i].skuId + "' name='sku['" + i + "'].skuId'>";
+                    html += "<input type='hidden' name='skus[" + (i) + "].skuId' value='" + res[i].skuId + "'>";
                     html += '<label class="control-label"><font color="red">*</font>规格:规格' + (i + 1) + '</label>';
                     html += '<label class="control-label"><font color="red">*</font>售价:</label>';
                     html += "<input name='skus[" + (i) + "].price' value='" + res[i].price + "' disabled='true' type='number' style='width: 90px' class='input-xlarge number'/>";
@@ -180,6 +181,7 @@
             }
         });
     }
+
     //删除商品
     function deleteProduct() {
         $('#contentTable').hide();

+ 7 - 0
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -815,6 +815,7 @@
 
 <script type="text/html" id="skuTemplate">
     <div class="sku">
+        <input type="hidden" name="skuId">
         <div class="sku-item sku-unit">
             <span class="red">*</span>包装规格:
             <input name="unit" type="text" maxlength="15" style="width: 40px" class="short required"/>
@@ -1835,6 +1836,12 @@
         var skuIndex = product.skuIndex;
         var index = el.find('input[name$="index"]');
         index.val(skuIndex);
+
+        if(product.skuId){
+            var skuId=el.find('input[name$="skuId"]');
+            skuId.val(product.skuId);
+            skuId.attr('name', 'skuList[' + skuIndex + '].skuId');
+        }
         // 包装规格
         var unit = el.find('input[name$="unit"]');
         unit.val(product.unit)

+ 5 - 4
src/main/webapp/WEB-INF/views/modules/product-new/productList.jsp

@@ -662,8 +662,8 @@
                 <c:if test="${product.productCategory ne 2}">
                     <c:if test="${product.validFlag ne 0}">
                         <td class="todo">
-                            <a href="javascript:;"
-                               onclick="jumpHref('${ctx}/product/new/fastEdit?id=${product.id}&searchName=${searchName}&searchShopID=${searchShopID}&searchShopName=${searchShopName}&searchBigTypeID=${searchBigTypeID}&searchSmallTypeID=${searchSmallTypeID}&searchTinyTypeID=${searchTinyTypeID}&searchValidFlag=${searchValidFlag}&searchActStatus=${searchActStatus}&searchProductType=${searchProductType}&searchBrandID=${searchBrandID}&searchPreferredFlag=${searchPreferredFlag}&searchProductCategory=${searchProductCategory}')">快编</a>
+<%--                            <a href="javascript:;"--%>
+<%--                               onclick="jumpHref('${ctx}/product/new/fastEdit?id=${product.id}&searchName=${searchName}&searchShopID=${searchShopID}&searchShopName=${searchShopName}&searchBigTypeID=${searchBigTypeID}&searchSmallTypeID=${searchSmallTypeID}&searchTinyTypeID=${searchTinyTypeID}&searchValidFlag=${searchValidFlag}&searchActStatus=${searchActStatus}&searchProductType=${searchProductType}&searchBrandID=${searchBrandID}&searchPreferredFlag=${searchPreferredFlag}&searchProductCategory=${searchProductCategory}')">快编</a>--%>
                             <a href="javascript:;"
                                onclick="jumpHref('${ctx}/product/new/productEdit?id=${product.id}&searchName=${searchName}&searchShopID=${searchShopID}&searchShopName=${searchShopName}&searchBigTypeID=${searchBigTypeID}&searchSmallTypeID=${searchSmallTypeID}&searchTinyTypeID=${searchTinyTypeID}&searchValidFlag=${searchValidFlag}&searchActStatus=${searchActStatus}&searchProductType=${searchProductType}&searchBrandID=${searchBrandID}&searchPreferredFlag=${searchPreferredFlag}&searchProductCategory=${searchProductCategory}&editFlag=${editFlag}')">商品编辑</a>
                             <a href="javascript:;"
@@ -671,8 +671,9 @@
                             <a href="javascript:void(0);" onclick="updateIndex('${product.id}')">更新索引</a>
                             <a href="javascript:;"
                                onclick="jumpHref('${ctx}/product/new/imageList?id=${product.id}&searchName=${searchName}&searchShopID=${searchShopID}&searchShopName=${searchShopName}&searchBigTypeID=${searchBigTypeID}&searchSmallTypeID=${searchSmallTypeID}&searchTinyTypeID=${searchTinyTypeID}&searchValidFlag=${searchValidFlag}&searchActStatus=${searchActStatus}&searchProductType=${searchProductType}&searchBrandID=${searchBrandID}&searchPreferredFlag=${searchPreferredFlag}&searchProductCategory=${searchProductCategory}')">图片管理</a>
-                            <a href="javascript:;"
-                               onclick="jumpHref('${ctx}/product/hehe/edit?id=${product.id}&searchName=${searchName}&searchShopID=${searchShopID}&searchShopName=${searchShopName}&searchBigTypeID=${searchBigTypeID}&searchSmallTypeID=${searchSmallTypeID}&searchTinyTypeID=${searchTinyTypeID}&searchValidFlag=${searchValidFlag}&searchActStatus=${searchActStatus}&searchProductType=${searchProductType}&searchBrandID=${searchBrandID}&searchPreferredFlag=${searchPreferredFlag}&searchProductCategory=${searchProductCategory}')">参与呵呵商城</a><br>
+<%--                            <a href="javascript:;"--%>
+<%--                               onclick="jumpHref('${ctx}/product/hehe/edit?id=${product.id}&searchName=${searchName}&searchShopID=${searchShopID}&searchShopName=${searchShopName}&searchBigTypeID=${searchBigTypeID}&searchSmallTypeID=${searchSmallTypeID}&searchTinyTypeID=${searchTinyTypeID}&searchValidFlag=${searchValidFlag}&searchActStatus=${searchActStatus}&searchProductType=${searchProductType}&searchBrandID=${searchBrandID}&searchPreferredFlag=${searchPreferredFlag}&searchProductCategory=${searchProductCategory}')">参与呵呵商城</a>--%>
+                            <br>
                             <c:if test="${product.validFlag eq 1 or product.validFlag eq 8}">
                                 <a class="red" href="javascript:void(0);"
                                    onclick="auditThis(${product.id},'${product.brand.name}','${product.brand.status}','${product.costCheckFlag}','${product.costPrice}','${product.costProportional}','${product.newvalidFlag}','${product.showTime}','${product.addTime}','${product.newProductType}')">上架审核</a>

+ 0 - 8
src/main/webapp/WEB-INF/views/modules/product-new/recommend.jsp

@@ -34,7 +34,6 @@
 			<tr>
 				<th>ID</th>
 				<th>商品名称</th>
-				<th>包装规格</th>
 				<th>图片</th>
 				<th>供应商</th>
 				<c:if test="${product.recommendType eq 1}">
@@ -52,9 +51,6 @@
 				<td>
 					${cpr.productName}
 				</td>
-				<td>
-					${cpr.unit}
-				</td>
 				<td><img src="${cpr.img}" width="50" height="50"></td>
 				<td>${cpr.shopName}</td>
 				<c:if test="${product.recommendType eq 1}">
@@ -123,7 +119,6 @@
 			<tr>
 				<th>ID</th>
 				<th>商品名称</th>
-				<th>包装规格</th>
 				<th>图片</th>
 				<th>供应商</th>
 				<th>排序</th>
@@ -139,9 +134,6 @@
 					<td>
 						${cpr.productName}
 					</td>
-					<td>
-						${cpr.unit}
-					</td>
 					<td><img src="${cpr.img}" width="50" height="50"></td>
 					<td>${cpr.shopName}</td>
 					<td>

+ 30 - 26
src/main/webapp/static/modules/bulkpurchase/orderForm.js

@@ -599,7 +599,7 @@ function deleteShop(obj) {
     $(".addSecondHandProduct").show();
 }
 
-function resetProductList(setData) {
+function resetProductList(setData, ind) {
     var productList = [];
     var productIdList = [];
     var skuIds = [];
@@ -634,6 +634,7 @@ function resetProductList(setData) {
             setProductList(data, false);
         });
     } else {
+        debugger;
         var skuId;
         if (setData.skuStr) {
             var strings = setData.skuStr.split("/");
@@ -641,22 +642,24 @@ function resetProductList(setData) {
         } else {
             skuId = setData.skuList[0].skuId;
         }
+
         if (skuIds.indexOf(skuId) >= 0) {
             //设置
             productList.forEach(function (data) {
                 if (setData.productId == data.productId) {
-                    setProductList(setData, false);
+                    setProductList(setData, false, ind);
                 } else {
-                    setProductList(data, false);
+                    setProductList(data, false, ind);
                 }
             });
         } else {
             //新增
             productList.forEach(function (data) {
-                setProductList(data, false);
+                setProductList(data, false, ind);
             });
-            setProductList(setData, false);
+            setProductList(setData, false, ind);
         }
+
     }
     setOrderFee(); //设置底部订单金额
 }
@@ -719,7 +722,7 @@ function editShopProduct(obj) {
                         return false;
                     } else {
                         console.log('设置:' + items[0]);
-                        resetProductList(items[0]); //设置商品列表
+                        resetProductList(items[0], 1); //设置商品列表
                     }
                     return true;
                 }
@@ -754,7 +757,7 @@ function showShopSelect(iframe) {
                     return false;
                 } else if (items.length > 0) {
                     console.log('添加:' + JSON.stringify(items[0]));
-                    resetProductList(items[0]); //设置商品列表
+                    resetProductList(items[0], 0); //设置商品列表
                     return true;
                 } else {
                     top.$.jBox.tip("请选择...");
@@ -825,7 +828,7 @@ function showSencondHandSelect(iframe) {
  * 设置商品列表(正常商品)
  * @param items
  */
-function setProductList(data) {
+function setProductList(data, flag, ind) {
     console.log("设置" + JSON.stringify(data));
     var skuStr = "";
     var skuIdStr = "";
@@ -977,10 +980,11 @@ function setProductList(data) {
         ) +
         "</td>" +
         "</tr>";
-    appendProductList(str, data, cmPromotion);
+    appendProductList(str, data, cmPromotion, ind);
 }
 
-function appendProductList(str, data, cmPromotion) {
+function appendProductList(str, data, cmPromotion, ind) {
+    debugger
     //把表中存在的删除
     var removeBeforeSoon = false; //是这一次移除
     var removeEle;
@@ -998,6 +1002,7 @@ function appendProductList(str, data, cmPromotion) {
     }
 
     $('.productTable tbody tr:not(.gift)').each(function (index, element) {
+        console.log("看看" + $(this).find("td:nth-child(2)").html());
         if ($(this).find("td:nth-child(2)").html() == skuId) {
             removeEle = $(this).parent();
             $(this).remove();
@@ -1092,20 +1097,20 @@ function setGiftHtmlList(data, cmPromotion) {
             "'/>" + present.shopId + "</td>" +
             "<td hidden>" + present.shopName + "</td>" +
             "<td class='fix-width'><i class='red'>协商赠品:</i>" + present.name + "</td><td hidden></td>" +
-            "<td>规格</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.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>";
         product_index++;
         appendGiftsList(present, giftStr, cmPromotion);
     }
@@ -1171,7 +1176,7 @@ function setGiftHtmlList(data, cmPromotion) {
                                 "<td class='fix-width'><i class='red'>促销赠品:</i>" + gift.name +
                                 "<td>" + gift.shopName + "</td>" +
                                 "</td><td hidden></td>" +
-                                "<td></td>" +
+                                "<td>赠品</td>" +
                                 "<td>" + gift.num + "</td>" +
                                 "<td>0</td>" +
                                 "<td>100</td>" +
@@ -1322,7 +1327,6 @@ function setOrderFee() {
         svipFullReduction = 0;   //超级会员优惠
     var couponPrice = $("#couponAmount").val() ? $("#couponAmount").val() * 1 : 0;
     $('.productTable tbody tr:not(.gift)').each(function (index, element) {
-        debugger;
         var obj = JSON.parse($(this).attr("data-value"));
         productTotalFee = ((Number(productTotalFee) * 100 + Number(obj.num * obj.price) * 100 + Number(obj
             .totalAddedValueTax) * 100) / 100 + Number(obj.svipTaxReduction)).toFixed(2);