<%@ page language="java" contentType="text/html; charset=utf-8"
		 pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta name="renderer" content="webkit">
	<!-- 移动设备 viewport -->
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
	<jsp:include page="../../common.jsp" />
	<style type="text/css">
		.layui-table th {
			text-align: center;
		}
	</style>
</head>
<body>
<div class="row animated fadeInRight" style="margin: 0;">
	<div class="wrapper wrapper-content mt5 right-content ml5 mr5">
		<div class="toolbar-panel bdd">
			<div class="toolbar-box">
				<div class="toolbar-head clearfix lgraybg pt5 pb10 pl10 bdbd">
					<!-- 顶部按钮 -->
					<div class="buttons fl">
						<a class="layui-btn layui-btn-sm fa fa-search f13" href="javascript:void(0);" onclick="queryMarketOrderList()"><span>搜索</span></a>
					</div>
					<div class="tools fr">
						<a href="javascript:void(0);" class="collapse dblock f14 dgray mr5">
							<i class="fa-2x fa fa-angle-double-up"></i>
						</a>
					</div>
				</div>
			</div>

			<!--搜索条件 -->
			<div class="toolbar-body">
				<div class="row pt10 pb10 whitebg ml0 mr0">
					<span class="dlblock w100 textr">商户名称：</span>
					<span class="bdc pt6 pb6 pl6 pr5 w180 dlblock">
							<input type="text" id="alias" placeholder="请输入商户名称">
						</span>
				</div>
			</div>
		</div>
	</div>
	<!-- 表单数据 -->
	<div class="mb20 mt10">
		<div class="whitebg pl10 pr10">
			<table class="layui-table">
				<thead>
				<tr>
					<th class="textc">
						<div class="checker" id="allCheck">
							<span class=""><input type="checkbox" value="" ></span>
						</div>
					</th>
					<th class="textc">序号</th>
					<th class="textc ">商户编号</th>
					<th class="textc ">商户简称</th>
					<th class="textc ">退款总额(元)</th>
					<th class="textc ">退款笔数</th>
					<th class="textc ">营销打款金额(元)</th>
				</tr>
				</thead>
				<!-- 数据体 -->
				<tbody id="data_content">
				</tbody>
			</table>

			<!-- footer -->
			<div class="clearfix mb10 pb20">
				<div class="layui-tab-item fr">
					<span class="dlblock vm">当前第<span class="now" id="currPage"></span>页 , </span>
					<span class="dlblock vm">共<span class="count" id="pageCount"></span>页 </span>
					<div class="pagination dlblock vm" id="pagination"></div>
					<span class="dlblock vm ml10">总记录数<span class="now" id="totalCount"></span>条</span>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script>
	var pageIndex=1;
	$(document).ready(function(){
		//调用查询
		pageIndex=StringUtil.getQueryString('pageIndex');
		if(pageIndex==undefined||pageIndex==null){
			pageIndex=1;
		}
		queryMarketOrderList(pageIndex);
		//绑定hover操作
		$(document).on('mouseenter','.listOperaters',function(){
			$(this).children(".ops_itemDiv").show();
			var width=15;
			$(this).children('div').find('li').each(function(){
				//获取li宽度
				width+=$(this).width();
			});
			$(this).children('div').width(width);
		})
		$(document).on('mouseleave','.listOperaters',function(){
			$(this).children(".ops_itemDiv").hide();
		});

		//行选中事件
		$("#allCheck").find("span").click(function() {
			$(this).toggleClass('checked');
			if($(this).hasClass('checked')){
				//所有列选中
				$(".checker").find("span").each(function () {
					$(this).addClass("checked");
				})
			}else{
				//所有列取消选中
				$(".checker").find("span").each(function () {
					$(this).removeClass("checked");
				})
			}
		});

		//单个选中
		$(document).on('click','.checkeBox span',function() {
			$(this).toggleClass('checked');
			//设置头部事件
			var length=$('.checkeBox span').length;
			var count=0;
			$(".checkeBox").find("span").each(function () {
				if($(this).hasClass("checked")){
					count++;
				}
			})
			//全选
			if(count==length){
				$("#allCheck").find("span").addClass('checked');
			}else{
				$("#allCheck").find("span").removeClass('checked');
			}
		})
		//左右div高度相等
		var left_content_height = $(".right-content").height();
		$(".left-content").height(left_content_height+35);
		var sub_left_height=$(".res-menu").height(left_content_height-60);
	});

	//查询
	function queryMarketOrderList(index){
		if(typeof(index)=='undefined'){
			index=1;
		}
		var url=ctx+'/refundOrder/queryMarketCountByPage';
		$.ajax({
			url:url,
			type:"post",
			dataType:"json",
			data:{
				"currPage":index,
				"alias":$("#alias").val(),
			},
			success:function(result){
				var presentPage = result.currPage;
				//渲染数据
				$('#data_content').empty();
				$.each(result.refundOrderCountList,function(i){
					var index = (presentPage-1)*12+i+1;
					var refundOrderCount=result.refundOrderCountList[i];
					var data='';
					data+='<tr class="odd">';
					data+='<td class="textc">';
					data+='		 <div class="checker checkeBox">';
					data+='		 <span class="" "><input type="checkbox"  value=""></span>';
					data+='		</div>';
					data+='</td>';
					data+='<td class="textc">'+index+'</td>';
					data+='<td class="textc">'+refundOrderCount.merchantCode+'</td>';
					data+='<td class="textc">'+refundOrderCount.alias+'</td>';
					data+='<td class="textc">'+refundOrderCount.refundAmtCount+'</td>';
					data+='<td class="textc">'+refundOrderCount.refunCount+'</td>';
					data+='<td class="textc">'+refundOrderCount.transferAmtCount+'</td>';
					data+='</tr>';
					$('#data_content').append(data);
				});
				//分页
				$('#pageCount').html(result.pageCount);
				$('#currPage').html(result.currPage);
				$('#totalCount').html(result.count);
				//设置分页
				pageIndex=result.currPage;
				$('#pagination').pagination({
					pageCount: result.pageCount,
					jump: true,
					coping: true,
					jump: true,
					homePage: '首页',
					endPage: '末页',
					prevContent: '上页',
					nextContent: '下页',
					current:result.currPage,
					callback:function(api){
						pageIndex=api.getCurrent();
						queryMarketOrderList(api.getCurrent());
					}
				});
			}
		});
		//表头列不选中
		$("#allCheck").find("span").removeClass('checked');
	}
	function hidePictureWindow(){
		$('#picture').empty();
		$('#pictureWindow').hide();
	}

	function dateFtt(fmt,date)
	{ //author: meizz
		var o = {
			"M+" : date.getMonth()+1,                 //月份
			"d+" : date.getDate(),                    //日
			"h+" : date.getHours(),                   //小时
			"m+" : date.getMinutes(),                 //分
			"s+" : date.getSeconds(),                 //秒
			"q+" : Math.floor((date.getMonth()+3)/3), //季度
			"S"  : date.getMilliseconds()             //毫秒
		};
		if(/(y+)/.test(fmt))
			fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length));
		for(var k in o)
			if(new RegExp("("+ k +")").test(fmt))
				fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
		return fmt;
	}
</script>

</html>

