Procházet zdrojové kódy

单品促销优惠价加入sku

zhijiezhao před 2 roky
rodič
revize
71e2673a3a

+ 9 - 0
src/main/java/com/caimei/modules/product/dao/CmPromotionDao.java

@@ -3,6 +3,7 @@ package com.caimei.modules.product.dao;
 import com.caimei.modules.bulkpurchase.entity.PurchaseProduct;
 import com.caimei.modules.cibe.entity.Shop;
 import com.caimei.modules.product.entity.CmPromotion;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.modules.product.entity.Product;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
@@ -101,4 +102,12 @@ public interface CmPromotionDao extends CrudDao<CmPromotion> {
     List<Integer> findProductIdsByPromotion(String promotionsId);
 
     void deletePromotion(@Param("id")String id,@Param("skuId") Integer skuId);
+
+    List<CmSku> getPromotionSkus(String id);
+
+    List<CmSku> getPromotionSkusByProduct(String productIds);
+
+    void deleteOldTouchPrice(String promotionId);
+
+    void insertNewTouchPrice(@Param("skuId")Integer skuId,@Param("touchPrice") Double touchPrice,@Param("promotionId")  String promotionId);
 }

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

@@ -11,6 +11,10 @@ import java.util.List;
 
 public class CmPromotion extends DataEntity<CmPromotion> {
     private static final long serialVersionUID = 1L;
+    /**
+     * skus
+     */
+    private List<CmSku> skus;
 
     private String unit;
     /**
@@ -151,6 +155,14 @@ public class CmPromotion extends DataEntity<CmPromotion> {
      */
     private String searchDbFlag;
 
+    public List<CmSku> getSkus() {
+        return skus;
+    }
+
+    public void setSkus(List<CmSku> skus) {
+        this.skus = skus;
+    }
+
     public String getUnit() {
         return unit;
     }

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

@@ -16,6 +16,7 @@ import java.util.List;
 public class CmSku extends DataEntity<CmSku> {
     private Integer skuId;
     private Integer productId;
+    private Double touchPrice; //单品促销优惠价
     private String unit;        // 包装规格
     private Double normalPrice;        // 市场价
     private String stock;        // 库存
@@ -31,6 +32,14 @@ public class CmSku extends DataEntity<CmSku> {
     private Double discount;       //超级会员会员折扣
     private Integer priceType;     //超级会员价类型:1折扣,2优惠价
 
+    public Double getTouchPrice() {
+        return touchPrice;
+    }
+
+    public void setTouchPrice(Double touchPrice) {
+        this.touchPrice = touchPrice;
+    }
+
     public Integer getPriceType() {
         return priceType;
     }

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

@@ -303,6 +303,12 @@ public class CmPromotionService extends CrudService<CmPromotionDao, CmPromotion>
         //删除数据库中该促销活动原来的商品、赠品和商店
         cmPromotionDao.deleteAllPromotionProductsAndShops(promotionId);
         cmPromotionDao.deleteAllPromotionGifts(promotionId);
+        if ("1".equals(cmPromotion.getType()) && "1".equals(cmPromotion.getMode())){
+            // 单品优惠价的时候,删除优惠商品之前的优惠价
+            cmPromotionDao.deleteOldTouchPrice(promotionId);
+            // 保存新的sku优惠价
+            cmPromotion.getSkus().forEach(s->cmPromotionDao.insertNewTouchPrice(s.getSkuId(),s.getTouchPrice(),promotionId));
+        }
 
         if (StringUtil.isNotBlank(cmPromotion.getProductIds())) {
             List<HashMap> list = JSONArray.parseArray(cmPromotion.getProductIds(), HashMap.class);

+ 9 - 0
src/main/java/com/caimei/modules/product/web/CmPromotionController.java

@@ -141,6 +141,15 @@ public class CmPromotionController extends BaseController {
     @RequestMapping(value = "form")
     public String form(CmPromotion cmPromotion, Model model) {
         if (cmPromotion != null) {
+            if("1".equals(cmPromotion.getType())&&"1".equals(cmPromotion.getMode())){
+                if(StringUtils.isNotBlank(cmPromotion.getId())){
+                    //单品优惠价的时候给优惠商品的skus赋值
+                    cmPromotion.setSkus(cmPromotionDao.getPromotionSkus(cmPromotion.getId()));
+                }else{
+                    //新增单品促销的时候没有id
+                    cmPromotion.setSkus(cmPromotionDao.getPromotionSkusByProduct(cmPromotion.getProductIds()));
+                }
+            }
             //表单选择商品或供应商后刷新时设置促销状态
             if ("close".equals(cmPromotion.getDelFlag1())) {
                 cmPromotion.setDelFlag1("0");

+ 23 - 0
src/main/resources/mappings/modules/product/CmPromotionMapper.xml

@@ -324,6 +324,11 @@
                 #{seen})
     </insert>
 
+    <insert id="insertNewTouchPrice">
+        insert into cm_promotion_sku(promotionId, skuId, productId, touchPrice)
+        values (#{promotionId},#{skuId},(select productId from cm_sku where skuId=#{skuId}),#{touchPrice})
+    </insert>
+
 
     <update id="update">
         UPDATE cm_promotions
@@ -440,9 +445,27 @@
         from product
         where shopID in (select supplierId from cm_promotions_product where promotionsId = #{promotionsId})
     </select>
+    <select id="getPromotionSkus" resultType="com.caimei.modules.product.entity.CmSku">
+        SELECT cs.unit,cs.costCheckFlag,cs.costPrice,cs.costProportional,cps.touchPrice,cs.skuId
+        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
+        LEFT JOIN cm_promotion_sku cps ON cs.skuId=cps.skuId
+        WHERE cp.id=#{id}
+    </select>
+    <select id="getPromotionSkusByProduct" resultType="com.caimei.modules.product.entity.CmSku">
+        SELECT cs.unit,cs.costCheckFlag,cs.costPrice,cs.costProportional,cps.touchPrice,cs.skuId
+        FROM  cm_sku cs
+        LEFT JOIN cm_promotion_sku cps ON cs.skuId=cps.skuId
+        WHERE cs.productId=#{productIds}
+    </select>
     <delete id="deletePromotion">
         delete from cm_promotions_gift
         where promotionsId=#{id}
         and skuId=#{skuId}
     </delete>
+    <delete id="deleteOldTouchPrice">
+        delete from cm_promotion_sku
+        where promotionId = #{promotionId}
+    </delete>
 </mapper>

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

@@ -1,20 +1,20 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<%@ page import="java.util.*"%>
-<%@ page import="java.text.*"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<%@ page import="java.util.*" %>
+<%@ page import="java.text.*" %>
 <%
-    String datetime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()); //获取系统时间
-    request.setAttribute("currentTime",datetime);
+    String datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()); //获取系统时间
+    request.setAttribute("currentTime", datetime);
 %>
 <html>
 <head>
     <title>促销活动管理</title>
     <meta name="decorator" content="default"/>
     <script type="text/javascript">
-        $(document).ready(function() {
+        $(document).ready(function () {
             //$("#name").focus();
             $("#inputForm").validate({
-                submitHandler: function(form){
+                submitHandler: function (form) {
                     var isSubMitFlag = true, addProductArray = [], addGiftArray = [];
                     var mode = $("input[name='mode']:checked").val();
                     var status = $("input[name='status']:checked").val();
@@ -29,36 +29,36 @@
                         return false;
                     }
                     if (mode == "1") {
-                        if ($("#touchPrice1").val() == '') {
-                            alertx("请输入优惠价");
-                            isSubMitFlag = false;
-                            return false;
-                        }else if(isNaN($("#touchPrice1").val())||$("#touchPrice1").val().indexOf('0')==0){
-                            alertx('请输入正确的优惠价!');
-                            isSubMitFlag = false;
-                            return false;
-                        }else {
-                            var price = $("#price").val();
-                            if (parseFloat($("#touchPrice1").val()) >= parseFloat(price)) {
-                                alertx('优惠价必须小于机构价'+price);
-                                isSubMitFlag = false;
-                                return false;
-                            }
-                        }
-                    }else if (mode == "2") {
+                        // if ($("#touchPrice1").val() == '') {
+                        //     alertx("请输入优惠价");
+                        //     isSubMitFlag = false;
+                        //     return false;
+                        // } else if (isNaN($("#touchPrice1").val()) || $("#touchPrice1").val().indexOf('0') == 0) {
+                        //     alertx('请输入正确的优惠价!');
+                        //     isSubMitFlag = false;
+                        //     return false;
+                        // } else {
+                        //     var price = $("#price").val();
+                        //     if (parseFloat($("#touchPrice1").val()) >= parseFloat(price)) {
+                        //         alertx('优惠价必须小于机构价' + price);
+                        //         isSubMitFlag = false;
+                        //         return false;
+                        //     }
+                        // }
+                    } else if (mode == "2") {
                         debugger
                         if ($("#touchPrice2").val() == '') {
                             alertx("请输入满减设定价");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#touchPrice2").val())||$("#touchPrice2").val().indexOf('0')==0){
+                        } else if (isNaN($("#touchPrice2").val()) || $("#touchPrice2").val().indexOf('0') == 0) {
                             alertx('请输入正确的满减设定价!');
                             isSubMitFlag = false;
                             return false;
-                        }else {
+                        } else {
                             var price = $("#price").val();
-                            if (parseFloat($("#touchPrice2").val()) <parseFloat(price)) {
-                                alertx('满减设定价需大于或等于商品机构价'+price);
+                            if (parseFloat($("#touchPrice2").val()) < parseFloat(price)) {
+                                alertx('满减设定价需大于或等于商品机构价' + price);
                                 isSubMitFlag = false;
                                 return false;
                             }
@@ -67,7 +67,7 @@
                             alertx("请输入减免价格");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#reducedPrice").val())||$("#reducedPrice").val().indexOf('0')==0){
+                        } else if (isNaN($("#reducedPrice").val()) || $("#reducedPrice").val().indexOf('0') == 0) {
                             alertx('请输入正确的减免价格!');
                             isSubMitFlag = false;
                             return false;
@@ -77,26 +77,26 @@
                             isSubMitFlag = false;
                             return false;
                         }
-                    }else if (mode == "3") {
+                    } else if (mode == "3") {
                         if ($("#touchPrice3").val() == '') {
                             alertx("请输入满赠设定价");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#touchPrice3").val())||$("#touchPrice3").val().indexOf('0')==0){
+                        } else if (isNaN($("#touchPrice3").val()) || $("#touchPrice3").val().indexOf('0') == 0) {
                             alertx('请输入正确的满赠设定价!');
                             isSubMitFlag = false;
                             return false;
-                        }else {
+                        } else {
                             var price = $("#price").val();
                             if (parseFloat($("#touchPrice3").val()) < parseFloat(price)) {
-                                alertx('满赠设定价需大于或等于商品机构价'+price);
+                                alertx('满赠设定价需大于或等于商品机构价' + price);
                                 isSubMitFlag = false;
                                 return false;
                             }
                         }
                     }
-                    if (mode=="3") {
-                        if(document.getElementById("contentTbody1").rows.length<1){
+                    if (mode == "3") {
+                        if (document.getElementById("contentTbody1").rows.length < 1) {
                             alertx("请至少选择1个赠送的商品");
                             isSubMitFlag = false;
                             return false;
@@ -116,12 +116,12 @@
                         //已改为skuId
                         var $itemProductID = $this.find('input[name="gift"]').val();
                         var $giftNumber = $this.find('input[name="giftNumber"]').val();
-                        if ($giftNumber == null || $giftNumber == '' ) {
+                        if ($giftNumber == null || $giftNumber == '') {
                             alertx("请输入赠品数量");
                             isSubMitFlag = false;
                             return false;
                         }
-                        if ( $giftNumber <= 0 ) {
+                        if ($giftNumber <= 0) {
                             alertx("赠品数量必须大于0");
                             isSubMitFlag = false;
                             return false;
@@ -151,9 +151,9 @@
                     }
                 },
                 errorContainer: "#messageBox",
-                errorPlacement: function(error, element) {
+                errorPlacement: function (error, element) {
                     $("#messageBox").text("输入有误,请先更正。");
-                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                         error.appendTo(element.parent().parent());
                     } else {
                         error.insertAfter(element);
@@ -161,6 +161,7 @@
                 }
             });
         });
+
         //选择添加商品
         function showSelect(type) {
             var showSelectProductID = '';
@@ -181,12 +182,12 @@
                     var $itemProductID = $this.find('input[name="gift"]').val();
                     showSelectProductID += $itemProductID + ',';
                 });
-                url ="${ctx}/product/cmPromotions/findProductPage?productIds=" + showSelectProductID
+                url = "${ctx}/product/cmPromotions/findProductPage?productIds=" + showSelectProductID
                 title = "选择促销赠品";
             }
             showSelectProductID = showSelectProductID.slice(0, -1)
             console.log(showSelectProductID);
-            top.$.jBox("iframe:"+url, {
+            top.$.jBox("iframe:" + url, {
                 iframeScrolling: 'yes',
                 width: $(top.document).width() - 400,
                 height: $(top.document).height() - 160,
@@ -209,7 +210,7 @@
                                     var giftIds = $("#giftIds").val();
                                     var mode = $("input[name='mode']:checked").val();
                                     var reducedPrice = $("#reducedPrice").val();
-                                    var touchPrice1 = $("#touchPrice1").val();
+                                    // var touchPrice1 = $("#touchPrice1").val();
                                     var touchPrice2 = $("#touchPrice2").val();
                                     var touchPrice3 = $("#touchPrice3").val();
                                     var status = $("input[name='status']:checked").val();
@@ -219,15 +220,15 @@
                                     var delProductIds = $("#delProductIds").val();
                                     var delGiftIds = $("#delGiftIds").val();
                                     //将选中商品id与原来的促销商品或赠品id拼接
-                                    if (type == 1 ) {
+                                    if (type == 1) {
                                         items = items;
                                         if (giftIds != '') {
                                             items1 = giftIds;
                                         }
                                         window.location.href = "${ctx}/product/cmPromotions/form?type=1&productIds=" + items + "&giftIds=" + items1 + "&mode=" + mode +
-                                            "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+
-                                            "&reducedPrice=" + reducedPrice + "&touchPrice1=" + touchPrice1 + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
-                                            "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}"+
+                                            "&delProductIds=" + delProductIds + "&delGiftIds=" + delGiftIds +
+                                            "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
+                                            "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}" +
                                             "&searchDbFlag=0";
                                     }
                                     if (type == 2) {
@@ -238,8 +239,8 @@
                                             items1 = productIds;
                                         }
                                         window.location.href = "${ctx}/product/cmPromotions/form?type=1&productIds=" + items1 + "&giftIds=" + items + "&mode=" + mode +
-                                            "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+
-                                            "&reducedPrice=" + reducedPrice + "&touchPrice1=" + touchPrice1 + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
+                                            "&delProductIds=" + delProductIds + "&delGiftIds=" + delGiftIds +
+                                            "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
                                             "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";
                                     }
                                     $.jBox.tip(data.msg, 'info');
@@ -258,25 +259,25 @@
             });
         }
 
-        function deleteProduct(obj,type) {
+        function deleteProduct(obj, type) {
             //将该行数据取消勾选,若存在数据库中则将其删除
             $(".check-item[value=" + obj + "]").prop("checked", false);
             if (type == 1) {
-                var product=$('#product'+obj);
+                var product = $('#product' + obj);
                 $(product).remove();
             }
             if (type == 2) {
-                var gift= $('#gift'+obj);
+                var gift = $('#gift' + obj);
                 $(gift).remove();
             }
 
             $.ajax({
                 url: "${ctx}/product/cmPromotions/delPromotion",
-                data: {"id":"${cmPromotion.id || ''}","skuId":obj},
+                data: {"id": "${cmPromotion.id || ''}", "skuId": obj},
                 type: "POST",
                 async: false,
-                success: function(data){
-                    flag=data.success;
+                success: function (data) {
+                    flag = data.success;
                 }
             });
 
@@ -302,18 +303,18 @@
 
         function getCheckedItems(type) {
             var items = new Array();
-            var $items = type==0? $('.check-item:checked'):type==1?$("#productCheckItem:checked"):$("#giftCheckItem:checked");
+            var $items = type == 0 ? $('.check-item:checked') : type == 1 ? $("#productCheckItem:checked") : $("#giftCheckItem:checked");
             $items.each(function () {
                 items.push($(this).val());
             });
             return items;
         }
 
-        function checkModes(){
+        function checkModes() {
             $("#discount").show();
         }
 
-        function checkMode(){
+        function checkMode() {
             $("#discount").hide();
         }
     </script>
@@ -321,10 +322,14 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/product/cmPromotions/list?type=1">单品促销</a></li>
-    <li class="active"><a href="${ctx}/product/cmPromotions/form?id=${cmPromotion.id}&type=1">${not empty cmPromotion.id?'编辑':'添加'}单品促销</a></li>
-</ul><br/>
+    <li class="active"><a
+            href="${ctx}/product/cmPromotions/form?id=${cmPromotion.id}&type=1">${not empty cmPromotion.id?'编辑':'添加'}单品促销</a>
+    </li>
+</ul>
+<br/>
 <input hidden="hidden" id="price" value="${price}">
-<form:form id="inputForm" modelAttribute="cmPromotion" action="${ctx}/product/cmPromotions/save" method="post" class="form-horizontal">
+<form:form id="inputForm" modelAttribute="cmPromotion" action="${ctx}/product/cmPromotions/save" method="post"
+           class="form-horizontal">
     <form:hidden path="id"/>
     <form:hidden path="type"/>
     <form:hidden path="productIds" id="productIds"/>
@@ -351,8 +356,8 @@
                 <c:forEach items="${cmPromotion.promotionProducts}" var="product">
                     <tr id="product${product.productID}">
                         <th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
-                                   name="info" ${product.storeStatus?'':'checked'}
-                                   value='${product.productID}'/></th>
+                                                name="info" ${product.storeStatus?'':'checked'}
+                                                value='${product.productID}'/></th>
                         <td><img src="${product.mainImage}" width="50px" height="50px"></td>
                         <td>${product.name}</td>
                         <td>${product.shopName}</td>
@@ -370,26 +375,51 @@
 
     <div class="control-group" id="promotionType">
         <label>促销方式:</label>
-        <input type="radio"  id="promotionType1" onclick="checkMode()" name="mode" value="1" ${cmPromotion.mode == null ? "checked" : cmPromotion.mode == "1"?"checked":""} />优惠价
-        <input type="radio"  id="promotionType2" onclick="checkModes()" name="mode" value="2" ${cmPromotion.mode == "2" ? "checked" : ""} />满减
-        <input type="radio" id="promotionType3"  onclick="checkModes()" name="mode" value="3" ${cmPromotion.mode == "3" ? "checked" : ""} />满赠
+        <input type="radio" id="promotionType1" onclick="checkMode()" name="mode"
+               value="1" ${cmPromotion.mode == null ? "checked" : cmPromotion.mode == "1"?"checked":""} />优惠价
+        <input type="radio" id="promotionType2" onclick="checkModes()" name="mode"
+               value="2" ${cmPromotion.mode == "2" ? "checked" : ""} />满减
+        <input type="radio" id="promotionType3" onclick="checkModes()" name="mode"
+               value="3" ${cmPromotion.mode == "3" ? "checked" : ""} />满赠
     </div>
 
     <div class="control-group">
         <label style="display: inline"><label style="color: red">*</label>优惠内容:</label>
-        <div id="discountContent1" style="display: ${cmPromotion.mode == null ? "inline" : cmPromotion.mode == "1"?"inline":"none"}" >
+        <div id="discountContent1"
+             style="display: ${cmPromotion.mode == null ? "inline" : cmPromotion.mode == "1"?"inline":"none"}">
             <label><font color="red">优惠价</font></label>
-            <form:input path="touchPrice1" id="touchPrice1" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
+                <%--            <form:input path="touchPrice1" id="touchPrice1" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>--%>
+            <table>
+                <c:forEach items="${cmPromotion.skus}" var="sku" varStatus="s">
+                    <tr>
+                        <td hidden><input name="skus[${s.index}].skuId" value="${sku.skuId}"></td>
+                        <td>规格:${sku.unit}</td>
+                        <td>优惠价:<input class="required" name="skus[${s.index}].touchPrice" value="${sku.touchPrice}" type="number"/></td>
+                        <td>成本类型:${sku.costCheckFlag eq 1?'固定成本':'比例成本'}</td>
+                        <td>
+                            <c:if test="${sku.costCheckFlag eq 1}">
+                                成本价格:¥${sku.costPrice}
+                            </c:if>
+                            <c:if test="${sku.costCheckFlag eq 2}">
+                                成本比例:${sku.costProportional}%
+                            </c:if>
+                        </td>
+                    </tr>
+                </c:forEach>
+            </table>
         </div>
         <div id="discountContent2" style="display: ${cmPromotion.mode == "2" ? "inline" : "none"}">
             <label><font color="red">满</font></label>
-            <form:input path="touchPrice2" id="touchPrice2" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
+            <form:input path="touchPrice2" id="touchPrice2" htmlEscape="false" maxlength="7" class="input-xlarge "
+                        onkeyup="onlynum(this)"/>
             <label><font color="red">减</font></label>
-            <form:input path="reducedPrice" id="reducedPrice" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
+            <form:input path="reducedPrice" id="reducedPrice" htmlEscape="false" maxlength="7" class="input-xlarge "
+                        onkeyup="onlynum(this)"/>
         </div>
         <div id="discountContent3" style="display: ${cmPromotion.mode == "3" ? "inline" : "none"}">
             <label><font color="red">满</font></label>
-            <form:input path="touchPrice3" id="touchPrice3" htmlEscape="false" maxlength="7" class="input-xlarge" onkeyup="onlynum(this)"/>
+            <form:input path="touchPrice3" id="touchPrice3" htmlEscape="false" maxlength="7" class="input-xlarge"
+                        onkeyup="onlynum(this)"/>
             <label><a href="JavaScript:;" onclick="showSelect(2)">请选择赠品</a></label>
             <c:if test="${cmPromotion.giftProducts !=null and cmPromotion.giftProducts.size()>0}">
                 <table id="contentTable" class="table table-striped table-bordered table-condensed">
@@ -433,11 +463,13 @@
 
     <div class="control-group">
         <label>促销时效:</label>
-        <input type="radio" name="status" value="1" ${cmPromotion.status == null ? "checked" : cmPromotion.status == "1"?"checked":""} />永久
+        <input type="radio" name="status"
+               value="1" ${cmPromotion.status == null ? "checked" : cmPromotion.status == "1"?"checked":""} />永久
         <input type="radio" name="status" value="2" ${cmPromotion.status == "2" ? "checked" : ""} />区间有效
     </div>
 
-    <div class="control-group" id="begin" style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}" >
+    <div class="control-group" id="begin"
+         style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}">
         <label>开始时间:</label>
         <input name="beginTime" type="text" readonly="readonly" maxlength="20"
                class="input-medium Wdate required" id="beginTime"
@@ -445,7 +477,8 @@
                onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
     </div>
 
-    <div class="control-group" id="end" style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}" >
+    <div class="control-group" id="end"
+         style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}">
         <label>结束时间:</label>
         <input name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
                id="endTime"
@@ -453,27 +486,32 @@
                onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
     </div>
 
-    <div class="control-group" id="discount" style="display: ${cmPromotion.mode == null ? "none" : cmPromotion.mode == "1"?"none":""}">
+    <div class="control-group" id="discount"
+         style="display: ${cmPromotion.mode == null ? "none" : cmPromotion.mode == "1"?"none":""}">
         <label>叠加优惠:</label>
-        <input type="radio" name="discount" value="1" ${cmPromotion.discount == null ? "checked" : cmPromotion.discount == "1"?"checked":""} />支持
+        <input type="radio" name="discount"
+               value="1" ${cmPromotion.discount == null ? "checked" : cmPromotion.discount == "1"?"checked":""} />支持
         <input type="radio" name="discount" value="2" ${cmPromotion.discount == "2" ? "checked" : ""} />不支持
     </div>
 
     <div class="control-group">
         <label>活动可见度:</label>
-        <input type="radio" name="seen" value="1" ${cmPromotion.seen == null ? "checked" : cmPromotion.seen == "1"?"checked":""}/>对所有人可见(含协销)
+        <input type="radio" name="seen"
+               value="1" ${cmPromotion.seen == null ? "checked" : cmPromotion.seen == "1"?"checked":""}/>对所有人可见(含协销)
         <input type="radio" name="seen" value="2" ${cmPromotion.seen == "2" ? "checked" : ""}/>仅对机构可见(不含协销)
     </div>
 
     <div class="control-group">
         <label style="display: inline" id="testStatus">促销状态:</label>
-        <label style="display: inline;color: ${cmPromotion.delFlag1 == null || cmPromotion.delFlag1 == '' ?"green":cmPromotion.delFlag1 == "0"?"red":cmPromotion.delFlag1 == "1"?"purple":cmPromotion.delFlag1 == "2"?"green":"orange"}" id="promotionStatus" >${cmPromotion.delFlag1 == null || cmPromotion.delFlag1 == '' ?"进行中":cmPromotion.delFlag1 == "0"?"已关闭":cmPromotion.delFlag1 == "1"?"未开始":cmPromotion.delFlag1 == "2"?"进行中":"已结束"}</label>
-        <input type="checkbox" id="delFlag1" name="delFlag1" value="close" ${cmPromotion.delFlag1 == null?"":cmPromotion.delFlag1 == "0" ? "checked" : ""} />关闭
+        <label style="display: inline;color: ${cmPromotion.delFlag1 == null || cmPromotion.delFlag1 == '' ?"green":cmPromotion.delFlag1 == "0"?"red":cmPromotion.delFlag1 == "1"?"purple":cmPromotion.delFlag1 == "2"?"green":"orange"}"
+               id="promotionStatus">${cmPromotion.delFlag1 == null || cmPromotion.delFlag1 == '' ?"进行中":cmPromotion.delFlag1 == "0"?"已关闭":cmPromotion.delFlag1 == "1"?"未开始":cmPromotion.delFlag1 == "2"?"进行中":"已结束"}</label>
+        <input type="checkbox" id="delFlag1" name="delFlag1"
+               value="close" ${cmPromotion.delFlag1 == null?"":cmPromotion.delFlag1 == "0" ? "checked" : ""} />关闭
     </div>
 
     <div class="form-actions">
         <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
-        <a href="${ctx}/product/cmPromotions/?type=1"><input id="btnCancel" class="btn" type="button" value="返 回" /></a>
+        <a href="${ctx}/product/cmPromotions/?type=1"><input id="btnCancel" class="btn" type="button" value="返 回"/></a>
     </div>
 </form:form>
 <script type="text/javascript">
@@ -484,17 +522,17 @@
     $("input:radio[name='mode']").click(function () {
         var promotionType = $("input[name='mode']:checked").val();
         if ("1" == promotionType) {
-            $("#discountContent1").attr("style","display:inline");
-            $("#discountContent2").attr("style","display:none");
-            $("#discountContent3").attr("style","display:none");
-        }else if ("2" == promotionType) {
-            $("#discountContent1").attr("style","display:none");
-            $("#discountContent2").attr("style","display:inline");
-            $("#discountContent3").attr("style","display:none");
+            $("#discountContent1").attr("style", "display:inline");
+            $("#discountContent2").attr("style", "display:none");
+            $("#discountContent3").attr("style", "display:none");
+        } else if ("2" == promotionType) {
+            $("#discountContent1").attr("style", "display:none");
+            $("#discountContent2").attr("style", "display:inline");
+            $("#discountContent3").attr("style", "display:none");
         } else {
-            $("#discountContent1").attr("style","display:none");
-            $("#discountContent2").attr("style","display:none");
-            $("#discountContent3").attr("style","display:inline");
+            $("#discountContent1").attr("style", "display:none");
+            $("#discountContent2").attr("style", "display:none");
+            $("#discountContent3").attr("style", "display:inline");
         }
     })
     //促销时效修改
@@ -502,15 +540,15 @@
         var promotionStatus = $("input[name='status']:checked").val();
         var promotiondelFlag1 = $("input[name='delFlag1']:checked").val();
         if ("1" == promotionStatus) {
-            $("#begin").attr("style","display:none");
-            $("#end").attr("style","display:none");
+            $("#begin").attr("style", "display:none");
+            $("#end").attr("style", "display:none");
             if (null == promotiondelFlag1) {
                 $("#promotionStatus").text("进行中");
                 $("#promotionStatus").attr("style", "display: inline;color:green");
             }
-        }else if ("2" == promotionStatus) {
-            $("#begin").attr("style","");
-            $("#end").attr("style","");
+        } else if ("2" == promotionStatus) {
+            $("#begin").attr("style", "");
+            $("#end").attr("style", "");
             if (null == promotiondelFlag1) {
                 updateStatus();
             }
@@ -532,7 +570,7 @@
         if (promotiondelFlag1 != null) {
             $("#promotionStatus").text("已关闭");
             $("#promotionStatus").attr("style", "display: inline;color:red");
-        }else {
+        } else {
             var promotionStatus = $("input[name='status']:checked").val();
             if ("1" == promotionStatus) {
                 $("#promotionStatus").text("进行中");