Просмотр исходного кода

促销商品列表商品id搜索1

Aslee 4 лет назад
Родитель
Сommit
257fd9a944

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

@@ -169,7 +169,7 @@
             cop.delFlag = 0
             and cop.status = 1
             and cop.organizeId = #{organizeId}
-            <if test="id != null">
+            <if test="id != null and id != ''">
                 AND cop.id = #{id}
             </if>
             <if test="productID != null">

+ 5 - 1
src/main/webapp/WEB-INF/views/modules/weisha/cmOrganizeProductList.jsp

@@ -122,6 +122,10 @@
 				$.jBox.confirm("确定下架该商品吗?", "提示", submit, { buttons: { '确认': true, '取消': false} });
 			}
 		}
+
+		function onlynum(obj) {
+			obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+		}
 	</script>
 </head>
 <body>
@@ -136,7 +140,7 @@
 		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
 		<div class="ul-form">
 			 <label>商品ID:</label>
-				<form:input path="id" htmlEscape="false" class="input-medium"/>
+				<form:input path="id" htmlEscape="false" class="input-medium" onkeyup="onlynum(this)"/>
 			<label>商品名称:</label>
 				<form:input path="productName" htmlEscape="false" class="input-large"/>
 			<label>供应商名称:</label>

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/weisha/findPromotionSingleProduct.jsp

@@ -22,8 +22,8 @@
             $("#searchForm").validate({
                 submitHandler: function (form) {
                     var isSubMitFlag = true;
-                    var productID = $("#productID").val();
-                    if (isNaN(productID) || productID.indexOf('0') == 0 ) {
+                    var productID = $("#id").val();
+                    if (isNaN(productID)) {
                         alertx("请输入正确的商品ID");
                         isSubMitFlag = false;
                         return false;