|
@@ -0,0 +1,542 @@
|
|
|
+<%@ page contentType="text/html;charset=UTF-8" %>
|
|
|
+<%@ 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);
|
|
|
+%>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+ <title>促销活动管理</title>
|
|
|
+ <meta name="decorator" content="default"/>
|
|
|
+ <script type="text/javascript">
|
|
|
+ $(document).ready(function() {
|
|
|
+ //$("#name").focus();
|
|
|
+ $("#inputForm").validate({
|
|
|
+ submitHandler: function(form){
|
|
|
+ var isSubMitFlag = true, addProductArray = [], addGiftArray = [];
|
|
|
+ var mode = $("input[name='mode']:checked").val();
|
|
|
+ var status = $("input[name='status']:checked").val();
|
|
|
+ if (${cmOrganizePromotion.promotionProducts==null or cmOrganizePromotion.promotionProducts.size()==0}) {
|
|
|
+ alertx("请选择促销商品");
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (${cmOrganizePromotion.promotionProducts.size()>1}) {
|
|
|
+ alertx("只能选择一种商品,请删除多出的商品");
|
|
|
+ isSubMitFlag = false;
|
|
|
+ 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 price1 = $("#price1").val();
|
|
|
+ if (parseFloat($("#touchPrice1").val()) >= parseFloat(price1)) {
|
|
|
+ alertx('优惠价必须小于机构价'+price1);
|
|
|
+ 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){
|
|
|
+ alertx('请输入正确的满减设定价!');
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }else {
|
|
|
+ var price1 = $("#price1").val();
|
|
|
+ if (parseFloat($("#touchPrice2").val()) <parseFloat(price1)) {
|
|
|
+ alertx('满减设定价需大于或等于商品机构价'+price1);
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($("#reducedPrice").val() == '') {
|
|
|
+ alertx("请输入减免价格");
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }else if(isNaN($("#reducedPrice").val())||$("#reducedPrice").val().indexOf('0')==0){
|
|
|
+ alertx('请输入正确的减免价格!');
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (parseFloat($("#reducedPrice").val()) > parseFloat($("#touchPrice2").val())) {
|
|
|
+ alertx("减免价格必须小于满减设定价")
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }else if (mode == "3") {
|
|
|
+ if ($("#touchPrice3").val() == '') {
|
|
|
+ alertx("请输入满赠设定价");
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }else if(isNaN($("#touchPrice3").val())||$("#touchPrice3").val().indexOf('0')==0){
|
|
|
+ alertx('请输入正确的满赠设定价!');
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }else {
|
|
|
+ var price1 = $("#price1").val();
|
|
|
+ if (parseFloat($("#touchPrice3").val()) < parseFloat(price1)) {
|
|
|
+ alertx('满赠设定价需大于或等于商品机构价'+price1);
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (mode=="3" &&( ${cmOrganizePromotion.giftProducts==null or cmOrganizePromotion.giftProducts.size()==0})) {
|
|
|
+ alertx("请至少选择1个赠送的商品");
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //将促销商品和赠品信息填充进数组
|
|
|
+ $('#contentTbody tr').each(function (index, item) {
|
|
|
+ var $this = $(this);
|
|
|
+ var $itemProductID = $this.find('input[name="info"]').val();
|
|
|
+ var obj = {
|
|
|
+ productId: $itemProductID,
|
|
|
+ }
|
|
|
+ addProductArray.push(obj)
|
|
|
+ });
|
|
|
+ $('#contentTbody1 tr').each(function (index, item) {
|
|
|
+ var $this = $(this);
|
|
|
+ var $itemProductID = $this.find('input[name="gift"]').val();
|
|
|
+ var $giftNumber = $this.find('input[name="giftNumber"]').val();
|
|
|
+ if ($giftNumber == null || $giftNumber == '' ) {
|
|
|
+ alertx("请输入赠品数量");
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if ( $giftNumber <= 0 ) {
|
|
|
+ alertx("赠品数量必须大于0");
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ var obj = {
|
|
|
+ productId: $itemProductID,
|
|
|
+ number: $giftNumber
|
|
|
+ };
|
|
|
+ addGiftArray.push(obj)
|
|
|
+ })
|
|
|
+ if (status == "2") {
|
|
|
+ var $beginTime = $("#beginTime").val();
|
|
|
+ var $endTime = $("#endTime").val();
|
|
|
+ if ($beginTime >= $endTime) {
|
|
|
+ alertx("结束时间不能早于开始时间");
|
|
|
+ isSubMitFlag = false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isSubMitFlag) {
|
|
|
+ var productItems = JSON.stringify(addProductArray);
|
|
|
+ var giftItems = JSON.stringify(addGiftArray);
|
|
|
+ $("#productIds").val(productItems);
|
|
|
+ $("#giftIds").val(giftItems)
|
|
|
+ loading('正在提交,请稍等...');
|
|
|
+ form.submit();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ errorContainer: "#messageBox",
|
|
|
+ errorPlacement: function(error, element) {
|
|
|
+ $("#messageBox").text("输入有误,请先更正。");
|
|
|
+ if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
|
|
|
+ error.appendTo(element.parent().parent());
|
|
|
+ } else {
|
|
|
+ error.insertAfter(element);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //选择添加商品
|
|
|
+ function showSelect(type) {
|
|
|
+ var showSelectProductID = '';
|
|
|
+ var url = '';
|
|
|
+ var title = '';
|
|
|
+ var delProductIds = $("#delProductIds").val();
|
|
|
+ if (type == 1) {
|
|
|
+ $('#contentTbody tr').each(function (index, item) {
|
|
|
+ var $this = $(this);
|
|
|
+ var $itemProductID = $this.find('input[name="info"]').val();
|
|
|
+ showSelectProductID += $itemProductID + ',';
|
|
|
+ });
|
|
|
+ url = "${ctx}/weisha/cmOrganizePromotions/findProductPage?productIds=" + showSelectProductID + "&promotionType=1&delProductIds=" + delProductIds;
|
|
|
+ title = "选择促销单品";
|
|
|
+ } else {
|
|
|
+ $('#contentTbody1 tr').each(function (index, item) {
|
|
|
+ var $this = $(this);
|
|
|
+ var $itemProductID = $this.find('input[name="gift"]').val();
|
|
|
+ showSelectProductID += $itemProductID + ',';
|
|
|
+ });
|
|
|
+ url ="${ctx}/weisha/cmOrganizePromotions/findProductPage?productIds=" + showSelectProductID
|
|
|
+ title = "选择促销赠品";
|
|
|
+ }
|
|
|
+ showSelectProductID = showSelectProductID.slice(0, -1)
|
|
|
+ console.log(showSelectProductID);
|
|
|
+ top.$.jBox("iframe:"+url, {
|
|
|
+ iframeScrolling: 'yes',
|
|
|
+ width: $(top.document).width() - 400,
|
|
|
+ height: $(top.document).height() - 160,
|
|
|
+ persistent: true,
|
|
|
+ title: title,
|
|
|
+ buttons: {"确定": '1', "关闭": '-1'},
|
|
|
+ submit: function (v, h, f) {
|
|
|
+ //确定
|
|
|
+ var $jboxFrame = top.$('#jbox-iframe');
|
|
|
+ var $mainFrame = top.$('#mainFrame');
|
|
|
+ if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
|
|
|
+ var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
|
|
|
+ var items1 = "";
|
|
|
+ var stringify = JSON.stringify(items);
|
|
|
+ if (items.length > 0) {
|
|
|
+ //添加数据
|
|
|
+ $.post("${ctx}/product/activity/saveTemp", function (data) {
|
|
|
+ if (true == data.success) {
|
|
|
+ var productIds = $("#productIds").val();
|
|
|
+ var giftIds = $("#giftIds").val();
|
|
|
+ var mode = $("input[name='mode']:checked").val();
|
|
|
+ var reducedPrice = $("#reducedPrice").val();
|
|
|
+ var touchPrice1 = $("#touchPrice1").val();
|
|
|
+ var touchPrice2 = $("#touchPrice2").val();
|
|
|
+ var touchPrice3 = $("#touchPrice3").val();
|
|
|
+ var status = $("input[name='status']:checked").val();
|
|
|
+ var beginTime = $("#beginTime").val();
|
|
|
+ var endTime = $("#endTime").val();
|
|
|
+ var delFlag1 = $("input[name='delFlag1']:checked").val();
|
|
|
+ var delProductIds = $("#delProductIds").val();
|
|
|
+ var delGiftIds = $("#delGiftIds").val();
|
|
|
+ var organizeId = $("#organizeId").val();
|
|
|
+ //将选中商品id与原来的促销商品或赠品id拼接
|
|
|
+ if (type == 1 ) {
|
|
|
+ items = items;
|
|
|
+ if (giftIds != '') {
|
|
|
+ items1 = giftIds;
|
|
|
+ }
|
|
|
+ window.location.href = "${ctx}/weisha/cmOrganizePromotions/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=${cmOrganizePromotion.id}" +
|
|
|
+ "&searchDbFlag=0&organizeId=" + organizeId;
|
|
|
+ }
|
|
|
+ if (type == 2) {
|
|
|
+ if (giftIds != '') {
|
|
|
+ items = items + ',' + giftIds;
|
|
|
+ }
|
|
|
+ if (productIds != '') {
|
|
|
+ items1 = productIds;
|
|
|
+ }
|
|
|
+ window.location.href = "${ctx}/weisha/cmOrganizePromotions/form?type=1&productIds=" + items1 + "&giftIds=" + items + "&mode=" + mode +
|
|
|
+ "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+
|
|
|
+ "&reducedPrice=" + reducedPrice + "&touchPrice1=" + touchPrice1 + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
|
|
|
+ "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmOrganizePromotion.id}&organizeId=" + organizeId;
|
|
|
+ }
|
|
|
+ $.jBox.tip(data.msg, 'info');
|
|
|
+ } else {
|
|
|
+ $.jBox.tip(data.msg, 'error');
|
|
|
+ }
|
|
|
+ }, "JSON");//这里返回的类型有:json,html,xml,text
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ top.$.jBox.tip("请先勾选商品...");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function deleteProduct(obj, storeStatus,type) {
|
|
|
+ //将该行数据取消勾选,若存在数据库中则将其删除
|
|
|
+ $(".check-item[value=" + obj + "]").prop("checked", false);
|
|
|
+ var delProductIds = $("#delProductIds").val();
|
|
|
+ var delGiftIds = $("#delGiftIds").val();
|
|
|
+ if (storeStatus && type == 1) {
|
|
|
+ if (delProductIds != '') {
|
|
|
+ delProductIds = delProductIds + "," + obj;
|
|
|
+ }else delProductIds = obj;
|
|
|
+ }
|
|
|
+ if (storeStatus && type == 2) {
|
|
|
+ if (delGiftIds != '') {
|
|
|
+ delGiftIds = delGiftIds + "," + obj;
|
|
|
+ }else delGiftIds = obj;
|
|
|
+ }
|
|
|
+ window.setTimeout(function () {
|
|
|
+ var productItems = getCheckedItems(1);
|
|
|
+ var giftItems = getCheckedItems(2);
|
|
|
+ var mode = $("input[name='mode']:checked").val();
|
|
|
+ var reducedPrice = $("#reducedPrice").val();
|
|
|
+ var touchPrice1 = $("#touchPrice1").val();
|
|
|
+ var touchPrice2 = $("#touchPrice2").val();
|
|
|
+ var touchPrice3 = $("#touchPrice3").val();
|
|
|
+ var status = $("input[name='status']:checked").val();
|
|
|
+ var beginTime = $("#beginTime").val();
|
|
|
+ var endTime = $("#endTime").val();
|
|
|
+ var delFlag1 = $("input[name='delFlag1']:checked").val();
|
|
|
+ var organizeId = $("#organizeId").val();
|
|
|
+ window.location.href = "${ctx}/weisha/cmOrganizePromotions/form?type=1&productIds=" + productItems + "&giftIds=" + giftItems +
|
|
|
+ "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+ "&mode=" + mode +
|
|
|
+ "&reducedPrice=" + reducedPrice + "&touchPrice1=" + touchPrice1 + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
|
|
|
+ "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmOrganizePromotion.id}" +
|
|
|
+ "&searchDbFlag=0&organizeId=" + organizeId;
|
|
|
+ },100)
|
|
|
+ }
|
|
|
+
|
|
|
+ function getCheckedItems(type) {
|
|
|
+ var items = new Array();
|
|
|
+ var $items = type==0? $('.check-item:checked'):type==1?$("#productCheckItem:checked"):$("#giftCheckItem:checked");
|
|
|
+ $items.each(function () {
|
|
|
+ items.push($(this).val());
|
|
|
+ });
|
|
|
+ return items;
|
|
|
+ }
|
|
|
+
|
|
|
+ </script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<ul class="nav nav-tabs">
|
|
|
+ <li><a href="${ctx}/weisha/cmOrganizeProduct/?organizeId=${organizeId}">组织商品列表</a></li>
|
|
|
+ <li><a href="${ctx}/weisha/cmOrganizePromotions/list?type=1&organizeId=${cmOrganizePromotion.organizeId}">单品促销</a></li>
|
|
|
+ <li class="active"><a href="${ctx}/weisha/cmOrganizePromotions/form?id=${cmOrganizePromotion.id}&type=1&organizeId=${cmOrganizePromotion.organizeId}">${not empty cmOrganizePromotion.id?'编辑':'添加'}单品促销</a></li>
|
|
|
+</ul><br/>
|
|
|
+<input hidden="hidden" id="price1" value="${price1}">
|
|
|
+<form:form id="inputForm" modelAttribute="cmOrganizePromotion" action="${ctx}/weisha/cmOrganizePromotions/save" method="post" class="form-horizontal">
|
|
|
+ <form:hidden path="id"/>
|
|
|
+ <form:hidden path="organizeId"/>
|
|
|
+ <form:hidden path="type"/>
|
|
|
+ <form:hidden path="productIds" id="productIds"/>
|
|
|
+ <form:hidden path="giftIds" id="giftIds"/>
|
|
|
+ <form:hidden path="shopIds" id="shopIds"/>
|
|
|
+ <form:hidden path="delProductIds" id="delProductIds"/>
|
|
|
+ <form:hidden path="delGiftIds" id="delGiftIds"/>
|
|
|
+ <form:hidden path="searchDbFlag" id="searchDbFlag"/>
|
|
|
+ <sys:message content="${message}"/>
|
|
|
+ <div class="control-group">
|
|
|
+ <label><label style="color: red">*</label>促销商品:</label>
|
|
|
+ <label><a href="JavaScript:;" onclick="showSelect(1)">请选择促销单品</a></label>
|
|
|
+ <c:if test="${cmOrganizePromotion.promotionProducts !=null and cmOrganizePromotion.promotionProducts.size()>0}">
|
|
|
+ <table id="contentTable" class="table table-striped table-bordered table-condensed">
|
|
|
+ <thead>
|
|
|
+ <th style="width:20px;" class="hide"></th>
|
|
|
+ <th>商品图片</th>
|
|
|
+ <th>商品名称</th>
|
|
|
+ <th>供应商</th>
|
|
|
+ <th>机构价</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </thead>
|
|
|
+ <tbody id="contentTbody">
|
|
|
+ <c:forEach items="${cmOrganizePromotion.promotionProducts}" var="product">
|
|
|
+ <tr>
|
|
|
+ <th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
|
|
|
+ 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>
|
|
|
+ <td>${product.price1}</td>
|
|
|
+ <td>
|
|
|
+ <a href="javaScript:;"
|
|
|
+ onclick="deleteProduct('${product.productID}',${product.storeStatus},1)">删除</a>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </c:forEach>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </c:if>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="control-group" id="promotionType">
|
|
|
+ <label>促销方式:</label>
|
|
|
+ <input type="radio" id="promotionType1" name="mode" value="1" ${cmOrganizePromotion.mode == null ? "checked" : cmOrganizePromotion.mode == "1"?"checked":""} />优惠价
|
|
|
+ <input type="radio" id="promotionType2" name="mode" value="2" ${cmOrganizePromotion.mode == "2" ? "checked" : ""} />满减
|
|
|
+ <input type="radio" id="promotionType3" name="mode" value="3" ${cmOrganizePromotion.mode == "3" ? "checked" : ""} />满赠
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="control-group">
|
|
|
+ <label style="display: inline"><label style="color: red">*</label>优惠内容:</label>
|
|
|
+ <div id="discountContent1" style="display: ${cmOrganizePromotion.mode == null ? "inline" : cmOrganizePromotion.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)"/>
|
|
|
+ </div>
|
|
|
+ <div id="discountContent2" style="display: ${cmOrganizePromotion.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)"/>
|
|
|
+ <label><font color="red">减</font></label>
|
|
|
+ <form:input path="reducedPrice" id="reducedPrice" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
|
|
|
+ </div>
|
|
|
+ <div id="discountContent3" style="display: ${cmOrganizePromotion.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)"/>
|
|
|
+ <label><a href="JavaScript:;" onclick="showSelect(2)">请选择赠品</a></label>
|
|
|
+ <c:if test="${cmOrganizePromotion.giftProducts !=null and cmOrganizePromotion.giftProducts.size()>0}">
|
|
|
+ <table id="contentTable" class="table table-striped table-bordered table-condensed">
|
|
|
+ <thead>
|
|
|
+ <th style="width:20px;" class="hide"></th>
|
|
|
+ <th></th>
|
|
|
+ <th>商品图片</th>
|
|
|
+ <th>商品名称</th>
|
|
|
+ <th>供应商</th>
|
|
|
+ <th>数量</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </thead>
|
|
|
+ <tbody id="contentTbody1">
|
|
|
+ <c:forEach items="${cmOrganizePromotion.giftProducts}" var="product">
|
|
|
+ <tr>
|
|
|
+ <td>赠</td>
|
|
|
+ <th class="hide"><input class="check-item" type="checkbox" id="giftCheckItem"
|
|
|
+ name="gift" ${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>
|
|
|
+ <td><input id="actPrice1" name="giftNumber" style="width:50px;"
|
|
|
+ value="${product.giftNumber}" type="number" maxlength="7" step="1"></td>
|
|
|
+ <td>
|
|
|
+ <a href="javaScript:;"
|
|
|
+ onclick="deleteProduct('${product.productID}',${product.storeStatus},2)">删除</a>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </c:forEach>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </c:if>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="control-group">
|
|
|
+ <label>促销时效:</label>
|
|
|
+ <input type="radio" name="status" value="1" ${cmOrganizePromotion.status == null ? "checked" : cmOrganizePromotion.status == "1"?"checked":""} />永久
|
|
|
+ <input type="radio" name="status" value="2" ${cmOrganizePromotion.status == "2" ? "checked" : ""} />区间有效
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="control-group" id="begin" style="display: ${cmOrganizePromotion.status == null ? "none" : cmOrganizePromotion.status == "1"?"none":""}" >
|
|
|
+ <label>开始时间:</label>
|
|
|
+ <input name="beginTime" type="text" readonly="readonly" maxlength="20"
|
|
|
+ class="input-medium Wdate required" id="beginTime"
|
|
|
+ value="<fmt:formatDate value="${cmOrganizePromotion.beginTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
|
|
|
+ onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="control-group" id="end" style="display: ${cmOrganizePromotion.status == null ? "none" : cmOrganizePromotion.status == "1"?"none":""}" >
|
|
|
+ <label>结束时间:</label>
|
|
|
+ <input name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
|
|
|
+ id="endTime"
|
|
|
+ value="<fmt:formatDate value="${cmOrganizePromotion.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
|
|
|
+ onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="control-group">
|
|
|
+ <label style="display: inline" id="testStatus">促销状态:</label>
|
|
|
+ <label style="display: inline;color: ${cmOrganizePromotion.delFlag1 == null || cmOrganizePromotion.delFlag1 == '' ?"green":cmOrganizePromotion.delFlag1 == "0"?"red":cmOrganizePromotion.delFlag1 == "1"?"purple":cmOrganizePromotion.delFlag1 == "2"?"green":"orange"}" id="promotionStatus" >${cmOrganizePromotion.delFlag1 == null || cmOrganizePromotion.delFlag1 == '' ?"进行中":cmOrganizePromotion.delFlag1 == "0"?"已关闭":cmOrganizePromotion.delFlag1 == "1"?"未开始":cmOrganizePromotion.delFlag1 == "2"?"进行中":"已结束"}</label>
|
|
|
+ <input type="checkbox" id="delFlag1" name="delFlag1" value="close" ${cmOrganizePromotion.delFlag1 == null?"":cmOrganizePromotion.delFlag1 == "0" ? "checked" : ""} />关闭
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form-actions">
|
|
|
+ <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
|
|
|
+ <a href="${ctx}/weisha/cmOrganizePromotions/?type=1"><input id="btnCancel" class="btn" type="button" value="返 回" /></a>
|
|
|
+ </div>
|
|
|
+</form:form>
|
|
|
+<script type="text/javascript">
|
|
|
+ $(function () {
|
|
|
+ })
|
|
|
+
|
|
|
+ //促销方式修改
|
|
|
+ $("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");
|
|
|
+ } else {
|
|
|
+ $("#discountContent1").attr("style","display:none");
|
|
|
+ $("#discountContent2").attr("style","display:none");
|
|
|
+ $("#discountContent3").attr("style","display:inline");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //促销时效修改
|
|
|
+ $("input:radio[name='status']").click(function () {
|
|
|
+ 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");
|
|
|
+ if (null == promotiondelFlag1) {
|
|
|
+ $("#promotionStatus").text("进行中");
|
|
|
+ $("#promotionStatus").attr("style", "display: inline;color:green");
|
|
|
+ }
|
|
|
+ }else if ("2" == promotionStatus) {
|
|
|
+ $("#begin").attr("style","");
|
|
|
+ $("#end").attr("style","");
|
|
|
+ if (null == promotiondelFlag1) {
|
|
|
+ updateStatus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //促销日期修改
|
|
|
+ $("#beginTime").blur(function () {
|
|
|
+ var promotiondelFlag1 = $("input[name='delFlag1']:checked").val();
|
|
|
+ if (null == promotiondelFlag1) updateStatus()
|
|
|
+ });
|
|
|
+ $("#endTime").blur(function () {
|
|
|
+ var promotiondelFlag1 = $("input[name='delFlag1']:checked").val();
|
|
|
+ if (null == promotiondelFlag1) updateStatus()
|
|
|
+ });
|
|
|
+ //促销状态修改
|
|
|
+ $("input:checkbox[name='delFlag1']").click(function () {
|
|
|
+ var promotiondelFlag1 = $("input[name='delFlag1']:checked").val();
|
|
|
+
|
|
|
+ if (promotiondelFlag1 != null) {
|
|
|
+ $("#promotionStatus").text("已关闭");
|
|
|
+ $("#promotionStatus").attr("style", "display: inline;color:red");
|
|
|
+ }else {
|
|
|
+ var promotionStatus = $("input[name='status']:checked").val();
|
|
|
+ if ("1" == promotionStatus) {
|
|
|
+ $("#promotionStatus").text("进行中");
|
|
|
+ $("#promotionStatus").attr("style", "display: inline;color:green");
|
|
|
+ } else updateStatus()
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ function updateStatus() {
|
|
|
+ var beginTime = $("#beginTime").val();
|
|
|
+ var beginMs = new Date(beginTime).getTime();
|
|
|
+ var endTime = $("#endTime").val();
|
|
|
+ var endMs = new Date(endTime).getTime();
|
|
|
+ var nowMs = new Date().getTime();
|
|
|
+ if (nowMs < beginMs) {
|
|
|
+ $("#promotionStatus").text("未开始");
|
|
|
+ $("#promotionStatus").attr("style", "display: inline;color:purple");
|
|
|
+ } else if (nowMs > endMs) {
|
|
|
+ $("#promotionStatus").text("已结束");
|
|
|
+ $("#promotionStatus").attr("style", "display: inline;color:orange");
|
|
|
+ } else {
|
|
|
+ $("#promotionStatus").text("进行中");
|
|
|
+ $("#promotionStatus").attr("style", "display: inline;color:green");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param obj
|
|
|
+ * jquery控制input只能输入数字
|
|
|
+ */
|
|
|
+ function onlynum(obj) {
|
|
|
+ obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
|
|
|
+ }
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|