huangzhiguo 1 سال پیش
والد
کامیت
17bc0abd66
19فایلهای تغییر یافته به همراه493 افزوده شده و 218 حذف شده
  1. 35 35
      src/main/java/com/caimei/modules/order/web/CmPayShopController.java
  2. 2 2
      src/main/java/com/caimei/modules/product/dao/CmOrganizeProductInfoMapper.java
  3. 2 0
      src/main/java/com/caimei/modules/product/dao/ProductDao.java
  4. 12 0
      src/main/java/com/caimei/modules/product/entity/CmOrganizeProductInfo.java
  5. 5 5
      src/main/java/com/caimei/modules/product/entity/CmSku.java
  6. 9 0
      src/main/java/com/caimei/modules/product/entity/Product.java
  7. 19 5
      src/main/java/com/caimei/modules/product/service/ProductService.java
  8. 11 4
      src/main/java/com/caimei/modules/product/web/ProductNewController.java
  9. 4 2
      src/main/resources/mappings/modules/bulkpurchase/PurchaseProductMapper.xml
  10. 1 1
      src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml
  11. 1 1
      src/main/resources/mappings/modules/order/OrderProductMapper.xml
  12. 7 4
      src/main/resources/mappings/modules/product/CmOrganizeProductInfoMapper.xml
  13. 14 6
      src/main/resources/mappings/modules/product/CmPromotionMapper.xml
  14. 1 1
      src/main/resources/mappings/modules/product/CmSecondHandDetailMapper.xml
  15. 107 54
      src/main/resources/mappings/modules/product/ProductMapper.xml
  16. 5 1
      src/main/resources/mappings/modules/product/ProductNewMapper.xml
  17. 1 1
      src/main/resources/mappings/modules/product/RepeatPurchasePriceMapper.xml
  18. 1 1
      src/main/resources/mappings/modules/weisha/CmOrganizeProductMapper.xml
  19. 256 95
      src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

+ 35 - 35
src/main/java/com/caimei/modules/order/web/CmPayShopController.java

@@ -299,7 +299,7 @@ public class CmPayShopController extends BaseController {
         //如果子订单填写了成本方式,那么页面上传过来的成本方式必须和数据库相同
         //子订单的成本方式第一次填写以后就不能修改了
         // 固定成本
-        if ("1".equals(costType)) {
+        //if ("1".equals(costType)) {
             // List<CmReturnedPurchaseProduct> rL = cmReturnedPurchaseProductService.findReturnedByShopOrderID(Integer.parseInt(shopOrderID));
             for (NewOrderProduct product : newOrderProducts) {
                 Integer orderProductID = product.getOrderProductID();
@@ -361,9 +361,9 @@ public class CmPayShopController extends BaseController {
             }
             shopOrder.setShopTaxFee(totalTaxesFee); //总税费
             shopOrder.setShopProductAmount(totalCostFee); //商品费
-        }
+        //}
         // 比例成本
-        if ("2".equals(costType)) {
+        /*if ("2".equals(costType)) {
             for (NewOrderProduct product : newOrderProducts) {
                 Integer orderProductID = product.getOrderProductID();
                 Double costPrice = product.getCostPrice() == null ? 0d : product.getCostPrice();
@@ -419,39 +419,39 @@ public class CmPayShopController extends BaseController {
             }
             shopOrder.setShopTaxFee(totalTaxesFee); //总税费
             shopOrder.setShopProductAmount(totalCostFee); //商品费
-            /*// 保存修改之前的记录
-            List<NewOrderProduct> orderProductList = newOrderProductService.getListByShopOrderID(Integer.parseInt(shopOrderID));
-            if (CollectionUtils.isNotEmpty(orderProductList)) {
-                for (NewOrderProduct orderProduct : orderProductList) {
-                    // 修改前
-                    if (StringUtils.isEmpty(dbcostType)) {
-                        CmChangePayShopProduct cmChangePayShopProduct = new CmChangePayShopProduct();
-                        cmChangePayShopProduct.setRecondType("1");
-                        cmChangePayShopProduct.setChangeType("1");
-                        cmChangePayShopProduct.setChangePayShopId(Integer.parseInt(cmChangePayShopRecondId));
-                        cmChangePayShopProduct.setOrderProductId(orderProduct.getOrderProductID());
-                        cmChangePayShopProduct.setOrderProductName(orderProduct.getName());
-                        cmChangePayShopProduct.setSupplierTaxRate(orderProduct.getSupplierTaxRate());
-                        cmChangePayShopProduct.setCostPrice(orderProduct.getCostPrice());
-                        cmChangePayShopProduct.setSingleShouldPayTotalTax(orderProduct.getSingleShouldPayTotalTax());
-                        cmChangePayShopProductService.save(cmChangePayShopProduct);
-                    }
-                    //售价
-                    Double price = orderProduct.getTouchPrice() == null ? orderProduct.getDiscountPrice() : orderProduct.getTouchPrice();
-                    orderProduct.setCostPrice(price * proportional / 100);
-                    orderProducts.add(orderProduct);
-                    if (soZeroCostFlag && orderProduct.getCostPrice() <= 0) {
-                        soZeroCostFlag = false;
-                    }
-                }
-            }
-
-            shopOrder.setProportional(proportional);
-            shopOrder.setShopTaxFee(0D); //总税费
-            Double productAmount = shopOrder.getProductAmount();//子订单金额
-            shopOrder.setShopProductAmount(productAmount * proportional / 100); //商品费*/
+//            // 保存修改之前的记录
+//            List<NewOrderProduct> orderProductList = newOrderProductService.getListByShopOrderID(Integer.parseInt(shopOrderID));
+//            if (CollectionUtils.isNotEmpty(orderProductList)) {
+//                for (NewOrderProduct orderProduct : orderProductList) {
+//                    // 修改前
+//                    if (StringUtils.isEmpty(dbcostType)) {
+//                        CmChangePayShopProduct cmChangePayShopProduct = new CmChangePayShopProduct();
+//                        cmChangePayShopProduct.setRecondType("1");
+//                        cmChangePayShopProduct.setChangeType("1");
+//                        cmChangePayShopProduct.setChangePayShopId(Integer.parseInt(cmChangePayShopRecondId));
+//                        cmChangePayShopProduct.setOrderProductId(orderProduct.getOrderProductID());
+//                        cmChangePayShopProduct.setOrderProductName(orderProduct.getName());
+//                        cmChangePayShopProduct.setSupplierTaxRate(orderProduct.getSupplierTaxRate());
+//                        cmChangePayShopProduct.setCostPrice(orderProduct.getCostPrice());
+//                        cmChangePayShopProduct.setSingleShouldPayTotalTax(orderProduct.getSingleShouldPayTotalTax());
+//                        cmChangePayShopProductService.save(cmChangePayShopProduct);
+//                    }
+//                    //售价
+//                    Double price = orderProduct.getTouchPrice() == null ? orderProduct.getDiscountPrice() : orderProduct.getTouchPrice();
+//                    orderProduct.setCostPrice(price * proportional / 100);
+//                    orderProducts.add(orderProduct);
+//                    if (soZeroCostFlag && orderProduct.getCostPrice() <= 0) {
+//                        soZeroCostFlag = false;
+//                    }
+//                }
+//            }
+//
+//            shopOrder.setProportional(proportional);
+//            shopOrder.setShopTaxFee(0D); //总税费
+//            Double productAmount = shopOrder.getProductAmount();//子订单金额
+//            shopOrder.setShopProductAmount(productAmount * proportional / 100); //商品费
 
-        }
+        }*/
         shopOrder.setPayStatus(soZeroCostFlag ? "3" : "1");
         shopOrder.setZeroCostFlag(soZeroCostFlag ? 1 : 0);
         //当子订单0成本时,若主订单中其他子订单(除了运费子订单)都为0成本,设主订单为已付款,否则设为部分付款

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

@@ -74,8 +74,8 @@ public interface CmOrganizeProductInfoMapper extends CrudDao<CmOrganizeProductIn
     /**
      * 批量修改商品组织信息(采购平台独立字段)
      *
-     * @param organizeIds 需要删除的数据主键集合
+     * @param organizeId
      * @return 结果
      */
-    public int updateNotCmOrganizeProductInfos(@Param("organizeIds") Integer[] organizeIds,  @Param("productId")Integer productId,@Param("validFlag")Integer validFlag);
+    int updateNotCmOrganizeProductInfos(@Param("organizeId") Integer organizeId,  @Param("productId")Integer productId,@Param("costCheckFlag") Integer costCheckFlag,@Param("validFlag")Integer validFlag);
 }

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

