ソースを参照

Merge remote-tracking branch 'origin/developerB' into developer

# Conflicts:
#	src/main/java/com/caimei/modules/product/web/ProductNewController.java
#	src/main/resources/mappings/modules/order/OrderProductMapper.xml
#	src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp
zhijiezhao 2 年 前
コミット
c8a85a0c12
88 ファイル変更7765 行追加5803 行削除
  1. 28 1
      src/main/java/com/caimei/modules/bulkpurchase/entity/PurchaseProduct.java
  2. 1 1
      src/main/java/com/caimei/modules/bulkpurchase/service/PurchaseProductService.java
  3. 3 1
      src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java
  4. 85 77
      src/main/java/com/caimei/modules/bulkpurchase/web/PurchaseProductController.java
  5. 13 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityProductDao.java
  6. 13 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheCollageProductDao.java
  7. 9 0
      src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java
  8. 3 0
      src/main/java/com/caimei/modules/hehe/dao/HeheDiscountActivityProductDao.java
  9. 9 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeHeActivityLadder.java
  10. 19 26
      src/main/java/com/caimei/modules/hehe/entity/CmHeheActivityProduct.java
  11. 16 4
      src/main/java/com/caimei/modules/hehe/entity/CmHeheCollageProduct.java
  12. 11 0
      src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java
  13. 13 1
      src/main/java/com/caimei/modules/hehe/entity/HeheDiscountActivityProduct.java
  14. 39 17
      src/main/java/com/caimei/modules/hehe/service/CmHeheActivityProductService.java
  15. 82 59
      src/main/java/com/caimei/modules/hehe/service/CmHeheCollageProductService.java
  16. 24 2
      src/main/java/com/caimei/modules/hehe/service/CmHeheProductService.java
  17. 3 2
      src/main/java/com/caimei/modules/hehe/service/CmHeheUserService.java
  18. 24 3
      src/main/java/com/caimei/modules/hehe/service/HeheDiscountActivityProductService.java
  19. 1 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheActivityProductController.java
  20. 13 0
      src/main/java/com/caimei/modules/hehe/web/CmHeheCollageProductController.java
  21. 9 2
      src/main/java/com/caimei/modules/hehe/web/CmHeheProductController.java
  22. 13 1
      src/main/java/com/caimei/modules/hehe/web/HeheDiscountActivityProductController.java
  23. 3 0
      src/main/java/com/caimei/modules/order/dao/NewOrderProductDao.java
  24. 8 0
      src/main/java/com/caimei/modules/order/entity/LogisticsRecord.java
  25. 11 5
      src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java
  26. 26 20
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  27. 13 1
      src/main/java/com/caimei/modules/order/web/NewOrderController.java
  28. 5 1
      src/main/java/com/caimei/modules/product/dao/CmPromotionDao.java
  29. 29 2
      src/main/java/com/caimei/modules/product/dao/ProductDao.java
  30. 127 0
      src/main/java/com/caimei/modules/product/entity/CmLadderPrice.java
  31. 21 0
      src/main/java/com/caimei/modules/product/entity/CmPromotion.java
  32. 143 0
      src/main/java/com/caimei/modules/product/entity/CmSku.java
  33. 20 15
      src/main/java/com/caimei/modules/product/entity/Product.java
  34. 9 0
      src/main/java/com/caimei/modules/product/entity/RepeatPurchasePrice.java
  35. 37 35
      src/main/java/com/caimei/modules/product/service/CmProductCombinationService.java
  36. 16 6
      src/main/java/com/caimei/modules/product/service/CmPromotionService.java
  37. 35 20
      src/main/java/com/caimei/modules/product/service/ProductNewService.java
  38. 97 66
      src/main/java/com/caimei/modules/product/service/ProductService.java
  39. 24 5
      src/main/java/com/caimei/modules/product/web/CmPromotionController.java
  40. 30 17
      src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java
  41. 62 64
      src/main/java/com/caimei/modules/product/web/ProductNewController.java
  42. 88 65
      src/main/java/com/caimei/modules/svip/service/CmSvipProductService.java
  43. 3 2
      src/main/resources/config/dev/caimei.properties
  44. 188 188
      src/main/resources/mappings/modules/bulkpurchase/PurchaseProductMapper.xml
  45. 201 166
      src/main/resources/mappings/modules/hehe/CmHeheActivityProductMapper.xml
  46. 157 112
      src/main/resources/mappings/modules/hehe/CmHeheCollageProductMapper.xml
  47. 297 262
      src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml
  48. 102 99
      src/main/resources/mappings/modules/hehe/HeheDiscountActivityProductMapper.xml
  49. 1 2
      src/main/resources/mappings/modules/hehe/HeheProductMapper.xml
  50. 2 1
      src/main/resources/mappings/modules/order/CmReturnedPurchaseProductMapper.xml
  51. 1 0
      src/main/resources/mappings/modules/order/LogisticsRecordMapper.xml
  52. 506 509
      src/main/resources/mappings/modules/order/OrderProductMapper.xml
  53. 43 24
      src/main/resources/mappings/modules/product/CmPromotionMapper.xml
  54. 7 6
      src/main/resources/mappings/modules/product/CmSecondHandDetailMapper.xml
  55. 1911 1850
      src/main/resources/mappings/modules/product/ProductMapper.xml
  56. 0 10
      src/main/resources/mappings/modules/product/ProductNewMapper.xml
  57. 7 4
      src/main/resources/mappings/modules/product/RepeatPurchasePriceMapper.xml
  58. 4 7
      src/main/resources/mappings/modules/svip/CmSvipProductMapper.xml
  59. 3 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/applyRefoundForm.jsp
  60. 1 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp
  61. 2 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderForm.jsp
  62. 168 70
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductForm.jsp
  63. 235 58
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductList.jsp
  64. 1 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReturnRecord.jsp
  65. 1 0
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp
  66. 163 113
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityProductForm.jsp
  67. 8 19
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityProductList.jsp
  68. 234 190
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheCollageProductForm.jsp
  69. 721 644
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductForm.jsp
  70. 11 4
      src/main/webapp/WEB-INF/views/modules/hehe/heheAddProduct.jsp
  71. 192 150
      src/main/webapp/WEB-INF/views/modules/hehe/heheDiscountActivityProductForm.jsp
  72. 487 138
      src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderDetail.jsp
  73. 1 0
      src/main/webapp/WEB-INF/views/modules/order/logisticsDetails.jsp
  74. 4 0
      src/main/webapp/WEB-INF/views/modules/order/orderDetail.jsp
  75. 5 2
      src/main/webapp/WEB-INF/views/modules/order/orderForm.jsp
  76. 1 1
      src/main/webapp/WEB-INF/views/modules/order/printOrder.jsp
  77. 2 0
      src/main/webapp/WEB-INF/views/modules/order/ship.jsp
  78. 4 0
      src/main/webapp/WEB-INF/views/modules/order/shipLogistic.jsp
  79. 60 38
      src/main/webapp/WEB-INF/views/modules/product-new/multiPromotionForm.jsp
  80. 397 391
      src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp
  81. 5 4
      src/main/webapp/WEB-INF/views/modules/product-new/productList.jsp
  82. 26 5
      src/main/webapp/WEB-INF/views/modules/product-new/promotionSelectProducts.jsp
  83. 0 8
      src/main/webapp/WEB-INF/views/modules/product-new/recommend.jsp
  84. 59 39
      src/main/webapp/WEB-INF/views/modules/product-new/shopPromotionForm.jsp
  85. 54 40
      src/main/webapp/WEB-INF/views/modules/product-new/singlePromotionForm.jsp
  86. 2 1
      src/main/webapp/WEB-INF/views/modules/product/repeatPurchasePriceHistoryList.jsp
  87. 122 99
      src/main/webapp/WEB-INF/views/modules/product/repeatPurchasePriceList.jsp
  88. 131 28
      src/main/webapp/static/modules/bulkpurchase/orderForm.js

+ 28 - 1
src/main/java/com/caimei/modules/bulkpurchase/entity/PurchaseProduct.java

@@ -1,6 +1,7 @@
 package com.caimei.modules.bulkpurchase.entity;
 
 import com.caimei.modules.product.entity.CmPromotion;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.po.ProductLadderPrice;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
 import org.hibernate.validator.constraints.Length;
@@ -16,6 +17,7 @@ import java.util.List;
 public class PurchaseProduct extends DataEntity<PurchaseProduct> {
 
     private static final long serialVersionUID = 1L;
+    private Integer skuId;   //默认skuId
     private String discounts; //是否支持叠加优惠,1支持,2不支持
     private String purchaseProductName;        // 商品名称
     private String name;        // 商品名称
@@ -65,7 +67,8 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
     private String oldProductFlag;//是否是旧商品 0否 1是
     private String commodityType; //商品属性:1产品,2仪器
     private Integer couponsLogo;    //显示优惠券查看: 1不显示 2显示
-
+    private List<CmSku> skuList;
+    private Integer skuStr;
 
     /**
      * 超级会员优惠价格标识:0不是,1是
@@ -92,6 +95,22 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
      */
     private Double svipTaxReduction;
 
+    public Integer getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
+    }
+
+    public Integer getSkuStr() {
+        return skuStr;
+    }
+
+    public void setSkuStr(Integer skuStr) {
+        this.skuStr = skuStr;
+    }
+
     public String getDiscounts() {
         return discounts;
     }
@@ -104,6 +123,14 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
         return ladderPriceFlag;
     }
 
+    public List<CmSku> getSkuList() {
+        return skuList;
+    }
+
+    public void setSkuList(List<CmSku> skuList) {
+        this.skuList = skuList;
+    }
+
     public void setLadderPriceFlag(Integer ladderPriceFlag) {
         this.ladderPriceFlag = ladderPriceFlag;
     }

+ 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;

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

@@ -98,6 +98,26 @@ public class PurchaseProductController extends BaseController {
         }
         for (PurchaseProduct p : list) {
             if (p != null) {
+                //是否有优惠券可以查看
+                Boolean couponsLogo = cmCouponService.setCouponsLogo(userId, p.getProductId().intValue(), Integer.valueOf(p.getShopId()), p.getCommodityType());
+                if (couponsLogo) {
+                    p.setCouponsLogo(2);
+                } else {
+                    p.setCouponsLogo(1);
+                }
+                List<CmSku> skuList = productDao.findSkuList(p.getProductId().intValue());
+                skuList.forEach(s -> {
+                    if (1 == s.getLadderPriceFlag()) {
+                        s.setLadderPriceList(productDao.findLadderPriceBySku(s.getSkuId()));
+                    }
+                });
+                p.setSkuId(skuList.get(0).getSkuId());
+                p.setPrice(skuList.get(0).getPrice().toString());
+                if (1 == skuList.get(0).getLadderPriceFlag()) {
+                    p.setLadderPriceFlag(1);
+                    p.setLadderPriceList(productDao.findLadderPrice(skuList.get(0).getSkuId()));
+                }
+                p.setSkuList(skuList);
                 long productId = p.getProductId();
                 String discountPrice = p.getPrice();//默认折扣单价
                 if (priceFlag) {
@@ -133,70 +153,62 @@ public class PurchaseProductController extends BaseController {
                 // 初始化超级会员优惠
                 p.setSvipReduction(0d);
                 if (1 == p.getSvipPriceFlag()) {
-                    if (1 == p.getSvipPriceType()) {
-                        p.setSvipDiscountPrice(MathUtil.div(MathUtil.mul(new Double(p.getPrice()), p.getSvipDiscount()), 100, 2).doubleValue());
-                    }
+//                    if (1 == p.getSvipPriceType()) {
+//                        p.setSvipDiscountPrice(MathUtil.div(MathUtil.mul(new Double(p.getPrice()), p.getSvipDiscount()), 100, 2).doubleValue());
+//                    }
                     // 商品的超级会员优惠=原价-超级会员优惠价
-                    p.setSvipReduction(MathUtil.sub(p.getPrice(), p.getSvipDiscountPrice()).doubleValue());
-                    if ("0".equals(p.getIncludedTax()) && ("1".equals(p.getInvoiceType()) || "2".equals(p.getInvoiceType()))) {
-                        // 计算优惠的税费
-                        BigDecimal taxReduction = MathUtil.div(MathUtil.mul(p.getSvipReduction(), p.getTaxRate()), 100);
-                        p.setSvipReduction(MathUtil.add(p.getSvipReduction(), taxReduction).doubleValue());
-                        p.setSvipTaxReduction(taxReduction.doubleValue());
-                    }
+//                    p.setSvipReduction(MathUtil.sub(p.getPrice(), p.getSvipDiscountPrice()).doubleValue());
+//                    if ("0".equals(p.getIncludedTax()) && ("1".equals(p.getInvoiceType()) || "2".equals(p.getInvoiceType()))) {
+//                        // 计算优惠的税费
+//                        BigDecimal taxReduction = MathUtil.div(MathUtil.mul(p.getSvipReduction(), p.getTaxRate()), 100);
+//                        p.setSvipReduction(MathUtil.add(p.getSvipReduction(), taxReduction).doubleValue());
+//                        p.setSvipTaxReduction(taxReduction.doubleValue());
+//                    }
                 } else if (null != cmPromotion) {
                     p.setCmPromotion(cmPromotion);
                     p.setLadderPriceFlag(0);
-                } else {
-                    if (p.getLadderPriceFlag().equals(1)) {
-                        // 查询阶梯价格
-                        List<ProductLadderPrice> ladderPriceList = purchaseProductService.findLadderPriceList(p.getProductId());
-                        if (null != ladderPriceList && ladderPriceList.size() > 0) {
-                            p.setPrice(ladderPriceList.get(0).getBuyPrice().toString());
-                            p.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);
-                                }
-                            });
-                            p.setLadderPriceList(ladderPriceList);
-                        } else {
-                            p.setLadderPriceFlag(0);
-                        }
-                    } else {
-                        // 复购价
-                        if (null != userId) {
-                            String priceProductList = repeatPurchasePriceService.findPriceProductList(userId);
-                            boolean contains = false;
-                            if (StringUtils.isNotEmpty(priceProductList)) {
-                                contains = priceProductList.contains(String.valueOf(productId));
-                            }
-                            if (contains) {//该商品存在价格库商品---修改价格为价格库价格
-                                p.setBuyAgainPriceFlag("1");//商品是否使用复购价格购买标识 0否 1是
-                                RepeatPurchasePrice lastBuyPrice = repeatPurchasePriceService.getLastBuyPrice(null, userId, Integer.parseInt(String.valueOf(productId)));
-                                if (null != lastBuyPrice && MathUtil.compare(p.getPrice(), lastBuyPrice.getCurrentPrice()) > 0) {
-                                    discountPrice = lastBuyPrice.getCurrentPrice();
-                                    p.setDiscountPrice(discountPrice);
-                                    // 计算折扣(折扣=折后单价/单价)[取值1-100]---四舍五入保留6位百分比小数,例如12.341234%
-                                    BigDecimal discount = MathUtil.round((MathUtil.mul((MathUtil.div(discountPrice, p.getPrice(), 8)), 100)), 6);
-                                    p.setDiscount(String.valueOf(discount));
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            if (p != null) {
-                //是否有优惠券可以查看
-                Boolean couponsLogo = cmCouponService.setCouponsLogo(userId, p.getProductId().intValue(), Integer.valueOf(p.getShopId()), p.getCommodityType());
-                if (couponsLogo) {
-                    p.setCouponsLogo(2);
-                } else {
-                    p.setCouponsLogo(1);
                 }
+//                else {
+//                    if (p.getLadderPriceFlag().equals(1)) {
+//                        // 查询阶梯价格
+//                        List<ProductLadderPrice> ladderPriceList = purchaseProductService.findLadderPriceList(p.getProductId());
+//                        if (null != ladderPriceList && ladderPriceList.size() > 0) {
+//                            p.setPrice(ladderPriceList.get(0).getBuyPrice().toString());
+//                            p.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);
+//                                }
+//                            });
+//                            p.setLadderPriceList(ladderPriceList);
+//                        } else {
+//                            p.setLadderPriceFlag(0);
+//                        }
+//                    } else {
+//                        // 复购价
+//                        if (null != userId) {
+//                            String priceProductList = repeatPurchasePriceService.findPriceProductList(userId);
+//                            boolean contains = false;
+//                            if (StringUtils.isNotEmpty(priceProductList)) {
+//                                contains = priceProductList.contains(String.valueOf(productId));
+//                            }
+//                            if (contains) {//该商品存在价格库商品---修改价格为价格库价格
+//                                p.setBuyAgainPriceFlag("1");//商品是否使用复购价格购买标识 0否 1是
+//                                RepeatPurchasePrice lastBuyPrice = repeatPurchasePriceService.getLastBuyPrice(null, userId, Integer.parseInt(String.valueOf(productId)));
+//                                if (null != lastBuyPrice && MathUtil.compare(p.getPrice(), lastBuyPrice.getCurrentPrice()) > 0) {
+//                                    discountPrice = lastBuyPrice.getCurrentPrice();
+//                                    p.setDiscountPrice(discountPrice);
+//                                    // 计算折扣(折扣=折后单价/单价)[取值1-100]---四舍五入保留6位百分比小数,例如12.341234%
+//                                    BigDecimal discount = MathUtil.round((MathUtil.mul((MathUtil.div(discountPrice, p.getPrice(), 8)), 100)), 6);
+//                                    p.setDiscount(String.valueOf(discount));
+//                                }
+//                            }
+//                        }
+//                    }
+//                }
             }
         }
         model.addAttribute("page", page);
@@ -327,6 +339,15 @@ public class PurchaseProductController extends BaseController {
             purchaseProduct.setLadderPriceFlag(0);
             Product product = productDao.get(purchaseProduct.getProductId().toString());
             if (product != null) {
+                List<CmSku> skus = productDao.findSkuList(product.getProductID());
+                purchaseProduct.setSkuId(skus.get(0).getSkuId());
+                purchaseProduct.setPrice(skus.get(0).getPrice().toString());
+                skus.forEach(s -> {
+                    if (1 == s.getLadderPriceFlag()) {
+                        s.setLadderPriceList(productDao.findLadderPriceBySku(s.getSkuId()));
+                    }
+                });
+                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()) {
@@ -335,29 +356,16 @@ public class PurchaseProductController extends BaseController {
                 } else if (productPromotion != null) {
                     purchaseProduct.setCmPromotion(productPromotion);
                 } else {
-                    if ("1".equals(product.getLadderPriceFlag())) {
+                    if (1 == skus.get(0).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);
-                        }
+                        purchaseProduct.setLadderPriceList(productDao.findLadderPrice(skus.get(0).getSkuId()));
+                    } else {
+                        purchaseProduct.setLadderPriceFlag(0);
                     }
                 }
             }
         }
+
         model.addAttribute("purchaseProduct", purchaseProduct);
         return "modules/bulkpurchase/orderPurchaseProductForm";
     }

+ 13 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityProductDao.java

@@ -2,6 +2,7 @@ package com.caimei.modules.hehe.dao;
 
 import com.caimei.modules.hehe.entity.CmHeHeActivityLadder;
 import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.product.entity.CmSku;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
@@ -66,4 +67,16 @@ public interface CmHeheActivityProductDao extends CrudDao<CmHeheActivityProduct>
     void deleteUserActivity(Integer productId);
 
     void updateProductId(@Param("newProductId") Integer newProductId, @Param("oldProductId") Integer oldProductId);
+
+    void deleteLadderBySkuId(@Param("activityId")Integer activityId, @Param("skuId")Integer skuId);
+
+    String findPrice(Integer productId);
+
+    List<CmSku> findDiscountSku(Integer productId);
+
+    CmSku findDiscountBySku(Integer skuId);
+
+    void updateDiscount(CmSku s);
+
+    void insertDiscount(CmSku s);
 }

+ 13 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheCollageProductDao.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.hehe.dao;
 
+import com.caimei.modules.product.entity.CmSku;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.hehe.entity.CmHeheCollageProduct;
@@ -20,4 +21,16 @@ public interface CmHeheCollageProductDao extends CrudDao<CmHeheCollageProduct> {
     Integer getProductId(Integer heheProductId);
 
     void updateProductId(@Param("newProductId") Integer newProductId, @Param("oldProductId") Integer oldProductId);
+
+    List<CmSku> findCollageSku(Integer productId);
+
+    List<CmSku> findCollageByHeHeId(Integer productId);
+
+    void insertSkuCollage(CmSku skus);
+
+    void updateSkuCollage(CmSku s);
+
+    CmSku getSkuCollage(Integer skuId);
+    //展示最低拼团价格
+    Double getCollagePrice(Integer productId);
 }

+ 9 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.hehe.dao;
 
+import com.caimei.modules.product.entity.CmLadderPrice;
 import com.caimei.modules.product.entity.Product;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
@@ -80,4 +81,12 @@ public interface CmHeheProductDao extends CrudDao<CmHeheProduct> {
      * @return
      */
     List<Integer> findDiscountProductIds();
+
+    CmHeheProduct findProductElement(Integer productId);
+
+    void insertHeHeSkuPrice(@Param("productId")Integer productId,@Param("skuId") Integer skuId, @Param("price") Double price);
+
+    void updateHeHeSkuPrice(@Param("skuId") Integer skuId, @Param("price") Double price);
+
+    List<CmLadderPrice> findLadderList(Integer skuId);
 }

+ 3 - 0
src/main/java/com/caimei/modules/hehe/dao/HeheDiscountActivityProductDao.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.hehe.dao;
 
+import com.caimei.modules.product.entity.CmSku;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.hehe.entity.HeheDiscountActivityProduct;
@@ -15,4 +16,6 @@ import java.util.List;
 public interface HeheDiscountActivityProductDao extends CrudDao<HeheDiscountActivityProduct> {
 
     List<Integer> findDiscountProductIds();
+
+    List<CmSku> findDiscountSku(Integer productId);
 }

+ 9 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeHeActivityLadder.java

@@ -14,11 +14,20 @@ public class CmHeHeActivityLadder implements Serializable {
     private Integer id;
     private Integer activityId;     //活动id
     private Integer productId;      //对应采美商品id
+    private Integer skuId;
     private Integer ladderNum;  //第几阶梯
     private Integer buyNum;     //购买数量
     private BigDecimal buyPrice;    //购买价格
     private Date createDate;      //创建时间
 
+    public Integer getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
+    }
+
     public Integer getId() {
         return id;
     }

+ 19 - 26
src/main/java/com/caimei/modules/hehe/entity/CmHeheActivityProduct.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.hehe.entity;
 
+import com.caimei.modules.product.entity.CmSku;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
 
@@ -23,10 +24,25 @@ public class CmHeheActivityProduct extends DataEntity<CmHeheActivityProduct> {
     private String name;         //商品名称
     private String mainImage;       //商品图片
     private String shopName;        //供应商名称
-    private BigDecimal price;        // 售价
-    private String unit;        //包装规格
     private Integer userId;         //用户id
-    private List<CmHeHeActivityLadder> activityLadderList;  //活动阶梯
+    private List<CmSku> skus;
+    private Integer LadderFlag; //有无活动价 0无1有
+
+    public Integer getLadderFlag() {
+        return LadderFlag;
+    }
+
+    public void setLadderFlag(Integer ladderFlag) {
+        LadderFlag = ladderFlag;
+    }
+
+    public List<CmSku> getSkus() {
+        return skus;
+    }
+
+    public void setSkus(List<CmSku> skus) {
+        this.skus = skus;
+    }
 
     public CmHeheActivityProduct() {
         super();
@@ -93,22 +109,6 @@ public class CmHeheActivityProduct extends DataEntity<CmHeheActivityProduct> {
         this.shopName = shopName;
     }
 
-    public BigDecimal getPrice() {
-        return price;
-    }
-
-    public void setPrice(BigDecimal price) {
-        this.price = price;
-    }
-
-    public String getUnit() {
-        return unit;
-    }
-
-    public void setUnit(String unit) {
-        this.unit = unit;
-    }
-
     public Integer getUserId() {
         return userId;
     }
@@ -117,11 +117,4 @@ public class CmHeheActivityProduct extends DataEntity<CmHeheActivityProduct> {
         this.userId = userId;
     }
 
-    public List<CmHeHeActivityLadder> getActivityLadderList() {
-        return activityLadderList;
-    }
-
-    public void setActivityLadderList(List<CmHeHeActivityLadder> activityLadderList) {
-        this.activityLadderList = activityLadderList;
-    }
 }

+ 16 - 4
src/main/java/com/caimei/modules/hehe/entity/CmHeheCollageProduct.java

@@ -1,6 +1,9 @@
 package com.caimei.modules.hehe.entity;
 
 import java.util.Date;
+import java.util.List;
+
+import com.caimei.modules.product.entity.CmSku;
 import com.fasterxml.jackson.annotation.JsonFormat;
 
 import com.thinkgem.jeesite.common.persistence.DataEntity;
@@ -14,17 +17,26 @@ public class CmHeheCollageProduct extends DataEntity<CmHeheCollageProduct> {
 	
 	private static final long serialVersionUID = 1L;
 	private Integer productId;		// 商品id
-	private Double price;		// 拼团价格
+	private Double price;		// 列表展示的最低拼团价格
 	private Integer limitedNum;		// 单人限购量
 	private Integer unlimitedFlag;		// 不限购买量标识:1不限制,0限制
 	private Integer memberNum;		// 拼团人数
 	private Integer status;		// 商品状态:0已下架,1已上架
 	private Date addTime;		// 添加时间
+	private List<CmSku> skus;
 
 	private String shopName;	// 供应商名称
 	private String productName;	// 商品名称
 	private String productImage;	// 商品图片
-	
+
+	public List<CmSku> getSkus() {
+		return skus;
+	}
+
+	public void setSkus(List<CmSku> skus) {
+		this.skus = skus;
+	}
+
 	public CmHeheCollageProduct() {
 		super();
 	}
@@ -40,7 +52,7 @@ public class CmHeheCollageProduct extends DataEntity<CmHeheCollageProduct> {
 	public void setProductId(Integer productId) {
 		this.productId = productId;
 	}
-	
+
 	public Double getPrice() {
 		return price;
 	}
@@ -48,7 +60,7 @@ public class CmHeheCollageProduct extends DataEntity<CmHeheCollageProduct> {
 	public void setPrice(Double price) {
 		this.price = price;
 	}
-	
+
 	public Integer getLimitedNum() {
 		return limitedNum;
 	}

+ 11 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java

@@ -1,5 +1,7 @@
 package com.caimei.modules.hehe.entity;
 
+import com.caimei.modules.product.entity.CmSku;
+import com.caimei.modules.product.entity.Sku;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
 import org.hibernate.validator.constraints.Length;
@@ -38,6 +40,15 @@ public class CmHeheProduct extends DataEntity<CmHeheProduct> {
 
     private Integer activityId;     //活动id
     private String floorIds;        //楼层id,以,隔开
+    private List<CmSku> skus;
+
+    public List<CmSku> getSkus() {
+        return skus;
+    }
+
+    public void setSkus(List<CmSku> skus) {
+        this.skus = skus;
+    }
 
     public CmHeheProduct() {
         super();

+ 13 - 1
src/main/java/com/caimei/modules/hehe/entity/HeheDiscountActivityProduct.java

@@ -1,6 +1,9 @@
 package com.caimei.modules.hehe.entity;
 
 import java.util.Date;
+import java.util.List;
+
+import com.caimei.modules.product.entity.CmSku;
 import com.fasterxml.jackson.annotation.JsonFormat;
 
 import com.thinkgem.jeesite.common.persistence.DataEntity;
@@ -19,10 +22,19 @@ public class HeheDiscountActivityProduct extends DataEntity<HeheDiscountActivity
 	private Integer status;		// 上架状态:0已下架,1已上架
 	private Date addTime;		// 添加时间
 
+	private List<CmSku> skus;
 	private String name;         //商品名称
 	private String mainImage;       //商品图片
 	private String shopName;        //供应商名称
-	
+
+	public List<CmSku> getSkus() {
+		return skus;
+	}
+
+	public void setSkus(List<CmSku> skus) {
+		this.skus = skus;
+	}
+
 	public HeheDiscountActivityProduct() {
 		super();
 	}

+ 39 - 17
src/main/java/com/caimei/modules/hehe/service/CmHeheActivityProductService.java

@@ -1,10 +1,14 @@
 package com.caimei.modules.hehe.service;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.caimei.modules.hehe.dao.CmHeheActivityProductDao;
 import com.caimei.modules.hehe.dao.CmHeheProductDao;
 import com.caimei.modules.hehe.entity.CmHeHeActivityLadder;
 import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
 import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.StringUtil;
 import com.thinkgem.jeesite.common.config.Global;
@@ -13,8 +17,11 @@ import com.thinkgem.jeesite.common.service.CrudService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
 
 import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -32,10 +39,12 @@ public class CmHeheActivityProductService extends CrudService<CmHeheActivityProd
     @Autowired
     private CmHeheProductDao cmHeheProductDao;
 
+    @Autowired
+    private CmHeheProductService heheProductService;
+
     public CmHeheActivityProduct get(String id) {
         CmHeheActivityProduct activityProduct = super.get(id);
-        List<CmHeHeActivityLadder> activityLadderList = activityProductDao.findActivityLadder(activityProduct.getActivityId(), activityProduct.getProductId());
-        activityProduct.setActivityLadderList(activityLadderList);
+        activityProduct.setSkus(heheProductService.getProductSku(activityProduct.getProductId()));
         return activityProduct;
     }
 
@@ -48,11 +57,19 @@ public class CmHeheActivityProductService extends CrudService<CmHeheActivityProd
         List<CmHeheActivityProduct> productList = productPage.getList();
         String wwwServer = Global.getConfig("wwwServer");
         productList.forEach(item -> {
-            List<CmHeHeActivityLadder> activityLadderList = activityProductDao.findActivityLadder(item.getActivityId(), item.getProductId());
+            List<CmSku> productSku = heheProductService.getProductSku(item.getProductId());
+            item.setSkus(productSku);
+            Integer ladderFlag = 0;
+            for (CmSku cmSku : productSku) {
+                if (null != cmSku.getLadderPriceList() && cmSku.getLadderPriceList().size() > 0) {
+                    ladderFlag = 1;
+                    break;
+                }
+            }
+            item.setLadderFlag(ladderFlag);
             if (StringUtil.isNotBlank(item.getMainImage())) {
                 item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
             }
-            item.setActivityLadderList(activityLadderList);
         });
         return productPage;
     }
@@ -103,20 +120,25 @@ public class CmHeheActivityProductService extends CrudService<CmHeheActivityProd
     @Transactional(readOnly = false)
     public void saveActivityLadder(String params, String id) {
         CmHeheActivityProduct activityProduct = activityProductDao.get(id);
-        if (StringUtil.isNotBlank(params)) {
-            activityProductDao.deleteLadder(activityProduct.getActivityId(), activityProduct.getProductId());
-            CmHeHeActivityLadder ladder = new CmHeHeActivityLadder();
-            ladder.setActivityId(activityProduct.getActivityId());
-            ladder.setProductId(activityProduct.getProductId());
-            int ladderNum = 0;
-            String[] ladders = params.split("-");
-            for (String l : ladders) {
-                ladderNum++;
-                ladder.setLadderNum(ladderNum);
-                ladder.setBuyNum(Integer.valueOf(l.split(",")[0]));
-                ladder.setBuyPrice(new BigDecimal(l.split(",")[1]));
+        Assert.notNull(params);
+        //[{"skuId":"5010","ladder1":"1,313","ladderSize":2,"ladder2":"2,123"},{"skuId":"8273","ladder1":"3,55","ladderSize":2,"ladder2":"5,44"}]
+        JSONArray parse = (JSONArray) JSONArray.parse(params);
+        parse.forEach(p -> {
+            JSONObject json = (JSONObject) p;
+            Integer ladderSize = (Integer) json.get("ladderSize");
+            String skuId = (String) json.get("skuId");
+            activityProductDao.deleteLadderBySkuId(activityProduct.getActivityId(), Integer.valueOf(skuId));
+            for (int i = 0; i < ladderSize; i++) {
+                String o = (String) json.get("ladder" + (i + 1));
+                String[] split = o.split(",");
+                CmHeHeActivityLadder ladder = new CmHeHeActivityLadder();
+                ladder.setActivityId(activityProduct.getActivityId());
+                ladder.setSkuId(Integer.valueOf(skuId));
+                ladder.setLadderNum(i + 1);
+                ladder.setBuyNum(Integer.valueOf(split[0]));
+                ladder.setBuyPrice(new BigDecimal(split[1]));
                 activityProductDao.insertLadder(ladder);
             }
-        }
+        });
     }
 }

+ 82 - 59
src/main/java/com/caimei/modules/hehe/service/CmHeheCollageProductService.java

@@ -3,12 +3,15 @@ package com.caimei.modules.hehe.service;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.function.Consumer;
 
 import com.caimei.modules.hehe.dao.CmHeheFloorProductDao;
 import com.caimei.modules.hehe.dao.CmHeheProductDao;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.utils.AppUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -22,77 +25,97 @@ import javax.annotation.Resource;
 
 /**
  * 呵呵商城拼团商品Service
+ *
  * @author Aslee
  * @version 2021-12-14
  */
 @Service
 @Transactional(readOnly = true)
 public class CmHeheCollageProductService extends CrudService<CmHeheCollageProductDao, CmHeheCollageProduct> {
-	@Resource
-	private CmHeheFloorProductDao cmHeheFloorProductDao;
+    @Resource
+    private CmHeheFloorProductDao cmHeheFloorProductDao;
 
-	@Resource
-	private CmHeheCollageProductDao cmHeheCollageProductDao;
+    @Resource
+    private CmHeheCollageProductDao cmHeheCollageProductDao;
 
-	@Resource
-	private CmHeheProductDao cmHeheProductDao;
+    @Resource
+    private CmHeheProductDao cmHeheProductDao;
 
-	public CmHeheCollageProduct get(String id) {
-		return super.get(id);
-	}
-	
-	public List<CmHeheCollageProduct> findList(CmHeheCollageProduct cmHeheCollageProduct) {
-		return super.findList(cmHeheCollageProduct);
-	}
-	
-	public Page<CmHeheCollageProduct> findPage(Page<CmHeheCollageProduct> page, CmHeheCollageProduct cmHeheCollageProduct) {
-		Page<CmHeheCollageProduct> productPage = super.findPage(page, cmHeheCollageProduct);
-		List<CmHeheCollageProduct> productList = productPage.getList();
-		productList.forEach(product -> product.setProductImage(AppUtils.getImageURL("product", product.getProductImage(), 0, "https://www.caimei365.com/")));
-		return productPage;
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(CmHeheCollageProduct cmHeheCollageProduct) {
-		if (!cmHeheCollageProduct.getIsNewRecord()) {
-			CmHeheCollageProduct dbProduct = get(cmHeheCollageProduct.getId());
-			if (!dbProduct.getProductId().equals(cmHeheCollageProduct.getProductId())) {
-				cmHeheCollageProduct.setProductId(cmHeheCollageProductDao.getProductId(cmHeheCollageProduct.getProductId()));
-			}
-		}
-		super.save(cmHeheCollageProduct);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(CmHeheCollageProduct cmHeheCollageProduct) {
-		super.delete(cmHeheCollageProduct);
-	}
+    public CmHeheCollageProduct get(String id) {
+        CmHeheCollageProduct cmHeheCollageProduct = super.get(id);
+        cmHeheCollageProduct.setSkus(cmHeheCollageProductDao.findCollageSku(cmHeheCollageProduct.getProductId()));
+        return cmHeheCollageProduct;
+    }
+
+    public List<CmHeheCollageProduct> findList(CmHeheCollageProduct cmHeheCollageProduct) {
+        return super.findList(cmHeheCollageProduct);
+    }
+
+    public Page<CmHeheCollageProduct> findPage(Page<CmHeheCollageProduct> page, CmHeheCollageProduct cmHeheCollageProduct) {
+        Page<CmHeheCollageProduct> productPage = super.findPage(page, cmHeheCollageProduct);
+        List<CmHeheCollageProduct> productList = productPage.getList();
+        productList.forEach(product -> {
+                    product.setPrice(cmHeheCollageProductDao.getCollagePrice(product.getProductId()));
+                    product.setProductImage(AppUtils.getImageURL("product", product.getProductImage(), 0, "https://www.caimei365.com/"));
+                });
+        return productPage;
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmHeheCollageProduct cmHeheCollageProduct) {
+        if (!cmHeheCollageProduct.getIsNewRecord()) {
+            CmHeheCollageProduct dbProduct = get(cmHeheCollageProduct.getId());
+            if (!dbProduct.getProductId().equals(cmHeheCollageProduct.getProductId())) {
+                cmHeheCollageProduct.setProductId(cmHeheCollageProductDao.getProductId(cmHeheCollageProduct.getProductId()));
+            }
+            //修改拼团价
+            List<CmSku> skus = cmHeheCollageProduct.getSkus();
+            for (CmSku s : skus) {
+                CmSku price = cmHeheCollageProductDao.getSkuCollage(s.getSkuId());
+                if (null != price) {
+                    cmHeheCollageProductDao.updateSkuCollage(s);
+                } else {
+                    cmHeheCollageProductDao.insertSkuCollage(s);
+                }
+            }
+        } else {
+            //新添加保存不同sku的拼团价
+            List<CmSku> skus = cmHeheCollageProduct.getSkus();
+            skus.forEach(s -> cmHeheCollageProductDao.insertSkuCollage(s));
+        }
+        super.save(cmHeheCollageProduct);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmHeheCollageProduct cmHeheCollageProduct) {
+        super.delete(cmHeheCollageProduct);
+    }
 
     public Page<Product> findProductList(Page<Product> productPage, Product product) {
-		product.setPage(productPage);
-		product.setSearchType(2);
-		// 已参与拼团商品id
-		List<Integer> productIds = cmHeheProductDao.findCollageProductIds();
-		// 已参与商品活动商品id
-		List<Integer> actProductIds = cmHeheProductDao.findActivityProductIds();
-		// 已参与限时特价活动商品id
-		List<Integer> discountProductIds = cmHeheProductDao.findDiscountProductIds();
-		productIds.addAll(actProductIds);
+        product.setPage(productPage);
+        product.setSearchType(2);
+        // 已参与拼团商品id
+        List<Integer> productIds = cmHeheProductDao.findCollageProductIds();
+        // 已参与商品活动商品id
+        List<Integer> actProductIds = cmHeheProductDao.findActivityProductIds();
+        // 已参与限时特价活动商品id
+        List<Integer> discountProductIds = cmHeheProductDao.findDiscountProductIds();
+        productIds.addAll(actProductIds);
         productIds.addAll(discountProductIds);
-		product.setIds(productIds);
-		List<Product> productList = cmHeheFloorProductDao.findAllProduct(product);
-		if (productList != null && productList.size() > 0) {
-			productList.forEach(item -> {
-				item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, "https://www.caimei365.com/"));
-				item.setProductIds(product.getProductIds());
-			});
-		}
-		productPage.setList(productList);
-		return productPage;
+        product.setIds(productIds);
+        List<Product> productList = cmHeheFloorProductDao.findAllProduct(product);
+        if (productList != null && productList.size() > 0) {
+            productList.forEach(item -> {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, "https://www.caimei365.com/"));
+                item.setProductIds(product.getProductIds());
+            });
+        }
+        productPage.setList(productList);
+        return productPage;
     }
 
-	@Transactional(readOnly = false)
-	public void updateStatus(Integer id, Integer status) {
-		cmHeheCollageProductDao.updateStatus(id, status);
-	}
+    @Transactional(readOnly = false)
+    public void updateStatus(Integer id, Integer status) {
+        cmHeheCollageProductDao.updateStatus(id, status);
+    }
 }

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

@@ -3,6 +3,9 @@ package com.caimei.modules.hehe.service;
 import com.caimei.modules.hehe.dao.CmHeheActivityProductDao;
 import com.caimei.modules.hehe.dao.CmHeheProductDao;
 import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.product.dao.ProductDao;
+import com.caimei.modules.product.entity.CmLadderPrice;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.MathUtil;
@@ -32,6 +35,8 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
     private CmHeheProductDao cmHeheProductDao;
     @Autowired
     private CmHeheActivityProductDao activityProductDao;
+    @Autowired
+    private ProductDao productDao;
 
     public CmHeheProduct get(String id) {
         return super.get(id);
@@ -46,6 +51,11 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
         List<CmHeheProduct> list = productPage.getList();
         String wwwServer = Global.getConfig("wwwServer");
         list.forEach(p -> {
+            CmHeheProduct cp = cmHeheProductDao.findProductElement(p.getProductId());
+            p.setCostPrice(cp.getCostPrice());
+            p.setCostProportional(cp.getCostProportional());
+            p.setCostType(cp.getCostType());
+            p.setPrice(cp.getPrice());
             //比例成本
             if ("2".equals(p.getCostType())) {
                 BigDecimal costPrice = MathUtil.div(MathUtil.mul(p.getPrice(), p.getCostProportional()), 100, 2);
@@ -60,18 +70,24 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
     public void save(CmHeheProduct cmHeheProduct) {
         boolean isNewRecord = cmHeheProduct.getIsNewRecord();
         super.save(cmHeheProduct);
+        List<CmSku> skus = cmHeheProduct.getSkus();
         if (isNewRecord) {
             // 添加商品时保存商品楼层和活动
             Integer newActivityId = cmHeheProduct.getActivityId();
             if (newActivityId != null) {
                 cmHeheProductDao.addActivityProduct(cmHeheProduct.getProductId(), newActivityId);
             }
+            //保存新的呵呵price
+            skus.forEach(s -> cmHeheProductDao.insertHeHeSkuPrice(cmHeheProduct.getProductId(), s.getSkuId(), s.getPrice()));
             /*String newFloorIds = cmHeheProduct.getFloorIds();
             String[] floorIdArr = newFloorIds.split(",");
             for (int i = 0; i < floorIdArr.length; i++) {
                 String floorId = floorIdArr[i];
                 cmHeheProductDao.addFloorProduct(cmHeheProduct.getId(), floorId);
             }*/
+        } else {
+            //修改sku呵呵价格
+            skus.forEach(s -> cmHeheProductDao.updateHeHeSkuPrice(s.getSkuId(), s.getPrice()));
         }
     }
 
@@ -83,7 +99,7 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
         //删除分销者活动商品
         activityProductDao.deleteUserActivity(cmHeheProduct.getProductId());
         //删除活动阶梯
-        activityProductDao.deleteLadder(null,cmHeheProduct.getProductId());
+        activityProductDao.deleteLadder(null, cmHeheProduct.getProductId());
     }
 
     public Page<Product> findProductPage(Page<Product> productPage, Product product) {
@@ -96,13 +112,13 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
             if (StringUtil.isNotBlank(item.getMainImage())) {
                 item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
             }
+            item.setSkuList(productDao.findHeHeSku(item.getProductID()));
         });
         productPage.setList(productList);
         return productPage;
     }
 
 
-
     @Transactional(readOnly = false)
     public void updateValidFlag(CmHeheProduct cmHeheProduct) {
         if ("1".equals(cmHeheProduct.getValidFlag())) {
@@ -134,4 +150,10 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
         productPage.setList(productList);
         return productPage;
     }
+
+    public List<CmSku> getProductSku(Integer productId) {
+        List<CmSku> skuList = productDao.findHeHeSku(productId);
+        skuList.forEach(s -> s.setLadderPriceList(cmHeheProductDao.findLadderList(s.getSkuId())));
+        return skuList;
+    }
 }

+ 3 - 2
src/main/java/com/caimei/modules/hehe/service/CmHeheUserService.java

@@ -31,6 +31,8 @@ public class CmHeheUserService extends CrudService<CmHeheUserDao, CmHeheUser> {
     private CmHeheUserDao cmHeheUserDao;
     @Autowired
     private CmHeheActivityProductDao activityProductDao;
+    @Autowired
+    private CmHeheProductService heheProductService;
 
     public CmHeheUser get(String id) {
         return super.get(id);
@@ -81,11 +83,10 @@ public class CmHeheUserService extends CrudService<CmHeheUserDao, CmHeheUser> {
         List<CmHeheActivityProduct> productList = cmHeheUserDao.activityProductList(activityProduct);
         String wwwServer = Global.getConfig("wwwServer");
         productList.forEach(item -> {
-            List<CmHeHeActivityLadder> activityLadderList = activityProductDao.findActivityLadder(item.getActivityId(), item.getProductId());
+            item.setSkus(heheProductService.getProductSku(item.getProductId()));
             if (StringUtil.isNotBlank(item.getMainImage())) {
                 item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
             }
-            item.setActivityLadderList(activityLadderList);
         });
         productPage.setList(productList);
         return productPage;

+ 24 - 3
src/main/java/com/caimei/modules/hehe/service/HeheDiscountActivityProductService.java

@@ -6,6 +6,7 @@ import com.caimei.modules.hehe.dao.CmHeheActivityProductDao;
 import com.caimei.modules.hehe.dao.CmHeheProductDao;
 import com.caimei.modules.hehe.entity.CmHeheProduct;
 import com.caimei.modules.hehe.entity.HeheHomeTypeProduct;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.StringUtil;
 import com.thinkgem.jeesite.common.config.Global;
@@ -18,6 +19,8 @@ import com.thinkgem.jeesite.common.service.CrudService;
 import com.caimei.modules.hehe.entity.HeheDiscountActivityProduct;
 import com.caimei.modules.hehe.dao.HeheDiscountActivityProductDao;
 
+import static org.apache.struts2.interceptor.DateTextFieldInterceptor.DateWord.s;
+
 /**
  * 限时特价商品Service
  * @author Aslee
@@ -34,7 +37,9 @@ public class HeheDiscountActivityProductService extends CrudService<HeheDiscount
 	private CmHeheProductDao cmHeheProductDao;
 
 	public HeheDiscountActivityProduct get(String id) {
-		return super.get(id);
+		HeheDiscountActivityProduct heheDiscountActivityProduct = super.get(id);
+		heheDiscountActivityProduct.setSkus(activityProductDao.findDiscountSku(heheDiscountActivityProduct.getProductId()));
+		return heheDiscountActivityProduct;
 	}
 	
 	public List<HeheDiscountActivityProduct> findList(HeheDiscountActivityProduct heheDiscountActivityProduct) {
@@ -45,15 +50,31 @@ public class HeheDiscountActivityProductService extends CrudService<HeheDiscount
 		Page<HeheDiscountActivityProduct> productPage = super.findPage(page, heheDiscountActivityProduct);
 		List<HeheDiscountActivityProduct> list = productPage.getList();
 		String wwwServer = Global.getConfig("wwwServer");
-		list.forEach(p -> p.setMainImage(AppUtils.getImageURL("product", p.getMainImage(), 0, wwwServer)));
+		list.forEach(p -> {
+			p.setMainImage(AppUtils.getImageURL("product", p.getMainImage(), 0, wwwServer));
+			p.setDiscountPrice(activityProductDao.findPrice(p.getProductId()));
+		});
 		return productPage;
 	}
 	
 	@Transactional(readOnly = false)
 	public void save(HeheDiscountActivityProduct heheDiscountActivityProduct) {
 		super.save(heheDiscountActivityProduct);
+		//修改/保存sku的限时特价
+		List<CmSku> skus = heheDiscountActivityProduct.getSkus();
+		skus.forEach(this::saveDiscountPrice);
 	}
-	
+
+	@Transactional(readOnly = false)
+	public void saveDiscountPrice(CmSku s) {
+		CmSku discount= activityProductDao.findDiscountBySku(s.getSkuId());
+		if(null!=discount){
+			activityProductDao.updateDiscount(s);
+		}else{
+			activityProductDao.insertDiscount(s);
+		}
+	}
+
 	@Transactional(readOnly = false)
 	public void delete(HeheDiscountActivityProduct heheDiscountActivityProduct) {
 		super.delete(heheDiscountActivityProduct);

+ 1 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheActivityProductController.java

@@ -20,6 +20,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;

+ 13 - 0
src/main/java/com/caimei/modules/hehe/web/CmHeheCollageProductController.java

@@ -3,6 +3,8 @@ package com.caimei.modules.hehe.web;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.caimei.modules.hehe.dao.CmHeheCollageProductDao;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.utils.AppUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -23,6 +25,7 @@ import com.caimei.modules.hehe.entity.CmHeheCollageProduct;
 import com.caimei.modules.hehe.service.CmHeheCollageProductService;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -36,6 +39,9 @@ public class CmHeheCollageProductController extends BaseController {
 
 	@Autowired
 	private CmHeheCollageProductService cmHeheCollageProductService;
+
+	@Autowired
+	private CmHeheCollageProductDao cmHeheCollageProductDao;
 	
 	@ModelAttribute
 	public CmHeheCollageProduct get(@RequestParam(required=false) String id) {
@@ -106,4 +112,11 @@ public class CmHeheCollageProductController extends BaseController {
 		return map;
 	}
 
+	@RequestMapping(value = "getSku")
+	@ResponseBody
+	public List<CmSku> updateStatus(Integer productId) {
+		List<CmSku> collageSku = cmHeheCollageProductDao.findCollageByHeHeId(productId);
+		return collageSku;
+	}
+
 }

+ 9 - 2
src/main/java/com/caimei/modules/hehe/web/CmHeheProductController.java

@@ -1,12 +1,16 @@
 package com.caimei.modules.hehe.web;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.alibaba.fastjson.JSON;
 import com.caimei.modules.hehe.entity.CmHeheActivity;
 import com.caimei.modules.hehe.entity.CmHeheFloor;
 import com.caimei.modules.hehe.service.CmHeheActivityService;
 import com.caimei.modules.hehe.service.CmHeheFloorService;
+import com.caimei.modules.product.dao.ProductDao;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.product.service.ProductService;
 import com.google.common.collect.Maps;
@@ -75,6 +79,8 @@ public class CmHeheProductController extends BaseController {
 
     @RequestMapping(value = "form")
     public String form(CmHeheProduct cmHeheProduct, Model model) {
+        List<CmSku> skuList = productService.findHeHeSku(cmHeheProduct.getProductId());
+        cmHeheProduct.setSkus(skuList);
         model.addAttribute("cmHeheProduct", cmHeheProduct);
         CmHeheFloor cmHeheFloor = new CmHeheFloor();
         cmHeheFloor.setStatus("1");
@@ -82,7 +88,7 @@ public class CmHeheProductController extends BaseController {
         List<CmHeheFloor> floorList = cmHeheFloorService.findList(cmHeheFloor);
         String floorIds = cmHeheProduct.getFloorIds();
         if (StringUtils.isNotEmpty(floorIds)) {
-            floorList.forEach(floor->{
+            floorList.forEach(floor -> {
                 if (floorIds.contains(floor.getId())) {
                     floor.setChecked(true);
                 }
@@ -95,7 +101,7 @@ public class CmHeheProductController extends BaseController {
         List<CmHeheActivity> activityList = cmHeheActivityService.findList(cmHeheActivity);
         String activityId = cmHeheProduct.getActivityId() + "";
         if (StringUtils.isNotEmpty(activityId)) {
-            activityList.forEach(activity->{
+            activityList.forEach(activity -> {
                 if (activityId.equals(activity.getId())) {
                     activity.setChecked(true);
                 }
@@ -129,6 +135,7 @@ public class CmHeheProductController extends BaseController {
     public String findProductPage(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
         Page<Product> page = cmHeheProductService.findProductPage(new Page<Product>(request, response), product);
         model.addAttribute("page", page);
+        model.addAttribute("productList", JSON.toJSONString(page.getList()));
         return "modules/hehe/heheAddProduct";
     }
 

+ 13 - 1
src/main/java/com/caimei/modules/hehe/web/HeheDiscountActivityProductController.java

@@ -3,8 +3,10 @@ package com.caimei.modules.hehe.web;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.caimei.modules.hehe.dao.HeheDiscountActivityProductDao;
 import com.caimei.modules.hehe.entity.CmHeheProduct;
 import com.caimei.modules.hehe.entity.HeheDiscountActivityProduct;
+import com.caimei.modules.product.entity.CmSku;
 import com.google.common.collect.Maps;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +25,7 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.caimei.modules.hehe.entity.HeheDiscountActivityProduct;
 import com.caimei.modules.hehe.service.HeheDiscountActivityProductService;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -36,7 +39,10 @@ public class HeheDiscountActivityProductController extends BaseController {
 
 	@Autowired
 	private HeheDiscountActivityProductService heheDiscountActivityProductService;
-	
+
+	@Autowired
+	private HeheDiscountActivityProductDao discountDao;
+
 	@ModelAttribute
 	public HeheDiscountActivityProduct get(@RequestParam(required=false) String id) {
 		HeheDiscountActivityProduct entity = null;
@@ -106,4 +112,10 @@ public class HeheDiscountActivityProductController extends BaseController {
 		model.addAttribute("page", page);
 		return "modules/hehe/addDiscountProduct";
 	}
+
+	@RequestMapping(value = "getSku")
+	@ResponseBody
+	public List<CmSku> updateStatus(Integer productId) {
+		return discountDao.findDiscountSku(productId);
+	}
 }

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

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

+ 8 - 0
src/main/java/com/caimei/modules/order/entity/LogisticsRecord.java

@@ -25,6 +25,7 @@ public class LogisticsRecord extends DataEntity<LogisticsRecord> {
     private String productName; //商品名称
     private String image; //商品图片
     private String sn;     //SN码
+    private String unit;   //规格
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date uploadTime;    //上传商品资质时间
     private String shopName; //供应商名称
@@ -35,6 +36,13 @@ public class LogisticsRecord extends DataEntity<LogisticsRecord> {
     private String[] files;
     private Integer recordId; //发货记录id
 
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
 
     public Integer getLogisticsBatchID() {
         return logisticsBatchID;

+ 11 - 5
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;
@@ -19,7 +20,7 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     private Integer num;//     int(11) comment '数量',
     private Integer presentNum;//   int(11) comment '赠送数量',
     private String outStoreType;// char(1) comment '出库类型',
-    private Integer skuID;//     int(11) comment 'skuId',
+    private Integer skuId;//     int(11) comment 'skuId',
 //    private String props;//     national varchar(1000) comment 'sku属性',
 //    private String propName;//   national varchar(1000) comment '属性名',
     private String productNo;//    national varchar(50) comment '商品编号',
@@ -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;
@@ -255,12 +261,12 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
         this.outStoreType = outStoreType;
     }
 
-    public Integer getSkuID() {
-        return skuID;
+    public Integer getSkuId() {
+        return skuId;
     }
 
-    public void setSkuID(Integer skuID) {
-        this.skuID = skuID;
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
     }
 
 //    public String getProps() {

+ 26 - 20
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());
@@ -966,7 +963,6 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 orderProductLadderPrice.setBuyNum(ladderPrice.getBuyNum());
                 orderProductLadderPrice.setBuyPrice(new BigDecimal(ladderPrice.getBuyPrice()));
                 orderProductLadderPrice.setCreateDate(new Date());
-                orderProductLadderPrice.setLadderNum(ladderPrice.getLadderNum().intValue());
                 orderProductLadderPriceList.add(orderProductLadderPrice);
             });
         }
@@ -1025,6 +1021,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())) {
@@ -1046,7 +1050,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             }
             if (o.getProductType() == 1 || o.getProductType() == 2) {
                 // 赠品订单过来售价为0,去数据库获取该商品原始售价
-                Double tempPrice = cmPromotionDao.getPresentPriceById(o.getProductID());
+                Double tempPrice = cmPromotionDao.getPresentPriceById(o.getSkuId());
                 if (null != tempPrice && tempPrice > 0) {
                     price = tempPrice;
                 }
@@ -1189,6 +1193,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         orderProduct.setIncludedTax(product.getIncludedTax());
         orderProduct.setInvoiceType(product.getInvoiceType());
         orderProduct.setSvipPriceFlag(0);
+        //邮费默认0,skuId不能为空
+        orderProduct.setSkuId(0);
         newOrderProductDao.insert(orderProduct);
     }
 
@@ -1241,7 +1247,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);
             }
@@ -1389,8 +1395,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) {
@@ -1741,14 +1747,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);
@@ -1800,7 +1806,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);
@@ -1842,7 +1848,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);

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

@@ -1,5 +1,6 @@
 package com.caimei.modules.order.web;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.constants.NewPayWay;
 import com.caimei.dfs.image.beens.ImageUploadInfo;
@@ -398,7 +399,8 @@ public class NewOrderController extends BaseController {
             List<NewOrderProduct> orderProductList = Lists.newArrayList();
             for (NewOrderProduct newOrderProduct : newOrder.getOrderProduct()) {
                 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());
                     String productId = jsonObject.getString("productId");
                     if (productId != null && !"".equals(productId)) {
@@ -428,8 +430,17 @@ public class NewOrderController extends BaseController {
                     if (ladderPriceFlag != null && !"".equals(ladderPriceFlag)) {
                         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);
+                    }
                     o.setSplitCode(productDao.getSplitCodeByProductId(o.getProductID()));
                     if ("0".equals(productType)) {
+                        o.setSkuId(Integer.valueOf(skuId));
                         o.setPreferential((o.getPrice() - o.getDiscountPrice()) * o.getNum());//折扣
                         o.setDiscountFee(BigDecimal.valueOf(o.getTotalFee()).subtract(BigDecimal.valueOf(o.getShouldPayFee())).doubleValue());//经理折扣
                         o.setTotalAmount(o.getPrice() * o.getNum());//商品总金额
@@ -439,6 +450,7 @@ public class NewOrderController extends BaseController {
                             o.setShouldPayTotalTax(o.getTotalAddedValueTax());
                         }
                     } else {
+                        o.setSkuId(productDao.findSkuIdByPromotionsId(o.getPromotionsId()));
                         o.setPreferential(0d);
                         o.setDiscount(100d);
                         o.setDiscountFee(0d);

+ 5 - 1
src/main/java/com/caimei/modules/product/dao/CmPromotionDao.java

@@ -94,7 +94,11 @@ public interface CmPromotionDao extends CrudDao<CmPromotion> {
      */
     CmPromotion findPromotionsByProductId(@Param("productId") Integer productId);
 
-    Double getPresentPriceById(@Param("productId") Integer productId);
+    Double getPresentPriceById(@Param("skuId") Integer skuId);
+
     List<Integer> findProductIdByPromotion(String promotionsId);
+
     List<Integer> findProductIdsByPromotion(String promotionsId);
+
+    void deletePromotion(@Param("id")String id,@Param("skuId") Integer skuId);
 }

+ 29 - 2
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -17,7 +17,6 @@ public interface ProductDao extends CrudDao<Product> {
     List<ActType> getAllActType();
 
 
-
     int saveSort(@Param("sort") String sort, @Param("id") String id);
 
     int findLadderPriceByNum(@Param("productID") String productID);
@@ -167,7 +166,7 @@ public interface ProductDao extends CrudDao<Product> {
 
     void deleteLadderPriceByProductId(Integer productID);
 
-    void deleteLadderPriceById(Integer id);
+    void deleteLadderPriceById(Integer productId);
 
     List<Product> findActList(Product product);
 
@@ -194,4 +193,32 @@ public interface ProductDao extends CrudDao<Product> {
     String getSplitCodeByProductId(Integer productID);
 
     List<CmSplitCode> findSplitCodesByShopId(Integer shopID);
+
+    void insertSku(CmSku s);
+
+    void insertCmLadderPrice(CmLadderPrice l);
+
+    void deleteSkus(Integer productID);
+
+    List<CmSku> findSkuList(Integer productID);
+
+    List<CmLadderPrice> findLadderPriceBySku(Integer skuId);
+
+    List<ProductLadderPrice> findLadderPrice(Integer skuId);
+
+    Product getBySku(String skuId);
+
+    List<CmSku> findHeHeSku(Integer productId);
+
+    Integer findSkuId(Integer productID);
+
+    void updateCmSku(CmSku cmSku);
+
+    CmSku findSku(Integer productId);
+
+    CmSku findSkuById(Integer skuId);
+
+    Integer findSkuIdByPromotionsId(Integer promotionsId);
+
+    void deleteProductSkus(@Param("skuIds")List<Integer> skuIds,@Param("productId")Integer productId);
 }

+ 127 - 0
src/main/java/com/caimei/modules/product/entity/CmLadderPrice.java

@@ -0,0 +1,127 @@
+package com.caimei.modules.product.entity;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author zzj
+ */
+@Data
+@Accessors(fluent = true)
+public class CmLadderPrice implements Serializable{
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键 id
+     */
+    private Integer id;
+    private Integer skuId;
+    private Integer productId; // 商品id
+    private Integer userType;  // 用户类型,1游客,2普通用户,3会员用户
+    private Integer ladderNum;  // 第几阶梯
+    private Integer buyNum; // 购买数量
+    private Double buyPrice; // 购买价格
+    private String createBy; // 创建人ID
+    private Date createDate; // 创建时间
+    private String updateBy; //  最后更新人ID(用户ID)
+    private Date updateDate; // 最后更新时间
+    private String delFlag; // 删除标记 0正常 其它为已删除(使用时间戳记录) 默认值 = 0
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getUserType() {
+        return userType;
+    }
+
+    public void setUserType(Integer userType) {
+        this.userType = userType;
+    }
+
+    public Integer getLadderNum() {
+        return ladderNum;
+    }
+
+    public void setLadderNum(Integer ladderNum) {
+        this.ladderNum = ladderNum;
+    }
+
+    public Integer getBuyNum() {
+        return buyNum;
+    }
+
+    public void setBuyNum(Integer buyNum) {
+        this.buyNum = buyNum;
+    }
+
+    public Double getBuyPrice() {
+        return buyPrice;
+    }
+
+    public void setBuyPrice(Double buyPrice) {
+        this.buyPrice = buyPrice;
+    }
+
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+
+    public String getUpdateBy() {
+        return updateBy;
+    }
+
+    public void setUpdateBy(String updateBy) {
+        this.updateBy = updateBy;
+    }
+
+    public Date getUpdateDate() {
+        return updateDate;
+    }
+
+    public void setUpdateDate(Date updateDate) {
+        this.updateDate = updateDate;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+}

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

@@ -12,6 +12,11 @@ import java.util.List;
 public class CmPromotion extends DataEntity<CmPromotion> {
     private static final long serialVersionUID = 1L;
 
+    private String unit;
+    /**
+     * 赠品的skuId,商品无需
+     */
+    private Integer skuId;
     /**
      * 是否支持叠加优惠,1支持,2不支持
      */
@@ -146,6 +151,22 @@ 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;
+    }
+
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
+    }
+
     public  CmPromotion(){
         super();
     }

+ 143 - 0
src/main/java/com/caimei/modules/product/entity/CmSku.java

@@ -0,0 +1,143 @@
+package com.caimei.modules.product.entity;
+
+import com.caimei.po.ProductLadderPrice;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @author zzj
+ */
+@SuppressWarnings("all")
+@Data
+@Accessors(fluent = true)
+public class CmSku extends DataEntity<CmSku> {
+    private Integer skuId;
+    private Integer productId;
+    private String unit;        // 包装规格
+    private Double normalPrice;        // 市场价
+    private String stock;        // 库存
+    private Integer costCheckFlag;        // 成本价选中标志:1固定成本 2比例成本
+    private Double costProportional;        // 比例成本百分比
+    private Double costPrice;        // 成本价
+    private Double price;        // 机构价
+    private Integer ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
+    private Integer minBuyNumber;        // 无阶梯价起订量
+    private Double collagePrice;   //拼团价
+    private Double discountPrice;  //限时特价
+    private List<CmLadderPrice> ladderPriceList;
+
+    public Double getCollagePrice() {
+        return collagePrice;
+    }
+
+    public void setCollagePrice(Double collagePrice) {
+        this.collagePrice = collagePrice;
+    }
+
+    public Double getDiscountPrice() {
+        return discountPrice;
+    }
+
+    public void setDiscountPrice(Double discountPrice) {
+        this.discountPrice = discountPrice;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public Double getNormalPrice() {
+        return normalPrice;
+    }
+
+    public void setNormalPrice(Double normalPrice) {
+        this.normalPrice = normalPrice;
+    }
+
+    public String getStock() {
+        return stock;
+    }
+
+    public void setStock(String stock) {
+        this.stock = stock;
+    }
+
+    public Double getCostProportional() {
+        return costProportional;
+    }
+
+    public void setCostProportional(Double costProportional) {
+        this.costProportional = costProportional;
+    }
+
+    public Integer getCostCheckFlag() {
+        return costCheckFlag;
+    }
+
+    public void setCostCheckFlag(Integer costCheckFlag) {
+        this.costCheckFlag = costCheckFlag;
+    }
+
+    public Double getCostPrice() {
+        return costPrice;
+    }
+
+    public void setCostPrice(Double costPrice) {
+        this.costPrice = costPrice;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    public Integer getLadderPriceFlag() {
+        return ladderPriceFlag;
+    }
+
+    public void setLadderPriceFlag(Integer ladderPriceFlag) {
+        this.ladderPriceFlag = ladderPriceFlag;
+    }
+
+    public Integer getMinBuyNumber() {
+        return minBuyNumber;
+    }
+
+    public void setMinBuyNumber(Integer minBuyNumber) {
+        this.minBuyNumber = minBuyNumber;
+    }
+
+    public List<CmLadderPrice> getLadderPriceList() {
+        return ladderPriceList;
+    }
+
+    public void setLadderPriceList(List<CmLadderPrice> ladderPriceList) {
+        this.ladderPriceList = ladderPriceList;
+    }
+}

+ 20 - 15
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -29,7 +29,7 @@ public class Product extends DataEntity<Product> {
     private String searchKey;        // 搜索关键词
     private String productRemarks;//商品备注
     private Double normalPrice;        // 市场价
-    private Double price;        // price
+    private Double price;        // 机构价
     private String priceFlag;        // 会员用户价格展示标志 0 否 1 是
     private String beautyActFlag;        // 游客价格文字
     private String ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
@@ -87,8 +87,10 @@ public class Product extends DataEntity<Product> {
     private Integer combinationID;//商品组合Id
     private String productDetail; //普通机构商品详情1同资质机构商品详情,2用普通机构商品详情
     private String splitCode; //  该商品分账商户号
+    private List<CmSku> skuList;
     //-----------------  虚拟字段 ----
-    private Integer shopType; //供应商类别,0未审核的二手供应商,普通1,新品供应商2,二手供应商3
+    private Integer skuId;
+    private Integer shopType; //供应商类别,0未审核的二手供应商,1普通,2新品供应商,3二手供应商
     private boolean customClass = false;  //是否有自定义分类
     private String brandName;//品牌名称
     private String otherBrandName;//其他手填品牌名称
@@ -171,19 +173,6 @@ public class Product extends DataEntity<Product> {
      * 商品别名
      */
     private String aliasName;
-//    /**
-//     * 普通用户价格等级(范围1-5)
-//     */
-//    private String price0Grade;
-//    /**
-//     * 会员用户价格等级(范围1-5)
-//     */
-//    private String price1Grade;
-//
-//    /**
-//     * 游客用户价格等级(范围1-5)
-//     */
-//    private String price8Grade;
     /**
      * (3:高可见度,2:中可见度,1:低可见度)
      */
@@ -292,6 +281,22 @@ public class Product extends DataEntity<Product> {
     //税率
     private Double taxRate;
 
+    public Integer getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
+    }
+
+    public List<CmSku> getSkuList() {
+        return skuList;
+    }
+
+    public void setSkuList(List<CmSku> skuList) {
+        this.skuList = skuList;
+    }
+
     public String[] getValidFlagString() {
         return validFlagString;
     }

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

@@ -28,6 +28,15 @@ public class RepeatPurchasePrice extends DataEntity<RepeatPurchasePrice> {
     private String orderId;   //
     private Integer clubId;   //
 	private String delFlag;   //删除标记 0否 其余是
+	private String unit;  //规格
+
+	public String getUnit() {
+		return unit;
+	}
+
+	public void setUnit(String unit) {
+		this.unit = unit;
+	}
 
 	public String getDelFlag() {
 		return delFlag;

+ 37 - 35
src/main/java/com/caimei/modules/product/service/CmProductCombinationService.java

@@ -2,6 +2,7 @@ package com.caimei.modules.product.service;
 
 import java.util.List;
 
+import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.Product;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
@@ -16,6 +17,7 @@ import javax.annotation.Resource;
 
 /**
  * 组合商品Service
+ *
  * @author lijun
  * @version 2020-04-29
  */
@@ -25,62 +27,62 @@ public class CmProductCombinationService extends CrudService<CmProductCombinatio
 	@Resource
 	public CmProductCombinationDao CmProductCombinationDao;
 
-	public CmProductCombination get(String id) {
-		return super.get(id);
-	}
+    public CmProductCombination get(String id) {
+        return super.get(id);
+    }
 
-	public List<CmProductCombination> findList(CmProductCombination cmProductCombination) {
-		return super.findList(cmProductCombination);
-	}
+    public List<CmProductCombination> findList(CmProductCombination cmProductCombination) {
+        return super.findList(cmProductCombination);
+    }
 
-	public Page<CmProductCombination> findPage(Page<CmProductCombination> page, CmProductCombination cmProductCombination) {
-		return super.findPage(page, cmProductCombination);
-	}
+    public Page<CmProductCombination> findPage(Page<CmProductCombination> page, CmProductCombination cmProductCombination) {
+        return super.findPage(page, cmProductCombination);
+    }
 
-	@Transactional(readOnly = false)
-	public void save(CmProductCombination cmProductCombination) {
-		super.save(cmProductCombination);
-	}
+    @Transactional(readOnly = false)
+    public void save(CmProductCombination cmProductCombination) {
+        super.save(cmProductCombination);
+    }
 
-	@Transactional(readOnly = false)
-	public void saveSort(String sort,String id ) {
-		CmProductCombinationDao.saveSort(sort,id);
-	}
+    @Transactional(readOnly = false)
+    public void saveSort(String sort, String id) {
+        CmProductCombinationDao.saveSort(sort, id);
+    }
 
-	@Transactional(readOnly = false)
-	public void delete(CmProductCombination cmProductCombination) {
-		super.delete(cmProductCombination);
-	}
+    @Transactional(readOnly = false)
+    public void delete(CmProductCombination cmProductCombination) {
+        super.delete(cmProductCombination);
+    }
 
 
-	@Transactional(readOnly = false)
-	public void untieProduct(String combinationId) {
-		CmProductCombinationDao.untieProduct(combinationId);
-	}
+    @Transactional(readOnly = false)
+    public void untieProduct(String combinationId) {
+        CmProductCombinationDao.untieProduct(combinationId);
+    }
 
 	@Transactional(readOnly = false)
 	public void addProductCombination(@Param("id")String id, @Param("productIds")String[] productIds){
 		CmProductCombinationDao.addProductCombination(id,productIds);
 	}
 
-	@Transactional(readOnly = false)
-	public void untieProductByProductId(Integer combinationId) {
-		CmProductCombinationDao.untieProductByProductId(combinationId);
-	}
+    @Transactional(readOnly = false)
+    public void untieProductByProductId(Integer skuId) {
+        CmProductCombinationDao.untieProductByProductId(skuId);
+    }
 
 
-	public List<Product> findCombinationProductList(String id) {
-		return CmProductCombinationDao.findCombinationProductList(id);
-	}
+    public List<Product> findCombinationProductList(String id) {
+        return CmProductCombinationDao.findCombinationProductList(id);
+    }
 
 
 	public List<Product> findProductList(Product product) {
 		return CmProductCombinationDao.findProductList(product);
 	}
 
-	public List<CmProductCombination> findProductCombinationList(){
-		return CmProductCombinationDao.findProductCombinationList();
-	}
+    public List<CmProductCombination> findProductCombinationList() {
+        return CmProductCombinationDao.findProductCombinationList();
+    }
 
 
 }

+ 16 - 6
src/main/java/com/caimei/modules/product/service/CmPromotionService.java

@@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONArray;
 import com.caimei.modules.bulkpurchase.entity.PurchaseProduct;
 import com.caimei.modules.cibe.entity.Shop;
 import com.caimei.modules.product.dao.CmPromotionDao;
+import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.CmPromotion;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.product.entity.RepeatPurchasePrice;
 import com.caimei.utils.AppUtils;
@@ -22,17 +24,16 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 @Transactional(readOnly = true)
 public class CmPromotionService extends CrudService<CmPromotionDao, CmPromotion> {
     @Autowired
     private CmPromotionDao cmPromotionDao;
-
+    @Autowired
+    private ProductDao productDao;
     @Override
     public CmPromotion get(String id) {
         return super.get(id);
@@ -225,6 +226,10 @@ public class CmPromotionService extends CrudService<CmPromotionDao, CmPromotion>
         productList = cmPromotionDao.findAllProduct(product);
         String wwwServer = Global.getConfig("wwwServer");
         productList.forEach(item ->{
+            List<CmSku> skuList = productDao.findSkuList(item.getProductID());
+            List<CmSku> collect = skuList.stream().sorted(Comparator.comparing(CmSku::getPrice)).collect(Collectors.toList());
+            item.setSkuList(collect);
+            item.setPrice(collect.get(0).getPrice());
             item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
         });
         productPage.setList(productList);
@@ -309,7 +314,8 @@ public class CmPromotionService extends CrudService<CmPromotionDao, CmPromotion>
         if (StringUtil.isNotBlank(cmPromotion.getGiftIds())) {
             List<HashMap> list = JSONArray.parseArray(cmPromotion.getGiftIds(), HashMap.class);
             for (HashMap map : list) {
-                String giftId = (String) map.get("productId");
+                //赠品改为skuId
+                String giftId = (String) map.get("skuId");
                 Integer number = Integer.parseInt(map.get("number").toString());
                 cmPromotionDao.insertGiftProduct(promotionId, giftId, number);
             }
@@ -342,4 +348,8 @@ public class CmPromotionService extends CrudService<CmPromotionDao, CmPromotion>
     public CmPromotion findProductPromotion(String shopId, Long productId) {
          return cmPromotionDao.findProductPromotion(shopId, productId);
     }
+
+    public void delPromotion(String id, Integer skuId) {
+        cmPromotionDao.deletePromotion(id,skuId);
+    }
 }

+ 35 - 20
src/main/java/com/caimei/modules/product/service/ProductNewService.java

@@ -82,6 +82,7 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
     private WeChatService weChatService;
     @Value("${wwwServer}")
     private String domain;
+
     @Override
     public Product get(String id) {
         return super.get(id);
@@ -96,7 +97,20 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
     public Page<Product> findPage(Page<Product> page, Product entity) {
         page.setPageSize(20);
         entity.setPage(page);
-        page.setList(dao.findList(entity));
+        List<Product> list = dao.findList(entity);
+        list.forEach(p -> {
+            CmSku sku = productDao.findSku(p.getProductID());
+            p.setPrice(sku.getPrice());
+            p.setNormalPrice(sku.getNormalPrice());
+            Integer costCheckFlag = sku.getCostCheckFlag();
+            p.setCostCheckFlag(costCheckFlag.toString());
+            if(1==costCheckFlag){
+                p.setCostPrice(sku.getCostPrice().toString());
+            }else{
+                p.setSqlCostProportional(sku.getCostProportional());
+            }
+        });
+        page.setList(list);
         return page;
     }
 
@@ -222,7 +236,7 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         }
     }
 
-    public void auditProduct(String validFlag,Integer newvalidFlag,String showtime, String beforeValidFlag, Integer productID) throws Exception{
+    public void auditProduct(String validFlag, Integer newvalidFlag, String showtime, String beforeValidFlag, Integer productID) throws Exception {
         Product product = new Product();
         product.setProductID(productID);
         product.setValidFlag(validFlag);
@@ -232,19 +246,19 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         SimpleDateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String createDates = formatters.format(new Date());
         product.setNewshowTime(createDates);
-        NewPageFloorImage floorImage=new NewPageFloorImage();
+        NewPageFloorImage floorImage = new NewPageFloorImage();
         floorImage.setFloorId(productNewDao.newFloorId());
         floorImage.setImage(product.getMainImage());
         floorImage.setProductId(productID);
         floorImage.setShopName(product.getShopName());
-        String link="";
-
-        if(domain.contains("-b")){
-            link="https://www-b.caimei365.com/product-"+productID+"-5"+".html";
-        }else if(domain.contains("localhost")){
-           link="http://localhost:8081/product-"+productID+"-5"+".html";
-        }else {
-            link="https://www.caimei365.com/product-"+productID+"-5"+".html";
+        String link = "";
+
+        if (domain.contains("-b")) {
+            link = "https://www-b.caimei365.com/product-" + productID + "-5" + ".html";
+        } else if (domain.contains("localhost")) {
+            link = "http://localhost:8081/product-" + productID + "-5" + ".html";
+        } else {
+            link = "https://www.caimei365.com/product-" + productID + "-5" + ".html";
         }
         floorImage.setLink(link);
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -252,11 +266,12 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         floorImage.setCreateDate(createDate);
         floorImage.setName(product.getName());
         newPageFloorDao.insertFloorImage(floorImage);
-        product.setFloorId( productNewDao.newFloorId());
+        product.setFloorId(productNewDao.newFloorId());
         productNewDao.updateByPrimaryKeySelective(product);
         cleanRedisCache();
 
     }
+
     public void cleanRedisCache() {
         //清除活动专题缓存
         redisService.removePattern("getPageFloorData*");
@@ -354,7 +369,7 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         Integer shopId = productNewDao.getShopIdByName("采美奥泰");
         if (null != shopId) {
             List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
-            heheProductList.forEach(heheProduct->{
+            heheProductList.forEach(heheProduct -> {
                 Integer heheProductId = Integer.parseInt(heheProduct.getId());
                 Integer oldProductId = heheProduct.getProductId();
                 // 采美商品id
@@ -375,19 +390,19 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
                 productDao.insertProductDetailInfo(productDetailInfo);
                 // 查询阶梯列表
                 List<ProductLadderPrice> ladderPriceList = productService.findLadderPrice(productId);
-                ladderPriceList.forEach(ladder->{
+                ladderPriceList.forEach(ladder -> {
                     ladder.setProductId(newProductId);
                     productDao.insertLadderPrice(ladder);
                 });
                 // 查询商品图片
                 List<ProductImage> imageList = productNewDao.getImageList(productId);
-                imageList.forEach(image->{
+                imageList.forEach(image -> {
                     image.setProductID(newProductId);
                     productNewDao.insertProductImage(image);
                 });
                 // 查询相关参数
                 List<ProductParameters> productParams = getProductParams(productId);
-                productParams.forEach(productParam->{
+                productParams.forEach(productParam -> {
                     productParam.setProductId(newProductId);
                     productNewDao.insertParameters(productParam);
                 });
@@ -396,7 +411,7 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
             });
             // 更新活动商品
             List<CmHeheActivityProduct> activityProductList = cmHeheActivityProductDao.findAllList(new CmHeheActivityProduct());
-            activityProductList.forEach(activityProduct->{
+            activityProductList.forEach(activityProduct -> {
                 Integer oldProductId = activityProduct.getProductId();
                 Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
                 if (null != newProductId) {
@@ -405,7 +420,7 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
             });
             // 更新拼团商品
             List<CmHeheCollageProduct> collageProductList = cmHeheCollageProductDao.findAllList(new CmHeheCollageProduct());
-            collageProductList.forEach(collageProduct->{
+            collageProductList.forEach(collageProduct -> {
                 Integer oldProductId = collageProduct.getProductId();
                 Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
                 if (null != newProductId) {
@@ -414,7 +429,7 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
             });
             // 更新优惠券商品
             List<Integer> productIds = cmHeheCouponDao.findAllProductIds();
-            productIds.forEach(oldProductId->{
+            productIds.forEach(oldProductId -> {
                 Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
                 if (null != newProductId) {
                     cmHeheCouponDao.updateProductId(newProductId, oldProductId);
@@ -438,7 +453,7 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
 
     public void addProductData() {
         List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
-        heheProductList.forEach(heheProduct->{
+        heheProductList.forEach(heheProduct -> {
             Product cmProduct = productNewDao.get(heheProduct.getOldProductId().toString());
             if (null != cmProduct) {
                 String costPrice = cmProduct.getCostPrice();

+ 97 - 66
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -35,9 +35,9 @@ import java.util.*;
 public class ProductService extends CrudService<ProductDao, Product> {
 
     @Autowired
-    ProductDao productDao;
+    private ProductDao productDao;
     @Autowired
-    CmBrandDao cmBrandDao;
+    private CmBrandDao cmBrandDao;
     @Autowired
     private CmBigtypeDao cmBigtypeDao;
     @Autowired
@@ -47,7 +47,7 @@ public class ProductService extends CrudService<ProductDao, Product> {
     @Resource
     private ProductNewDao productNewDao;
     @Autowired
-    NewPageFloorDao newPageFloorDao;
+    private NewPageFloorDao newPageFloorDao;
 
     @Override
     public Product get(String id) {
@@ -346,7 +346,7 @@ public class ProductService extends CrudService<ProductDao, Product> {
         return productDao.queryProductDetailInfo(productID);
     }
 
-    public Product qualification(Integer productID){
+    public Product qualification(Integer productID) {
         return productDao.qualification(productID);
     }
 
@@ -374,10 +374,6 @@ public class ProductService extends CrudService<ProductDao, Product> {
 
     @Transactional(readOnly = false)
     public void saveProduct(Product product, ProductDetailInfo productDetailInfo) {
-        String detailInfo = product.getDetailInfo();
-        String orderInfo = product.getOrderInfo();
-        String serviceInfo = product.getServiceInfo();
-        List<ProductLadderPrice> ladderPriceList = product.getLadderPriceList();
         // 上传商品图片
         String qualificationImg = product.getQualificationImg();
         String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
@@ -395,36 +391,26 @@ public class ProductService extends CrudService<ProductDao, Product> {
             }
         }
         product.setQualificationImg(res);
-        if(product.getNewProductType()==1){
+        if (product.getNewProductType() == 1) {
             product.setShowFlag(1);
-        }else if(product.getNewProductType()==2){
+        } else if (product.getNewProductType() == 2) {
             product.setShowFlag(3);
         }
-        if(product.getVisibility()==null){
+        if (product.getVisibility() == null) {
             product.setVisibility("3");
         }
-//        if(StringUtils.isNotBlank(product.getSplitCode())&&"0".equals(product.getSplitCode())){
-//            product.setSplitCode(null);
-//        }
         if (null != product.getShopType() && 2 == product.getShopType()) {
             product.setValidFlag("2");
-            if(StringUtils.isNotBlank(product.getCostPrice())){
-                product.setSqlCostPrice(Double.valueOf(product.getCostPrice()));
-            }
-            if(StringUtils.isNotBlank(product.getTaxPoint())){
+            if (StringUtils.isNotBlank(product.getTaxPoint())) {
                 product.setSqlTaxPoint(Double.valueOf(product.getTaxPoint()));
             }
-            if(StringUtils.isNotBlank(product.getSupplierTaxPoint())){
+            if (StringUtils.isNotBlank(product.getSupplierTaxPoint())) {
                 product.setSqlSupplierTaxPoint(Double.valueOf(product.getSupplierTaxPoint()));
             }
-            if(StringUtils.isNotBlank(product.getCostProportional())){
-                product.setSqlCostProportional(Double.valueOf(product.getCostProportional()));
-            }
-
-
-logger.info("+++++++++++++++++++++++"+product);
             //保存商品信息
             productDao.insert(product);
+            //保存sku
+            addSkus(product);
             productDetailInfo.setProductID(product.getProductID());
             // 保存商品图片
             String image1 = product.getImage1();
@@ -436,12 +422,12 @@ logger.info("+++++++++++++++++++++++"+product);
             String image2 = product.getImage2();
             if (StringUtils.isNotEmpty(image2)) {
                 String imageUrl = getImageUrl(image2);
-                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+                addProductImage(imageUrl, "0", product.getProductID(), product.getShopID());
             }
             String image3 = product.getImage3();
             if (StringUtils.isNotEmpty(image3)) {
                 String imageUrl = getImageUrl(image3);
-                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+                addProductImage(imageUrl, "0", product.getProductID(), product.getShopID());
             }
             String image4 = product.getImage4();
             if (StringUtils.isNotEmpty(image4)) {
@@ -451,11 +437,12 @@ logger.info("+++++++++++++++++++++++"+product);
             String image5 = product.getImage5();
             if (StringUtils.isNotEmpty(image5)) {
                 String imageUrl = getImageUrl(image5);
-                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+                addProductImage(imageUrl, "0", product.getProductID(), product.getShopID());
             }
             productDao.updateMainImage(product);
-        }else{
+        } else {
             productDao.updateByPrimaryKeySelective(product);
+            updateSku(product);
         }
         ProductDetailInfo queryProductDetailInfo = productDao.queryProductDetailInfo(product.getProductID());
         if (queryProductDetailInfo != null) {
@@ -463,34 +450,62 @@ logger.info("+++++++++++++++++++++++"+product);
         } else {
             productDao.insertProductDetailInfo(productDetailInfo);
         }
-        User user = UserUtils.getUser();
-        if ("1".equals(product.getLadderPriceFlag())) {
-            for (int i = 0; i < ladderPriceList.size(); i++) {
-                Integer buyNum = ladderPriceList.get(i).getBuyNum();
-                Double buyPrice = ladderPriceList.get(i).getBuyPrice();
-                Integer ladderId = ladderPriceList.get(i).getId();
-                String delFlag = ladderPriceList.get(i).getDelFlag();
-                if ("0".equals(delFlag) && null != buyNum && null != buyPrice && !"".equals(buyPrice)) {
-                    ladderPriceList.get(i).setProductId(product.getProductID());
-                    ladderPriceList.get(i).setLadderNum(i + 1);
-                    ladderPriceList.get(i).setUpdateDate(new Date());
-                    ladderPriceList.get(i).setUpdateBy(user.getId());
-                    if (null != ladderId) {
-                        productDao.updateLadderPrice(ladderPriceList.get(i));
-                    } else {
-                        ladderPriceList.get(i).setCreateDate(new Date());
-                        ladderPriceList.get(i).setCreateBy(user.getId());
-                        ladderPriceList.get(i).setDelFlag("0");
-                        productDao.insertLadderPrice(ladderPriceList.get(i));
+    }
+
+    private void updateSku(Product product) {
+        List<CmSku> skuList = product.getSkuList();
+        if (null != skuList && skuList.size() > 0) {
+            productDao.deleteLadderPriceById(product.getProductID());
+            List<Integer> skuIds = new ArrayList<>();
+            skuList.forEach(s -> {
+                if (null != s.getPrice()) {
+                    if (null != s.getSkuId()) {
+                        skuIds.add(s.getSkuId());
                     }
-                } else {
-                    if (null != ladderId) {
-                        productDao.deleteLadderPriceById(ladderId);
+                    s.setProductId(product.getProductID());
+                    if (null != s.getSkuId()) {
+                        productDao.updateCmSku(s);
                     } else {
-                        break;
+                        productDao.insertSku(s);
+                        skuIds.add(s.getSkuId());
+                    }
+                    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));
+                            }
+                        }
                     }
                 }
-            }
+            });
+            productDao.deleteProductSkus(skuIds, product.getProductID());
+        }
+    }
+
+    public void addSkus(Product product) {
+        //保存sku
+        List<CmSku> skuList = product.getSkuList();
+        if (null != skuList && skuList.size() > 0) {
+            productDao.deleteLadderPriceById(product.getProductID());
+            skuList.forEach(s -> {
+                if (null != s.getPrice()) {
+                    s.productId(product.getProductID());
+                    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));
+                            }
+                        }
+                    }
+                }
+            });
         }
     }
 
@@ -572,22 +587,22 @@ logger.info("+++++++++++++++++++++++"+product);
     public Page<Product> newfindProductImage(Page<Product> page, Product product) {
         product.setPage(page);
         List<Product> productList = productDao.newfindProductImage(product);
-        int num=0;
+        int num = 0;
 
-        for (int i=0;i<productList.size();i++){
+        for (int i = 0; i < productList.size(); i++) {
             Date currentTime = new Date();
-                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                String dateString = formatter.format(currentTime);
+            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String dateString = formatter.format(currentTime);
             /**
              *如果有设置展示开始时间就当前时间判断,如果没有就用商品创建时间判断当前时间;
              */
-                if(productList.get(i).getShowTime()!=null){
-                    num=productList.get(i).getShowTime().compareTo(dateString);
-                }else if(productList.get(i).getAddTime()!=null) {
-                    num=productList.get(i).getAddTime().compareTo(dateString);
-                }
-            if(num<0){
-              product.setShowFlag(2);
+            if (productList.get(i).getShowTime() != null) {
+                num = productList.get(i).getShowTime().compareTo(dateString);
+            } else if (productList.get(i).getAddTime() != null) {
+                num = productList.get(i).getAddTime().compareTo(dateString);
+            }
+            if (num < 0) {
+                product.setShowFlag(2);
                 product.setRecommend(0);
                 product.setProductID(productList.get(i).getProductID());
                 newPageFloorDao.updatshowFlag(product);
@@ -599,9 +614,9 @@ logger.info("+++++++++++++++++++++++"+product);
         }
         page.setList(productList);
         return page;
-   }
+    }
 
-    public Product productList(Product product){
+    public Product productList(Product product) {
 
         return productDao.productList(product);
     }
@@ -621,4 +636,20 @@ logger.info("+++++++++++++++++++++++"+product);
     public List<CmSplitCode> getCodes(Integer shopId) {
         return productDao.findSplitCodesByShopId(shopId);
     }
+
+    public List<CmSku> findSkuList(Integer productID) {
+        List<CmSku> skus = productDao.findSkuList(productID);
+        skus.forEach(s -> {
+            s.ladderPriceList(productDao.findLadderPriceBySku(s.skuId()));
+        });
+        return skus;
+    }
+
+    public Product getBySku(String skuId) {
+        return productDao.getBySku(skuId);
+    }
+
+    public List<CmSku> findHeHeSku(Integer productId) {
+        return productDao.findHeHeSku(productId);
+    }
 }

+ 24 - 5
src/main/java/com/caimei/modules/product/web/CmPromotionController.java

@@ -1,5 +1,8 @@
 package com.caimei.modules.product.web;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.modules.bulkpurchase.entity.OrderProduct;
 import com.caimei.modules.bulkpurchase.entity.PurchaseProduct;
 import com.caimei.modules.cibe.entity.Shop;
 import com.caimei.modules.opensearch.CoreServiceUitls;
@@ -116,6 +119,21 @@ public class CmPromotionController extends BaseController {
         }
     }
 
+    @RequestMapping(value = "delPromotion")
+    @ResponseBody
+    public Map<String, Object> delPromotion(@RequestParam("id") String id,@RequestParam("skuId")Integer skuId, HttpServletRequest request) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            cmPromotionService.delPromotion(id,skuId);
+            map.put("success", "true");
+            map.put("msg", "删除成功");
+        } catch (Exception e) {
+            map.put("success", "false");
+            map.put("msg", "删除失败");
+        }
+        return map;
+    }
+
     /**
      * 新增/编辑表单回显
      */
@@ -167,16 +185,17 @@ public class CmPromotionController extends BaseController {
                 }
             }
             if (StringUtil.isNotBlank(cmPromotion.getGiftIds())) {
+                //设置页面传过来的勾选赠品skuId
                 if (cmPromotion.getGiftIds().contains(",")) {
                     String[] split = cmPromotion.getGiftIds().split(",");
-                    for (String giftId : split) {
-                        if (StringUtil.isNotBlank(giftId)) {
-                            Product product = productService.get(giftId);
+                    for (String skuId : split) {
+                        if (StringUtil.isNotBlank(skuId)) {
+                            Product product = productService.getBySku(skuId);
                             giftProducts.add(product);
                         }
                     }
                 } else {
-                    Product product = productService.get(cmPromotion.getGiftIds());
+                    Product product = productService.getBySku(cmPromotion.getGiftIds());
                     giftProducts.add(product);
                 }
             }
@@ -272,7 +291,7 @@ public class CmPromotionController extends BaseController {
                         ListIterator<Product> giftListIterator = giftProduct.listIterator();
                         while (giftListIterator.hasNext()) {
                             Product next = giftListIterator.next();
-                            if (delGiftIdList.contains(next.getProductID().toString())) {
+                            if (delGiftIdList.contains(next.getSkuId().toString())) {
                                 giftListIterator.remove();
                             }
                         }

+ 30 - 17
src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java

@@ -8,9 +8,11 @@ import com.caimei.modules.cibe.entity.Shop;
 import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.modules.oss.utils.OSSUtils;
+import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.dao.ProductNewDao;
 import com.caimei.modules.product.entity.BigType;
 import com.caimei.modules.product.entity.CmSecondHandDetail;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.product.service.CmSecondHandDetailService;
 import com.caimei.modules.product.service.CmSecondHandTransactionService;
@@ -66,6 +68,8 @@ public class CmSecondHandDetailController extends BaseController {
     private RedisService redisService;
     @Resource
     private GenerateUtils generateUtils;
+    @Resource
+    private ProductDao productDao;
 
     @ModelAttribute
     public CmSecondHandDetail get(@RequestParam(required = false) String id) {
@@ -353,21 +357,6 @@ public class CmSecondHandDetailController extends BaseController {
         product.setName(cmSecondHandDetail.getName());
         product.setAliasName(cmSecondHandDetail.getName());
         product.setVisibility(cmSecondHandDetail.getVisibility());
-        String normalPrice = cmSecondHandDetail.getNormalPrice();
-        if (StringUtils.isNotEmpty(normalPrice)) {
-            product.setNormalPrice(Double.parseDouble(normalPrice));
-        }
-        product.setPrice(cmSecondHandDetail.getPrice());
-        product.setCostCheckFlag(cmSecondHandDetail.getCostCheckFlag());
-        if ("1".equals(product.getCostCheckFlag())) {
-            product.setCostPrice(String.valueOf(cmSecondHandDetail.getCostPrice()));
-        } else {
-            product.setCostProportional(String.valueOf(cmSecondHandDetail.getCostProportional()));
-        }
-        Integer stock = cmSecondHandDetail.getStock();
-        if (null != stock && stock > 0) {
-            product.setStock(String.valueOf(stock));
-        }
         product.setHasSkuFlag("1");
         product.setUpdateTime(dateStr);
         product.setSellNumber(String.valueOf(cmSecondHandDetail.getStock()));
@@ -382,7 +371,6 @@ public class CmSecondHandDetailController extends BaseController {
 
         }
         product.setSplitCode(cmSecondHandDetail.getSplitCode());
-        product.setLadderPriceFlag("0");
         product.setSortIndex("1");
         product.setFeaturedFlag("0");
         product.setByFlag("0");
@@ -415,7 +403,32 @@ public class CmSecondHandDetailController extends BaseController {
             product.setMainImage(imageUrl);
         }
         cmSecondHandDetailService.saveProduct(product);
-        String payType = cmSecondHandDetail.getPayType();
+        //保存sku
+        CmSku cmSku = new CmSku();
+        cmSku.setProductId(product.getProductID());
+        cmSku.setLadderPriceFlag(0);
+        Integer stock = cmSecondHandDetail.getStock();
+        if (null != stock && stock > 0) {
+            cmSku.setStock(String.valueOf(stock));
+        }
+        String normalPrice = cmSecondHandDetail.getNormalPrice();
+        if (StringUtils.isNotEmpty(normalPrice)) {
+            cmSku.setNormalPrice(Double.parseDouble(normalPrice));
+        }
+        cmSku.setPrice(cmSecondHandDetail.getPrice());
+        cmSku.setCostCheckFlag(Integer.valueOf(cmSecondHandDetail.getCostCheckFlag()));
+        if ("1".equals(cmSecondHandDetail.getCostCheckFlag())) {
+            cmSku.setCostPrice(cmSecondHandDetail.getCostPrice());
+        } else {
+            cmSku.setCostProportional(cmSecondHandDetail.getCostProportional());
+        }
+        Integer skuId=productDao.findSkuId(product.getProductID());
+        if(null!=skuId){
+            cmSku.setSkuId(skuId);
+            productDao.updateCmSku(cmSku);
+        }else{
+            productDao.insertSku(cmSku);
+        }
         cmSecondHandDetail.setProductID(product.getProductID());
         // 地址优化
         Integer townId = cmSecondHandDetail.getTownId();

+ 62 - 64
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.product.web;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.dfs.image.beens.ImageUploadInfo;
@@ -119,7 +120,7 @@ public class ProductNewController extends BaseController {
     @RequiresPermissions("product:product:view")
     @RequestMapping(value = {"list", ""})
     public String list(Product product, HttpServletRequest request, HttpServletResponse response, Model model) {
-      Product pro=product;
+        Product pro = product;
         String id = product.getId();
         if (StringUtils.isEmpty(id)) {
             String shopName = product.getSearchShopName();
@@ -156,8 +157,8 @@ public class ProductNewController extends BaseController {
                 product.setTinyTypeID(searchTinyTypeID);
             }
             if (StringUtils.isNotEmpty(searchValidFlag) && !"on".equals(searchValidFlag)) {
-                if(searchValidFlag.contains("7")){
-                    searchValidFlag=searchValidFlag.replace("7","10");
+                if (searchValidFlag.contains("7")) {
+                    searchValidFlag = searchValidFlag.replace("7", "10");
                 }
                 String[] split = searchValidFlag.split(",");
                 product.setValidFlagString(split);
@@ -326,16 +327,6 @@ public class ProductNewController extends BaseController {
     public String editProduct(Product product, Model model) {
         if (null != product.getProductID()) {
             ProductDetailInfo productDetailInfo = productService.getProductDetailInfo(product.getProductID());
-//            Product produ=productService.qualification(product.getProductID());
-//            if(null != produ){
-//                product.setQualificationLink(produ.getQualificationLink());
-//                product.setQualificationNo(produ.getQualificationNo());
-//                product.setQualificationTime(produ.getQualificationTime());
-//                product.setProductName(produ.getProductName());
-//            }
-
-
-            List<ProductLadderPrice> ladderPriceList = productService.findLadderPrice(product.getProductID());
             if (null != productDetailInfo) {
                 product.setDetailInfo(productDetailInfo.getDetailInfo());
                 product.setServiceInfo(productDetailInfo.getServiceInfo());
@@ -343,8 +334,8 @@ public class ProductNewController extends BaseController {
                 product.setCommonDetailInfo(productDetailInfo.getCommonDetailInfo());
             }
             product.setProductDescribe(productService.findProductDescribe(product.getProductID()));
-            product.setLadderPriceList(ladderPriceList);
             product.setProductDetail(productService.findProductDetail(product.getProductID()));
+            product.setSkuList(productService.findSkuList(product.getProductID()));
         } else {
             //发布特殊商品给默认值
             product.setIncludedTax("2");
@@ -405,20 +396,22 @@ public class ProductNewController extends BaseController {
         //先从reids中获取keyword值,不存在时在查询数据库
         List<SearchFrequencyVo> searchFrequencyVos=new ArrayList<>();
         if(redisService.getExpireTime("keyword")>0){
-             searchFrequencyVos= JSONArray.parseArray(redisService.get("keyword").toString(),SearchFrequencyVo.class);
+            searchFrequencyVos= JSONArray.parseArray(redisService.get("keyword").toString(),SearchFrequencyVo.class);
         }else{
-             searchFrequencyVos = keywordFrequencyDao.getKeywordList();
+            searchFrequencyVos = keywordFrequencyDao.getKeywordList();
         }
         model.addAttribute("splitCodeList",splitCodeList);
+        model.addAttribute("splitCodeList", splitCodeList);
         model.addAttribute("combinationList", combinationList);
         model.addAttribute("brandList", brandList);
         model.addAttribute("shopList", shopList);
         model.addAttribute("classify", classify);
         model.addAttribute("provinceList", provinceList);
         model.addAttribute("product", product);
-        model.addAttribute("SearchFrequencyVo",searchFrequencyVos);
+        model.addAttribute("productJson", JSON.toJSONString(product));
         return "modules/product-new/productEdit";
     }
+
     @RequestMapping(value = "productNewSave")
     public String productNewSave(Product product, RedirectAttributes redirectAttributes) {
         // 组合搜索关键词
@@ -524,10 +517,14 @@ public class ProductNewController extends BaseController {
             redirectAttributes.addAttribute("searchPreferredFlag", product.getSearchPreferredFlag());
             redirectAttributes.addAttribute("searchProductCategory", product.getSearchProductCategory());
         }
-        // 有数据变动时需要清除缓存
-        cleanRedisCache();
-        // 更新索引
-        coreServiceUitls.updateProductIndex(product.getProductID());
+        try {
+            // 有数据变动时需要清除缓存
+            cleanRedisCache();
+            // 更新索引
+            coreServiceUitls.updateProductIndex(product.getProductID());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return "redirect:" + Global.getAdminPath() + "/product/new/list/";
     }
 
@@ -879,7 +876,7 @@ public class ProductNewController extends BaseController {
 
     @RequestMapping("auditProduct")
     @ResponseBody
-    public Map<String, Object> auditProduct(String validFlag,Integer newvalidFlag,String showtime, Integer productID, String remarks) {
+    public Map<String, Object> auditProduct(String validFlag, Integer newvalidFlag, String showtime, Integer productID, String remarks) {
         Map<String, Object> map = Maps.newLinkedHashMap();
         try {
             if (StringUtils.isBlank(validFlag) || null == productID) {
@@ -912,48 +909,48 @@ public class ProductNewController extends BaseController {
                 }
             }
 
-            productNewService.auditProduct(validFlag,newvalidFlag,showtime, beforeValidFlag, productID);
+            productNewService.auditProduct(validFlag, newvalidFlag, showtime, beforeValidFlag, productID);
             SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             String current = dateFormat.format(new Date());
             MessageCenter messageCenter = new MessageCenter();
-           Integer shopid= messageCenterDao.shopID(productID);
-           if("8".equals(validFlag)){
-               messageCenter.setShopId(shopid);
-               messageCenter.setClubId(null);
-               messageCenter.setUserType(2);
-               messageCenter.setMessageType(2);
-               messageCenter.setShopMessType(3);
-               messageCenter.setContent(null);
-               messageCenter.setProductId(productID);
-               messageCenter.setTime(current);
-               messageCenterDao.addMessageCenter(messageCenter);
-               Product pro=new Product();
-               pro=productNewDao.validIList(productID);
-                   String content = "【采美365】您有商品未通过审核,暂时不能上架采美商城。请登录采美平台修改商品信息后重新发布。";
-                   boolean sendSms = newOrderService.getSendSms(9, pro.getMobile(), content);
-                   if(sendSms){
-                       logger.info(">>>>>>>发送成功");
-                   }
-               try {
-                   logger.info("********供应商审核失败微信公众号推送********");
-                   String unionid = newShopOrderDao.UnionId(pro.getUserId());
-                   logger.info("userid>>>>>>>>>>>>>>>" + pro.getUserId() + "unionid》》》》》》》》》》" + unionid);
-                   List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+            Integer shopid = messageCenterDao.shopID(productID);
+            if ("8".equals(validFlag)) {
+                messageCenter.setShopId(shopid);
+                messageCenter.setClubId(null);
+                messageCenter.setUserType(2);
+                messageCenter.setMessageType(2);
+                messageCenter.setShopMessType(3);
+                messageCenter.setContent(null);
+                messageCenter.setProductId(productID);
+                messageCenter.setTime(current);
+                messageCenterDao.addMessageCenter(messageCenter);
+                Product pro = new Product();
+                pro = productNewDao.validIList(productID);
+                String content = "【采美365】您有商品未通过审核,暂时不能上架采美商城。请登录采美平台修改商品信息后重新发布。";
+                boolean sendSms = newOrderService.getSendSms(9, pro.getMobile(), content);
+                if (sendSms) {
+                    logger.info(">>>>>>>发送成功");
+                }
+                try {
+                    logger.info("********供应商审核失败微信公众号推送********");
+                    String unionid = newShopOrderDao.UnionId(pro.getUserId());
+                    logger.info("userid>>>>>>>>>>>>>>>" + pro.getUserId() + "unionid》》》》》》》》》》" + unionid);
+                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
 
-                   String accessToken = weChatService.getAccessToken();
-                   Date date=new Date();
-                   String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                    String accessToken = weChatService.getAccessToken();
+                    Date date = new Date();
+                    String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
 
-                   String pagePath = "/pages/login/apply-supplier";
-                   for (String openid : openidList) {
-                       weChatService.sendTemp(accessToken, openid,pro.getName(),auditTime, pagePath);
-                   }
-               } catch (Exception e) {
-                   logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
-               }
-           }
-            if(newvalidFlag!=null){
-                if(newvalidFlag ==2) {
+                    String pagePath = "/pages/login/apply-supplier";
+                    for (String openid : openidList) {
+                        weChatService.sendTemp(accessToken, openid, pro.getName(), auditTime, pagePath);
+                    }
+                } catch (Exception e) {
+                    logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
+                }
+            }
+            if (newvalidFlag != null) {
+                if (newvalidFlag == 2) {
                     messageCenter.setShopId(shopid);
                     messageCenter.setClubId(null);
                     messageCenter.setUserType(2);
@@ -1001,7 +998,7 @@ public class ProductNewController extends BaseController {
             if (null == validFlag || "".equals(validFlag) || null == productID) {
                 throw new Exception("参数错误!");
             }
-            productNewService.auditProduct(validFlag,null,null,null, productID);
+            productNewService.auditProduct(validFlag, null, null, null, productID);
             map.put("success", true);
             map.put("msg", "操作成功");
             // 更新二手商品上架信息
@@ -1062,7 +1059,7 @@ public class ProductNewController extends BaseController {
 
             }
             // 更新商品库上下架状态
-            productNewService.auditProduct(validFlag,null, null,null, productId);
+            productNewService.auditProduct(validFlag, null, null, null, productId);
             map.put("success", true);
             cleanRedisCache();
         } catch (Exception e) {
@@ -1196,18 +1193,19 @@ public class ProductNewController extends BaseController {
      */
     @RequestMapping("/hehe/move")
     @ResponseBody
-    public String moveHeheProducts(){
+    public String moveHeheProducts() {
         productNewService.moveHeheProducts();
         return "success";
     }
 
     /**
      * 补充数据
+     *
      * @return
      */
     @RequestMapping("/hehe/data/add")
     @ResponseBody
-    public String addProductData(){
+    public String addProductData() {
         productNewService.addProductData();
         return "success";
     }
@@ -1217,7 +1215,7 @@ public class ProductNewController extends BaseController {
      */
     @RequestMapping("/hehe/back")
     @ResponseBody
-    public String backHeheProducts(){
+    public String backHeheProducts() {
         productNewService.backHeheProducts();
         return "success";
     }

+ 88 - 65
src/main/java/com/caimei/modules/svip/service/CmSvipProductService.java

@@ -3,6 +3,8 @@ package com.caimei.modules.svip.service;
 import java.math.BigDecimal;
 import java.util.List;
 
+import com.caimei.modules.product.dao.ProductDao;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.svip.entity.CmSvipProductAdsImage;
 import com.caimei.utils.AppUtils;
@@ -20,81 +22,102 @@ import javax.annotation.Resource;
 
 /**
  * 超级会员优惠商品Service
+ *
  * @author Aslee
  * @version 2021-09-23
  */
 @Service
 @Transactional(readOnly = true)
 public class CmSvipProductService extends CrudService<CmSvipProductDao, CmSvipProduct> {
-	@Resource
-	private CmSvipProductDao cmSvipProductDao;
+    @Resource
+    private CmSvipProductDao cmSvipProductDao;
+    @Resource
+    private ProductDao productDao;
 
-	public CmSvipProduct get(String id) {
-		return super.get(id);
-	}
-	
-	public List<CmSvipProduct> findList(CmSvipProduct cmSvipProduct) {
-		return super.findList(cmSvipProduct);
-	}
-	
-	public Page<CmSvipProduct> findPage(Page<CmSvipProduct> page, CmSvipProduct cmSvipProduct) {
-		Page<CmSvipProduct> page1 = super.findPage(page, cmSvipProduct);
-		List<CmSvipProduct> list = page1.getList();
-		String wwwServer = Global.getConfig("wwwServer");
-		list.forEach(product->{
-			if (StringUtil.isNotBlank(product.getProductImage())) {
-				product.setProductImage(AppUtils.getImageURL("product", product.getProductImage(), 0, wwwServer));
-			}
-		});
-		return page1;
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(CmSvipProduct cmSvipProduct) {
-		if (cmSvipProduct.getIsNewRecord()) {
-			Integer priceType = null == cmSvipProduct.getDiscount() ? 2 : 1;
-			cmSvipProduct.setPriceType(priceType);
-			cmSvipProduct.setSort(1);
-		}
-		super.save(cmSvipProduct);
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(CmSvipProduct cmSvipProduct) {
-		super.delete(cmSvipProduct);
-	}
+    public CmSvipProduct get(String id) {
+        CmSvipProduct cmSvipProduct = super.get(id);
+        CmSku sku = productDao.findSku(cmSvipProduct.getProductId());
+        cmSvipProduct.setPrice(BigDecimal.valueOf(sku.getPrice()));
+        cmSvipProduct.setCostCheckFlag(sku.getCostCheckFlag().toString());
+        if (1 == sku.getCostCheckFlag()) {
+            cmSvipProduct.setCostPrice(sku.getCostPrice().toString());
+        } else {
+            cmSvipProduct.setCostProportional(sku.getCostProportional().toString());
+        }
+        return cmSvipProduct;
+    }
 
+    public List<CmSvipProduct> findList(CmSvipProduct cmSvipProduct) {
+        List<CmSvipProduct> list = super.findList(cmSvipProduct);
+        list.forEach(product -> {
+            CmSku sku = productDao.findSku(product.getProductId());
+            product.setPrice(BigDecimal.valueOf(sku.getPrice()));
+        });
+        return list;
+    }
 
-	@Transactional(readOnly = false)
-	public Page<Product> findProductPage(Page<Product> productPage, Product product) {
-		List<Integer> ids = cmSvipProductDao.findSvipProductIds();
-		product.setIds(ids);
-		product.setPage(productPage);
-		List<Product> productList = cmSvipProductDao.findAllProduct(product);
-		String wwwServer = Global.getConfig("wwwServer");
-		productList.forEach(item -> {
-			if (StringUtil.isNotBlank(item.getMainImage())) {
-				item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
-			}
-			if (ids.contains(item.getProductID())) {
-				item.setExistsFlag("1");
-			}
-		});
-		productPage.setList(productList);
-		return productPage;
-	}
+    public Page<CmSvipProduct> findPage(Page<CmSvipProduct> page, CmSvipProduct cmSvipProduct) {
+        Page<CmSvipProduct> page1 = super.findPage(page, cmSvipProduct);
+        List<CmSvipProduct> list = page1.getList();
+        String wwwServer = Global.getConfig("wwwServer");
+        list.forEach(product -> {
+            CmSku sku = productDao.findSku(product.getProductId());
+            product.setPrice(BigDecimal.valueOf(sku.getPrice()));
+            if (StringUtil.isNotBlank(product.getProductImage())) {
+                product.setProductImage(AppUtils.getImageURL("product", product.getProductImage(), 0, wwwServer));
+            }
+        });
+        return page1;
+    }
 
-	@Transactional(readOnly = false)
-	public void saveSort(String sort, String id) {
-		cmSvipProductDao.saveSort(sort, id);
-	}
+    @Transactional(readOnly = false)
+    public void save(CmSvipProduct cmSvipProduct) {
+        if (cmSvipProduct.getIsNewRecord()) {
+            Integer priceType = null == cmSvipProduct.getDiscount() ? 2 : 1;
+            cmSvipProduct.setPriceType(priceType);
+            cmSvipProduct.setSort(1);
+        }
+        super.save(cmSvipProduct);
+    }
 
-	public CmSvipProductAdsImage getAdsImage() {
-		return cmSvipProductDao.getAdsImage();
-	}
+    @Transactional(readOnly = false)
+    public void delete(CmSvipProduct cmSvipProduct) {
+        super.delete(cmSvipProduct);
+    }
 
-	@Transactional(readOnly = false)
-	public void saveAdsImage(CmSvipProductAdsImage adsImage) {
-		cmSvipProductDao.saveAdsImage(adsImage);
-	}
+
+    @Transactional(readOnly = false)
+    public Page<Product> findProductPage(Page<Product> productPage, Product product) {
+        List<Integer> ids = cmSvipProductDao.findSvipProductIds();
+        product.setIds(ids);
+        product.setPage(productPage);
+        List<Product> productList = cmSvipProductDao.findAllProduct(product);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            CmSku sku = productDao.findSku(item.getProductID());
+            item.setPrice(sku.getPrice());
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+            if (ids.contains(item.getProductID())) {
+                item.setExistsFlag("1");
+            }
+        });
+        productPage.setList(productList);
+        return productPage;
+    }
+
+    @Transactional(readOnly = false)
+    public void saveSort(String sort, String id) {
+        cmSvipProductDao.saveSort(sort, id);
+    }
+
+    public CmSvipProductAdsImage getAdsImage() {
+        return cmSvipProductDao.getAdsImage();
+    }
+
+    @Transactional(readOnly = false)
+    public void saveAdsImage(CmSvipProductAdsImage adsImage) {
+        cmSvipProductDao.saveAdsImage(adsImage);
+    }
 }

+ 3 - 2
src/main/resources/config/dev/caimei.properties

@@ -40,9 +40,10 @@ jdbc.pool.maxActive=20
 jdbc.testSql=SELECT 'x' FROM DUAL
 
 #redis settings
-redis.host=47.119.112.46
+redis.keyPrefix=caimei-manager
+redis.host=192.168.2.100
 redis.port=6379
-redis.pass=6#xsI%b4o@5c3RoE
+redis.pass=123456
 redis.timeout=100000
 #\u6700\u5927\u8FDE\u63A5\u6570
 redis.pool.maxActive=300

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

@@ -2,15 +2,15 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.bulkpurchase.dao.PurchaseProductDao">
 
-	<resultMap id="resultShop" type="PurchaseProduct">
-		<result column="productID" property="productId"/>
-		<result column="name" property="purchaseProductName"/>
-		<result column="shopName" property="shopName"/>
-		<result column="shopID" property="shopId"/>
-		<result column="price" property="price"/>
-	</resultMap>
-	<sql id="purchaseProductColumns">
-		a.id AS "id",
+    <resultMap id="resultShop" type="PurchaseProduct">
+        <result column="productID" property="productId"/>
+        <result column="name" property="purchaseProductName"/>
+        <result column="shopName" property="shopName"/>
+        <result column="shopID" property="shopId"/>
+        <result column="price" property="price"/>
+    </resultMap>
+    <sql id="purchaseProductColumns">
+        a.id AS "id",
 		a.contractId AS "contractId",
 		a.productId AS "productId",
 		a.discount AS "discount",
@@ -22,193 +22,193 @@
 		a.shopFee AS "shopFee",
 		a.otherFee AS "otherFee",
 		a.cmFee AS "cmFee"
-	</sql>
+    </sql>
 
 
-	<sql id="purchaseProductJoins">
-	</sql>
+    <sql id="purchaseProductJoins">
+    </sql>
 
 
+    <select id="get" resultType="PurchaseProduct">
+        SELECT
+        <include refid="purchaseProductColumns"/>
+        FROM bp_product a
+        <include refid="purchaseProductJoins"/>
+        WHERE a.id = #{id}
+    </select>
+    <select id="findProductList" resultType="PurchaseProduct">
 
-	<select id="get" resultType="PurchaseProduct">
-		SELECT
-			<include refid="purchaseProductColumns"/>
-		FROM bp_product a
-		<include refid="purchaseProductJoins"/>
-		WHERE a.id = #{id}
-	</select>
-	<select id="findProductList" resultType="PurchaseProduct">
+    </select>
 
-	</select>
+    <select id="findList" resultType="PurchaseProduct">
+        SELECT b.name shopName ,b.`shopID` shopId,a.name purchaseProductName,
+        a.`productID` productId,a.productCode productNo,a.mainImage image,a.includedTax AS includedTax,
+        a.invoiceType AS invoiceType, a.taxPoint AS taxRate, a.supplierTaxPoint AS supplierTaxRate, a.commodityType,
+        if(csp.id is not null and csu.id is not null,1,0) as svipPriceFlag,
+        csp.priceType as svipPriceType,csp.discount as svipDiscount,
+        csp.discountPrice as svipDiscountPrice
+        FROM product a LEFT JOIN shop b ON b.shopID=a.shopID
+        left join cm_svip_product csp on a.productID = csp.productId
+        left join cm_svip_user csu on csu.userId = #{userId} and csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
+        <where>
+            <if test="purchaseProductName != null and purchaseProductName != ''">
+                AND a.name LIKE concat('%',#{purchaseProductName},'%')
+            </if>
+            <if test="productId != null and productId != ''">
+                AND a.productID = #{productId}
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND b.name like concat('%',#{shopName},'%')
+            </if>
+            and (a.validFlag=2 or a.validFlag = 9)
+            AND a.productID != 999
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+    <select id="findAllList" resultType="PurchaseProduct">
+        SELECT
+        <include refid="purchaseProductColumns"/>
+        FROM bp_product a
+        <include refid="purchaseProductJoins"/>
+        <where>
+            a.delFlag = 0
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
 
-	<select id="findList" resultType="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 AS normalPrice
-		,a.ladderPriceFlag as ladderPriceFlag
-		,a.includedTax AS includedTax, a.invoiceType AS invoiceType, a.taxPoint AS taxRate, a.supplierTaxPoint AS supplierTaxRate,
-		a.minBuyNumber AS num, a.commodityType,
-	    if(csp.id is not null and csu.id is not null,1,0) as svipPriceFlag,
-	    csp.priceType as svipPriceType,csp.discount as svipDiscount,
-	    csp.discountPrice as svipDiscountPrice
-		FROM product a LEFT JOIN shop b ON b.shopID=a.shopID
-	    left join cm_svip_product csp on a.productID = csp.productId
-	    left join cm_svip_user csu on csu.userId = #{userId} and csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
-		<where>
-			<if test="purchaseProductName != null and purchaseProductName != ''">
-				AND a.name LIKE concat('%',#{purchaseProductName},'%')
-			</if>
-			<if test="productId != null and productId != ''">
-				AND a.productID = #{productId}
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND b.name  like concat('%',#{shopName},'%')
-			</if>
-				and (a.validFlag=2 or a.validFlag = 9)
-			    AND a.productID != 999
-			    and a.productCategory  = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findAllList" resultType="PurchaseProduct">
-		SELECT
-			<include refid="purchaseProductColumns"/>
-		FROM bp_product a
-		<include refid="purchaseProductJoins"/>
-		<where>
-			a.delFlag = 0
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
+    <insert id="insert" parameterType="PurchaseProduct" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO bp_product(id,
+                               contractId,
+                               productId,
+                               shopId,
+                               discount,
+                               discountPrice,
+                               taxRate,
+                               addedValueTax,
+                               stipulateFlag,
+                               delFlag,
+                               shopFee,
+                               otherFee,
+                               cmFee)
+        VALUES (#{id},
+                #{contractId},
+                #{productId},
+                #{shopId},
+                #{discount},
+                #{discountPrice},
+                #{taxRate},
+                #{addedValueTax},
+                #{stipulateFlag},
+                #{delFlag},
+                #{shopFee},
+                #{otherFee},
+                #{cmFee})
+    </insert>
+    <select id="getPurchaseProductByCtId" resultMap="resultShop">
+        SELECT a.*, b.name shopName, c.name, c.price
+        FROM bp_product a
+                 LEFT JOIN shop b ON a.shopId = b.`shopID`
+                 JOIN product c ON a.productId = c.productid
+        WHERE a.`contractId` = #{contractId}
+          AND a.delFlag = 0
+          and c.productCategory = 1
+    </select>
+    <update id="update">
+        UPDATE bp_product
+        SET contractId    = #{contractId},
+            productId     = #{productId},
+            shopId        = #{shopId},
+            discount      = #{discount},
+            discountPrice = #{discountPrice},
+            taxRate       = #{taxRate},
+            addedValueTax = #{addedValueTax},
+            stipulateFlag = #{stipulateFlag},
+            delFlag       = #{delFlag},
+            shopFee       = #{shopFee},
+            otherFee      = #{otherFee},
+            cmFee         = #{cmFee}
+        WHERE id = #{id}
+    </update>
 
-	<insert id="insert" parameterType="PurchaseProduct"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO bp_product(
-			id,
-			contractId,
-			productId,
-			shopId,
-			discount,
-			discountPrice,
-			taxRate,
-			addedValueTax,
-			stipulateFlag,
-			delFlag,
-			shopFee,
-			otherFee,
-			cmFee
-		) VALUES (
-			#{id},
-			#{contractId},
-			#{productId},
-			#{shopId},
-			#{discount},
-			#{discountPrice},
-			#{taxRate},
-			#{addedValueTax},
-			#{stipulateFlag},
-			#{delFlag},
-			#{shopFee},
-			#{otherFee},
-			#{cmFee}
-		)
-	</insert>
-	<select id="getPurchaseProductByCtId" resultMap="resultShop">
-	SELECT a.* ,b.name shopName , c.name ,c.price FROM bp_product a LEFT JOIN shop b ON a.shopId=b.`shopID`  JOIN product c ON a.productId =c.productid
-  WHERE a.`contractId` =#{contractId}
-  AND a.delFlag = 0
-  and c.productCategory  = 1
-	</select>
-	<update id="update">
-		UPDATE bp_product SET
-			contractId = #{contractId},
-			productId = #{productId},
-			shopId = #{shopId},
-			discount = #{discount},
-			discountPrice = #{discountPrice},
-			taxRate = #{taxRate},
-			addedValueTax = #{addedValueTax},
-			stipulateFlag = #{stipulateFlag},
-			delFlag = #{delFlag},
-			shopFee = #{shopFee},
-			otherFee = #{otherFee},
-			cmFee = #{cmFee}
-		WHERE id = #{id}
-	</update>
-
-	<delete id="delete">
-		DELETE FROM bp_product
-		WHERE id = #{id}
-	</delete>
-	<select id="findCount" resultType="Integer">
-		SELECT count(1) FROM `bp_product` where contractId = #{contractId} 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
-		,a.includedTax,a.invoiceType
-		FROM product a LEFT JOIN shop b ON b.shopID=a.shopID
-		left join cm_second_hand_detail cshd on cshd.productID = a.productID
-		<where>
-			<if test="purchaseProductName != null and purchaseProductName != ''">
-				AND a.name LIKE concat('%',#{purchaseProductName},'%')
-			</if>
-			<if test="productId != null and productId != ''">
-				AND a.productID = #{productId}
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND b.name  like concat('%',#{shopName},'%')是否含税
-			</if>
-				and a.validFlag=2
-			    AND a.productID != 999
-			    and a.productCategory  = 2
-			    and cshd.sold != 1
-		</where>
-<!--		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>-->
-	</select>
-	<select id="findLadderPriceList" resultType="com.caimei.po.ProductLadderPrice">
-		SELECT *
-		FROM product_ladder_price
-		WHERE
-		productId = #{productId}
-		AND buyNum is NOT null
-		AND buyPrice is NOT null
-		AND delFlag = 0
-		ORDER BY ladderNum ASC
-	</select>
-	<select id="checkSvipProduct" resultType="java.lang.Integer">
-		select if(csp.id is not null and csu.id is not null, 1, 0) as svipPriceFlag
-		from cm_svip_product csp
-				 left join cm_svip_user csu
-						   on csu.userId = #{userId} and csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
-		where csp.productId = #{productId};
-	</select>
+    <delete id="delete">
+        DELETE
+        FROM bp_product
+        WHERE id = #{id}
+    </delete>
+    <select id="findCount" resultType="Integer">
+        SELECT count(1)
+        FROM `bp_product`
+        where contractId = #{contractId}
+          AND delFlag = 0
+    </select>
+    <select id="findSencondProductPage" resultType="com.caimei.modules.bulkpurchase.entity.PurchaseProduct">
+        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 != ''">
+                AND a.name LIKE concat('%',#{purchaseProductName},'%')
+            </if>
+            <if test="productId != null and productId != ''">
+                AND a.productID = #{productId}
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND b.name like concat('%',#{shopName},'%')是否含税
+            </if>
+            and a.validFlag=2
+            AND a.productID != 999
+            and a.productCategory = 2
+            and cshd.sold != 1
+        </where>
+        <!--		<choose>
+                    <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                        ORDER BY ${page.orderBy}
+                    </when>
+                    <otherwise>
+                    </otherwise>
+                </choose>-->
+    </select>
+    <select id="findLadderPriceList" resultType="com.caimei.po.ProductLadderPrice">
+        SELECT *
+        FROM product_ladder_price
+        WHERE productId = #{productId}
+          AND buyNum is NOT null
+          AND buyPrice is NOT null
+          AND delFlag = 0
+        ORDER BY ladderNum ASC
+    </select>
+    <select id="checkSvipProduct" resultType="java.lang.Integer">
+        select if(csp.id is not null and csu.id is not null, 1, 0) as svipPriceFlag
+        from cm_svip_product csp
+                 left join cm_svip_user csu
+                           on csu.userId = #{userId} and csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
+        where csp.productId = #{productId};
+    </select>
     <select id="getSvipProduct" resultType="com.caimei.modules.svip.entity.CmSvipProduct">
-		select csp.priceType,
-			   if(csp.id is not null and csu.id is not null, 1, 0) as svipPriceFlag
-		from cm_svip_product csp
-				 left join cm_svip_user csu
-						   on csu.userId = #{userId} and csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
-		where csp.productId = #{productId};
+        select csp.priceType,
+               if(csp.id is not null and csu.id is not null, 1, 0) as svipPriceFlag
+        from cm_svip_product csp
+                 left join cm_svip_user csu
+                           on csu.userId = #{userId} and csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
+        where csp.productId = #{productId};
 
-	</select>
+    </select>
 </mapper>

+ 201 - 166
src/main/resources/mappings/modules/hehe/CmHeheActivityProductMapper.xml

@@ -1,181 +1,216 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.hehe.dao.CmHeheActivityProductDao">
-    
-	<sql id="cmHeheActivityProductColumns">
-		a.id AS "id",
+
+    <sql id="cmHeheActivityProductColumns">
+        a.id AS "id",
 		a.activityId AS "activityId",
 		a.productId AS "productId",
 		a.addTime AS "addTime",
 		a.delFlag AS "delFlag",
-		chp.price AS "price",
 		p.name AS "name",
 		p.mainImage AS "mainImage",
-		p.unit AS "unit",
 		s.name AS "shopName"
-	</sql>
-	
-	<sql id="cmHeheActivityProductJoins">
-		LEFT JOIN cm_hehe_product chp ON chp.productId = a.productID
+    </sql>
+
+    <sql id="cmHeheActivityProductJoins">
+        LEFT JOIN cm_hehe_product chp ON chp.productId = a.productID
 		LEFT JOIN product p ON a.productId = p.productID
 		LEFT JOIN shop s ON s.shopID = p.shopID
-	</sql>
-    
-	<select id="get" resultType="CmHeheActivityProduct">
-		SELECT 
-			<include refid="cmHeheActivityProductColumns"/>
-		FROM cm_hehe_activity_product a
-		<include refid="cmHeheActivityProductJoins"/>
-		WHERE a.id = #{id}
-	</select>
-	
-	<select id="findList" resultType="CmHeheActivityProduct">
-		SELECT 
-			<include refid="cmHeheActivityProductColumns"/>
-		FROM cm_hehe_activity_product a
-		<include refid="cmHeheActivityProductJoins"/>
-		<where>
-			a.delFlag = 0
-			AND a.activityId = #{activityId}
-			and chp.id is not null
-			<if test="name != null and name != ''">
-				AND p.name LIKE CONCAT('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE CONCAT('%',#{shopName},'%')
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.addTime DESC
-			</otherwise>
-		</choose>
-	</select>
-	
-	<select id="findAllList" resultType="CmHeheActivityProduct">
-		SELECT 
-			<include refid="cmHeheActivityProductColumns"/>
-		FROM cm_hehe_activity_product a
-		<include refid="cmHeheActivityProductJoins"/>
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	
-	<insert id="insert" parameterType="CmHeheActivityProduct"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO cm_hehe_activity_product(
-			activityId,
-			productId,
-			addTime,
-			delFlag
-		) VALUES (
-			#{activityId},
-			#{productId},
-			NOW(),
-			0
-		)
-	</insert>
-	
-	<update id="update">
-		UPDATE cm_hehe_activity_product SET 	
-			activityId = #{activityId},
-			productId = #{productId},
-			addTime = #{addTime}
-		WHERE id = #{id}
-	</update>
-	
-	<update id="delete">
-		UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE id = #{id}
-	</update>
+    </sql>
+
+    <select id="get" resultType="CmHeheActivityProduct">
+        SELECT
+        <include refid="cmHeheActivityProductColumns"/>
+        FROM cm_hehe_activity_product a
+        <include refid="cmHeheActivityProductJoins"/>
+        WHERE a.id = #{id}
+    </select>
+
+    <select id="findList" resultType="CmHeheActivityProduct">
+        SELECT
+        <include refid="cmHeheActivityProductColumns"/>
+        FROM cm_hehe_activity_product a
+        <include refid="cmHeheActivityProductJoins"/>
+        <where>
+            a.delFlag = 0
+            AND a.activityId = #{activityId}
+            and chp.id is not null
+            <if test="name != null and name != ''">
+                AND p.name LIKE CONCAT('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE CONCAT('%',#{shopName},'%')
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY a.addTime DESC
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllList" resultType="CmHeheActivityProduct">
+        SELECT
+        <include refid="cmHeheActivityProductColumns"/>
+        FROM cm_hehe_activity_product a
+        <include refid="cmHeheActivityProductJoins"/>
+        <where>
+
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+
+    <insert id="insert" parameterType="CmHeheActivityProduct" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO cm_hehe_activity_product(activityId,
+                                             productId,
+                                             addTime,
+                                             delFlag)
+        VALUES (#{activityId},
+                #{productId},
+                NOW(),
+                0)
+    </insert>
+
+    <update id="update">
+        UPDATE cm_hehe_activity_product
+        SET activityId = #{activityId},
+            productId  = #{productId},
+            addTime    = #{addTime}
+        WHERE id = #{id}
+    </update>
+
+    <update id="delete">
+        UPDATE cm_hehe_activity_product
+        SET delFlag = 1
+        WHERE id = #{id}
+    </update>
     <update id="updateProductId">
-		update cm_hehe_activity_product set productId = #{newProductId} where productId = #{oldProductId}
-	</update>
+        update cm_hehe_activity_product
+        set productId = #{newProductId}
+        where productId = #{oldProductId}
+    </update>
+
+    <update id="updateDiscount">
+        update cm_hehe_discount_activity_sku
+        set discountPrice=#{discountPrice}
+        where skuId = #{skuId}
+    </update>
+
+    <select id="findAllHeHeProduct" resultType="com.caimei.modules.hehe.entity.CmHeheProduct">
+        SELECT
+        a.id AS "id",
+        a.productId AS "productId",
+        p.name AS "name",
+        p.mainImage AS "mainImage",
+        s.name AS "shopName"
+        FROM
+        cm_hehe_product a
+        LEFT JOIN product p ON a.productId = p.productID
+        LEFT JOIN shop s ON s.shopID = p.shopID
+        WHERE
+        a.validFlag = 1
+        <if test="ids != null and ids.size() > 0 ">
+            AND a.productId NOT IN
+            <foreach collection="ids" open="(" close=")" item="id" separator=",">
+                #{id,jdbcType=INTEGER}
+            </foreach>
+        </if>
+        <if test="productId != null">
+            AND a.productId = #{productId,jdbcType=INTEGER}
+        </if>
+        <if test="name != null and name != ''">
+            AND p.name LIKE CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name LIKE CONCAT('%',#{shopName,jdbcType=VARCHAR},'%')
+        </if>
+    </select>
+
+    <select id="findActivityLadder" resultType="com.caimei.modules.hehe.entity.CmHeHeActivityLadder">
+        SELECT id,
+               activityId,
+               productId,
+               ladderNum,
+               buyNum,
+               buyPrice
+        FROM cm_hehe_activity_ladder
+        WHERE activityId = #{activityId}
+          AND productId = #{productId}
+        ORDER BY ladderNum ASC
+    </select>
+
+    <insert id="insertLadder">
+        INSERT INTO `cm_hehe_activity_ladder` (`activityId`, `skuId`, `ladderNum`,
+                                               `buyNum`, `buyPrice`, `createDate`, productId)
+        VALUES (#{activityId}, #{skuId}, #{ladderNum},
+                #{buyNum}, #{buyPrice}, NOW(), (select productId from cm_sku where skuId = #{skuId}))
+    </insert>
+
+    <insert id="insertDiscount">
+        insert into cm_hehe_discount_activity_sku(skuId, productid, discountprice)
+        values (#{skuId}, (select productId from cm_sku where skuId = #{skuId}), #{discountPrice})
+    </insert>
+
+    <delete id="deleteLadder">
+        DELETE FROM cm_hehe_activity_ladder WHERE
+        productId =#{productId}
+        <if test="activityId != null">
+            AND activityId = #{activityId}
+        </if>
+    </delete>
+
+    <select id="findActivityByProductId" resultType="integer">
+        SELECT activityId
+        FROM cm_hehe_activity_product
+        WHERE productId = #{productId}
+          AND delFlag = 0
+    </select>
+
+    <select id="findPrice" resultType="java.lang.String">
+        select discountPrice
+        from cm_hehe_discount_activity_sku
+        where productId = #{productId}
+        order by discountPrice asc
+        limit 1
+    </select>
+
+    <select id="findDiscountSku" resultType="com.caimei.modules.product.entity.CmSku">
+        select chds.discountPrice, chds.productId, chds.skuId, chs.price, cs.unit
+        from cm_hehe_discount_activity_sku chds
+                 left join cm_hehe_sku chs on chds.skuId = chs.skuId
+                 left join cm_sku cs on chs.skuId = cs.skuId
+        where chds.productId = #{productId}
+    </select>
+
+    <select id="findDiscountBySku" resultType="com.caimei.modules.product.entity.CmSku">
+        select discountPrice, skuId, productId
+        from cm_hehe_discount_activity_sku
+        where skuId = #{skuId}
+    </select>
+
+    <delete id="deleteUserActivity">
+        DELETE
+        FROM cm_hehe_user_activity
+        WHERE productId = #{productId}
+    </delete>
+
+    <delete id="deleteLadderBySkuId">
+        delete from cm_hehe_activity_ladder
+        WHERE skuId =#{skuId}
+        <if test="activityId != null">
+            AND activityId = #{activityId}
+        </if>
+    </delete>
+
 
-	<select id="findAllHeHeProduct" resultType="com.caimei.modules.hehe.entity.CmHeheProduct">
-		SELECT
-		a.id AS "id",
-		a.productId AS "productId",
-		a.price AS "price",
-		p.name AS "name",
-		p.mainImage AS "mainImage",
-		s.name AS "shopName"
-		FROM
-		cm_hehe_product a
-		LEFT JOIN product p ON a.productId = p.productID
-		LEFT JOIN shop s ON s.shopID = p.shopID
-		WHERE
-		a.validFlag = 1
-		<if test="ids != null and ids.size() > 0 ">
-			AND a.productId NOT IN
-			<foreach collection="ids" open="(" close=")" item="id" separator=",">
-				#{id,jdbcType=INTEGER}
-			</foreach>
-		</if>
-		<if test="productId != null">
-			AND a.productId = #{productId,jdbcType=INTEGER}
-		</if>
-		<if test="name != null and name != ''">
-			AND p.name LIKE CONCAT('%',#{name,jdbcType=VARCHAR},'%')
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name LIKE CONCAT('%',#{shopName,jdbcType=VARCHAR},'%')
-		</if>
-	</select>
-
-	<select id="findActivityLadder" resultType="com.caimei.modules.hehe.entity.CmHeHeActivityLadder">
-		SELECT
-		  id,
-		  activityId,
-		  productId,
-		  ladderNum,
-		  buyNum,
-		  buyPrice
-		FROM
-		  cm_hehe_activity_ladder
-		WHERE
-		  activityId = #{activityId}
-		  AND productId = #{productId}
-		ORDER BY
-		  ladderNum ASC
-	</select>
-
-	<insert id="insertLadder">
-		INSERT INTO `cm_hehe_activity_ladder` (
-		  `activityId`, `productId`, `ladderNum`,
-		  `buyNum`, `buyPrice`, `createDate`
-		)
-		VALUES
-		  (
-			#{activityId}, #{productId}, #{ladderNum},
-			#{buyNum}, #{buyPrice}, NOW()
-		  )
-	</insert>
-
-	<delete id="deleteLadder">
-		DELETE FROM cm_hehe_activity_ladder WHERE
-		productId =#{productId}
-		<if test="activityId != null">
-			AND activityId = #{activityId}
-		</if>
-	</delete>
-
-	<select id="findActivityByProductId" resultType="integer">
-		SELECT activityId FROM cm_hehe_activity_product WHERE productId = #{productId} AND delFlag = 0
-	</select>
-
-	<delete id="deleteUserActivity">
-		DELETE FROM cm_hehe_user_activity WHERE productId = #{productId}
-	</delete>
-
-	
 </mapper>

+ 157 - 112
src/main/resources/mappings/modules/hehe/CmHeheCollageProductMapper.xml

@@ -1,11 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.hehe.dao.CmHeheCollageProductDao">
-    
-	<sql id="cmHeheCollageProductColumns">
-		a.id AS "id",
+
+    <sql id="cmHeheCollageProductColumns">
+        a.id AS "id",
 		a.productId AS "productId",
-		a.price AS "price",
 		a.limitedNum AS "limitedNum",
 		a.unlimitedFlag AS "unlimitedFlag",
 		a.memberNum AS "memberNum",
@@ -14,117 +13,163 @@
 		s.name AS shopName,
 		p.name AS productName,
 		p.mainImage AS productImage
-	</sql>
-	
-	<sql id="cmHeheCollageProductJoins">
-		left join product p on a.productId = p.productID
+    </sql>
+
+    <sql id="cmHeheCollageProductJoins">
+        left join product p on a.productId = p.productID
 		left join cm_hehe_product chp on p.productID = chp.productId
 		left join shop s on p.shopID = s.shopID
-	</sql>
-    
-	<select id="get" resultType="CmHeheCollageProduct">
-		SELECT 
-			<include refid="cmHeheCollageProductColumns"/>
-		FROM cm_hehe_collage_product a
-		<include refid="cmHeheCollageProductJoins"/>
-		WHERE a.id = #{id}
-	</select>
-	
-	<select id="findList" resultType="CmHeheCollageProduct">
-		SELECT 
-			<include refid="cmHeheCollageProductColumns"/>
-		FROM cm_hehe_collage_product a
-		<include refid="cmHeheCollageProductJoins"/>
-		<where>
-			chp.id is not null
-			<if test="id != null and id != ''">
-				AND a.id = #{id}
-			</if>
-			<if test="status != null">
-				AND a.status = #{status}
-			</if>
-			<if test="productName != null and productName != ''">
-				and p.name like concat('%',#{productName},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				and s.name like concat('%',#{shopName},'%')
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.addTime desc
-			</otherwise>
-		</choose>
-	</select>
-	
-	<select id="findAllList" resultType="CmHeheCollageProduct">
-		SELECT 
-			<include refid="cmHeheCollageProductColumns"/>
-		FROM cm_hehe_collage_product a
-		<include refid="cmHeheCollageProductJoins"/>
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findReductionProductIds" resultType="java.lang.Integer">
-		select chp.id
-		from cm_hehe_reduction chap
-				 left join cm_hehe_product chp on chap.productId = chp.productId;
-	</select>
-	<select id="getProductId" resultType="java.lang.Integer">
-		select productId from cm_hehe_product where id = #{heheProductId}
-	</select>
-
-	<insert id="insert" parameterType="CmHeheCollageProduct"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO cm_hehe_collage_product(
-			productId,
-			price,
-			limitedNum,
-			unlimitedFlag,
-			memberNum,
-			status,
-			addTime
-		) VALUES (
-             (select productId from cm_hehe_product where id = #{productId}),
-			#{price},
-			#{limitedNum},
-			#{unlimitedFlag},
-			#{memberNum},
-			#{status},
-			NOW()
-		)
-	</insert>
-	
-	<update id="update">
-		UPDATE cm_hehe_collage_product SET 	
-			productId = #{productId},
-			price = #{price},
-			limitedNum = #{limitedNum},
-			unlimitedFlag = #{unlimitedFlag},
-			memberNum = #{memberNum},
-			status = #{status}
-		WHERE id = #{id}
-	</update>
-	<update id="updateStatus">
-		update cm_hehe_collage_product set status = #{status} where id = #{id}
-	</update>
+    </sql>
+
+    <select id="get" resultType="CmHeheCollageProduct">
+        SELECT
+        <include refid="cmHeheCollageProductColumns"/>
+        FROM cm_hehe_collage_product a
+        <include refid="cmHeheCollageProductJoins"/>
+        WHERE a.id = #{id}
+    </select>
+
+    <select id="findList" resultType="CmHeheCollageProduct">
+        SELECT
+        <include refid="cmHeheCollageProductColumns"/>
+        FROM cm_hehe_collage_product a
+        <include refid="cmHeheCollageProductJoins"/>
+        <where>
+            chp.id is not null
+            <if test="id != null and id != ''">
+                AND a.id = #{id}
+            </if>
+            <if test="status != null">
+                AND a.status = #{status}
+            </if>
+            <if test="productName != null and productName != ''">
+                and p.name like concat('%',#{productName},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                and s.name like concat('%',#{shopName},'%')
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.addTime desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllList" resultType="CmHeheCollageProduct">
+        SELECT
+        <include refid="cmHeheCollageProductColumns"/>
+        FROM cm_hehe_collage_product a
+        <include refid="cmHeheCollageProductJoins"/>
+        <where>
+
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findReductionProductIds" resultType="java.lang.Integer">
+        select chp.id
+        from cm_hehe_reduction chap
+                 left join cm_hehe_product chp on chap.productId = chp.productId;
+    </select>
+
+    <select id="getProductId" resultType="java.lang.Integer">
+        select productId
+        from cm_hehe_product
+        where id = #{heheProductId}
+    </select>
+
+    <select id="findCollageSku" resultType="com.caimei.modules.product.entity.CmSku">
+        select chs.price as 'price', chcs.collagePrice , chs.skuId
+        from cm_hehe_sku chs
+        left join cm_hehe_collage_sku chcs on chs.skuId = chcs.skuId
+        left join cm_hehe_product chp on chs.productId = chp.productId
+        where chs.productId = #{productId}
+    </select>
+
+    <select id="findCollageByHeHeId" resultType="com.caimei.modules.product.entity.CmSku">
+        select chs.price as 'price', chcs.collagePrice as 'price', chs.skuId
+        from cm_hehe_sku chs
+        left join cm_hehe_collage_sku chcs on chs.skuId = chcs.skuId
+        left join cm_hehe_product chp on chs.productId = chp.productId
+        where chp.id = #{productId}
+    </select>
+
+    <select id="getSkuCollage" resultType="com.caimei.modules.product.entity.CmSku">
+        select skuId, productId, collagePrice
+        from cm_hehe_collage_sku
+        where skuId = #{skuId}
+    </select>
+
+    <select id="getCollagePrice" resultType="java.lang.Double">
+        select collagePrice
+        from cm_hehe_collage_sku
+        where productId = #{productId}
+        order by collagePrice asc
+        limit 1
+    </select>
+
+    <insert id="insert" parameterType="CmHeheCollageProduct" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO cm_hehe_collage_product(productId,
+                                            limitedNum,
+                                            unlimitedFlag,
+                                            memberNum,
+                                            status,
+                                            addTime)
+        VALUES ((select productId from cm_hehe_product where id = #{productId}),
+                #{limitedNum},
+                #{unlimitedFlag},
+                #{memberNum},
+                #{status},
+                NOW())
+    </insert>
+
+    <insert id="insertSkuCollage">
+        insert into cm_hehe_collage_sku(skuId, productid, collageprice)
+        values (#{skuId}, (select productId from cm_sku where skuId = #{skuId}), #{collagePrice})
+    </insert>
+
+    <update id="update">
+        UPDATE cm_hehe_collage_product
+        SET productId     = #{productId},
+            limitedNum    = #{limitedNum},
+            unlimitedFlag = #{unlimitedFlag},
+            memberNum     = #{memberNum},
+            status        = #{status}
+        WHERE id = #{id}
+    </update>
+
+    <update id="updateStatus">
+        update cm_hehe_collage_product
+        set status = #{status}
+        where id = #{id}
+    </update>
+
     <update id="updateProductId">
-		update cm_hehe_collage_product set productId = #{newProductId} where productId = #{oldProductId}
-	</update>
+        update cm_hehe_collage_product
+        set productId = #{newProductId}
+        where productId = #{oldProductId}
+    </update>
+
+    <update id="updateSkuCollage">
+        update cm_hehe_collage_sku
+        set collagePrice=#{collagePrice}
+        where skuId = #{skuId}
+    </update>
 
     <delete id="delete">
-		DELETE FROM cm_hehe_collage_product
-		WHERE id = #{id}
-	</delete>
-	
+        DELETE
+        FROM cm_hehe_collage_product
+        WHERE id = #{id}
+    </delete>
+
 </mapper>

+ 297 - 262
src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml

@@ -1,291 +1,326 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.hehe.dao.CmHeheProductDao">
-    
-	<sql id="cmHeheProductColumns">
-		a.id AS "id",
+
+    <sql id="cmHeheProductColumns">
+        a.id AS "id",
 		a.productId AS "productId",
 		ifnull(a.bigTypeId,0) AS "bigTypeId",
 		ifnull(a.smallTypeId,0) AS "smallTypeId",
 		a.validFlag AS "validFlag",
-		a.price AS "price",
 		a.includedTax AS "includedTax",
 		a.invoiceType AS "invoiceType",
 		a.clubTaxPoint AS "clubTaxPoint",
 		a.shopTaxPoint AS "shopTaxPoint",
 		a.oldProductId,
-		p.costCheckFlag AS "costType",
-		p.costPrice AS "costPrice",
-		p.costProportional AS "costProportional",
 		a.addTime AS "addTime",
 		p.name AS "name",
 		p.mainImage AS "mainImage",
 		s.name AS "shopName",
 		chap.activityId,
 		group_concat(chfp.floorId) as floorIds
-	</sql>
-	
-	<sql id="cmHeheProductJoins">
-		LEFT JOIN product p ON  a.productId = p.productID
+    </sql>
+
+    <sql id="cmHeheProductJoins">
+        LEFT JOIN product p ON  a.productId = p.productID
 		LEFT JOIN shop s ON s.shopID = p.shopID
 		left join cm_hehe_activity_product chap on a.productId = chap.productId
 		left join cm_hehe_floor_product chfp on a.productId = chfp.productId
-	</sql>
-    
-	<select id="get" resultType="CmHeheProduct">
-		SELECT 
-			<include refid="cmHeheProductColumns"/>
-		FROM cm_hehe_product a
-		<include refid="cmHeheProductJoins"/>
-		WHERE a.id = #{id}
-		group by a.id
-	</select>
-	
-	<select id="findList" resultType="CmHeheProduct">
-		SELECT 
-			<include refid="cmHeheProductColumns"/>
-		FROM cm_hehe_product a
-		<include refid="cmHeheProductJoins"/>
-		<where>
-			<if test="productId != null and productId != ''">
-				AND a.productId = #{productId}
-			</if>
-			<if test="validFlag != null and validFlag != ''">
-				AND a.validFlag = #{validFlag}
-			</if>
-			<if test="includedTax != null and includedTax != ''">
-				AND a.includedTax = #{includedTax}
-			</if>
-			<if test="invoiceType != null and invoiceType != ''">
-				AND a.invoiceType = #{invoiceType}
-			</if>
-			<if test="id != null and id != ''">
-				AND a.id = #{id}
-			</if>
-			<if test="name != null and name != ''">
-				AND p.name LIKE CONCAT('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE CONCAT('%',#{shopName},'%')
-			</if>
-		</where>
-		group by a.id
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY addTime DESC
-			</otherwise>
-		</choose>
-	</select>
-	
-	<select id="findAllList" resultType="CmHeheProduct">
-		SELECT 
-			<include refid="cmHeheProductColumns"/>
-		FROM cm_hehe_product a
-		<include refid="cmHeheProductJoins"/>
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	
-	<insert id="insert" parameterType="CmHeheProduct"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO cm_hehe_product(
-			productId,
-			bigTypeId,
-			smallTypeId,
-			validFlag,
-			price,
-			includedTax,
-			invoiceType,
-			clubTaxPoint,
-			shopTaxPoint,
-			addTime
-		) VALUES (
-			#{productId},
-			#{bigTypeId},
-			#{smallTypeId},
-			#{validFlag},
-			#{price},
-			#{includedTax},
-			#{invoiceType},
-			#{clubTaxPoint},
-			#{shopTaxPoint},
-			NOW()
-		)
-	</insert>
-	<insert id="addActivityProduct">
-		insert into cm_hehe_activity_product (activityId, productId, addTime, delFlag)
-		values (#{activityId}, #{productId}, NOW(), 0)
-	</insert>
-	<insert id="addFloorProduct">
-		insert into cm_hehe_floor_product(floorId, productId, validFlag, recommend, sort, addTime)
-		VALUES (#{floorId}, #{productId}, 1, 0, 1, NOW())
-	</insert>
+    </sql>
+
+    <select id="get" resultType="CmHeheProduct">
+        SELECT
+        <include refid="cmHeheProductColumns"/>
+        FROM cm_hehe_product a
+        <include refid="cmHeheProductJoins"/>
+        WHERE a.id = #{id}
+        group by a.id
+    </select>
+
+    <select id="findList" resultType="CmHeheProduct">
+        SELECT
+        <include refid="cmHeheProductColumns"/>
+        FROM cm_hehe_product a
+        <include refid="cmHeheProductJoins"/>
+        <where>
+            <if test="productId != null and productId != ''">
+                AND a.productId = #{productId}
+            </if>
+            <if test="validFlag != null and validFlag != ''">
+                AND a.validFlag = #{validFlag}
+            </if>
+            <if test="includedTax != null and includedTax != ''">
+                AND a.includedTax = #{includedTax}
+            </if>
+            <if test="invoiceType != null and invoiceType != ''">
+                AND a.invoiceType = #{invoiceType}
+            </if>
+            <if test="id != null and id != ''">
+                AND a.id = #{id}
+            </if>
+            <if test="name != null and name != ''">
+                AND p.name LIKE CONCAT('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE CONCAT('%',#{shopName},'%')
+            </if>
+        </where>
+        group by a.id
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY addTime DESC
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllList" resultType="CmHeheProduct">
+        SELECT
+        <include refid="cmHeheProductColumns"/>
+        FROM cm_hehe_product a
+        <include refid="cmHeheProductJoins"/>
+        <where>
+
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+
+    <insert id="insert" parameterType="CmHeheProduct" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO cm_hehe_product(productId,
+                                    bigTypeId,
+                                    smallTypeId,
+                                    validFlag,
+                                    includedTax,
+                                    invoiceType,
+                                    clubTaxPoint,
+                                    shopTaxPoint,
+                                    addTime)
+        VALUES (#{productId},
+                #{bigTypeId},
+                #{smallTypeId},
+                #{validFlag},
+                #{includedTax},
+                #{invoiceType},
+                #{clubTaxPoint},
+                #{shopTaxPoint},
+                NOW())
+    </insert>
+    <insert id="addActivityProduct">
+        insert into cm_hehe_activity_product (activityId, productId, addTime, delFlag)
+        values (#{activityId}, #{productId}, NOW(), 0)
+    </insert>
+    <insert id="addFloorProduct">
+        insert into cm_hehe_floor_product(floorId, productId, validFlag, recommend, sort, addTime)
+        VALUES (#{floorId}, #{productId}, 1, 0, 1, NOW())
+    </insert>
+    <insert id="insertHeHeSkuPrice">
+        insert into cm_hehe_sku(skuid, productid, price)
+        values (#{skuId}, #{productId}, #{price})
+    </insert>
+
+    <update id="update">
+        UPDATE cm_hehe_product
+        SET productId    = #{productId},
+            bigTypeId    = #{bigTypeId},
+            smallTypeId  = #{smallTypeId},
+            validFlag    = #{validFlag},
+            includedTax  = #{includedTax},
+            invoiceType  = #{invoiceType},
+            clubTaxPoint = #{clubTaxPoint},
+            shopTaxPoint = #{shopTaxPoint}
+        WHERE id = #{id}
+    </update>
+
+    <delete id="delete">
+        DELETE
+        FROM cm_hehe_product
+        WHERE id = #{id}
+    </delete>
+
+    <select id="findHeHeProductId" resultType="integer">
+        SELECT productId
+        FROM cm_hehe_product
+    </select>
+
+    <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        a.*,s.name AS "shopName"
+        FROM product a
+        LEFT JOIN shop s on s.shopID = a.shopID
+        <where>
+            a.splitCode is not null and a.splitCode != ''
+            <if test="productID != null">
+                AND a.productID = #{productID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE concat('%',#{shopName},'%')
+            </if>
+            <if test="ids != null and ids.size() > 0 ">
+                AND a.productID NOT IN
+                <foreach collection="ids" open="(" close=")" item="id" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findCouponProduct" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        a.*,s.name AS "shopName"
+        FROM cm_hehe_product
+        product a
+        LEFT JOIN shop s on s.shopID = a.shopID
+        <where>
+            <if test="productID != null">
+                AND a.productID = #{productID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE concat('%',#{shopName},'%')
+            </if>
+            <if test="ids != null and ids.size() > 0 ">
+                AND a.productID NOT IN
+                <foreach collection="ids" open="(" close=")" item="id" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findProductActivity" resultType="java.lang.Integer">
+        select activityId
+        from cm_hehe_activity_product
+        where productId = #{productId}
+    </select>
+
+    <select id="getNewProductId" resultType="java.lang.Integer">
+        select productId
+        from cm_hehe_product
+        where oldProductId = #{oldProductId}
+    </select>
+
+    <select id="findHeHeFloorProductIds" resultType="java.lang.Integer">
+        select i.productId
+        from new_page_floor_image i
+                 left join cm_page_centre c on i.centreId = c.id
+                 left join cm_page p on c.pageId = p.id
+        where p.type = 8
+    </select>
 
-	<update id="update">
-		UPDATE cm_hehe_product SET 	
-			productId = #{productId},
-		    bigTypeId = #{bigTypeId},
-			smallTypeId = #{smallTypeId},
-			validFlag = #{validFlag},
-			price = #{price},
-			includedTax = #{includedTax},
-			invoiceType = #{invoiceType},
-			clubTaxPoint = #{clubTaxPoint},
-			shopTaxPoint = #{shopTaxPoint}
-		WHERE id = #{id}
-	</update>
-	
-	<delete id="delete">
-		DELETE FROM cm_hehe_product
-		WHERE id = #{id}
-	</delete>
+    <select id="findAllHeheProduct" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        a.*,s.name AS "shopName"
+        FROM cm_hehe_product chp left join product a on chp.productId = a.productID
+        LEFT JOIN shop s on s.shopID = a.shopID
+        <where>
+            chp.validFlag = 1
+            <if test="productID != null">
+                AND a.productID = #{productID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE concat('%',#{shopName},'%')
+            </if>
+            <if test="ids != null and ids.size() > 0 ">
+                AND a.productID NOT IN
+                <foreach collection="ids" open="(" close=")" item="id" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID
+            </otherwise>
+        </choose>
+    </select>
 
-	<select id="findHeHeProductId" resultType="integer">
-		SELECT productId FROM cm_hehe_product
-	</select>
+    <select id="findActivityProductIds" resultType="java.lang.Integer">
+        SELECT a.productId
+        FROM cm_hehe_activity_product a
+                 LEFT JOIN cm_hehe_activity cha ON a.activityId = cha.id
+        WHERE a.delFlag = 0
+          AND cha.delFlag = 0
+    </select>
 
-	<select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		a.*,s.name AS "shopName"
-		FROM product a
-		LEFT JOIN shop s on s.shopID = a.shopID
-		<where>
-			a.splitCode is not null and a.splitCode != ''
-			<if test="productID != null" >
-				AND a.productID = #{productID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE concat('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE concat('%',#{shopName},'%')
-			</if>
-			<if test="ids != null and ids.size() > 0 ">
-				AND a.productID NOT IN
-				<foreach collection="ids" open="(" close=")" item="id" separator=",">
-					#{id}
-				</foreach>
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID
-			</otherwise>
-		</choose>
-	</select>
+    <select id="findCollageProductIds" resultType="java.lang.Integer">
+        select productId
+        from cm_hehe_collage_product
+    </select>
 
-	<select id="findCouponProduct" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		a.*,s.name AS "shopName"
-		FROM cm_hehe_product
-		     product a
-		LEFT JOIN shop s on s.shopID = a.shopID
-		<where>
-			<if test="productID != null" >
-				AND a.productID = #{productID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE concat('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE concat('%',#{shopName},'%')
-			</if>
-			<if test="ids != null and ids.size() > 0 ">
-				AND a.productID NOT IN
-				<foreach collection="ids" open="(" close=")" item="id" separator=",">
-					#{id}
-				</foreach>
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findProductActivity" resultType="java.lang.Integer">
-		select activityId from cm_hehe_activity_product where productId = #{productId}
-	</select>
-	<select id="getNewProductId" resultType="java.lang.Integer">
-		select productId from cm_hehe_product where oldProductId = #{oldProductId}
-	</select>
+    <select id="findDiscountProductIds" resultType="java.lang.Integer">
+        select productId
+        from hehe_discount_activity_product hdap
+                 left join cm_hehe_discount_activity chda on hdap.activityId = chda.id
+        where chda.id is not null
+    </select>
 
-	<select id="findHeHeFloorProductIds" resultType="java.lang.Integer">
-		select i.productId from new_page_floor_image i left join cm_page_centre c on i.centreId = c.id
-		left join cm_page p on c.pageId = p.id
-		where p.type = 8
-	</select>
-	<select id="findAllHeheProduct" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-			a.*,s.name AS "shopName"
-		FROM cm_hehe_product chp left join product a on chp.productId = a.productID
-				 LEFT JOIN shop s on s.shopID = a.shopID
-		<where>
-		    chp.validFlag = 1
-			<if test="productID != null" >
-				AND a.productID = #{productID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE concat('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE concat('%',#{shopName},'%')
-			</if>
-			<if test="ids != null and ids.size() > 0 ">
-				AND a.productID NOT IN
-				<foreach collection="ids" open="(" close=")" item="id" separator=",">
-					#{id}
-				</foreach>
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findActivityProductIds" resultType="java.lang.Integer">
-		SELECT
-			a.productId
-		FROM
-			cm_hehe_activity_product a
-			LEFT JOIN cm_hehe_activity cha ON a.activityId = cha.id
-		WHERE
-			a.delFlag = 0
-		  AND cha.delFlag = 0
-  	</select>
-	<select id="findCollageProductIds" resultType="java.lang.Integer">
-		select productId from cm_hehe_collage_product
-	</select>
-	<select id="findDiscountProductIds" resultType="java.lang.Integer">
-		select productId from hehe_discount_activity_product hdap left join cm_hehe_discount_activity chda on hdap.activityId = chda.id
-		where chda.id is not null
-	</select>
+    <select id="findProductElement" resultType="com.caimei.modules.hehe.entity.CmHeheProduct">
+        select ifnull(chs.price, 0)           as price,
+               ifnull(cs.costProportional, 0) as costProportional,
+               ifnull(cs.costCheckFlag, 0)    as costType,
+               ifnull(cs.costPrice, 0)        as costPrice
+        from cm_sku cs
+                 left join cm_hehe_sku chs on cs.skuId = chs.skuId
+        where cs.productId = #{productId}
+        order by chs.price asc
+        limit 1
+    </select>
 
-	<update id="deleteActivityProduct">
-		UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE productId = #{productId}
-	</update>
-	<update id="updateProductId">
-		update cm_hehe_product set oldProductId = #{oldProductId}, productId = #{newProductId} where productId = #{oldProductId}
-	</update>
+    <update id="deleteActivityProduct">
+        UPDATE cm_hehe_activity_product
+        SET delFlag = 1
+        WHERE productId = #{productId}
+    </update>
 
+    <update id="updateProductId">
+        update cm_hehe_product
+        set oldProductId = #{oldProductId},
+            productId    = #{newProductId}
+        where productId = #{oldProductId}
+    </update>
+    <update id="updateHeHeSkuPrice">
+        update cm_hehe_sku
+        set price=#{price}
+        where skuId = #{skuId}
+    </update>
+    <select id="findLadderList" resultType="com.caimei.modules.product.entity.CmLadderPrice">
+        select id,buyPrice,buyNum
+        from cm_hehe_activity_ladder
+        where skuId=#{skuId}
+    </select>
 </mapper>

+ 102 - 99
src/main/resources/mappings/modules/hehe/HeheDiscountActivityProductMapper.xml

@@ -1,113 +1,116 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.hehe.dao.HeheDiscountActivityProductDao">
-    
-	<sql id="heheDiscountActivityProductColumns">
-		a.id AS "id",
+
+    <sql id="heheDiscountActivityProductColumns">
+        a.id AS "id",
 		a.activityId,
 		a.productId AS "productId",
-		a.discountPrice AS "discountPrice",
 		a.status AS "status",
 		a.addTime AS "addTime",
 		p.mainImage AS "mainImage",
 		p.name AS "name",
 		s.name AS "shopName"
-	</sql>
-	
-	<sql id="heheDiscountActivityProductJoins">
-		LEFT JOIN cm_hehe_product chp ON a.productId = chp.productId
+    </sql>
+
+    <sql id="heheDiscountActivityProductJoins">
+        LEFT JOIN cm_hehe_product chp ON a.productId = chp.productId
 		LEFT JOIN product p ON a.productId = p.productID
 		LEFT JOIN shop s ON s.shopID = p.shopID
-	</sql>
-    
-	<select id="get" resultType="HeheDiscountActivityProduct">
-		SELECT 
-			<include refid="heheDiscountActivityProductColumns"/>
-		FROM hehe_discount_activity_product a
-		<include refid="heheDiscountActivityProductJoins"/>
-		WHERE a.id = #{id}
-	</select>
-	
-	<select id="findList" resultType="HeheDiscountActivityProduct">
-		SELECT 
-			<include refid="heheDiscountActivityProductColumns"/>
-		FROM hehe_discount_activity_product a
-		<include refid="heheDiscountActivityProductJoins"/>
-		<where>
-			chp.id is not null
-			<if test="activityId != null">
-				and a.activityId = #{activityId}
-			</if>
-			<if test="productId != null">
-				AND a.productId = #{productId}
-			</if>
-			<if test="status != null">
-				AND a.status = #{status}
-			</if>
-			<if test="name != null and name != ''">
-				AND p.name LIKE CONCAT('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE CONCAT('%',#{shopName},'%')
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				ORDER BY a.addTime DESC
-			</otherwise>
-		</choose>
-	</select>
-	
-	<select id="findAllList" resultType="HeheDiscountActivityProduct">
-		SELECT 
-			<include refid="heheDiscountActivityProductColumns"/>
-		FROM hehe_discount_activity_product a
-		<include refid="heheDiscountActivityProductJoins"/>
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findDiscountProductIds" resultType="java.lang.Integer">
-		select productId from hehe_discount_activity_product;
-	</select>
+    </sql>
+
+    <select id="get" resultType="HeheDiscountActivityProduct">
+        SELECT
+        <include refid="heheDiscountActivityProductColumns"/>
+        FROM hehe_discount_activity_product a
+        <include refid="heheDiscountActivityProductJoins"/>
+        WHERE a.id = #{id}
+    </select>
+
+    <select id="findList" resultType="HeheDiscountActivityProduct">
+        SELECT
+        <include refid="heheDiscountActivityProductColumns"/>
+        FROM hehe_discount_activity_product a
+        <include refid="heheDiscountActivityProductJoins"/>
+        <where>
+            chp.id is not null
+            <if test="activityId != null">
+                and a.activityId = #{activityId}
+            </if>
+            <if test="productId != null">
+                AND a.productId = #{productId}
+            </if>
+            <if test="status != null">
+                AND a.status = #{status}
+            </if>
+            <if test="name != null and name != ''">
+                AND p.name LIKE CONCAT('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE CONCAT('%',#{shopName},'%')
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY a.addTime DESC
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllList" resultType="HeheDiscountActivityProduct">
+        SELECT
+        <include refid="heheDiscountActivityProductColumns"/>
+        FROM hehe_discount_activity_product a
+        <include refid="heheDiscountActivityProductJoins"/>
+        <where>
+
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findDiscountProductIds" resultType="java.lang.Integer">
+        select productId
+        from hehe_discount_activity_product;
+    </select>
+
+    <select id="findDiscountSku" resultType="com.caimei.modules.product.entity.CmSku">
+        SELECT chda.discountPrice, chs.productId, chs.skuId, chs.price
+        FROM cm_hehe_sku chs
+        LEFT JOIN cm_hehe_discount_activity_sku chda ON chda.skuId = chs.skuId
+        WHERE chs.productId = #{productId}
+    </select>
+
+    <insert id="insert" parameterType="HeheDiscountActivityProduct" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO hehe_discount_activity_product(activityId,
+                                                   productId,
+                                                   status,
+                                                   addTime)
+        VALUES (#{activityId},
+                #{productId},
+                #{status},
+                NOW())
+    </insert>
+
+    <update id="update">
+        UPDATE hehe_discount_activity_product
+        SET productId = #{productId},
+            status    = #{status}
+        WHERE id = #{id}
+    </update>
+
+    <delete id="delete">
+        DELETE
+        FROM hehe_discount_activity_product
+        WHERE id = #{id}
+    </delete>
 
-	<insert id="insert" parameterType="HeheDiscountActivityProduct"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO hehe_discount_activity_product(
-		    activityId,
-			productId,
-			discountPrice,
-			status,
-			addTime
-		) VALUES (
-		    #{activityId},
-			#{productId},
-			#{discountPrice},
-			#{status},
-			NOW()
-		)
-	</insert>
-	
-	<update id="update">
-		UPDATE hehe_discount_activity_product SET 	
-			productId = #{productId},
-			discountPrice = #{discountPrice},
-			status = #{status}
-		WHERE id = #{id}
-	</update>
-	
-	<delete id="delete">
-		DELETE FROM hehe_discount_activity_product
-		WHERE id = #{id}
-	</delete>
-	
 </mapper>

+ 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

+ 2 - 1
src/main/resources/mappings/modules/order/CmReturnedPurchaseProductMapper.xml

@@ -33,9 +33,10 @@
 			b.totalFee as totalFee,b.totalAddedValueTax as totalAddedValueTax,
 			b.taxRate as taxRate,b.addedValueTax as addedValueTax,c.mainImage as mainImage,
 			c.name as name,d.name as shopName,
-			c.unit as unit
+			cs.unit as unit
 		FROM cm_returned_purchase_product a
 		left join cm_order_product b on a.orderProductID = b.orderProductID
+		left join cm_sku cs on b.skuId = cs.skuId
 		left join product c on c.productID = a.productID
 		left join shop d on d.shopID = a.shopID
 		<where>

+ 1 - 0
src/main/resources/mappings/modules/order/LogisticsRecordMapper.xml

@@ -54,6 +54,7 @@
 			p.name AS productName,
 			p.productImage AS image,
 			p.num AS buyNum,
+		    p.productUnit as unit,
 			p.presentNum AS presentNum,
 			s.name AS shopName
 		from cm_logistics_record a

ファイルの差分が大きいため隠しています
+ 506 - 509
src/main/resources/mappings/modules/order/OrderProductMapper.xml


+ 43 - 24
src/main/resources/mappings/modules/product/CmPromotionMapper.xml

@@ -97,9 +97,11 @@
 
     <select id="findPromotionProduct" resultType="com.caimei.modules.product.entity.Product">
         SELECT p.*,
-               cp.reducedPrice AS "reducedPrice",
-               s.name          AS "shopName"
+               (select price from cm_sku where productId = p.productId order by price asc limit 1) as price,
+               cp.reducedPrice                                                                     AS "reducedPrice",
+               s.name                                                                              AS "shopName"
         FROM cm_promotions cp
+
                  LEFT JOIN cm_promotions_product cpp ON cp.id = cpp.promotionsId
                  LEFT JOIN product p ON cpp.productId = p.productID
                  LEFT JOIN shop s ON s.shopID = p.shopID
@@ -108,11 +110,16 @@
     </select>
 
     <select id="findGiftProduct" resultType="com.caimei.modules.product.entity.Product">
-        SELECT p.*,
+        SELECT cpg.skuId  AS "skuId",
+               cs.unit,
+               p.name,
+               p.mainImage,
+               p.productID,
                s.name     AS "shopName",
                cpg.number AS "giftNumber"
         FROM cm_promotions cp
                  LEFT JOIN cm_promotions_gift cpg ON cp.id = cpg.promotionsId
+                 left join cm_sku cs on cpg.skuId = cs.skuId
                  LEFT JOIN product p ON cpg.productId = p.productID
                  LEFT JOIN shop s ON s.shopID = p.shopID
         WHERE cp.id = #{id}
@@ -120,23 +127,23 @@
     </select>
 
     <select id="findGiftPurchaseProduct" resultType="com.caimei.modules.bulkpurchase.entity.PurchaseProduct">
-        SELECT p.name             name,
-               s.name             shopName,
-               s.`shopID`         shopId,
-               p.name             purchaseProductName,
-               p.`price`         price,
-               p.`productID`      productId,
-               p.productCode      productNo,
-               p.mainImage        image
-                ,
-               p.costCheckFlag    costCheckFlag,
-               p.costPrice        costPrice,
-               p.costProportional costProportional,
-               p.normalPrice    AS     normalPrice,
-               cpg.number  AS     num,
-               cp.discount as     discounts
+        SELECT p.name              name,
+               s.name              shopName,
+               s.`shopID`          shopId,
+               p.name              purchaseProductName,
+               cs.`price`          price,
+               p.`productID`       productId,
+               p.productCode       productNo,
+               p.mainImage         image,
+               cs.costCheckFlag    costCheckFlag,
+               cs.costPrice        costPrice,
+               cs.costProportional costProportional,
+               cs.normalPrice AS   normalPrice,
+               cpg.number     AS   num,
+               cp.discount    as   discounts
         FROM cm_promotions cp
                  LEFT JOIN cm_promotions_gift cpg ON cp.id = cpg.promotionsId
+                 left join cm_sku cs on cpg.skuId = cs.skuId
                  LEFT JOIN product p ON cpg.productId = p.productID
                  LEFT JOIN shop s ON s.shopID = p.shopID
         WHERE cp.id = #{id}
@@ -152,8 +159,10 @@
 
     <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
         SELECT
-        p.*,
-        s.name AS "shopName"
+        p.productId as productID,
+        p.mainImage as mainImage,
+        p.name as name,
+        s.name AS shopName
         FROM
         product p
         LEFT JOIN shop s ON s.shopID = p.shopID
@@ -161,7 +170,6 @@
             p.productCategory = 1
             and p.validFlag = 2
             and p.priceFlag != 1
-            and p.stock <![CDATA[   >  ]]> 0
             <if test="productID != null">
                 AND p.productID = #{productID}
             </if>
@@ -263,11 +271,13 @@
 
     <insert id="insertGiftProduct">
         INSERT INTO cm_promotions_gift(promotionsId,
+                                       skuId,
                                        productId,
                                        number,
                                        addTime)
         VALUES (#{promotionId},
                 #{giftId},
+                (select productId from cm_sku where skuId = #{giftId}),
                 #{number},
                 now())
     </insert>
@@ -351,9 +361,13 @@
                pr.status,
                prp.productId,
                prp.supplierId,
-               pr.discount
+               pr.discount,
+               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)))
@@ -413,8 +427,8 @@
     </select>
     <select id="getPresentPriceById" resultType="java.lang.Double">
         select price
-        from product
-        where productID = #{productId}
+        from cm_sku
+        where skuId = #{skuId}
     </select>
     <select id="findProductIdByPromotion" resultType="java.lang.Integer">
         select productId
@@ -426,4 +440,9 @@
         from product
         where shopID in (select supplierId from cm_promotions_product where promotionsId = #{promotionsId})
     </select>
+    <delete id="deletePromotion">
+        delete from cm_promotions_gift
+        where promotionsId=#{id}
+        and skuId=#{skuId}
+    </delete>
 </mapper>

+ 7 - 6
src/main/resources/mappings/modules/product/CmSecondHandDetailMapper.xml

@@ -42,19 +42,20 @@
 		p.validFlag AS "validFlag",
 		p.productCategory AS "productCategory",
 		p.name AS "name",
-		p.normalPrice AS "normalPrice",
-		p.price AS "price",
-		p.stock AS "stock",
+		cs.normalPrice AS "normalPrice",
+		cs.price AS "price",
+		cs.stock AS "stock",
 		p.brandID AS "brandID",
-		p.costPrice as "costPrice",
-		p.costCheckFlag AS "costCheckFlag",
-		p.costProportional AS "costProportional",
+		cs.costPrice as "costPrice",
+		cs.costCheckFlag AS "costCheckFlag",
+		cs.costProportional AS "costProportional",
 		p.visibility AS "visibility",
 		p.splitCode AS "splitCode"
 	</sql>
 
 	<sql id="cmSecondHandDetailJoins">
         left join product p on p.productID = a.productID
+		left join cm_sku cs on p.productId=cs.productId
 	</sql>
 
 	<select id="get" resultType="CmSecondHandDetail">

+ 1911 - 1850
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -2,13 +2,13 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.product.dao.ProductDao">
 
-	<resultMap  id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
-		<id  property="id" column="id"/>
-		<result  property="name" column="name"/>
-	</resultMap>
+    <resultMap id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
+        <id property="id" column="id"/>
+        <result property="name" column="name"/>
+    </resultMap>
 
-	<sql id="productColumns">
-		a.productID AS "id",
+    <sql id="productColumns">
+        a.productID AS "id",
 		a.productID AS "productID",
 		a.brandID AS "brandID",
 		a.bigTypeID AS "bigTypeID",
@@ -21,12 +21,8 @@
 		a.searchKey AS "searchKey",
 		a.combinationID AS "combinationID",
 		a.productRemarks AS "productRemarks",
-		a.normalPrice AS "normalPrice",
-		a.price AS "price",
 		a.priceFlag AS "priceFlag",
 		a.beautyActFlag AS "beautyActFlag",
-		a.ladderPriceFlag AS "ladderPriceFlag",
-		a.stock AS "stock",
 		a.hasSkuFlag AS "hasSkuFlag",
 		a.mainImage AS "mainImage",
 		a.propertiesInfo AS "propertiesInfo",
@@ -45,13 +41,10 @@
 		a.featuredFlag AS "featuredFlag",
 		a.featuredSortIndex AS "featuredSortIndex",
 		a.productCode AS "productCode",
-		a.unit AS "unit",
 		a.synToERPFlag AS "synToERPFlag",
 		a.allAreaFlag AS "allAreaFlag",
 		a.provinceIDs AS "provinceIDs",
 		a.serviceNumber AS "serviceNumber",
-		a.maxBuyNumber AS "maxBuyNumber",
-		a.minBuyNumber AS "minBuyNumber",
 		a.packageCount AS "packageCount",
 		a.byFlag AS "byFlag",
 		a.normalProductFlag AS "normalProductFlag",
@@ -65,9 +58,6 @@
 		a.onlineTime AS "onlineTime",
 		a.downlineTime AS "downlineTime",
 		a.freePostFlag AS "freePostFlag",
-		a.costPrice AS "costPrice",
-		a.costProportional AS "costProportional",
-		a.costCheckFlag AS "costCheckFlag",
 		a.precisehKey AS "precisehKey",
 		s.name AS "shopName",
 		a.actSort AS "actSort",
@@ -101,333 +91,324 @@
 
     </sql>
 
-	<sql id="productJoins">
-		LEFT JOIN shop s on s.shopID = a.shopID
+    <sql id="productJoins">
+        LEFT JOIN shop s on s.shopID = a.shopID
 		left join product p on a.productID = p.productId
-	</sql>
-	<sql id="ActivityJoins">
-		LEFT JOIN shop s on s.shopID = a.shopID
-	</sql>
-
-	<update id="saveSort">
-		UPDATE cm_search_recommend_product SET
-			sort = #{sort}
-		WHERE id = #{id}
-	</update>
-
-	<select id="findLadderPriceByNum" resultType="Integer">
-		select IFNULL(buyNum,1)
-		FROM product_ladder_price
-		WHERE  userType = 3 and ladderNum = 1 and delFlag = 0  and productID = #{productID}
-	</select>
-
-	<select id="get" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		WHERE a.productID = #{id}
-	</select>
-
-
-	<select id="getAllExistsProductList" resultType="Integer">
-		SELECT
-			a.productID
-		FROM cm_mall_organize_products a
-		WHERE a.delFlag = 0 and a.organizeID = #{organizeID}
-	</select>
-
-	<select id="findRecommendPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null and productID !=''">
-				AND a.productID=#{productID}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="speCommisionFlag !=null and speCommisionFlag !=''">
-				AND a.speCommisionFlag=#{speCommisionFlag}
-			</if>
-			<if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
-				AND a.displayOnCRMFlag=#{displayOnCRMFlag}
-			</if>
-			<if test="crmBigTypeId !=null and crmBigTypeId !=''">
-				AND a.crmBigTypeId=#{crmBigTypeId}
-			</if>
-			<if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
-				AND a.crmSmallTypeId=#{crmSmallTypeId}
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			<choose>
-				<when test="actType != null and actType != ''">
-					AND a.actType = #{actType}
-				</when>
-				<otherwise>
-					AND a.actType != 3
-				</otherwise>
-			</choose>
-			AND a.validFlag != 0
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<!--小程序商品获取采美2已上架 3已下架 9已冻结的商品-->
-	<select id="findListBuyMall" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null and productID !=''">
-				AND a.productID=#{productID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			AND a.validFlag in (2,3,9)
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findList" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
-				<if test="preferredFlag/100>=1">
-					AND a.preferredFlag in (100,101,110,111)
-				</if>
-				<if test="(preferredFlag%100)/10>=1">
-					AND a.preferredFlag in (10,11,110,111)
-				</if>
-				<if test="preferredFlag%10>=1">
-					AND a.preferredFlag in (1,11,101,111)
-				</if>
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actType !=null and actType !=''">
-				AND a.actType=#{actType}
-			</if>
-			<if test="speCommisionFlag !=null and speCommisionFlag !=''">
-				AND a.speCommisionFlag=#{speCommisionFlag}
-			</if>
-			<if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
-				AND a.displayOnCRMFlag=#{displayOnCRMFlag}
-			</if>
-			<if test="crmBigTypeId !=null and crmBigTypeId !=''">
-				AND a.crmBigTypeId=#{crmBigTypeId}
-			</if>
-			<if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
-				AND a.crmSmallTypeId=#{crmSmallTypeId}
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag != 0
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findAllList" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-
-		</choose>
-	</select>
+    </sql>
+    <sql id="ActivityJoins">
+        LEFT JOIN shop s on s.shopID = a.shopID
+    </sql>
+
+    <update id="saveSort">
+        UPDATE cm_search_recommend_product
+        SET sort = #{sort}
+        WHERE id = #{id}
+    </update>
+
+    <select id="findLadderPriceByNum" resultType="Integer">
+        select IFNULL(buyNum, 1)
+        FROM product_ladder_price
+        WHERE userType = 3
+          and ladderNum = 1
+          and delFlag = 0
+          and productID = #{productID}
+    </select>
+
+    <select id="get" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        WHERE a.productID = #{id}
+    </select>
+
+
+    <select id="getAllExistsProductList" resultType="Integer">
+        SELECT a.productID
+        FROM cm_mall_organize_products a
+        WHERE a.delFlag = 0
+          and a.organizeID = #{organizeID}
+    </select>
+
+    <select id="findRecommendPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null and productID !=''">
+                AND a.productID=#{productID}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="speCommisionFlag !=null and speCommisionFlag !=''">
+                AND a.speCommisionFlag=#{speCommisionFlag}
+            </if>
+            <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
+                AND a.displayOnCRMFlag=#{displayOnCRMFlag}
+            </if>
+            <if test="crmBigTypeId !=null and crmBigTypeId !=''">
+                AND a.crmBigTypeId=#{crmBigTypeId}
+            </if>
+            <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
+                AND a.crmSmallTypeId=#{crmSmallTypeId}
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            <choose>
+                <when test="actType != null and actType != ''">
+                    AND a.actType = #{actType}
+                </when>
+                <otherwise>
+                    AND a.actType != 3
+                </otherwise>
+            </choose>
+            AND a.validFlag != 0
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <!--小程序商品获取采美2已上架 3已下架 9已冻结的商品-->
+    <select id="findListBuyMall" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null and productID !=''">
+                AND a.productID=#{productID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            AND a.validFlag in (2,3,9)
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findList" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
+                <if test="preferredFlag/100>=1">
+                    AND a.preferredFlag in (100,101,110,111)
+                </if>
+                <if test="(preferredFlag%100)/10>=1">
+                    AND a.preferredFlag in (10,11,110,111)
+                </if>
+                <if test="preferredFlag%10>=1">
+                    AND a.preferredFlag in (1,11,101,111)
+                </if>
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actType !=null and actType !=''">
+                AND a.actType=#{actType}
+            </if>
+            <if test="speCommisionFlag !=null and speCommisionFlag !=''">
+                AND a.speCommisionFlag=#{speCommisionFlag}
+            </if>
+            <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
+                AND a.displayOnCRMFlag=#{displayOnCRMFlag}
+            </if>
+            <if test="crmBigTypeId !=null and crmBigTypeId !=''">
+                AND a.crmBigTypeId=#{crmBigTypeId}
+            </if>
+            <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
+                AND a.crmSmallTypeId=#{crmSmallTypeId}
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag != 0
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllList" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+
+        </choose>
+    </select>
 
     <insert id="insert" parameterType="Product" keyProperty="productID" keyColumn="productID" useGeneratedKeys="true">
         INSERT INTO product(brandID,
-                            bigTypeID,
-                            smallTypeID,
-                            tinyTypeID,
-                            selfTypeID,
-                            shopID,
-                            aliasName,
-                            name,
-                            searchKey,
-                            normalPrice,
-                            price,
-                            priceFlag,
-                            beautyActFlag,
-                            ladderPriceFlag,
-                             <if test="stock !=''">
-	                        	stock,
-                            </if>
-                            hasSkuFlag,
-                            mainImage,
-                            propertiesInfo,
-                            addTime,
-                            updateTime,
-                            weekSellNumber,
-                            beforeValidFlag,
-                            validFlag,
-                            favoriteTimes,
-                            commentScore,
-                            commentTimes,
-                            selfRecommendFlag,
-                            sysRecommendFlag,
-                            sortIndex,
-                            featuredFlag,
-                            featuredSortIndex,
-                            productCode,
-                            unit,
-                            synToERPFlag,
-                            allAreaFlag,
-                            provinceIDs,
-                            serviceNumber,
-                            maxBuyNumber,
-                            minBuyNumber,
-                            packageCount,
-                            byFlag,
-                            normalProductFlag,
-                            wholeSaleProductFlag,
-                            promotionProductFlag,
-                            groupBuyProductFlag,
-                            step,
-                            actFlag,
-                            actType,
-                            actSort,
-                            onlineTime,
-                            downlineTime,
-                            freePostFlag,
-                            costPrice,
-                            costProportional,
-                            costCheckFlag,
-                            precisehKey,
-                            visibility,
-							commodityDetailsFlag,
-                            productType,
-                            qualificationImg,
-                            invoiceType,
-                            taxPoint,
-                            supplierTaxPoint,
-                            tags,
-                            recommendType,
-                            machineType,
-                            includedTax,
-                            commodityType,
-                            trainingMethod,
-                            trainingType,
-                            trainingFee,
-                            productDescribe,
-                            splitCode,
-                            productDetail,
-                            announType,
-							newProductType,
-		<if test="qualificationNo != null and  qualificationNo != ''">
-			qualificationNo,
-		</if>
-		<if test="productName != null and  productName != ''">
-			productName,
-		</if>
-		<if test="qualificationTime != null and  qualificationTime != ''">
-			qualificationTime,
-		</if>
-		<if test="qualificationLink != null and  qualificationLink != ''">
-			qualificationLink,
-		</if>
-		showFlag)
+        bigTypeID,
+        smallTypeID,
+        tinyTypeID,
+        selfTypeID,
+        shopID,
+        aliasName,
+        name,
+        searchKey,
+        priceFlag,
+        beautyActFlag,
+        hasSkuFlag,
+        mainImage,
+        propertiesInfo,
+        addTime,
+        updateTime,
+        weekSellNumber,
+        beforeValidFlag,
+        validFlag,
+        favoriteTimes,
+        commentScore,
+        commentTimes,
+        selfRecommendFlag,
+        sysRecommendFlag,
+        sortIndex,
+        featuredFlag,
+        featuredSortIndex,
+        productCode,
+        synToERPFlag,
+        allAreaFlag,
+        provinceIDs,
+        serviceNumber,
+        packageCount,
+        byFlag,
+        normalProductFlag,
+        wholeSaleProductFlag,
+        promotionProductFlag,
+        groupBuyProductFlag,
+        step,
+        actFlag,
+        actType,
+        actSort,
+        onlineTime,
+        downlineTime,
+        freePostFlag,
+        precisehKey,
+        visibility,
+        commodityDetailsFlag,
+        productType,
+        qualificationImg,
+        invoiceType,
+        taxPoint,
+        supplierTaxPoint,
+        tags,
+        recommendType,
+        machineType,
+        includedTax,
+        commodityType,
+        trainingMethod,
+        trainingType,
+        trainingFee,
+        productDescribe,
+        splitCode,
+        productDetail,
+        announType,
+        newProductType,
+        <if test="qualificationNo != null and  qualificationNo != ''">
+            qualificationNo,
+        </if>
+        <if test="productName != null and  productName != ''">
+            productName,
+        </if>
+        <if test="qualificationTime != null and  qualificationTime != ''">
+            qualificationTime,
+        </if>
+        <if test="qualificationLink != null and  qualificationLink != ''">
+            qualificationLink,
+        </if>
+        showFlag)
         VALUES (#{brandID},
         #{bigTypeID},
         #{smallTypeID},
@@ -437,14 +418,8 @@
         #{aliasName},
         #{name},
         #{searchKey},
-        #{normalPrice},
-        #{price},
         #{priceFlag},
         #{beautyActFlag},
-        #{ladderPriceFlag},
-		<if test="stock !=''">
-			#{stock},
-		</if>
         #{hasSkuFlag},
         #{mainImage},
         #{propertiesInfo},
@@ -462,13 +437,10 @@
         #{featuredFlag},
         #{featuredSortIndex},
         #{productCode},
-        #{unit},
         #{synToERPFlag},
         #{allAreaFlag},
         #{provinceIDs},
         #{serviceNumber},
-        #{maxBuyNumber},
-        #{minBuyNumber},
         #{packageCount},
         #{byFlag},
         #{normalProductFlag},
@@ -482,9 +454,6 @@
         #{onlineTime},
         #{downlineTime},
         #{freePostFlag},
-        #{SqlCostPrice},
-        #{sqlCostProportional},
-        #{costCheckFlag},
         #{precisehKey},
         #{visibility},
         #{commodityDetailsFlag},
@@ -521,1504 +490,1596 @@
         #{showFlag})
     </insert>
 
-	<update id="update">
-		UPDATE product SET
-						   productID = #{id},
-						   brandID = #{brandID},
-						   tinyTypeID = #{tinyTypeID},
-						   selfTypeID = #{selfTypeID},
-						   shopID = #{shopID},
-						   name = #{name},
-						   searchKey = #{searchKey},
-						   normalPrice = #{normalPrice},
-						   price = #{price},
-						   priceFlag = #{priceFlag},
-						   beautyActFlag = #{beautyActFlag},
-						   ladderPriceFlag = #{ladderPriceFlag},
-						   stock = #{stock},
-						   hasSkuFlag = #{hasSkuFlag},
-						   mainImage = #{mainImage},
-						   propertiesInfo = #{propertiesInfo},
-						   addTime = #{addTime},
-						   updateTime = #{updateTime},
-						   sellNumber = #{sellNumber},
-						   weekSellNumber = #{weekSellNumber},
-						   beforeValidFlag = #{beforeValidFlag},
-						   validFlag = #{validFlag},
-						   favoriteTimes = #{favoriteTimes},
-						   commentScore = #{commentScore},
-						   commentTimes = #{commentTimes},
-						   selfRecommendFlag = #{selfRecommendFlag},
-						   sysRecommendFlag = #{sysRecommendFlag},
-						   sortIndex = #{sortIndex},
-						   featuredFlag = #{featuredFlag},
-						   featuredSortIndex = #{featuredSortIndex},
-						   productCode = #{productCode},
-						   unit = #{unit},
-						   synToERPFlag = #{synToERPFlag},
-						   allAreaFlag = #{allAreaFlag},
-						   provinceIDs = #{provinceIDs},
-						   serviceNumber = #{serviceNumber},
-						   maxBuyNumber = #{maxBuyNumber},
-						   minBuyNumber = #{minBuyNumber},
-						   packageCount = #{packageCount},
-						   byFlag = #{byFlag},
-						   normalProductFlag = #{normalProductFlag},
-						   wholeSaleProductFlag = #{wholeSaleProductFlag},
-						   promotionProductFlag = #{promotionProductFlag},
-						   groupBuyProductFlag = #{groupBuyProductFlag},
-						   step = #{step},
-						   actFlag = #{actFlag},
-						   actType = #{actType},
-						   onlineTime = #{onlineTime},
-						   downlineTime = #{downlineTime},
-						   freePostFlag = #{freePostFlag},
-						   costPrice = #{costPrice},
-						   costProportional = #{costProportional},
-						   costCheckFlag = #{costCheckFlag},
-						   precisehKey = #{precisehKey},
-						   actSort = #{actSort},
-						   newProductType=#{newProductType}
-
-		WHERE productID = #{id}
-	</update>
-	<select id="productList" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		*
-		FROM product a
-		<where>
-			a.newvalidFlag=1
-			<if test="productID !=null and productID !=''">
-				and a.productID=#{productID}
-			</if>
-		</where>
-	</select>
-	<select id="newfindProductImage" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null">
-				AND a.productID=#{productID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE concat('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE concat('%',#{shopName},'%')
-			</if>
-			<if test="showFlag !=null and showFlag !=''">
-				AND a.showFlag=#{showFlag}
-			</if>
-			<if test="ids != null and ids.size() > 0">
-				AND a.productID NOT IN
-				<foreach collection="ids" close=")" separator="," open="(" item="id">
-					#{id}
-				</foreach>
-			</if>
-			AND p.newvalidFlag = 1
-			AND p.newProductType=1
-			AND p.validFlag = 2
-			AND p.showFlag!=2
-
-		</where>
-# 		在设置重点关注时给排序值1000为了让重点关注始终在列表前端
-		order by a.sortIndex desc,a.newshowTime DESC
-	</select>
-	<update id="updateActive">
-		UPDATE product
-		<set>
-			<if test="actFlag != null and actFlag != ''">
-				actFlag = #{actFlag},
-			</if>
-			<if test="actType != null and actType != ''">
-				actType = #{actType},
-			</if>
-			<if test="actSort != null and actSort != ''">
-				actSort = #{actSort},
-			</if>
-			<if test="actCreateTime != null and actCreateTime != ''">
-				actCreateTime = #{actCreateTime},
-			</if>
-		</set>
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updatePreferred">
-		UPDATE product SET preferredFlag = #{preferredFlag}
-		WHERE productID = #{productID}
-	</update>
-
-	<delete id="delete">
-		DELETE FROM product
-		WHERE id = #{id}
-	</delete>
-
-	<update id="deleteProduct">
-		UPDATE cm_search_recommend_product
-		SET delFlag = #{DateTime}
-		WHERE id = #{id}
-	</update>
-
-
-	<select id="getAllActType" resultType="com.caimei.po.ActType">
-		SELECT
-			*
-		FROM acttype
-		where validFlag = 1
-	</select>
-
-
-
-	<select id="getSupplierProductList" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		*
-		FROM
-		product
-		<where>
-			<if test="name != null and name != ''">
-				AND name LIKE concat('%',#{name},'%')
-			</if>
-			AND shopID = #{shopID}
-			AND (validFlag = 1 or validFlag = 2 or validFlag = 3 or validFlag =  9)
-		</where>
-		ORDER BY addTime desc
-	</select>
-
-	<select id="getGiftProductInfo" parameterType="com.caimei.modules.product.entity.GiftProduct" resultType="com.caimei.modules.product.entity.GiftProduct">
-		SELECT
-		g.id as "id",
-		g.fullGiftProductId as "fullGiftProductId",
-		g.giftProductId as "giftProductId",
-		g.actType as "actType",
-		g.giftProductNum as "giftProductNum",
-		p.name as "productName"
-		FROM
-		gift_product g
-		left join  product p on p.productID = g.giftProductId
-		<where>
-			g.fullGiftProductId = #{fullGiftProductId}
-			AND g.actType = #{actType}
-			<if test="giftProductId != null and giftProductId != ''">
-				AND g.giftProductId =  #{giftProductId}
-			</if>
-			<if test="delFlag != null and delFlag != ''">
-				AND g.delFlag =  #{delFlag}
-			</if>
-			and p.productCategory = 1
-		</where>
-	</select>
-
-	<select id="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
-		SELECT
-		*
-		FROM
-		sku
-		<where>
-			productID = #{productId}
-			AND  validFlag = 1
-		</where>
-	</select>
-
-	<select id="findProductBigTypeByProductID" parameterType="java.lang.Integer" resultType="java.lang.String">
-		SELECT
-		tb.name
-		FROM
-		bigType AS tb
-		INNER JOIN smallType AS ts
-		ON tb.bigTypeID = ts.bigTypeID
-		INNER JOIN tinyType AS tt
-		ON ts.smallTypeID = tt.smallTypeID
-		INNER JOIN product AS tp
-		ON tt.tinyTypeID = tp.tinyTypeID
-		<where>
-			tp.productID = #{productId}
-			and tp.productCategory = 1
-		</where>
-	</select>
-
-	<update id="updateGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct">
-		update gift_product
-		<set >
-			<if test="fullGiftProductId != null and  !=''" >
-				fullGiftProductId = #{fullGiftProductId},
-			</if>
-			<if test="giftProductId != null and  !=''" >
-				giftProductId = #{giftProductId},
-			</if>
-			<if test="productName != null and  !=''" >
-				productName = #{productName},
-			</if>
-			<if test="actType != null and  !=''" >
-				actType = #{actType},
-			</if>
-			<if test="giftProductNum != null and  !=''" >
-				giftProductNum = #{giftProductNum},
-			</if>
-			<if test="createBy != null and  !=''" >
-				createBy = #{createBy.id},
-			</if>
-			<if test="createDate != null and  !=''" >
-				createDate = #{createDate},
-			</if>
-
-			<if test="updateBy != null and  !=''" >
-				updateBy = #{updateBy.id},
-			</if>
-			<if test="updateDate != null and  !=''" >
-				updateDate = #{updateDate},
-			</if>
-			<if test="delFlag != null and  !=''" >
-				delFlag = #{delFlag},
-			</if>
-		</set>
-		where id = #{id}
-	</update>
-
-	<insert id="insertGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO gift_product(
-			fullGiftProductId,
-			giftProductId,
-			productName,
-			actType,
-			giftProductNum,
-			createBy,
-			createDate,
-			updateBy,
-			updateDate,
-			delFlag
-		) VALUES (
-					 #{fullGiftProductId},
-					 #{giftProductId},
-					 #{productName},
-					 #{actType},
-					 #{giftProductNum},
-					 #{createBy.id},
-					 #{createDate},
-					 #{updateBy.id},
-					 #{updateDate},
-					 #{delFlag}
-				 )
-	</insert>
-
-
-	<insert id="insertProductPriceRecord" parameterType="com.caimei.modules.product.entity.ProductPriceRecord"  keyProperty="productPriceRecordID" useGeneratedKeys="true">
-		INSERT INTO productpricerecord(
-			`productID`,
-			`shopID`,
-			`highestUserLevelPrice`,
-			`lowestUserLevelPrice`,
-			`lowestUserLevelID`,
-			`price0`,
-			`price1`,
-			`updateTime`
-		)
-		VALUES
-			(
-				#{productID},
-				#{shopID},
-				#{highestUserLevelPrice},
-				#{lowestUserLevelPrice},
-				#{lowestUserLevelID},
-				#{price0},
-				#{price1},
-				#{updateTime}
-			)
-	</insert>
-
-	<!--	<update id="updateCRMFlag">-->
-	<!--		UPDATE product a SET a.displayOnCRMFlag = #{param1}-->
-	<!--		WHERE  a.productID IN-->
-	<!--		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >-->
-	<!--			#{id}-->
-	<!--		</foreach>-->
-	<!--	</update>-->
-
-	<update id="deleteActive">
-		UPDATE product a SET a.actFlag = 0
-		WHERE  a.productID = #{id}
-	</update>
-
-
-	<update id="updatePostFlag">
-		UPDATE product a SET a.freePostFlag = #{param1}
-		WHERE  a.productID IN
-		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
-			#{id}
-		</foreach>
-	</update>
-
-
-	<select id="getBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
-		select * from bigtype
-		<where>
-			validFlag = 1
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND bigTypeID = #{bigTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
-		select * from smalltype
-		<where>
-			validFlag = 1
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND bigTypeID = #{bigTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
-		select * from tinytype
-		<where>
-			validFlag = 1
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getProductTypeNameAndID" resultType="map">
-		select
-			b.name AS bigTypeName,
-			b.bigTypeID AS bigTypeID,
-			s.name AS smallTypeName,
-			s.smallTypeID AS smallTypeID,
-			t.name AS tinyTypeName,
-			t.tinyTypeID AS tinyTypeID
-		from tinytype AS t
-				 join smalltype AS s on t.smallTypeID = s.smallTypeID
-				 JOIN bigtype AS b on b.bigTypeID = s.bigTypeID
-		where t.tinyTypeID = #{tinyTypeID}
-	</select>
-
-	<delete id="deleteCustomClassification">
-		delete from product_custom_classification
-		where productID = #{productID}
-	</delete>
-
-	<insert id="insertCustomClassification" parameterType="com.caimei.modules.product.entity.ProductCustomClassification"  keyProperty="userId" useGeneratedKeys="true">
-		INSERT INTO product_custom_classification(
-			productID,
-			bigTypeID,
-			smallTypeID,
-			tinyTypeID,
-			createDate,
-			updateDate
-		) VALUES (
-					 #{productID},
-					 #{bigTypeID},
-					 #{smallTypeID},
-					 #{tinyTypeID},
-					 #{createDate},
-					 #{updateDate}
-				 )
-	</insert>
-
-	<insert id="insertAddProduct">
-		INSERT INTO cm_search_recommend_product(
-			productID,
-			tinyTypeID,
-			sort,
-			delFlag
-		) VALUES (
-					 #{productID},
-					 #{tinyTypeID},
-					 0,
-					 0
-				 )
-	</insert>
-	<insert id="insertLadderPrice">
-		insert into product_ladder_price (productId, userType, ladderNum,
-										  buyNum, buyPrice, createBy, createDate, delFlag)
-		values (#{productId}, 3, #{ladderNum},
-				#{buyNum}, #{buyPrice}, #{createBy},
-				#{createDate},'0')
-	</insert>
-
-	<insert id="insertProduct" keyColumn="productID" keyProperty="productID"  parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
-		INSERT INTO `product` (
-		`brandID`,
-		`tinyTypeID`,
-		<if test="productCategory != null and  productCategory != '' ">
-			`productCategory`,
-		</if>
-		`preferredFlag`,
-		`selfTypeID`,
-		`shopID`,
-		`name`,
-		`aliasName`,
-		`searchKey`,
-		`productRemarks`,
-		`normalPrice`,
-		`price`,
-		`priceFlag`,
-		`beautyActFlag`,
-		`ladderPriceFlag`,
-		<if test="stock != null and  stock != '' ">
-		`stock`,
-		</if>
-		`hasSkuFlag`,
-		`mainImage`,
-		`propertiesInfo`,
-		`addTime`,
-		`updateTime`,
-		`weekSellNumber`,
-		`beforeValidFlag`,
-		`validFlag`,
-		`favoriteTimes`,
-		`commentScore`,
-		`commentTimes`,
-		`selfRecommendFlag`,
-		`sysRecommendFlag`,
-		`sortIndex`,
-		`featuredFlag`,
-		`featuredSortIndex`,
-		`productCode`,
-		`unit`,
-		`synToERPFlag`,
-		`allAreaFlag`,
-		`provinceIDs`,
-		`serviceNumber`,
-		`maxBuyNumber`,
-		`minBuyNumber`,
-		`packageCount`,
-		`byFlag`,
-		`normalProductFlag`,
-		`wholeSaleProductFlag`,
-		`promotionProductFlag`,
-		`groupBuyProductFlag`,
-		`step`,
-		`actFlag`,
-		`actStatus`,
-		`actSort`,
-		`actType`,
-		`visibility`,
-		`onlineTime`,
-		`downlineTime`,
-		`freePostFlag`,
-		`costPrice`,
-		`costProportional`,
-		`costCheckFlag`,
-		`precisehKey`,
-		`tags`,
-		`productType`,
-		`machineType`,
-		`qualificationImg`,
-		`includedTax`,
-		`taxPoint`,
-		`invoiceType`,
-		`recommendType`,
-		`combinationID`,
-		`combinationSort`,
-		announType
-		)
-		VALUES
-		(
-		#{brandID},
-		#{tinyTypeID},
-		<if test="productCategory != null and  productCategory != '' ">
-			#{productCategory},
-		</if>
-		#{preferredFlag},
-		#{selfTypeID},
-		#{shopID},
-		#{name},
-		#{aliasName},
-		#{searchKey},
-		#{productRemarks},
-		#{normalPrice},
-		#{price},
-		#{priceFlag},
-		#{beautyActFlag},
-		#{ladderPriceFlag},
-		<if test="stock != null and  stock != '' ">
-		#{stock},
-		</if>
-		#{hasSkuFlag},
-		#{mainImage},
-		#{propertiesInfo},
-		#{addTime},
-		#{updateTime},
-		#{weekSellNumber},
-		#{beforeValidFlag},
-		#{validFlag},
-		#{favoriteTimes},
-		#{commentScore},
-		#{commentTimes},
-		#{selfRecommendFlag},
-		#{sysRecommendFlag},
-		#{sortIndex},
-		#{featuredFlag},
-		#{featuredSortIndex},
-		#{productCode},
-		#{unit},
-		#{synToERPFlag},
-		#{allAreaFlag},
-		#{provinceIDs},
-		#{serviceNumber},
-		#{maxBuyNumber},
-		#{minBuyNumber},
-		#{packageCount},
-		#{byFlag},
-		#{normalProductFlag},
-		#{wholeSaleProductFlag},
-		#{promotionProductFlag},
-		#{groupBuyProductFlag},
-		#{step},
-		#{actFlag},
-		#{actStatus},
-		#{actSort},
-		#{actType},
-		#{visibility},
-		#{onlineTime},
-		#{downlineTime},
-		#{freePostFlag},
-		#{costPrice},
-		#{costProportional},
-		#{costCheckFlag},
-		#{precisehKey},
-		#{tags},
-		#{productType},
-		#{machineType},
-		#{qualificationImg},
-		#{includedTax},
-		#{taxPoint},
-		#{invoiceType},
-		#{recommendType},
-		#{combinationID},
-		#{combinationSort},
-		#{announType}
-		)
-	</insert>
-
-	<insert id="insertProductDetailInfo">
-		insert into productdetailinfo
-		<trim prefix="(" suffix=")" suffixOverrides=",">
-			<if test="productID != null">
-				`productID`,
-			</if>
-			<if test="detailInfo != null and detailInfo != ''">
-				`detailInfo`,
-			</if>
-			<if test="serviceInfo != null and serviceInfo != ''">
-				`serviceInfo`,
-			</if>
-			<if test="orderInfo != null and orderInfo != ''">
-				`orderInfo`,
-			</if>
-		</trim>
-		<trim prefix="values (" suffix=")" suffixOverrides=",">
-			<if test="productID != null">
-				#{productID},
-			</if>
-			<if test="detailInfo != null and detailInfo != ''">
-				#{detailInfo},
-			</if>
-			<if test="serviceInfo != null and serviceInfo != ''">
-				#{serviceInfo},
-			</if>
-			<if test="orderInfo != null and orderInfo != ''">
-				#{orderInfo},
-			</if>
-		</trim>
-	</insert>
-
-	<select id="getrecommendProductList" resultType="product">
-		select
-		a.*,
-		csrp.sort AS sort,
-		csrp.id AS recommendProductId,
-		b.name AS brandName,
-		s.name AS shopName
-		FROM
-		cm_search_recommend_product csrp
-		LEFT JOIN  product a on a.productID = csrp.productID
-		LEFT JOIN shop s on s.shopID = a.shopID
-		left join cm_brand b on b.id = a.brandID
-		WHERE
-		csrp.tinyTypeId = #{tinyTypeID}
-		<if test="name != null and name != ''">
-			AND a.name like concat('%', #{name} ,'%')
-		</if>
-		<if test="validFlag !=null and validFlag !=''">
-			AND a.validFlag=#{validFlag}
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name like concat('%', #{shopName} ,'%')
-		</if>
-		<if test="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		and a.productCategory = 1
-		AND a.validFlag != 0
-		AND csrp.delFlag =0
-		ORDER BY csrp.sort DESC
-	</select>
-
-
-	<select id="relatedProductList" resultType="product">
-		select
-		<include refid="productColumns"/>,
-		b.name AS brandName,
-		(case when a.tinyTypeID = #{tinyTypeID} then '1' else '0' end) AS defaultType
-		FROM product a
-		<include refid="productJoins"/>
-		left join brand b on b.brandID = a.brandID
-		WHERE (a.productID
-		IN (select productID from product_custom_classification where tinyTypeID = #{tinyTypeID})
-		OR a.tinyTypeID = #{tinyTypeID})
-		<if test="name != null and name != ''">
-			AND a.name like concat('%', #{name} ,'%')
-		</if>
-		<if test="validFlag !=null and validFlag !=''">
-			AND a.validFlag=#{validFlag}
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name like concat('%', #{shopName} ,'%')
-		</if>
-		<if test="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		AND a.validFlag != 0
-		and a.productCategory = 1
-	</select>
-
-	<delete id="deleteProductCustomClassification">
-		delete from product_custom_classification
-		where productID = #{productID} and tinyTypeID = #{tinyTypeID}
-	</delete>
-	<delete id="deleteLadderPriceByProductId">
-		DELETE FROM product_ladder_price where productId = #{productID}
-	</delete>
-	<delete id="deleteLadderPriceById">
-		DELETE FROM product_ladder_price where id = #{id}
-	</delete>
-
-	<select id="toAddProductCustomClassificationList" resultType="product">
-		select
-		<include refid="productColumns"/>,
-		b.name AS brandName
-		FROM product a
-		<include refid="productJoins"/>
-		left join cm_brand b on b.id = a.brandID
-		WHERE a.tinyTypeID != #{tinyTypeID}
-		and not exists
-		(select pcc.id from product_custom_classification pcc where pcc.productID = a.productID and pcc.tinyTypeID = #{tinyTypeID})
-		and a.validFlag = '2'
-		and (select count(id) from product_custom_classification pcc where pcc.productID = a.productID) <![CDATA[ < ]]> 5
-		<if test="name != null and name != ''">
-			and a.name like concat('%', #{name} ,'%')
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name like concat('%', #{shopName} ,'%')
-		</if>
-		<if test="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-	</select>
-
-
-	<select id="toAddProductList" resultType="product">
-		select
-		a.*,
-		b.name AS brandName,
-		s.name AS shopName
-		FROM product a
-		LEFT JOIN shop s on s.shopID = a.shopID
-		left join cm_brand b on b.id = a.brandID
-		WHERE
-		NOT EXISTS (select * from cm_search_recommend_product csrp where  csrp.productID = a.productID  and csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
-		and a.validFlag = '2'
-		<if test="name != null and name != ''">
-			and a.name like concat('%', #{name} ,'%')
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name like concat('%', #{shopName} ,'%')
-		</if>
-		<if test="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		and a.productCategory = 1
-	</select>
-
-	<select id="getProductTypes" resultType="com.caimei.modules.product.entity.ProductCustomClassification">
-		select *
-		from product_custom_classification where productID = #{productID}
-	</select>
-
-
-	<select id="findRecommendActivityListPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-
-
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag = 2
-			AND (a.actType != 3 or a.`actType` IS NULL or (a.actType = 3 and STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i')))
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findGroupActivityListPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actStatus != null and actStatus != '' and actStatus == 1">
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
-			</if>
-			<if test="actStatus != null and actStatus != '' and actStatus == 2">
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  >  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag = 2
-			AND ((a.actType != 1 AND a.actType != 2 OR a.`actType` IS NULL) or a.actFlag = 0)
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
-		SELECT
-		*
-		FROM bigtype a
-		<where>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-
-		</where>
-	</select>
-	<select id="findSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
-		SELECT
-		*
-		FROM smalltype a
-		<where>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-		</where>
-	</select>
-	<select id="findTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
-		SELECT
-		*
-		FROM tinytype a
-		<where>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-		</where>
-	</select>
-
-	<select id="findProductRecommendList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
-		select
-			cpr.id AS id,
-			cpr.productID AS productID,
-			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
-				 join product pro on cpr.recommendProductID = pro.productID
-		where cpr.productID = #{productID}
-		order by cpr.sort desc
-	</select>
-
-	<select id="findProductRecommendCount" resultType="int">
-		select
-			count(1)
-		from cm_product_recommend cpr
-		where cpr.productID = #{productID}
-	</select>
-
-	<select id="findProductList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
-		select
-		a.productID AS productID,
-		a.name AS productName,
-		a.unit AS unit,
-		a.mainImage AS img,
-		s.name AS shopName
-		from product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<choose>
-				<when test="commodityType != null and commodityType != ''">
-					AND a.commodityType = #{commodityType}
-				</when>
-				<when test="bigTypeID != null and bigTypeID != ''">
-					AND a.bigTypeID = #{bigTypeID}
-				</when>
-				<when test="smallTypeID != null and smallTypeID != ''">
-					AND a.smallTypeID = #{smallTypeID}
-				</when>
-				<when test="tinyTypeID != null and tinyTypeID != ''">
-					AND a.tinyTypeID = #{tinyTypeID}
-				</when>
-			</choose>
-			<if test="productName != null and productName != ''">
-				and a.name like concat('%', #{productName} ,'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				and s.name like concat('%', #{shopName} ,'%')
-			</if>
-			and a.productCategory = 1
-		</where>
-		<!--		limit 0, 10-->
-	</select>
-
-	<update id="updateRecommendType">
-		UPDATE product SET
-			recommendType = #{recommendType}
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updateBrnadId">
-		UPDATE product
-		set brandID = #{brandID}
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updateProductByBrandId">
-		UPDATE product
-		set  brandID = null
-		WHERE brandID = #{brandId}
-	</update>
-	<select id="getProductIdByBrandId" resultType="java.lang.Integer">
-		SELECT productID FROM product WHERE brandID = #{brandId}
-	</select>
-	<update id="updateTinyType">
-		UPDATE product
-		set tinyTypeID = #{tinyTypeID}
-		WHERE productID = #{productID}
-	</update>
-	<update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
-		update product
-		<set>
-			<if test="productDescribe != null and productDescribe != ''">
-				productDescribe = #{productDescribe},
-			</if>
-			<if test="productDetail != null and productDetail != ''">
-				productDetail = #{productDetail},
-			</if>
-			<if test="brandID != null and brandID != ''">
-				brandID = #{brandID},
-			</if>
-			<if test="bigTypeID != null and bigTypeID !=''">
-				bigTypeID = #{bigTypeID},
-				smallTypeID = #{smallTypeID},
-				tinyTypeID = #{tinyTypeID},
-			</if>
-			<if test="preferredFlag != null and preferredFlag !=''">
-				preferredFlag = #{preferredFlag},
-			</if>
-			<if test="shopID != null and shopID !=''">
-				shopID = #{shopID},
-			</if>
-			<if test="name != null and name !=''">
-				`name` = #{name},
-			</if>
-			<if test="aliasName != null and aliasName !=''">
-				aliasName = #{aliasName},
-			</if>
-			<if test="searchKey != null and searchKey !=''">
-				searchKey = #{searchKey},
-			</if>
-			<if test="productRemarks != null and productRemarks !=''">
-				productRemarks = #{productRemarks},
-			</if>
-			<if test="combinationID != null and combinationID !=''">
-				combinationID = #{combinationID},
-			</if>
-			<if test="normalPrice != null and normalPrice !=''">
-				normalPrice = #{normalPrice},
-			</if>
-			<if test="price != null and price !=''">
-				price = #{price},
-			</if>
-			<if test="priceFlag != null and priceFlag !=''">
-				priceFlag = #{priceFlag},
-			</if>
-			<if test="beautyActFlag != null and beautyActFlag !=''">
-				beautyActFlag = #{beautyActFlag},
-			</if>
-			<if test="ladderPriceFlag != null and ladderPriceFlag !=''">
-				ladderPriceFlag = #{ladderPriceFlag},
-			</if>
-			<if test="stock != null and stock !=''">
-				stock = #{stock},
-			</if>
-			<if test="hasSkuFlag != null and hasSkuFlag !=''">
-				hasSkuFlag = #{hasSkuFlag},
-			</if>
-			<if test="mainImage != null and mainImage !=''">
-				mainImage = #{mainImage},
-			</if>
-			<if test="propertiesInfo != null and propertiesInfo !=''">
-				propertiesInfo = #{propertiesInfo},
-			</if>
-			<if test="addTime != null and addTime !=''">
-				addTime = #{addTime},
-			</if>
-			<if test="updateTime != null and updateTime !=''">
-				updateTime = #{updateTime},
-			</if>
-			<if test="weekSellNumber != null and weekSellNumber !=''">
-				weekSellNumber = #{weekSellNumber},
-			</if>
-			<if test="beforeValidFlag != null and beforeValidFlag !=''">
-				beforeValidFlag = #{beforeValidFlag},
-			</if>
-			<if test="validFlag != null and validFlag !=''">
-				validFlag = #{validFlag},
-			</if>
-			<if test="favoriteTimes != null and favoriteTimes !=''">
-				favoriteTimes = #{favoriteTimes},
-			</if>
-			<if test="commentScore != null and commentScore !=''">
-				commentScore = #{commentScore},
-			</if>
-			<if test="commentTimes != null and commentTimes !=''">
-				commentTimes = #{commentTimes},
-			</if>
-			<if test="selfRecommendFlag != null and selfRecommendFlag !=''">
-				selfRecommendFlag = #{selfRecommendFlag},
-			</if>
-			<if test="sysRecommendFlag != null and sysRecommendFlag !=''">
-				sysRecommendFlag = #{sysRecommendFlag},
-			</if>
-			<if test="sortIndex != null and sortIndex != ''">
-				sortIndex = #{sortIndex},
-			</if>
-			<if test="featuredFlag != null and featuredFlag !=''">
-				featuredFlag = #{featuredFlag},
-			</if>
-			<if test="featuredSortIndex != null and featuredSortIndex !=''">
-				featuredSortIndex = #{featuredSortIndex},
-			</if>
-			<if test="productCode != null and productCode !=''">
-				productCode = #{productCode},
-			</if>
-			<if test="unit != null and unit !=''">
-				unit = #{unit},
-			</if>
-			<if test="synToERPFlag != null and synToERPFlag !=''">
-				synToERPFlag = #{synToERPFlag},
-			</if>
-			<if test="allAreaFlag != null and allAreaFlag !=''">
-				allAreaFlag = #{allAreaFlag},
-			</if>
-			<if test="provinceIDs != null and provinceIDs !=''">
-				provinceIDs = #{provinceIDs},
-			</if>
-			<if test="serviceNumber != null and serviceNumber !=''">
-				serviceNumber = #{serviceNumber},
-			</if>
-			<if test="maxBuyNumber != null and maxBuyNumber !=''">
-				maxBuyNumber = #{maxBuyNumber},
-			</if>
-			<if test="minBuyNumber != null and minBuyNumber !=''">
-				minBuyNumber = #{minBuyNumber},
-			</if>
-			<if test="packageCount != null and packageCount !=''">
-				packageCount = #{packageCount},
-			</if>
-			<if test="byFlag != null and byFlag !=''">
-				byFlag = #{byFlag},
-			</if>
-			<if test="normalProductFlag != null and normalProductFlag !=''">
-				normalProductFlag = #{normalProductFlag},
-			</if>
-			<if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">
-				wholeSaleProductFlag = #{wholeSaleProductFlag},
-			</if>
-			<if test="promotionProductFlag != null and promotionProductFlag !=''">
-				promotionProductFlag = #{promotionProductFlag},
-			</if>
-			<if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">
-				groupBuyProductFlag = #{groupBuyProductFlag},
-			</if>
-			<if test="step != null and step !=''">
-				step = #{step},
-			</if>
-			<if test="actFlag != null and actFlag !=''">
-				actFlag = #{actFlag},
-			</if>
-			<if test="actSort != null and actSort !=''">
-				actSort = #{actSort},
-			</if>
-			<if test="actType != null and actType !=''">
-				actType = #{actType},
-			</if>
-			<if test="onlineTime != null and onlineTime !=''">
-				onlineTime = #{onlineTime},
-			</if>
-			<if test="downlineTime != null and downlineTime !=''">
-				downlineTime = #{downlineTime},
-			</if>
-			<if test="freePostFlag != null and freePostFlag !=''">
-				freePostFlag = #{freePostFlag},
-			</if>
-			<if test="costPrice != null and costPrice != ''">
-				costPrice = #{costPrice},
-			</if>
-			<if test="costProportional != null and costProportional !=''">
-				costProportional = #{costProportional},
-			</if>
-			<if test="costCheckFlag != null and costCheckFlag !=''">
-				costCheckFlag = #{costCheckFlag},
-			</if>
-			<if test="precisehKey != null and precisehKey !=''">
-				precisehKey = #{precisehKey},
-			</if>
-			<if test="visibility != null and visibility !=''">
-				visibility = #{visibility},
-			</if>
-		    <if test="commodityDetailsFlag != null and commodityDetailsFlag != ''">
-				commodityDetailsFlag = #{commodityDetailsFlag},
-			</if>
-			<if test="productType != null and productType !=''">
-				productType = #{productType},
-			</if>
-			<if test="qualificationImg != null and qualificationImg !=''">
-				qualificationImg = #{qualificationImg},
-			</if>
-			<if test="qualificationImg != null and qualificationImg !=''">
-				qualificationImg = #{qualificationImg},
-			</if>
-			<if test="invoiceType != null and invoiceType !=''">
-				invoiceType = #{invoiceType},
-			</if>
-			<if test="taxPoint != null and taxPoint !=''">
-				taxPoint = #{taxPoint},
-			</if>
-			<if test="supplierTaxPoint != null and supplierTaxPoint !=''">
-				supplierTaxPoint = #{supplierTaxPoint},
-			</if>
-			<if test="endTimeStr != null and endTimeStr !=''">
-				endTimeStr = #{endTimeStr},
-			</if>
-			<if test="tags != null and tags !=''">
-				tags = #{tags},
-			</if>
-			<if test="recommendType != null and recommendType !=''">
-				recommendType = #{recommendType},
-			</if>
-			<if test="machineType != null and machineType !=''">
-				machineType = #{machineType},
-			</if>
-			<if test="includedTax != null and includedTax !=''">
-				includedTax = #{includedTax},
-			</if>
-			<if test="invoiceType != null and invoiceType !=''">
-				invoiceType = #{invoiceType},
-			</if>
-			<if test="commodityType != null and commodityType != ''">
-				commodityType = #{commodityType},
-			</if>
-			<if test="trainingMethod != null">
-				trainingMethod = #{trainingMethod},
-			</if>
-			<if test="trainingType != null">
-				trainingType = #{trainingType},
-			</if>
-			<if test="trainingFee != null">
-				trainingFee = #{trainingFee},
-			</if>
-		    <if test="qualificationNo !=null and qualificationNo != ''">
-				qualificationNo=#{qualificationNo},
-			</if>
-			<if test="productName !=null and productName !=''">
-				productName=#{productName},
-			</if>
-			<if test="qualificationTime !=null and qualificationTime!=''">
-				qualificationTime=#{qualificationTime},
-			</if>
-			<if test="qualificationLink !=null and qualificationLink!=''">
-				qualificationLink=#{qualificationLink},
-			</if>
-
-			newProductType=#{newProductType},
-			showFlag=#{showFlag},
-			announType=#{announType},
-			splitCode = #{splitCode}
-		</set>
-		where productID = #{productID}
-	</update>
-	<update id="updateproductDetailInfo" parameterType="com.caimei.modules.product.entity.ProductDetailInfo">
-		update productdetailinfo
-		<set>
-			<if test="propValueAlias != null and propValueAlias != ''">
-				propValueAlias = #{propValueAlias},
-			</if>
-			<if test="propValueImages != null and propValueImages !=''">
-				propValueImages = #{propValueImages},
-			</if>
-			<if test="detailInfo != null">
-				detailInfo = #{detailInfo},
-			</if>
-			<if test="commonDetailInfo != null">
-				commonDetailInfo = #{commonDetailInfo},
-			</if>
-			<if test="detailInfoTxt != null">
-				detailInfoTxt = #{detailInfoTxt},
-			</if>
-			<if test="seoTitle != null and seoTitle !=''">
-				seoTitle = #{seoTitle},
-			</if>
-			<if test="seoKeyword != null and seoKeyword !=''">
-				seoKeyword = #{seoKeyword},
-			</if>
-			<if test="seoDes != null and seoDes !=''">
-				seoDes = #{seoDes},
-			</if>
-			<if test="serviceInfo != null ">
-				serviceInfo = #{serviceInfo},
-			</if>
-			<if test="orderInfo != null ">
-				orderInfo = #{orderInfo},
-			</if>
-		</set>
-		where productID = #{productID}
-	</update>
-	<update id="updateLadderPrice">
-		update product_ladder_price
-		set productId = #{productId},
-			ladderNum = #{ladderNum},
-			buyNum = #{buyNum},
-			buyPrice = #{buyPrice},
-			updateBy = #{updateBy},
-			updateDate = #{updateDate},
-			delFlag = #{delFlag}
-		where id = #{id}
-	</update>
-	<update id="updateMainImage">
-		update product
-		set mainImage =#{mainImage}
-		where productID=#{productID}
-	</update>
-
-	<select id="getProductByTypeName" resultType="com.caimei.modules.brand.entity.BrandAndProductType">
-		select
-			b.name AS "bigTypeName",b.bigTypeID,s.`name` AS "smallTypeName",s.smalltypeID,t.name AS "tinyTypeName" ,t.tinytypeID
-		from tinytype  t LEFT JOIN smalltype  s on  t.smallTypeID = s.smallTypeID  LEFT JOIN bigtype b ON b.bigTypeID = s.bigTypeID
-		where  b.`name` = #{name} AND s.`name` = #{name1} AND t.name = #{name2}
-	</select>
-
-	<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
-				 left join shop s on s.shopID = p.shopID
-		where p.tinyTypeID = #{tinyTypeID} and p.productCategory = 1
-		order by p.sellNumber
-				desc limit 0, 7
-	</select>
-
-	<select id="getSecondHandRecommend" resultType="CmSecondHandRecommendVo">
-		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"
-		from product p
-				 left join shop s on s.shopID = p.shopID
-		where p.productID = #{productID}
-		  AND p.validFlag = '2'
-	</select>
-
-	<select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
-		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"
-		from product p
-		left join shop s on s.shopID = p.shopID
-		<where>
-			<if test="productID != null and productID != ''">
-				p.productID = #{productID}
-			</if>
-			<if test="productName != null and productName != ''">
-				and p.name like concat('%', #{productName} ,'%')
-			</if>
-			AND p.validFlag = '2'
-			and p.productCategory = #{queryProductType}
-		</where>
-		limit 0, 10
-	</select>
-	<select id="queryProductDetailInfo" resultType="com.caimei.modules.product.entity.ProductDetailInfo">
-		SELECT * FROM
-			productdetailinfo
-		where productID = #{productID}
-	</select>
-	<select id="qualification" resultType="com.caimei.modules.product.entity.Product">
-		SELECT qualificationNo,productName,qualificationTime,qualificationLink FROM product
-		where productID = #{productID}
-	</select>
-	<select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
-		SELECT *
-		FROM product_ladder_price
-		WHERE
-			productId = #{productId}
-		  AND userType = #{userType}
-		  AND buyNum is NOT null
-		  AND buyPrice is NOT null
-		  AND delFlag = 0
-		ORDER BY ladderNum ASC
-	</select>
-	<select id="findActList" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actType !=null and actType !=''">
-				AND a.actType=#{actType}
-			</if>
-			AND a.actStatus = 1
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
-		select p.productID,p.mainImage,p.name,s.name as shopName from product p left join shop s on p.shopID = s.shopID
-		<where>
-			(p.actFlag=0 or p.actType is null) and p.validFlag = 2 and p.productCategory = 1
-			<if test="productIds != null and productIds != '' ">
-				and p.productID != #{productIds}
-			</if>
-			<if test="productID != null and productID != ''">
-				and p.productID = #{productID}
-			</if>
-			<if test="name != null and name != ''">
-				and p.name like concat('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				and s.name like concat('%',#{shopName},'%')
-			</if>
-		</where>
-		order by productID asc
-	</select>
-
-	<select id="findProductImage" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null">
-				AND a.productID=#{productID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="name != null and name != ''">
-				AND a.name LIKE concat('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				AND s.name LIKE concat('%',#{shopName},'%')
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="productCategory !=null and productCategory !=''">
-				AND a.productCategory=#{productCategory}
-			</if>
-			<if test="ids != null and ids.size() > 0">
-				AND a.productID NOT IN
-				<foreach collection="ids" close=")" separator="," open="(" item="id">
-					#{id}
-				</foreach>
-			</if>
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID asc
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findProductDetail" resultType="java.lang.String">
-		select productDetail from product where productID = #{productID}
-	</select>
-	<select id="findProductDescribe" resultType="java.lang.String">
-		select productDescribe from product where productID = #{productID}
-	</select>
-	<select id="findSepcialShopList" resultType="com.caimei.modules.product.entity.CmShop">
-		select name,shopID
-		from shop
-		where shopType=2
-	</select>
+    <update id="update">
+        UPDATE product
+        SET productID            = #{id},
+            brandID              = #{brandID},
+            tinyTypeID           = #{tinyTypeID},
+            selfTypeID           = #{selfTypeID},
+            shopID               = #{shopID},
+            name                 = #{name},
+            searchKey            = #{searchKey},
+            priceFlag            = #{priceFlag},
+            beautyActFlag        = #{beautyActFlag},
+            hasSkuFlag           = #{hasSkuFlag},
+            mainImage            = #{mainImage},
+            propertiesInfo       = #{propertiesInfo},
+            addTime              = #{addTime},
+            updateTime           = #{updateTime},
+            sellNumber           = #{sellNumber},
+            weekSellNumber       = #{weekSellNumber},
+            beforeValidFlag      = #{beforeValidFlag},
+            validFlag            = #{validFlag},
+            favoriteTimes        = #{favoriteTimes},
+            commentScore         = #{commentScore},
+            commentTimes         = #{commentTimes},
+            selfRecommendFlag    = #{selfRecommendFlag},
+            sysRecommendFlag     = #{sysRecommendFlag},
+            sortIndex            = #{sortIndex},
+            featuredFlag         = #{featuredFlag},
+            featuredSortIndex    = #{featuredSortIndex},
+            productCode          = #{productCode},
+            synToERPFlag         = #{synToERPFlag},
+            allAreaFlag          = #{allAreaFlag},
+            provinceIDs          = #{provinceIDs},
+            serviceNumber        = #{serviceNumber},
+            packageCount         = #{packageCount},
+            byFlag               = #{byFlag},
+            normalProductFlag    = #{normalProductFlag},
+            wholeSaleProductFlag = #{wholeSaleProductFlag},
+            promotionProductFlag = #{promotionProductFlag},
+            groupBuyProductFlag  = #{groupBuyProductFlag},
+            step                 = #{step},
+            actFlag              = #{actFlag},
+            actType              = #{actType},
+            onlineTime           = #{onlineTime},
+            downlineTime         = #{downlineTime},
+            freePostFlag         = #{freePostFlag},
+            precisehKey          = #{precisehKey},
+            actSort              = #{actSort},
+            newProductType=#{newProductType}
+
+        WHERE productID = #{id}
+    </update>
+    <select id="productList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        *
+        FROM product a
+        <where>
+            a.newvalidFlag=1
+            <if test="productID !=null and productID !=''">
+                and a.productID=#{productID}
+            </if>
+        </where>
+    </select>
+    <select id="newfindProductImage" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null">
+                AND a.productID=#{productID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE concat('%',#{shopName},'%')
+            </if>
+            <if test="showFlag !=null and showFlag !=''">
+                AND a.showFlag=#{showFlag}
+            </if>
+            <if test="ids != null and ids.size() > 0">
+                AND a.productID NOT IN
+                <foreach collection="ids" close=")" separator="," open="(" item="id">
+                    #{id}
+                </foreach>
+            </if>
+            AND p.newvalidFlag = 1
+            AND p.newProductType=1
+            AND p.validFlag = 2
+            AND p.showFlag!=2
+
+        </where>
+        # 在设置重点关注时给排序值1000为了让重点关注始终在列表前端
+        order by a.sortIndex desc,a.newshowTime DESC
+    </select>
+    <update id="updateActive">
+        UPDATE product
+        <set>
+            <if test="actFlag != null and actFlag != ''">
+                actFlag = #{actFlag},
+            </if>
+            <if test="actType != null and actType != ''">
+                actType = #{actType},
+            </if>
+            <if test="actSort != null and actSort != ''">
+                actSort = #{actSort},
+            </if>
+            <if test="actCreateTime != null and actCreateTime != ''">
+                actCreateTime = #{actCreateTime},
+            </if>
+        </set>
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updatePreferred">
+        UPDATE product
+        SET preferredFlag = #{preferredFlag}
+        WHERE productID = #{productID}
+    </update>
+
+    <delete id="delete">
+        DELETE
+        FROM product
+        WHERE id = #{id}
+    </delete>
+
+    <update id="deleteProduct">
+        UPDATE cm_search_recommend_product
+        SET delFlag = #{DateTime}
+        WHERE id = #{id}
+    </update>
+
+
+    <select id="getAllActType" resultType="com.caimei.po.ActType">
+        SELECT *
+        FROM acttype
+        where validFlag = 1
+    </select>
+
+
+    <select id="getSupplierProductList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        *
+        FROM
+        product
+        <where>
+            <if test="name != null and name != ''">
+                AND name LIKE concat('%',#{name},'%')
+            </if>
+            AND shopID = #{shopID}
+            AND (validFlag = 1 or validFlag = 2 or validFlag = 3 or validFlag = 9)
+        </where>
+        ORDER BY addTime desc
+    </select>
+
+    <select id="getGiftProductInfo" parameterType="com.caimei.modules.product.entity.GiftProduct"
+            resultType="com.caimei.modules.product.entity.GiftProduct">
+        SELECT
+        g.id as "id",
+        g.fullGiftProductId as "fullGiftProductId",
+        g.giftProductId as "giftProductId",
+        g.actType as "actType",
+        g.giftProductNum as "giftProductNum",
+        p.name as "productName"
+        FROM
+        gift_product g
+        left join product p on p.productID = g.giftProductId
+        <where>
+            g.fullGiftProductId = #{fullGiftProductId}
+            AND g.actType = #{actType}
+            <if test="giftProductId != null and giftProductId != ''">
+                AND g.giftProductId = #{giftProductId}
+            </if>
+            <if test="delFlag != null and delFlag != ''">
+                AND g.delFlag = #{delFlag}
+            </if>
+            and p.productCategory = 1
+        </where>
+    </select>
+
+    <select id="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
+        SELECT
+        *
+        FROM
+        sku
+        <where>
+            productID = #{productId}
+            AND validFlag = 1
+        </where>
+    </select>
+
+    <select id="findProductBigTypeByProductID" parameterType="java.lang.Integer" resultType="java.lang.String">
+        SELECT
+        tb.name
+        FROM
+        bigType AS tb
+        INNER JOIN smallType AS ts
+        ON tb.bigTypeID = ts.bigTypeID
+        INNER JOIN tinyType AS tt
+        ON ts.smallTypeID = tt.smallTypeID
+        INNER JOIN product AS tp
+        ON tt.tinyTypeID = tp.tinyTypeID
+        <where>
+            tp.productID = #{productId}
+            and tp.productCategory = 1
+        </where>
+    </select>
+
+    <update id="updateGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct">
+        update gift_product
+        <set>
+            <if test="fullGiftProductId != null and  !=''">
+                fullGiftProductId = #{fullGiftProductId},
+            </if>
+            <if test="giftProductId != null and  !=''">
+                giftProductId = #{giftProductId},
+            </if>
+            <if test="productName != null and  !=''">
+                productName = #{productName},
+            </if>
+            <if test="actType != null and  !=''">
+                actType = #{actType},
+            </if>
+            <if test="giftProductNum != null and  !=''">
+                giftProductNum = #{giftProductNum},
+            </if>
+            <if test="createBy != null and  !=''">
+                createBy = #{createBy.id},
+            </if>
+            <if test="createDate != null and  !=''">
+                createDate = #{createDate},
+            </if>
+
+            <if test="updateBy != null and  !=''">
+                updateBy = #{updateBy.id},
+            </if>
+            <if test="updateDate != null and  !=''">
+                updateDate = #{updateDate},
+            </if>
+            <if test="delFlag != null and  !=''">
+                delFlag = #{delFlag},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <insert id="insertGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct" keyProperty="id"
+            useGeneratedKeys="true">
+        INSERT INTO gift_product(fullGiftProductId,
+                                 giftProductId,
+                                 productName,
+                                 actType,
+                                 giftProductNum,
+                                 createBy,
+                                 createDate,
+                                 updateBy,
+                                 updateDate,
+                                 delFlag)
+        VALUES (#{fullGiftProductId},
+                #{giftProductId},
+                #{productName},
+                #{actType},
+                #{giftProductNum},
+                #{createBy.id},
+                #{createDate},
+                #{updateBy.id},
+                #{updateDate},
+                #{delFlag})
+    </insert>
+
+
+    <insert id="insertProductPriceRecord" parameterType="com.caimei.modules.product.entity.ProductPriceRecord"
+            keyProperty="productPriceRecordID" useGeneratedKeys="true">
+        INSERT INTO productpricerecord(`productID`,
+                                       `shopID`,
+                                       `highestUserLevelPrice`,
+                                       `lowestUserLevelPrice`,
+                                       `lowestUserLevelID`,
+                                       `price0`,
+                                       `price1`,
+                                       `updateTime`)
+        VALUES (#{productID},
+                #{shopID},
+                #{highestUserLevelPrice},
+                #{lowestUserLevelPrice},
+                #{lowestUserLevelID},
+                #{price0},
+                #{price1},
+                #{updateTime})
+    </insert>
+
+    <!--	<update id="updateCRMFlag">-->
+    <!--		UPDATE product a SET a.displayOnCRMFlag = #{param1}-->
+    <!--		WHERE  a.productID IN-->
+    <!--		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >-->
+    <!--			#{id}-->
+    <!--		</foreach>-->
+    <!--	</update>-->
+
+    <update id="deleteActive">
+        UPDATE product a
+        SET a.actFlag = 0
+        WHERE a.productID = #{id}
+    </update>
+
+
+    <update id="updatePostFlag">
+        UPDATE product a SET a.freePostFlag = #{param1}
+        WHERE a.productID IN
+        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+
+    <select id="getBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
+        select * from bigtype
+        <where>
+            validFlag = 1
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND bigTypeID = #{bigTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
+        select * from smalltype
+        <where>
+            validFlag = 1
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND bigTypeID = #{bigTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
+        select * from tinytype
+        <where>
+            validFlag = 1
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getProductTypeNameAndID" resultType="map">
+        select b.name        AS bigTypeName,
+               b.bigTypeID   AS bigTypeID,
+               s.name        AS smallTypeName,
+               s.smallTypeID AS smallTypeID,
+               t.name        AS tinyTypeName,
+               t.tinyTypeID  AS tinyTypeID
+        from tinytype AS t
+                 join smalltype AS s on t.smallTypeID = s.smallTypeID
+                 JOIN bigtype AS b on b.bigTypeID = s.bigTypeID
+        where t.tinyTypeID = #{tinyTypeID}
+    </select>
+
+    <delete id="deleteCustomClassification">
+        delete
+        from product_custom_classification
+        where productID = #{productID}
+    </delete>
+
+    <insert id="insertCustomClassification"
+            parameterType="com.caimei.modules.product.entity.ProductCustomClassification" keyProperty="userId"
+            useGeneratedKeys="true">
+        INSERT INTO product_custom_classification(productID,
+                                                  bigTypeID,
+                                                  smallTypeID,
+                                                  tinyTypeID,
+                                                  createDate,
+                                                  updateDate)
+        VALUES (#{productID},
+                #{bigTypeID},
+                #{smallTypeID},
+                #{tinyTypeID},
+                #{createDate},
+                #{updateDate})
+    </insert>
+
+    <insert id="insertAddProduct">
+        INSERT INTO cm_search_recommend_product(productID,
+                                                tinyTypeID,
+                                                sort,
+                                                delFlag)
+        VALUES (#{productID},
+                #{tinyTypeID},
+                0,
+                0)
+    </insert>
+    <insert id="insertLadderPrice">
+        insert into product_ladder_price (productId, userType, ladderNum,
+                                          buyNum, buyPrice, createBy, createDate, delFlag)
+        values (#{productId}, 3, #{ladderNum},
+                #{buyNum}, #{buyPrice}, #{createBy},
+                now(), '0')
+    </insert>
+
+    <insert id="insertProduct" keyColumn="productID" keyProperty="productID"
+            parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
+        INSERT INTO `product` (
+        `brandID`,
+        `tinyTypeID`,
+        <if test="productCategory != null and  productCategory != '' ">
+            `productCategory`,
+        </if>
+        `preferredFlag`,
+        `selfTypeID`,
+        `shopID`,
+        `name`,
+        `aliasName`,
+        `searchKey`,
+        `productRemarks`,
+        `priceFlag`,
+        `beautyActFlag`,
+        `hasSkuFlag`,
+        `mainImage`,
+        `propertiesInfo`,
+        `addTime`,
+        `updateTime`,
+        `weekSellNumber`,
+        `beforeValidFlag`,
+        `validFlag`,
+        `favoriteTimes`,
+        `commentScore`,
+        `commentTimes`,
+        `selfRecommendFlag`,
+        `sysRecommendFlag`,
+        `sortIndex`,
+        `featuredFlag`,
+        `featuredSortIndex`,
+        `productCode`,
+        `synToERPFlag`,
+        `allAreaFlag`,
+        `provinceIDs`,
+        `serviceNumber`,
+        `packageCount`,
+        `byFlag`,
+        `normalProductFlag`,
+        `wholeSaleProductFlag`,
+        `promotionProductFlag`,
+        `groupBuyProductFlag`,
+        `step`,
+        `actFlag`,
+        `actStatus`,
+        `actSort`,
+        `actType`,
+        `visibility`,
+        `onlineTime`,
+        `downlineTime`,
+        `freePostFlag`,
+        `precisehKey`,
+        `tags`,
+        `productType`,
+        `machineType`,
+        `qualificationImg`,
+        `includedTax`,
+        `taxPoint`,
+        `invoiceType`,
+        `recommendType`,
+        `combinationID`,
+        `combinationSort`,
+        announType
+        )
+        VALUES
+        (
+        #{brandID},
+        #{tinyTypeID},
+        <if test="productCategory != null and  productCategory != '' ">
+            #{productCategory},
+        </if>
+        #{preferredFlag},
+        #{selfTypeID},
+        #{shopID},
+        #{name},
+        #{aliasName},
+        #{searchKey},
+        #{productRemarks},
+        #{priceFlag},
+        #{beautyActFlag},
+        #{hasSkuFlag},
+        #{mainImage},
+        #{propertiesInfo},
+        #{addTime},
+        #{updateTime},
+        #{weekSellNumber},
+        #{beforeValidFlag},
+        #{validFlag},
+        #{favoriteTimes},
+        #{commentScore},
+        #{commentTimes},
+        #{selfRecommendFlag},
+        #{sysRecommendFlag},
+        #{sortIndex},
+        #{featuredFlag},
+        #{featuredSortIndex},
+        #{productCode},
+        #{synToERPFlag},
+        #{allAreaFlag},
+        #{provinceIDs},
+        #{serviceNumber},
+        #{packageCount},
+        #{byFlag},
+        #{normalProductFlag},
+        #{wholeSaleProductFlag},
+        #{promotionProductFlag},
+        #{groupBuyProductFlag},
+        #{step},
+        #{actFlag},
+        #{actStatus},
+        #{actSort},
+        #{actType},
+        #{visibility},
+        #{onlineTime},
+        #{downlineTime},
+        #{freePostFlag},
+        #{precisehKey},
+        #{tags},
+        #{productType},
+        #{machineType},
+        #{qualificationImg},
+        #{includedTax},
+        #{taxPoint},
+        #{invoiceType},
+        #{recommendType},
+        #{combinationID},
+        #{combinationSort},
+        #{announType}
+        )
+    </insert>
+
+    <insert id="insertProductDetailInfo">
+        insert into productdetailinfo
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="productID != null">
+                `productID`,
+            </if>
+            <if test="detailInfo != null and detailInfo != ''">
+                `detailInfo`,
+            </if>
+            <if test="serviceInfo != null and serviceInfo != ''">
+                `serviceInfo`,
+            </if>
+            <if test="orderInfo != null and orderInfo != ''">
+                `orderInfo`,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="productID != null">
+                #{productID},
+            </if>
+            <if test="detailInfo != null and detailInfo != ''">
+                #{detailInfo},
+            </if>
+            <if test="serviceInfo != null and serviceInfo != ''">
+                #{serviceInfo},
+            </if>
+            <if test="orderInfo != null and orderInfo != ''">
+                #{orderInfo},
+            </if>
+        </trim>
+    </insert>
+    <insert id="insertSku" keyColumn="skuId" keyProperty="skuId" parameterType="com.caimei.modules.product.entity.CmSku"
+            useGeneratedKeys="true">
+        insert into cm_sku
+        (productId,
+         normalPrice,
+         price,
+         ladderPriceFlag,
+         costCheckFlag,
+         costprice,
+         stock,
+         costProportional,
+         minBuyNumber,
+         unit)
+        values (#{productId},
+                #{normalPrice},
+                #{price},
+                #{ladderPriceFlag},
+                #{costCheckFlag},
+                #{costPrice},
+                #{stock},
+                #{costProportional},
+                #{minBuyNumber},
+                #{unit})
+    </insert>
+    <insert id="insertCmLadderPrice">
+        insert into product_ladder_price (skuId, productId, userType, ladderNum,
+                                          buyNum, buyPrice, createBy, createDate, delFlag)
+        values (#{skuId}, #{productId}, 3, #{ladderNum},
+                #{buyNum}, #{buyPrice}, #{createBy},
+                now(), '0')
+    </insert>
+
+    <select id="getrecommendProductList" resultType="product">
+        select
+        a.*,
+        csrp.sort AS sort,
+        csrp.id AS recommendProductId,
+        b.name AS brandName,
+        s.name AS shopName
+        FROM
+        cm_search_recommend_product csrp
+        LEFT JOIN product a on a.productID = csrp.productID
+        LEFT JOIN shop s on s.shopID = a.shopID
+        left join cm_brand b on b.id = a.brandID
+        WHERE
+        csrp.tinyTypeId = #{tinyTypeID}
+        <if test="name != null and name != ''">
+            AND a.name like concat('%', #{name} ,'%')
+        </if>
+        <if test="validFlag !=null and validFlag !=''">
+            AND a.validFlag=#{validFlag}
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        and a.productCategory = 1
+        AND a.validFlag != 0
+        AND csrp.delFlag =0
+        ORDER BY csrp.sort DESC
+    </select>
+
+
+    <select id="relatedProductList" resultType="product">
+        select
+        <include refid="productColumns"/>,
+        b.name AS brandName,
+        (case when a.tinyTypeID = #{tinyTypeID} then '1' else '0' end) AS defaultType
+        FROM product a
+        <include refid="productJoins"/>
+        left join brand b on b.brandID = a.brandID
+        WHERE (a.productID
+        IN (select productID from product_custom_classification where tinyTypeID = #{tinyTypeID})
+        OR a.tinyTypeID = #{tinyTypeID})
+        <if test="name != null and name != ''">
+            AND a.name like concat('%', #{name} ,'%')
+        </if>
+        <if test="validFlag !=null and validFlag !=''">
+            AND a.validFlag=#{validFlag}
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        AND a.validFlag != 0
+        and a.productCategory = 1
+    </select>
+
+    <delete id="deleteProductCustomClassification">
+        delete
+        from product_custom_classification
+        where productID = #{productID}
+          and tinyTypeID = #{tinyTypeID}
+    </delete>
+    <delete id="deleteLadderPriceByProductId">
+        DELETE
+        FROM product_ladder_price
+        where productId = #{productID}
+    </delete>
+    <delete id="deleteLadderPriceById">
+        DELETE
+        FROM product_ladder_price
+        where productId = #{productId}
+    </delete>
+    <delete id="deleteSkus">
+        delete
+        from cm_sku
+        where productId = #{productID}
+    </delete>
+
+    <delete id="deleteProductSkus">
+        DELETE
+        FROM cm_sku
+        WHERE productId = #{productId}
+        and skuId not in
+        <foreach collection="skuIds" close=")" separator="," open="(" item="id">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="toAddProductCustomClassificationList" resultType="product">
+        select
+        <include refid="productColumns"/>,
+        b.name AS brandName
+        FROM product a
+        <include refid="productJoins"/>
+        left join cm_brand b on b.id = a.brandID
+        WHERE a.tinyTypeID != #{tinyTypeID}
+        and not exists
+        (select pcc.id from product_custom_classification pcc where pcc.productID = a.productID and pcc.tinyTypeID =
+        #{tinyTypeID})
+        and a.validFlag = '2'
+        and (select count(id) from product_custom_classification pcc where pcc.productID = a.productID) <![CDATA[ < ]]>
+        5
+        <if test="name != null and name != ''">
+            and a.name like concat('%', #{name} ,'%')
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+    </select>
+
+
+    <select id="toAddProductList" resultType="product">
+        select
+        a.*,
+        b.name AS brandName,
+        s.name AS shopName
+        FROM product a
+        LEFT JOIN shop s on s.shopID = a.shopID
+        left join cm_brand b on b.id = a.brandID
+        WHERE
+        NOT EXISTS (select * from cm_search_recommend_product csrp where csrp.productID = a.productID and
+        csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
+        and a.validFlag = '2'
+        <if test="name != null and name != ''">
+            and a.name like concat('%', #{name} ,'%')
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        and a.productCategory = 1
+    </select>
+
+    <select id="getProductTypes" resultType="com.caimei.modules.product.entity.ProductCustomClassification">
+        select *
+        from product_custom_classification
+        where productID = #{productID}
+    </select>
+
+
+    <select id="findRecommendActivityListPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+
+
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag = 2
+            AND (a.actType != 3 or a.`actType` IS NULL or (a.actType = 3 and STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
+            <![CDATA[  <  ]]> STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i')))
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findGroupActivityListPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actStatus != null and actStatus != '' and actStatus == 1">
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
+            </if>
+            <if test="actStatus != null and actStatus != '' and actStatus == 2">
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  >  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag = 2
+            AND ((a.actType != 1 AND a.actType != 2 OR a.`actType` IS NULL) or a.actFlag = 0)
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
+        SELECT
+        *
+        FROM bigtype a
+        <where>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+
+        </where>
+    </select>
+    <select id="findSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
+        SELECT
+        *
+        FROM smalltype a
+        <where>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+        </where>
+    </select>
+    <select id="findTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
+        SELECT
+        *
+        FROM tinytype a
+        <where>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+        </where>
+    </select>
+
+    <select id="findProductRecommendList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select cpr.id                 AS id,
+               cpr.productID          AS productID,
+               cpr.recommendProductID AS recommendProductID,
+               cpr.sort               AS sort,
+               pro.name               AS productName,
+               pro.mainImage          AS img,
+               cpr.shopName           AS shopName
+        from cm_product_recommend cpr
+                 join product pro on cpr.recommendProductID = pro.productID
+        where cpr.productID = #{productID}
+        order by cpr.sort desc
+    </select>
+
+    <select id="findProductRecommendCount" resultType="int">
+        select count(1)
+        from cm_product_recommend cpr
+        where cpr.productID = #{productID}
+    </select>
+
+    <select id="findProductList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select
+        a.productID AS productID,
+        a.name AS productName,
+        a.mainImage AS img,
+        s.name AS shopName
+        from product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <choose>
+                <when test="commodityType != null and commodityType != ''">
+                    AND a.commodityType = #{commodityType}
+                </when>
+                <when test="bigTypeID != null and bigTypeID != ''">
+                    AND a.bigTypeID = #{bigTypeID}
+                </when>
+                <when test="smallTypeID != null and smallTypeID != ''">
+                    AND a.smallTypeID = #{smallTypeID}
+                </when>
+                <when test="tinyTypeID != null and tinyTypeID != ''">
+                    AND a.tinyTypeID = #{tinyTypeID}
+                </when>
+            </choose>
+            <if test="productName != null and productName != ''">
+                and a.name like concat('%', #{productName} ,'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                and s.name like concat('%', #{shopName} ,'%')
+            </if>
+            and a.productCategory = 1
+        </where>
+        <!--		limit 0, 10-->
+    </select>
+
+    <update id="updateRecommendType">
+        UPDATE product
+        SET recommendType = #{recommendType}
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updateBrnadId">
+        UPDATE product
+        set brandID = #{brandID}
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updateProductByBrandId">
+        UPDATE product
+        set brandID = null
+        WHERE brandID = #{brandId}
+    </update>
+    <select id="getProductIdByBrandId" resultType="java.lang.Integer">
+        SELECT productID
+        FROM product
+        WHERE brandID = #{brandId}
+    </select>
+    <update id="updateTinyType">
+        UPDATE product
+        set tinyTypeID = #{tinyTypeID}
+        WHERE productID = #{productID}
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
+        update product
+        <set>
+            <if test="productDescribe != null and productDescribe != ''">
+                productDescribe = #{productDescribe},
+            </if>
+            <if test="productDetail != null and productDetail != ''">
+                productDetail = #{productDetail},
+            </if>
+            <if test="brandID != null and brandID != ''">
+                brandID = #{brandID},
+            </if>
+            <if test="bigTypeID != null and bigTypeID !=''">
+                bigTypeID = #{bigTypeID},
+                smallTypeID = #{smallTypeID},
+                tinyTypeID = #{tinyTypeID},
+            </if>
+            <if test="preferredFlag != null and preferredFlag !=''">
+                preferredFlag = #{preferredFlag},
+            </if>
+            <if test="shopID != null and shopID !=''">
+                shopID = #{shopID},
+            </if>
+            <if test="name != null and name !=''">
+                `name` = #{name},
+            </if>
+            <if test="aliasName != null and aliasName !=''">
+                aliasName = #{aliasName},
+            </if>
+            <if test="searchKey != null and searchKey !=''">
+                searchKey = #{searchKey},
+            </if>
+            <if test="productRemarks != null and productRemarks !=''">
+                productRemarks = #{productRemarks},
+            </if>
+            <if test="combinationID != null and combinationID !=''">
+                combinationID = #{combinationID},
+            </if>
+            <if test="priceFlag != null and priceFlag !=''">
+                priceFlag = #{priceFlag},
+            </if>
+            <if test="beautyActFlag != null and beautyActFlag !=''">
+                beautyActFlag = #{beautyActFlag},
+            </if>
+            <if test="hasSkuFlag != null and hasSkuFlag !=''">
+                hasSkuFlag = #{hasSkuFlag},
+            </if>
+            <if test="mainImage != null and mainImage !=''">
+                mainImage = #{mainImage},
+            </if>
+            <if test="propertiesInfo != null and propertiesInfo !=''">
+                propertiesInfo = #{propertiesInfo},
+            </if>
+            <if test="addTime != null and addTime !=''">
+                addTime = #{addTime},
+            </if>
+            <if test="updateTime != null and updateTime !=''">
+                updateTime = #{updateTime},
+            </if>
+            <if test="weekSellNumber != null and weekSellNumber !=''">
+                weekSellNumber = #{weekSellNumber},
+            </if>
+            <if test="beforeValidFlag != null and beforeValidFlag !=''">
+                beforeValidFlag = #{beforeValidFlag},
+            </if>
+            <if test="validFlag != null and validFlag !=''">
+                validFlag = #{validFlag},
+            </if>
+            <if test="favoriteTimes != null and favoriteTimes !=''">
+                favoriteTimes = #{favoriteTimes},
+            </if>
+            <if test="commentScore != null and commentScore !=''">
+                commentScore = #{commentScore},
+            </if>
+            <if test="commentTimes != null and commentTimes !=''">
+                commentTimes = #{commentTimes},
+            </if>
+            <if test="selfRecommendFlag != null and selfRecommendFlag !=''">
+                selfRecommendFlag = #{selfRecommendFlag},
+            </if>
+            <if test="sysRecommendFlag != null and sysRecommendFlag !=''">
+                sysRecommendFlag = #{sysRecommendFlag},
+            </if>
+            <if test="sortIndex != null and sortIndex != ''">
+                sortIndex = #{sortIndex},
+            </if>
+            <if test="featuredFlag != null and featuredFlag !=''">
+                featuredFlag = #{featuredFlag},
+            </if>
+            <if test="featuredSortIndex != null and featuredSortIndex !=''">
+                featuredSortIndex = #{featuredSortIndex},
+            </if>
+            <if test="productCode != null and productCode !=''">
+                productCode = #{productCode},
+            </if>
+            <if test="synToERPFlag != null and synToERPFlag !=''">
+                synToERPFlag = #{synToERPFlag},
+            </if>
+            <if test="allAreaFlag != null and allAreaFlag !=''">
+                allAreaFlag = #{allAreaFlag},
+            </if>
+            <if test="provinceIDs != null and provinceIDs !=''">
+                provinceIDs = #{provinceIDs},
+            </if>
+            <if test="serviceNumber != null and serviceNumber !=''">
+                serviceNumber = #{serviceNumber},
+            </if>
+            <if test="packageCount != null and packageCount !=''">
+                packageCount = #{packageCount},
+            </if>
+            <if test="byFlag != null and byFlag !=''">
+                byFlag = #{byFlag},
+            </if>
+            <if test="normalProductFlag != null and normalProductFlag !=''">
+                normalProductFlag = #{normalProductFlag},
+            </if>
+            <if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">
+                wholeSaleProductFlag = #{wholeSaleProductFlag},
+            </if>
+            <if test="promotionProductFlag != null and promotionProductFlag !=''">
+                promotionProductFlag = #{promotionProductFlag},
+            </if>
+            <if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">
+                groupBuyProductFlag = #{groupBuyProductFlag},
+            </if>
+            <if test="step != null and step !=''">
+                step = #{step},
+            </if>
+            <if test="actFlag != null and actFlag !=''">
+                actFlag = #{actFlag},
+            </if>
+            <if test="actSort != null and actSort !=''">
+                actSort = #{actSort},
+            </if>
+            <if test="actType != null and actType !=''">
+                actType = #{actType},
+            </if>
+            <if test="onlineTime != null and onlineTime !=''">
+                onlineTime = #{onlineTime},
+            </if>
+            <if test="downlineTime != null and downlineTime !=''">
+                downlineTime = #{downlineTime},
+            </if>
+            <if test="freePostFlag != null and freePostFlag !=''">
+                freePostFlag = #{freePostFlag},
+            </if>
+            <if test="precisehKey != null and precisehKey !=''">
+                precisehKey = #{precisehKey},
+            </if>
+            <if test="visibility != null and visibility !=''">
+                visibility = #{visibility},
+            </if>
+            <if test="commodityDetailsFlag != null and commodityDetailsFlag != ''">
+                commodityDetailsFlag = #{commodityDetailsFlag},
+            </if>
+            <if test="productType != null and productType !=''">
+                productType = #{productType},
+            </if>
+            <if test="qualificationImg != null and qualificationImg !=''">
+                qualificationImg = #{qualificationImg},
+            </if>
+            <if test="qualificationImg != null and qualificationImg !=''">
+                qualificationImg = #{qualificationImg},
+            </if>
+            <if test="invoiceType != null and invoiceType !=''">
+                invoiceType = #{invoiceType},
+            </if>
+            <if test="taxPoint != null and taxPoint !=''">
+                taxPoint = #{taxPoint},
+            </if>
+            <if test="supplierTaxPoint != null and supplierTaxPoint !=''">
+                supplierTaxPoint = #{supplierTaxPoint},
+            </if>
+            <if test="endTimeStr != null and endTimeStr !=''">
+                endTimeStr = #{endTimeStr},
+            </if>
+            <if test="tags != null and tags !=''">
+                tags = #{tags},
+            </if>
+            <if test="recommendType != null and recommendType !=''">
+                recommendType = #{recommendType},
+            </if>
+            <if test="machineType != null and machineType !=''">
+                machineType = #{machineType},
+            </if>
+            <if test="includedTax != null and includedTax !=''">
+                includedTax = #{includedTax},
+            </if>
+            <if test="invoiceType != null and invoiceType !=''">
+                invoiceType = #{invoiceType},
+            </if>
+            <if test="commodityType != null and commodityType != ''">
+                commodityType = #{commodityType},
+            </if>
+            <if test="trainingMethod != null">
+                trainingMethod = #{trainingMethod},
+            </if>
+            <if test="trainingType != null">
+                trainingType = #{trainingType},
+            </if>
+            <if test="trainingFee != null">
+                trainingFee = #{trainingFee},
+            </if>
+            <if test="qualificationNo !=null and qualificationNo != ''">
+                qualificationNo=#{qualificationNo},
+            </if>
+            <if test="productName !=null and productName !=''">
+                productName=#{productName},
+            </if>
+            <if test="qualificationTime !=null and qualificationTime!=''">
+                qualificationTime=#{qualificationTime},
+            </if>
+            <if test="qualificationLink !=null and qualificationLink!=''">
+                qualificationLink=#{qualificationLink},
+            </if>
+
+            newProductType=#{newProductType},
+            showFlag=#{showFlag},
+            announType=#{announType},
+            splitCode = #{splitCode}
+        </set>
+        where productID = #{productID}
+    </update>
+    <update id="updateproductDetailInfo" parameterType="com.caimei.modules.product.entity.ProductDetailInfo">
+        update productdetailinfo
+        <set>
+            <if test="propValueAlias != null and propValueAlias != ''">
+                propValueAlias = #{propValueAlias},
+            </if>
+            <if test="propValueImages != null and propValueImages !=''">
+                propValueImages = #{propValueImages},
+            </if>
+            <if test="detailInfo != null">
+                detailInfo = #{detailInfo},
+            </if>
+            <if test="commonDetailInfo != null">
+                commonDetailInfo = #{commonDetailInfo},
+            </if>
+            <if test="detailInfoTxt != null">
+                detailInfoTxt = #{detailInfoTxt},
+            </if>
+            <if test="seoTitle != null and seoTitle !=''">
+                seoTitle = #{seoTitle},
+            </if>
+            <if test="seoKeyword != null and seoKeyword !=''">
+                seoKeyword = #{seoKeyword},
+            </if>
+            <if test="seoDes != null and seoDes !=''">
+                seoDes = #{seoDes},
+            </if>
+            <if test="serviceInfo != null ">
+                serviceInfo = #{serviceInfo},
+            </if>
+            <if test="orderInfo != null ">
+                orderInfo = #{orderInfo},
+            </if>
+        </set>
+        where productID = #{productID}
+    </update>
+    <update id="updateLadderPrice">
+        update product_ladder_price
+        set productId  = #{productId},
+            ladderNum  = #{ladderNum},
+            buyNum     = #{buyNum},
+            buyPrice   = #{buyPrice},
+            updateBy   = #{updateBy},
+            updateDate = #{updateDate},
+            delFlag    = #{delFlag}
+        where id = #{id}
+    </update>
+
+    <update id="updateMainImage">
+        update product
+        set mainImage =#{mainImage}
+        where productID = #{productID}
+    </update>
+
+    <update id="updateCmSku">
+        update cm_sku
+        set productId=#{productId},
+            ladderPriceFlag=#{ladderPriceFlag},
+            normalPrice=#{normalPrice},
+            price=#{price},
+            costProportional=#{costProportional},
+            costPrice=#{costPrice},
+            costCheckFlag=#{costCheckFlag},
+            stock=#{stock},
+            unit=#{unit},
+            minBuyNumber=#{minBuyNumber}
+        where skuId = #{skuId}
+    </update>
+
+    <select id="getProductByTypeName" resultType="com.caimei.modules.brand.entity.BrandAndProductType">
+        select b.name   AS "bigTypeName",
+               b.bigTypeID,
+               s.`name` AS "smallTypeName",
+               s.smalltypeID,
+               t.name   AS "tinyTypeName",
+               t.tinytypeID
+        from tinytype t
+                 LEFT JOIN smalltype s on t.smallTypeID = s.smallTypeID
+                 LEFT JOIN bigtype b ON b.bigTypeID = s.bigTypeID
+        where b.`name` = #{name}
+          AND s.`name` = #{name1}
+          AND t.name = #{name2}
+    </select>
+
+    <select id="findRecommendBySys" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select p.productID AS recommendProductID,
+               p.name      AS productName,
+               p.mainImage AS img,
+               s.name      AS shopName
+        from product p
+                 left join shop s on s.shopID = p.shopID
+        where p.tinyTypeID = #{tinyTypeID}
+          and p.productCategory = 1
+        order by p.sellNumber
+                desc
+        limit 0, 7
+    </select>
+
+    <select id="getSecondHandRecommend" resultType="CmSecondHandRecommendVo">
+        select p.productID       AS id,
+               1                 AS type,
+               p.name            AS name,
+               p.mainImage       AS img,
+               s.name            AS shopName,
+               p.productCategory as "productCategory"
+        from product p
+                 left join shop s on s.shopID = p.shopID
+        where p.productID = #{productID}
+          AND p.validFlag = '2'
+    </select>
+
+    <select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
+        select
+        p.productID AS id,
+        1 AS type,
+        p.name AS name,
+        p.mainImage AS img,
+        s.name AS shopName,
+        p.productCategory as "productCategory"
+        from product p
+        left join shop s on s.shopID = p.shopID
+        <where>
+            <if test="productID != null and productID != ''">
+                p.productID = #{productID}
+            </if>
+            <if test="productName != null and productName != ''">
+                and p.name like concat('%', #{productName} ,'%')
+            </if>
+            AND p.validFlag = '2'
+            and p.productCategory = #{queryProductType}
+        </where>
+        limit 0, 10
+    </select>
+    <select id="queryProductDetailInfo" resultType="com.caimei.modules.product.entity.ProductDetailInfo">
+        SELECT *
+        FROM productdetailinfo
+        where productID = #{productID}
+    </select>
+    <select id="qualification" resultType="com.caimei.modules.product.entity.Product">
+        SELECT qualificationNo, productName, qualificationTime, qualificationLink
+        FROM product
+        where productID = #{productID}
+    </select>
+    <select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
+        SELECT *
+        FROM product_ladder_price
+        WHERE productId = #{productId}
+          AND userType = #{userType}
+          AND buyNum is NOT null
+          AND buyPrice is NOT null
+          AND delFlag = 0
+        ORDER BY ladderNum ASC
+    </select>
+    <select id="findActList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actType !=null and actType !=''">
+                AND a.actType=#{actType}
+            </if>
+            AND a.actStatus = 1
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
+        select p.productID,p.mainImage,p.name,s.name as shopName from product p left join shop s on p.shopID = s.shopID
+        <where>
+            (p.actFlag=0 or p.actType is null) and p.validFlag = 2 and p.productCategory = 1
+            <if test="productIds != null and productIds != '' ">
+                and p.productID != #{productIds}
+            </if>
+            <if test="productID != null and productID != ''">
+                and p.productID = #{productID}
+            </if>
+            <if test="name != null and name != ''">
+                and p.name like concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                and s.name like concat('%',#{shopName},'%')
+            </if>
+        </where>
+        order by productID asc
+    </select>
+
+    <select id="findProductImage" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null">
+                AND a.productID=#{productID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE concat('%',#{shopName},'%')
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="productCategory !=null and productCategory !=''">
+                AND a.productCategory=#{productCategory}
+            </if>
+            <if test="ids != null and ids.size() > 0">
+                AND a.productID NOT IN
+                <foreach collection="ids" close=")" separator="," open="(" item="id">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID asc
+            </otherwise>
+        </choose>
+    </select>
+    <select id="findProductDetail" resultType="java.lang.String">
+        select productDetail
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findProductDescribe" resultType="java.lang.String">
+        select productDescribe
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findSepcialShopList" resultType="com.caimei.modules.product.entity.CmShop">
+        select name, shopID
+        from shop
+        where shopType = 2
+    </select>
     <select id="getSplitCodeByProductId" resultType="java.lang.String">
-		select splitCode from product where productID = #{productID}
-	</select>
-	<select id="findSplitCodesByShopId" resultType="com.caimei.modules.product.entity.CmSplitCode">
-		select shopId,commercialCode as splitCode,codeDetail as codeName,email
-		from cm_shop_splitcode
-		where shopId = #{shopID}
-	</select>
+        select splitCode
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findSplitCodesByShopId" resultType="com.caimei.modules.product.entity.CmSplitCode">
+        select shopId, commercialCode as splitCode, codeDetail as codeName, email
+        from cm_shop_splitcode
+        where shopId = #{shopID}
+    </select>
+    <select id="findSkuList" resultType="com.caimei.modules.product.entity.CmSku">
+        select skuId,
+               productId,
+               unit,
+               normalPrice,
+               stock,
+               costCheckFlag,
+               costProportional,
+               costPrice,
+               price,
+               ladderPriceFlag,
+               minBuyNumber
+        from cm_sku
+        where productId = #{productID}
+    </select>
+    <select id="findLadderPriceBySku" resultType="com.caimei.modules.product.entity.CmLadderPrice">
+        select skuId, productId, userType, ladderNum, buyNum, buyPrice, delFlag
+        FROM product_ladder_price
+        WHERE userType = 3
+          AND skuId = #{skuId}
+          AND buyNum is NOT null
+          AND buyPrice is NOT null
+          AND delFlag = 0
+        ORDER BY buyNum ASC
+    </select>
+    <select id="findLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
+        select skuId, productId, userType, ladderNum, buyNum, buyPrice, delFlag
+        FROM product_ladder_price
+        WHERE userType = 3
+          AND skuId = #{skuId}
+          AND buyNum is NOT null
+          AND buyPrice is NOT null
+          AND delFlag = 0
+        ORDER BY buyNum ASC
+    </select>
+    <select id="getBySku" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        ,cs.unit
+        ,cs.skuId
+        FROM product a
+        <include refid="productJoins"/>
+        left join cm_sku cs on cs.productId=a.productID
+        WHERE cs.skuId = #{skuId}
+    </select>
+    <select id="findHeHeSku" resultType="com.caimei.modules.product.entity.CmSku">
+        select cs.skuId,
+               cs.productId,
+               cs.unit,
+               cs.stock,
+               cs.costCheckFlag,
+               cs.costProportional,
+               cs.costPrice,
+               chs.price
+        from cm_sku cs
+                 left join cm_hehe_sku chs on cs.skuId = chs.skuId
+        where cs.productId = #{productID}
+    </select>
+    <select id="findSkuId" resultType="java.lang.Integer">
+        select skuId
+        from cm_sku
+        where productId = #{productId}
+    </select>
+    <select id="findSku" resultType="com.caimei.modules.product.entity.CmSku">
+        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>

+ 0 - 10
src/main/resources/mappings/modules/product/ProductNewMapper.xml

@@ -24,12 +24,8 @@
         a.searchKey AS "searchKey",
         a.combinationID AS "combinationID",
         a.productRemarks AS "productRemarks",
-        a.normalPrice AS "normalPrice",
-        a.price AS "price",
         a.priceFlag AS "priceFlag",
         a.beautyActFlag AS "beautyActFlag",
-        a.ladderPriceFlag AS "ladderPriceFlag",
-        a.stock AS "stock",
         a.hasSkuFlag AS "hasSkuFlag",
         a.mainImage AS "mainImage",
         a.propertiesInfo AS "propertiesInfo",
@@ -48,13 +44,10 @@
         a.featuredFlag AS "featuredFlag",
         a.featuredSortIndex AS "featuredSortIndex",
         a.productCode AS "productCode",
-        a.unit AS "unit",
         a.synToERPFlag AS "synToERPFlag",
         a.allAreaFlag AS "allAreaFlag",
         a.provinceIDs AS "provinceIDs",
         a.serviceNumber AS "serviceNumber",
-        a.maxBuyNumber AS "maxBuyNumber",
-        a.minBuyNumber AS "minBuyNumber",
         a.packageCount AS "packageCount",
         a.byFlag AS "byFlag",
         a.normalProductFlag AS "normalProductFlag",
@@ -68,9 +61,6 @@
         a.onlineTime AS "onlineTime",
         a.downlineTime AS "downlineTime",
         a.freePostFlag AS "freePostFlag",
-        a.costPrice AS "costPrice",
-        a.costProportional AS "costProportional",
-        a.costCheckFlag AS "costCheckFlag",
         a.precisehKey AS "precisehKey",
         s.name AS "shopName",
         a.actSort AS "actSort",

+ 7 - 4
src/main/resources/mappings/modules/product/RepeatPurchasePriceMapper.xml

@@ -14,7 +14,8 @@
 	</sql>
 
 	<sql id="repeatPurchasePriceJoins">
-		left join product as b on a.productId = b.productID
+		left join cm_sku cs on cs.skuId=a.skuId
+		left join product as b on cs.productId = b.productID
 		left join user as c on a.userId = c.userId
 	</sql>
 
@@ -37,6 +38,7 @@
 		c.userName AS "userName",
 		c.mobile As "mobile",
 		c.registerUserTypeID As "type",
+		cs.unit AS "unit",
 		b.name AS "productName"
 		FROM repeat_purchase_price a
 		<include refid="repeatPurchasePriceJoins"/>
@@ -57,9 +59,10 @@
 			c.bindMobile AS "bindMobile",
 			IFNULL(c.registerUserTypeID,3) As "type",
 			b.name AS "productName",
-            CASE   b.costCheckFlag
-            WHEN  1 THEN b.`costPrice`
-            WHEN  2 THEN b.`costProportional` * b.`price` / 100
+		  	cs.unit,
+            CASE   cs.costCheckFlag
+            WHEN  1 THEN cs.`costPrice`
+            WHEN  2 THEN cs.`costProportional` * cs.`price` / 100
             END   AS "costPrice"
 		FROM repeat_purchase_price a
 		<include refid="repeatPurchasePriceJoins"/>

+ 4 - 7
src/main/resources/mappings/modules/svip/CmSvipProductMapper.xml

@@ -13,14 +13,10 @@
         p.mainImage as "productImage",
         p.name as "productName",
 		s.name as "shopName",
-        p.price,
         p.includedTax,
         p.invoiceType,
         p.taxPoint,
-        p.supplierTaxPoint,
-        p.costCheckFlag,
-        p.costPrice,
-        p.costProportional
+        p.supplierTaxPoint
     </sql>
 
     <sql id="cmSvipProductJoins">
@@ -84,7 +80,7 @@
     </select>
     <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
         SELECT
-        a.*,s.name AS "shopName"
+        a.productId,a.mainImage,a.name,s.name AS "shopName"
         FROM product a
         LEFT JOIN shop s on s.shopID = a.shopID
         <where>
@@ -92,7 +88,8 @@
              and a.productID not in (
             select productId from cm_promotions_product cpp left join
             cm_promotions cp on cpp.promotionsId = cp.id where cp.delFlag != '2')
-            and a.ladderPriceFlag = '0' and priceFlag != '1'
+            and priceFlag != '1'
+            and a.productId not in(SELECT DISTINCT productId FROM cm_sku WHERE ladderPriceFlag=1)
             <if test="productID != null">
                 AND a.productID = #{productID}
             </if>

+ 3 - 0
src/main/webapp/WEB-INF/views/modules/bulkpurchase/applyRefoundForm.jsp

@@ -617,6 +617,9 @@
                                     </td>
                                 </tr>
                                 <tr>
+                                    <td>
+                                        规格:${newOrderProduct.unit}
+                                    </td>
                                     <td style="width: 275px;">
                                         税率:${newOrderProduct.taxRate}%
                                     </td>

+ 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>

+ 2 - 0
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderForm.jsp

@@ -264,6 +264,7 @@
         <thead>
         <tr>
             <th>商品ID</th>
+            <th>skuId</th>
             <th hidden></th>
             <th hidden></th>
             <th>商品名称</th>
@@ -289,6 +290,7 @@
             <tr id="product_${orderProduct.productId}" data-value='${fns:toJson(orderProduct)}'
                 data-index="${index.index}">
                 <td>${orderProduct.productId}</td>
+                <td>${orderProduct.skuId}</td>
                 <td hidden>${orderProduct.shopId}</td>
                 <td hidden>${orderProduct.shopName}</td>
                 <td>${orderProduct.name}</td>

+ 168 - 70
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductForm.jsp

@@ -90,9 +90,11 @@
         <tr>
             <th class="hide"></th>
             <th>商品ID</th>
+            <th>skuId</th>
             <th>商品名称</th>
             <th>商品编码</th>
             <th>供应商名称</th>
+            <th>规格</th>
             <th>当前单价</th>
             <th>折扣</th>
             <th>折后单价</th>
@@ -118,13 +120,22 @@
             <th class="hide"><input class="check-item" type="hidden" name="cmClub" id="check-item0"
                                     value='${fns:toJson(purchaseProduct)}'/></th>
             <td>${purchaseProduct.productId}</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();" id="ints0">
+                    <c:forEach items="${purchaseProduct.skuList}" var="skus" varStatus="ind">
+                        <option value="${skus.skuId}/${ind.index}">${skus.unit}</option>
+                    </c:forEach>
+                </select>
+            </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}">
@@ -145,24 +156,25 @@
             <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"
+            <td><input id="oldPrice0" type="hidden" value="${purchaseProduct.price}">
+                <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>
                         <div class="list">
                             <p><span>起订量</span><span>价格</span></p>
                             <c:forEach items="${purchaseProduct.ladderPriceList}" var="ladderPrice">
-                                <p data-num="${ladderPrice.buyNum}"><span>${ladderPrice.buyNumRangeShow}</span><span
+                                <p data-num="${ladderPrice.buyNum}"><span>${ladderPrice.buyNum}</span><span
                                         class="price">${ladderPrice.buyPrice}</span></p>
                             </c:forEach>
                         </div>
@@ -175,8 +187,8 @@
                     <button class="decrease" onclick="presentNum('0','del')">-</button>
                     <input type="text" name="num" id="num0" class="input-mini" style="width: 25px"
                            onchange="changenum(0)"
-                           min="${purchaseProduct.ladderPriceFlag eq 1?purchaseProduct.ladderPriceList[0].buyNum:1}"
-                           value="${(not empty orderProduct.num)?(orderProduct.num):(purchaseProduct.ladderPriceFlag eq 1?purchaseProduct.ladderPriceList[0].buyNum:1)}">
+                           min="1"
+                           value="${(not empty orderProduct.num)?(orderProduct.num):1}">
                     <button class="increase" onclick="presentNum('0','add')">+</button>
                 </c:if>
                 <c:if test="${purchaseProduct.secondHandType eq 1 }">
@@ -195,7 +207,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>
@@ -272,58 +285,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">
@@ -347,11 +379,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);
@@ -375,11 +413,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 != '')) {
@@ -399,6 +437,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;
@@ -435,6 +474,65 @@
             buttons: {"确定": '1'}
         });
     }
+
+    function checkSkuValue() {
+        var skuStr = $("#ints0").val();
+        var $checkItem = eval('(' + $("#check-item0").val() + ')');
+        $checkItem["skuStr"] = skuStr;
+        //切换价格
+        var price = "priceLabel0";//单价
+        var singlePrice = "#" + "discountPrice0";
+        var totalFee = "#" + "totalFee0";
+        var skus = JSON.parse($("#hideSkus").val());
+        var skuIndex = skuStr.split("/")[1];
+        console.log(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);
+        $(totalFee).val(skus[skuIndex].price);
+        var discount = $checkItem["discount"];
+        $checkItem["price"] = skus[skuIndex].price;
+        $checkItem["discountPrice"] = skus[skuIndex].price * discount / 100;
+        $checkItem["totalFee"] = skus[skuIndex].price;
+        $("#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;
+        if (productId >= 6060 && productId <= 6069) {
+            tax = 0;
+        } else if ("3" === invoiceType) {
+            tax = "---";
+        } else {
+            tax = discountPrice * taxRate / 100;
+            if ("0" === includedTax) {
+                base += discountPrice * taxRate / 100;
+            }
+        }
+        if(1==skus[skuIndex].ladderPriceFlag){
+            $checkItem["ladderPriceFlag"] = 1;
+            $checkItem["ladderPriceList"] = skus[skuIndex].ladderPriceList;
+            $(".ladderPrice").show();
+        }else{
+            $checkItem["ladderPriceFlag"] = 0;
+            $checkItem["ladderPriceList"] = {};
+            $(".ladderPrice").hide();
+        }
+        $checkItem["addedValueTax"] = tax;
+        $checkItem["totalAddedValueTax"] = tax * num;
+        $("#addedValueTax0").val(tax);
+        $("#totalAddedValueTax0").val(tax * num);
+        var total = base * num;
+        $("#totalFee0").val(total);
+        $checkItem["totalFee"] = total;
+        $("#check-item0").val(JSON.stringify($checkItem));
+    }
 </script>
 </body>
 </html>

+ 235 - 58
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductList.jsp

@@ -6,20 +6,80 @@
     <title>直接生成订单的添加商品页面</title>
     <meta name="decorator" content="default"/>
     <style type="text/css">
-        .table th{text-align:center;white-space:nowrap}
-        .table td{text-align:center;white-space:nowrap}
-        .sel{background:RGB(232,232,232)}
-        #contentTable input{text-align:center}
-        #contentTable input[readonly]{border:0 solid #ccc;border-radius:4px;background:#fff}
-        #contentTable tr:hover input[readonly]{background:#e8e8e8}
-        #contentTable input[type="text"]{height:17px;line-height:17px;margin-bottom:0;border:0}
-        .ladderPrice>span{text-decoration:underline;color:red}
-        .ladderPrice .list{display:none;position:absolute;background:#FFF;white-space:nowrap;border:1px solid #EEE;padding:10px 0;color:#333}
-        .ladderPrice:hover .list{display:block}
-        .ladderPrice .list span{margin:0 20px;width:60px;text-align:center;display:inline-block}
-        .ladderPrice .list span.price{color:red}
-        input[type=number]{-moz-appearance:textfield;margin:0}
-        input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
+        .table th {
+            text-align: center;
+            white-space: nowrap
+        }
+
+        .table td {
+            text-align: center;
+            white-space: nowrap
+        }
+
+        .sel {
+            background: RGB(232, 232, 232)
+        }
+
+        #contentTable input {
+            text-align: center
+        }
+
+        #contentTable input[readonly] {
+            border: 0 solid #ccc;
+            border-radius: 4px;
+            background: #fff
+        }
+
+        #contentTable tr:hover input[readonly] {
+            background: #e8e8e8
+        }
+
+        #contentTable input[type="text"] {
+            height: 17px;
+            line-height: 17px;
+            margin-bottom: 0;
+            border: 0
+        }
+
+        .ladderPrice > span {
+            text-decoration: underline;
+            color: red
+        }
+
+        .ladderPrice .list {
+            display: none;
+            position: absolute;
+            background: #FFF;
+            white-space: nowrap;
+            border: 1px solid #EEE;
+            padding: 10px 0;
+            color: #333
+        }
+
+        .ladderPrice:hover .list {
+            display: block
+        }
+
+        .ladderPrice .list span {
+            margin: 0 20px;
+            width: 60px;
+            text-align: center;
+            display: inline-block
+        }
+
+        .ladderPrice .list span.price {
+            color: red
+        }
+
+        input[type=number] {
+            -moz-appearance: textfield;
+            margin: 0
+        }
+
+        input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button {
+            -webkit-appearance: none;
+            margin: 0
+        }
     </style>
     <script type="text/javascript">
         $(document).ready(function () {
@@ -224,9 +284,72 @@
             items.push(json);
             return items;
         }
+
         function onlynum(obj) {
             obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
         }
+
+        function checkSkuValue(ind) {
+            var c = "#" + "ints" + ind;
+            var skuStr = $(c).val();
+            var $checkItem = eval('(' + $("#check-item" + ind).val() + ')');
+            $checkItem["skuStr"] = skuStr;
+            //切换价格
+            var price = "priceLabel" + ind;//单价
+            var singlePrice = "#" + "discountPrice" + ind;
+            var totalFee = "#" + "totalFee" + ind;
+            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);
+            //页面价格赋值
+            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"];
+            $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);
+            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;
+            if (productId >= 6060 && productId <= 6069) {
+                tax = 0;
+            } else if ("3"===invoiceType) {
+                tax = "---";
+            } else {
+                tax = discountPrice * taxRate / 100;
+                if("0"===includedTax){
+                    base += discountPrice * taxRate / 100;
+                }
+            }
+            if(1==skus[skuIndex].ladderPriceFlag){
+                $checkItem["ladderPriceFlag"] = 1;
+                $checkItem["ladderPriceList"] = skus[skuIndex].ladderPriceList;
+                $(".ladderPrice").show();
+            }else{
+                $checkItem["ladderPriceFlag"] = 0;
+                $checkItem["ladderPriceList"] = {};
+                $(".ladderPrice").hide();
+            }
+            $checkItem["addedValueTax"] = tax;
+            $checkItem["totalAddedValueTax"] = tax * num;
+            $("#addedValueTax" + ind).val(tax);
+            $("#totalAddedValueTax" + ind).val(tax * num);
+            var total = base * num;
+            $("#totalFee" + ind).val(total);
+            $checkItem["totalFee"] = total;
+            $("#check-item" + ind).val(JSON.stringify($checkItem));
+        }
     </script>
 </head>
 <body>
@@ -247,7 +370,8 @@
             <label>商品名称:</label>
             <form:input path="purchaseProductName" htmlEscape="false" maxlength="30" class="input-medium"/>
             <label>商品ID:</label>
-            <form:input path="productId" htmlEscape="false" maxlength="11" class="input-medium" onkeyup="onlynum(this)"/>
+            <form:input path="productId" htmlEscape="false" maxlength="11" class="input-medium"
+                        onkeyup="onlynum(this)"/>
             <label>供应商名称:</label>
             <form:input path="shopName" htmlEscape="false" maxlength="20" class="input-medium"/>
             &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
@@ -263,9 +387,11 @@
         <tr>
             <th style="width:20px;"></th>
             <th>商品ID</th>
+            <th>skuId</th>
             <th>商品名称</th>
             <th>商品编码</th>
             <th>供应商名称</th>
+            <th>规格</th>
             <th>当前单价</th>
             <th>折扣</th>
             <th>折后单价</th>
@@ -289,17 +415,32 @@
                 <th><input class="check-item" type="radio" name="cmClub" id="check-item${state.index}"
                            value='${fns:toJson(purchaseProduct)}'/></th>
                 <td>
-                    <label id="productId${state.index}" value="${purchaseProduct.productId}" disabled>${purchaseProduct.productId}</label>
+                    <label id="productId${state.index}" value="${purchaseProduct.productId}"
+                           disabled>${purchaseProduct.productId}</label>
                     <c:if test="${purchaseProduct.buyAgainPriceFlag eq 1}">
                         <font color="red">(曾购)</font>
                     </c:if>
                 </td>
+                <td>
+                    <label id="skuId${state.index}" value="${purchaseProduct.skuList[0].skuId}"
+                           disabled>${purchaseProduct.skuList[0].skuId}</label>
+                </td>
                 <td title="${purchaseProduct.purchaseProductName}">${fns:abbr(purchaseProduct.purchaseProductName,16)}</td>
                 <td>${purchaseProduct.productNo}</td>
                 <td title="${purchaseProduct.shopName}">${fns:abbr(purchaseProduct.shopName,10)}</td>
                 <td>
-                    <label id="priceLabel${state.index}" style=" ${purchaseProduct.svipPriceFlag eq 1 or purchaseProduct.cmPromotion.mode eq 1?'text-decoration:line-through':'' }">${purchaseProduct.price}</label>
-                    <label id="svipDiscountPrice${state.index}"  style="display:none">${purchaseProduct.svipDiscountPrice}</label>
+                    <input id="hideSkus" value='${fns:toJson(purchaseProduct.skuList)}' hidden/>
+                    <select onchange="checkSkuValue(${state.index});" id="ints${state.index}">
+                        <c:forEach items="${purchaseProduct.skuList}" var="skus" varStatus="ind">
+                            <option value="${skus.skuId}/${ind.index}">${skus.unit}</option>
+                        </c:forEach>
+                    </select>
+                </td>
+                <td>
+                    <label id="priceLabel${state.index}"
+                           style=" ${purchaseProduct.svipPriceFlag eq 1 or purchaseProduct.cmPromotion.mode eq 1?'text-decoration:line-through':'' }">${purchaseProduct.skuList.get(0).price}</label>
+                    <label id="svipDiscountPrice${state.index}"
+                           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}">
@@ -316,28 +457,33 @@
                         </c:if>
                     </label>
-                    <input type="hidden" id="price${state.index}" value="${purchaseProduct.price}"></td>
-                <td><input type="text" name="discount" id="discount${state.index}"
+                    <input type="hidden" id="price${state.index}" value="${purchaseProduct.skuList.get(0).price}">
+                </td>
+                <td>
+                    <input type="text" name="discount" id="discount${state.index}"
                            value="${empty purchaseProduct.discount ?100:(purchaseProduct.discount)}"
                            onchange="discountPriceVal(${state.index})"
-                           ${(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="discountPrice${state.index}"
+                <td>
+                    <input id="oldPrice${state.index}" type="hidden" value="${purchaseProduct.price}">
+                    <input name="discountPrice" id="discountPrice${state.index}"
                            value="${empty purchaseProduct.discount ?(purchaseProduct.svipPriceFlag eq 1?purchaseProduct.svipDiscountPrice: purchaseProduct.price):(purchaseProduct.discount)}"
                            onchange="countDiscount(${state.index})"
-                            ${(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>
                             <div class="list">
                                 <p><span>起订量</span><span>价格</span></p>
                                 <c:forEach items="${purchaseProduct.ladderPriceList}" var="ladderPrice">
-                                    <p data-num="${ladderPrice.buyNum}"><span>${ladderPrice.buyNumRangeShow}</span><span class="price">${ladderPrice.buyPrice}</span></p>
+                                    <p data-num="${ladderPrice.buyNum}"><span>${ladderPrice.buyNum}</span><span
+                                            class="price">${ladderPrice.buyPrice}</span></p>
                                 </c:forEach>
                             </div>
                         </a>
@@ -345,9 +491,10 @@
                 </td>
                 <td>
                     <button class="decrease" onclick="presentNum('${state.index}','del')">-</button>
-                    <input type="number" name="num" id="num${state.index}" style="width: 25px" min="${purchaseProduct.ladderPriceFlag eq 1?purchaseProduct.ladderPriceList[0].buyNum:1}"
+                    <input type="number" name="num" id="num${state.index}" style="width: 25px"
+                           min="${purchaseProduct.ladderPriceFlag eq 1?purchaseProduct.ladderPriceList[0].buyNum:1}"
                            onchange="changenum(${state.index})"
-                           value="${(not empty purchaseProduct.num)?(purchaseProduct.num):(purchaseProduct.ladderPriceFlag eq 1?purchaseProduct.ladderPriceList[0].buyNum:1)}">
+                           value="${(not empty purchaseProduct.num)?(purchaseProduct.num):1}">
                     <button class="increase" onclick="presentNum('${state.index}','add')">+</button>
                 </td>
                 <c:choose>
@@ -355,7 +502,7 @@
                         <td><input type="text" name="presentNum" id="presentNum${state.index}"
                                    onchange="giveNum(${state.index})"
                                    value="${(empty orderProduct.giveNum)?'0':(orderProduct.giveNum)}" class="required2 "
-                                    ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?'readonly="readonly"':''}
+                            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?'readonly="readonly"':''}
                                    style="width: 50px"></td>
                     </c:when>
                     <c:when test="${purchaseProduct.cmPromotion ne null}">
@@ -368,14 +515,15 @@
 
                 <td><input type="text" name="taxRate" id="taxRate${state.index}"
                            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(${state.index})" style="width: 50px">${(purchaseProduct.includedTax != '' and purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)?'':'%'}
+                    ${(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(${state.index})"
+                           style="width: 50px">${(purchaseProduct.includedTax != '' and purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)?'':'%'}
                 </td>
                 <td><input name="addedValueTax" id="addedValueTax${state.index}"
                            value="${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?0:(purchaseProduct.includedTax ne '' and (purchaseProduct.includedTax eq 1 or (purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)))?'---': empty purchaseProduct.addedValueTax ?0:(purchaseProduct.addedValueTax)}"
                            readonly style="width: 80px">
-               </td>
+                </td>
                 <td><input name="totalAddedValueTax" id="totalAddedValueTax${state.index}"
                            value="${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?0:(purchaseProduct.includedTax ne '' and (purchaseProduct.includedTax eq 1 or (purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)))?'---': empty purchaseProduct.totalAddedValueTax ?0:(purchaseProduct.totalAddedValueTax)}"
                            readonly style="width: 80px">
@@ -393,7 +541,7 @@
                                 <option value="0">否</option>
                             </c:when>
                             <c:otherwise>
-                                <option value="1" selected="checked" >是</option>
+                                <option value="1" selected="checked">是</option>
                                 <option value="0">否</option>
                             </c:otherwise>
                         </c:choose>
@@ -401,15 +549,21 @@
                 </td>
                 <td id="promotion${state.index}">
                     <c:if test="${purchaseProduct.cmPromotion.mode eq 1}">
-                        <label style="float: left;cursor: default"><a href="javascript:void(0);" onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label style="background: green;color: white;">${purchaseProduct.cmPromotion.name}</label>
+                        <label style="float: left;cursor: default"><a href="javascript:void(0);"
+                                                                      onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label
+                                style="background: green;color: white;">${purchaseProduct.cmPromotion.name}</label>
                             <label>优惠价:${purchaseProduct.cmPromotion.touchPrice}</label></a></label>
                     </c:if>
                     <c:if test="${purchaseProduct.cmPromotion.mode eq 2}">
-                        <label style="float: left"><a href="javascript:void(0);" onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label style="background: #F60;color: white;" >${purchaseProduct.cmPromotion.name}</label>
+                        <label style="float: left"><a href="javascript:void(0);"
+                                                      onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label
+                                style="background: #F60;color: white;">${purchaseProduct.cmPromotion.name}</label>
                             <label>满${purchaseProduct.cmPromotion.touchPrice},减${purchaseProduct.cmPromotion.reducedPrice}</label></a></label>
                     </c:if>
                     <c:if test="${purchaseProduct.cmPromotion.mode eq 3}">
-                        <label style="float: left"><a href="javascript:void(0);" onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label style="background: purple;color: white;" >${purchaseProduct.cmPromotion.name}</label>
+                        <label style="float: left"><a href="javascript:void(0);"
+                                                      onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label
+                                style="background: purple;color: white;">${purchaseProduct.cmPromotion.name}</label>
                             <label>满${purchaseProduct.cmPromotion.touchPrice},赠送商品</label></a></label>
                     </c:if>
                 </td>
@@ -431,75 +585,98 @@
                 </td>
                     <%--促销活动mode--%>
                 <td style="display: none">
-                    <input name="mode"  id="mode${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.mode: '0'}" readonly  style="width: 80px">
+                    <input name="mode" id="mode${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.mode: '0'}" readonly
+                           style="width: 80px">
                 </td>
                     <%--促销活动touchPrice--%>
                 <td style="display: none">
-                    <input name="touchPrice"  id="touchPrice${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.touchPrice: '0'}" readonly  style="width: 80px">
+                    <input name="touchPrice" id="touchPrice${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.touchPrice: '0'}"
+                           readonly style="width: 80px">
                 </td>
                     <%--促销活动reducedPrice--%>
                 <td style="display: none">
-                    <input name="touchPrice"  id="reducedPrice${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.reducedPrice: '0'}" readonly  style="width: 80px">
+                    <input name="touchPrice" id="reducedPrice${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.reducedPrice: '0'}"
+                           readonly style="width: 80px">
                 </td>
                     <%--name--%>
                 <td style="display: none">
-                    <input name="name"  id="promotionName${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.name: '0'}" readonly  style="width: 80px">
+                    <input name="name" id="promotionName${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.name: '0'}" readonly
+                           style="width: 80px">
                 </td>
                     <%--promotionsId--%>
                 <td style="display: none">
-                    <input name="promotionsId"  id="promotionsId${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.id: '0'}" readonly  style="width: 80px">
+                    <input name="promotionsId" id="promotionsId${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.id: '0'}" readonly
+                           style="width: 80px">
                 </td>
                     <%--${ctx}--%>
                 <td style="display: none">
-                    <input name="ctx"  id="ctx${state.index}" value="${ctx}" readonly  style="width: 80px">
+                    <input name="ctx" id="ctx${state.index}" value="${ctx}" readonly style="width: 80px">
                 </td>
                     <%--是否含税--%>
                 <td style="display: none">
-                    <input name="includedTax"  id="includedTax${state.index}" value="${purchaseProduct.includedTax}" readonly  style="width: 80px">
+                    <input name="includedTax" id="includedTax${state.index}" value="${purchaseProduct.includedTax}"
+                           readonly style="width: 80px">
                 </td>
                     <%--发票类型--%>
                 <td style="display: none">
-                    <input name="invoiceType"  id="invoiceType${state.index}" value="${purchaseProduct.invoiceType}" readonly  style="width: 80px">
+                    <input name="invoiceType" id="invoiceType${state.index}" value="${purchaseProduct.invoiceType}"
+                           readonly style="width: 80px">
                 </td>
                     <%--供应商税率--%>
                 <td style="display: none">
-                    <input name="supplierTaxRate"  id="supplierTaxRate${state.index}" value="${purchaseProduct.supplierTaxRate}" readonly  style="width: 80px">
+                    <input name="supplierTaxRate" id="supplierTaxRate${state.index}"
+                           value="${purchaseProduct.supplierTaxRate}" readonly style="width: 80px">
                 </td>
                     <%--供应商税费(单)--%>
                 <td style="display: none">
-                    <input name="singleShouldPayTotalTax"  id="singleShouldPayTotalTax${state.index}" value="${purchaseProduct.singleShouldPayTotalTax}" readonly  style="width: 80px">
+                    <input name="singleShouldPayTotalTax" id="singleShouldPayTotalTax${state.index}"
+                           value="${purchaseProduct.singleShouldPayTotalTax}" readonly style="width: 80px">
                 </td>
                     <%--供应商税费(总)--%>
                 <td style="display: none">
-                    <input name="shouldPayTotalTax"  id="shouldPayTotalTax${state.index}" value="${purchaseProduct.shouldPayTotalTax}" readonly  style="width: 80px">
+                    <input name="shouldPayTotalTax" id="shouldPayTotalTax${state.index}"
+                           value="${purchaseProduct.shouldPayTotalTax}" readonly style="width: 80px">
                 </td>
                     <%--成本价选中标志:1固定成本 2比例成--%>
                 <td style="display: none">
-                    <input name="costCheckFlag"  id="costCheckFlag${state.index}" value="${purchaseProduct.costCheckFlag}" readonly  style="width: 80px">
+                    <input name="costCheckFlag" id="costCheckFlag${state.index}"
+                           value="${purchaseProduct.costCheckFlag}" readonly style="width: 80px">
                 </td>
                     <%--成本价--%>
                 <td style="display: none">
-                    <input name="costPrice"  id="costPrice${state.index}" value="${purchaseProduct.costPrice}" readonly  style="width: 80px">
+                    <input name="costPrice" id="costPrice${state.index}" value="${purchaseProduct.costPrice}" readonly
+                           style="width: 80px">
                 </td>
                     <%--比例成本百分比90%--%>
                 <td style="display: none">
-                    <input name="costProportional"  id="costProportional${state.index}" value="${purchaseProduct.costProportional}" readonly  style="width: 80px">
+                    <input name="costProportional" id="costProportional${state.index}"
+                           value="${purchaseProduct.costProportional}" readonly style="width: 80px">
                 </td>
                     <%--旧商品标志,供应商税率跟随机构税率变动--%>
                 <td style="display: none">
-                    <input name="oldProductFlag"  id="oldProductFlag${state.index}" value="${purchaseProduct.oldProductFlag}" readonly  style="width: 80px">
+                    <input name="oldProductFlag" id="oldProductFlag${state.index}"
+                           value="${purchaseProduct.oldProductFlag}" readonly style="width: 80px">
                 </td>
                 <td style="display: none">
-                    <input name="svipReduction" id="svipReduction${state.index}" value="${purchaseProduct.svipReduction}">
+                    <input name="svipReduction" id="svipReduction${state.index}"
+                           value="${purchaseProduct.svipReduction}">
                 </td>
                 <td style="display: none">
-                    <input name="svipTaxReduction" id="svipTaxReduction${state.index}"  value="${purchaseProduct.svipTaxReduction}">
+                    <input name="svipTaxReduction" id="svipTaxReduction${state.index}"
+                           value="${purchaseProduct.svipTaxReduction}">
                 </td>
                 <td style="display: none">
-                    <input name="svipPriceFlag" id="svipPriceFlag${state.index}" value="${purchaseProduct.svipPriceFlag}">
+                    <input name="svipPriceFlag" id="svipPriceFlag${state.index}"
+                           value="${purchaseProduct.svipPriceFlag}">
                 </td>
                 <td style="display: none">
-                    <input name="svipPriceType" id="svipPriceType${state.index}" value="${purchaseProduct.svipPriceType}">
+                    <input name="svipPriceType" id="svipPriceType${state.index}"
+                           value="${purchaseProduct.svipPriceType}">
                 </td>
                 <td>
                     <c:if test="${purchaseProduct.couponsLogo eq 1}">

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

@@ -644,6 +644,7 @@
                                     </td>
                                 </tr>
                                 <tr>
+                                    <td>规格:${cmReturnedPurchaseProduct.unit}</td>
                                     <td>税率:${cmReturnedPurchaseProduct.taxRate}</td>
                                     <td>税费:¥${cmReturnedPurchaseProduct.totalAddedValueTax}</td>
                                     <td colspan="2">总额:¥${cmReturnedPurchaseProduct.totalFee}</td>

+ 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>

+ 163 - 113
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityProductForm.jsp

@@ -14,30 +14,31 @@
             //$("#name").focus();
             $("#inputForm").validate({
                 submitHandler: function (form) {
-                    debugger
-                    alertx(111)
-                    if ($('input[name="activityLadderList[0].buyNum"]:visible').length>0){
-                        var buyNum = $('input[name="activityLadderList[0].buyNum"]').val();
-                        var buyPrice = $('input[name="activityLadderList[0].buyPrice"]').val();
-                        if(buyNum<=0 || buyNum == '' || buyPrice<=0 || buyPrice == ''){
-                            alertx("请输入正确的阶梯价格");
-                            return false;
+                    var size = $('#skuSize').val();
+                    for (let i = 0; i < size; i++) {
+                        if ($('input[name="skus[' + i + '].ladderPriceList[0].buyNum"]:visible').length > 0) {
+                            buyNum = $('input[name="skus[' + i + '].ladderPriceList[0].buyNum"]').val();
+                            buyPrice = $('input[name="skus[' + i + '].ladderPriceList[0].buyPrice"]').val();
+                            if (buyNum <= 0 || buyNum == '' || buyPrice <= 0 || buyPrice == '') {
+                                alertx("请输入正确的阶梯价格");
+                                return false;
+                            }
                         }
-                    }
-                    if ($('input[name="activityLadderList[1].buyNum"]:visible').length>0){
-                        var buyNum1 = $('input[name="activityLadderList[1].buyNum"]').val();
-                        var buyPrice1 = $('input[name="activityLadderList[1].buyPrice"]').val();
-                        if(buyNum1<=0 || buyNum1 == '' || buyPrice1<=0 || buyPrice1 == ''){
-                            alertx("请输入正确的阶梯价格");
-                            return false;
+                        if ($('input[name="skus[' + i + '].ladderPriceList[1].buyNum"]:visible').length > 0) {
+                            buyNum1 = $('input[name="skus[' + i + '].ladderPriceList[1].buyNum"]').val();
+                            buyPrice1 = $('input[name="skus[' + i + '].ladderPriceList[1].buyPrice"]').val();
+                            if (buyNum1 <= 0 || buyNum1 == '' || buyPrice1 <= 0 || buyPrice1 == '') {
+                                alertx("请输入正确的阶梯价格");
+                                return false;
+                            }
                         }
-                    }
-                    if ($('input[name="activityLadderList[2].buyNum"]:visible').length>0){
-                        var buyNum2 = $('input[name="activityLadderList[2].buyNum"]').val();
-                        var buyPrice2 = $('input[name="activityLadderList[2].buyPrice"]').val();
-                        if(buyNum2<=0 || buyNum2 == '' || buyPrice2<=0 || buyPrice2 == ''){
-                            alertx("请输入正确的阶梯价格");
-                            return false;
+                        if ($('input[name="skus[' + i + '].ladderPriceList[2].buyNum"]:visible').length > 0) {
+                            buyNum2 = $('input[name="skus[' + i + '].ladderPriceList[2].buyNum"]').val();
+                            buyPrice2 = $('input[name="skus[' + i + '].ladderPriceList[2].buyPrice"]').val();
+                            if (buyNum2 <= 0 || buyNum2 == '' || buyPrice2 <= 0 || buyPrice2 == '') {
+                                alertx("请输入正确的阶梯价格");
+                                return false;
+                            }
                         }
                     }
                     loading('正在提交,请稍等...');
@@ -74,88 +75,120 @@
         <label>供应商:</label>${cmHeheActivityProduct.shopName}
     </div>
     <div class="control-group">
-        <label>机构价:</label>${cmHeheActivityProduct.price}
-    </div>
-    <div class="control-group">
-        <label>活动价:</label>
-        <div id="ladderPrice1">
-            &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="activityLadderList[0].buyNum" min="1" type="number"
-                                                    maxlength="11" class="short number" onblur="checkBuyNum(this, 0)"/>及以上,
-            <form:input path="activityLadderList[0].buyPrice" type="number" maxlength="11" class="short price"
-                        onblur="checkBuyPrice(this, 0)"/>元/(${cmHeheActivityProduct.unit})
-            <span class="showBtn ${null != cmHeheActivityProduct.activityLadderList[1] && null != cmHeheActivityProduct.activityLadderList[1].buyNum ? "hide" : ""}">
-                                <a class="addBtn" href="javascript:;">添加</a>
-                                <form:hidden path="activityLadderList[0].id"/>
+        <input id="skuSize" value="${cmHeheActivityProduct.skus.size()}" type="hidden">
+        <c:forEach items="${cmHeheActivityProduct.skus}" var="sku" varStatus="index">
+            <div>
+                <label>规格:规格${index.index+1}</label>
+            </div>
+            <div>
+                <label>机构价:</label><input id="price${index.index}" value="${sku.price}" class="input-medium" type="text"
+                                          style="width: 60px" disabled/>
+            </div>
+            <label>活动价:</label>
+            <div class="sku${index.index}">
+                <input id="skuId" type="hidden" value="${sku.skuId}">
+                <div id="ladderPrice1">
+                    &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="skus[${index.index}].ladderPriceList[0].buyNum"
+                                                            min="1" type="number"
+                                                            maxlength="11" class="short number"
+                                                            onblur="checkBuyNum(this, 0,${index.index})"/>及以上,
+                    <form:input path="skus[${index.index}].ladderPriceList[0].buyPrice" type="number" maxlength="11"
+                                class="short price"
+                                onblur="checkBuyPrice(this, 0 ,${index.index})"/>元/(${sku.unit})
+                    <span class="showBtn ${null != sku.ladderPriceList[1] && null != sku.ladderPriceList[1].buyNum ? 'hide' : ''}">
+                                <a class="addBtn" href="javascript:;" onclick="addPrice1(${index.index})">添加</a>
+                                <form:hidden path="skus[${index.index}].ladderPriceList[0].id"/>
                             </span>
-        </div>
-        <div id="ladderPrice2" ${null == cmHeheActivityProduct.activityLadderList[1] && null == cmHeheActivityProduct.activityLadderList[1].buyNum ? "class='hide'" : ""}>
-            &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="activityLadderList[1].buyNum" type="number" maxlength="11"
-                                                    class="short number" onblur="checkBuyNum(this, 1)"/>及以上,
-            <form:input path="activityLadderList[1].buyPrice" type="number" maxlength="11" class="short price"
-                        onblur="checkBuyPrice(this, 1)"/>元/(${cmHeheActivityProduct.unit})
-            <span class="showBtn ${null != cmHeheActivityProduct.activityLadderList[2] && null != cmHeheActivityProduct.activityLadderList[2].buyNum ? "hide" : ""}">
-                                <a class="delBtn" href="javascript:;">删除</a> / <a class="addBtn"
-                                                                                  href="javascript:;">添加</a>
-                                <form:hidden path="activityLadderList[1].id"/>
+                </div>
+                <div id="ladderPrice2" ${null == sku.ladderPriceList[1] && null == sku.ladderPriceList[1].buyNum ? "class='hide'" : ""}>
+                    &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="skus[${index.index}].ladderPriceList[1].buyNum"
+                                                            type="number" maxlength="11"
+                                                            class="short number"
+                                                            onblur="checkBuyNum(this, 1 , ${index.index})"/>及以上,
+                    <form:input path="skus[${index.index}].ladderPriceList[1].buyPrice" type="number" maxlength="11"
+                                class="short price"
+                                onblur="checkBuyPrice(this, 1 , ${index.index})"/>元/(${sku.unit})
+                    <span class="showBtn ${null != sku.ladderPriceList[2] && null != sku.ladderPriceList[2].buyNum ? "hide" : ""}">
+                        <a class="delBtn" href="javascript:;" onclick="delPrice2(${index.index})">删除</a> /
+                        <a class="addBtn" onclick="addPrice2(${index.index})" href="javascript:;">添加</a>
+                                <form:hidden path="skus[${index.index}].ladderPriceList[1].id"/>
                             </span>
-        </div>
-        <div id="ladderPrice3" ${null == cmHeheActivityProduct.activityLadderList[2] && null == cmHeheActivityProduct.activityLadderList[2].buyNum ? "class='hide'" : ""}>
-            &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="activityLadderList[2].buyNum" type="number" maxlength="11"
-                                                    class="short number" onblur="checkBuyNum(this, 2)"/>及以上,
-            <form:input path="activityLadderList[2].buyPrice" type="number" maxlength="11" class="short price"
-                        onblur="checkBuyPrice(this, 2)"/>元/(${cmHeheActivityProduct.unit})
-            <span class="showBtn"><a class="delBtn" href="javascript:;">删除</a></span>
-            <form:hidden path="activityLadderList[2].id"/>
-        </div>
+                    <input id="delFlag2" value="${sku.ladderPriceList[1].delFlag}" type="hidden"/>
+                </div>
+                <div id="ladderPrice3" ${null == sku.ladderPriceList[2] && null == sku.ladderPriceList[2].buyNum ? "class='hide'" : ""}>
+                    &nbsp;&nbsp;&nbsp;&nbsp;起订量:<form:input path="skus[${index.index}].ladderPriceList[2].buyNum"
+                                                            type="number" maxlength="11"
+                                                            class="short number"
+                                                            onblur="checkBuyNum(this, 2 ,${index.index})"/>及以上,
+                    <form:input path="skus[${index.index}].ladderPriceList[2].buyPrice" type="number" maxlength="11"
+                                class="short price"
+                                onblur="checkBuyPrice(this, 2 , ${index.index})"/>元/(${sku.unit})
+                    <span class="showBtn"><a class="delBtn" href="javascript:;"
+                                             onclick="delPrice3(${index.index})">删除</a></span>
+                    <form:hidden path="skus[${index.index}].ladderPriceList[2].id"/>
+                    <input id="delFlag3" value="${sku.ladderPriceList[2].delFlag}" type="hidden"/>
+                </div>
+            </div>
+        </c:forEach>
     </div>
 </form:form>
 
 <script>
-    // 阶梯价格点击事件
-    $("#ladderPrice1").on("click", ".addBtn", function () {
-        $("#ladderPrice2").removeClass("hide");
-        $("#delFlag2").val("0");
-        $("#ladderPrice1").find(".showBtn").addClass("hide");
-    });
-    $("#ladderPrice2").on("click", ".addBtn", function () {
-        $("#ladderPrice3").removeClass("hide");
-        $("#delFlag3").val("0");
-        $("#ladderPrice2").find(".showBtn").addClass("hide");
-    }).on("click", ".delBtn", function () {
-        $("#ladderPrice2").addClass("hide");
-        $("#ladderPrice1").find(".showBtn").removeClass("hide");
-        $("#delFlag2").val("1");
-    });
-    $("#ladderPrice3").on("click", ".delBtn", function () {
-        $("#ladderPrice3").addClass("hide");
-        $("#ladderPrice2").find(".showBtn").removeClass("hide");
-        $("#delFlag3").val("1");
-    });
+    function addPrice1(index) {
+        var skuIndex = ".sku" + index;
+        $(skuIndex).find("#ladderPrice2").removeClass("hide");
+        $(skuIndex).find("#delFlag2").val("0");
+        $(skuIndex).find("#ladderPrice1").find(".showBtn").addClass("hide");
+    }
+
+    function addPrice2(index) {
+        var skuIndex = ".sku" + index;
+        $(skuIndex).find("#ladderPrice3").removeClass("hide");
+        $(skuIndex).find("#delFlag3").val("0");
+        $(skuIndex).find("#ladderPrice2").find(".showBtn").addClass("hide");
+    }
+
+    function delPrice2(index) {
+        var skuIndex = ".sku" + index;
+        $(skuIndex).find("#ladderPrice2").addClass("hide");
+        $(skuIndex).find("#ladderPrice1").find(".showBtn").removeClass("hide");
+        $(skuIndex).find("#delFlag2").val("1");
+    }
+
+    function delPrice3(index) {
+        var skuIndex = ".sku" + index;
+        $(skuIndex).find("#ladderPrice3").addClass("hide");
+        $(skuIndex).find("#ladderPrice2").find(".showBtn").removeClass("hide");
+        $(skuIndex).find("#delFlag3").val("1");
+    }
+
 
     // 检查阶梯数量
-    function checkBuyNum(input, index) {
+    function checkBuyNum(input, index, skuIndex) {
+        var skus = ".sku" + skuIndex;
         if (index > 0) {
-            var beforeNum = $('input[name="activityLadderList[' + (index - 1) + '].buyNum"]').val() * 1;
+            var beforeNum = $(skus).find('input[name="skus[' + skuIndex + '].ladderPriceList[' + (index - 1) + '].buyNum"]').val() * 1;
             if (input.value * 1 <= beforeNum) {
                 alertx("请输入大于上一阶起订量的值");
-                $(input).val(input.value * 1 + beforeNum);
+                $(skus).find(input).val(input.value * 1 + beforeNum);
             }
         } else {
-            var minNum = $('input[name="activityLadderList[0].buyNum"]').val() * 1;
-            $('#minBuyNumber').val(minNum);
+            var minNum = $(skus).find('input[name="skus[' + skuIndex + '].ladderPriceList[0].buyNum"]').val() * 1;
+            $(skus).find('#minBuyNumber').val(minNum);
         }
     }
 
     // 检查阶梯价格
-    function checkBuyPrice(input, index) {
+    function checkBuyPrice(input, index, skuIndex) {
+        var skus = ".sku" + skuIndex;
         if (index > 0) {
-            var beforePrice = $('input[name="activityLadderList[' + (index - 1) + '].buyPrice"]').val() * 1;
+            var beforePrice = $(skus).find('input[name="skus[' + skuIndex + '].ladderPriceList[' + (index - 1) + '].buyPrice"]').val() * 1;
             if (input.value * 1 > beforePrice) {
                 $(input).val('');
                 alertx("请输入小于前一个价格的值");
             }
         } else {
-            var price = $('#price').val();
+            var price = $('#price' + skuIndex).val();
             if (input.value * 1 > price) {
                 $(input).val('');
                 alertx("第一个阶梯价格不能大于机构价");
@@ -164,42 +197,59 @@
     }
 
     function onclickSave() {
-        if ($('input[name="activityLadderList[0].buyNum"]:visible').length>0){
-            var buyNum = $('input[name="activityLadderList[0].buyNum"]').val();
-            var buyPrice = $('input[name="activityLadderList[0].buyPrice"]').val();
-            if(buyNum<=0 || buyNum == '' || buyPrice<=0 || buyPrice == ''){
-                return false;
+        var size = $('#skuSize').val();
+        var skus = new Array();
+        for (let i = 0; i < size; i++) {
+            //根据sku数量循环包装数据返回页面保存
+            var buyNum;
+            var buyPrice;
+            var buyNum1;
+            var buyPrice1;
+            var buyNum2;
+            var buyPrice2;
+            if ($('input[name="skus[' + i + '].ladderPriceList[0].buyNum"]:visible').length > 0) {
+                buyNum = $('input[name="skus[' + i + '].ladderPriceList[0].buyNum"]').val();
+                buyPrice = $('input[name="skus[' + i + '].ladderPriceList[0].buyPrice"]').val();
+                if (buyNum <= 0 || buyNum == '' || buyPrice <= 0 || buyPrice == '') {
+                    return false;
+                }
             }
-        }
-        if ($('input[name="activityLadderList[1].buyNum"]:visible').length>0){
-            var buyNum1 = $('input[name="activityLadderList[1].buyNum"]').val();
-            var buyPrice1 = $('input[name="activityLadderList[1].buyPrice"]').val();
-            if(buyNum1<=0 || buyNum1 == '' || buyPrice1<=0 || buyPrice1 == ''){
-                return false;
+            if ($('input[name="skus[' + i + '].ladderPriceList[1].buyNum"]:visible').length > 0) {
+                buyNum1 = $('input[name="skus[' + i + '].ladderPriceList[1].buyNum"]').val();
+                buyPrice1 = $('input[name="skus[' + i + '].ladderPriceList[1].buyPrice"]').val();
+                if (buyNum1 <= 0 || buyNum1 == '' || buyPrice1 <= 0 || buyPrice1 == '') {
+                    return false;
+                }
             }
-        }
-        if ($('input[name="activityLadderList[2].buyNum"]:visible').length>0){
-            var buyNum2 = $('input[name="activityLadderList[2].buyNum"]').val();
-            var buyPrice2 = $('input[name="activityLadderList[2].buyPrice"]').val();
-            if(buyNum2<=0 || buyNum2 == '' || buyPrice2<=0 || buyPrice2 == ''){
-                return false;
+            if ($('input[name="skus[' + i + '].ladderPriceList[2].buyNum"]:visible').length > 0) {
+                buyNum2 = $('input[name="skus[' + i + '].ladderPriceList[2].buyNum"]').val();
+                buyPrice2 = $('input[name="skus[' + i + '].ladderPriceList[2].buyPrice"]').val();
+                if (buyNum2 <= 0 || buyNum2 == '' || buyPrice2 <= 0 || buyPrice2 == '') {
+                    return false;
+                }
             }
+
+            var skuId = $('.sku' + i).find("#skuId").val();
+            var con={};
+            con["skuId"] = skuId;
+            con["ladder1"] = buyNum + "," + buyPrice;
+            con["ladderSize"] = 1;
+            con["ladder2"];
+            con["ladder3"];
+            var delFlag2 = $('.sku' + i).find("#delFlag2").val() * 1;
+            var delFlag3 = $('.sku' + i).find("#delFlag3").val() * 1;
+            if (0 == delFlag2 && !$('.sku' + i).find("#ladderPrice2").is(":hidden")) {
+                con["ladderSize"] = 2;
+                con["ladder2"] = buyNum1 + "," + buyPrice1;
+            }
+            if (0 == delFlag3 && !$('.sku' + i).find("#ladderPrice3").is(":hidden")) {
+                con["ladderSize"] = 3;
+                con["ladder3"] = buyNum2 + "," + buyPrice2;
+            }
+            skus[i]=con;
         }
-        var params = "";
-        var buyNum = $('input[name="activityLadderList[0].buyNum"]').val() * 1;
-        var buyPrice = $('input[name="activityLadderList[0].buyPrice"]').val() * 1;
-        params = buyNum + "," + buyPrice;
-        if (!$("#ladderPrice2").is(":hidden")) {
-            var buyNum1 = $('input[name="activityLadderList[1].buyNum"]').val() * 1;
-            var buyPrice1 = $('input[name="activityLadderList[1].buyPrice"]').val() * 1;
-            params = params + "-" + buyNum1 + "," + buyPrice1;
-        }
-        if (!$("#ladderPrice3").is(":hidden")) {
-            var buyNum2 = $('input[name="activityLadderList[2].buyNum"]').val() * 1;
-            var buyPrice2 = $('input[name="activityLadderList[2].buyPrice"]').val() * 1;
-            params = params + "-" + buyNum2 + "," + buyPrice2;
-        }
-        return params;
+        var skJ = JSON.stringify(skus);
+        return skJ;
     }
 </script>
 </body>

+ 8 - 19
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheActivityProductList.jsp

@@ -29,7 +29,8 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/hehe/cmHeheActivity/list">活动列表</a></li>
-    <li class="active"><a href="${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}">活动商品列表</a></li>
+    <li class="active"><a
+            href="${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}">活动商品列表</a></li>
 </ul>
 <form:form id="searchForm" modelAttribute="cmHeheActivityProduct" action="${ctx}/hehe/cmHeheActivityProduct/"
            method="post" class="breadcrumb form-search">
@@ -53,8 +54,7 @@
         <th>图片</th>
         <th>名称</th>
         <th>供应商</th>
-        <th>售价</th>
-        <th>活动价</th>
+        <th>有无活动价</th>
         <th>操作</th>
     </tr>
     </thead>
@@ -71,21 +71,7 @@
                     ${cmHeheActivityProduct.shopName}
             </td>
             <td>
-                    ${cmHeheActivityProduct.price}
-            </td>
-            <td>
-                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 1}">
-                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[0].buyNum})</label><br>
-                </c:if>
-                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 2}">
-                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[0].buyNum}-${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
-                    <label>¥${cmHeheActivityProduct.activityLadderList[1].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
-                </c:if>
-                <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 3}">
-                    <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[0].buyNum}-${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
-                    <label>¥${cmHeheActivityProduct.activityLadderList[1].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[1].buyNum}-${cmHeheActivityProduct.activityLadderList[2].buyNum})</label><br>
-                    <label>¥${cmHeheActivityProduct.activityLadderList[2].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[2].buyNum})</label><br>
-                </c:if>
+                    ${0 ==cmHeheActivityProduct.ladderFlag?'无':'有'}
             </td>
             <td>
                 <a href="javascript:void(0);" onclick="showLadder(${cmHeheActivityProduct.id})">编辑</a>
@@ -170,7 +156,10 @@
                     var params = $jboxFrame[0].contentWindow.onclickSave();
                     console.log(params);
                     if (params != false) {
-                        $.post("${ctx}/hehe/cmHeheActivityProduct/saveActivityLadder?params=" + params + "&id=" + id, function (data) {
+                        $.post("${ctx}/hehe/cmHeheActivityProduct/saveActivityLadder", {
+                            'params': params,
+                            'id': id
+                        }, function (data) {
                             if (true == data.success) {
                                 $.jBox.tip(data.info, 'info');
                                 setTimeout(function () {

+ 234 - 190
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheCollageProductForm.jsp

@@ -1,205 +1,249 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
 <html>
 <head>
-	<title>商品管理</title>
-	<meta name="decorator" content="default"/>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			//$("#name").focus();
-			$("#inputForm").validate({
-				submitHandler: function(form){
-					var productId = $("#productId").val();
-					if (productId == '') {
-						alertx("请选择商品");
-						return false;
-					}
-					loading('正在提交,请稍等...');
-					form.submit();
-				},
-				errorContainer: "#messageBox",
-				errorPlacement: function(error, element) {
-					$("#messageBox").text("输入有误,请先更正。");
-					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
-						error.appendTo(element.parent().parent());
-					} else {
-						error.insertAfter(element);
-					}
-				}
-			});
-		});
-	</script>
+    <title>商品管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    var productId = $("#productId").val();
+                    if (productId == '') {
+                        alertx("请选择商品");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
 </head>
 <body>
-	<ul class="nav nav-tabs">
-		<li><a href="${ctx}/hehe/cmHeheCollageProduct/">商品列表</a></li>
-		<li class="active"><a href="${ctx}/hehe/cmHeheCollageProduct/form?id=${cmHeheCollageProduct.id}">商品${not empty cmHeheCollageProduct.id?'编辑':'添加'}</a></li>
-	</ul><br/>
-	<form:form id="inputForm" modelAttribute="cmHeheCollageProduct" action="${ctx}/hehe/cmHeheCollageProduct/save" method="post" class="form-horizontal">
-		<form:hidden path="id"/>
-		<sys:message content="${message}"/>
-		<form:hidden path="productId"/>
-		<form:hidden path="unlimitedFlag"/>
-		<div class="control-group">
-			<label class="control-label"><font color="red">*</font>商品:</label>
-			<div class="controls">
-				<label class="noProd"><a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a></label>
-			</div>
-			<table id="contentTable" class="table table-striped table-bordered table-condensed hasProd">
-				<thead>
-				<th>商品ID</th>
-				<th>图片</th>
-				<th>商品名称</th>
-				<th>供应商</th>
-				<th>操作</th>
-				</thead>
-				<tbody id="contentTbody">
-				<tr>
-					<td id="productIdTd">${cmHeheCollageProduct.productId}</td>
-					<td><img id="productImageTd" src="${cmHeheCollageProduct.productImage}" width="50px" height="50px"></td>
-					<td id="productNameTd">${cmHeheCollageProduct.productName}</td>
-					<td id="shopNameTd">${cmHeheCollageProduct.shopName}</td>
-					<td>
-						<a href="javaScript:;"
-						   onclick="deleteProduct()">删除</a>
-					</td>
-				</tr>
-				</tbody>
-			</table>
-		</div>
-		<div class="hasProd">
-			<div class="control-group">
-				<label class="control-label"><font color="red">*</font>拼团价格:</label>
-				<div class="controls">
-					<form:input path="price" htmlEscape="false" class="input-xlarge  number required"/>
-				</div>
-			</div>
-			<div class="control-group">
-				<label class="control-label"><font color="red">*</font>单人限购量:</label>
-				<div class="controls">
-					<input type="number" id="limitedNum" name="limitedNum" onkeyup="onlynum(this)" value="${cmHeheCollageProduct.limitedNum}" min="1" required>
-					<input type="checkbox" id="unlimitedFlag" name="unlimitedFlag" class="formCheck" value="${cmHeheCollageProduct.unlimitedFlag eq 1?1:0}"
-						${cmHeheCollageProduct.unlimitedFlag eq 1 ? "checked" : ""} onclick="changeCondition()" />不限
-					<input id="limitedNumTemp" type="hidden" value="${cmHeheCollageProduct.limitedNum}">
-				</div>
-			</div>
-			<div class="control-group">
-				<label class="control-label"><font color="red">*</font>拼团人数:</label>
-				<div class="controls">
-					<form:input path="memberNum" htmlEscape="false" class="input-xlarge  digits required"/>
-				</div>
-			</div>
-		</div>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/hehe/cmHeheCollageProduct/">商品列表</a></li>
+    <li class="active"><a
+            href="${ctx}/hehe/cmHeheCollageProduct/form?id=${cmHeheCollageProduct.id}">商品${not empty cmHeheCollageProduct.id?'编辑':'添加'}</a>
+    </li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="cmHeheCollageProduct" action="${ctx}/hehe/cmHeheCollageProduct/save"
+           method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <sys:message content="${message}"/>
+    <form:hidden path="productId"/>
+    <form:hidden path="unlimitedFlag"/>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>商品:</label>
+        <div class="controls">
+            <label class="noProd"><a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a></label>
+        </div>
+        <table id="contentTable" class="table table-striped table-bordered table-condensed hasProd">
+            <thead>
+            <th>商品ID</th>
+            <th>图片</th>
+            <th>商品名称</th>
+            <th>供应商</th>
+            <th>操作</th>
+            </thead>
+            <tbody id="contentTbody">
+            <tr>
+                <td id="productIdTd">${cmHeheCollageProduct.productId}</td>
+                <td><img id="productImageTd" src="${cmHeheCollageProduct.productImage}" width="50px" height="50px"></td>
+                <td id="productNameTd">${cmHeheCollageProduct.productName}</td>
+                <td id="shopNameTd">${cmHeheCollageProduct.shopName}</td>
+                <td>
+                    <a href="javaScript:;"
+                       onclick="deleteProduct()">删除</a>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+    </div>
+    <div class="hasProd">
+        <div class="control-group" id="skus">
+            <c:forEach items="${cmHeheCollageProduct.skus}" var="sku" varStatus="index">
+                <label class="control-label"><font color="red">*</font>规格:规格${index.index+1}</label>
+                <input name="skus[${index.index}].skuId" value="${sku.skuId}" type="hidden">
+                <div class="controls" style="display:flex">
+                    <div>
+                        <label class="control-label"><font color="red">*</font>售价:</label>
+                        <form:input path="skus[${index.index}].price" htmlEscape="false" cssStyle="width: 80px;"
+                                    disabled="true" class="input-xlarge  number"/>
+                    </div>
+                    <div>
+                        <label class="control-label"><font color="red">*</font>拼团价格:</label>
+                        <form:input path="skus[${index.index}].collagePrice" htmlEscape="false" cssStyle="width: 90px;"
+                                    class="input-xlarge  number required"/>
+                    </div>
+                </div>
+            </c:forEach>
+        </div>
+        <div class="control-group">
+            <label class="control-label"><font color="red">*</font>单人限购量:</label>
+            <div class="controls">
+                <input type="number" id="limitedNum" name="limitedNum" onkeyup="onlynum(this)"
+                       value="${cmHeheCollageProduct.limitedNum}" min="1" required>
+                <input type="checkbox" id="unlimitedFlag" name="unlimitedFlag" class="formCheck"
+                       value="${cmHeheCollageProduct.unlimitedFlag eq 1?1:0}"
+                    ${cmHeheCollageProduct.unlimitedFlag eq 1 ? "checked" : ""} onclick="changeCondition()"/>不限
+                <input id="limitedNumTemp" type="hidden" value="${cmHeheCollageProduct.limitedNum}">
+            </div>
+        </div>
+        <div class="control-group">
+            <label class="control-label"><font color="red">*</font>拼团人数:</label>
+            <div class="controls">
+                <form:input path="memberNum" htmlEscape="false" class="input-xlarge  digits required"/>
+            </div>
+        </div>
+    </div>
 
-		<div class="control-group">
-			<label class="control-label"><font color="red">*</font>商品状态:</label>
-			<div class="controls">
-				<form:select path="status" class="input-xlarge ">
-					<form:option value="1" label="已上架"/>
-					<form:option value="0" label="已下架"/>
-				</form:select>
-			</div>
-		</div>
-		<div class="form-actions">
-			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
-			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
-		</div>
-	</form:form>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>商品状态:</label>
+        <div class="controls">
+            <form:select path="status" class="input-xlarge ">
+                <form:option value="1" label="已上架"/>
+                <form:option value="0" label="已下架"/>
+            </form:select>
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
 <script>
-	$(function () {
-		showInfo();
-	});
+    $(function () {
+        showInfo();
+    });
 
-	function showInfo() {
-		var productId = $("#productId").val();
-		if (productId != '') {
-			$(".hasProd").show();
-			$(".noProd").hide();
-		} else {
-			$(".hasProd").hide();
-			$(".noProd").show();
-		}
-		var unlimitedFlag = $("#unlimitedFlag").val();
-		if (unlimitedFlag == '') {
-			$("#unlimitedFlag").val(0);
-			unlimitedFlag = '0';
-		}
-		if (unlimitedFlag === '1') {
-			$("#limitedNum").attr('readonly', true);
-			$("#limitedNum").attr('required', false);
-		} else {
-			$("#limitedNum").attr('readonly', false);
-			$("#limitedNum").attr('required', true);
-		}
-	}
+    function showInfo(va) {
+        var productId = $("#productId").val();
+        if (productId != '') {
+            $(".hasProd").show();
+            $(".noProd").hide();
+        } else {
+            $(".hasProd").hide();
+            $(".noProd").show();
+        }
+        var unlimitedFlag = $("#unlimitedFlag").val();
+        if (unlimitedFlag == '') {
+            $("#unlimitedFlag").val(0);
+            unlimitedFlag = '0';
+        }
+        if (unlimitedFlag === '1') {
+            $("#limitedNum").attr('readonly', true);
+            $("#limitedNum").attr('required', false);
+        } else {
+            $("#limitedNum").attr('readonly', false);
+            $("#limitedNum").attr('required', true);
+        }
+        if (null != va && 1 === va) {
+            //sku填充
+            $.ajax({
+                url: "${ctx}/hehe/cmHeheCollageProduct/getSku?productId=" + productId,
+                type: "GET",
+                dataType: "json",
+                data: "",
+                success: function (res) {
+                    console.log(res);
+                    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 += "<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);
+                }
+            });
+        }
+    }
 
-	function changeCondition() {
-		var obj = $("#unlimitedFlag");
-		var val = obj.val();
-		if (val === '1') {
-			obj.val(0);
-			val = '0';
-		} else {
-			obj.val(1);
-			val = '1';
-		}
-		var inputObj = $("#limitedNum");
-		// 临时数据
-		var tempObj = $("#limitedNumTemp");
-		if (val === '1') {
-			inputObj.attr('readonly', true);
-			inputObj.attr('required', false);
-			tempObj.val(inputObj.val());
-			inputObj.val('');
-		} else {
-			inputObj.attr('readonly', false);
-			inputObj.attr('required', true);
-			inputObj.val(tempObj.val());
-			tempObj.val('');
-		}
-	}
+    function changeCondition() {
+        var obj = $("#unlimitedFlag");
+        var val = obj.val();
+        if (val === '1') {
+            obj.val(0);
+            val = '0';
+        } else {
+            obj.val(1);
+            val = '1';
+        }
+        var inputObj = $("#limitedNum");
+        // 临时数据
+        var tempObj = $("#limitedNumTemp");
+        if (val === '1') {
+            inputObj.attr('readonly', true);
+            inputObj.attr('required', false);
+            tempObj.val(inputObj.val());
+            inputObj.val('');
+        } else {
+            inputObj.attr('readonly', false);
+            inputObj.attr('required', true);
+            inputObj.val(tempObj.val());
+            tempObj.val('');
+        }
+    }
 
-	function showSelect() {
-		var url = "${ctx}/hehe/cmHeheCollageProduct/toAddProduct";
-		var title = '';
-		title = "选择商品";
-		top.$.jBox("iframe:" + url, {
-			iframeScrolling: 'yes',
-			width: $(top.document).width() - 400,
-			height: $(top.document).height() - 160,
-			persistent: true,
-			title: title,
-			buttons: {"确定": '1', "取消": '-1'},
-			submit: function (v, h, f) {
-				//确定
-				var $jboxFrame = top.$('#jbox-iframe');
-				var $mainFrame = top.$('#mainFrame');
-				if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
-					var items = $jboxFrame[0].contentWindow.getCheckedItems();
-					$("#productId").val(items[0].productId);
-					$("#productIdTd").text(items[0].productId);
-					$("#productImageTd").attr('src', items[0].image);
-					$("#productNameTd").text(items[0].productName);
-					$("#shopNameTd").text(items[0].shopName);
-					showInfo();
-				}
-				return true;
-			}
-		});
-	}
+    function showSelect() {
+        var url = "${ctx}/hehe/cmHeheCollageProduct/toAddProduct";
+        var title = '';
+        title = "选择商品";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 400,
+            height: $(top.document).height() - 160,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "取消": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems();
+                    console.log(items);
+                    $("#productId").val(items[0].productId);
+                    $("#productIdTd").text(items[0].productId);
+                    $("#productImageTd").attr('src', items[0].image);
+                    $("#productNameTd").text(items[0].productName);
+                    $("#shopNameTd").text(items[0].shopName);
+                    showInfo(1);
+                }
+                return true;
+            }
+        });
+    }
 
-	function deleteProduct() {
-		$("#productId").val('');
-		showInfo();
-	}
+    function deleteProduct() {
+        $("#productId").val('');
+        showInfo();
+    }
 
-	/**
-	 * @param obj
-	 * jquery控制input只能输入数字
-	 */
-	function onlynum(obj) {
-		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
-	}
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
 </script>
 </body>
 </html>

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

@@ -1,651 +1,728 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
 <html>
 <head>
-	<title>呵呵商品管理</title>
-	<meta name="decorator" content="default"/>
-	<style>
-		body {
-			font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
-			font-size: 14px;
-			line-height: 1.42857143;
-			color: #666;
-			margin: 0;
-		}
-
-		.hidden {
-			display: none !important;
-		}
-		.selectPickerWrapper * {
-			box-sizing: border-box;
-		}
-		.selectPickerWrapper {
-			position: relative;
-			/* margin: 50px; */
-			display: inline-block;
-		}
-		.select-picker-search {
-			width: 200px;
-			height: 32px;
-			line-height: 32px;
-			color: #666;
-			border-radius: 3px;
-			border: 1px solid #ddd;
-			padding: 0 10px;
-			font-size: 14px;
-			cursor: pointer;
-		}
-		.select-picker-search-checked {
-			position: relative;
-			width: 180px;
-			white-space: nowrap;
-			text-overflow: ellipsis;
-			overflow: hidden;
-			padding-right: 5px;
-		}
-		.select-picker-search-checked:after {
-			border: 5px solid transparent;
-			content: ' ';
-			height: 0;
-			position: absolute;
-			width: 0;
-			top: 12.2px;
-			border-top: 8px solid #666;
-			right: 0;
-		}
-		.select-picker-options-wrp {
-			display: none;
-			width: 200px;
-			border-radius: 2px;
-			box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
-			background-color: #fff;
-			position: absolute;
-			top: 36px;
-			left: 0;
-			z-index: 999;
-		}
-		.select-picker-options-serch input {
-			width: 160px;
-			height: 32px;
-			line-height: 32px;
-			border: 1px solid #ddd;
-			border-radius: 3px;
-			margin: 12px 0 0 10px;
-			padding-left: 8px;
-		}
-		.select-picker-options-serch input:focus {
-			border-color: #2fa4e7;
-			outline: 0;
-			-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
-			box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
-		}
-		.select-picker-options-list {
-			width: 100%;
-			padding: 8px 0;
-		}
-		.select-picker-options-list-item {
-			width: 100%;
-			line-height: 36px;
-			cursor: pointer;
-			padding: 0 12px;
-		}
-		.select-picker-options-list-item:hover {
-			background: #ebf1f5;
-		}
-		.duihao {
-			display: inline-block;
-			width: 18px;
-			height: 18px;
-			border-radius: 3px;
-			transform: translateY(4px);
-			margin-right: 6px;
-		}
-		.duihao-checked {
-			background: #2fa4e7;
-			position: relative;
-		}
-		.duihao-checked:before,
-		.duihao-checked::after {
-			content: '';
-			height: 10px;
-			width: 2px;
-			border-radius: 10px;
-			display: block;
-			background: white;
-			position: absolute;
-			top: 4px;
-			left: 10px;
-			transform: rotate(45deg);
-			-ms-transform: rotate(45deg);
-		}
-		.duihao-checked::before {
-			height: 6px;
-			transform: rotate(-45deg);
-			-ms-transform: rotate(-45deg);
-			position: absolute;
-			top: 7px;
-			left: 5px;
-		}
-		.duihao-nocheck {
-			border: 1px solid #ddd;
-		}
-
-	</style>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			//$("#name").focus();
-			$("#inputForm").validate({
-				submitHandler: function (form) {
-					var productId = $('#productId').val();
-					if (productId.length == 0) {
-						alertx("请选择商品");
-						return false;
-					}
-					loading('正在提交,请稍等...');
-					form.submit();
-				},
-				errorContainer: "#messageBox",
-				errorPlacement: function (error, element) {
-					$("#messageBox").text("输入有误,请先更正。");
-					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
-						error.appendTo(element.parent().parent());
-					} else {
-						error.insertAfter(element);
-					}
-				}
-			});
-		});
-
-
-		/*;(function ($, window, document, undefined) {
-			//用一个自调用匿名函数把插架代码包裹起来,防止代码污染
-			$.fn.mySelect = function (options) {
-				var defaults = {
-					//defaults 使我们设置的默认参数。
-					callback: function (res) {
-						console.log(res)
-					},
-				}
-				var options = $.extend(defaults, options) //将传入参数和默认参数合并
-				var $this = $(this) //当然响应事件对象
-				var selectValues = []
-				//生成option-item并追加展示
-				var html = ''
-				html += '<div class="select-picker-search">'
-				html += '<div class="select-picker-search-checked">请选择</div>'
-				html += '</div>'
-				html += '<div class="select-picker-options-wrp">'
-				// html += '<div class="select-picker-options-serch">';
-				// html += '<input type="text" placeholder="">';
-				// html += '</div>';
-				html += '<div class="select-picker-options-list">'
-				$this.find('option').each(function () {
-					let _this = $(this)
-					html += '<div class="select-picker-options-list-item"'
-					html += 'value="' + _this.attr('value') + '">'
-					html += '<b class="duihao duihao-nocheck"></b>'
-					html += '<span>' + _this.text() + '</span>'
-					html += '</div>'
-				})
-				html += '</div>'
-				html += '</div>'
-				$this.append(html)
-				// 下拉显示隐藏
-				$this.on('click', '.select-picker-search', function (e) {
-					//功能代码部分,绑定事件
-					$(this).next('.select-picker-options-wrp').toggle()
-					// $(this).next('.select-picker-options-wrp').find('.select-picker-options-serch input').focus()
-				})
-				// 点击选中或不选
-				$this.on('click', '.select-picker-options-list-item', function () {
-					let _this = $(this)
-					if (_this.find('.duihao-nocheck').length > 0) {
-						_this.find('.duihao').removeClass('duihao-nocheck').addClass('duihao-checked')
-					} else {
-						_this.find('.duihao').addClass('duihao-nocheck').removeClass('duihao-checked')
-					}
-					// 循环遍历options中选中的项添加到选项栏中
-					var checkedArr = []
-					selectValues = []
-					$this.find('.select-picker-options-list-item').each(function () {
-						let _this = $(this)
-						if (_this.find('.duihao-checked').length > 0) {
-							checkedArr.push($.trim(_this.text()))
-							selectValues.push(_this.attr('value'))
-						}
-					})
-					if (checkedArr.length > 0) {
-						$this.find('.select-picker-search-checked').text(checkedArr.join(','))
-						// $this.find('.select-picker-search-checked').text(checkedArr.join(',')).css('color', '#fff');
-					} else {
-						$this.find('.select-picker-search-checked').text('请选择').css('color', '#757575')
-					}
-					// 回调
-					options.callback(selectValues)
-				})
-				// 前端实现下拉搜索
-				// $this.on('keyup', '.select-picker-options-serch input', function () {
-				// 	var text = $(this).val()
-				// 	var html = ''
-				// 	$this.find('option').each(function () {
-				// 		let _this = $(this)
-				// 		if (_this.text().indexOf(text) != -1) {
-				// 			html += '<div class="select-picker-options-list-item">'
-				// 			html += '<b class="duihao duihao-nocheck"></b>'
-				// 			html += '<span>' + _this.text() + '</span>'
-				// 			html += '</div>'
-				// 		}
-				// 	})
-				// 	if (html == '') {
-				// 		html += '<p style="text-align:center;">没有相关内容</p>'
-				// 	}
-				// 	$this.find('.select-picker-options-list').html('').append(html)
-				// })
-				// 点击document任意地方 下拉消失
-				$(document).click(function (event) {
-					var _con = $('.select-picker-options-wrp') // 设置目标区域
-					var _con2 = $('.select-picker-search-checked') // 设置目标区域
-					if (!_con2.is(event.target) && !_con.is(event.target) && _con.has(event.target).length === 0) {
-						// Mark 1
-						$('.select-picker-options-wrp').hide() //淡出消失
-					}
-				})
-			}
-		})(jQuery, window, document)
-
-		$(function () {
-			$('#demo1').mySelect({
-				callback: function (res) {
-					console.log(res);
-					$("#floorIds").val(res)
-				},
-			})
-		})*/
-	</script>
+    <title>呵呵商品管理</title>
+    <meta name="decorator" content="default"/>
+    <style>
+        body {
+            font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+            font-size: 14px;
+            line-height: 1.42857143;
+            color: #666;
+            margin: 0;
+        }
+
+        .hidden {
+            display: none !important;
+        }
+
+        .selectPickerWrapper * {
+            box-sizing: border-box;
+        }
+
+        .selectPickerWrapper {
+            position: relative;
+            /* margin: 50px; */
+            display: inline-block;
+        }
+
+        .select-picker-search {
+            width: 200px;
+            height: 32px;
+            line-height: 32px;
+            color: #666;
+            border-radius: 3px;
+            border: 1px solid #ddd;
+            padding: 0 10px;
+            font-size: 14px;
+            cursor: pointer;
+        }
+
+        .select-picker-search-checked {
+            position: relative;
+            width: 180px;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+            overflow: hidden;
+            padding-right: 5px;
+        }
+
+        .select-picker-search-checked:after {
+            border: 5px solid transparent;
+            content: ' ';
+            height: 0;
+            position: absolute;
+            width: 0;
+            top: 12.2px;
+            border-top: 8px solid #666;
+            right: 0;
+        }
+
+        .select-picker-options-wrp {
+            display: none;
+            width: 200px;
+            border-radius: 2px;
+            box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
+            background-color: #fff;
+            position: absolute;
+            top: 36px;
+            left: 0;
+            z-index: 999;
+        }
+
+        .select-picker-options-serch input {
+            width: 160px;
+            height: 32px;
+            line-height: 32px;
+            border: 1px solid #ddd;
+            border-radius: 3px;
+            margin: 12px 0 0 10px;
+            padding-left: 8px;
+        }
+
+        .select-picker-options-serch input:focus {
+            border-color: #2fa4e7;
+            outline: 0;
+            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
+            box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
+        }
+
+        .select-picker-options-list {
+            width: 100%;
+            padding: 8px 0;
+        }
+
+        .select-picker-options-list-item {
+            width: 100%;
+            line-height: 36px;
+            cursor: pointer;
+            padding: 0 12px;
+        }
+
+        .select-picker-options-list-item:hover {
+            background: #ebf1f5;
+        }
+
+        .duihao {
+            display: inline-block;
+            width: 18px;
+            height: 18px;
+            border-radius: 3px;
+            transform: translateY(4px);
+            margin-right: 6px;
+        }
+
+        .duihao-checked {
+            background: #2fa4e7;
+            position: relative;
+        }
+
+        .duihao-checked:before,
+        .duihao-checked::after {
+            content: '';
+            height: 10px;
+            width: 2px;
+            border-radius: 10px;
+            display: block;
+            background: white;
+            position: absolute;
+            top: 4px;
+            left: 10px;
+            transform: rotate(45deg);
+            -ms-transform: rotate(45deg);
+        }
+
+        .duihao-checked::before {
+            height: 6px;
+            transform: rotate(-45deg);
+            -ms-transform: rotate(-45deg);
+            position: absolute;
+            top: 7px;
+            left: 5px;
+        }
+
+        .duihao-nocheck {
+            border: 1px solid #ddd;
+        }
+
+        .control-group>div::after{
+            content: "";
+            display: block;
+            clear: both;
+        }
+
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    var productId = $('#productId').val();
+                    if (productId.length == 0) {
+                        alertx("请选择商品");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+
+
+        /*;(function ($, window, document, undefined) {
+            //用一个自调用匿名函数把插架代码包裹起来,防止代码污染
+            $.fn.mySelect = function (options) {
+                var defaults = {
+                    //defaults 使我们设置的默认参数。
+                    callback: function (res) {
+                        console.log(res)
+                    },
+                }
+                var options = $.extend(defaults, options) //将传入参数和默认参数合并
+                var $this = $(this) //当然响应事件对象
+                var selectValues = []
+                //生成option-item并追加展示
+                var html = ''
+                html += '<div class="select-picker-search">'
+                html += '<div class="select-picker-search-checked">请选择</div>'
+                html += '</div>'
+                html += '<div class="select-picker-options-wrp">'
+                // html += '<div class="select-picker-options-serch">';
+                // html += '<input type="text" placeholder="">';
+                // html += '</div>';
+                html += '<div class="select-picker-options-list">'
+                $this.find('option').each(function () {
+                    let _this = $(this)
+                    html += '<div class="select-picker-options-list-item"'
+                    html += 'value="' + _this.attr('value') + '">'
+                    html += '<b class="duihao duihao-nocheck"></b>'
+                    html += '<span>' + _this.text() + '</span>'
+                    html += '</div>'
+                })
+                html += '</div>'
+                html += '</div>'
+                $this.append(html)
+                // 下拉显示隐藏
+                $this.on('click', '.select-picker-search', function (e) {
+                    //功能代码部分,绑定事件
+                    $(this).next('.select-picker-options-wrp').toggle()
+                    // $(this).next('.select-picker-options-wrp').find('.select-picker-options-serch input').focus()
+                })
+                // 点击选中或不选
+                $this.on('click', '.select-picker-options-list-item', function () {
+                    let _this = $(this)
+                    if (_this.find('.duihao-nocheck').length > 0) {
+                        _this.find('.duihao').removeClass('duihao-nocheck').addClass('duihao-checked')
+                    } else {
+                        _this.find('.duihao').addClass('duihao-nocheck').removeClass('duihao-checked')
+                    }
+                    // 循环遍历options中选中的项添加到选项栏中
+                    var checkedArr = []
+                    selectValues = []
+                    $this.find('.select-picker-options-list-item').each(function () {
+                        let _this = $(this)
+                        if (_this.find('.duihao-checked').length > 0) {
+                            checkedArr.push($.trim(_this.text()))
+                            selectValues.push(_this.attr('value'))
+                        }
+                    })
+                    if (checkedArr.length > 0) {
+                        $this.find('.select-picker-search-checked').text(checkedArr.join(','))
+                        // $this.find('.select-picker-search-checked').text(checkedArr.join(',')).css('color', '#fff');
+                    } else {
+                        $this.find('.select-picker-search-checked').text('请选择').css('color', '#757575')
+                    }
+                    // 回调
+                    options.callback(selectValues)
+                })
+                // 前端实现下拉搜索
+                // $this.on('keyup', '.select-picker-options-serch input', function () {
+                // 	var text = $(this).val()
+                // 	var html = ''
+                // 	$this.find('option').each(function () {
+                // 		let _this = $(this)
+                // 		if (_this.text().indexOf(text) != -1) {
+                // 			html += '<div class="select-picker-options-list-item">'
+                // 			html += '<b class="duihao duihao-nocheck"></b>'
+                // 			html += '<span>' + _this.text() + '</span>'
+                // 			html += '</div>'
+                // 		}
+                // 	})
+                // 	if (html == '') {
+                // 		html += '<p style="text-align:center;">没有相关内容</p>'
+                // 	}
+                // 	$this.find('.select-picker-options-list').html('').append(html)
+                // })
+                // 点击document任意地方 下拉消失
+                $(document).click(function (event) {
+                    var _con = $('.select-picker-options-wrp') // 设置目标区域
+                    var _con2 = $('.select-picker-search-checked') // 设置目标区域
+                    if (!_con2.is(event.target) && !_con.is(event.target) && _con.has(event.target).length === 0) {
+                        // Mark 1
+                        $('.select-picker-options-wrp').hide() //淡出消失
+                    }
+                })
+            }
+        })(jQuery, window, document)
+
+        $(function () {
+            $('#demo1').mySelect({
+                callback: function (res) {
+                    console.log(res);
+                    $("#floorIds").val(res)
+                },
+            })
+        })*/
+    </script>
 </head>
 <body>
-	<ul class="nav nav-tabs">
-		<li><a href="${ctx}/hehe/cmHeheProduct/">商品列表</a></li>
-		<li class="active"><a href="${ctx}/hehe/cmHeheProduct/form?id=${cmHeheProduct.id}">${not empty cmHeheProduct.id?'编辑':'添加'}</a></li>
-	</ul><br/>
-	<form:form id="inputForm" modelAttribute="cmHeheProduct" action="${ctx}/hehe/cmHeheProduct/save" method="post" class="form-horizontal">
-		<form:hidden path="id"/>
-		<form:hidden path="productId" id="productId"/>
-		<sys:message content="${message}"/>
-<%--        <form:hidden path="floorIds"/>--%>
-		<div class="control-group">
-			<label class="control-label"><font color="red">*</font>商品:</label>
-			<div class="controls" id="addProduct">
-				<a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a>
-			</div>
-			<table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
-				<thead>
-					<tr>
-						<th>图片</th>
-						<th>商品名称</th>
-						<th>供应商</th>
-						<th>操作</th>
-					</tr>
-				</thead>
-				<tbody>
-					<tr>
-						<td><img id="mainImage" src="${cmHeheProduct.mainImage}" width="50px" height="50px"></td>
-						<td style="text-align: center" id="name">${cmHeheProduct.name}</td>
-						<td id="shopName">${cmHeheProduct.shopName}</td>
-						<td><a href="javascript:void(0);" onclick="deleteProduct()">删除</a></td>
-					</tr>
-				</tbody>
-			</table>
-		</div>
-		<div id="productInfo" hidden="hidden">
-			<div class="control-group">
-				<label class="control-label"><font color="red">*</font>售价:</label>
-				<div class="controls">
-					<input type="number" style="width:100px;" min="0" id="price" name="price" value="${cmHeheProduct.price}" required onblur="checkPrice(this)">
-				</div>
-			</div>
-			<div class="control-group">
-				<label class="control-label"><font color="red">*</font>是否含税:</label>
-				<div class="controls">
-					<form:radiobutton id="includedTax1" path="includedTax" value="1" label="含税" onclick="chageIncludedTax()"/>&nbsp;&nbsp;&nbsp;&nbsp;
-					<form:radiobutton id="includedTax0" path="includedTax" value="0" label="不含税" onclick="chageIncludedTax()"/>
-				</div>
-				<br>
-				<div class="controls">
-					<form:radiobutton id="invoiceType1" path="invoiceType" value="1" label="增值税专用发票" onclick="showTaxPoint()"/>&nbsp;&nbsp;&nbsp;&nbsp;
-					<form:radiobutton id="invoiceType2" path="invoiceType" value="2" label="增值税普通发票" onclick="showTaxPoint()"/>&nbsp;&nbsp;&nbsp;&nbsp;
-					<span id="invoiceTypeShow"><form:radiobutton id="invoiceType3" path="invoiceType" value="3" label="不能开票" onclick="showTaxPoint()"/></span>
-				</div>
-			</div>
-			<div class="control-group taxPointShow">
-				<label class="control-label"><font color="red">*</font>机构税率:</label>
-				<div class="controls">
-					<input type="number" style="width:100px;" id="clubTaxPoint" name="clubTaxPoint" value="${cmHeheProduct.clubTaxPoint}" required>%
-				</div>
-			</div>
-			<div class="control-group taxPointShow">
-				<label class="control-label"><font color="red">*</font>供应商税率:</label>
-				<div class="controls">
-					<input type="number" style="width:100px;" id="shopTaxPoint" name="shopTaxPoint" value="${cmHeheProduct.shopTaxPoint}" required>%
-				</div>
-			</div>
-			<div class="control-group">
-				<label class="control-label"><font color="red">*</font>成本价类型:</label>
-				<div class="controls" id="costType">
-						${cmHeheProduct.costType eq 1 ? '固定成本' : '比例成本'}
-				</div>
-			</div>
-			<div class="control-group" id="costPriceShow">
-				<label class="control-label"><font color="red">*</font>成本价:</label>
-				<div class="controls" id="costPrice">
-					${cmHeheProduct.costPrice}
-				</div>
-			</div>
-			<div class="control-group" id="costProportionalShow">
-				<label class="control-label"><font color="red">*</font>比例成本百分比:</label>
-				<div class="controls" id="costProportional">
-					${cmHeheProduct.costProportional}%
-				</div>
-			</div>
-		</div>
-		<div class="control-group">
-			<label class="control-label"><font color="red">*</font>商品分类:</label>
-			<div class="controls">
-				<form:select path="bigTypeId" class="input-small required" id="bigType" onchange="loadSmallType()">
-					<form:option value="" label="请选择"/>
-					<form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID"
-								  htmlEscape="false"/>
-				</form:select>
-				<form:select path="smallTypeId" class="input-small required" id="smallType">
-					<form:option value="" label="请选择"/>
-					<c:forEach items="${classify.smalltypeList}" var="smallType">
-						<form:option value="${smallType.smallTypeID}" label="${smallType.name}"
-									 bigTypeId="${smallType.bigTypeID}"/>
-					</c:forEach>
-				</form:select>
-			</div>
-		</div>
-		<div class="control-group">
-			<label class="control-label"><font color="red">*</font>商品状态:</label>
-			<div class="controls">
-				<form:select path="validFlag" class="input-small required">
-					<form:option value="" label="请选择"/>
-					<form:option value="1" label="已上架"/>
-					<form:option value="2" label="已下架"/>
-				</form:select>
-			</div>
-		</div>
-		<c:if test="${cmHeheProduct.id eq null}">
-			<%--<div class="control-group">
-				<label class="control-label">首页楼层:</label>
-				<div class="controls" style="overflow: visible">
-					<div id="demo1" class="selectPickerWrapper">
-						<select class="hidden" multiple="multiple" id="select">
-							<c:forEach items="${floorList}" var="floor">
-								<option value="${floor.id}" checked="${floor.checked?'checked':''}">${floor.title}</option>
-							</c:forEach>
-						</select>
-					</div>
-				</div>
-			</div>--%>
-			<div class="control-group">
-				<label class="control-label">商城活动:</label>
-				<div class="controls">
-					<form:select path="activityId" class="input-small">
-						<form:option value="" label="选择活动"/>
-						<form:options items="${activityList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
-					</form:select>
-				</div>
-			</div>
-		</c:if>
-		<div class="form-actions">
-			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
-			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
-		</div>
-	</form:form>
-
-<script>
-	$(function () {
-		//初始化商品信息
-		if (${not empty cmHeheProduct.id}){
-			$('#contentTable').show();
-			$('#productInfo').show();
-			$('#addProduct').hide();
-			chageIncludedTax();
-			changeCostPriceShow(${cmHeheProduct.costType});
-			showTaxPoint();
-		}
-	});
-
-
-	//选择添加商品
-	function showSelect() {
-		var url = '';
-		var title = '';
-		url = "${ctx}/hehe/cmHeheProduct/findProductPage";
-		title = "选择商品";
-		top.$.jBox("iframe:" + url, {
-			iframeScrolling: 'yes',
-			width: $(top.document).width() - 600,
-			height: $(top.document).height() - 160,
-			persistent: true,
-			title: title,
-			buttons: {"确定": '1', "关闭": '-1'},
-			submit: function (v, h, f) {
-				//确定
-				var $jboxFrame = top.$('#jbox-iframe');
-				var $mainFrame = top.$('#mainFrame');
-				if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
-					var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
-					if (items.length > 0) {
-						console.log(items);
-						$('#contentTable').show();
-						$('#productInfo').show();
-						$('#addProduct').hide();
-						var productId = items[0].productId;
-						var mainImage = items[0].mainImage;
-						var name = items[0].name;
-						var shopName = items[0].shopName;
-						var price = items[0].price;
-						var includedTax = items[0].includedTax;
-						var invoiceType = items[0].invoiceType;
-						var clubTaxPoint = items[0].clubTaxPoint;
-						var shopTaxPoint = items[0].shopTaxPoint;
-						var costType = items[0].costType;
-						var costPrice = items[0].costPrice;
-						var costProportional = items[0].costProportional;
-						$("#mainImage").attr("src", mainImage);
-						$("#shopName").text(shopName);
-						$("#productId").val(productId);
-						$("#name").text(name);
-						$("#price").val(price);
-						if (includedTax == 1) {
-							$('#includedTax1').attr('checked', true);
-						} else {
-							$('#includedTax0').attr('checked', true);
-						}
-						if (invoiceType == 1) {
-							$('#invoiceType1').attr('checked', true);
-						} else if (invoiceType == 2) {
-							$('#invoiceType2').attr('checked', true);
-						} else {
-							$('#invoiceType3').attr('checked', true);
-						}
-						$("#clubTaxPoint").val(clubTaxPoint);
-						$("#shopTaxPoint").val(shopTaxPoint);
-						if (costType == 1) {
-							$('#costType').text('固定成本');
-						} else {
-							$('#costType').text('比例成本');
-						}
-						$("#costPrice").text(costPrice);
-						$("#costProportional").text(costProportional + '%');
-						chageIncludedTax();
-						changeCostPriceShow(costType);
-						showTaxPoint();
-					} else {
-						top.$.jBox.tip("请先勾选商品...");
-						return false;
-					}
-				}
-				return true;
-			}
-		});
-	}
-
-	//是否含税显示
-	function chageIncludedTax() {
-		var includedTax = $("input[name='includedTax']:checked").val();
-		if (includedTax == 1) {
-			$('#invoiceTypeShow').hide();
-			var invoiceType = $("input[name='invoiceType']:checked").val();
-			if (invoiceType == 3) {
-				$('#invoiceType1').attr('checked', true);
-				showTaxPoint();
-			}
-		} else {
-			$('#invoiceTypeShow').show();
-		}
-	}
-
-	// 是否固定成本
-	function changeCostPriceShow(costType) {
-		if (costType == 1) {
-			$("#costPriceShow").show();
-			$("#costProportionalShow").hide();
-		} else {
-			$("#costPriceShow").hide();
-			$("#costProportionalShow").show();
-		}
-	}
-
-	//税率显示
-	function showTaxPoint() {
-		var invoiceType = $("input[name='invoiceType']:checked").val();
-		if (invoiceType == 3) {
-			$('.taxPointShow').hide();
-		} else {
-			$('.taxPointShow').show();
-		}
-	}
-
-	//删除商品
-	function deleteProduct() {
-		$('#contentTable').hide();
-		$('#productInfo').hide();
-		$('#addProduct').show();
-		$('#productId').val('');
-	}
-
-	/**
-	 * @param obj
-	 * jquery控制input只能输入数字
-	 */
-	function onlynum(obj) {
-		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
-	}
-
-	/**
-	 * @param obj
-	 * jquery检验售价
-	 */
-	function checkPrice(obj) {
-		if (obj.value == '0') {
-			obj.value = '';
-		}
-	}
-
-	$(window).load(function () {
-		loadInitType();
-	});
-
-	// 网站分类
-	var currentBigtype = ${empty cmHeheProduct.bigTypeId?0:cmHeheProduct.bigTypeId};
-	var currentSmalltype = ${empty cmHeheProduct.smallTypeId?0:cmHeheProduct.smallTypeId};
-	var bigTypeList = [
-		<c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
-		<c:if test="${index.index > 0}">, </c:if>
-		{
-			bigTypeId: ${bigType.bigTypeID},
-			name: "${bigType.name}",
-			typeSort: ${bigType.typeSort}
-		}
-		</c:forEach>
-	];
-	var smalltypeList = [
-		<c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
-		<c:if test="${index.index > 0}">, </c:if>
-		{
-			smallTypeId: ${smalltype.smallTypeID},
-			name: "${smalltype.name}",
-			bigTypeId: ${smalltype.bigTypeID},
-		}
-		</c:forEach>
-	];
-	
-	
-	// 初始分类
-	function loadInitType() {
-		if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
-			setTimeout(function () {
-				loadBigType();
-			}, 0);
-		}
-	}
-
-	// 分类联动
-	function loadBigType() {
-		$("#bigType").html("");
-		$("#bigType").prev().find(".select2-chosen").text("请选择");
-		$("#bigType").append("<option value=''>请选择</option>");
-		$("#smallType").html("");
-		$("#smallType").prev().find(".select2-chosen").text("请选择");
-		$("#smallType").append("<option value=''>请选择</option>");
-		$("#tinyType").html("");
-		$("#tinyType").prev().find(".select2-chosen").text("请选择");
-		$("#tinyType").append("<option value=''>请选择</option>");
-		for (var i = 0; i < bigTypeList.length; i++) {
-			if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeId) {
-				$("#bigType").append("<option selected value='" + bigTypeList[i].bigTypeId + "'>" + bigTypeList[i].name + "</option>");
-				$("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
-				setTimeout(function () {
-					loadSmallType();
-				}, 500);
-			} else {
-				$("#bigType").append("<option value='" + bigTypeList[i].bigTypeId + "'>" + bigTypeList[i].name + "</option>");
-			}
-		}
-		loadSmallType();
-	}
-
-	function loadSmallType(id) {
-		if (id) {
-			$("#bigType").val(id);
-			$("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
-		}
-		var bigType = $("#bigType").val();
-		$("#smallType").html("");
-		$("#smallType").prev().find(".select2-chosen").text("请选择");
-		$("#smallType").append("<option value=''>请选择</option>");
-		$("#tinyType").html("");
-		$("#tinyType").prev().find(".select2-chosen").text("请选择");
-		$("#tinyType").append("<option value=''>请选择</option>");
-		if (typeof (bigType) != "undefined" && bigType != "") {
-			var smallTypeNum = 0;
-			for (var i = 0; i < smalltypeList.length; i++) {
-				if (bigType == smalltypeList[i].bigTypeId) {
-					smallTypeNum = smallTypeNum + 1;
-					if (currentSmalltype != null && typeof (currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeId) {
-						$("#smallType").append("<option selected value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
-						$("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
-					} else {
-						$("#smallType").append("<option value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
-					}
-				}
-			}
-			document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
-		}
-	}
-</script>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/hehe/cmHeheProduct/">商品列表</a></li>
+    <li class="active"><a
+            href="${ctx}/hehe/cmHeheProduct/form?id=${cmHeheProduct.id}">${not empty cmHeheProduct.id?'编辑':'添加'}</a>
+    </li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="cmHeheProduct" action="${ctx}/hehe/cmHeheProduct/save" method="post"
+           class="form-horizontal">
+<form:hidden path="id"/>
+<form:hidden path="productId" id="productId"/>
+<sys:message content="${message}"/>
+    <%--        <form:hidden path="floorIds"/>--%>
+<div class="control-group">
+    <label class="control-label"><font color="red">*</font>商品:</label>
+    <div class="controls" id="addProduct">
+        <a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a>
+    </div>
+    <table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
+        <thead>
+        <tr>
+            <th>图片</th>
+            <th>商品名称</th>
+            <th>供应商</th>
+            <th>操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        <tr>
+            <td><img id="mainImage" src="${cmHeheProduct.mainImage}" width="50px" height="50px"></td>
+            <td style="text-align: center" id="name">${cmHeheProduct.name}</td>
+            <td id="shopName">${cmHeheProduct.shopName}</td>
+            <td><a href="javascript:void(0);" onclick="deleteProduct()">删除</a></td>
+        </tr>
+        </tbody>
+    </table>
+</div>
+<div id="productInfo" hidden="hidden">
+    <c:if test="${empty cmHeheProduct.skus}">
+    <div class="control-group" hidden id="skuPrice">
+        </c:if>
+        <c:if test="${not empty cmHeheProduct.skus}">
+        <div class="control-group" id="skuPrice">
+            </c:if>
+            <c:forEach items="${cmHeheProduct.skus}" var="sku" varStatus="index">
+                <div>
+                    <input type="number" style="display:none" value="${sku.skuId}" name="skus[${index.index}].skuId">
+                    <label class="control-label" style="text-align:left">
+                        <font color="red">*</font>规格:${sku.unit}
+                    </label>
+                    <div class="controls">
+                        <font color="red">*</font>售价:
+                        <input type="number" style="width:100px;" min="0" id="price" name="skus[${index.index}].price"
+                               value="${sku.price}" required onblur="checkPrice(this)">
+                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                        <label><font color="red">*</font>成本: ${sku.costCheckFlag eq 1 ? '固定成本' : '比例成本'}</label>
+                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                        <c:if test="${sku.costCheckFlag eq 1}">
+                            <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>
+                        </c:if>
+                    </div>
+                </div>
+            </c:forEach>
+        </div>
+        <div class="control-group">
+            <label class="control-label"><font color="red">*</font>是否含税:</label>
+            <div class="controls">
+                <form:radiobutton id="includedTax1" path="includedTax" value="1" label="含税"
+                                  onclick="chageIncludedTax()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                <form:radiobutton id="includedTax0" path="includedTax" value="0" label="不含税"
+                                  onclick="chageIncludedTax()"/>
+            </div>
+            <br>
+            <div class="controls">
+                <form:radiobutton id="invoiceType1" path="invoiceType" value="1" label="增值税专用发票"
+                                  onclick="showTaxPoint()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                <form:radiobutton id="invoiceType2" path="invoiceType" value="2" label="增值税普通发票"
+                                  onclick="showTaxPoint()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                <span id="invoiceTypeShow"><form:radiobutton id="invoiceType3" path="invoiceType" value="3" label="不能开票"
+                                                             onclick="showTaxPoint()"/></span>
+            </div>
+        </div>
+        <div class="control-group taxPointShow">
+            <label class="control-label"><font color="red">*</font>机构税率:</label>
+            <div class="controls">
+                <input type="number" style="width:100px;" id="clubTaxPoint" name="clubTaxPoint"
+                       value="${cmHeheProduct.clubTaxPoint}" required>%
+            </div>
+        </div>
+        <div class="control-group taxPointShow">
+            <label class="control-label"><font color="red">*</font>供应商税率:</label>
+            <div class="controls">
+                <input type="number" style="width:100px;" id="shopTaxPoint" name="shopTaxPoint"
+                       value="${cmHeheProduct.shopTaxPoint}" required>%
+            </div>
+        </div>
+            <%--        <div class="control-group">--%>
+            <%--            <label class="control-label"><font color="red">*</font>成本价类型:</label>--%>
+            <%--            <div class="controls" id="costType">--%>
+            <%--                    ${cmHeheProduct.costType eq 1 ? '固定成本' : '比例成本'}--%>
+            <%--            </div>--%>
+            <%--        </div>--%>
+            <%--        <div class="control-group" id="costPriceShow">--%>
+            <%--            <label class="control-label"><font color="red">*</font>成本价:</label>--%>
+            <%--            <div class="controls" id="costPrice">--%>
+            <%--                    ${cmHeheProduct.costPrice}--%>
+            <%--            </div>--%>
+            <%--        </div>--%>
+            <%--        <div class="control-group" id="costProportionalShow">--%>
+            <%--            <label class="control-label"><font color="red">*</font>比例成本百分比:</label>--%>
+            <%--            <div class="controls" id="costProportional">--%>
+            <%--                    ${cmHeheProduct.costProportional}%--%>
+            <%--            </div>--%>
+            <%--        </div>--%>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>商品分类:</label>
+        <div class="controls">
+            <form:select path="bigTypeId" class="input-small required" id="bigType" onchange="loadSmallType()">
+                <form:option value="" label="请选择"/>
+                <form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID"
+                              htmlEscape="false"/>
+            </form:select>
+            <form:select path="smallTypeId" class="input-small required" id="smallType">
+                <form:option value="" label="请选择"/>
+                <c:forEach items="${classify.smalltypeList}" var="smallType">
+                    <form:option value="${smallType.smallTypeID}" label="${smallType.name}"
+                                 bigTypeId="${smallType.bigTypeID}"/>
+                </c:forEach>
+            </form:select>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>商品状态:</label>
+        <div class="controls">
+            <form:select path="validFlag" class="input-small required">
+                <form:option value="" label="请选择"/>
+                <form:option value="1" label="已上架"/>
+                <form:option value="2" label="已下架"/>
+            </form:select>
+        </div>
+    </div>
+    <c:if test="${cmHeheProduct.id eq null}">
+        <%--<div class="control-group">
+            <label class="control-label">首页楼层:</label>
+            <div class="controls" style="overflow: visible">
+                <div id="demo1" class="selectPickerWrapper">
+                    <select class="hidden" multiple="multiple" id="select">
+                        <c:forEach items="${floorList}" var="floor">
+                            <option value="${floor.id}" checked="${floor.checked?'checked':''}">${floor.title}</option>
+                        </c:forEach>
+                    </select>
+                </div>
+            </div>
+        </div>--%>
+    <div class="control-group">
+        <label class="control-label">商城活动:</label>
+        <div class="controls">
+            <form:select path="activityId" class="input-small">
+                <form:option value="" label="选择活动"/>
+                <form:options items="${activityList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
+            </form:select>
+        </div>
+    </div>
+    </c:if>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+    </form:form>
+
+    <script>
+        $(function () {
+            //初始化商品信息
+            if (${not empty cmHeheProduct.id}) {
+                $('#contentTable').show();
+                $('#productInfo').show();
+                $('#addProduct').hide();
+                chageIncludedTax();
+                <%--changeCostPriceShow(${cmHeheProduct.costType});--%>
+                showTaxPoint();
+            }
+        });
+
+
+        //选择添加商品
+        function showSelect() {
+            var url = '';
+            var title = '';
+            url = "${ctx}/hehe/cmHeheProduct/findProductPage";
+            title = "选择商品";
+            top.$.jBox("iframe:" + url, {
+                iframeScrolling: 'yes',
+                width: $(top.document).width() - 600,
+                height: $(top.document).height() - 160,
+                persistent: true,
+                title: title,
+                buttons: {"确定": '1', "关闭": '-1'},
+                submit: function (v, h, f) {
+                    //确定
+                    var $jboxFrame = top.$('#jbox-iframe');
+                    var $mainFrame = top.$('#mainFrame');
+                    if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                        var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
+                        if (items.length > 0) {
+                            console.log(items);
+                            var skus = {};
+                            skus = items[0].skuList;
+                            var html = '';
+
+                            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>';
+                                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>';
+                                html += '<div class="controls"><font color="red">*</font>售价:';
+                                html += '<input type="number" style="width:100px;" min="0" id="price" name="skus[' + i + '].price" value="' + skus[i].price + '" required onblur="checkPrice(this)">';
+                                html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
+                                html += '<label><font color="red">*</font>成本: ' + cost + '</label>';
+                                html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
+                                html += costShow + '</div></div>';
+                            }
+                            $("#skuPrice").html(html);
+                            $("#skuPrice").show();
+
+                            $('#contentTable').show();
+                            $('#productInfo').show();
+                            $('#addProduct').hide();
+                            var productId = items[0].productId;
+                            var mainImage = items[0].mainImage;
+                            var name = items[0].name;
+                            var shopName = items[0].shopName;
+                            var price = items[0].price;
+                            var includedTax = items[0].includedTax;
+                            var invoiceType = items[0].invoiceType;
+                            var clubTaxPoint = items[0].clubTaxPoint;
+                            var shopTaxPoint = items[0].shopTaxPoint;
+                            var costType = items[0].costType;
+                            var costPrice = items[0].costPrice;
+                            var costProportional = items[0].costProportional;
+                            $("#mainImage").attr("src", mainImage);
+                            $("#shopName").text(shopName);
+                            $("#productId").val(productId);
+                            $("#name").text(name);
+                            $("#price").val(price);
+                            if (includedTax == 1) {
+                                $('#includedTax1').attr('checked', true);
+                            } else {
+                                $('#includedTax0').attr('checked', true);
+                            }
+                            if (invoiceType == 1) {
+                                $('#invoiceType1').attr('checked', true);
+                            } else if (invoiceType == 2) {
+                                $('#invoiceType2').attr('checked', true);
+                            } else {
+                                $('#invoiceType3').attr('checked', true);
+                            }
+                            $("#clubTaxPoint").val(clubTaxPoint);
+                            $("#shopTaxPoint").val(shopTaxPoint);
+                            if (costType == 1) {
+                                $('#costType').text('固定成本');
+                            } else {
+                                $('#costType').text('比例成本');
+                            }
+                            $("#costPrice").text(costPrice);
+                            $("#costProportional").text(costProportional + '%');
+                            chageIncludedTax();
+                            // changeCostPriceShow(costType);
+                            showTaxPoint();
+                        } else {
+                            top.$.jBox.tip("请先勾选商品...");
+                            return false;
+                        }
+                    }
+                    return true;
+                }
+            });
+        }
+
+        //是否含税显示
+        function chageIncludedTax() {
+            var includedTax = $("input[name='includedTax']:checked").val();
+            if (includedTax == 1) {
+                $('#invoiceTypeShow').hide();
+                var invoiceType = $("input[name='invoiceType']:checked").val();
+                if (invoiceType == 3) {
+                    $('#invoiceType1').attr('checked', true);
+                    showTaxPoint();
+                }
+            } else {
+                $('#invoiceTypeShow').show();
+            }
+        }
+
+        // 是否固定成本
+        // function changeCostPriceShow(costType) {
+        //     if (costType == 1) {
+        //         $("#costPriceShow").show();
+        //         $("#costProportionalShow").hide();
+        //     } else {
+        //         $("#costPriceShow").hide();
+        //         $("#costProportionalShow").show();
+        //     }
+        // }
+
+        //税率显示
+        function showTaxPoint() {
+            var invoiceType = $("input[name='invoiceType']:checked").val();
+            if (invoiceType == 3) {
+                $('.taxPointShow').hide();
+            } else {
+                $('.taxPointShow').show();
+            }
+        }
+
+        //删除商品
+        function deleteProduct() {
+            $('#contentTable').hide();
+            $('#productInfo').hide();
+            $('#addProduct').show();
+            $('#productId').val('');
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        /**
+         * @param obj
+         * jquery检验售价
+         */
+        function checkPrice(obj) {
+            if (obj.value == '0') {
+                obj.value = '';
+            }
+        }
+
+        $(window).load(function () {
+            loadInitType();
+        });
+
+        // 网站分类
+        var currentBigtype = ${empty cmHeheProduct.bigTypeId?0:cmHeheProduct.bigTypeId};
+        var currentSmalltype = ${empty cmHeheProduct.smallTypeId?0:cmHeheProduct.smallTypeId};
+        var bigTypeList = [
+            <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
+            <c:if test="${index.index > 0}">, </c:if>
+            {
+                bigTypeId: ${bigType.bigTypeID},
+                name: "${bigType.name}",
+                typeSort: ${bigType.typeSort}
+            }
+            </c:forEach>
+        ];
+        var smalltypeList = [
+            <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
+            <c:if test="${index.index > 0}">, </c:if>
+            {
+                smallTypeId: ${smalltype.smallTypeID},
+                name: "${smalltype.name}",
+                bigTypeId: ${smalltype.bigTypeID},
+            }
+            </c:forEach>
+        ];
+
+
+        // 初始分类
+        function loadInitType() {
+            if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
+                setTimeout(function () {
+                    loadBigType();
+                }, 0);
+            }
+        }
+
+        // 分类联动
+        function loadBigType() {
+            $("#bigType").html("");
+            $("#bigType").prev().find(".select2-chosen").text("请选择");
+            $("#bigType").append("<option value=''>请选择</option>");
+            $("#smallType").html("");
+            $("#smallType").prev().find(".select2-chosen").text("请选择");
+            $("#smallType").append("<option value=''>请选择</option>");
+            $("#tinyType").html("");
+            $("#tinyType").prev().find(".select2-chosen").text("请选择");
+            $("#tinyType").append("<option value=''>请选择</option>");
+            for (var i = 0; i < bigTypeList.length; i++) {
+                if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeId) {
+                    $("#bigType").append("<option selected value='" + bigTypeList[i].bigTypeId + "'>" + bigTypeList[i].name + "</option>");
+                    $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
+                    setTimeout(function () {
+                        loadSmallType();
+                    }, 500);
+                } else {
+                    $("#bigType").append("<option value='" + bigTypeList[i].bigTypeId + "'>" + bigTypeList[i].name + "</option>");
+                }
+            }
+            loadSmallType();
+        }
+
+        function loadSmallType(id) {
+            if (id) {
+                $("#bigType").val(id);
+                $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
+            }
+            var bigType = $("#bigType").val();
+            $("#smallType").html("");
+            $("#smallType").prev().find(".select2-chosen").text("请选择");
+            $("#smallType").append("<option value=''>请选择</option>");
+            $("#tinyType").html("");
+            $("#tinyType").prev().find(".select2-chosen").text("请选择");
+            $("#tinyType").append("<option value=''>请选择</option>");
+            if (typeof (bigType) != "undefined" && bigType != "") {
+                var smallTypeNum = 0;
+                for (var i = 0; i < smalltypeList.length; i++) {
+                    if (bigType == smalltypeList[i].bigTypeId) {
+                        smallTypeNum = smallTypeNum + 1;
+                        if (currentSmalltype != null && typeof (currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeId) {
+                            $("#smallType").append("<option selected value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
+                            $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
+                        } else {
+                            $("#smallType").append("<option value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
+                        }
+                    }
+                }
+                document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
+            }
+        }
+    </script>
 </body>
 </html>

+ 11 - 4
src/main/webapp/WEB-INF/views/modules/hehe/heheAddProduct.jsp

@@ -16,7 +16,7 @@
                 submitHandler: function (form) {
                     var isSubMitFlag = true;
                     var productID = $("#productID").val();
-                    if (isNaN(productID) || productID.indexOf('0') == 0 ) {
+                    if (isNaN(productID) || productID.indexOf('0') == 0) {
                         alertx("请输入正确的商品ID");
                         isSubMitFlag = false;
                         return false;
@@ -36,12 +36,13 @@
     <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
     <div class="ul-form">
         <label>商品ID:</label>
-        <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini" onkeyup="onlynum(this)"/>
+        <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini"
+                    onkeyup="onlynum(this)"/>
         <label>商品名称:</label>
         <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
         <label>供应商名称:</label>
         <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
-        &nbsp;&nbsp;  <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        &nbsp;&nbsp; <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
         <div class="clearfix"></div>
     </div>
 </form:form>
@@ -56,7 +57,7 @@
     </tr>
     <tbody>
     <c:if test="${not empty page.list}">
-        <c:forEach items="${page.list}" var="item">
+        <c:forEach items="${page.list}" var="item" varStatus="index">
             <tr id="${item.productID}" class="itemtr">
                 <th>
                     <input class="check-item" type="radio" name="info" value='${item.productID}'/>
@@ -66,6 +67,7 @@
                 <td class="name">${item.name}</td>
                 <td id="shopName">${item.shopName}</td>
                 <input type="hidden" value="${item.price}" id="price">
+                <input type="hidden" value="${index.index}" id="index">
                 <input type="hidden" value="${item.includedTax}" id="includedTax">
                 <input type="hidden" value="${item.invoiceType}" id="invoiceType">
                 <input type="hidden" value="${item.taxPoint}" id="clubTaxPoint">
@@ -100,8 +102,13 @@
         var items = new Array();
         var $items = $('.check-item:checked');
         $items.each(function () {
+            var c={};
+            c= ${productList};
+            var index= $(this).parents(".itemtr").find("#index").val();
+            var s=c[index].skuList;
             items.push({
                 productId: $(this).val(),
+                skuList: s,
                 mainImage: $(this).parents(".itemtr").find(".mainImage").attr("src"),
                 name: $(this).parents(".itemtr").find(".name").text(),
                 shopName: $(this).parents(".itemtr").find("#shopName").text(),

+ 192 - 150
src/main/webapp/WEB-INF/views/modules/hehe/heheDiscountActivityProductForm.jsp

@@ -1,162 +1,204 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
 <html>
 <head>
-	<title>商品管理</title>
-	<meta name="decorator" content="default"/>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			//$("#name").focus();
-			$("#inputForm").validate({
-				submitHandler: function(form){
-					var productId = $("#productId").val();
-					if (productId === '') {
-						alertx("请选择商品");
-						return false;
-					}
-					loading('正在提交,请稍等...');
-					form.submit();
-				},
-				errorContainer: "#messageBox",
-				errorPlacement: function(error, element) {
-					$("#messageBox").text("输入有误,请先更正。");
-					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
-						error.appendTo(element.parent().parent());
-					} else {
-						error.insertAfter(element);
-					}
-				}
-			});
-		});
-	</script>
+    <title>商品管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    var productId = $("#productId").val();
+                    if (productId === '') {
+                        alertx("请选择商品");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
 </head>
 <body>
-	<ul class="nav nav-tabs">
-		<li><a href="${ctx}/hehe/heheDiscountActivityProduct/?activityId=${heheDiscountActivityProduct.activityId}">商品列表</a></li>
-		<li class="active"><a href="${ctx}/hehe/heheDiscountActivityProduct/form?id=${heheDiscountActivityProduct.id}&activityId=${heheDiscountActivityProduct.activityId}">商品${not empty heheDiscountActivityProduct.id?'编辑':'添加'}</a></li>
-	</ul><br/>
-	<form:form id="inputForm" modelAttribute="heheDiscountActivityProduct" action="${ctx}/hehe/heheDiscountActivityProduct/save" method="post" class="form-horizontal">
-		<form:hidden path="id"/>
-		<form:hidden path="activityId"/>
-		<form:hidden path="productId"/>
-		<sys:message content="${message}"/>
-		<div class="control-group">
-			<label class="control-label"><font color="red">*</font>商品:</label>
-			<div class="controls" id="addProduct">
-				<a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a>
-			</div>
-			<table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
-				<thead>
-				<tr>
-					<th>图片</th>
-					<th>商品名称</th>
-					<th>供应商</th>
-					<th>操作</th>
-				</tr>
-				</thead>
-				<tbody>
-				<tr>
-					<td><img id="mainImage" src="${heheDiscountActivityProduct.mainImage}" width="50px" height="50px"></td>
-					<td style="text-align: center" id="name">${heheDiscountActivityProduct.name}</td>
-					<td id="shopName">${heheDiscountActivityProduct.shopName}</td>
-					<td><a href="javascript:void(0);" onclick="deleteProduct()">删除</a></td>
-				</tr>
-				</tbody>
-			</table>
-		</div>
-		<div id="productInfo" hidden="hidden">
-			<div class="control-group">
-				<label class="control-label"><font color="red">*</font>限时特价:</label>
-				<div class="controls">
-					<input type="number" style="width:100px;" min="0" id="discountPrice" name="discountPrice" value="${heheDiscountActivityProduct.discountPrice}" required onblur="checkPrice(this)">
-				</div>
-			</div>
-		</div>
-		<div class="control-group">
-			<label class="control-label"><font color="red">*</font>商品状态:</label>
-			<div class="controls">
-				<form:select path="status" class="input-small required">
-					<form:option value="1" label="已上架"/>
-					<form:option value="0" label="已下架"/>
-				</form:select>
-			</div>
-		</div>
-		<div class="form-actions">
-			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
-			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
-		</div>
-	</form:form>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/hehe/heheDiscountActivityProduct/?activityId=${heheDiscountActivityProduct.activityId}">商品列表</a>
+    </li>
+    <li class="active"><a
+            href="${ctx}/hehe/heheDiscountActivityProduct/form?id=${heheDiscountActivityProduct.id}&activityId=${heheDiscountActivityProduct.activityId}">商品${not empty heheDiscountActivityProduct.id?'编辑':'添加'}</a>
+    </li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="heheDiscountActivityProduct"
+           action="${ctx}/hehe/heheDiscountActivityProduct/save" method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="activityId"/>
+    <form:hidden path="productId"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>商品:</label>
+        <div class="controls" id="addProduct">
+            <a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a>
+        </div>
+        <table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
+            <thead>
+            <tr>
+                <th>图片</th>
+                <th>商品名称</th>
+                <th>供应商</th>
+                <th>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            <tr>
+                <td><img id="mainImage" src="${heheDiscountActivityProduct.mainImage}" width="50px" height="50px"></td>
+                <td style="text-align: center" id="name">${heheDiscountActivityProduct.name}</td>
+                <td id="shopName">${heheDiscountActivityProduct.shopName}</td>
+                <td><a href="javascript:void(0);" onclick="deleteProduct()">删除</a></td>
+            </tr>
+            </tbody>
+        </table>
+    </div>
+    <div id="productInfo" hidden="hidden">
+        <c:forEach items="${heheDiscountActivityProduct.skus}" var="sku" varStatus="index">
+            <div class="control-group" style="display:flex">
+                <input type="hidden" value="${sku.skuId}" name="sku[${index.index}].skuId">
+                <label class="control-label"><font color="red">*</font>规格:${sku.unit}</label>
+                <label class="control-label"><font color="red">*</font>售价:</label>
+                <input type="number" style="width:100px;" disabled="true" min="0" id="price"
+                       name="sku[${index.index}].price"
+                       value="${sku.price}">
+                <label class="control-label"><font color="red">*</font>限时特价:</label>
+                <input type="number" style="width:100px;" min="0" id="discountPrice"
+                       name="sku[${index.index}].discountPrice"
+                       value="${sku.discountPrice}" required onblur="checkPrice(this)">
+            </div>
+        </c:forEach>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>商品状态:</label>
+        <div class="controls">
+            <form:select path="status" class="input-small required">
+                <form:option value="1" label="已上架"/>
+                <form:option value="0" label="已下架"/>
+            </form:select>
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
 <script>
-	$(function () {
-		//初始化商品信息
-		if (${not empty heheDiscountActivityProduct.id}){
-			$('#contentTable').show();
-			$('#productInfo').show();
-			$('#addProduct').hide();
-		}
-	});
+    $(function () {
+        //初始化商品信息
+        if (${not empty heheDiscountActivityProduct.id}) {
+            $('#contentTable').show();
+            $('#productInfo').show();
+            $('#addProduct').hide();
+        }
+    });
 
-	//选择添加商品
-	function showSelect() {
-		var url = '';
-		var title = '';
-		url = "${ctx}/hehe/heheDiscountActivityProduct/findProductPage";
-		title = "选择商品";
-		top.$.jBox("iframe:" + url, {
-			iframeScrolling: 'yes',
-			width: $(top.document).width() - 600,
-			height: $(top.document).height() - 160,
-			persistent: true,
-			title: title,
-			buttons: {"确定": '1', "关闭": '-1'},
-			submit: function (v, h, f) {
-				//确定
-				var $jboxFrame = top.$('#jbox-iframe');
-				var $mainFrame = top.$('#mainFrame');
-				if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
-					var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
-					if (items.length > 0) {
-						console.log(items);
-						$('#contentTable').show();
-						$('#productInfo').show();
-						$('#addProduct').hide();
-						var productId = items[0].productId;
-						var mainImage = items[0].mainImage;
-						var name = items[0].name;
-						var shopName = items[0].shopName;
-						var price = items[0].price;
-						$("#mainImage").attr("src", mainImage);
-						$("#shopName").text(shopName);
-						$("#productId").val(productId);
-						$("#name").text(name);
-						$("#discountPrice").val(price);
-					} else {
-						top.$.jBox.tip("请先勾选商品...");
-						return false;
-					}
-				}
-				return true;
-			}
-		});
-	}
+    //选择添加商品
+    function showSelect() {
+        var url = '';
+        var title = '';
+        url = "${ctx}/hehe/heheDiscountActivityProduct/findProductPage";
+        title = "选择商品";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 600,
+            height: $(top.document).height() - 160,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "关闭": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
+                    if (items.length > 0) {
+                        console.log(items);
+                        $('#contentTable').show();
+                        $('#productInfo').show();
+                        $('#addProduct').hide();
+                        var productId = items[0].productId;
+                        var mainImage = items[0].mainImage;
+                        var name = items[0].name;
+                        var shopName = items[0].shopName;
+                        var price = items[0].price;
+                        $("#mainImage").attr("src", mainImage);
+                        $("#shopName").text(shopName);
+                        $("#productId").val(productId);
+                        $("#name").text(name);
+                        $("#discountPrice").val(price);
+                        getSkus(productId);
 
-	//删除商品
-	function deleteProduct() {
-		$('#contentTable').hide();
-		$('#productInfo').hide();
-		$('#addProduct').show();
-		$('#productId').val('');
-	}
+                    } else {
+                        top.$.jBox.tip("请先勾选商品...");
+                        return false;
+                    }
+                }
+                return true;
+            }
+        });
+    }
 
-	/**
-	 * @param obj
-	 * jquery检验售价
-	 */
-	function checkPrice(obj) {
-		if (obj.value == '0') {
-			obj.value = '';
-		}
-	}
+    function getSkus(productId) {
+        //渲染限时特价sku
+        $.ajax({
+            url: "${ctx}/hehe/heheDiscountActivityProduct/getSku?productId=" + productId,
+            type: "GET",
+            dataType: "json",
+            data: "",
+            success: function (res) {
+                console.log(res);
+                var html = '';
+                for (let i = 0; i < res.length; i++) {
+                    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'/>";
+                    html += '<label class="control-label"><font color="red">*</font>限时特价:</label>';
+                    html += "<input name='skus[" + (i) + "].discountPrice' value='" + res[i].discountPrice + "' style='width: 90px;' type='number' class='input-xlarge number required'/>";
+                    html += '</div>';
+                }
+                $("#productInfo").html(html);
+            }
+        });
+    }
+
+    //删除商品
+    function deleteProduct() {
+        $('#contentTable').hide();
+        $('#productInfo').hide();
+        $('#addProduct').show();
+        $('#productId').val('');
+    }
+
+    /**
+     * @param obj
+     * jquery检验售价
+     */
+    function checkPrice(obj) {
+        if (obj.value == '0') {
+            obj.value = '';
+        }
+    }
 </script>
 </body>
 </html>

+ 487 - 138
src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderDetail.jsp

@@ -6,69 +6,377 @@
     <meta name="decorator" content="default"/>
     <%--<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>--%>
     <style type="text/css">
-        *{margin:0;padding:0}
-        a{list-style:none;text-decoration:none}
-        body{background-color:rgb(255,255,255)}
-        h3{line-height:20px;padding:20px 0 20px 15px;border-bottom:1px solid #CCCCCC}
-        .now-status p{padding:20px}
-        .now-status span{display:inline-block;width:160px;line-height:35px;margin-right:15px;cursor:pointer;border:1px solid #CCCCCC;text-align:center;border-radius:5px}
-        .buyInfo p{padding:15px 5px 0}
-        .buyInfo p label{width:60px;display:inline-block}
-        .buyInfo p span{padding-left:10px}
-        .table th{background-color:#CCCCCC}
-        .table th,.table td{font-weight:normal;border:1px solid #CCCCCC;height:35px;text-align:center}
-        .table td .div-img{box-sizing:border-box}
-        .table td .div-img img{width:100px;height:100px;vertical-align:middle}
-        .table td .div-img span{}
-        .div-order span{width:260px;display:inline-block;margin-right:50px}
-        .text-result p{padding-top:15px}
-        .text-cost p{padding:20px 0}
-        .moeny-cost p{padding:10px 0 0 0;text-align:left}
-        .moeny-cost p label{display:inline-block}
-        .Staging table{width:100%;border-collapse:collapse;margin-top:20px}
-        .Staging table th,.Staging table td{font-weight:normal;border:1px solid #000;height:35px;text-align:center;width:10%}
-        .change-info{position:fixed;top:0%;left:50%;transform:translateX(-50%);z-index:999;width:800px;background-color:#fff;box-shadow:0px 0px 15px #ccc}
-        .item-div label{width:260px;text-align:right;display:inline-block;margin-right:50px}
-        .item-div input{width:300px;line-height:35px;height:35px;box-sizing:border-box;border:1px solid #CCCCCC;display:inline-block}
-        .item-div select{width:90px;height:35px;margin-right:10px}
-        .item-div textarea{border:1px solid #CCCCCC;margin-top:20px;width:300px;height:80px;resize:none;display:block}
-        .layer-status span{display:inline-block;width:80px;line-height:35px;background-color:#00A6C7;text-align:center;color:#fff;cursor:pointer}
-        .layer-status span:nth-of-type(1){}
-        .layer-status span:nth-of-type(2){margin-left:72px}
-        .same-style{position:fixed;top:20%;left:50%;transform:translateX(-50%);width:500px;background-color:#fff;z-index:999;box-shadow:0 0 15px #666}
-        .reason-cancel label{margin-right:20px}
-        .reason-cancel textarea{width:270px;height:80px;resize:none;vertical-align:text-top;border:1px solid #CCCCCC}
-        .order-details-heading{background:#eee}
-        .order-details-heading td{white-space:nowrap;padding:0 10px}
-        .order-rows,.order-details-heading{width:100%;border-bottom:1px solid #ccc;border-left:1px solid #ccc;border-right:1px solid #ccc;color:#666;padding:10px;line-height:30px}
-        .order-details-heading{border-top:1px solid #ccc}
-        .order-details-heading span,.order-rows span{margin-right:80px}
-        .order-details-heading span{width:230px;margin-right:0px;display:inline-block}
-        .order-details-heading span label,.order-rows span label{font-weight:bold}
-        .order-rows .supplier-img{width:100px}
-        .operation-wrapper{position:relative}
-        .operation-btn{cursor:pointer}
-        .operation-block{background:#fff;width:125px;position:absolute;left:35px;top:30px;padding:10px;border:1px solid #666;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;z-index:999;display:none}
-        .operation-block a{display:block;padding:3px 0}
-        .print-wrapper{display:inline-block}
-        .supplier-product-name,.supplier-product-alias{width:200px;line-height:20px}
-        .supplier-product-info{width:50%;display:inline-block;position:relative;top:50%;transform:translateY(30%)}
-        .supplier-product-promotionInfo{width:20%;display:inline-block;position:relative;top:50%;transform:translateY(30%)}
-        .supplier-product-item{margin-bottom:10px}
-        .supplier-product-alias{display:inline-block;margin-top:5px}
-        .supplier-name{display:inline-block;vertical-align:middle;margin:0 10px}
-        #auditBox{padding:20px;line-height:30px}
-        #auditBox p{font-size:16px;margin:0 0 0 0}
-        #auditBox .note-div{font-size:16px}
-        .downSpan{display:block;margin-left:5px;margin-bottom:-8px}
-        .upSpan{display:block;margin-left:5px;margin-top:-8px}
-        .promotionsName{margin:2px}
-        .ladderPrice>span{text-decoration:underline;color:red}
-        .ladderPrice .list{display:none;position:absolute;z-index:999;background:#FFF;white-space:nowrap;border:1px solid #EEE;padding:10px 0;color:#333}
-        .ladderPrice:hover .list{display:block}
-        .ladderPrice .list span{margin:0 20px;width:60px;text-align:center;display:inline-block}
-        .ladderPrice .list span.price{color:red}
-        .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
+        * {
+            margin: 0;
+            padding: 0
+        }
+
+        a {
+            list-style: none;
+            text-decoration: none
+        }
+
+        body {
+            background-color: rgb(255, 255, 255)
+        }
+
+        h3 {
+            line-height: 20px;
+            padding: 20px 0 20px 15px;
+            border-bottom: 1px solid #CCCCCC
+        }
+
+        .now-status p {
+            padding: 20px
+        }
+
+        .now-status span {
+            display: inline-block;
+            width: 160px;
+            line-height: 35px;
+            margin-right: 15px;
+            cursor: pointer;
+            border: 1px solid #CCCCCC;
+            text-align: center;
+            border-radius: 5px
+        }
+
+        .buyInfo p {
+            padding: 15px 5px 0
+        }
+
+        .buyInfo p label {
+            width: 60px;
+            display: inline-block
+        }
+
+        .buyInfo p span {
+            padding-left: 10px
+        }
+
+        .table th {
+            background-color: #CCCCCC
+        }
+
+        .table th, .table td {
+            font-weight: normal;
+            border: 1px solid #CCCCCC;
+            height: 35px;
+            text-align: center
+        }
+
+        .table td .div-img {
+            box-sizing: border-box
+        }
+
+        .table td .div-img img {
+            width: 100px;
+            height: 100px;
+            vertical-align: middle
+        }
+
+        .table td .div-img span {
+        }
+
+        .div-order span {
+            width: 260px;
+            display: inline-block;
+            margin-right: 50px
+        }
+
+        .text-result p {
+            padding-top: 15px
+        }
+
+        .text-cost p {
+            padding: 20px 0
+        }
+
+        .moeny-cost p {
+            padding: 10px 0 0 0;
+            text-align: left
+        }
+
+        .moeny-cost p label {
+            display: inline-block
+        }
+
+        .Staging table {
+            width: 100%;
+            border-collapse: collapse;
+            margin-top: 20px
+        }
+
+        .Staging table th, .Staging table td {
+            font-weight: normal;
+            border: 1px solid #000;
+            height: 35px;
+            text-align: center;
+            width: 10%
+        }
+
+        .change-info {
+            position: fixed;
+            top: 0%;
+            left: 50%;
+            transform: translateX(-50%);
+            z-index: 999;
+            width: 800px;
+            background-color: #fff;
+            box-shadow: 0px 0px 15px #ccc
+        }
+
+        .item-div label {
+            width: 260px;
+            text-align: right;
+            display: inline-block;
+            margin-right: 50px
+        }
+
+        .item-div input {
+            width: 300px;
+            line-height: 35px;
+            height: 35px;
+            box-sizing: border-box;
+            border: 1px solid #CCCCCC;
+            display: inline-block
+        }
+
+        .item-div select {
+            width: 90px;
+            height: 35px;
+            margin-right: 10px
+        }
+
+        .item-div textarea {
+            border: 1px solid #CCCCCC;
+            margin-top: 20px;
+            width: 300px;
+            height: 80px;
+            resize: none;
+            display: block
+        }
+
+        .layer-status span {
+            display: inline-block;
+            width: 80px;
+            line-height: 35px;
+            background-color: #00A6C7;
+            text-align: center;
+            color: #fff;
+            cursor: pointer
+        }
+
+        .layer-status span:nth-of-type(1) {
+        }
+
+        .layer-status span:nth-of-type(2) {
+            margin-left: 72px
+        }
+
+        .same-style {
+            position: fixed;
+            top: 20%;
+            left: 50%;
+            transform: translateX(-50%);
+            width: 500px;
+            background-color: #fff;
+            z-index: 999;
+            box-shadow: 0 0 15px #666
+        }
+
+        .reason-cancel label {
+            margin-right: 20px
+        }
+
+        .reason-cancel textarea {
+            width: 270px;
+            height: 80px;
+            resize: none;
+            vertical-align: text-top;
+            border: 1px solid #CCCCCC
+        }
+
+        .order-details-heading {
+            background: #eee
+        }
+
+        .order-details-heading td {
+            white-space: nowrap;
+            padding: 0 10px
+        }
+
+        .order-rows, .order-details-heading {
+            width: 100%;
+            border-bottom: 1px solid #ccc;
+            border-left: 1px solid #ccc;
+            border-right: 1px solid #ccc;
+            color: #666;
+            padding: 10px;
+            line-height: 30px
+        }
+
+        .order-details-heading {
+            border-top: 1px solid #ccc
+        }
+
+        .order-details-heading span, .order-rows span {
+            margin-right: 80px
+        }
+
+        .order-details-heading span {
+            width: 230px;
+            margin-right: 0px;
+            display: inline-block
+        }
+
+        .order-details-heading span label, .order-rows span label {
+            font-weight: bold
+        }
+
+        .order-rows .supplier-img {
+            width: 100px
+        }
+
+        .operation-wrapper {
+            position: relative
+        }
+
+        .operation-btn {
+            cursor: pointer
+        }
+
+        .operation-block {
+            background: #fff;
+            width: 125px;
+            position: absolute;
+            left: 35px;
+            top: 30px;
+            padding: 10px;
+            border: 1px solid #666;
+            -webkit-border-radius: 5px;
+            -moz-border-radius: 5px;
+            border-radius: 5px;
+            z-index: 999;
+            display: none
+        }
+
+        .operation-block a {
+            display: block;
+            padding: 3px 0
+        }
+
+        .print-wrapper {
+            display: inline-block
+        }
+
+        .supplier-product-name, .supplier-product-alias {
+            width: 200px;
+            line-height: 20px
+        }
+
+        .supplier-product-info {
+            width: 50%;
+            display: inline-block;
+            position: relative;
+            top: 50%;
+            transform: translateY(30%)
+        }
+
+        .supplier-product-promotionInfo {
+            width: 20%;
+            display: inline-block;
+            position: relative;
+            top: 50%;
+            transform: translateY(30%)
+        }
+
+        .supplier-product-item {
+            margin-bottom: 10px
+        }
+
+        .supplier-product-alias {
+            display: inline-block;
+            margin-top: 5px
+        }
+
+        .supplier-name {
+            display: inline-block;
+            vertical-align: middle;
+            margin: 0 10px
+        }
+
+        #auditBox {
+            padding: 20px;
+            line-height: 30px
+        }
+
+        #auditBox p {
+            font-size: 16px;
+            margin: 0 0 0 0
+        }
+
+        #auditBox .note-div {
+            font-size: 16px
+        }
+
+        .downSpan {
+            display: block;
+            margin-left: 5px;
+            margin-bottom: -8px
+        }
+
+        .upSpan {
+            display: block;
+            margin-left: 5px;
+            margin-top: -8px
+        }
+
+        .promotionsName {
+            margin: 2px
+        }
+
+        .ladderPrice > span {
+            text-decoration: underline;
+            color: red
+        }
+
+        .ladderPrice .list {
+            display: none;
+            position: absolute;
+            z-index: 999;
+            background: #FFF;
+            white-space: nowrap;
+            border: 1px solid #EEE;
+            padding: 10px 0;
+            color: #333
+        }
+
+        .ladderPrice:hover .list {
+            display: block
+        }
+
+        .ladderPrice .list span {
+            margin: 0 20px;
+            width: 60px;
+            text-align: center;
+            display: inline-block
+        }
+
+        .ladderPrice .list span.price {
+            color: red
+        }
+
+        .weishaIcon {
+            background: darkorange;
+            color: white;
+            margin: 0 0px;
+            padding: 0 3px;
+            font-style: normal;
+            font-size: 12px;
+            display: inline-block;
+            border-radius: 2px
+        }
     </style>
     <script type="text/javascript" src="${ctxStatic}/QRCode/jquery.qrcode.min.js"></script>
     <script type="text/javascript" src="static/common/clipboard.min.js"></script>
@@ -114,38 +422,44 @@
                 <c:if test="${order.receiptStatus == 3}">
                     <font color="green">已收款</font>
                 </c:if>
-                <%--抹平明细--%>
-                    <c:if test="${order.confirmType eq 1}">
-                        <c:if test="${order.receiptOrderFlag}">
-                            <font color="red">(一款多单:少收抹平金额未知)</font>
-                        </c:if>
-                        <c:if test="${!order.receiptOrderFlag}">
-                            <font color="red">(少收抹平:
-                                ¥<fmt:formatNumber value="${order.payableAmount - (empty order.orderReceivedAmount ? 0 : order.orderReceivedAmount)}" pattern="#0.00"/>)
-                            </font>
-                        </c:if>
+                    <%--抹平明细--%>
+                <c:if test="${order.confirmType eq 1}">
+                    <c:if test="${order.receiptOrderFlag}">
+                        <font color="red">(一款多单:少收抹平金额未知)</font>
                     </c:if>
-                    <c:if test="${order.confirmType eq 2}">
-                        <c:if test="${order.receiptOrderFlag}">
-                            <font color="red">(一款多单:多收抹平金额未知)</font>
-                        </c:if>
-                        <c:if test="${!order.receiptOrderFlag}">
-                            <font color="red">(多收抹平:
-                                ¥<fmt:formatNumber value="${(empty order.orderReceivedAmount ? 0 : order.orderReceivedAmount) - order.payableAmount}" pattern="#0.00"/>)
-                            </font>
-                        </c:if>
+                    <c:if test="${!order.receiptOrderFlag}">
+                        <font color="red">(少收抹平:
+                            ¥<fmt:formatNumber
+                                    value="${order.payableAmount - (empty order.orderReceivedAmount ? 0 : order.orderReceivedAmount)}"
+                                    pattern="#0.00"/>)
+                        </font>
                     </c:if>
-                    <c:if test="${order.confirmType eq 3}">
-                        <c:if test="${order.receiptOrderFlag}">
-                             <font color="red">(一款多单:多收退余额)</font>
-                        </c:if>
-                        <c:if test="${!order.receiptOrderFlag}">
-                            <font color="red">(多收退余额&nbsp;&nbsp;${order.associationType eq 2 ? "(自动)" : ""}:
-                                ¥<fmt:formatNumber value="${(empty order.returnBalanceAmount ? 0 : order.returnBalanceAmount)}" pattern="#0.00"/>)
-                            </font>
-                        </c:if>
+                </c:if>
+                <c:if test="${order.confirmType eq 2}">
+                    <c:if test="${order.receiptOrderFlag}">
+                        <font color="red">(一款多单:多收抹平金额未知)</font>
+                    </c:if>
+                    <c:if test="${!order.receiptOrderFlag}">
+                        <font color="red">(多收抹平:
+                            ¥<fmt:formatNumber
+                                    value="${(empty order.orderReceivedAmount ? 0 : order.orderReceivedAmount) - order.payableAmount}"
+                                    pattern="#0.00"/>)
+                        </font>
                     </c:if>
-                </td>
+                </c:if>
+                <c:if test="${order.confirmType eq 3}">
+                    <c:if test="${order.receiptOrderFlag}">
+                        <font color="red">(一款多单:多收退余额)</font>
+                    </c:if>
+                    <c:if test="${!order.receiptOrderFlag}">
+                        <font color="red">(多收退余额&nbsp;&nbsp;${order.associationType eq 2 ? "(自动)" : ""}:
+                            ¥<fmt:formatNumber
+                                    value="${(empty order.returnBalanceAmount ? 0 : order.returnBalanceAmount)}"
+                                    pattern="#0.00"/>)
+                        </font>
+                    </c:if>
+                </c:if>
+            </td>
             <td>发货状态:
                 <c:if test="${order.sendOutStatus == 1}">
                     <font color="red">待发货</font>
@@ -213,12 +527,13 @@
             应收金额:<fmt:formatNumber value="${order.payableAmount}" type="currency"/>
             <span style="color: red">
                 <c:if test="${order.balancePayFee gt 0}">
-                    <a href="${ctx}/user/cmUserBalanceRecord/userBalanceRecord?userId=${order.userID}" style="color: red;text-decoration: underline">
+                    <a href="${ctx}/user/cmUserBalanceRecord/userBalanceRecord?userId=${order.userID}"
+                       style="color: red;text-decoration: underline">
                         (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)
                     </a>
                 </c:if>
                 <c:if test="${order.balancePayFee le 0}">
-                        (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)
+                    (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)
                 </c:if>
 
 
@@ -508,25 +823,32 @@
         <span><label>供应商:</label>${shopOrder.shopName}</span>
         <c:if test="${shopOrder.shopPromotion ne null && shopOrder.shopPromotion.type eq 3}">
             <c:if test="${shopOrder.shopPromotion.mode eq 2}">
-                <span><label style="background-color: #F60;color: white">${shopOrder.shopPromotion.name}</label> 满<fmt:formatNumber value="${shopOrder.shopPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,减<fmt:formatNumber value="${shopOrder.shopPromotion.reducedPrice}" pattern="#,##0.00" maxFractionDigits="2"/></span>
+                <span><label
+                        style="background-color: #F60;color: white">${shopOrder.shopPromotion.name}</label> 满<fmt:formatNumber
+                        value="${shopOrder.shopPromotion.touchPrice}" pattern="#,##0.00"
+                        maxFractionDigits="2"/>,减<fmt:formatNumber value="${shopOrder.shopPromotion.reducedPrice}"
+                                                                   pattern="#,##0.00" maxFractionDigits="2"/></span>
             </c:if>
             <c:if test="${shopOrder.shopPromotion.mode eq 3}">
-                <span><label style="background-color: purple;color: white">${shopOrder.shopPromotion.name}</label> 满<fmt:formatNumber value="${shopOrder.shopPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,赠送商品</span>
+                <span><label
+                        style="background-color: purple;color: white">${shopOrder.shopPromotion.name}</label> 满<fmt:formatNumber
+                        value="${shopOrder.shopPromotion.touchPrice}" pattern="#,##0.00"
+                        maxFractionDigits="2"/>,赠送商品</span>
             </c:if>
         </c:if>
         <div>
             <c:forEach items="${shopOrder.newOrderProducts}" var="op">
                 <div class="supplier-product-item">
-                    <%--二手订单详情--%>
+                        <%--二手订单详情--%>
                     <c:if test="${order.secondHandOrderFlag eq 1}">
                         <a href="${fns:getConfig('wwwServer')}product-${op.productID}.html" target="_blank">
-                        <img class="supplier-img" src="${op.image}"/>
+                            <img class="supplier-img" src="${op.image}"/>
                         </a>
                     </c:if>
-                    <%--正常订单详情--%>
+                        <%--正常订单详情--%>
                     <c:if test="${order.secondHandOrderFlag ne 1}">
                         <a href="${fns:getConfig('wwwServer')}product-${op.productID}.html" target="_blank">
-                         <img class="supplier-img" src="${op.image}"/>
+                            <img class="supplier-img" src="${op.image}"/>
                         </a>
                     </c:if>
                     <div class="supplier-name">
@@ -557,39 +879,44 @@
                     </div>
                     <c:if test="${op.productID ne 999}">
                         <div class="supplier-product-info">
+                            <span style="color: red">规格:${op.productUnit}</span>
                             <span>单价:
                                 <c:if test="${op.productPromotion.mode eq 1}">
-                                    <label style="text-decoration: line-through"><fmt:formatNumber value="${op.price}" type="currency"/></label></span>
-                                </c:if>
-                                <c:if test="${op.productPromotion.mode ne 1}">
-                                    <fmt:formatNumber value="${op.price}" type="currency"/>
-                                </c:if>
-                                <c:if test="${op.ladderPriceFlag eq 1 || op.isActProduct eq 1}">
-                                    <a href="javascript:;" class="ladderPrice"><span> (阶梯价格)</span>
-                                        <c:if test="${not empty op.orderProductLadderPriceList}">
-                                            <div class="list">
-                                                <p><span>起订量</span><span>价格</span></p>
-                                                <c:forEach items="${op.orderProductLadderPriceList}" var="ladderPrice">
-                                                    <p data-num="${ladderPrice.buyNum}"><span>${ladderPrice.buyNumRangeShow}</span><span class="price">${ladderPrice.buyPrice}</span></p>
-                                                </c:forEach>
-                                            </div>
-                                        </c:if>
-                                    </a>
-                                </c:if>
-                                <c:if test="${order.collageFlag eq 1}"><font color="red">(拼团价)</font></c:if>
+                                    <label style="text-decoration: line-through"><fmt:formatNumber value="${op.price}"
+                                                                                                   type="currency"/></label></span>
+                            </c:if>
+                            <c:if test="${op.productPromotion.mode ne 1}">
+                                <fmt:formatNumber value="${op.price}" type="currency"/>
+                            </c:if>
+                            <c:if test="${op.ladderPriceFlag eq 1 || op.isActProduct eq 1}">
+                                <a href="javascript:;" class="ladderPrice"><span> (阶梯价格)</span>
+                                    <c:if test="${not empty op.orderProductLadderPriceList}">
+                                        <div class="list">
+                                            <p><span>起订量</span><span>价格</span></p>
+                                            <c:forEach items="${op.orderProductLadderPriceList}" var="ladderPrice">
+                                                <p data-num="${ladderPrice.buyNum}">
+                                                    <span>${ladderPrice.buyNumRangeShow}</span><span
+                                                        class="price">${ladderPrice.buyPrice}</span></p>
+                                            </c:forEach>
+                                        </div>
+                                    </c:if>
+                                </a>
+                            </c:if>
+                            <c:if test="${order.collageFlag eq 1}"><font color="red">(拼团价)</font></c:if>
                             </span>
                             <span>折扣: ${op.discount}%</span>
                             <span>折后单价:
                                 <c:if test="${op.productPromotion.mode eq 1}">
-                                    <label style="text-decoration: line-through"><fmt:formatNumber value="${op.discountPrice}" type="currency"/></label></span>
-                                </c:if>
-                                <c:if test="${op.productPromotion.mode ne 1}">
-                                    <fmt:formatNumber value="${op.discountPrice}" type="currency"/></span>
-                                </c:if>
+                                    <label style="text-decoration: line-through"><fmt:formatNumber
+                                            value="${op.discountPrice}" type="currency"/></label></span>
+                            </c:if>
+                            <c:if test="${op.productPromotion.mode ne 1}">
+                                <fmt:formatNumber value="${op.discountPrice}" type="currency"/></span>
+                            </c:if>
                             <span>数量:  x${op.num}</span>
                             <br>
                             <span>税率:  ${(op.includedTax != '' and op.includedTax eq 0 and op.invoiceType eq 3)?'---': op.taxRate ne null?op.taxRate:0.0}%</span>
-                            <span>税费:  ${(op.includedTax eq 1 or (op.includedTax != '' and op.includedTax eq 0 and op.invoiceType eq 3))?'---': empty op.totalAddedValueTax ?0.00:(op.totalAddedValueTax)}</span>
+                            <span>税费: ${(op.includedTax eq 1 or (op.includedTax != '' and op.includedTax eq 0 and op.invoiceType eq 3))?'---': empty op.totalAddedValueTax ?0.00:(op.totalAddedValueTax)}</span>
                             <span>总额:  <fmt:formatNumber value="${op.totalFee}" type="currency"/></span>
                             <c:if test="${order.sendOutStatus == 2 || order.sendOutStatus == 3}">
                                 <span>已发/已收  ${(op.num == null ? 0 : op.num)+ (op.presentNum == null ? 0 : op.presentNum)- (op.notOutStore == null ? 0 : op.notOutStore)}/${op.receivedNum}</span>
@@ -598,29 +925,37 @@
                                 <span>退款(退货)中/已完成  ${op.returningNum}/${op.returnedNum}</span>
                             </c:if>
                             <c:if test="${op.heUserId > 0}">
-                                <span><font color="red">分销者:  ${op.heUserName}</font></span>
+                                <span><font color="red">分销者: ${op.heUserName}</font></span>
                             </c:if>
                         </div>
                         <c:if test="${op.productPromotion ne null}">
                             <c:if test="${op.productPromotion.type eq 2}">
                                 <div class="supplier-product-promotionInfo">
                                     <table>
-                                        <tr >
+                                        <tr>
                                             <td rowspan="2">
                                                 <c:if test="${op.productPromotion.mode eq 2}">
-                                                    <label style="background-color: #F60;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label>
+                                                    <label style="background-color: #F60;color: white"><label
+                                                            class="promotionsName">${op.productPromotion.name}</label></label>
                                                 </c:if>
                                                 <c:if test="${op.productPromotion.mode eq 3}">
-                                                    <label style="background-color: purple;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label>
+                                                    <label style="background-color: purple;color: white"><label
+                                                            class="promotionsName">${op.productPromotion.name}</label></label>
                                                 </c:if>
                                             </td>
                                             <td>
                                                 <span class="downSpan">${op.productPromotion.description}</span>
                                                 <c:if test="${op.productPromotion.mode eq 2}">
-                                                    <span class="upSpan"> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,减<fmt:formatNumber value="${op.productPromotion.reducedPrice}" pattern="#,##0.00" maxFractionDigits="2"/></span>
+                                                    <span class="upSpan"> 满<fmt:formatNumber
+                                                            value="${op.productPromotion.touchPrice}" pattern="#,##0.00"
+                                                            maxFractionDigits="2"/>,减<fmt:formatNumber
+                                                            value="${op.productPromotion.reducedPrice}"
+                                                            pattern="#,##0.00" maxFractionDigits="2"/></span>
                                                 </c:if>
                                                 <c:if test="${op.productPromotion.mode eq 3}">
-                                                    <span class="upSpan"> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,赠送商品</span>
+                                                    <span class="upSpan"> 满<fmt:formatNumber
+                                                            value="${op.productPromotion.touchPrice}" pattern="#,##0.00"
+                                                            maxFractionDigits="2"/>,赠送商品</span>
                                                 </c:if>
                                             </td>
                                         </tr>
@@ -632,16 +967,30 @@
                                     <table>
                                         <tr>
                                             <c:if test="${op.productPromotion.mode eq 1}">
-                                                <td><label style="background-color: green;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label></td>
-                                                <td> 优惠价: <label style="color: red"><fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/></label></td>
+                                                <td><label style="background-color: green;color: white"><label
+                                                        class="promotionsName">${op.productPromotion.name}</label></label>
+                                                </td>
+                                                <td> 优惠价: <label style="color: red"><fmt:formatNumber
+                                                        value="${op.productPromotion.touchPrice}" pattern="#,##0.00"
+                                                        maxFractionDigits="2"/></label></td>
                                             </c:if>
                                             <c:if test="${op.productPromotion.mode eq 2}">
-                                                <td><label style="background-color: #F60;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label></td>
-                                                <td> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,减<fmt:formatNumber value="${op.productPromotion.reducedPrice}" pattern="#,##0.00" maxFractionDigits="2"/></td>
+                                                <td><label style="background-color: #F60;color: white"><label
+                                                        class="promotionsName">${op.productPromotion.name}</label></label>
+                                                </td>
+                                                <td> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}"
+                                                                        pattern="#,##0.00"
+                                                                        maxFractionDigits="2"/>,减<fmt:formatNumber
+                                                        value="${op.productPromotion.reducedPrice}" pattern="#,##0.00"
+                                                        maxFractionDigits="2"/></td>
                                             </c:if>
                                             <c:if test="${op.productPromotion.mode eq 3}">
-                                                <td><label style="background-color: purple;color: white"><label class="promotionsName">${op.productPromotion.name}</label></label></td>
-                                                <td> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}" pattern="#,##0.00" maxFractionDigits="2"/>,赠送商品</td>
+                                                <td><label style="background-color: purple;color: white"><label
+                                                        class="promotionsName">${op.productPromotion.name}</label></label>
+                                                </td>
+                                                <td> 满<fmt:formatNumber value="${op.productPromotion.touchPrice}"
+                                                                        pattern="#,##0.00" maxFractionDigits="2"/>,赠送商品
+                                                </td>
                                             </c:if>
                                         </tr>
                                     </table>
@@ -829,7 +1178,7 @@
         $.jBox.tip(msg, 'info', {timeout: 1000});
         setTimeout(function () {
             window.location.href = "${ctx}/order/detail?id=${order.orderID}"
-        },1000)
+        }, 1000)
     }
 </script>
  
@@ -916,7 +1265,7 @@
                                 'orderID': orderId,
                                 'balanceAccountsRemark': content
                             });
-                            window.location.href = "${ctx}/order/detail?id="+orderId;
+                            window.location.href = "${ctx}/order/detail?id=" + orderId;
                         }
                     }
                 });

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/order/logisticsDetails.jsp

@@ -52,6 +52,7 @@
                 <table class="table">
                     <tr>
                         <td><img src="${lrs.image}"><span>${lrs.productName}</span></td>
+                        <td>规格:${lrs.unit}</td>
                         <td>购买数量(赠品):<span>${lrs.buyNum}(${lrs.presentNum})</span></td>
                         <td>本次发货:<span>${lrs.num}</span></td>
                     </tr>

+ 4 - 0
src/main/webapp/WEB-INF/views/modules/order/orderDetail.jsp

@@ -980,6 +980,10 @@
                     </div>
                     <c:if test="${op.productID ne 999}">
                         <div class="supplier-product-info">
+                            <span>
+                                规格:
+                                <label>${op.unit}</label>
+                            </span>
                             <span>单价:
                                 <c:if test="${op.svipPriceFlag eq 1 or op.productPromotion.mode eq 1}">
                                     <label style="text-decoration: line-through"><fmt:formatNumber value="${op.price}"

+ 5 - 2
src/main/webapp/WEB-INF/views/modules/order/orderForm.jsp

@@ -362,11 +362,13 @@
                 <thead>
                 <tr>
                     <th>商品ID</th>
+                    <th>skuId</th>
                     <th hidden></th>
                     <th hidden></th>
                     <th class="fix-width">商品名称</th>
                     <th hidden></th>
                     <th>数量(赠品数)</th>
+                    <th>规格</th>
                     <th>单价</th>
                     <th>折扣</th>
                     <th>折后单价</th>
@@ -393,6 +395,7 @@
                         <tr id="product_promotion_${orderProduct.productID}" class="gift promotions promotion_${orderProduct.promotionsId}" data-value='${fns:toJson(orderProduct)}' data-index="<%=idx%>">
                     </c:if>
                     <td>${orderProduct.productID}</td>
+                    <td>${orderProduct.skuId}</td>
                     <td hidden>
                         <input type="hidden" name="orderProduct[<%=idx%>].enabledStatus"
                                id="orderProduct<%=idx%>.enabledStatus" value='${fns:toJson(orderProduct)}'>
@@ -424,7 +427,7 @@
                                         <p><span>起订量</span><span>价格</span></p>
                                         <c:forEach items="${orderProduct.ladderPriceList}" var="ladderPrice">
                                             <p data-num="${ladderPrice.buyNum}">
-                                                <span>${ladderPrice.buyNumRangeShow}</span><span
+                                                <span>${ladderPrice.buyNum}</span><span
                                                     class="price">${ladderPrice.buyPrice}</span></p>
                                         </c:forEach>
                                     </div>
@@ -977,7 +980,7 @@
             setFreightFee();
         }
         if (obj == "1") {
-            $("#freeDesc").append("<span class='freightSpan'><input class='freight' name='freight' value='0' oninput='value=value.replace(/[^\\d]/g,'')' onblur='setFreightFee()'>元</input></span>")
+            $("#freeDesc").append("<span class='freightSpan'><input class='freight' name='freight' value='0' type='number' onblur='setFreightFee()'>元</input></span>")
         }
     }
 

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/printOrder.jsp

@@ -118,7 +118,7 @@
                 </td>
                 <td class=xl65>${orderProduct.discountPrice}</td>
                 <td class=xl65>${orderProduct.num}(${orderProduct.presentNum})</td>
-                <td class=xl65>${orderProduct.unit}</td>
+                <td class=xl65>${orderProduct.productUnit}</td>
                 <td class=xl65>${orderProduct.preferential}</td>
                 <td class=xl65>${orderProduct.totalAddedValueTax}</td>
                 <td class=xl65>${orderProduct.totalFee}</td>

+ 2 - 0
src/main/webapp/WEB-INF/views/modules/order/ship.jsp

@@ -93,6 +93,7 @@
             <tr>
                 <th>选择发货商品</th>
                 <th>商品ID</th>
+                <th>规格</th>
                 <th>供应商</th>
                 <th>商品编号</th>
                 <th>商品图片</th>
@@ -113,6 +114,7 @@
                         </c:if>
                     </td>
                     <td>${orderProduct.productID}</td>
+                    <td>${orderProduct.unit}</td>
                     <td>${orderProduct.shopName}</td>
                     <td>${orderProduct.productNo}</td>
                     <td><img src="${orderProduct.image}" alt="" width="80px;height:auto;"></td>

+ 4 - 0
src/main/webapp/WEB-INF/views/modules/order/shipLogistic.jsp

@@ -72,6 +72,7 @@
                 <th>供应商</th>
                 <th>商品图片</th>
                 <th>商品名称</th>
+                <th>规格</th>
                 <th>购买数量</th>
                 <th>赠品数量</th>
                 <th>已发数量</th>
@@ -255,6 +256,9 @@ window.onload = function () {
         html+='<td>';
         html+=resdata[i].name;
         html+='</td>';
+        html+='<td>';
+        html+=resdata[i].unit;
+        html+='</td>';
         html+='<td class="buy-num">';
         html+=resdata[i].num;
         html+='</td>';

+ 60 - 38
src/main/webapp/WEB-INF/views/modules/product-new/multiPromotionForm.jsp

@@ -66,10 +66,12 @@
                             return false;
                         }
                     }
-                    if (mode=="3" &&  ( ${cmPromotion.giftProducts==null or cmPromotion.giftProducts.size()==0})) {
-                        alertx("请至少选择1个赠送的商品");
-                        isSubMitFlag = false;
-                        return false;
+                    if (mode=="3") {
+                        if(document.getElementById("contentTbody1").rows.length<1){
+                            alertx("请至少选择1个赠送的商品");
+                            isSubMitFlag = false;
+                            return false;
+                        }
                     }
                     //将促销商品和赠品信息填充进数组
                     $('#contentTbody tr').each(function (index, item) {
@@ -95,7 +97,7 @@
                             return false;
                         }
                         var obj = {
-                            productId: $itemProductID,
+                            skuId: $itemProductID,
                             number: $giftNumber
                         };
                         addGiftArray.push(obj)
@@ -225,38 +227,56 @@
             });
         }
 
-        function deleteProduct(obj, storeStatus,type) {
+        function deleteProduct(obj,type) {
             //将该行数据取消勾选,若存在数据库中则将其存入delProductIds中
             $(".check-item[value=" + obj + "]").prop("checked", false);
-            var delProductIds = $("#delProductIds").val();
-            var delGiftIds = $("#delGiftIds").val();
-            if (storeStatus && type == 1) {
-                if (delProductIds != '') {
-                    delProductIds = delProductIds + "," + obj;
-                }else delProductIds = obj;
+            if (type == 1) {
+                var product=$('#product'+obj);
+                $(product).remove();
             }
-            if (storeStatus && type == 2) {
-                if (delGiftIds != '') {
-                    delGiftIds = delGiftIds + "," + obj;
-                }else delGiftIds = obj;
+            if (type == 2) {
+                var gift= $('#gift'+obj);
+                $(gift).remove();
             }
-            window.setTimeout(function () {
-                var productItems = getCheckedItems(1);
-                var giftItems = getCheckedItems(2);
-                var mode = $("input[name='mode']:checked").val();
-                var reducedPrice = $("#reducedPrice").val();
-                var touchPrice2 = $("#touchPrice2").val();
-                var touchPrice3 = $("#touchPrice3").val();
-                var status = $("input[name='status']:checked").val();
-                var beginTime = $("#beginTime").val();
-                var endTime = $("#endTime").val();
-                var delFlag1 = $("input[name='delFlag1']:checked").val();
-                var description = $("#description").val();
-                window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + productItems + "&giftIds=" + giftItems +
-                    "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+"&mode=" + mode + "&description=" +description+
-                    "&reducedPrice=" + reducedPrice  + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
-                    "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";
-            },100)
+
+            $.ajax({
+                url: "${ctx}/product/cmPromotions/delPromotion",
+                data: {"id":${cmPromotion.id},"skuId":obj},
+                type: "POST",
+                async: false,
+                success: function(data){
+                    flag=data.success;
+                }
+            });
+            <%--var delProductIds = $("#delProductIds").val();--%>
+            <%--var delGiftIds = $("#delGiftIds").val();--%>
+            <%--if (storeStatus && type == 1) {--%>
+            <%--    if (delProductIds != '') {--%>
+            <%--        delProductIds = delProductIds + "," + obj;--%>
+            <%--    }else delProductIds = obj;--%>
+            <%--}--%>
+            <%--if (storeStatus && type == 2) {--%>
+            <%--    if (delGiftIds != '') {--%>
+            <%--        delGiftIds = delGiftIds + "," + obj;--%>
+            <%--    }else delGiftIds = obj;--%>
+            <%--}--%>
+            <%--window.setTimeout(function () {--%>
+            <%--    var productItems = getCheckedItems(1);--%>
+            <%--    var giftItems = getCheckedItems(2);--%>
+            <%--    var mode = $("input[name='mode']:checked").val();--%>
+            <%--    var reducedPrice = $("#reducedPrice").val();--%>
+            <%--    var touchPrice2 = $("#touchPrice2").val();--%>
+            <%--    var touchPrice3 = $("#touchPrice3").val();--%>
+            <%--    var status = $("input[name='status']:checked").val();--%>
+            <%--    var beginTime = $("#beginTime").val();--%>
+            <%--    var endTime = $("#endTime").val();--%>
+            <%--    var delFlag1 = $("input[name='delFlag1']:checked").val();--%>
+            <%--    var description = $("#description").val();--%>
+            <%--    window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + productItems + "&giftIds=" + giftItems +--%>
+            <%--        "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+"&mode=" + mode + "&description=" +description+--%>
+            <%--        "&reducedPrice=" + reducedPrice  + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +--%>
+            <%--        "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";--%>
+            <%--},100)--%>
         }
 
         function getCheckedItems(type) {
@@ -302,7 +322,7 @@
                 </thead>
                 <tbody id="contentTbody">
                 <c:forEach items="${cmPromotion.promotionProducts}" var="product">
-                    <tr>
+                    <tr id="product${product.productID}">
                         <th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
                                    name="info" ${product.storeStatus?'':'checked'}
                                    value='${product.productID}'/></th>
@@ -312,7 +332,7 @@
                         <td>${product.price}</td>
                         <td>
                             <a href="javaScript:;"
-                               onclick="deleteProduct('${product.productID}',${product.storeStatus},1)">删除</a>
+                               onclick="deleteProduct('${product.productID}',1)">删除</a>
                         </td>
                     </tr>
                 </c:forEach>
@@ -346,6 +366,7 @@
                     <th style="width:20px;" class="hide"></th>
                     <th></th>
                     <th>商品图片</th>
+                    <th>skuId</th>
                     <th>商品名称</th>
                     <th>供应商</th>
                     <th>数量</th>
@@ -353,19 +374,20 @@
                     </thead>
                     <tbody id="contentTbody1">
                     <c:forEach items="${cmPromotion.giftProducts}" var="product">
-                        <tr>
+                        <tr id="gift${product.skuId}">
                             <td>赠</td>
                             <th class="hide"><input class="check-item" type="checkbox" id="giftCheckItem"
                                                     name="gift" ${product.storeStatus?'':'checked'}
-                                                    value='${product.productID}'/></th>
+                                                    value='${product.skuId}'/></th>
                             <td><img src="${product.mainImage}" width="50px" height="50px"></td>
+                            <td>${product.skuId}</td>
                             <td>${product.name}</td>
                             <td>${product.shopName}</td>
                             <td><input id="actPrice1" name="giftNumber" style="width:50px;"
                                        value="${product.giftNumber}" type="number" maxlength="7" step="1"></td>
                             <td>
                                 <a href="javaScript:;"
-                                   onclick="deleteProduct('${product.productID}',${product.storeStatus},2)">删除</a>
+                                   onclick="deleteProduct('${product.skuId}',2)">删除</a>
                             </td>
                         </tr>
                     </c:forEach>

ファイルの差分が大きいため隠しています
+ 397 - 391
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp


+ 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>

+ 26 - 5
src/main/webapp/WEB-INF/views/modules/product-new/promotionSelectProducts.jsp

@@ -23,7 +23,7 @@
                 submitHandler: function (form) {
                     var isSubMitFlag = true;
                     var productID = $("#productID").val();
-                    if (isNaN(productID) || productID.indexOf('0') == 0 ) {
+                    if (isNaN(productID) || productID.indexOf('0') == 0) {
                         alertx("请输入正确的商品ID");
                         isSubMitFlag = false;
                         return false;
@@ -34,6 +34,17 @@
                 }
             })
         });
+
+        function checkSkuValue(index) {
+            var skus = JSON.parse($("#hideSku").val());
+            var price = "price" + index;//单价
+            var chose = "#ints" + index;//选中的sku
+            var skuStr = $(chose).val();
+            var skuIndex = skuStr.split("/")[1];
+            var skuId = skuStr.split("/")[0];
+            document.getElementById(price).innerHTML = skus[skuIndex].price;
+            $("#skuId").val(skuId);
+        }
     </script>
 </head>
 <body>
@@ -47,7 +58,8 @@
     <form:hidden path="delProductIds"/>
     <div class="ul-form">
         <label>商品ID:</label>
-        <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini" onkeyup="onlynum(this)"/>
+        <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini"
+                    onkeyup="onlynum(this)"/>
         <label>商品名称:</label>
         <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
         <label>供应商名称:</label>
@@ -63,21 +75,30 @@
         <th>商品ID</th>
         <th>商品图片</th>
         <th>商品名称</th>
+        <th>规格</th>
         <th>供应商名称</th>
         <th>机构价</th>
     </tr>
     <tbody>
     <c:if test="${not empty page.list}">
-        <c:forEach items="${page.list}" var="item">
+        <c:forEach items="${page.list}" var="item" varStatus="state">
             <tr id="${item.productID}" class="itemtr">
                 <th>
-                    <input class="check-item" type="checkbox" name="info" value='${item.productID}'/>
+                    <input id="skuId" class="check-item" type="checkbox" name="info" value='${item.skuList[0].skuId}'/>
                 </th>
                 <td>${item.productID}</td>
                 <td><img src="${item.mainImage}" width="50px" height="50px"></td>
                 <td>${item.name}</td>
+                <td>
+                    <input id="hideSku" value='${fns:toJson(item.skuList)}' hidden>
+                    <select id="ints${state.index}" onchange="checkSkuValue(${state.index});">
+                        <c:forEach items="${item.skuList}" var="skus" varStatus="ind">
+                            <option value="${skus.skuId}/${ind.index}">${skus.unit}</option>
+                        </c:forEach>
+                    </select>
+                </td>
                 <td>${item.shopName}</td>
-                <td>${item.price}</td>
+                <td><label id="price${state.index}">${item.price}</label></td>
             </tr>
         </c:forEach>
     </c:if>

+ 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>

+ 59 - 39
src/main/webapp/WEB-INF/views/modules/product-new/shopPromotionForm.jsp

@@ -90,7 +90,7 @@
                             return false;
                         }
                         var obj = {
-                            productId: $itemProductID,
+                            skuId: $itemProductID,
                             number: $giftNumber
                         };
                         addGiftArray.push(obj)
@@ -220,43 +220,61 @@
             });
         }
 
-        function deleteProduct(obj, storeStatus,type) {
+        function deleteProduct(obj, type) {
             //将该行数据取消勾选,若存在数据库中则将其删除
             $(".check-item[value=" + obj + "]").prop("checked", false);
-            var delShopIds = $("#delShopIds").val();
-            var delGiftIds = $("#delGiftIds").val();
-            if (storeStatus && type == 1) {
-                if (delProductIds != '') {
-                    delProductIds = delProductIds + "," + obj;
-                }else delProductIds = obj;
-            }
-            if (storeStatus && type == 2) {
-                if (delGiftIds != '') {
-                    delGiftIds = delGiftIds + "," + obj;
-                }else delGiftIds = obj;
+            if (type == 3) {
+                var shop=$('#shop'+obj);
+                $(shop).remove();
             }
-            if (storeStatus && type == 3) {
-                if (delShopIds != '') {
-                    delShopIds = delShopIds + "," + obj;
-                }else delShopIds = obj;
+            if (type == 2) {
+                var gift= $('#gift'+obj);
+                $(gift).remove();
             }
-            window.setTimeout(function () {
-                var productItems = getCheckedItems(1);
-                var giftItems = getCheckedItems(2);
-                var mode = $("input[name='mode']:checked").val();
-                var reducedPrice = $("#reducedPrice").val();
-                var touchPrice2 = $("#touchPrice2").val();
-                var touchPrice3 = $("#touchPrice3").val();
-                var status = $("input[name='status']:checked").val();
-                var beginTime = $("#beginTime").val();
-                var endTime = $("#endTime").val();
-                var delFlag1 = $("input[name='delFlag1']:checked").val();
-                window.location.href = "${ctx}/product/cmPromotions/form?type=3&shopIds=" + productItems + "&giftIds=" + giftItems +
-                    "&delShopIds="+delShopIds+"&delGiftIds="+delGiftIds+ "&mode=" + mode +
-                    "&reducedPrice=" + reducedPrice  + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
-                    "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}"+
-                    "&searchDbFlag=0";
-            },100)
+
+            $.ajax({
+                url: "${ctx}/product/cmPromotions/delPromotion",
+                data: {"id":${cmPromotion.id},"skuId":obj},
+                type: "POST",
+                async: false,
+                success: function(data){
+                    flag=data.success;
+                }
+            });
+            <%--var delShopIds = $("#delShopIds").val();--%>
+            <%--var delGiftIds = $("#delGiftIds").val();--%>
+            <%--if (storeStatus && type == 1) {--%>
+            <%--    if (delProductIds != '') {--%>
+            <%--        delProductIds = delProductIds + "," + obj;--%>
+            <%--    }else delProductIds = obj;--%>
+            <%--}--%>
+            <%--if (storeStatus && type == 2) {--%>
+            <%--    if (delGiftIds != '') {--%>
+            <%--        delGiftIds = delGiftIds + "," + obj;--%>
+            <%--    }else delGiftIds = obj;--%>
+            <%--}--%>
+            <%--if (storeStatus && type == 3) {--%>
+            <%--    if (delShopIds != '') {--%>
+            <%--        delShopIds = delShopIds + "," + obj;--%>
+            <%--    }else delShopIds = obj;--%>
+            <%--}--%>
+            <%--window.setTimeout(function () {--%>
+            <%--    var productItems = getCheckedItems(1);--%>
+            <%--    var giftItems = getCheckedItems(2);--%>
+            <%--    var mode = $("input[name='mode']:checked").val();--%>
+            <%--    var reducedPrice = $("#reducedPrice").val();--%>
+            <%--    var touchPrice2 = $("#touchPrice2").val();--%>
+            <%--    var touchPrice3 = $("#touchPrice3").val();--%>
+            <%--    var status = $("input[name='status']:checked").val();--%>
+            <%--    var beginTime = $("#beginTime").val();--%>
+            <%--    var endTime = $("#endTime").val();--%>
+            <%--    var delFlag1 = $("input[name='delFlag1']:checked").val();--%>
+            <%--    window.location.href = "${ctx}/product/cmPromotions/form?type=3&shopIds=" + productItems + "&giftIds=" + giftItems +--%>
+            <%--        "&delShopIds="+delShopIds+"&delGiftIds="+delGiftIds+ "&mode=" + mode +--%>
+            <%--        "&reducedPrice=" + reducedPrice  + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +--%>
+            <%--        "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}"+--%>
+            <%--        "&searchDbFlag=0";--%>
+            <%--},100)--%>
         }
 
         function getCheckedItems(type) {
@@ -299,7 +317,7 @@
                 </thead>
                 <tbody id="contentTbody">
                 <c:forEach items="${cmPromotion.promotionShops}" var="shop">
-                    <tr>
+                    <tr id="shop${shop.shopID}">
                         <th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
                                    name="info" ${shop.storeStatus?'':'checked'}
                                    value='${shop.shopID}'/></th>
@@ -309,7 +327,7 @@
                         <td>${shop.contractMobile}</td>
                         <td>
                             <a href="javaScript:;"
-                               onclick="deleteProduct('${shop.shopID}',${shop.storeStatus},3)">删除</a>
+                               onclick="deleteProduct('${shop.shopID}',3)">删除</a>
                         </td>
                     </tr>
                 </c:forEach>
@@ -343,6 +361,7 @@
                     <th style="width:20px;" class="hide"></th>
                     <th></th>
                     <th>商品图片</th>
+                    <th>skuId</th>
                     <th>商品名称</th>
                     <th>供应商</th>
                     <th>数量</th>
@@ -350,19 +369,20 @@
                     </thead>
                     <tbody id="contentTbody1">
                     <c:forEach items="${cmPromotion.giftProducts}" var="product">
-                        <tr>
+                        <tr id="gift${product.skuId}">
                             <td>赠</td>
                             <th class="hide"><input class="check-item" type="checkbox" id="giftCheckItem"
                                                     name="gift" ${product.storeStatus?'':'checked'}
-                                                    value='${product.productID}'/></th>
+                                                    value='${product.skuId}'/></th>
                             <td><img src="${product.mainImage}" width="50px" height="50px"></td>
+                            <td>${product.skuId}</td>
                             <td>${product.name}</td>
                             <td>${product.shopName}</td>
                             <td><input id="actPrice1" name="giftNumber" style="width:50px;"
                                        value="${product.giftNumber}" type="number" maxlength="7" step="1"></td>
                             <td>
                                 <a href="javaScript:;"
-                                   onclick="deleteProduct('${product.productID}',${product.storeStatus},2)">删除</a>
+                                   onclick="deleteProduct('${product.skuId}',2)">删除</a>
                             </td>
                         </tr>
                     </c:forEach>

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

@@ -95,10 +95,12 @@
                             }
                         }
                     }
-                    if (mode=="3" &&( ${cmPromotion.giftProducts==null or cmPromotion.giftProducts.size()==0})) {
-                        alertx("请至少选择1个赠送的商品");
-                        isSubMitFlag = false;
-                        return false;
+                    if (mode=="3") {
+                        if(document.getElementById("contentTbody1").rows.length<1){
+                            alertx("请至少选择1个赠送的商品");
+                            isSubMitFlag = false;
+                            return false;
+                        }
                     }
                     //将促销商品和赠品信息填充进数组
                     $('#contentTbody tr').each(function (index, item) {
@@ -111,6 +113,7 @@
                     });
                     $('#contentTbody1 tr').each(function (index, item) {
                         var $this = $(this);
+                        //已改为skuId
                         var $itemProductID = $this.find('input[name="gift"]').val();
                         var $giftNumber = $this.find('input[name="giftNumber"]').val();
                         if ($giftNumber == null || $giftNumber == '' ) {
@@ -124,7 +127,7 @@
                             return false;
                         }
                         var obj = {
-                            productId: $itemProductID,
+                            skuId: $itemProductID,
                             number: $giftNumber
                         };
                         addGiftArray.push(obj)
@@ -142,7 +145,7 @@
                         var productItems = JSON.stringify(addProductArray);
                         var giftItems = JSON.stringify(addGiftArray);
                         $("#productIds").val(productItems);
-                        $("#giftIds").val(giftItems)
+                        $("#giftIds").val(giftItems);
                         loading('正在提交,请稍等...');
                         form.submit();
                     }
@@ -255,39 +258,46 @@
             });
         }
 
-        function deleteProduct(obj, storeStatus,type) {
+        function deleteProduct(obj,type) {
             //将该行数据取消勾选,若存在数据库中则将其删除
             $(".check-item[value=" + obj + "]").prop("checked", false);
-            var delProductIds = $("#delProductIds").val();
-            var delGiftIds = $("#delGiftIds").val();
-            if (storeStatus && type == 1) {
-                if (delProductIds != '') {
-                    delProductIds = delProductIds + "," + obj;
-                }else delProductIds = obj;
+            if (type == 1) {
+                var product=$('#product'+obj);
+                $(product).remove();
             }
-            if (storeStatus && type == 2) {
-                if (delGiftIds != '') {
-                    delGiftIds = delGiftIds + "," + obj;
-                }else delGiftIds = obj;
+            if (type == 2) {
+                var gift= $('#gift'+obj);
+                $(gift).remove();
             }
-            window.setTimeout(function () {
-                var productItems = getCheckedItems(1);
-                var giftItems = getCheckedItems(2);
-                var mode = $("input[name='mode']:checked").val();
-                var reducedPrice = $("#reducedPrice").val();
-                var touchPrice1 = $("#touchPrice1").val();
-                var touchPrice2 = $("#touchPrice2").val();
-                var touchPrice3 = $("#touchPrice3").val();
-                var status = $("input[name='status']:checked").val();
-                var beginTime = $("#beginTime").val();
-                var endTime = $("#endTime").val();
-                var delFlag1 = $("input[name='delFlag1']:checked").val();
-                window.location.href = "${ctx}/product/cmPromotions/form?type=1&productIds=" + productItems + "&giftIds=" + giftItems +
-                    "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+ "&mode=" + mode +
-                    "&reducedPrice=" + reducedPrice + "&touchPrice1=" + touchPrice1 + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
-                    "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}" +
-                    "&searchDbFlag=0";
-            },100)
+
+            $.ajax({
+                url: "${ctx}/product/cmPromotions/delPromotion",
+                data: {"id":"${cmPromotion.id || ''}","skuId":obj},
+                type: "POST",
+                async: false,
+                success: function(data){
+                    flag=data.success;
+                }
+            });
+
+            <%--window.setTimeout(function () {--%>
+            <%--    var productItems = getCheckedItems(1);--%>
+            <%--    var giftItems = getCheckedItems(2);--%>
+            <%--    var mode = $("input[name='mode']:checked").val();--%>
+            <%--    var reducedPrice = $("#reducedPrice").val();--%>
+            <%--    var touchPrice1 = $("#touchPrice1").val();--%>
+            <%--    var touchPrice2 = $("#touchPrice2").val();--%>
+            <%--    var touchPrice3 = $("#touchPrice3").val();--%>
+            <%--    var status = $("input[name='status']:checked").val();--%>
+            <%--    var beginTime = $("#beginTime").val();--%>
+            <%--    var endTime = $("#endTime").val();--%>
+            <%--    var delFlag1 = $("input[name='delFlag1']:checked").val();--%>
+            <%--    window.location.href = "${ctx}/product/cmPromotions/form?type=1&productIds=" + productItems + "&giftIds=" + giftItems +--%>
+            <%--        "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+ "&mode=" + mode +--%>
+            <%--        "&reducedPrice=" + reducedPrice + "&touchPrice1=" + touchPrice1 + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +--%>
+            <%--        "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}" +--%>
+            <%--        "&searchDbFlag=0";--%>
+            <%--},100)--%>
         }
 
         function getCheckedItems(type) {
@@ -339,7 +349,7 @@
                 </thead>
                 <tbody id="contentTbody">
                 <c:forEach items="${cmPromotion.promotionProducts}" var="product">
-                    <tr>
+                    <tr id="product${product.productID}">
                         <th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
                                    name="info" ${product.storeStatus?'':'checked'}
                                    value='${product.productID}'/></th>
@@ -349,7 +359,7 @@
                         <td>${product.price}</td>
                         <td>
                             <a href="javaScript:;"
-                               onclick="deleteProduct('${product.productID}',${product.storeStatus},1)">删除</a>
+                               onclick="deleteProduct('${product.productID}',1)">删除</a>
                         </td>
                     </tr>
                 </c:forEach>
@@ -386,27 +396,31 @@
                     <thead>
                     <th style="width:20px;" class="hide"></th>
                     <th></th>
+                    <th>skuId</th>
                     <th>商品图片</th>
                     <th>商品名称</th>
+                    <th>规格</th>
                     <th>供应商</th>
                     <th>数量</th>
                     <th>操作</th>
                     </thead>
                     <tbody id="contentTbody1">
                     <c:forEach items="${cmPromotion.giftProducts}" var="product">
-                        <tr>
+                        <tr id="gift${product.skuId}">
                             <td>赠</td>
+                            <td>${product.skuId}</td>
                             <th class="hide"><input class="check-item" type="checkbox" id="giftCheckItem"
                                                     name="gift" ${product.storeStatus?'':'checked'}
-                                                    value='${product.productID}'/></th>
+                                                    value='${product.skuId}'/></th>
                             <td><img src="${product.mainImage}" width="50px" height="50px"></td>
                             <td>${product.name}</td>
+                            <td>${product.unit}</td>
                             <td>${product.shopName}</td>
                             <td><input id="actPrice1" name="giftNumber" style="width:50px;"
                                        value="${product.giftNumber}" type="number" maxlength="7" step="1"></td>
                             <td>
                                 <a href="javaScript:;"
-                                   onclick="deleteProduct('${product.productID}',${product.storeStatus},2)">删除</a>
+                                   onclick="deleteProduct('${product.skuId}',2)">删除</a>
                             </td>
                         </tr>
                     </c:forEach>

+ 2 - 1
src/main/webapp/WEB-INF/views/modules/product/repeatPurchasePriceHistoryList.jsp

@@ -31,7 +31,8 @@
 			<b>机构名称:</b>${repeatPurchasePrice.userName}
 <%--			用户手机:${repeatPurchasePrice.mobile}--%>
 			<b>&nbsp;&nbsp;&nbsp;&nbsp;商品名称(ID):</b><a href="${wwwServer}product-${repeatPurchasePrice.productId}.html">${repeatPurchasePrice.productName}(${repeatPurchasePrice.productId})</a>
-			<b>&nbsp;&nbsp;&nbsp;&nbsp;供应商:</b><a href="${wwwServer}supplier/prolist-${repeatPurchasePrice.shopId}.html">${repeatPurchasePrice.shopName}</a>
+		<b>&nbsp;&nbsp;&nbsp;&nbsp;规格:</b>${repeatPurchasePrice.unit}
+		<b>&nbsp;&nbsp;&nbsp;&nbsp;供应商:</b><a href="${wwwServer}supplier/prolist-${repeatPurchasePrice.shopId}.html">${repeatPurchasePrice.shopName}</a>
 			<div class="clearfix"></div>
 		</div>
 	</form:form>

+ 122 - 99
src/main/webapp/WEB-INF/views/modules/product/repeatPurchasePriceList.jsp

@@ -1,108 +1,131 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
 <html>
 <head>
-	<title>再次购买管理</title>
-	<meta name="decorator" content="default"/>
-	<style type="text/css">
-		.table th{text-align: center;}
-		.table td{text-align: center;}
-	</style>
-	<script type="text/javascript">
-		$(document).ready(function() {
+    <title>再次购买管理</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th {
+            text-align: center;
+        }
 
-		});
-		function page(n,s){
-			$("#pageNo").val(n);
-			$("#pageSize").val(s);
-			$("#searchForm").submit();
-        	return false;
+        .table td {
+            text-align: center;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
         };
-	</script>
+    </script>
 </head>
 <body>
-	<ul class="nav nav-tabs">
-		<li class="active"><a href="${ctx}/product/repeatPurchasePrice/">再次购买列表</a></li>
-<%--		<shiro:hasPermission name="product:repeatPurchasePrice:edit"><li><a href="${ctx}/product/repeatPurchasePrice/form">再次购买添加</a></li></shiro:hasPermission>--%>
-	</ul>
-	<form:form id="searchForm" modelAttribute="repeatPurchasePrice" action="${ctx}/product/repeatPurchasePrice/" method="post" class="breadcrumb form-search">
-		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
-		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
-		<div class="ul-form">
-			<label>商品ID:</label>
-			<form:input path="productId" htmlEscape="false" maxlength="20" class="input-medium"  onkeyup="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"/>
-			<label>商品名称:</label>
-			<form:input path="productName" htmlEscape="false" maxlength="50" class="input-medium"/>
-			<label>机构名称:</label>
-			<form:input path="userName" htmlEscape="false" maxlength="50" class="input-medium"/>
-			<label>用户手机:</label>
-			<form:input path="mobile" htmlEscape="false" maxlength="50" class="input-medium"/>
-			<label>供应商名称:</label>
-			<form:input path="shopName" htmlEscape="false" maxlength="50" class="input-medium"/>
-			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
-			<div class="clearfix"></div>
-		</div>
-	</form:form>
-	<sys:message content="${message}"/>
-	<table id="contentTable" class="table table-striped table-bordered table-condensed">
-		<thead>
-			<tr>
-				<td>
-					机构名称
-				</td>
-				<td>
-					用户手机
-				</td>
-<%--				<td>--%>
-<%--					用户类型--%>
-<%--				</td>--%>
-				<td>
-					商品(ID)
-				</td>
-				<td>
-					供应商
-				</td>
-				<td>
-					税率
-				</td>
-				<td>
-					当前成本价<button type="button" class="tipButton" style="color: lightslategray;border-radius: 25px" onmousemove="alertx('商品的成本价跟随成本变化')">?</button>
-				</td>
-				<td>
-					复购价<button type="button" class="tipButton" style="color: lightslategray;border-radius: 25px" onmousemove="alertx('用户上一次购买此商品时商品的售价')">?</button>
-				</td>
-				<td>
-					添加时间
-				</td>
-				<%--<shiro:hasPermission name="product:repeatPurchasePrice:edit"></shiro:hasPermission>--%>
-                <th>操作</th>
-			</tr>
-		</thead>
-		<tbody>
-		<c:forEach items="${page.list}" var="repeatPurchasePrice">
-			<tr>
-				<td>${repeatPurchasePrice.userName}</td>
-				<td>${repeatPurchasePrice.mobile}</td>
-<%--				<td>${repeatPurchasePrice.type}</td>--%>
-                <td width="25%"><a href="${wwwServer}product-${repeatPurchasePrice.productId}.html">${repeatPurchasePrice.productName}(${repeatPurchasePrice.productId})</a></td>
-                <td><a href="${wwwServer}supplier/prolist-${repeatPurchasePrice.shopId}.html">${repeatPurchasePrice.shopName}</a></td>
-				<td><fmt:formatNumber value= "${repeatPurchasePrice.taxRate}" type="currency" pattern="0.00"/>%</td>
-                <td><fmt:formatNumber value= "${repeatPurchasePrice.costPrice}" type="currency" pattern="#,#00.00#"/></td>
-				<td><fmt:formatNumber value= "${repeatPurchasePrice.currentPrice}" type="currency" pattern="#,#00.00#"/></td>
-                <td>${repeatPurchasePrice.createTime}</td>
-                <td>
-					<a href="${ctx}/product/repeatPurchasePrice/getHistoryPriceList?repeatPurchasePriceId=${repeatPurchasePrice.id}">历史价格</a>&nbsp&nbsp
-					<a href="${ctx}/product/repeatPurchasePrice/delete?id=${repeatPurchasePrice.id}&repeatPurchasePriceId=${repeatPurchasePrice.id}" onclick="return confirmx('确认要删除该再次购买吗?', this.href)">删除</a>
-				</td>
-				<%--<shiro:hasPermission name="product:repeatPurchasePrice:edit"><td>--%>
-    				<%--<a href="${ctx}/product/repeatPurchasePrice/form?id=${repeatPurchasePrice.id}">编辑</a>--%>
-    				<%--<shiro:hasPermission name="product:repeatPurchasePrice:delete">--%>
-					<%--</shiro:hasPermission>--%>
-				<%--</td></shiro:hasPermission>--%>
-			</tr>
-		</c:forEach>
-		</tbody>
-	</table>
-	<div class="pagination">${page}</div>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/product/repeatPurchasePrice/">再次购买列表</a></li>
+    <%--		<shiro:hasPermission name="product:repeatPurchasePrice:edit"><li><a href="${ctx}/product/repeatPurchasePrice/form">再次购买添加</a></li></shiro:hasPermission>--%>
+</ul>
+<form:form id="searchForm" modelAttribute="repeatPurchasePrice" action="${ctx}/product/repeatPurchasePrice/"
+           method="post" class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <div class="ul-form">
+        <label>商品ID:</label>
+        <form:input path="productId" htmlEscape="false" maxlength="20" class="input-medium"
+                    onkeyup="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"/>
+        <label>商品名称:</label>
+        <form:input path="productName" htmlEscape="false" maxlength="50" class="input-medium"/>
+        <label>机构名称:</label>
+        <form:input path="userName" htmlEscape="false" maxlength="50" class="input-medium"/>
+        <label>用户手机:</label>
+        <form:input path="mobile" htmlEscape="false" maxlength="50" class="input-medium"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" maxlength="50" class="input-medium"/>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <td>
+            机构名称
+        </td>
+        <td>
+            用户手机
+        </td>
+        <%--				<td>--%>
+        <%--					用户类型--%>
+        <%--				</td>--%>
+        <td>
+            商品(ID)
+        </td>
+        <td>
+            规格
+        </td>
+        <td>
+            供应商
+        </td>
+        <td>
+            税率
+        </td>
+        <td>
+            当前成本价
+            <button type="button" class="tipButton" style="color: lightslategray;border-radius: 25px"
+                    onmousemove="alertx('商品的成本价跟随成本变化')">?
+            </button>
+        </td>
+        <td>
+            复购价
+            <button type="button" class="tipButton" style="color: lightslategray;border-radius: 25px"
+                    onmousemove="alertx('用户上一次购买此商品时商品的售价')">?
+            </button>
+        </td>
+        <td>
+            添加时间
+        </td>
+        <%--<shiro:hasPermission name="product:repeatPurchasePrice:edit"></shiro:hasPermission>--%>
+        <th>操作</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="repeatPurchasePrice">
+        <tr>
+            <td>${repeatPurchasePrice.userName}</td>
+            <td>${repeatPurchasePrice.mobile}</td>
+                <%--				<td>${repeatPurchasePrice.type}</td>--%>
+            <td width="25%"><a
+                    href="${wwwServer}product-${repeatPurchasePrice.productId}.html">${repeatPurchasePrice.productName}(${repeatPurchasePrice.productId})</a>
+            </td>
+            <td>${repeatPurchasePrice.unit}</td>
+            <td>
+                <a href="${wwwServer}supplier/prolist-${repeatPurchasePrice.shopId}.html">${repeatPurchasePrice.shopName}</a>
+            </td>
+            <td><fmt:formatNumber value="${repeatPurchasePrice.taxRate}" type="currency" pattern="0.00"/>%</td>
+            <td><fmt:formatNumber value="${repeatPurchasePrice.costPrice}" type="currency" pattern="#,#00.00#"/></td>
+            <td><fmt:formatNumber value="${repeatPurchasePrice.currentPrice}" type="currency" pattern="#,#00.00#"/></td>
+            <td>${repeatPurchasePrice.createTime}</td>
+            <td>
+                <a href="${ctx}/product/repeatPurchasePrice/getHistoryPriceList?repeatPurchasePriceId=${repeatPurchasePrice.id}">历史价格</a>&nbsp&nbsp
+                <a href="${ctx}/product/repeatPurchasePrice/delete?id=${repeatPurchasePrice.id}&repeatPurchasePriceId=${repeatPurchasePrice.id}"
+                   onclick="return confirmx('确认要删除该再次购买吗?', this.href)">删除</a>
+            </td>
+                <%--<shiro:hasPermission name="product:repeatPurchasePrice:edit"><td>--%>
+                <%--<a href="${ctx}/product/repeatPurchasePrice/form?id=${repeatPurchasePrice.id}">编辑</a>--%>
+                <%--<shiro:hasPermission name="product:repeatPurchasePrice:delete">--%>
+                <%--</shiro:hasPermission>--%>
+                <%--</td></shiro:hasPermission>--%>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
 </body>
 </html>

+ 131 - 28
src/main/webapp/static/modules/bulkpurchase/orderForm.js

@@ -472,7 +472,7 @@ function setPageCoupon() {
         html += '            <span>' + item.couponName + '</span>';
         html += redemptionCode;
         html += '            <span>' + item.couponDesc + '</span>';
-        html += '            <span>有效期:'+item.receiveDate+' - '+item.useEndDate+'</span>';
+        html += '            <span>有效期:' + item.receiveDate + ' - ' + item.useEndDate + '</span>';
         html += '</span></label></li>';
     });
     $("#couponBox").find(".couponContent").html(html);
@@ -599,15 +599,32 @@ function deleteShop(obj) {
     $(".addSecondHandProduct").show();
 }
 
-function resetProductList(setData) {
+function resetProductList(setData, ind) {
     var productList = [];
     var productIdList = [];
+    var skuIds = [];
     //var if (promotionsIds.indexOf(tempId)>=0) {
     $('.productTable tbody tr:not(.gift)').each(function (index, element) {
         var data = JSON.parse($(this).attr("data-value"));
         productList.push(data);
+        if (data.skuStr) {
+            var strings = data.skuStr.split("/");
+            var skuId = strings[0];
+            skuId = skuId * 1;
+            skuIds.push(skuId);
+        } else {
+            var skuId = "";
+            if (data.skuList) {
+                skuId = data.skuList[0].skuId;
+            } else {
+                skuId = data.skuId;
+            }
+            skuId = skuId * 1;
+            skuIds.push(skuId);
+        }
         productIdList.push(data.productId);
     });
+
     $('.productTable').each(function (index, element) {
         $(this).prev('.order-rows').remove();
         $(this).remove();
@@ -620,22 +637,38 @@ function resetProductList(setData) {
             setProductList(data, false);
         });
     } else {
-        if (productIdList.indexOf(setData.productId) >= 0) {
+        if (ind) {
+            productList.forEach(function (data) {
+                setProductList(data, false);
+            });
+        }
+
+        var skuId;
+        if (setData.skuStr) {
+            var strings = setData.skuStr.split("/");
+            skuId = strings[0];
+        } else {
+            skuId = setData.skuList[0].skuId;
+        }
+
+        skuId = skuId * 1;
+        if (skuIds.indexOf(skuId) >= 0) {
             //设置
             productList.forEach(function (data) {
-                if (setData.productId == data.productId) {
-                    setProductList(setData, false);
+                if (setData.skuId == data.skuId) {
+                    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(); //设置底部订单金额
 }
@@ -663,6 +696,7 @@ function editShopProduct(obj) {
     data = JSON.parse(data);
     var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
     var productID = (data.productId == undefined) ? data.productID : data.productId;
+    var skuId = (data.skuId == undefined) ? data.skuId : data.skuId;
     var secondHandType = (data.secondHandType == undefined) ? 0 : data.secondHandType;
     var discount = (data.discount == undefined) ? 100 : data.discount;
     var productCategory = (data.productCategory == undefined) ? 1 : data.productCategory;
@@ -698,7 +732,7 @@ function editShopProduct(obj) {
                         return false;
                     } else {
                         console.log('设置:' + items[0]);
-                        resetProductList(items[0]); //设置商品列表
+                        resetProductList(items[0], skuId); //设置商品列表
                     }
                     return true;
                 }
@@ -733,7 +767,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("请选择...");
@@ -804,8 +838,31 @@ function showSencondHandSelect(iframe) {
  * 设置商品列表(正常商品)
  * @param items
  */
-function setProductList(data) {
+function setProductList(data, flag, ind) {
     console.log("设置" + JSON.stringify(data));
+    var skuStr = "";
+    var skuIdStr = "";
+    var price = "";
+    if (data.skuList) {
+        skuStr = "<td>" + data.skuList[0].unit + "</td>";
+        skuIdStr = "<td>" + data.skuList[0].skuId + "</td>";
+        price = data.skuList[0].price;
+    } else {
+        skuStr = "<td>" + data.unit + "</td>";
+        skuIdStr = "<td>" + data.skuId + "</td>";
+        price = data.price;
+    }
+
+    //未选择sku,默认sku[0],选择了sku,skustr不为空
+    if (data.skuStr) {
+        var strings = data.skuStr.split("/");
+        var skuId = strings[0];
+        var index = strings[1] * 1;
+        skuStr = "<td>" + data.skuList[index].unit + "</td>";
+        skuIdStr = "<td>" + skuId + "</td>";
+        //price
+        price = data.skuList[index].price;
+    }
     var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
     var orderStatus = $("#orderStatus").val() ? $("#orderStatus").val() * 1 : 0;
     data.productType = 0;
@@ -821,7 +878,8 @@ function setProductList(data) {
             var tempProduct = {
                 shopId: data.shopId,
                 productId: data.productId,
-                price: data.price,
+                //有skuid后不能直传price,从选中项中取
+                price: price,
                 number: data.num,
                 totalTax: data.totalAddedValueTax
             };
@@ -871,7 +929,7 @@ function setProductList(data) {
                 var ladder = '<p><span>起订量</span><span>价格</span></p>';
                 for (var i = 0; i < data.ladderPriceList.length; i++) {
                     ladder += '<p data-num="' + data.ladderPriceList[i].buyNum + '"><span>' + data.ladderPriceList[i]
-                            .buyNumRangeShow + '</span><span class="price">' + data.ladderPriceList[i].buyPrice +
+                            .buyNum + '</span><span class="price">' + data.ladderPriceList[i].buyPrice +
                         '</span></p>';
                 }
                 ladderPrice = '<br><a href="javascript:;" class="ladderPrice"><span>阶梯价格</span><div class="list">' +
@@ -884,19 +942,23 @@ function setProductList(data) {
     if (data.couponsLogo * 1 === 2) {
         cmCouponBtn = '<a href="javascript:;" onclick="showCouponDetail(' + userId + ',' + data.productId + ')">查看</a>';
     }
+
     var str =
         "<tr id='product_" + data.productId + "' data-value='" + JSON.stringify(data) + "' data-index='" +
         product_index + "'>" +
         "<td>" + data.productId + "</td>" +
+        skuIdStr +
         "<td hidden><input type='hidden' name='orderProduct[" + product_index + "].enabledStatus' id='orderProduct" +
         product_index + ".enabledStatus' value='" + JSON.stringify(data) + "'/>" + data.shopId + "</td>" +
         "<td hidden>" + data.shopName + "</td>" +
         "<td class='fix-width'>" + data.name + "</td><td hidden></td>" +
         (data.productCategory == 2 ? "" : ("<td>" + data.shopName + "</td>")) +
+        skuStr +
         "<td>" + data.num + (data.presentNum > 0 ? "(" + data.presentNum + ")" : "") + "</td>" +
+        //价格
         (data.svipPriceFlag == 1 ? "<td>" + data.discountPrice :
-            (data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data.price +
-                "</del>") : ("<td>" + data.price))) +
+            (data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + price +
+                "</del>") : ("<td>" + price))) +
         ((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2)) ? "<label style='color: red'>(" : "") +
         (data.svipPriceFlag == 1 ? "超级会员价" : "") +
         ((data.svipPriceFlag == 1 && (data.includedTax != null && data.includedTax != '' && data.includedTax != 2)) ? "," : "") +
@@ -928,20 +990,35 @@ 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;
+
+    var skuId;
+    if (data.skuStr) {
+        var strings = data.skuStr.split("/");
+        skuId = strings[0];
+    } else {
+        if (data.skuList) {
+            skuId = data.skuList[0].skuId;
+        } else {
+            skuId = data.skuId;
+        }
+    }
+    skuId = skuId * 1;
     $('.productTable tbody tr:not(.gift)').each(function (index, element) {
-        if ($(this).find("td:nth-child(1)").html() == data.productId) {
+        if ($(this).find("td:nth-child(2)").html() == skuId) {
             removeEle = $(this).parent();
             $(this).remove();
             removeBeforeSoon = true;
         }
     });
+
     if (removeBeforeSoon) {
         //走到这里 说明是修改
         removeEle.append(str);
@@ -953,6 +1030,7 @@ function appendProductList(str, data, cmPromotion) {
             appendShopOrderHead(data, str, cmPromotion);
         }
     }
+
     setShopOrderFee(data.shopId);
     // setOrderFee(); //设置底部订单金额
     product_index++;
@@ -980,10 +1058,12 @@ function appendShopOrderHead(data, str, cmPromotion) {
         '<thead>' +
         '<tr>' +
         '<th>商品ID</th>' +
+        '<th>skuId</th>' +
         '<th hidden></th>' +
         '<th hidden></th>' +
         '<th class="fix-width">商品名称</th><th hidden></th>' +
         ((data.productCategory == 2) ? '' : '<th>供应商名称</th>') +
+        '<th>规格</th>' +
         '<th>数量(赠品数)</th>' +
         '<th>单价</th>' +
         '<th>折扣</th>' +
@@ -1007,9 +1087,18 @@ function setGiftHtmlList(data, cmPromotion) {
     console.log("设置赠品" + JSON.stringify(data));
     if (data.presentNum > 0) {
         // 已经添加的,重新添加
-        $('.productTable tbody tr.gift_' + data.productId).each(function (index, element) {
+        $('.productTable tbody tr.gift_' + data.skuId).each(function (index, element) {
             $(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));
         present.productType = 1;
         present.num = data.presentNum;
@@ -1020,11 +1109,14 @@ function setGiftHtmlList(data, cmPromotion) {
         var giftStr = "<tr id='product_gift_" + present.productId + "' class='gift gift_" + present.productId +
             "' data-value='" + JSON.stringify(present) + "' data-index='" + product_index + "'>" +
             "<td>" + present.productId + "</td>" +
+            "<td>" + present.skuId + "</td>" +
             "<td hidden><input type='hidden' name='orderProduct[" + product_index +
             "].enabledStatus' id='orderProduct" + product_index + ".enabledStatus' value='" + JSON.stringify(present) +
             "'/>" + present.shopId + "</td>" +
             "<td hidden>" + present.shopName + "</td>" +
             "<td class='fix-width'><i class='red'>协商赠品:</i>" + present.name + "</td><td hidden></td>" +
+            "<td>" + present.shopName + "</td>" +
+            "<td>" + skuStr + "</td>" +
             "<td>" + present.num + "</td>" +
             "<td>0</td>" +
             "<td>100</td>" +
@@ -1041,6 +1133,7 @@ function setGiftHtmlList(data, cmPromotion) {
         product_index++;
         appendGiftsList(present, giftStr, cmPromotion);
     }
+
     if (data.cmPromotion && data.cmPromotion.mode == 3) {
         var thisTouchPrice = 0;
         totalPromotions.forEach(function (item) {
@@ -1094,6 +1187,7 @@ function setGiftHtmlList(data, cmPromotion) {
                                 "' data-value='" + JSON.stringify(gift) + "' gift-index='" +
                                 product_index + "'>" +
                                 "<td>" + gift.productId + "</td>" +
+                                "<td>" + 0 + "</td>" +
                                 "<td hidden><input type='hidden' name='orderProduct[" + product_index +
                                 "].enabledStatus' id='orderProduct" + product_index +
                                 ".enabledStatus' value='" + JSON.stringify(gift) + "'/>" + gift.shopId +
@@ -1101,6 +1195,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>" + gift.num + "</td>" +
                                 "<td>0</td>" +
                                 "<td>100</td>" +
@@ -1239,7 +1334,8 @@ function setSeondHandProductList(data) {
 
 
 //设置订单金额信息
-function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金额=订单总额=应付总额
+function setOrderFee() {
+    //不考虑经理折扣、运费,此时 商品总金额=订单总额=应付总额
     var productTotalFee = 0, //商品总金额
         productCount = 0, //	商品总数
         presentCount = 0, //协商赠送商品数
@@ -1273,7 +1369,7 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
             });
             if (touchPrice >= item.touchPrice) {
                 if (item.discount * 1 === 1) {
-                    var b = Math.floor(touchPrice/item.touchPrice);
+                    var b = Math.floor(touchPrice / item.touchPrice);
                     reducedPrice += (b * item.reducedPrice);
                     payTotalFee -= reducedPrice;
                 } else {
@@ -1361,6 +1457,7 @@ function presentNum(index, type) {
 
 function setLadderPrice(obj, numVal, index) {
     if (obj["ladderPriceFlag"] * 1 === 1) {
+        debugger;
         var ladderList = obj["ladderPriceList"];
         var resultLadder = 0;
         for (var i = 0; i < ladderList.length; i++) {
@@ -1373,6 +1470,12 @@ function setLadderPrice(obj, numVal, index) {
         $("#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("#discountPrice" + index).val(ladderList[resultLadder]["buyPrice"]);
+        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("#priceLabel" + index).text(old);
+            $("#check-item" + index).parents("tr").find("#discountPrice" + index).val(old);
+        }
     }
 }
 
@@ -2056,7 +2159,7 @@ function setProductTotalFee() {
             });
             if (touchPrice >= item.touchPrice) {
                 if (item.discount * 1 === 1) {
-                    var b = Math.floor(touchPrice/item.touchPrice);
+                    var b = Math.floor(touchPrice / item.touchPrice);
                     reducedPrice += (b * item.reducedPrice);
                     payTotalFee -= reducedPrice;
                 } else {
@@ -2094,7 +2197,6 @@ function setProductTotalFee() {
 
     trs.each(function (index, element) {
         var obj = JSON.parse($(this).attr("data-value"));
-
         var _taxRate = Number(obj.taxRate); //税率
         var _totalFee = Number(obj.totalFee); //总价
         var _shopFee1 = isNaN(Number(obj.shopFee1)) ? Number(obj.singleShopFee) : Number(obj.shopFee1);
@@ -2214,9 +2316,9 @@ function showPromotionDetail(iframe, title) {
  * 改变返佣标识
  */
 function updateRebateFlag() {
-    var rebateFlag = $("#rebateFlag").val()*1;
+    var rebateFlag = $("#rebateFlag").val() * 1;
     console.log(rebateFlag);
-    if (1===rebateFlag) {
+    if (1 === rebateFlag) {
         // $("#rebateFlag").val(1);
         //选中返佣订单后不可用优惠券
         // $("#couponBox").find("input[name=clubCouponId]").prop('checked', 'checked');
@@ -2288,13 +2390,14 @@ function updateRebateFlags() {
     }
 }
 
-function checkRebateFee(rebateFlag){
-    if(2===rebateFlag){
+function checkRebateFee(rebateFlag) {
+    if (2 === rebateFlag) {
         $("#rebateFee").show();
-    }else {
+    } else {
         $("#rebateFee").hide();
     }
 }
+
 /**
  * 修改返佣选项是否可见
  */

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません