Pārlūkot izejas kodu

特殊供应商新品添加

zhijiezhao 3 gadi atpakaļ
vecāks
revīzija
17cfff6c44

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

@@ -3,6 +3,7 @@ package com.caimei.modules.product.dao;
 import com.caimei.modules.brand.entity.BrandAndProductType;
 import com.caimei.modules.product.entity.*;
 import com.caimei.po.ProductLadderPrice;
+import com.caimei.po.Shop;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
@@ -179,4 +180,5 @@ public interface ProductDao extends CrudDao<Product> {
 
     List<Integer> getProductIdByBrandId(String brandId);
 
+    List<Shop> findSepcialShopList();
 }

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

@@ -129,6 +129,11 @@ public class Product extends DataEntity<Product> {
     private Integer svipFlag;	//超级会员商品标识:1是,2不是
     private Integer publishIdentity; //发布者身份 1,个人,2.公司
     private String companyName; //公司名称
+    private String image1;
+    private String image2;
+    private String image3;
+    private String image4;
+    private String image5;
 
     //以下参数是搜索回显参数
     private String searchName;
@@ -222,6 +227,46 @@ public class Product extends DataEntity<Product> {
         this.companyName = companyName;
     }
 
+    public String getImage1() {
+        return image1;
+    }
+
+    public void setImage1(String image1) {
+        this.image1 = image1;
+    }
+
+    public String getImage2() {
+        return image2;
+    }
+
+    public void setImage2(String image2) {
+        this.image2 = image2;
+    }
+
+    public String getImage3() {
+        return image3;
+    }
+
+    public void setImage3(String image3) {
+        this.image3 = image3;
+    }
+
+    public String getImage4() {
+        return image4;
+    }
+
+    public void setImage4(String image4) {
+        this.image4 = image4;
+    }
+
+    public String getImage5() {
+        return image5;
+    }
+
+    public void setImage5(String image5) {
+        this.image5 = image5;
+    }
+
     public String getSplitCode() {
         return splitCode;
     }

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

@@ -11,6 +11,7 @@ import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.po.ProductLadderPrice;
+import com.caimei.po.Shop;
 import com.caimei.utils.AppUtils;
 import com.caimei.vo.JsonModel;
 import com.thinkgem.jeesite.common.config.Global;
@@ -468,4 +469,8 @@ public class ProductService extends CrudService<ProductDao, Product> {
     public String findProductDescribe(Integer productID) {
         return productDao.findProductDescribe(productID);
     }
+
+    public List<Shop> findSepcialShopList() {
+        return productDao.findSepcialShopList();
+    }
 }

+ 137 - 2
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -1,26 +1,31 @@
 package com.caimei.modules.product.web;
 
+import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.modules.brand.service.CmBrandService;
 import com.caimei.modules.common.entity.Province;
 import com.caimei.modules.common.service.AreaService;
+import com.caimei.modules.common.utils.UploadUtils;
 import com.caimei.modules.opensearch.CoreServiceUitls;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.modules.product.dao.ProductNewDao;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.product.service.*;
+import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.user.entity.CmPageModules;
 import com.caimei.modules.user.entity.CmUserOrganize;
 import com.caimei.modules.user.entity.SplitCode;
 import com.caimei.modules.user.service.CmUserOrganizeService;
 import com.caimei.po.ProductImage;
 import com.caimei.po.ProductLadderPrice;
+import com.caimei.po.Shop;
 import com.caimei.redis.RedisService;
 import com.caimei.utils.AppUtils;
 import com.caimei.vo.JsonModel;
 import com.google.common.collect.Maps;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.Encodes;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.common.web.BaseController;
 import org.apache.commons.collections.CollectionUtils;
@@ -243,6 +248,42 @@ public class ProductNewController extends BaseController {
         }
     }
 
