Commit 02d928ff by 朱继来

调整数量校验

parent ce24b594
......@@ -183,7 +183,34 @@
}
})
// 输入数量、单价校验
// 输入数量校验
$(document).off().delegate('.change_number', 'keyup', function(){
var val = $(this).val();
var reg = /^\d{0,8}$/g;
if(!val) return false;
if (!(reg.test(val))) {
if(isNaN(parseInt(val))){
layer.msg('只能是数字组成');
$(this).val('');
}else{
$(this).val(parseInt(val));
}
}
if (val < 0) {
layer.msg('只能是正整数');
$(this).val('');
return false;
}
if(val.length > 8){
$(this).val(val.slice(0, 8));
}
});
// 输入单价校验
$('#checkOrderForm').off().delegate('.only_number', 'keyup', function(){
if($(this).val() == '') return false;
......
......@@ -151,7 +151,7 @@
html += '<td>\
<input class="only_number num change_goods_number" name="change_info['+curr_no+'][goods_number]" value="'+order_item.goods_number+'">\
<input class="num change_number" name="change_info['+curr_no+'][goods_number]" value="'+order_item.goods_number+'">\
</td>\
<td>\
<input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+order_item.goods_price+'" value="'+order_item.goods_price+'">\
......@@ -357,7 +357,7 @@
<i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true" data-type=2></i>\
</td>\
<td>\
<input class="only_number num change_goods_number" name="change_info['+curr_no+'][goods_number]" value="'+add_goods_number+'">\
<input class="num change_number" name="change_info['+curr_no+'][goods_number]" value="'+add_goods_number+'">\
</td>\
<td>\
<input class="price only_number" name="change_info['+curr_no+'][goods_price]" data-price="'+add_goods_price+'" value="'+add_goods_price+'">\
......
......@@ -209,7 +209,7 @@
</td>
@endif
<td>
<input type="text" class="only_number num change_goods_number" name="change_info[{{$v['rec_id']}}][goods_number]" value="{{$v['goods_number']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>>
<input type="text" class="num change_number" name="change_info[{{$v['rec_id']}}][goods_number]" value="{{$v['goods_number']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>>
</td>
<td>
<input type="text" class="price only_number change_goods_price" name="change_info[{{$v['rec_id']}}][goods_price]" data-origin="{{$v['original_price']}}" data-price="{{$v['goods_price']}}" value="{{$v['goods_price']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>>
......@@ -217,7 +217,7 @@
<!-- 销售类型为预售时展示 -->
@if ($order_info['sale_type'] == 2)
<td>
<input type="text" class="only_number" name="change_info[{{$v['rec_id']}}][delivery_time]" value="{{$v['delivery_time']}}" placeholder="请填写天数">
<input type="text" class="change_number" name="change_info[{{$v['rec_id']}}][delivery_time]" value="{{$v['delivery_time']}}" placeholder="请填写天数">
</td>
<td>
<!-- 未锁库存 -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment