{extend name="public/container"}
{block name="head_top"}

{/block}
{block name="content"}
<div class="layui-fluid" style="background: #fff;margin-top: -10px;">
    <div class="layui-tab layui-tab-brief" lay-filter="tab">
        <ul class="layui-tab-title">
            <li lay-id="list" {eq name='type' value='1' }class="layui-this" {
            /eq}>
            <a href="{eq name='type' value='1'}javascript:;{else}{:Url('apply',['type'=>1])}{/eq}">未审核申请({$show})</a>
            </li>
            <li lay-id="list" {eq name='type' value='2' }class="layui-this" {
            /eq}>
            <a href="{eq name='type' value='2'}javascript:;{else}{:Url('apply',['type'=>2])}{/eq}">已通过申请({$hide})</a>
            </li>
            <li lay-id="list" {eq name='type' value='3' }class="layui-this" {
            /eq}>
            <a href="{eq name='type' value='3'}javascript:;{else}{:Url('apply',['type'=>3])}{/eq}">未通过申请({$recycle})</a>
            </li>
        </ul>
    </div>
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">门店名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="name" class="layui-input" placeholder="请输入门店名称,关键字,编号">
                                    <input type="hidden" name="type" value="{$type}">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search"
                                            lay-filter="search">
                                        <i class="layui-icon layui-icon-search"></i>搜索
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <!--                <div class="layui-card-header">门店列表</div>-->
                <div class="layui-card-body">
                    <table class="layui-hide" id="List" lay-filter="List"></table>
                    <script type="text/html" id="headimgurl">
                        <img style="cursor: pointer" lay-event='open_image' src="{{d.image}}">
                    </script>
                    <script type="text/html" id="cert">
                        <img style="cursor: pointer" lay-event='open_image' src="{{d.cert}}">
                    </script>
                    <script type="text/html" id="address">
                        {{d.address}} {{d.detailed_address}}
                    </script>
                    <script type="text/html" id="act">
                        {{# if(d.status == 0){ }}
                            <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
                                审核
                            </button>
                        {{# } else { }}
                            {{d.reason}}
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="{__ADMIN_PATH}js/layuiList.js"></script>
{/block}
{block name="script"}
<script>
    var type = <?=$type?>;
    layList.tableList('List', "{:Url('apply_list',['type'=>$type])}", function () {
        return [
            {field: 'id', title: 'ID', sort: true, event: 'id', width: '4%'},
            {field: 'image', title: '门店图片', templet: '#headimgurl', width: '6%'},
            {field: 'name', title: '门店名称', width: '10%'},
            {field: 'user', title: '申请人'},
            {field: 'leader', title: '联系人'},
            {field: 'id_card', title: '联系人身份证号码'},
            {field: 'phone', title: '电话', width: '10%'},
            {field: 'address', title: '地址', templet: '#address'},
            {field: 'cert', title: '营业执照', templet: '#cert', width: '6%'},
            {field: 'right', title: '操作', align: 'center', toolbar: '#act', width: '14%'},
        ];
    });
    //查询条件
    layList.search('search', function (where) {
        layList.reload(where);
    });
    //点击事件绑定
    layList.tool(function (event, data, obj) {
        switch (event) {
            case 'open_image':
                $eb.openImage(data.image);
                break;
            case 'edit':
                $eb.createModalFrame(data.name + '-审核', layList.U({a: 'check_apply', q: {id: data.id}}), {h: 700, w: 1100});
                break;
        }
    })
</script>
{/block}