|
@ -86,6 +86,26 @@ function changeCalType(type){//当切换计算方式 |
|
|
} |
|
|
} |
|
|
calType = type; |
|
|
calType = type; |
|
|
} |
|
|
} |
|
|
|
|
|
//金额补全
|
|
|
|
|
|
function toFixeds(val, pre) { |
|
|
|
|
|
const num = parseFloat(val); |
|
|
|
|
|
// eslint-disable-next-line no-restricted-globals
|
|
|
|
|
|
if (isNaN(num)) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
const p = 10 ** pre; |
|
|
|
|
|
const value = num * p; |
|
|
|
|
|
let f = (Math.round(value) / p).toString(); |
|
|
|
|
|
let rs = f.indexOf('.'); |
|
|
|
|
|
if (rs < 0) { |
|
|
|
|
|
rs = f.length; |
|
|
|
|
|
f += '.'; |
|
|
|
|
|
} |
|
|
|
|
|
while (f.length <= rs + pre) { |
|
|
|
|
|
f += '0'; |
|
|
|
|
|
} |
|
|
|
|
|
return f; |
|
|
|
|
|
} |
|
|
$(document).ready(function(){ |
|
|
$(document).ready(function(){ |
|
|
$("#expressarea-basic_count").blur(function(){ |
|
|
$("#expressarea-basic_count").blur(function(){ |
|
|
if(isNaN($(this).val())){ |
|
|
if(isNaN($(this).val())){ |
|
@ -96,8 +116,7 @@ $(document).ready(function(){ |
|
|
$(this).val(1) |
|
|
$(this).val(1) |
|
|
} |
|
|
} |
|
|
var basiccount = $(this).val(); |
|
|
var basiccount = $(this).val(); |
|
|
// $(this).val(Math.floor(basiccount * 10) / 10);
|
|
|
|
|
|
$(this).val(basiccount.toString().match(/^\d+(?:\.\d{0,1})?/)); |
|
|
|
|
|
|
|
|
$(this).val(toFixeds($(this).val(), 1)); |
|
|
} else{ |
|
|
} else{ |
|
|
if($(this).val() < 1){ |
|
|
if($(this).val() < 1){ |
|
|
$(this).val(1) |
|
|
$(this).val(1) |
|
@ -114,7 +133,7 @@ $(document).ready(function(){ |
|
|
$(this).val("0.00") |
|
|
$(this).val("0.00") |
|
|
} |
|
|
} |
|
|
var basicPrice = $(this).val(); |
|
|
var basicPrice = $(this).val(); |
|
|
$(this).val(basicPrice.toString().match(/^\d+(?:\.\d{0,2})?/)); |
|
|
|
|
|
|
|
|
$(this).val(toFixeds($(this).val(), 2)); |
|
|
}) |
|
|
}) |
|
|
$("#expressarea-extra_count").blur(function(){ |
|
|
$("#expressarea-extra_count").blur(function(){ |
|
|
if(isNaN($(this).val())){ |
|
|
if(isNaN($(this).val())){ |
|
@ -125,7 +144,7 @@ $(document).ready(function(){ |
|
|
$(this).val(0) |
|
|
$(this).val(0) |
|
|
} |
|
|
} |
|
|
var basiccount = $(this).val(); |
|
|
var basiccount = $(this).val(); |
|
|
$(this).val(Math.floor(basiccount * 10) / 10); |
|
|
|
|
|
|
|
|
$(this).val(toFixeds($(this).val(), 1)); |
|
|
} else{ |
|
|
} else{ |
|
|
if($(this).val() < 0){ |
|
|
if($(this).val() < 0){ |
|
|
$(this).val(0) |
|
|
$(this).val(0) |
|
@ -142,7 +161,7 @@ $(document).ready(function(){ |
|
|
$(this).val("0.00") |
|
|
$(this).val("0.00") |
|
|
} |
|
|
} |
|
|
var basicPrice = $(this).val(); |
|
|
var basicPrice = $(this).val(); |
|
|
$(this).val(basicPrice.toString().match(/^\d+(?:\.\d{0,2})?/)); |
|
|
|
|
|
|
|
|
$(this).val(toFixeds($(this).val(), 2)); |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
$("input:radio[name='ExpressArea[calculation_type]']").on('ifChecked', function(event){ |
|
|
$("input:radio[name='ExpressArea[calculation_type]']").on('ifChecked', function(event){ |
|
|