diff --git a/backend/modules/shop/views/express-template/express_area_form.php b/backend/modules/shop/views/express-template/express_area_form.php index 940b46f..7864334 100755 --- a/backend/modules/shop/views/express-template/express_area_form.php +++ b/backend/modules/shop/views/express-template/express_area_form.php @@ -19,9 +19,7 @@ if ($status == 1) { -field($model, 'name')->textInput(['maxlength' => true]) ?> - -field($model, 'calculation_type')->widget(Icheck::className(), ["items" => ExpressTemplate::$calculationType, 'type' => "radio"]) ?> +field($model, 'express_template')->textInput(['maxlength' => true]) ?> field($model, 'basic_count')->textInput() ?> @@ -35,18 +33,18 @@ if ($status == 1) { $js=<<calculation_type}-1;//初始的计算方式0:计重 1:计件 function updateTypeChangeCalType(type){//当切换计算方式 @@ -62,10 +60,10 @@ function updateTypeChangeCalType(type){//当切换计算方式 $("." + index).children("label").html(value) }); - $("#expresstemplate-basic_count").val(udfVal[type][0])//重置初始值 - $("#expresstemplate-basic_price").val(udfVal[type][1]) - $("#expresstemplate-extra_count").val(0) - $("#expresstemplate-extra_price").val(udfVal[type][1]) + $("#expressarea-basic_count").val(udfVal[type][0])//重置初始值 + $("#expressarea-basic_price").val(udfVal[type][1]) + $("#expressarea-extra_count").val(0) + $("#expressarea-extra_price").val(udfVal[type][1]) calType = type; } function changeCalType(type){//当切换计算方式 @@ -74,44 +72,55 @@ function changeCalType(type){//当切换计算方式 $("." + index).children("label").html(value) }); - if(!$("#expresstemplate-basic_count").val()){ - $("#expresstemplate-basic_count").val(udfVal[type][0])//重置初始值 + if(!$("#expressarea-basic_count").val()){ + $("#expressarea-basic_count").val(udfVal[type][0])//重置初始值 } - if(!$("#expresstemplate-basic_price").val()){ - $("#expresstemplate-basic_price").val(udfVal[type][1]) + if(!$("#expressarea-basic_price").val()){ + $("#expressarea-basic_price").val(udfVal[type][1]) } - if(!$("#expresstemplate-extra_count").val()){ - $("#expresstemplate-extra_count").val(0) + if(!$("#expressarea-extra_count").val()){ + $("#expressarea-extra_count").val(0) } - if(!$("#expresstemplate-extra_price").val()){ - $("#expresstemplate-extra_price").val(udfVal[type][1]) + if(!$("#expressarea-extra_price").val()){ + $("#expressarea-extra_price").val(udfVal[type][1]) } calType = type; } $(document).ready(function(){ - $("#expresstemplate-basic_count").blur(function(){ + $("#expressarea-basic_count").blur(function(){ + if(isNaN($(this).val())){ + $(this).val(1) + } if (calType == 0) { if($(this).val() < 0.1){ - $(this).val(0.1) + $(this).val(1) } var basiccount = $(this).val(); - $(this).val(Math.floor(basiccount * 10) / 10); + // $(this).val(Math.floor(basiccount * 10) / 10); + $(this).val(basiccount.toString().match(/^\d+(?:\.\d{0,1})?/)); } else{ if($(this).val() < 1){ $(this).val(1) } var basiccount = $(this).val(); - $(this).val(Math.floor(basiccount * 1) / 1); + // $(this).val(Math.floor(basiccount * 1) / 1); + $(this).val(basiccount.toString().match(/^\d+(?:\.\d{0,0})?/)); } }) - $("#expresstemplate-basic_price").blur(function(){ + $("#expressarea-basic_price").blur(function(){ + if(isNaN($(this).val())){ + $(this).val("0.00") + } if($(this).val().indexOf('-') != -1){ $(this).val("0.00") } var basicPrice = $(this).val(); $(this).val(basicPrice.toString().match(/^\d+(?:\.\d{0,2})?/)); }) - $("#expresstemplate-extra_count").blur(function(){ + $("#expressarea-extra_count").blur(function(){ + if(isNaN($(this).val())){ + $(this).val(0) + } if (calType == 0) { if($(this).val() < 0){ $(this).val(0) @@ -126,7 +135,10 @@ $(document).ready(function(){ $(this).val(Math.floor(basiccount * 1) / 1); } }) - $("#expresstemplate-extra_price").blur(function(){ + $("#expressarea-extra_price").blur(function(){ + if(isNaN($(this).val())){ + $(this).val("0.00") + } if($(this).val().indexOf('-') != -1){ $(this).val("0.00") } @@ -134,7 +146,7 @@ $(document).ready(function(){ $(this).val(basicPrice.toString().match(/^\d+(?:\.\d{0,2})?/)); }) - $("input:radio[name='ExpressTemplate[calculation_type]']").on('ifChecked', function(event){ + $("input:radio[name='ExpressArea[calculation_type]']").on('ifChecked', function(event){ updateTypeChangeCalType($(this).val()-1) }) changeCalType(calType)