+    @RequestMapping(value = "productAdd")
+    public String addProduct(Product product, Model model) {
+        List<CmBrand> brandList = productService.findBrandList();
+        List<Shop> shopList = productService.findSepcialShopList();
+        //解析商品搜索关键字(搜索关键词目前最多只能5个)
+        String searchKey = product.getSearchKey();
+        List<String> searchKeyList = new ArrayList<String>(5);
+        searchKeyList.add("");
+        searchKeyList.add("");
+        searchKeyList.add("");
+        searchKeyList.add("");
+        searchKeyList.add("");
+        if (StringUtils.isNotEmpty(searchKey)) {
+            boolean contains = searchKey.contains("##");
+            boolean contains1 = searchKey.contains(",");
+            if (contains) {
+                String[] split = searchKey.split("##");
+                for (int i = 0; (i < split.length && i < 5); i++) {
+                    searchKeyList.set(i, split[i]);
+                }
+            } else if (contains1) {
+                String[] split = searchKey.split(",");
+                for (int i = 0; (i < split.length && i < 5); i++) {
+                    searchKeyList.set(i, split[i]);
+                }
+            } else {
+                searchKeyList.set(0, searchKey);
+            }
+        }
+        product.setSearchKeyList(searchKeyList);
+        model.addAttribute("brandList", brandList);
+        model.addAttribute("shopList", shopList);
+        model.addAttribute("product", product);
+        return "modules/product-new/cmNewProductForm";
+    }
+
     @RequiresPermissions("product:product:view")
     @RequestMapping(value = "productEdit")
     public String editProduct(Product product, Model model) {
@@ -299,8 +340,8 @@ public class ProductNewController extends BaseController {
         if (product.getSupplierTaxPoint() == null) {
             product.setSupplierTaxPoint(product.getTaxPoint());
         }
-        List<SplitCode> splitCodeList = productNewDao.findSplitCode(product.getShopID());
-        model.addAttribute("splitCodeList",splitCodeList);
+//        List<SplitCode> splitCodeList = productNewDao.findSplitCode(product.getShopID());
+//        model.addAttribute("splitCodeList",splitCodeList);
         model.addAttribute("combinationList", combinationList);
         model.addAttribute("brandList", brandList);
         model.addAttribute("classify", classify);
@@ -309,6 +350,64 @@ public class ProductNewController extends BaseController {
         return "modules/product-new/productEdit";
     }
 
+    @RequestMapping(value = "productNewSave")
+    public String productNewSave(Product product, RedirectAttributes redirectAttributes){
+        // 组合搜索关键词
+        List<String> searchKeyList = product.getSearchKeyList();
+        String searchKeyStr = "";
+        for (int j = 0; j < searchKeyList.size(); j++) {
+            searchKeyStr += searchKeyList.get(j);
+            if (j != 5) {
+                searchKeyStr += "##";
+            }
+        }
+        product.setSearchKey(searchKeyStr);
+        productService.save(product);
+
+        // 保存商品图片
+        String image1=product.getImage1();
+        if (StringUtils.isNotEmpty(image1)) {
+            String imageUrl = getImageUrl(image1);
+            addProductImage(imageUrl, "1", Integer.valueOf(product.getId()),product.getShopID());
+        }
+        String image2 = product.getImage2();
+        if (StringUtils.isNotEmpty(image2)) {
+            String imageUrl = getImageUrl(image2);
+            addProductImage(imageUrl, "0", Integer.valueOf(product.getId()),product.getShopID());
+        }
+        String image3 = product.getImage3();
+        if (StringUtils.isNotEmpty(image3)) {
+            String imageUrl = getImageUrl(image3);
+            addProductImage(imageUrl, "0", Integer.valueOf(product.getId()),product.getShopID());
+        }
+        String image4 = product.getImage4();
+        if (StringUtils.isNotEmpty(image4)) {
+            String imageUrl = getImageUrl(image4);
+            addProductImage(imageUrl, "0", Integer.valueOf(product.getId()),product.getShopID());
+        }
+        String image5 = product.getImage5();
+        if (StringUtils.isNotEmpty(image5)) {
+            String imageUrl = getImageUrl(image5);
+            addProductImage(imageUrl, "0", Integer.valueOf(product.getId()),product.getShopID());
+        }
+        // 保存商品相关参数
+        List<ProductParameters> productParametersList = product.getProductParametersList();
+        if (CollectionUtils.isNotEmpty(productParametersList) && productParametersList.size() > 0) {
+            for (ProductParameters p : productParametersList) {
+                if (null != p && StringUtils.isNotEmpty(p.getParamsName()) && StringUtils.isNotEmpty(p.getParamsContent())) {
+                    p.setProductId(product.getProductID());
+                    p.setDelFlag("0");
+                    productNewService.insertParameters(p);
+                }
+            }
+        }
+        // 有数据变动时需要清除缓存
+        cleanRedisCache();
+        // 更新索引
+        coreServiceUitls.updateProductIndex(product.getProductID());
+        return "redirect:" + Global.getAdminPath() + "/product/new/list/";
+    }
+
     @RequiresPermissions("product:product:edit")
     @RequestMapping(value = "productSave")
     public String productSave(Product product, ProductDetailInfo productDetailInfo, RedirectAttributes redirectAttributes) {
@@ -361,6 +460,42 @@ public class ProductNewController extends BaseController {
         return "redirect:" + Global.getAdminPath() + "/product/new/list/";
     }
 
+    public void addProductImage(String image, String mainFlag, Integer productID,Integer shopID) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String dateStr = simpleDateFormat.format(new Date());
+        ProductImage productimage = new ProductImage();
+        productimage.setImage(image);
+        productimage.setProductID(productID);
+        productimage.setShopID(shopID);
+        productimage.setAddTime(dateStr);
+        productimage.setMainFlag(mainFlag);
+        productimage.setSortIndex(null);
+        productNewDao.insertProductImage(productimage);
+    }
+
+    /**
+     * 获取商品图片服务器全路径
+     *
+     * @param imageUrl
+     * @return
+     */
+    public String getImageUrl(String imageUrl) {
+        String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
+        ImageUploadInfo saveImageSerivce = new ImageUploadInfo();
+        if (StringUtils.isNotBlank(imageUrl) && !imageUrl.startsWith("http:") && !imageUrl.startsWith("https:")) {
+            imageUrl = Encodes.urlDecode(imageUrl);
+            String realPath = UploadImageUtils.getAbsolutePath(imageUrl);
+            int pointerIndex = realPath.lastIndexOf(".");
+            try {
+                saveImageSerivce = UploadUtils.saveImageSerivce(realPath, pointerIndex, realPath);
+                imageUrl = photoServer + saveImageSerivce.getSource();
+            } catch (Exception e) {
+                logger.error("图片上传错误:" + e.toString(), e);
+            }
+        }
+        return imageUrl;
+    }
+
     @ResponseBody
     @RequestMapping(value = {"/addPreferred"})
     public Map<String, Object> addPreferred(Integer productId, Integer preferredFlag) {

+ 10 - 10
src/main/resources/config/dev/caimei.properties

@@ -12,12 +12,12 @@
 #mysql database setting
 jdbc.type=mysql
 jdbc.driver=com.mysql.cj.jdbc.Driver
-#jdbc.url=jdbc:mysql://192.168.2.100:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
-#jdbc.username=developer
-#jdbc.password=05bZ/OxTB:X+yd%1
-jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+jdbc.url=jdbc:mysql://192.168.2.100:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
 jdbc.username=developer
-jdbc.password=J5p3tgOVazNl4ydf
+jdbc.password=05bZ/OxTB:X+yd%1
+#jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+#jdbc.username=developer
+#jdbc.password=J5p3tgOVazNl4ydf
 
 #jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
 #jdbc.username=developer
@@ -44,12 +44,12 @@ jdbc.testSql=SELECT 'x' FROM DUAL
 
 #redis settings
 redis.keyPrefix=caimei-manager
-#redis.host=192.168.2.100
-#redis.port=6379
-#redis.pass=123456
-redis.host=47.119.112.46
+redis.host=192.168.2.100
 redis.port=6379
-redis.pass=6#xsI%b4o@5c3RoE
+redis.pass=123456
+#redis.host=47.119.112.46
+#redis.port=6379
+#redis.pass=6#xsI%b4o@5c3RoE
 
 redis.timeout=100000
 #\u6700\u5927\u8FDE\u63A5\u6570

+ 3 - 0
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -1846,4 +1846,7 @@
 	<select id="findProductDescribe" resultType="java.lang.String">
 		select productDescribe from product where productID = #{productID}
 	</select>
+	<select id="findSepcialShopList" resultType="com.caimei.po.Shop">
+		select name,shopId from shop where shopType=2
+	</select>
 </mapper>

+ 1 - 0
src/main/resources/mappings/modules/user/NewCmShopMapper.xml

@@ -58,6 +58,7 @@
 		u.email,
 		u.source AS "source",
 		a.shopType AS "shopType",
+		a.cardNumber AS "cardNumber",
 		d.name AS "province",c.name AS "city",b.name AS "town"
 	</sql>
 

+ 148 - 512
src/main/webapp/WEB-INF/views/modules/product-new/cmNewProductForm.jsp

@@ -11,101 +11,6 @@
             //$("#name").focus();订单来源
             $("#inputForm").validate({
                 submitHandler: function (form) {
-                    var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
-                    var find = $("input[name='ids']:checked").val();
-                    if (!find >= 1) {
-                        alertx("请选择商品包含的文件!");
-                        return false;
-                    }
-                    var publishIdentity = $("input[name='publishIdentity']:checked").val();
-                    console.log(publishIdentity);
-                    if (!publishIdentity > 0) {
-                        alertx("请选择用户身份");
-                        return false;
-                    }
-                    if (publishIdentity * 1 === 2) {
-                        if ($("#companyName").val() == '') {
-                            alertx("公司名称不能为空!");
-                            return false;
-                        }
-                    }
-                    if (costCheckFlag * 1 === 1) {
-                        if ($("#costPrice").val() == '') {
-                            alertx("请输入成本价");
-                            return false;
-                        }
-                        var costPrice = $("#costPrice").val();
-                        if (0 == costPrice) {
-                            alertx('成本价不能为0');
-                            return false;
-                        }
-                    } else {
-                        if ($("#costProportional").val() == '') {
-                            alertx("请输入成本比例");
-                            return false;
-                        }
-                    }
-
-                    // 验证填写参数
-                    var payStatus = $('#payStatus').val();
-                    if (payStatus == 2) {
-                        var payAmount = $("#payAmount").val();
-                        // (验证付款金额)
-                        if (payAmount == "" || payAmount == null) {
-                            alertx('请填写付款金额');
-                            return false;
-                        }
-                        if (0 == payAmount) {
-                            alertx('付款金额不能为0');
-                            return false;
-                        }
-                    }
-
-                    var price = $("#price").val();
-                    if (0 == price) {
-                        alertx('交易价不能为0');
-                        return false;
-                    }
-
-                    var secondHandType = $("input[name ='secondHandType']:checked").val();
-                    if (secondHandType == 2) {
-                        var maturityYears = $("#maturityYears").val();
-                        // (验证到期时期)
-                        if (maturityYears == null || maturityYears == "") {
-                            alertx('请输入产品到期日');
-                            return false;
-                        }
-                        //(验证临期价格信息)
-                        var normalPrice = $("#normalPrice").val();
-                        if (null == normalPrice || normalPrice == "") {
-                            alertx('请输入市场价');
-                            return false;
-                        }
-                        if (0 == normalPrice) {
-                            alertx('市场价不能为0');
-                            return false;
-                        }
-                        //
-                        var originalPrice = $("#originalPrice").val();
-                        if (null == originalPrice || originalPrice == "") {
-                            alertx('请输入采购价/原价');
-                            return false;
-                        }
-                        if (0 == originalPrice) {
-                            alertx('采购价/原价不能为0');
-                            return false;
-                        }
-
-                        var stock = $("#stock").val();
-                        if (null == stock || stock == "") {
-                            alertx('请输入数量');
-                            return false;
-                        }
-                    }
-                    //获取选中townID给Form标签
-                    var townId = $("#town option:selected").attr("townId");
-                    $("#townId").val(townId);
-
                     var peopleMobile = $("#dockingPeopleMobile").val();
                     if (peopleMobile != '' && peopleMobile != undefined) {
                         var reg = new RegExp('^1[0-9]{10}$');
@@ -300,45 +205,37 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/product/new/list?searchProductCategory=2">二手商品列表</a></li>
-    <li class="active"><a
-            href="${ctx}/product/cmSecondHandDetail/form?id=${cmSecondHandDetail.id}">二手商品<shiro:hasPermission
-            name="product:cmSecondHandDetail:edit">${not empty cmSecondHandDetail.id?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission
-            name="product:cmSecondHandDetail:edit">查看</shiro:lacksPermission></a></li>
+    <li><a href="${ctx}/product/new/list?searchProductCategory=1">商品列表</a></li>
+    <li class="active"><a href="${ctx}/product/new/productAdd">添加新品</a></li>
 </ul>
 <br/>
-<form:form id="inputForm" modelAttribute="cmSecondHandDetail"
-           action="${ctx}/product/cmSecondHandDetail/save?searchName=${cmSecondHandDetail.searchName}&searchShopID=${cmSecondHandDetail.searchShopID}&searchShopName=${cmSecondHandDetail.searchShopName}&searchBigTypeID=${cmSecondHandDetail.searchBigTypeID}&searchSmallTypeID=${cmSecondHandDetail.searchSmallTypeID}&searchTinyTypeID=${cmSecondHandDetail.searchTinyTypeID}&searchValidFlag=${cmSecondHandDetail.searchValidFlag}&searchActStatus=${cmSecondHandDetail.searchActStatus}&searchProductType=${cmSecondHandDetail.searchProductType}&searchBrandID=${cmSecondHandDetail.searchBrandID}&searchPreferredFlag=${cmSecondHandDetail.searchPreferredFlag}&searchProductCategory=${cmSecondHandDetail.searchProductCategory}&editFlag=${cmSecondHandDetail.editFlag}"
-           method="post" class="form-horizontal">
+<form:form id="inputForm" modelAttribute="product" action="${ctx}/product/new/productNewSave" method="post"
+           class="form-horizontal">
     <sys:message content="${message}"/>
-    <%--		新增加不需要显示--%>
-    <c:if test="${ not empty cmSecondHandDetail.id}">
-    <tr>
-        <th><span class="red">*</span>商品显示名:</th>
-        <td colspan="3">
+    <div class="ul-form">
+        <div style="margin-top: 15px">
+            <label class="control-label"><span style="color: red">*</span>商品显示名:</label>
             <form:input path="name" maxlength="100" onchange="checkmaxlength(this.value)"
                         class="input-small required"/>
-            <span>
+                <span>
                     <span style="font-weight: bold;">商品编码:</span>
                     <span><form:input path="productCode" maxlength="100"/></span>
                 </span>
-        </td>
-    </tr>
-    <tr>
-        <th><span class="red">*</span>内部商品名:</th>
-        <td colspan="3">
-            <form:input path="aliasName" maxlength="100" onchange="checkmaxlength(this.value)"
-                        class="input-small required"/>
-            <span>
+        </div>
+        <div style="margin-top: 15px">
+            <labeel class="control-label"><span style="color: red">*</span>内部商品名:</labeel>
+            <td colspan="3">
+                <form:input path="aliasName" maxlength="100" onchange="checkmaxlength(this.value)"
+                            class="input-small required"/>
+                <span>
                     <span style="font-weight: bold;">商品备注:</span>
                     <span><form:input path="productRemarks" maxlength="60" onchange="checkmaxlengths(this.value,60)"
                                       class="input-small"/></span>
                 </span>
-        </td>
-    </tr>
-    <tr>
-        <th>搜索关键字:</th>
-        <td colspan="3" class="skword">
+            </td>
+        </div>
+        <div style="margin-top: 15px">
+            <label class="control-label">搜索关键字:</label>
             <form:input path="searchKeyList[0]" maxlength="32" placeholder="建议输入品牌关键词"
                         onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
             <form:input path="searchKeyList[1]" maxlength="32" placeholder="建议输入商品学名关键词"
@@ -349,119 +246,147 @@
                         onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
             <form:input path="searchKeyList[4]" maxlength="32" placeholder="建议输入商品小分类关键词"
                         onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
-            <p>请务必准确定义关键词,关键词会影响商品的搜索结果,建议从品牌,商品学名,商品别名,商品大类别和商品小类别5个方面考虑,每个关键词不超过16个汉字。</p>
-        </td>
-    </tr>
-    <tr>
-        <th>相关参数:</th>
-        <td colspan="3" class="params">
-            <div id="addParamsItems">
-                    <%--相关参数层--%>
-                <input type="hidden" value="${fn:length(product.productParametersList)}"
-                       id="productParametersLength">
-                <c:forEach items="${product.productParametersList}" var="item" varStatus="varIndex">
-                    <div id="paramsItem" class="paramsItem">
-                        <form:input path="productParametersList[${varIndex.index}].paramsName" id="paramsName"
-                                    cssStyle="width:142px" maxlength="10" placeholder="参数名称" class="input-small"/>
-                        <form:input path="productParametersList[${varIndex.index}].paramsContent" id="paramsContent"
-                                    cssStyle="width:680px" maxlength="50" placeholder="请输入参数信息"
-                                    class="input-small"/>
-                        <span type="button" style="cursor: pointer;color: #0B61A4"
-                              onclick="deleteParams(this)">删除</span>
-                    </div>
-                </c:forEach>
-            </div>
-            <button class="addParams" onclick="return false">添加参数</button>
-        </td>
-    </tr>
-    <tr>
-        <th>品牌:</th>
-        <td colspan="3">
+            <p style="color: grey;margin-left: 100px">
+                请务必准确定义关键词,关键词会影响商品的搜索结果,建议从品牌,商品学名,商品别名,商品大类别和商品小类别5个方面考虑,每个关键词不超过16个汉字。</p>
+        </div>
+        <div>
+            <label style="margin-left: 100px">相关参数:</label>
+            <td colspan="3" class="params">
+                <div id="addParamsItems">
+                        <%--相关参数层--%>
+                    <input type="hidden" value="${fn:length(product.productParametersList)}"
+                           id="productParametersLength">
+                    <c:forEach items="${product.productParametersList}" var="item" varStatus="varIndex">
+                        <div id="paramsItem" class="paramsItem">
+                            <form:input path="productParametersList[${varIndex.index}].paramsName" id="paramsName"
+                                        cssStyle="width:142px" maxlength="10" placeholder="参数名称" class="input-small"/>
+                            <form:input path="productParametersList[${varIndex.index}].paramsContent" id="paramsContent"
+                                        cssStyle="width:680px" maxlength="50" placeholder="请输入参数信息"
+                                        class="input-small"/>
+                            <span type="button" style="cursor: pointer;color: #0B61A4"
+                                  onclick="deleteParams(this)">删除</span>
+                        </div>
+                    </c:forEach>
+                </div>
+                <button style="margin-left: 100px;margin-top: 10px" class="addParams" onclick="return false">添加参数
+                </button>
+            </td>
+        </div>
+        <div style="margin-top: 10px">
+            <label class="control-label">品牌:</label>
             <form:select path="brandID" class="input-small">
                 <form:option value="" label="请选择"/>
                 <form:options items="${brandList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
             </form:select>
-        </td>
-    </tr>
-    <div class="control-group">
-        <label class="control-label" style="margin-top: 17px">图片:</label>
-        <div class="controls upload-content" id="secondHandImage">
-            <div class="conList">
-                <form:hidden value="${cmSecondHandDetail.image1}" id="image1" path="image1" htmlEscape="false"
-                             maxlength="255" class="input-xlarge"/>
-                <sys:ckfinder input="image1" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
-                              maxHeight="100"/>
-            </div>
-            <div class="conList hide-pic">
-                <form:hidden value="${cmSecondHandDetail.image2}" id="image2" path="image2" htmlEscape="false"
-                             maxlength="255" class="input-xlarge"/>
-                <sys:ckfinder input="image2" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
-                              maxHeight="100"/>
-            </div>
-            <div class="conList hide-pic">
-                <form:hidden value="${cmSecondHandDetail.image3}" id="image3" path="image3" htmlEscape="false"
-                             maxlength="255" class="input-xlarge"/>
-                <sys:ckfinder input="image3" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
-                              maxHeight="100"/>
-            </div>
-            <div class="conList hide-pic">
-                <form:hidden value="${cmSecondHandDetail.image4}" id="image4" path="image4" htmlEscape="false"
-                             maxlength="255" class="input-xlarge"/>
-                <sys:ckfinder input="image4" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
-                              maxHeight="100"/>
+        </div>
+        <div style="margin-top: 10px">
+            <label class="control-label"><span style="color: red">*</span>供应商:</label>
+            <form:select path="shopID" class="input-small">
+                <form:option value="" label="请选择"/>
+                <form:options items="${shopList}" itemLabel="name" itemValue="shopID" htmlEscape="false"/>
+            </form:select>
+        </div>
+        <div class="control-group">
+            <label class="control-label" style="margin-top: 15px">商品图片:</label>
+            <div class="controls upload-content" id="secondHandImage">
+                <div class="conList">
+                    <form:hidden value="${product.image1}" id="image1" path="image1" htmlEscape="false"
+                                 maxlength="255" class="input-xlarge"/>
+                    <sys:ckfinder input="image1" type="images" uploadPath="/photo" selectMultiple="false"
+                                  maxWidth="100"
+                                  maxHeight="100"/>
+                </div>
+                <div class="conList hide-pic">
+                    <form:hidden value="${product.image2}" id="image2" path="image2" htmlEscape="false"
+                                 maxlength="255" class="input-xlarge"/>
+                    <sys:ckfinder input="image2" type="images" uploadPath="/photo" selectMultiple="false"
+                                  maxWidth="100"
+                                  maxHeight="100"/>
+                </div>
+                <div class="conList hide-pic">
+                    <form:hidden value="${product.image3}" id="image3" path="image3" htmlEscape="false"
+                                 maxlength="255" class="input-xlarge"/>
+                    <sys:ckfinder input="image3" type="images" uploadPath="/photo" selectMultiple="false"
+                                  maxWidth="100"
+                                  maxHeight="100"/>
+                </div>
+                <div class="conList hide-pic">
+                    <form:hidden value="${product.image4}" id="image4" path="image4" htmlEscape="false"
+                                 maxlength="255" class="input-xlarge"/>
+                    <sys:ckfinder input="image4" type="images" uploadPath="/photo" selectMultiple="false"
+                                  maxWidth="100"
+                                  maxHeight="100"/>
+                </div>
+                <div class="conList hide-pic">
+                    <form:hidden value="${product.image5}" id="image5" path="image5" htmlEscape="false"
+                                 maxlength="255" class="input-xlarge"/>
+                    <sys:ckfinder input="image5" type="images" uploadPath="/photo" selectMultiple="false"
+                                  maxWidth="100"
+                                  maxHeight="100"/>
+                </div>
             </div>
-            <div class="conList hide-pic">
-                <form:hidden value="${cmSecondHandDetail.image5}" id="image5" path="image5" htmlEscape="false"
-                             maxlength="255" class="input-xlarge"/>
-                <sys:ckfinder input="image5" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
-                              maxHeight="100"/>
+            <div class="conList upload-tips" style="margin-left: 205px">
+                <font color="red">最多上传5张商品图片,请尽量全部上传,单张图片不能超过5M</font>
             </div>
         </div>
-        <div class="conList upload-tips" style="margin-left: 205px">
-            <font color="red">最多上传5张商品图片,请尽量全部上传,单张图片不能超过5M</font>
-        </div>
-    </div>
 
-    <div class="form-actions">
-        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
-        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+        <div class="form-actions">
+            <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
+            <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+        </div>
     </div>
 </form:form>
 <script>
+    //删除相关参数
+    function deleteParams(paramsThis) {
+        $(paramsThis).parent().remove();
+        var paramsItemLength = $('.paramsItem').length;
+        if (paramsItemLength < 50) {
+            $('.addParams').show();
+        }
+    }
 
     //图片初始化
     $(function () {
-        var ids = [];
-        if (999 !=${cmSecondHandDetail.fileTypes}) {
-            ids =${cmSecondHandDetail.fileTypes};
-            for (let i = 0; i < ids.length; i++) {
-                if (1 == ids[i]) {
-                    $("#yqht").attr("checked", true);
-                }
-                if (2 == ids[i]) {
-                    $("#yqzc").attr("checked", true);
-                }
-                if (3 == ids[i]) {
-                    $("#yqfp").attr("checked", true);
-                }
-                if (4 == ids[i]) {
-                    $("#yqbg").attr("checked", true);
-                }
-                if (5 == ids[i]) {
-                    $("#wrh").attr("checked", true);
-                }
+        // 添加相关参数
+        var productParametersIndex = $('#productParametersLength').val() - 1;
+        $(".addParams").click(function () {
+            var val = $("#paramsName").val();
+            // alertx("+++++"+val.length)
+            productParametersIndex++;
+            var html = '<div id="paramsItem" class="paramsItem" style="margin-left:100px;margin-top: 10px">';
+            html += '<input name="productParametersList[' + [productParametersIndex] + '].paramsName" id="paramsName" style="width:142px" maxlength="10" placeholder="参数名称" type="text" class="input-small"/>&nbsp;';
+            html += '<input name="productParametersList[' + [productParametersIndex] + '].paramsContent" id="paramsContent"  style="width:680px" maxlength="50" placeholder="请输入参数信息"  type="text"   class="input-small"/>&nbsp;';
+            html += '<span type="button" style="cursor: pointer;color: #0B61A4" onclick="deleteParams(this)"">删除</span>';
+            html += '</div>';
+            $("#addParamsItems").append(html).show();
+            var paramsItemLength = $('.paramsItem').length;
+            if (paramsItemLength === 50) {
+                $(this).hide();
+                return
             }
-        }
+        });
+
 
-        var publishIdentity = $("input[name='publishIdentity']:checked").val();
-        if (publishIdentity * 1 === 1) {
-            $("#gsmc").hide();
-            $("#yyzz").hide();
-            $("#sfz").show();
-        } else {
-            $("#gsmc").show();
-            $("#sfz").hide();
-            $("#yyzz").show();
+        function checkmaxlengthsBySearch(searckThis, str, maxlength) {
+            var realLength = 0;
+            var maxChange = "1";
+            for (var i = 0; i < str.length; i++) {
+                charCode = str.charCodeAt(i);
+                if (charCode >= 0 && charCode <= 128)
+                    realLength += 1;
+                else {
+                    realLength += 2;
+                    maxChange = "2";
+                }
+            }
+            if (maxChange == "2") {
+                var s = str.substr(0, 16);
+                $(searckThis).val(s);
+            }
+            if (realLength > maxlength) {
+                alertx("关键字最多16个汉字,即32个字符!");
+            }
         }
 
         $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
@@ -499,7 +424,6 @@
             eval(str + '()');
         });
         $('body').on('click', '.cancel-upload', function () {
-            debugger
             var wrapper = $(this).closest('.conList');
             wrapper.find('li').css('z-index', '-1');
             wrapper.find('input').val('');
@@ -534,7 +458,7 @@
         $('.upload-content-image .conList .btn:nth-of-type(2)').after('<img class="cancel-upload-image" src="/static/images/close-btn1.png">').remove();
         $('.upload-content-image .conList').find('.cancel-upload-image').hide();
         var observeEleImage = document.getElementsByClassName('upload-content-image')[0];
-        var observeEleImage1 = document.getElementsByClassName('upload-content-image')[1];
+        // var observeEleImage1 = document.getElementsByClassName('upload-content-image')[1];
         var MutationObserverImage = window.MutationObserver || window.WebKitMutationObserver;
         var MutationObserverConfigImage = {
             childList: true,
@@ -554,10 +478,10 @@
                         nextEle.removeClass('hide-pic-image');
                     }
                 }
-            })
+            });
         });
-        observerImage.observe(observeEleImage, MutationObserverConfigImage);
-        observerImage.observe(observeEleImage1, MutationObserverConfigImage);
+        // observerImage.observe(observeEleImage, MutationObserverConfigImage);
+        // observerImage.observe(observeEleImage1, MutationObserverConfigImage);
 
         $('body').on('click', '.upload-content-image li', function () {
             var index = $(this).closest('.conList').index() + 1,
@@ -578,263 +502,8 @@
                 }
             })
         });
-        $(window).on("load", function () {
-            setTimeout(function () {
-                var input = $("#authenticationImage");
-                if (input.val()) {
-                    input.next().find("li").css("z-index", "99");
-                    input.parents(".conList").find(".cancel-upload-image").show();
-                    input.parents(".conList").next().removeClass("hide-pic-image")
-                }
-                var input = $("#authenticationBackImage");
-                if (input.val()) {
-                    input.next().find("li").css("z-index", "99");
-                    input.parents(".conList").find(".cancel-upload-image").show();
-                    input.parents(".conList").next().removeClass("hide-pic-image")
-                }
-                var input = $("#licenseImage");
-                if (input.val()) {
-                    input.next().find("li").css("z-index", "99");
-                    input.parents(".conList").find(".cancel-upload-image").show();
-                    input.parents(".conList").next().removeClass("hide-pic-image")
-                }
-                input = $("#commitmentImage");
-                if (input.val()) {
-                    input.next().find("li").css("z-index", "99");
-                    input.parents(".conList").find(".cancel-upload-image").show();
-                    input.parents(".conList").next().removeClass("hide-pic-image")
-                }
-            }, 500);
-        });
-
-        var controlsFiles = document.getElementById("controlsFiles");
-        controlsFiles.addEventListener("change", function () {
-            $('#uploadFileName').val(name.substring(0, name.indexOf('.')));
-            var files = $('#controlsFiles').prop('files');
-            var data = new FormData();
-            var url = "${ctx}/oss/cmOssArchive/fileUpload";
-            data.append('file', files[0]);
-            $.ajax({
-                url: url,
-                data: data,
-                type: "POST",
-                processData: false,
-                contentType: false,
-                dataType: "json",
-                success: function (res) {
-                    var html = "<span>" + res.fileName + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href=" + res.url + " style='position: relative' target='_blank'>预览</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href='${ctx}/oss/cmOssArchive/fileDownload?ossName=" + res.ossName + "&fileName=" + res.fileName + "' style='position: relative'>下载</a></span>";
-                    $("#file-list-display").html(html);
-                    $("#controlsFiles").val("");
-                    $("#ossName").val(res.ossName);
-                    $("#fileName").val(res.fileName);
-                },
-                error: function (error) {
-                    alertx(error);
-                }
-            });
-        })
-    });
-    $(function () {
-        // 加载地址
-        loadProvince();
-
-        // 初始化付款状态
-        if ($('#payStatus').val() == '1' || $('#payStatus').val() == '3') {
-            //待支付情况下不能填写付款金额
-            $('.payAmount').hide();
-            $('#payAmount').removeClass('required');
-        }
-
-        if ($('#payStatus').val() == '2') {
-            //已支付情况下需要填写付款金额, 而且必填
-            $('.payAmount').show();
-            $('#payAmount').addClass('required');
-        }
-
-        // 初始化分类
-        var val = $("input[name ='secondHandType']:checked").val();
-        // 分类控制
-        if (val == 2 || val == 3 || val == undefined) {
-            $('.bigTypeList').hide();
-        }
-        if (val == 1) {
-            $('.bigTypeList').show();
-        }
-
-
-        // 价格控制
-        if (val == 1 || val == 3) {
-            $('.showClassDiv').hide();
-        }
-        if (val == 2) {
-            $('.showClassDiv').show();
-        }
-
-
-        $('#brandID').change(function () {
-            var val = $(this).val();
-            if (val == '161') {
-                //显示输入框
-                $("#brandName").show();
-            }
-            if (val != '161') {
-                //隐藏输入框
-                $("#brandName").hide();
-            }
-        });
-
-        //初始化
-        var val = $("#brandID option:selected").val();
-        if (val == '161') {
-            //显示输入框
-            $("#brandName").show();
-        }
-        if (val != '161') {
-            //隐藏输入框
-            $("#brandName").hide();
-        }
-
-        //	修改支付状态
-        $('#payStatus').change(function () {
-                var val = $("#payStatus").val();
-                if (val == 1 || val == 3) {
-                    //待支付情况下不能填写付款金额
-                    $('.payAmount').hide();
-                    $('#payAmount').removeClass('required');
-                }
-                if (val == 2) {
-                    //待支付情况下不能填写付款金额
-                    $('.payAmount').show();
-                    $('#payAmount').addClass('required');
-                }
-            }
-        );
-        // 修改分类
-        $("input[name='secondHandType']").change(function () {
-            var val = $(this).val();
-            // 分类控制
-            if (val == 2 || val == 3) {
-                $('.bigTypeList').hide();
-            }
-            if (val == 1) {
-                $('.bigTypeList').show();
-            }
-
-            // 价格控制
-            if (val == 1 || val == 3) {
-                $('.showClassDiv').hide();
-            }
-            if (val == 2) {
-                $('.showClassDiv').show();
-            }
-
-        });
-
     });
 
