Aslee il y a 3 ans
Parent
commit
c9cf193f08

+ 2 - 1
src/main/resources/mappings/modules/svip/CmSvipProductMapper.xml

@@ -88,7 +88,8 @@
         FROM product a
         LEFT JOIN shop s on s.shopID = a.shopID
         <where>
-            a.validFlag = '2' and a.productID not in (
+            a.validFlag = '2' and a.productCategory = '1'
+             and a.productID not in (
             select productId from cm_promotions_product cpp left join
             cm_promotions cp on cpp.promotionsId = cp.id where cp.delFlag != '2')
             and a.ladderPriceFlag = '0' and price1TextFlag != '1'

+ 41 - 2
src/main/webapp/WEB-INF/views/modules/svip/cmSvipProductForm.jsp

@@ -110,12 +110,12 @@
 		</div>
 		<div class="control-group discountInput" hidden>
 			<div class="controls">
-				<form:input path="discount" htmlEscape="false" class="input-medium required"/> %
+				<form:input path="discount" htmlEscape="false" onchange="changeDiscount(this,1)" class="input-medium required"/> %
 			</div>
 		</div>
 		<div class="control-group discountPriceInput" hidden>
 			<div class="controls">
-				<form:input path="discountPrice" htmlEscape="false" class="input-medium required"/>
+				<form:input path="discountPrice" htmlEscape="false" onchange="changeDiscount(this,2)" class="input-medium required"/>
 			</div>
 		</div>
 		<div class="control-group">
@@ -147,6 +147,45 @@
 			$(".discountPriceInput").show();
 		}
 	}
+
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+
+	/**
+	 * 更改折扣/折扣价
+	 */
+	function changeDiscount(obj,priceType) {
+		debugger
+		var val = obj.value;
+		var number = Number(val).toFixed(2);
+		if (priceType == 1) {
+			if (val > 100 || val <0) {
+				$.jBox.tip("请输入0-100之间的数字", 'info');
+				obj.value = '';
+			}else {
+				if (number == 'NaN') {
+					$.jBox.tip("请输入正确的数字", 'info');
+					obj.value = '';
+				} else {
+					obj.value = number;
+				}
+			}
+		} else {
+			if (val != '' && val != undefined) {
+				if (number == 'NaN') {
+					$.jBox.tip("请输入正确的数字", 'info');
+					obj.value = '';
+				} else {
+					obj.value = number;
+				}
+			}
+		}
+	}
 </script>
 </body>
 </html>

+ 0 - 1
src/main/webapp/WEB-INF/views/modules/svip/svipAddProduct.jsp

@@ -142,7 +142,6 @@
      * 更改折扣/折扣价
      */
     function changeDiscount(productId,priceType) {
-        debugger
         if (priceType == 1) {
             var val = $("#discount" + productId).val();
             if (val > 100 || val <0) {