File: /var/www/html/wp-content/themes/frameMyrskyNew/quickQuote.php
<div id='quickQuote'>
<?php
	//include  'pager_helper.php';
    include_once  'clientConfig.php';
	
	//长度单位
	if(empty($length_unit)){
		$length_unit = 'cm';//cm,mm
	}
	
	
	// $className="ErpGetOffer";
	
	// $ws = "$location/material_manage/{$className}.wsdl";
	// $c_arr = array('location'=>$location.$path.$file."?className={$className}",'uri'=>$uri);//?className={$className}
	// $client = new SoapClient($ws,$c_arr);
	// $rs = $client->__soapCall("getSuggestQty", array('fab'));
	$rs = trim(file_get_contents("./data/getSuggestQty.d"));
	$qty_list_info = unserialize($rs);
	if($qty_list_info["code"] == '200'){		
		$qty_list = $qty_list_info['data'];
		$limit =  intval($qty_list_info['cond']['v_lq']);
	}
	else{
		$qty_list = array();
	}
	foreach($qty_list as $qty){
		$qty_options .=  "<option value='$qty'>$qty</option>";
	}
	$qty_options .=  "<option value='other'>其他</option>";	
	//$limit_msg = "less or equal $limit ,we only allow the select list qtys !";
	$limit = $limit + 1;
	$limit_msg = "数量如果小于$limit,请选择下拉列表中提供的数量";//"Quantity Need Larger Than $limit. Please chose the list quantities if less than $limit .";
	$none_msg = "请输入数量 !";//"Please enter the qty which your select other !";
	$dimension_msg = "请输入全部尺寸 !";//"Please enter the whole Dimensions !";
	$int_qty_msg = "请输入正确的数量 !";//"Plsease enter a positive integer for qty !"; 
	$int_dm_msg = "请输入正确的尺寸 !";//"Plsease enter a positive float for dimensions !"; 
?>
<script type="text/javascript" src="<?php bloginfo('stylesheet_directory')?>/js/jquery1.7.2.min.js"></script>
<script>
$(function(){
	$("input").blur(function(){
		console.log($(this).val());
		getrealquote();
	});
	$("select").change(function(){
		console.log($(this).val());
		getrealquote();
	});
	getrealquote();
});
function getrealquote(){
	console.log('ajax');
	
	var quick_layer = $("#quick_layer").val();
	var quick_sizex = $("#quick_sizex").val();
	var quick_sizey = $("#quick_sizey").val();
	var quick_qty = $("#quick_qty").val();
	var qty_unit = $("#qty_unit").val();
	var silkscreen = $("#silkscreen").val();
	if(quick_sizex > 0 && quick_sizey > 0){
		var str1 = "&quick_layer=" + quick_layer + "&quick_sizex=" + quick_sizex + "&quick_sizey=" + quick_sizey + "&quick_qty=" + quick_qty + "&qty_unit=" + qty_unit + "&silkscreen=" + silkscreen;
		$("#quick_total_price").html('价格加载中...');
		$.ajax({
			type: "GET",
			url: "http://crm.myrsky.com.cn:8079/ERP/loadscript.php?user_email={user_email}&AjaxAction=get_quick_quote_price" + str1,		   
			dataType: "json",
			async: false, 
			success: function(msg){			
				console.log(msg);
				 if(msg.result == 1){							  		   		
						console.log('quote_success');
						$("#quick_total_price").html(msg.data[6]);
				  }
			},
		   error:function(a,b,c){
			   alert(a+b+c);
		   }
		});
	}
	
}
function fab_quick_quote(){
	console.log('click');
	if(document.getElementById('quick_sizey').value==''){
		 document.getElementById('tip1').innerHTML='注意:<?echo $dimension_msg?>';
		 document.getElementById('quick_sizey').focus();
		 return false;
	   } 
	  if(!/^\d+(\.\d+)?$/.test(document.getElementById('quick_sizey').value)){
		document.getElementById('tip1').innerHTML='注意:<?echo $int_dm_msg?>';
		 document.getElementById('quick_sizey').focus();
		 return false;
	  }
	 if(document.getElementById('quick_sizex').value==''){
	    document.getElementById('tip1').innerHTML='注意:<?echo $dimension_msg?>';
		document.getElementById('quick_sizex').focus();
		return false;
	 }
	 if(!/^\d+(\.\d+)?$/.test(document.getElementById('quick_sizex').value)){
		 document.getElementById('tip1').innerHTML='注意:<?echo $int_dm_msg?>';
		 document.getElementById('quick_sizex').focus();
		 return false;
	  }	 
	 if(document.getElementById('quick_qty').value=='other' && 
	   document.getElementById('quick_qty_other').value==''){
	   document.getElementById('tip1').innerHTML='注意:<?echo $none_msg ?>';
	   document.getElementById('quick_qty_other').focus();
	   return flase;
	 }
	 if(document.getElementById('quick_qty').value=='other' && parseInt(document.getElementById('quick_qty_other').value) < parseInt('<?echo $limit ?>')){
		document.getElementById('tip1').innerHTML='注意:<?echo $limit_msg ?>';
		document.getElementById('quick_qty_other').focus();
		return false;
	  }
	  var r = /^\+?[1-9][0-9]*$/;
	  if(document.getElementById('quick_qty').value=='other' && !r.test(document.getElementById('quick_qty_other').value)){
		document.getElementById('tip1').innerHTML='注意:<?echo $int_qty_msg ?>';
		document.getElementById('quick_qty_other').focus();
		return false;
	  }
	   
	   var get_url = '';
	   if(document.getElementById('quick_qty_other').value){
			get_url = '&required_quantity=' + document.getElementById('quick_qty_other').value + '&qty_unit=' + document.getElementById('qty_unit').value;
	   }else{
			get_url = '&required_quantity=' + document.getElementById('quick_qty').value + '&qty_unit=' + document.getElementById('qty_unit').value;
	   }
	window.location.href= 'http://crm.myrsky.com.cn:8079/电路板下单/线路板报价-2/?q_qty_other='+document.getElementById('quick_qty_other').value+'&q_qty='+document.getElementById('quick_qty').value+'&sizey='+document.getElementById('quick_sizey').value+'&sizex='+document.getElementById('quick_sizex').value+get_url+'&layer='+document.getElementById('quick_layer').value+'&silkscreen=' + document.getElementById('silkscreen').value +'&size_unit=<?php echo $length_unit; ?>&finished=HASL&quick_quote=1&quick_quote_link=1';
}
</script>
		<span style="letter-spacing: 7px;font-size: 16px;line-height: 19px;color: #0D2A58;">即时</span>
		<span style="letter-spacing: 7px;font-size: 16px;line-height: 19px;color: #7F7F7F;">报价!</span>
	<hr style="margin-bottom:10px;"/>
