Browse Source

修改货道自动生成中奖范围

xubh 5 years ago
parent
commit
9fee808451
1 changed files with 49 additions and 4 deletions
  1. 49 4
      src/main/webapp/admin/machineManage/editEquproduct.html

+ 49 - 4
src/main/webapp/admin/machineManage/editEquproduct.html

@@ -49,11 +49,11 @@
 		<div class="layui-form-item">
 		    <label class="layui-form-label">*售货价:</label>
 		    <div class="layui-input-inline">
-		        <input type="text" name="sallPrice" maxlength="30" id ="sallPrice" lay-verify="sallPrice" autocomplete="off" placeholder="请输入售货价" class="layui-input">
+		        <input  type="number"  onblur="value=zhzs(this.value)"  name="sallPrice" placeholder="¥"  maxlength="30" id ="sallPrice" lay-verify="sallPrice" autocomplete="off" placeholder="请输入售货价" class="layui-input">
 		    </div>
 		    <label class="layui-form-label">*成本价:</label>
 		    <div class="layui-input-inline">
-		        <input type="text" name="costPrice" maxlength="30" id ="costPrice" lay-verify="costPrice" autocomplete="off" placeholder="请输入成本价" class="layui-input">
+		        <input type="text"   onblur="value=zhzs(this.value)"  name="costPrice" maxlength="30" id ="costPrice" lay-verify="costPrice" autocomplete="off" placeholder="请输入成本价" class="layui-input">
 		    </div>
 		
 		</div>
@@ -63,14 +63,14 @@
             </div>
            <label class="layui-form-label">*促销价:</label>
 		    <div class="layui-input-inline">
-		        <input type="text" name="promottonPrice" maxlength="30" id ="promottonPrice" lay-verify="promottonPrice" autocomplete="off" placeholder="请输入促销价" class="layui-input">
+		        <input type="text"  onblur="value=zhzs(this.value)"  name="promottonPrice" maxlength="30" id ="promottonPrice" lay-verify="promottonPrice" autocomplete="off" placeholder="请输入促销价" class="layui-input">
 		    </div>
 		    
 		</div>		
 		<div class="layui-form-item" >
 		    <label class="layui-form-label">*游戏价:</label>
 		    <div class="layui-input-inline">
-		        <input type="text" name="gamePrice" maxlength="30" id ="gamePrice" lay-verify="gamePrice" autocomplete="off" placeholder="请输入游戏价" class="layui-input">
+		        <input type="text"  onblur="value=zhzs(this.value)"  name="gamePrice" maxlength="30" id ="gamePrice" lay-verify="gamePrice" autocomplete="off" placeholder="请输入游戏价" class="layui-input">
 		    </div>
 		</div>
 		<div class="layui-form-item" id = "game" >
@@ -245,6 +245,9 @@
 				if(type == '02'){
 					var price_min = $('#price_min').val();
 					var price_max = $('#price_max').val();
+
+
+
 					if(isEmpty(price_min)){
 						layer.msg('中奖范围不能为空',function() {time:2000});
 						return false;
@@ -253,6 +256,14 @@
 						layer.msg('中奖范围不能为空',function() {time:2000});
 						return false;
 					}
+					if(isNaN(price_min)){
+						layer.msg('中奖范围类型错误',function() {time:2000});
+						return false;
+					}
+					if(isNaN(price_max)){
+						layer.msg('中奖范围类型错误',function() {time:2000});
+						return false;
+					}
 					data.field.drawAmount = price_min+'-'+price_max;
 				}
 	  			$.request({
@@ -373,6 +384,40 @@
         });
 	 })
 	initSelect('isPromotton', "IS_PROMOTION", "isPromotton", '', true);
+	//(商品售价+促销价)~(商品售价+游戏价)
+	$("#sallPrice").bind('input propertychange',function(){
+		zjfwstr();
+	});
+	$("#gamePrice").bind('input propertychange',function(){
+		zjfwstr();
+	});
+	$("#promottonPrice").bind('input propertychange',function(){
+		zjfwstr();
+	});
+	function  zjfwstr() {
+		var type =$("#type").val();
+		if(type == '02'){
+			//售价
+			var sallPrice = parseInt($('#sallPrice').val()); ;
+			//游戏价
+			var gamePrice = parseInt($('#gamePrice').val());
+			//促销价
+			var promottonPrice = parseInt($('#promottonPrice').val());
+			$('#price_min').val(sallPrice + promottonPrice);
+			$('#price_max').val(sallPrice + gamePrice);
+		}
+
+	}
+	/*自定义处理数字*/
+	function zhzs(value) {
+		value = value.replace(/[^\d]/g, '').replace(/^0{1,}/g, '');
+		if (value != '')
+			value = parseFloat(value).toFixed(2);
+		else
+			value = parseFloat(0).toFixed(2);
+		return value;
+	}
+
     </script>
 </body>