@@ -196,6 +196,8 @@ public interface ProductDao extends CrudDao<Product> {
 
     List<CmSku> findSkuList(Integer productID);
 
+    Integer getCostCheckFlag(@Param("productId") Integer productId,@Param("organizeId") Integer organizeId);
+
     List<CmSku> findSkuListProduct(Integer productID);
 
     List<CmSku> findSkuOrganizeList(Integer productID);

+ 12 - 0
src/main/java/com/caimei/modules/product/entity/CmOrganizeProductInfo.java

@@ -28,6 +28,10 @@ public class CmOrganizeProductInfo  extends DataEntity<CmOrganizeProductInfo> im
      * 商品id
      */
     private Integer productId;
+    /**
+     * 成本类型:1固定成本 2比例成本
+     */
+    private Integer costCheckFlag;
     /**
      * 0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已隐身 10已冻结
      */
@@ -49,6 +53,14 @@ public class CmOrganizeProductInfo  extends DataEntity<CmOrganizeProductInfo> im
         this.productId = productId;
     }
 
+    public Integer getCostCheckFlag() {
+        return costCheckFlag;
+    }
+
+    public void setCostCheckFlag(Integer costCheckFlag) {
+        this.costCheckFlag = costCheckFlag;
+    }
+
     public Integer getValidFlag() {
         return validFlag;
     }

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

