<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no,minimum-scale=1,initial-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="applicable-device" content="mobile">
    <title></title>
    <script type="text/javascript" src="__PUBLIC__/js/do.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/js/moble.js" charset="utf-8"></script>
    <style>
        *{margin:0px; padding:0px;}
        body{font-family: 'Helvetica Neue', Helvetica, sans-serif;font-size: 17px;line-height: 21px;color: #333;padding: .28rem;}
        #card{box-sizing: border-box;background: #fafafa url(__STATIC__/guard/bg.jpg) no-repeat left top;background-size: 100% auto;}
        .title{font-size:20px;color: #FFF;padding:25px 10px;margin-bottom:125px;}
        .title span{color: #FF0000;}
        .cards{width: 100%;background: #fff;box-sizing: border-box;box-shadow: 0 0.03rem 0.07rem 0 rgba(0,49,91,0.16);border-radius: 10px;padding: 10px 0px;margin-top:.2rem;}
        .mart27{margin-top:2.5rem;}
        .tips{--weui-FG-1: #FF0000;margin:10px;padding: 10px;text-align:left;background: #d9edf7;border-radius: 10px;}
        .weui-padding{margin:20px 0px;}
        .gray{font-size:12px;color: #FF0000;float:right;}
        .red{font-size:19px;color: #FF0000;}
        .green{font-size:19px;color: #54C865;}
        .manage{position: absolute;top:20px;right: 20px;}
        .show{display: block;}
        .hide{display:none;}
        .weui-form-preview{border-bottom:5px #d9edf7 solid;}
        .weui-cells__group_form .weui-cells__title{padding:5px 15px;}
        .weui-cells__group_form .weui-cell {padding: 16px 15px;}
        .weui-cells__group_form .weui-cell::before, .weui-cells__group_form .weui-cells::before {left: 15px;right: 15px;}
        .weui-label {width:80px}
        #success{padding: .28rem;box-sizing: border-box;background: #fafafa url(__STATIC__/guard/bg.jpg) no-repeat left top;background-size: 100% auto;position: absolute;top: 0;right: 0;bottom: 0;left: 0;overflow-y: auto;-webkit-overflow-scrolling: touch;box-sizing: border-box;z-index:2;}
    </style>
</head>
<body id="card" ontouchstart>
    <div id="page">
    {if $guard}
    <div class="title">{$guard.company}</div>
    <form id="form" action="{:urls('guard/manage/list',$guard.member_miniapp_id,['id' => $guard.id])}" method="post">
    <div class="cards mart27">
        <div class="weui-cells__group weui-cells__group_form">
            <div class="weui-cells__title">查询</div>
            <div class="weui-cells weui-cells_form">
                <div class="weui-cell weui-cell_active">
                    <div class="weui-cell__bd"><input  type="text" name="name" id="name" class="weui-input" placeholder="姓名" required></div>
                    <div class="weui-cell__ft"><i class="weui-icon-warn"></i></div></div>
                <div class="weui-cell weui-cell_active">
                    <div class="weui-cell__bd"><input  type="text" name="phone" id="phone" class="weui-input" placeholder="手机号" required></div>
                    <div class="weui-cell__ft"><i class="weui-icon-warn"></i></div></div>
                <div class="weui-cell weui-cell_active">
                    <div class="weui-cell__bd"><input  type="text" name="idcard" id="idcard" class="weui-input" placeholder="身份证" required></div>
                    <div class="weui-cell__ft"><i class="weui-icon-warn"></i></div></div>
                <div class="weui-cell weui-cell_active">
                    <div class="weui-cell__bd"><input  type="text" name="start" id="start" class="weui-input" placeholder="开始时间" required></div>
                    <div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
                </div>
                <div class="weui-cell weui-cell_active">
                    <div class="weui-cell__bd"><input  type="text" name="end" id="end" class="weui-input" placeholder="结束时间" required></div>
                    <div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
                </div>
            </div>
        </div>
    </div>
    <div class="weui-padding button-sp-area cell weui-btn-area_inline">
        <button id="formSubmitBtn" type="button" class="weui-btn weui-btn_primary">确 定</button>
    </div>
    </form>
    {else}
    <div class="title">免费开通,疫情出入控制信息系统</div>
    <div class="cards mart27">
        <div class="weui-cells__group weui-cells__group_form">
            <div class="weui-form__tips-area tips">
                <p class="weui-form__tips">我司免费提供开通,疫情出入控制信息系统</p>
            </div>
        </div>
    </div>
    <div class="weui-padding button-sp-area cell weui-btn-area_inline"></div>
    {/if}
    <div class="weui-form__tips-area"><p class="weui-form__tips">技术支持 古德科技</p></div>
    <div class="weui-form__extra-area">
        <div class="weui-footer"><p class="weui-footer__links"><a href="javascript:void(0);" class="weui-footer__link">免费开通小程序,助力林州实体商家</a></p>
          <p class="weui-footer__text">开通热线 18567770669 16638329860:</p>
        </div>
    </div>
    </div>
    <div id="success" class="hide">
        <div class="manage"><a href="{:urls('guard/manage/list',$guard.member_miniapp_id,['id' => $guard.id,'types' => 0])}" class="weui-btn weui-btn_mini weui-btn_primary">导出</a></div>
        <div class="title">{$guard.company}</div>
        <div class="mart27">
            <div class="page__bd" id="history"></div>
        </div>
    </div>
</body>
<script id="history_tpl" type="text/html">
    {literal}
    {{each list value key}}
    <div class="weui-form-preview">
        <div class="weui-form-preview__hd"><div class="weui-form-preview__item"><label class="weui-form-preview__label">进出状态</label><em class="weui-form-preview__value">{{value.pass_out}}</em></div></div>
        <div class="weui-form-preview__bd">
            <div class="weui-form-preview__item"><label class="weui-form-preview__label">姓名</label><span class="weui-form-preview__value">{{value.account.name}}</span></div>
            <div class="weui-form-preview__item"><label class="weui-form-preview__label">手机号</label><span class="weui-form-preview__value">{{value.account.phone}}</span></div>
            <div class="weui-form-preview__item"><label class="weui-form-preview__label">发生时间</label><span class="weui-form-preview__value">{{value.update_time}}</span></div>
            <div class="weui-form-preview__item"><label class="weui-form-preview__label">车牌号</label><span class="weui-form-preview__value">{{value.car_num}}</span></div>
            <div class="weui-form-preview__item"><label class="weui-form-preview__label">体温</label><span class="weui-form-preview__value red">{{value.temperature}}°c</span></div>
            <div class="weui-form-preview__item"><label class="weui-form-preview__label">近期是否接触疫情</label><span class="weui-form-preview__value {{if value.is_danger == 0}}green{{else}}red{{/if}}">{{if value.is_danger == 0}}没有{{else}}接触{{/if}}</span></div>
            <div class="weui-form-preview__item"><label class="weui-form-preview__label">事由</label><span class="weui-form-preview__value">{{value.why}}</span></div>
        </div>
    </div>
    {/literal}
    {{/each}}
</script>
<script id="clickLoading" type="text/html">
    <div class="weui-footer" style="padding-top: 20px">
        <p class="weui-footer__links">
            <a href="javascript:void(0);" class="weui-footer__link" onclick="more('{{page}}')">加载更多</a>
        </p>
    </div>
</script>
<script id="empty" type="text/html"><div class="weui-loadmore weui-loadmore_line fn-clear" id="buttom"><span class="weui-loadmore__tips" style="background-color:#fff">已到底部</span></div></script>
<script id="loading" type="text/html"><div class="weui-loadmore"><i class="weui-loading"></i><span class="weui-loadmore__tips">正在加载</span></div></script>
<script type="text/javascript">
    Do('weui', 'fastclick', 'tpl','jform',function () {
        $(function () {FastClick.attach(document.body);});
        $('#start').click(function () {
            weui.datePicker({
                start: 2020,
                end: 2050,
                defaultValue: [2020, 1, 1],
                onChange: function(result){

                },
                onConfirm: function(result){
                    $('#start').val(result.join('-'));
                },
                id: 'start'
            });
        })
        $('#end').click(function () {
            weui.datePicker({
                start: 2020,
                end: 2050,
                defaultValue: [2020, 1, 1],
                onChange: function(result){

                },
                onConfirm: function(result){
                    $('#end').val(result.join('-'));
                },
                id: 'end'
            });
        })
        $('#formSubmitBtn').click(function(){
            if(!($('#name').val() || $('#phone').val() || $('#idcard').val()) && !($('#start').val() && $('#end').val())){
                weui.alert('请输入查询条件');
                return;
            }
            $('#form').ajaxSubmit({dataType:"json",success:function (rel) {
                if(rel.data.length == 0){
                    weui.alert('暂无查询结果');
                    return;
                }
                $('#page').hide();
                $('#success').show();
                $("#history").append(template("history_tpl",{list:rel.data}));
                if(rel.code == 200 && rel.data.length >= 10){
                    $('#history').append(template("clickLoading",{page:page}));
                }else{
                    $('#history').append(template("empty"));
                }
                pushHistory();
            }});
        });
        window.addEventListener("popstate", function(e) {
            $('#success').hide();
            $('#page').show();
        }, false);
    });
    function pushHistory() {
        var state = {
            title: "title",
            url: "#"
        };
        window.history.pushState(state, "title", "#");
    }
    function more(page) {
        isNaN(page) ? page = 2 : page++;
        $('.weui-footer').remove();
        $('#history').append(template("loading"));
        $('#form').ajaxSubmit({dataType:"json",data:{page:page},success:function (rel) {
                $('.weui-loadmore').remove();
                $('#page').hide();
                $('#success').show();
                $("#history").append(template("history_tpl",{list:rel.data}));
                if(rel.code == 200 && rel.data.length >= 10){
                    $('#history').append(template("clickLoading",{page:page}));
                }else{
                    $('#history').append(template("empty"));
                }
            }});
    }
</script>
</html>