<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>财务管理—结账记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/static/css/reset.css"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-form layui-card">
        <div class="layui-tab layui-tab-brief " >
            <ul class="layui-tab-title">
                <li class="layui-this">结账记录</li>
                <button class="layui-btn f-r mt-10 mr-15 pl-10 pr-10" id="searchBtn" lay-submit lay-filter="LAY-user-back-search"><i class="layui-icon fs-12">&#xe615;</i>查询</button>
            </ul>
        </div>
        <div class=" layui-card-body layuiadmin-card-header-auto" id="searchForm">
            <div class="layui-form-item">
                <div class="layui-col-lg4 layui-col-sm6">
                    <label class="layui-form-label">结账时间：</label>
                    <div class="layui-input-block">
                        <div class="layui-col-xs5">
                            <input type="text" name="startTime" class="layui-input" id="startTime"
                                   placeholder="开始日期">
                        </div>
                        <div class="layui-col-xs2 text-c lh-30">
                            —
                        </div>
                        <div class="layui-col-xs5">
                            <input type="text" name="endTime" class="layui-input" id="endTime" placeholder="结束日期">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-card">
        <div class="layui-card-body">
            <table class="layui-hide" lay-skin="row" id="test" lay-filter="test"></table>
            <script type="text/html" id="toolbarDemo">
                <div class="layui-btn-container">
                   <%-- <button class="layui-btn layui-btn-sm" id="exportBtn" lay-event="exports"><i class="layui-icon layui-icon-export"></i>导出</button>--%>
                </div>
            </script>
        </div>
    </div>
</div>
<div id="lookImg" class="hide">
    <div class="w-500 h-500 lookImg">
        <img src="" width="80%">
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'tableExt', 'jquery', 'layer','laypage','laydate','form'], function(){
        //layui.use(['table', 'layer', 'laypage', 'laydate', 'form'], function () {
        $ = layui.$;
        tableExt = layui.tableExt;
        layer = layui.layer;
        laypage = layui.laypage;
        laydate = layui.laydate;
        form = layui.form;
        var table = tableExt.getLayTable();

        tableExt.render({
            elem: '#test'
            , height: 'full-300'
            , toolbar: '#toolbarDemo'
            , defaultToolbar: false
            , limits: [20, 50, 100]
            , limit: 20
            , page: true //开启分页
            , url: '${ctx}/site/financialManagement/accountRecordList'
            , cols: [[
                {type: 'numbers',fixed:'left',title:'序号'}
                , {field: 'id', type: 'checkbox',fixed: 'left'}
                , {field: 'amount', title: '结账金额',minWidth:'180', sort: false, align: 'center', exportable:true}
                , {field: 'imgs', title: '支付凭证',minWidth:'150', sort: false, align: 'center',exportable:true
                ,  templet: function (d){
                    return '<a href="javascript:;" class="layui-table-link" onclick="showImgs(\'' + d.imgs + '\');">详情</a>';
                },expFormat:function (d){
                    return "详情";
                }
                }
                , {field: 'service_costs', title: '结账详情',minWidth: '120', sort: false, align: 'center', exportable:true
                ,  templet: function (d){
                        return '<a lay-href="${ctx}/site/financialManagement/billingDetailPage?site_billing_id=\''+d.id + '\'" lay-tips="结算明细"  class="layui-table-link">结算明细</a>';
                    },expFormat:function (d){
                        return '<a lay-href="${ctx}/site/financialManagement/billingDetailPage?siteId=\''+d.site_id +'\'&createTime=\''+ d.createTime + '\'"  class="layui-table-link">查看详情</a>';
                    }
                }
                , {field: 'createTime', title: '结账时间',minWidth:'120', sort: false, align: 'center', exportable:true}
            ]]
            ,exportOpt:{                           //导出选项配置
                ele:'#exportBtn',                   //导出的Dom元素
                headerTitle: '备件申请-备件在途',             //excel表格的标题
                pageData:false,                     //true:导出的数据为页面数据，false:最大导出maxAmount条数据
                maxAmount: 1000,                    //当pageData为false生效
                fileName: '备件申请-备件在途',
                where: function (){                 //当pageData为false时生效，过滤的条件
                    return _serializeJson($("#searchForm"));
                }
            }
        });

        //监听搜索
        form.on('submit(LAY-user-back-search)', function (data) {
            var field = data.field;
            //执行重载
            tableExt.reload('test', {
                where: field,
                page: {
                    curr: 1
                }
            });
        });

        //结算开始日期
        var insStart = laydate.render({
            elem: '#startTime'
            , done: function (value, date) {
                //更新结束日期的最小日期
                insEnd.config.min = lay.extend({}, date, {
                    month: date.month - 1
                });

                //自动弹出结束日期的选择器
                insEnd.config.elem[0].focus();
            }
        });

        //结算结束日期
        var insEnd = laydate.render({
            elem: '#endTime'
            , done: function (value, date) {
                //更新开始日期的最大日期
                insStart.config.max = lay.extend({}, date, {
                    month: date.month - 1
                });
            }
        });


    });
    function showImgs(imgs) {
        $("#lookImg img").attr('src', "${commonStaticImgPath}" + imgs);
        layer.open({
            type: 1,
            title:'支付凭证',
            area:['500px','543px'],
            content: $('#lookImg')
        });
    }
function showDetail(siteId,createTime){


}
    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }

</script>
</body>
</html>