<table class="quickQuote_table">
	<tr>
	<td>
	</td>
	<td colspan="3">
	<label id="tip1" class='smallblacktitle'></label>
	</td>
	
	</tr>
	<tr>
	<td>
	<span class='h2like'>层数:</span> 
	</td>
	<td>
	<select  id='quick_layer' name='quick_layer'>
	<option value='1'>1</option>
	<option value='2' selected>2</option>
	<option value='4'>4</option>
	<option value='6'>6</option>
	</select>
	</td>
	<td>
	</td>
	<td>
	</td>
	</tr>
	
	<tr>
	<td>
	<span class='h2like'>长:</span>
	</td>
	<td>
	<input
		onkeyup="document.getElementById('tip1').innerHTML='';" value="5" style="color:#C1C1C1"
		id='quick_sizex' type='text' class='qsftxt' onfocus="if(this.value=='<?php echo $length_unit; ?>'){this.value='';this.style.color=''}"  onblur="if(this.value==''){this.value='<?php echo $length_unit; ?>';this.style.color='#C1C1C1'}"/>
	cm</td>
	</td>
	<td>
	<span class='h2like'>宽:</span>
	</td>
	<td>
	<input
		onkeyup="document.getElementById('tip1').innerHTML='';" value="5" style="color:#C1C1C1"
		id='quick_sizey' type='text' class='qsftxt' onfocus="if(this.value=='<?php echo $length_unit; ?>'){this.value='';this.style.color=''}"  onblur="if(this.value==''){this.value='<?php echo $length_unit; ?>';this.style.color='#C1C1C1'}"/>
	cm</td>
	</tr><tr>
	<td>
	 <span class='h2like'>数量:</span> 
	</td>
	<td>
	<select
		id='quick_qty'
		onchange="if(document.getElementById('quick_qty').value=='other'){document.getElementById('quick_qty_other').style.display = '';}else{document.getElementById('tip1').innerHTML='';document.getElementById('quick_qty_other').value='';document.getElementById('quick_qty_other').style.display = 'none'}">
		<? echo $qty_options ?>
	</select>
	</td>
	<td>
	</td>
	<td >
	<input id='quick_qty_other'
		onclick="var oTip = document.getElementById('tip1');if (this.value==''){oTip.innerHTML ='注意:'+this.title ;}else{oTip.innerHTML = '';}"
		onkeyup="var oTip = document.getElementById('tip1');if (this.value==''){oTip.innerHTML ='注意:'+this.title ;}else{oTip.innerHTML = '';}"
		type='text' title='最小 <? echo $limit ?>' class='qsftxt'
		style='display: none' />
	</td>
	</tr>
	<tr>
	<td>
	<span
		class='h2like'>单位:</span>
	</td>
	<td>
	<select id='qty_unit'><option
			value='Piece'>片</option>
		<option value='Panel'>拼</option>
	</select> 
	</td>
	</tr>
	<tr>
	<td>
	<span
		class='h2like'>字符:</span>
	</td>
	<td><select id='silkscreen'><option value="Top" selected="">顶层</option>