-    /**
-     * 加载省份
-     * @param curProvince
-     */
-    function loadProvince() {
-        var curProvince = $("#curProvince").val();
-        $.ajax({
-            type: 'POST',
-            dataType: 'json',
-            url: '/area/loadProvince',
-            success: function (data) {
-                $("#s2id_province .select2-chosen").html("市");
-                $("#province").html("");
-                $("#province").append("<option value=''>省</option>");
-                for (var i = 0; i < data.length; i++) {
-                    if (curProvince != '' && curProvince != null && typeof (curProvince) != "undefined" && curProvince == data[i].name) {
-                        $("#province").append("<option value='" + data[i].name + "' provinceId=" + data[i].id + " selected>" + data[i].name + "</option>");
-                        $("#s2id_province .select2-chosen").html(curProvince);
-                        loadCity($("#curCity").val());
-                    } else {
-                        $("#province").append("<option value='" + data[i].name + "' provinceId=" + data[i].id + ">" + data[i].name + "</option>");
-                    }
-                }
-            }
-
-        });
-    }
-
-    /**
-     * 加载城市
-     */
-    function loadCity(curCity) {
-        var provinceId = $("#province option:selected").attr("provinceId");
-        if (typeof (provinceId) != "undefined" && provinceId * 1 > 0) {
-            $.ajax({
-                type: 'POST',
-                dataType: 'json',
-                data: {'provinceId': provinceId},
-                url: '/area/loadCity',
-                success: function (data) {
-                    $("#s2id_city .select2-chosen").html("市");
-                    $("#city").html("");
-                    $("#city").append("<option value=''>市</option>");
-                    for (var i = 0; i < data.length; i++) {
-                        if (curCity != null && typeof (curCity) != "undefined" && curCity == data[i].name) {
-                            $("#city").append("<option value='" + data[i].name + "' selected cityId=" + data[i].id + ">" + data[i].name + "</option>");
-                            $("#s2id_city .select2-chosen").html(curCity);
-                            loadTown($("#curTown").val());
-                        } else {
-                            $("#city").append("<option value='" + data[i].name + "' cityId=" + data[i].id + ">" + data[i].name + "</option>");
-                        }
-
-
-                    }
-                }
-
-            });
-        } else {
-            $("#city").html("");
-            $(".select2-chosen").eq(3).html("市");
-            $("#city").append("<option value=''>市</option>");
-
-            $("#town").html("");
-            $(".select2-chosen").eq(4).html("区");
-            $("#town").append("<option value=''>区</option>");
-        }
-    }
-
-    /**
-     * 加载县区
-     * @param curTown
-     */
-    function loadTown(curTown) {
-        var cityId = $("#city option:selected").attr("cityId");
-        if (typeof (cityId) != "undefined" && cityId * 1 > 0) {
-            $.ajax({
-                type: 'POST',
-                dataType: 'json',
-                data: {'cityId': cityId},
-                url: '/area/loadTown',
-                success: function (data) {
-                    $("#s2id_town .select2-chosen").html("区");
-                    $("#town").html("");
-                    $("#town").append("<option value='' >区</option>");
-                    for (var i = 0; i < data.length; i++) {
-                        if (curTown != null && typeof (curTown) != "undefined" && curTown == data[i].name) {
-                            $("#town").append("<option value='" + data[i].name + "' selected townId=" + data[i].id + ">" + data[i].name + "</option>");
-                            $("#s2id_town .select2-chosen").html(curTown);
-                        } else {
-                            $("#town").append("<option value='" + data[i].name + "' townId=" + data[i].id + ">" + data[i].name + "</option>");
-                        }
-                    }
-                }
-
-            });
-        } else {
-            $("#town").html("");
-            $(".select2-chosen").eq(4).html("区");
-            $("#town").append("<option value=''>区</option>");
-        }
-
-    }
-
     /**
      * @param obj
      * jquery控制input只能输入数字和两位小数
@@ -847,20 +516,6 @@
         obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
     }
 
-    function Idcheck(val) {
-        var c = val;
-        console.log(c);
-        if (1 === c) {
-            $("#yyzz").hide();
-            $("#sfz").show();
-            $("#gsmc").hide();
-        } else {
-            $("#gsmc").show();
-            $("#sfz").hide();
-            $("#yyzz").show();
-        }
-    }
-
 </script>
 </body>
 <head>
@@ -880,18 +535,6 @@
 
             $("#inputForm").validate({
                 submitHandler: function (form) {
-
-                    // 验证填写参数
-                    var payStatus = $('#payStatus').val();
-                    if (payStatus == 2) {
-                        var payAmount = $("#payAmount").val();
-                        // (验证付款金额)
-                        if (payAmount == "" || payAmount == null) {
-                            alertx('请填写付款金额');
-                            return false;
-                        }
-                    }
-
                     var secondHandType = $("input[name ='secondHandType']:checked").val();
                     if (secondHandType == 2) {
                         var maturityYears = $("#maturityYears").val();
@@ -918,11 +561,7 @@
                             alertx('请输入采购价/原价');
                             return false;
                         }
-
-
                     }
-
-
                     loading('正在提交,请稍等...');
                     form.submit();
                 },
@@ -980,9 +619,6 @@
 
 
     </script>
-    <style>
-
-    </style>
 </head>
 </html>
 

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

@@ -126,6 +126,7 @@
 				</div>
 				<div class="item">
 					<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" style="margin-left:20px;"/>
+					&nbsp;&nbsp;&nbsp;&nbsp;<input class="btn btn-primary" onclick="window.location='${ctx}/product/new/productAdd'" value="发布特殊供应商新品"/>
 				</div>
 				<%--<div class="item">
 					<input type="button" class="btn btn-primary" value="更新所有商品索引" onclick="updateAllIndex()"  style="margin-left:20px;"/>

+ 6 - 1
src/main/webapp/WEB-INF/views/modules/user/cmNewProductShopEdit.jsp

@@ -74,7 +74,6 @@
         <c:if test="${newCmShop.shopType eq 2}">
         <label class="control-label"><font color="red">*</font>状态:</label>
         <div class="controls">
-
             <form:select path="status" class="input-xlarge required">
                 <form:option value="" label="请选择"/>
                 <form:option value="90" label="已上线" selected="selected" htmlEscape="false"/>
@@ -82,6 +81,12 @@
             </form:select>
         </div>
         </c:if>
+        <c:if test="${newCmShop.shopType eq 3}">
+            <label class="control-label"><font color="red">*</font>收款卡号:</label>
+            <div class="controls">
+                    ${newCmShop.cardNumber}
+            </div>
+        </c:if>
     </div>
     <div class="control-group">
         <tr>

+ 1 - 2
src/main/webapp/WEB-INF/views/modules/user/cmNewProductShopList.jsp

@@ -285,7 +285,7 @@
             </td>
             <c:if test="${shopType eq 3}">
                 <td>
-
+                        ${newCmShop.cardNumber}
                 </td>
             </c:if>
             <td>
@@ -303,7 +303,6 @@
                           <c:if test="${not empty newCmShop.auditNote}">onclick="alertx('审核未通过原因:'+'${newCmShop.auditNote}')"</c:if>
                           style="cursor:pointer;text-decoration: underline">审核未通过</font>
                 </c:if>
-
                 <c:if test="${newCmShop.status eq 90}">
                     <a href="javascript:void(0);" onclick="offline(${newCmShop.shopID})">下线</a>
                 </c:if>