Commit b23c3125 by 朱继来

限制售后单价

parent c42aab58
......@@ -31,14 +31,29 @@
return false;
}
var is_one_empty = false; // 同一行的售后数量或单价中一个为空
$('.order-service-table').find('tbody tr').each(function() {
var goods_number = $(this).find('.adjust_number').val();
var goods_price = $(this).find('.adjust_price').val();
if (!goods_number && goods_price) {
layer.tips('请填写数量', $(this).find('.adjust_number'));
is_one_empty = true;
return false;
}
if (goods_number && !goods_price) {
layer.tips('请填写单价', $(this).find('.adjust_price'));
is_one_empty = true;
return false;
}
if (goods_number) is_all_num_empty = true;
if (goods_price) is_all_price_empty = true;
})
if (is_one_empty) return false;
if (!is_all_num_empty) {
layer.msg('请填写申请数量');
return false;
......@@ -75,7 +90,7 @@
}
})
// layer.msg('申请中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
layer.msg('申请中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2: function(index, layero){
layer.close(index);
......@@ -103,7 +118,7 @@
if (!val) return false;
if (!(/\d/.test(val)) || val <= 0) {
layer.msg('只能是数字,且为正整数');
layer.tips('只能是数字,且为正整数', $(this));
$(this).val('');
return false;
}
......@@ -114,7 +129,7 @@
var origin_amount = goods_price * (goods_number - service_goods_number); // 商品可退金额
if (val > (goods_number - service_goods_number)) {
layer.msg('不能超过订单数量');
layer.tips('不能超过订单数量', $(this));
$(this).val('');
return false;
}
......@@ -123,7 +138,7 @@
var adjust_amount = adjust_price * val;
if (adjust_amount > origin_amount) {
layer.msg('不能超过该条商品可退金额');
layer.tips('不能超过该条商品可退金额', $(this));
$(this).val('');
return false;
}
......@@ -138,15 +153,16 @@
if(!(/^\d{0,6}(\.\d{0,6})?$/g.test(val))){//判断输入是否合法,不合法强制转换
if(isNaN(parseFloat(val))){
layer.msg('只能是数字和小数组成');
layer.tips('只能是数字和小数组成', $(this));
$(this).val('');
return false;
}else{
$(this).val(parseFloat(val).toFixed(6));
}
}
if (val < 0) {
layer.msg('只能是正整数');
layer.tips('只能是正整数', $(this));
$(this).val('');
return false;
}
......@@ -158,13 +174,22 @@
if(val.length > 12){
$(this).val(val.slice(0, 12));
}
var single_pre_price = $(this).parents('tr').find('.single_pre_price').val();
if (val > single_pre_price) {
layer.tips('不能超过均摊单价', $(this));
$(this).val('');
return false;
}
}).blur(function() {
var val = $(this).val();
if (!val) return false;
if (val == 0) {
layer.msg('单价不能为0');
layer.tips('单价不能为0', $(this));
$(this).val('');
return false;
}
......@@ -178,7 +203,7 @@
var adjust_amount = adjust_number * val;
if (adjust_amount > origin_amount) {
layer.msg('不能超过该条商品可退金额');
layer.tips('不能超过该条商品可退金额', $(this));
$(this).val('');
return false;
}
......
......@@ -53,6 +53,7 @@
<tr>
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][rec_id]" value="{{ $v['rec_id'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][order_id]" value="{{ $v['order_id'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][erp_rec_id]" value="{{ $v['erp_rec_id'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][goods_id]" value="{{ $v['goods_id'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][goods_name]" value="{{ $v['goods_name'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][sku_name]" value="{{ $v['sku_name'] }}">
......@@ -61,7 +62,7 @@
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][supplier_id]" value="{{ $v['supplier_id'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][supplier_name]" value="{{ $v['supplier_name'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][goods_price]" value="{{ $v['goods_price'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][single_pre_price]" value="{{ $v['single_pre_price'] }}">
<input type="hidden" class="single_pre_price" name="service_item[{{ $v['rec_id'] }}][single_pre_price]" value="{{ $v['single_pre_price'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][goods_number]" value="{{ $v['goods_number'] }}">
<input type="hidden" name="service_item[{{ $v['rec_id'] }}][removal_number]" value="{{ $v['fqty'] }}">
<td>{{ $goods_count }}</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