<option value="Bottom">底层</option>
<option value="Double">双面</option>
<option value="None">无</option></select> 
</td>
<td colspan="2">
	
	<font color='#3A3C3C'><b>  费用总计:</b></font>
	<font color='#ED7121'><b><span id='quick_total_price'></span></b></font>
	</td>
	</tr>
	<tr>
	<td colspan ="4" style="padding-left:65px;">
	
	<!-- <div class="quickQuote_btn_s"  ></div> -->
	<button class="btn-hover color-7" onclick="fab_quick_quote()">立即报价</button>
	<a href="javascript:void(0)" class="font12_gray" onclick="fab_quick_quote()" style="Display:none">快速下单</a>
	</td>
	</tr>
	<tr style="Display:none">
	<td colspan ="4">
	<div class="quickQuote_btn" 
	onclick="
	   if(document.getElementById('quick_sizey').value==''){
		 document.getElementById('tip1').innerHTML='注意:<?echo $dimension_msg?>';
		 document.getElementById('quick_sizey').focus();
		 return false;
	   } 
	  if(!/^\d+(\.\d+)?$/.test(document.getElementById('quick_sizey').value)){
		document.getElementById('tip1').innerHTML='注意:<?echo $int_dm_msg?>';
		 document.getElementById('quick_sizey').focus();
		 return false;
	  }
	 if(document.getElementById('quick_sizex').value==''){
	    document.getElementById('tip1').innerHTML='注意:<?echo $dimension_msg?>';
		document.getElementById('quick_sizex').focus();
		return false;
	 }
	 if(!/^\d+(\.\d+)?$/.test(document.getElementById('quick_sizex').value)){
		 document.getElementById('tip1').innerHTML='注意:<?echo $int_dm_msg?>';
		 document.getElementById('quick_sizex').focus();
		 return false;
	  }	 
	 if(document.getElementById('quick_qty').value=='other' && 
	   document.getElementById('quick_qty_other').value==''){
	   document.getElementById('tip1').innerHTML='注意:<?echo $none_msg ?>';
	   document.getElementById('quick_qty_other').focus();
	   return flase;
	 }
	 if(document.getElementById('quick_qty').value=='other' && parseInt(document.getElementById('quick_qty_other').value) < parseInt('<?echo $limit ?>')){
		document.getElementById('tip1').innerHTML='注意:<?echo $limit_msg ?>';
		document.getElementById('quick_qty_other').focus();
		return false;
	  }
	  var r = /^\+?[1-9][0-9]*$/;
	  if(document.getElementById('quick_qty').value=='other' && !r.test(document.getElementById('quick_qty_other').value)){
		document.getElementById('tip1').innerHTML='注意:<?echo $int_qty_msg ?>';
		document.getElementById('quick_qty_other').focus();
		return false;
	  }
	   
	   var get_url = '';
	   if(document.getElementById('quick_qty_other').value){
			get_url = '&required_quantity=' + document.getElementById('quick_qty_other').value + '&qty_unit=' + document.getElementById('qty_unit').value;
	   }else{
			get_url = '&required_quantity=' + document.getElementById('quick_qty').value + '&qty_unit=' + document.getElementById('qty_unit').value;
	   }
	  window.location.href=getJumpURL('<?php echo get_option('home'); ?>/电路板下单/线路板报价-2/?q_qty_other='+document.getElementById('quick_qty_other').value+'&q_qty='+document.getElementById('quick_qty').value+'&sizey='+document.getElementById('quick_sizey').value+'&sizex='+document.getElementById('quick_sizex').value+get_url+'&layer='+document.getElementById('quick_layer').value+'&silkscreen=' + document.getElementById('silkscreen').value +'&q_unit=<?php echo $length_unit; ?>&quick_quote=1')" 
			id='quick_apply' alt="PCB标准版" 
	id='quick_apply'></div>
	</td>
	</tr>
	</table>
</div>