<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>患者消费记录</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="icon" th:href="@{image/sgl.png}" sizes="32x32">
    <script th:src="@{/layui/layui.js}"></script>
    <script th:src="@{/layui/jquery-3.4.1.min.js}"></script>
    <script th:src="@{/js/common.js}"></script>
    <script th:src="@{/js/rules.js}"></script>
    <link rel="stylesheet" th:href="@{/css/common.css}">
</head>
<style>
.btn:hover{color: #555;}
.layui-table-view {margin: 0;}
.layui-tab-card{box-shadow:none;border-radius: 0px;}
.layui-tab{margin:0;}
.layui-tab-content{padding:0;}
.layui-form-radio{margin:0;}
.tdBackground-color{background-color:#ff0000;}
</style>

<body class="layui-layout-body">

	<div class="toolbar">           	
        <div class="layui-inline">
			<button class="layui-btn layui-btn-sm" onclick="findPayRequestPageList()"><i class="layui-icon">&#xe615;</i>查询</button>
		</div>
		<!--<div class="layui-inline">
			<button class="layui-btn layui-btn-sm layui-btn-normal" data-type="add" id="add"><i class="layui-icon">&#xe654;</i>添加</button>
   		</div>-->
    </div>
    	
	<table id="demo" lay-filter="test"></table>	
	   
</body>   
</html>
<script th:inline="javascript">


</script>
<script>
	var element ,
	    table,
	    laydate,
	    layer,
	    form,
	    tree;
	var tHeight = $(".toolbar").height()+6;
    layui.use(['element','table','laydate','layer','form','tree'], function(){
		element = layui.element;
	    table = layui.table;
	    laydate = layui.laydate;
	    layer = layui.layer;
	    form = layui.form;
	    tree = layui.tree;
	    
	    //表格加载
		table.render({
			elem: '#demo',
			height: 'full-'+tHeight,
			url: '/patient/findPayRequestPageList', //数据接口
			title: '用户表',
			page: true ,//开启分页
			limit:20,
			limits:[20,30,50],
			//toolbar: '', //开启工具栏，此处显示默认图标，可以自定义模板
			defaultToolbar: [],	 
			id:'test', 
			cols: [
			 [ //表头
			   {type: 'numbers', title: '序号', width: 30},
			   {field: 'MERORDERID', title: '订单号', sort: false},
			   {field: 'OPENID', title: 'openid', sort: false, totalRow: true},
			   {field: 'TRUE_NAME', title: '姓名', sort: false, totalRow: true},
			   {field: 'MEDICAL_CARD', title: '卡号', sort: false, totalRow: true},
			   {field: 'TOTALAMOUNT', title: '充值金额（分）', sort: false},
			   {field: 'STATUS', title: '交易状态', sort: false,templet:function(d){
			   		if(d.STATUS == 'NEW_ORDER'){
			   			return '新订单';
			   		}else if(d.STATUS == 'UNKNOWN'){
			   			return '不明确的交易状态';
			   		}else if(d.STATUS == 'TRADE_CLOSED'){
			   			return '在指定时间段内未支付时关闭的交易；在交易完成撤销成功时关闭的交易；支付失败的交易。';
			   		}else if(d.STATUS == 'WAIT_BUYER_PAY'){
			   			return '交易创建，等待买家付款';
			   		}else if(d.STATUS == 'TRADE_SUCCESS'){
			   			return '支付成功';
			   		}else if(d.STATUS == 'TRADE_REFUND'){
			   			return '订单转入退货流程';
			   		}else{
			   			return '';
			   		}
			   }},
			   {field: 'HISSTATUS', title: 'his状态', sort: false,templet:function(d){
			   		if(d.HISSTATUS == '0'){
			   			return '未同步';
			   		}else if(d.HISSTATUS == '1'){
			   			return '已同步';
			   		}
			   }},
			   {field: 'HISMSG', title: 'his信息', sort: false},
			   {field: 'CREATE_TIME', title: '创建时间', sort: false},
			 ]
			]
		});
	
		//时间控件
		laydate.render({
	  		elem:'#date', //指定元素
	  		eventElem: '.date-input-icon',
	  		trigger: 'click',
		});
		
        $(".downpanel").on("click", ".layui-select-title", function (e) {
            $(".layui-form-select").not($(this).parents(".layui-form-select")).removeClass("layui-form-selected");
            $(this).parents(".downpanel").toggleClass("layui-form-selected");
            layui.stope(e);
        }).on("click", "dl i", function (e) {
            layui.stope(e);
        });
        $(document).on("click", function (e) {
            $(".layui-form-select").removeClass("layui-form-selected");
        });
    });
    
  	function findPayRequestPageList(){
		var hospitalName = $("#hospitalName").val();
		table.reload('test', {
			method: 'get',
			url:'/patient/findPayRequestPageList',
			where: {
				'hospitalName':hospitalName,
				'type':2
			},
			page: {
				curr: 1
			}
		});
	}
    </script>