<%@page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ include file="header.jsp"%>
<script type="text/javascript" src="<%=webpath%>/js/business/coupon.js"></script>
<style>
	.search {
		margin: 30px 45px 10px 45px;
	}
	table.searchTable td {
	    width: 19.5%;
	    padding-bottom: 15px;
	}
	.dialog_con .datagrid .panel-body {
		border-bottom:1px solid #D3D3D3;
		height:400px;
	}
	.dialog_default {
		margin: 30px auto auto;
	}
</style>
<script type="text/javascript">
function query(){
	var vinCode=$("#vinCode").val();
	var license=$("#license").val();
	var userPhone=$("#userPhone").val();
	var electronicAccounts=$("#electronicAccounts").val();
	
	if((vinCode==null||vinCode=='')&&(license==null||license=='')&&(userPhone==null||userPhone=='')&&(electronicAccounts==null||electronicAccounts=='')){
		alert("查询条件不能为空");
		return;
	}
	var path=$("#paths").val();
	var url=path+"/coupon/search_consume.do";
	var queryParams={};
	queryParams['vinCode']=vinCode;
	queryParams['license']=license;
	queryParams['userPhone']=userPhone;
	queryParams['electronicAccounts']=electronicAccounts;
	
	queryCouponHistoryList(url,queryParams);
	
}
function clearVal(){
	$("#vinCode").val("");
	$("#license").val("");
	$("#userPhone").val("");
	$("#electronicAccounts").val("");
	
}

function queryHistory(ctype){

	var vinCode=$("#vinSelectCode").val();
	var c_type=$("#c_type").val();
	if(ctype==c_type){
		return;
	}else{
	
	
		$("#c_type").val(ctype);
		var path=$("#paths").val();
		var queryParams={};
		queryParams['vinCode']=vinCode;
		var url;
		if(ctype==1){
		 	url=path+"/coupon/get_coupon_recharge.do";
			queryCouponRechargehistoryList(url,queryParams);
		}else{
			 url=path+"/coupon/get_coupon_consume.do";
			queryCouponConsumeHistoryList(url,queryParams);
		}
	
	}
	
	
}
$(".opera").bind("click",function(){
	$(".order_undo").show();
	
});

$(document).on('click','.cancel',function(){  
	 $("#consume").addClass("activeCheck");
	 $("#consume").removeClass("check");
	 $("#recharge").removeClass("activeCheck");
	 $("#recharge").addClass("check");
     $(".order_undo").hide();
 });
 
 
 $(document).on('click','.swatch',function(){  
 	 
 	 $(".swatch").removeClass("activeCheck");
 	 $(".swatch").addClass("check");
     $(this).removeClass("check");	
 	 $(this).addClass("activeCheck");
 });
 
/*   $(document).on('click','.datagrid-row',function(){  
     showConsumePanelHistory(this.vinCode);
 });
 */ 
 /* $(".swatch").bind("click",function(){
 	$(this).removeClass("check");
 	$(this).addClass("activeCheck");
 }) */
   $(document).ready(function(){ 
   
		   	var path=$("#paths").val();
			var url=path+"/coupon/search_consume.do";
			queryCouponHistoryList(url,"");
		}) 
</script>
<input type="hidden" id="paths" value="<%=path%>"/>
<div id="main">
	<div class="search">
	  <table class="searchTable">
  		 <tbody>
   
	    <tr>
	    <td style="position:relative;">
	     <span class="inputTitle">VIN码:</span>
	     <span id="vinCodeWrap">
	     <input id="vinCode" name="endSubmitDate" type="text" value="" class="mc-ipt-text hasDatepicker" style="" />
	     <span class="mc-ipt" style="width:90%;"><span id="input33Tip" class="mc-ipt-tip-query" style="font-size: 11px; line-height: 40px; height: 40px;"><font></td>
	    
	     <td>
	     	<span class="inputTitle">电子账户:</span>
	     	<input id="electronicAccounts" name="electronicAccounts" type="text" value="" class="mc-ipt-text hasDatepicker" style="" />
	     </td>
	     <td style="position:relative;">
	     <span class="inputTitle">手机号:</span>
	     <span id="userPhoneWrap">
	     <input id="userPhone" name="endSubmitDate" type="text" value="" class="mc-ipt-text hasDatepicker" style="" />
	     <span class="mc-ipt" style="width:215px;">
	     <span id="input33Tip" class="mc-ipt-tip-query" style="font-size: 11px; line-height: 40px; height: 40px;">
	     <font>
	     </td>
	     <td>
	     <button class="t-button searchBtn" id="CaseInfoList2btnCtClear" type="button" onclick="clearVal();"><img class="searchIcon" src="../images/clear.png">清空</button>
	     
	     <button class="t-button searchBtn" style="margin-right:10px;" id="CaseInfoList2btnCtSearch" type="button" onclick="query();"><img class="searchIcon" src="../images/search.png">搜索</button>
	     </td>
	     
	    </tr>
	   </tbody>
	  </table>
	</div>
	
	
</div>
<table id="datatable"></table>
<div class="order_undo"  id="consume_dialog" style="display: none;" >
	<div class="dialog_default">
						<div class="dialog_title">
							账户记录
						</div>
						<div class="dialog_con">
			<input type="hidden" value="" id="vinSelectCode">
			<div class="clearfix" style="width:100%;height:45px;">
				<a href="javascript:void(0);" class="check swatch" id="recharge" onclick="queryHistory(1)"><span>充值记录</span></a>
				<a href="javascript:void(0);" class="activeCheck swatch" id="consume" onclick="queryHistory(2)"><span>消费记录</span></a>
			</div>
			
			 <input type="hidden" value="" id="c_type">
			 <div class="clearfix" style="width:100%">
				<table id="datatable2"></table>
			</div>
			<div class="confirm_cancel clearfix">
							<a href="javascript:void(0);" class="btn1 cancel">确&nbsp;&nbsp;定</a>
						</div>
			</div>
	</div>
</div>
<%@ include file="footer.jsp"%>