@@ -24,9 +24,9 @@ public class CmSku extends DataEntity<CmSku> {
     private String stock;        // 库存
     private Integer costCheckFlag;        // 成本价选中标志:1固定成本 2比例成本
     private Double shopPercent;        // 比例成本百分比
-    private Double costPrice;        // 成本价
-    private Double OrganizeCostPrice;        // 成本价
-    private Double cmCostPrice;        // 成本价
+    private Double costPrice;        // 供应商成本价
+    private Double organizeCostPrice;        // 集团成本价
+    private Double cmCostPrice;        // 采美成本价
     private Double price;        // 机构价
     private Integer ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
     private Integer minBuyNumber;        // 无阶梯价起订量
@@ -159,11 +159,11 @@ public class CmSku extends DataEntity<CmSku> {
     }
 
     public Double getOrganizeCostPrice() {
-        return OrganizeCostPrice;
+        return organizeCostPrice;
     }
 
     public void setOrganizeCostPrice(Double organizeCostPrice) {
-        OrganizeCostPrice = organizeCostPrice;
+        this.organizeCostPrice = organizeCostPrice;
     }
 
     public Double getCmCostPrice() {

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

@@ -70,6 +70,7 @@ public class Product extends DataEntity<Product> {
     private String shopPercent;        // 比例成本百分比
     private Double sqlShopPercent;     //入数据库字段
     private String costCheckFlag;        // 成本价选中标志:1固定成本 2比例成
+    private String mallCostCheckFlag;        // 成本价选中标志:1固定成本 2比例成
     private String precisehKey;        // 精确关键字
     private String giftFlag;//是否可以参加赠送(0:无法参加,1:可以参加赠送,2:已参加过赠送)
     private String beginTimeStr;//活动开始时间串
@@ -1033,6 +1034,14 @@ public class Product extends DataEntity<Product> {
         this.costCheckFlag = costCheckFlag;
     }
 
+    public String getMallCostCheckFlag() {
+        return mallCostCheckFlag;
+    }
+
+    public void setMallCostCheckFlag(String mallCostCheckFlag) {
+        this.mallCostCheckFlag = mallCostCheckFlag;
+    }
+
     public String getPrecisehKey() {
         return precisehKey;
     }

+ 19 - 5
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -333,23 +333,35 @@ public class ProductService extends CrudService<ProductDao, Product> {
             listMall.sort(Comparator.naturalOrder());
             String strip = StringUtils.strip(listMall.toString(), "[]");
             product.setGroundMall(strip.replaceAll(",", "##").trim());
-            cmOrganizeProductInfoMapper.updateNotCmOrganizeProductInfos(listMall.toArray(new Integer[listMall.size()]),product.getProductID(),3);
             listMall.forEach(s -> {
                 CmOrganizeProductInfo cmOrganizeProductInfoOrganizeId = new CmOrganizeProductInfo();
                 cmOrganizeProductInfoOrganizeId.setOrganizeId(s);
                 cmOrganizeProductInfoOrganizeId.setProductId(product.getProductID());
+                // 调整商品信息表
+                CmOrganizeProductInfo cmOrganizeProductInfo = new CmOrganizeProductInfo();
+                if (0 == s) {
+                    cmOrganizeProductInfo.setCostCheckFlag(Integer.parseInt(product.getCostCheckFlag()));
+                } else if (4 == s){
+                    cmOrganizeProductInfo.setCostCheckFlag(Integer.parseInt(product.getMallCostCheckFlag()));
+                }
                 if ( null == cmOrganizeProductInfoMapper.getByCmOrganizeProductInfo(cmOrganizeProductInfoOrganizeId)){
-                    CmOrganizeProductInfo cmOrganizeProductInfo = new CmOrganizeProductInfo();
                     cmOrganizeProductInfo.setOrganizeId(s);
                     cmOrganizeProductInfo.setProductId(product.getProductID());
                     cmOrganizeProductInfo.setValidFlag(1);
                     cmOrganizeProductInfoMapper.addCmOrganizeProductInfo(cmOrganizeProductInfo);
+                } else {
+                    if (!listMall.contains(s)) {
+                        cmOrganizeProductInfoMapper.updateNotCmOrganizeProductInfos(s, product.getProductID(), cmOrganizeProductInfo.getCostCheckFlag(), 3);
+                    }
                 }
 
             });
         } else {
             product.setGroundMall("");
-            cmOrganizeProductInfoMapper.delCmOrganizeProductInfoByOrganizeIds(new Integer[]{0, 4},product.getProductID());
+            /**
+             * 即使不上架平台,商品状态也不能直接删除,将商品状态置为下架,删除状态
+             */
+            cmOrganizeProductInfoMapper.updateNotCmOrganizeProductInfos(999,product.getProductID(),999,10);
         }
         if (null != product.getShopType() && 2 == product.getShopType()) {
             product.setValidFlag("2");
@@ -671,8 +683,9 @@ public class ProductService extends CrudService<ProductDao, Product> {
 
     public List<CmSku> findSkuList(Integer productID) {
         List<CmSku> skus = productDao.findSkuListProduct(productID);
+        Integer costCheckFlag = productDao.getCostCheckFlag(productID, 0);
         skus.forEach(s -> {
-            //s.setCostCheckFlag(2);
+            s.setCostCheckFlag(costCheckFlag);
             s.ladderPriceList(productDao.findLadderPriceBySku(s.skuId()));
         });
 
@@ -681,8 +694,9 @@ public class ProductService extends CrudService<ProductDao, Product> {
 
     public List<CmSku> findMallSkuList(Integer productID) {
         List<CmSku> skuOrganizeList = productDao.findSkuOrganizeList(productID);
+        Integer costCheckFlag = productDao.getCostCheckFlag(productID, 4);
         skuOrganizeList.forEach(o -> {
-            o.setCostCheckFlag(2);
+            o.setCostCheckFlag(costCheckFlag);
         });
         return skuOrganizeList;
     }

+ 11 - 4
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -483,9 +483,16 @@ public class ProductNewController extends BaseController {
                 searchKeyStr += "##";
             }
         }
-        if (null != product.getSkuList()) {
+        /*if (null != product.getSkuList()) {
             for (CmSku s : product.getSkuList()) {
-                if (null != s.getCostCheckFlag() && s.getCostCheckFlag() == 2) {
+                if (StringUtils.isNotBlank(product.getCostCheckFlag()) && "1".equals(product.getCostCheckFlag())) {
+                    double v = MathUtil.add(MathUtil.add(s.getCostPrice(), s.getOrganizeCostPrice()), s.getCmCostPrice()).doubleValue();
+                    if (v != s.getPrice()) {
+                        addMessage(redirectAttributes, "保存商品失败,sku固定成本之和需要等于机构价!");
+                        return "redirect:" + Global.getAdminPath() + "/product/new/productEdit?id="+product.getId();
+                    }
+                }
+                if (StringUtils.isNotBlank(product.getCostCheckFlag()) && "2".equals(product.getCostCheckFlag())) {
                     if (s.getShopPercent()==0) {
                         addMessage(redirectAttributes, "保存商品失败,供应商比例必须大于0");
                         return "redirect:" + Global.getAdminPath() + "/product/new/productEdit?id="+product.getId();
@@ -497,7 +504,7 @@ public class ProductNewController extends BaseController {
                     }
                 }
             }
-        }
+        }*/
         product.setSearchKey(searchKeyStr);
         productDetailInfo.setProductID(product.getProductID());
         productService.saveProduct(product, productDetailInfo);
@@ -825,7 +832,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 synchronized 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) {

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

@@ -38,8 +38,10 @@
 
 	<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.shopPercent, cs.normalPrice
+		cs.price,a.`productID` as productId,a.productCode productNo,
+		a.mainImage image,
+		(SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cs.productId AND organizeId = cs.organizeId ) AS costCheckFlag,
+		cs.costPrice,cs.shopPercent, cs.normalPrice
 		,a.productCategory as "productCategory",cshd.secondHandType as "secondHandType",cs.ladderPriceFlag
 		,a.includedTax
 		,a.invoiceType

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

@@ -302,7 +302,7 @@
                ifnull(cs.shopPercent, 0) as shopPercent,
                ifnull(cs.organizePercent, 0) as organizePercent,
                ifnull(cs.cmPercent, 0) as cmPercent,
-               ifnull(cs.costCheckFlag, 0)    as costType,
+               ifnull((SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cs.productId AND organizeId = cs.organizeId ), 0)    as costType,
                ifnull(cs.costPrice, 0)        as costPrice
             ,cs.organizeId
         from cm_sku cs

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

@@ -81,7 +81,7 @@
 		a.`productImage` AS `productImage`,
 		a.`shopName` AS `shopName`,
 		cs.stock AS stock,
-		cs.costCheckFlag AS costCheckFlag,
+		(SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cs.productId AND organizeId = cs.organizeId ) AS costCheckFlag,
 		cs.costPrice AS costPrice,
 		cs.organizeId AS organizeId,
 		cs.unit AS unit,

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

@@ -48,11 +48,13 @@
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="organizeId != null">organizeId,</if>
             <if test="productId != null">productId,</if>
+            <if test="costCheckFlag != null">costCheckFlag,</if>
             <if test="validFlag != null">validFlag,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="organizeId != null">#{organizeId},</if>
             <if test="productId != null">#{productId},</if>
+            <if test="costCheckFlag != null">#{costCheckFlag},</if>
             <if test="validFlag != null">#{validFlag},</if>
         </trim>
     </insert>
@@ -88,11 +90,12 @@
         update cm_organize_product_info
         <trim prefix="SET" suffixOverrides=",">
             <if test="validFlag != null">validFlag = #{validFlag},</if>
+            <if test="costCheckFlag != null and costCheckFlag != 999">costCheckFlag = #{costCheckFlag},</if>
         </trim>
-        where productId = #{productId} and organizeId not in
-        <foreach item="organizeId" collection="organizeIds" open="(" separator="," close=")">
-            #{organizeId}
-        </foreach>
+        where productId = #{productId}
+            <if test="organizeId != null and organizeId != 999">
+                and organizeId = #{organizeId}
+            </if>
     </update>
 
 </mapper>

+ 14 - 6
src/main/resources/mappings/modules/product/CmPromotionMapper.xml

@@ -140,7 +140,7 @@
                p.`productID`       productId,
                p.productCode       productNo,
                p.mainImage         image,
-               cs.costCheckFlag    costCheckFlag,
+               (SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cs.productId AND organizeId = cs.organizeId ) AS costCheckFlag,
                cs.costPrice        costPrice,
                cs.organizeId        organizeId,
                cs.shopPercent shopPercent,
@@ -461,9 +461,13 @@
     </select>
 
     <select id="getPromotionSkus" resultType="com.caimei.modules.product.entity.CmSku">
-        SELECT DISTINCT cs.unit, cs.costCheckFlag, cs.costPrice, cs.shopPercent, cps.touchPrice
-                               , cs.skuId
-                               , cs.organizeId
+        SELECT DISTINCT cs.unit,
+                        (SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cs.productId AND organizeId = cs.organizeId ) AS costCheckFlag,
+                        cs.costPrice,
+                        cs.shopPercent,
+                        cps.touchPrice,
+                        cs.skuId,
+                        cs.organizeId
         FROM cm_promotions cp
                  LEFT JOIN cm_promotions_product cpp ON cp.id = cpp.promotionsId
                  LEFT JOIN cm_sku cs ON cpp.productId = cs.productId
@@ -472,8 +476,12 @@
     </select>
 
     <select id="getPromotionSkusByProduct" resultType="com.caimei.modules.product.entity.CmSku">
-        SELECT cs.skuId,cs.unit, cs.costCheckFlag, cs.costPrice, cs.shopPercent, cps.touchPrice
-                      , cs.organizeId
+        SELECT cs.skuId,cs.unit,
+               (SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cs.productId AND organizeId = cs.organizeId ) AS costCheckFlag,
+               cs.costPrice,
+               cs.shopPercent,
+               cps.touchPrice,
+               cs.organizeId
         FROM cm_sku cs
                  LEFT JOIN cm_promotion_sku cps ON cs.skuId = cps.skuId
         WHERE cs.productId = #{productIds} and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)

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

@@ -47,7 +47,7 @@
 		cs.stock AS "stock",
 		p.brandID AS "brandID",
 		cs.costPrice as "costPrice",
-		cs.costCheckFlag AS "costCheckFlag",
+		(SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cs.productId AND organizeId = cs.organizeId ) AS costCheckFlag,
 		cs.shopPercent AS "shopPercent",
 		cs.organizeId AS "organizeId",
 		p.visibility AS "visibility",

+ 107 - 54
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -122,7 +122,9 @@
 
     <select id="get" resultType="Product">
         SELECT
-        <include refid="productColumns"/>
+        <include refid="productColumns"/>,
+        (select costCheckFlag from cm_organize_product_info where productId = #{id} and organizeId = 0 ) as costCheckFlag,
+        (select costCheckFlag from cm_organize_product_info where productId = #{id} and organizeId = 4 ) as mallCostCheckFlag
         FROM product a
         <include refid="productJoins"/>
         WHERE a.productID = #{id}
@@ -1051,14 +1053,25 @@
          normalPrice,
          price,
          ladderPriceFlag,
-         costCheckFlag,
-         costprice,
-         organizeCostPrice,
-         cmCostPrice,
+         <if test="costPrice != null and costPrice != ''">
+            costprice,
+         </if>
+         <if test="organizeCostPrice != null and organizeCostPrice != ''">
+            organizeCostPrice,
+         </if>
+         <if test="cmCostPrice != null and cmCostPrice != ''">
+            cmCostPrice,
+         </if>
          stock,
-         shopPercent,
-         organizePercent,
-         cmPercent,
+         <if test="shopPercent != null and shopPercent != ''">
+            shopPercent,
+         </if>
+         <if test="organizePercent != null and organizePercent != ''">
+            organizePercent,
+         </if>
+         <if test="cmPercent != null and cmPercent != ''">
+            cmPercent,
+         </if>
          organizeId,
          minBuyNumber,
          unit)
@@ -1066,14 +1079,25 @@
                 #{normalPrice},
                 #{price},
                 #{ladderPriceFlag},
-                #{costCheckFlag},
-                #{costPrice},
-                #{organizeCostPrice},
-                #{cmCostPrice},
+                <if test="costPrice != null and costPrice != ''">
+                    #{costPrice},
+                </if>
+                <if test="organizeCostPrice != null and organizeCostPrice != ''">
+                    #{organizeCostPrice},
+                </if>
+                <if test="cmCostPrice != null and cmCostPrice != ''">
+                    #{cmCostPrice},
+                </if>
                 #{stock},
-                #{shopPercent},
-                #{organizePercent},
-                #{cmPercent},
+                <if test="shopPercent != null and shopPercent != ''">
+                    #{shopPercent},
+                </if>
+                <if test="organizePercent != null and organizePercent != ''">
+                    #{organizePercent},
+                </if>
+                <if test="cmPercent != null and cmPercent != ''">
+                    #{cmPercent},
+                </if>
                 #{organizeId},
                 #{minBuyNumber},
                 #{unit})
@@ -1716,13 +1740,24 @@
             normalPrice=#{normalPrice},
             price=#{price},
             organizeId=#{organizeId},
-            shopPercent=#{shopPercent},
-            organizePercent=#{organizePercent},
-            cmPercent=#{cmPercent},
-            costPrice=#{costPrice},
-            organizeCostPrice = #{organizeCostPrice},
-            cmCostPrice = #{cmCostPrice},
-            costCheckFlag=#{costCheckFlag},
+            <if test="shopPercent != null and shopPercent !=''">
+                shopPercent=#{shopPercent},
+            </if>
+            <if test="organizePercent != null and organizePercent !=''">
+                organizePercent=#{organizePercent},
+            </if>
+            <if test="cmPercent != null and cmPercent !=''">
+                cmPercent=#{cmPercent},
+            </if>
+            <if test="costPrice != null and costPrice !=''">
+                costPrice=#{costPrice},
+            </if>
+            <if test="organizeCostPrice != null and organizeCostPrice !=''">
+                organizeCostPrice = #{organizeCostPrice},
+            </if>
+            <if test="cmCostPrice != null and cmCostPrice !=''">
+                cmCostPrice = #{cmCostPrice},
+            </if>
             stock=#{stock},
             unit=#{unit},
             minBuyNumber=#{minBuyNumber}
@@ -1986,7 +2021,7 @@
                unit,
                normalPrice,
                stock,
-               costCheckFlag,
+               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
                shopPercent,
                costPrice,
                price,
@@ -2002,6 +2037,9 @@
         where cs.productId = #{productID}
           and  cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=#{productID})
     </select>
+    <select id="getCostCheckFlag" resultType="java.lang.Integer">
+        select costCheckFlag from cm_organize_product_info where productId = #{productId} and organizeId = #{organizeId}
+    </select>
     <select id="findSkuListProduct" resultType="com.caimei.modules.product.entity.CmSku">
         select cs.skuId,
                cs.productId,
@@ -2009,11 +2047,13 @@
                unit,
                normalPrice,
                stock,
-               costCheckFlag,
+               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
                shopPercent,
                organizePercent,
                cmPercent,
                costPrice,
+               organizeCostPrice,
+               cmCostPrice,
                price,
                ladderPriceFlag,
                minBuyNumber,
@@ -2025,22 +2065,24 @@
         where cs.organizeId=0 and  cs.productId = #{productID}
     </select>
     <select id="findSkuOrganizeList" resultType="com.caimei.modules.product.entity.CmSku">
-        select skuId,
-               productId,
-               organizeId,
-               unit,
-               normalPrice,
-               stock,
-               "2" as costCheckFlag,
-               shopPercent as shopPercent,
-               costPrice,
-               price,
-               minBuyNumber,
-               organizePercent,
-               shopPercent,
-               cmPercent
-        from cm_sku
-        where organizeId=4  and productId = #{productID}
+        select cs.skuId,
+               cs.productId,
+               cs.organizeId,
+               cs.unit,
+               cs.normalPrice,
+               cs.stock,
+               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               cs.shopPercent as shopPercent,
+               cs.costPrice,
+               cs.organizeCostPrice,
+               cs.cmCostPrice,
+               cs.price,
+               cs.minBuyNumber,
+               cs.organizePercent,
+               cs.shopPercent,
+               cs.cmPercent
+        from cm_sku cs
+        where cs.organizeId = 4  and cs.productId = #{productID}
     </select>
     <select id="findLadderPriceBySku" resultType="com.caimei.modules.product.entity.CmLadderPrice">
         select skuId, productId, userType, ladderNum, buyNum, buyPrice, delFlag
@@ -2079,7 +2121,7 @@
                cs.organizeId,
                cs.unit,
                cs.stock,
-               cs.costCheckFlag,
+               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
                cs.costPrice,
                ifnull(cs.shopPercent, 0) as shopPercent,
                ifnull(cs.organizePercent, 0) as organizePercent,
@@ -2097,29 +2139,40 @@
         where productId = #{productId}
     </select>
     <select id="findSku" resultType="com.caimei.modules.product.entity.CmSku">
-        select price, ifnull(costPrice, 0) as costPrice, costCheckFlag, shopPercent, normalPrice
+        select cs.price,
+               ifnull(cs.costPrice, 0) as costPrice,
+               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               cs.shopPercent,
+               cs.normalPrice
         from cm_sku cs
-        where productId = #{productId}
+        where cs.productId = #{productId}
           and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
-        order by price asc
+        order by cs.price asc
         limit 1
     </select>
     <select id="findOrganizeSku" resultType="com.caimei.modules.product.entity.CmSku">
-        SELECT price, ifnull(costPrice, 0),"1" AS costCheckFlag, shopPercent AS shopPercent
-                    , normalPrice
-                    , organizeId
+        SELECT cs.price,
+               ifnull(cs.costPrice, 0),
+               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               cs.shopPercent AS shopPercent,
+               cs.normalPrice,
+               cs.organizeId
         FROM cm_sku cs
-        WHERE productId = #{productId}
+        WHERE cs.productId = #{productId}
           and cs.organizeId=4
-        ORDER BY price ASC
+        ORDER BY cs.price ASC
         LIMIT 1
     </select>
     <select id="findSkuById" resultType="com.caimei.modules.product.entity.CmSku">
-        select skuId, price, costPrice, costCheckFlag, shopPercent
-                    , unit
-                    , organizeId
-        from cm_sku
-        where skuId = #{skuId}
+        select cs.skuId,
+               cs.price,
+               cs.costPrice,
+               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               cs.shopPercent,
+               cs.unit,
+               cs.organizeId
+        from cm_sku cs
+        where cs.skuId = #{skuId}
           and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
     </select>
     <select id="findSkuIdByPromotionsId" resultType="java.lang.Integer">

+ 5 - 1
src/main/resources/mappings/modules/product/ProductNewMapper.xml

@@ -140,7 +140,11 @@
         SELECT
         <include refid="productColumns"/>
         FROM product a
-        <include refid="productJoins"/>
+        LEFT JOIN shop s ON s.shopID = a.shopID
+        LEFT JOIN cm_second_hand_detail cshd ON cshd.productID = a.productID
+        LEFT JOIN cm_brand cb ON a.brandID = cb.id
+        LEFT JOIN cm_svip_product csp on a.productID = csp.productId
+        left join (select * from cm_organize_product_info ) copi on copi.productId = a.productID
         <where>
               copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=a.productID)
             <if test="id !=null and id !=''">

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

@@ -64,7 +64,7 @@
 			IFNULL(c.registerUserTypeID,3) As "type",
 			b.name AS "productName",
 		  	cs.unit,
-            CASE   cs.costCheckFlag
+            CASE   (SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cs.productId AND organizeId = cs.organizeId )
             WHEN  1 THEN cs.`costPrice`
             WHEN  2 THEN cs.`shopPercent` * cs.`price` / 100
             END   AS "costPrice"

+ 1 - 1
src/main/resources/mappings/modules/weisha/CmOrganizeProductMapper.xml

@@ -80,7 +80,7 @@
         cmps.price,
         cmps.stock,
         cmps.unit,
-        "2" as costCheckFlag,
+        (SELECT costCheckFlag FROM cm_organize_product_info WHERE productId = cmps.productId AND organizeId = cmps.organizeId ) AS costCheckFlag,
         cmps.organizePercent,
         cmps.shopPercent,
         cmps.cmPercent

+ 256 - 95
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -314,6 +314,7 @@
            method="post" class="form-horizontal">
     <form:hidden path="id"/>
     <form:hidden path="searchName"/>
+    <form:hidden path="shopID" id="shopId" />
     <sys:message content="${message}"/>
     <table border="0" cellspacing="0" cellpadding="0" width="100%">
         <tr>
@@ -609,6 +610,7 @@
         </tr>
         <tr>
             <th><span class="red">*</span>上架平台:</th>
+
             <td>
                 <input id="caimei" type="checkbox" name="groundMall" value="0" >【采美】平台
                 <input id="bcc" type="checkbox" name="groundMall" value="4" >【丽格集采联盟】平台
@@ -618,6 +620,14 @@
             <th><span class="red">*</span>SKU种类:<br><span class="red">【采美】平台</span></th>
             <td>
                 <div><span><button class="addSku" onclick="return false">添加SKU</button></span></div>
+                <div class="sku-item sku-costCheckFlag" style="margin-top: 15px;">
+                    <span class="red">*</span>成本类型:
+                    <label><input type="radio" name="costCheckFlag" class="costCheckFlag" value="1"
+                        ${empty product.costCheckFlag || product.costCheckFlag == 1 ? "checked" : ""} />固定成本</label>
+                    <b class="line">|</b>
+                    <label><input type="radio" name="costCheckFlag" class="costCheckFlag" value="2"
+                        ${empty product.costCheckFlag || product.costCheckFlag == 2 ? "checked" : ""} />比例成本</label>
+                </div>
                     <%-- 插入html --%>
                 <div id="skus"></div>
             </td>
@@ -626,6 +636,14 @@
             <th><span class="red">*</span>SKU种类:<br><span class="red">【丽格集采联盟】平台</span></th>
             <td>
                 <div><span><button class="addMallSku" onclick="return false">添加SKU</button></span></div>
+                <div class="sku-item sku-costCheckFlag" style="margin-top: 15px;">
+                    <span class="red">*</span>成本类型:
+                    <label><input type="radio" name="mallCostCheckFlag" class="mallCostCheckFlag" value="1"
+                        ${empty product.mallCostCheckFlag || product.mallCostCheckFlag == 1 ? "checked" : ""} />固定成本</label>
+                    <b class="line">|</b>
+                    <label><input type="radio" name="mallCostCheckFlag" class="mallCostCheckFlag" value="2"
+                        ${empty product.mallCostCheckFlag || product.mallCostCheckFlag == 2 ? "checked" : ""} />比例成本</label>
+                </div>
                     <%-- 插入html --%>
                 <div id="mallSkus"></div>
             </td>
@@ -895,24 +913,24 @@
             </div>
         </div>
         <div class="sku-item-li">
-            <div class="sku-item sku-costCheckFlag">
-                <span class="red">*</span>成本类型:
-                <label><input type="radio" name="costCheckFlag" value="1" checked/>固定成本</label>
-                <b class="line">|</b>
-                <label><input type="radio" name="costCheckFlag" value="2"/>比例成本</label>
-            </div>
+<%--            <div class="sku-item sku-costCheckFlag">--%>
+<%--                <span class="red">*</span>成本类型:--%>
+<%--                <label><input type="radio" name="costCheckFlag" value="1" checked/>固定成本</label>--%>
+<%--                <b class="line">|</b>--%>
+<%--                <label><input type="radio" name="costCheckFlag" value="2"/>比例成本</label>--%>
+<%--            </div>--%>
             <div class="sku-item sku-costPrice">
                 <span class="red">*</span>
                 <span class="costFlagText">成本价</span>:
-                供应商:<input style="width: 60px" name="costPrice" type="number" maxlength="11" class="short"/>
-                集团:<input style="width: 60px" name="OrganizeCostPrice" type="number" maxlength="11" class="short"/>
-                采美:<input style="width: 60px" name="cmCostPrice" type="number" maxlength="11" class="short"/>
+                供应商:<input style="width: 60px" name="costPrice" type="number" maxlength="11" class="short costPrice"/>
+                集团:<input style="width: 60px" name="organizeCostPrice" type="number" maxlength="11" class="short organizeCostPrice"/>
+                采美:<input style="width: 60px" name="cmCostPrice" type="number" maxlength="11" class="short cmCostPrice"/>
             </div>
             <div class="sku-item sku-shopPercent" style="display: none;">
                 <span class="red">*</span>佣金比例:
-                供应商:<input style="width: 50px" name="shopPercent" type="number" maxlength="11" class="short"/>%
-                集团:<input style="width: 50px" name="organizePercent" type="number" maxlength="11" class="short"/>%
-                采美:<input style="width: 50px" name="cmPercent" type="number" maxlength="11" class="short"/>%
+                供应商:<input style="width: 50px" name="shopPercent" type="number" maxlength="11" class="short shopPercent"/>%
+                集团:<input style="width: 50px" name="organizePercent" type="number" maxlength="11" class="short organizePercent"/>%
+                采美:<input style="width: 50px" name="cmPercent" type="number" maxlength="11" class="short cmPercent"/>%
             </div>
         </div>
         <div class="sku-item-li sku-item-delete">
@@ -1056,7 +1074,83 @@
             $("#commodityDetailsFlag").prop("disabled", false);
         }
     }
+    $('.costCheckFlag').on('change', function () {
+        var skus = $("#skus")
+        if ($(this).val() == 1) {
+            skus.each(function() {
+                skus.find('.sku-shopPercent').hide();
+                skus.find('.sku-costPrice').show();
+            })
+            //shopPercent.parent('.sku-shopPercent').hide();
+            //costPrice.parent('.sku-costPrice').show();
+        } else {
+            skus.each(function() {
+                skus.find('.sku-shopPercent').show();
+                skus.find('.sku-costPrice').hide();
+            })
+            // shopPercent.parent('.sku-shopPercent').show();
+            // costPrice.parent('.sku-costPrice').hide();
+        }
+    })
+    $('.mallCostCheckFlag').on('change', function () {
+        console.log('333333')
+        var mallSkus = $("#mallSkus")
+        if ($(this).val() == 1) {
+            mallSkus.each(function() {
+                mallSkus.find('.sku-shopPercent').hide(); // shopPercent.parent('.sku-shopPercent').hide();
+                mallSkus.find('.sku-costPrice').show();
+            })
+        } else {
+            mallSkus.each(function() {
+                mallSkus.find('.sku-shopPercent').show(); // shopPercent.parent('.sku-shopPercent').hide();
+                mallSkus.find('.sku-costPrice').hide();
+            })
+            // shopPercent.parent('.sku-shopPercent').show();
+            // costPrice.parent('.sku-costPrice').hide();
+        }
+    })
 
+    //富文本框编辑
+    function checkInfo() {
+        // debugger
+
+        var productType = $("#productType").val();
+        var qualificationNo = $('#qualificationNo').val()
+        var productName = $("#productName").val();
+        var qualificationTime = $('#qualificationTime').val()
+        var qualificationLink = $("#qualificationLink").val();
+        if (productType == "2") {
+
+            if (qualificationNo == null || qualificationNo == "") {
+                alertx("请输入证书编号");
+                return false;
+            }
+            if (productName == null || productName == "") {
+                alertx("请输入产品名称");
+                return false;
+            }
+            if (qualificationTime == null || qualificationTime == "") {
+                alertx("请输入证书有效时间");
+                return false;
+            }
+            if (qualificationLink == null || qualificationLink == "") {
+                alertx("请输入证书有效链接");
+                return false;
+            }
+        }
+
+        var detailInfo = detailInfoEditor.getData();
+        $("#detailInfo").val(detailInfo);
+        var commonDetailInfo = detailInfoEditor2.getData();
+        $("#commonDetailInfo").val(commonDetailInfo);
+        console.log(detailInfo);
+        var orderInfo = orderInfoEditor.getData();
+        $("#orderInfo").val(orderInfo);
+        console.log(orderInfo);
+        var serviceInfo = serviceInfoEditor.getData();
+        $("#serviceInfo").val(serviceInfo);
+        console.log(serviceInfo);
+    }
 
     $(document).ready(function () {
 
@@ -1067,45 +1161,150 @@
         $("#inputForm").validate({
             ignore: "",
             submitHandler: function (form) {
+                var flag = true;
+                var shopId = $("#shopId").val()*1;
                 var commodityType = $("input[name='commodityType']:checked").val();
                 if (commodityType == '' || commodityType == null) {
                     alertx("请选择商品属性");
-                    return false;
+                    flag = false;
+                }
+                var groundMall = $("input[name='groundMall']:checked").val();
+                if (groundMall.length < 1) {
+                    alertx("请选中上架平台");
+                    flag = false;
                 }
                 var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
-                if (costCheckFlag * 1 === 1) {
-                    if ($("#costPrice").val() == '') {
-                        alertx("请输入成本价");
-                        return false;
+                var skus = $("#skus .sku")
+                skus.each(function() {
+                    var cost = $(this)
+                    if (costCheckFlag * 1 === 1) {
+                        var costPrice = cost.find(".costPrice").val()
+                        var organizeCostPrice = cost.find(".organizeCostPrice").val()
+                        var cmCostPrice = cost.find(".cmCostPrice").val()
+                        var price = cost.find(".computedPrice").val()*1
+                        if (costPrice == '') {
+                            alertx("请输入供应商成本价");
+                            flag = false;
+                        }
+                        if (organizeCostPrice == '') {
+                            alertx("请输入集团成本价");
+                            flag = false;
+                        }
+                        if (cmCostPrice == '') {
+                            alertx("请输入采美成本价");
+                            flag = false;
+                        }
+                        const num = costPrice*1 + organizeCostPrice*1 + cmCostPrice*1
+                        debugger
+                        if (shopId != 11070 ) {
+                            if (num != price) {
+                                alertx("采美国定成本和需为机构价")
+                                flag = false;
+                            }
+                        }else {
+                            if (num > price) {
+                                alertx("采美国定成本和不能大于机构价")
+                                flag = false;
+                            }
+                        }
+                    } else {
+                        var shopPercent = cost.find(".shopPercent").val()
+                        var organizePercent = cost.find(".organizePercent").val()
+                        var cmPercent = cost.find(".cmPercent").val()
+                        if (shopPercent == '') {
+                            alertx("请输入成本比例");
+                            flag = false;
+                        }
+                        if (organizePercent == '') {
+                            alertx("请输入集团比例");
+                            flag = false;
+                        }
+                        if (cmPercent == '') {
+                            alertx("请输入供应商比例");
+                            flag = false;
+                        }
+                        const num = shopPercent*1 + organizePercent*1 + cmPercent*1
+                        if (shopId != 11070 ) {
+                            if (num != 100) {
+                                alertx("采美佣金比例和需为100")
+                                flag = false;
+                            }
+                        }else {
+                            if (num > 100) {
+                                alertx("采美佣金比例和不能大于100")
+                                flag = false;
+                            }
+                        }
                     }
-                    ;
-                } else {
-                    var shopPercent = $("#shopPercent").val()
-                    var organizePercent = $("#organizePercent").val()
-                    var cmPercent = $("#cmPercent").val()
-                    if ($("#shopPercent").val() == '') {
-                        alertx("请输入成本比例");
-                        return false;
-                    };
-                    if ($("#organizePercent").val() == '') {
-                        alertx("请输入集团比例");
-                        return false;
-                    };
-                    if ($("#cmPercent").val() == '') {
-                        alertx("请输入供应商比例");
-                        return false;
-                    };
-                    /*const num = shopPercent*1 + organizePercent*1 + cmPercent*1
-                    if (num != 100) {
-                        alertx("佣金比例和需为100")
-                        return false;
-                    }*/
-                }
+                })
+                var mallCostCheckFlag = $("input[name='mallCostCheckFlag']:checked").val();
+                var mallSkus = $("#mallSkus")
+                mallSkus.each(function() {
+                    var mallCost = $(this)
+                    if (mallCostCheckFlag * 1 === 1) {
+                        var mallCostPrice = mallCost.find(".costPrice").val()
+                        var mallOrganizeCostPrice = mallCost.find(".organizeCostPrice").val()
+                        var mallCmCostPrice = mallCost.find(".cmCostPrice").val()
+                        var mallprice = mallCost.find(".computedPrice").val()*1
+                        if (mallCostPrice == '') {
+                            alertx("请输入供应商成本价");
+                            flag = false;
+                        }
+                        if (mallOrganizeCostPrice == '') {
+                            alertx("请输入集团成本价");
+                            flag = false;
+                        }
+                        if (mallCmCostPrice == '') {
+                            alertx("请输入采美成本价");
+                            flag = false;
+                        }
+                        const num = mallCostPrice*1 + mallOrganizeCostPrice*1 + mallCmCostPrice*1
+                        if (shopId != 11070 ) {
+                            if (num != mallprice) {
+                                alertx("丽格国定成本和需为机构价");
+                                flag = false;
+                            }
+                        } else {
+                            if (num > mallprice) {
+                                alertx("丽格国定成本和不能大于机构价")
+                                flag = false;
+                            }
+                        }
+                    } else {
+                        var mallShopPercent = mallCost.find(".shopPercent").val()
+                        var mallOrganizePercent = mallCost.find(".organizePercent").val()
+                        var mallCmPercent = mallCost.find(".cmPercent").val()
+                        if (mallShopPercent == '') {
+                            alertx("请输入成本比例");
+                            flag = false;
+                        }
+                        if (mallOrganizePercent == '') {
+                            alertx("请输入集团比例");
+                            flag = false;
+                        }
+                        if (mallCmPercent == '') {
+                            alertx("请输入供应商比例");
+                            flag = false;
+                        }
+                        const num = mallShopPercent*1 + mallOrganizePercent*1 + cmPercent*1
+                        if (shopId != 11070 ) {
+                            if (num != 100) {
+                                alertx("丽格佣金比例和需为100");
+                                flag = false;
+                            }
+                        } else {
+                            if (num > 100) {
+                                alertx("丽格佣金比例和不能大于100")
+                                flag = false;
+                            }
+                        }
+                    }
+                })
                 if ($('#minBuyNumber:visible').length > 0) {
                     var minBuyNumber = $('#minBuyNumber').val();
                     if (minBuyNumber <= 0 || minBuyNumber == '') {
                         alertx("请输入起订量");
-                        return false;
+                        flag = false;
                     }
                 }
                 if ($('input[name="ladderPriceList[0].buyNum"]:visible').length > 0) {
@@ -1113,7 +1312,7 @@
                     var buyPrice = $('input[name="ladderPriceList[0].buyPrice"]').val();
                     if (buyNum <= 0 || buyNum == '' || buyPrice <= 0 || buyPrice == '') {
                         alertx("请输入正确的阶梯价格");
-                        return false;
+                        flag = false;
                     }
                 }
                 if ($('input[name="ladderPriceList[1].buyNum"]:visible').length > 0) {
@@ -1121,7 +1320,7 @@
                     var buyPrice1 = $('input[name="ladderPriceList[1].buyPrice"]').val();
                     if (buyNum1 <= 0 || buyNum1 == '' || buyPrice1 <= 0 || buyPrice1 == '') {
                         alertx("请输入正确的阶梯价格");
-                        return false;
+                        flag = false;
                     }
                 }
                 if ($('input[name="ladderPriceList[2].buyNum"]:visible').length > 0) {
@@ -1129,18 +1328,18 @@
                     var buyPrice2 = $('input[name="ladderPriceList[2].buyPrice"]').val();
                     if (buyNum2 <= 0 || buyNum2 == '' || buyPrice2 <= 0 || buyPrice2 == '') {
                         alertx("请输入正确的阶梯价格");
-                        return false;
+                        flag = false;
                     }
                 }
                 var detailInfo = detailInfoEditor.getData();
                 if (detailInfo == '') {
                     alertx("请输入商品详细信息");
-                    return false;
+                    flag = false;
                 }
                 var includedTax = $("input[name='includedTax']:checked").val();
                 if (includedTax == '' || includedTax == null) {
                     alertx("请选择是否含税");
-                    return false;
+                    flag = false;
                 }
                 var invoiceType = $("input[name='invoiceType']:checked").val();
                 if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
@@ -1148,11 +1347,11 @@
                     var supplierTaxPoint = $("#supplierTaxPoint").val();
                     if (taxPoint == '' || taxPoint == null) {
                         alertx("请输入机构税率");
-                        return false;
+                        flag = false;
                     }
                     if (supplierTaxPoint == '' || supplierTaxPoint == null) {
                         alertx("请输入供应商税率");
-                        return false;
+                        flag = false;
                     }
                 }
                 if (includedTax != ${product.includedTax} || invoiceType != ${product.invoiceType}) {
@@ -1165,8 +1364,10 @@
                                 $("#groundSkuBcc").remove()
                             }
                             // 提交订单
-                            loading('正在提交,请稍等...');
-                            form.submit();
+                            if (flag) {
+                                loading('正在提交,请稍等...');
+                                form.submit();
+                            }
                         }
                     }, {
                         buttonsFocus: 1, closed: function () {
@@ -1182,8 +1383,10 @@
                     if(!$('#bcc').prop('checked')){
                         $("#groundSkuBcc").remove()
                     }
-                    loading('正在提交,请稍等...');
-                    form.submit();
+                    if (flag) {
+                        loading('正在提交,请稍等...');
+                        form.submit();
+                    }
                 }
             },
             errorContainer: "#messageBox",
@@ -1535,48 +1738,6 @@
         });
     });
 
-    //富文本框编辑
-    function checkInfo() {
-        // debugger
-
-        var productType = $("#productType").val();
-        var qualificationNo = $('#qualificationNo').val()
-        var productName = $("#productName").val();
-        var qualificationTime = $('#qualificationTime').val()
-        var qualificationLink = $("#qualificationLink").val();
-        if (productType == "2") {
-
-            if (qualificationNo == null || qualificationNo == "") {
-                alertx("请输入证书编号");
-                return false;
-            }
-            if (productName == null || productName == "") {
-                alertx("请输入产品名称");
-                return false;
-            }
-            if (qualificationTime == null || qualificationTime == "") {
-                alertx("请输入证书有效时间");
-                return false;
-            }
-            if (qualificationLink == null || qualificationLink == "") {
-                alertx("请输入证书有效链接");
-                return false;
-            }
-        }
-
-        var detailInfo = detailInfoEditor.getData();
-        $("#detailInfo").val(detailInfo);
-        var commonDetailInfo = detailInfoEditor2.getData();
-        $("#commonDetailInfo").val(commonDetailInfo);
-        console.log(detailInfo);
-        var orderInfo = orderInfoEditor.getData();
-        $("#orderInfo").val(orderInfo);
-        console.log(orderInfo);
-        var serviceInfo = serviceInfoEditor.getData();
-        $("#serviceInfo").val(serviceInfo);
-        console.log(serviceInfo);
-    }
-
 
     // $("#ladderPrice1").on("click", ".addBtn", function () {
     //     $("#ladderPrice2").removeClass("hide");
@@ -2197,7 +2358,7 @@
         // if (organize != 0) {
         //     ladderPriceFlag.parent().parent().hide();
         // }
-        // costCheckFlag.parent().parent().hide();
+        costCheckFlag.parent().parent().hide();
 
         ladderPriceBox.find('.ladderPrice').each(function (index, item) {
             var ladderPrice = {}