<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link rel="stylesheet" href="/static/weixin/css/public.css">
    <link rel="stylesheet" href="/static/weixin/css/wechat_add_new.css">
    <link rel="stylesheet" href="/static/weixin/css/basic.css">
    <link rel="stylesheet" href="/static/weixin/css/mobiscroll/mobiscroll.css">
    <link rel="stylesheet" href="/static/weixin/css/mobiscroll/mobiscroll_002.css">
    <link rel="stylesheet" href="/static/weixin/css/mobiscroll/mobiscroll_003.css">
    <script src="/static/weixin/js/flexible.js"></script>
    <title>账单筛选</title>
    <style>
        .zeng-exhibition {
            margin-top: 0.16667rem !important;
        }
    </style>
</head>
<body id="contain">
<div class="contain lm_contain">
    <div class="bai-head">
        <a href="/weixin/billNewPage/gotoBillPage?product_type=${p.product_type}" class="left">
            <img src="/static/weixin/images/head-left.png"/>
        </a>
        <span>筛选</span>
    </div>
    <div class="zeng-exhibition">
        <ul class="exhibition-cont">
            <li>
                <span>订单号</span>
                <input class="input-text" type="text" id="sel_orderNo" placeholder="请输入订单号"/>
            </li>
            <c:if test="${p.weixin_login_company_type!=4 && p.product_type ==6}">
            <li>
                <span>来源</span>
                <input class="input-text input-tiao" readonly="readonly" type="text" id="sel_company" placeholder="请选择来源"/>
            </li>
            </c:if>
            <li class="city-address">
                <span>项目活动</span>
                <input class="input-text input-tiao" readonly="readonly" type="text" id="sel_project" placeholder="请选择项目活动"/>
            </li>
            <li>
                <span>销售区域</span>
                <input class="input-text input-tiao" readonly="readonly" type="text" id="sel_region" placeholder="请选择区域"/>
            </li>
            <li>
                <span>支付时间</span>
                <input class="input-text" style="width:42%" readonly="readonly" type="text" id="start-time" placeholder="开始时间"/>
                <div style="width:5%;display:inline;padding-right: 0.6rem;">-</div>
                <input class="input-text" style="width:42%" readonly="readonly" type="text" id="end-time" placeholder="结束时间"/>
            </li>
            <%--<li>--%>
                <%--<span>支付结束时间</span>--%>
                <%--<input class="input-text input-tiao" readonly="readonly" name="city" type="text" id="end-time" placeholder="结束时间"/>--%>
            <%--</li>--%>


        </ul>
    </div>
</div>
<div class="pro-steps assigned-steps">
    <div class="steps">
        <button id="sureBtn" class="xia">确定</button>
        <button id="resetBtn" class="save">重置</button>
    </div>
</div>
<script src="/static/weixin/js/jquery-1.8.3.min.js"></script>
<script src="/static/weixin/js/mobiscroll/mobiscroll_002.js"></script>
<script src="/static/weixin/js/mobiscroll/mobiscroll_004.js"></script>
<script src="/static/weixin/js/mobiscroll/mobiscroll.js"></script>
<script src="/static/weixin/js/mobiscroll/mobiscroll_003.js"></script>
<script src="/static/weixin/js/mobiscroll/mobiscroll_005.js"></script>
<script src="/static/weixin/common/layer_mobile/layer.js"></script>
<link rel="stylesheet" href="/static/weixin/common/layer_mobile/need/right.css">
<script src="/static/weixin/common/jquery.formHelper.js"></script>
<script type="text/javascript" src="/static/weixin/js/g.js"></script>
<script type="text/javascript">
    $(function () {
        function initValue(){
            if(sessionStorage.getItem("sel_orderNo")!=null){
                var sel_orderNo = JSON.parse(sessionStorage.getItem("sel_orderNo")); //订单号
                $("#sel_orderNo").val(sel_orderNo);
            }else{
                $("#sel_orderNo").val("");
            }

            if(sessionStorage.getItem("sel_region")!=null){
                var sel_region = JSON.parse(sessionStorage.getItem("sel_region")); //选择地区
                $("#sel_region").val(sel_region.region_name);
            }else{
                $("#sel_region").val("");
            }

            if(sessionStorage.getItem("sel_startTime")!=null) {
                var startTime = JSON.parse(sessionStorage.getItem("sel_startTime")); //开始时间
                $("#start-time").val(startTime);
            }else{
                $("#start-time").val("");
            }

            if(sessionStorage.getItem("sel_endTime")!=null) {
                var endTime = JSON.parse(sessionStorage.getItem("sel_endTime")); //结束时间
                $("#end-time").val(endTime);
            }else{
                $("#end-time").val("");
            }

            if(sessionStorage.getItem("sel_project")!=null) {
                var sel_project = JSON.parse(sessionStorage.getItem("sel_project")); //选择地区
                $("#sel_project").val(sel_project);
            }else{
                $("#sel_project").val("");
            }

            if(sessionStorage.getItem("sel_company")!=null) {
                var sel_company = JSON.parse(sessionStorage.getItem("sel_company")); //选择分销商
                $("#sel_company").val(sel_company.company_name);
            }else{
                $("#sel_company").val("");
            }

        }(initValue())

        //触发失去焦点事件
        $("#sel_orderNo").blur(function(){
            var orderNo=$("#sel_orderNo").val();
            sessionStorage.setItem("sel_orderNo",JSON.stringify(orderNo));
        });

        $("#sel_region").click(function(){
            window.location.href="/weixin/billNewPage/billConditionCity?product_type=${p.product_type}";
        });
        $("#sel_project").click(function(){
            window.location.href="/weixin/billNewPage/billConditionProject?product_type=${p.product_type}";
        });
        $("#sel_company").click(function(){
            window.location.href="/weixin/billNewPage/billConditionCompany?product_type=${p.product_type}";
        });
        $("#sureBtn").click(function () {
            window.location.href="/weixin/billNewPage/gotoBillPage?product_type=${p.product_type}";
        });
        $("#resetBtn").click(function () {
            sessionStorage.removeItem("sel_orderNo");
            sessionStorage.removeItem("sel_region");
            sessionStorage.removeItem("sel_startTime");
            sessionStorage.removeItem("sel_endTime");
            sessionStorage.removeItem("sel_project");
            sessionStorage.removeItem("sel_company");
            initValue()
        });

        var currYear = (new Date()).getFullYear();
        var opt={};
        opt.date = {preset: 'date'};
        opt.datetime = {preset: 'datetime'};
        opt.time = {preset: 'time'};
        opt.default = {
            theme: 'android-ics light', //皮肤样式
            display: 'bottom', //显示方式
            mode: 'scroller', //日期选择模式
            dateFormat: 'yyyy-mm-dd',
            lang: 'zh',
            showNow: true,
            nowText: "今天",
            startYear: currYear - 10, //开始年份
            endYear: currYear + 10, //结束年份

            onSelect: function (valueText, inst) {
                var id = $(this)[0].id;
                var validity = valueText.split("-");
                if (id === "start-time") {
                    if (opt.default.maxDate) {
                        opt.default.maxDate = null;
                    }
                    opt.default.minDate = new Date(validity[0], +validity[1] - 1, +validity[2] + 1);
                    $("#end-time").mobiscroll($.extend(opt['date'], opt['default']));
                    sessionStorage.setItem("sel_startTime",JSON.stringify(valueText));
                }
                if(id==="end-time"){
                    sessionStorage.setItem("sel_endTime",JSON.stringify(valueText));
                }
            }
        };

        $("#start-time").mobiscroll($.extend(opt['date'], opt['default']));
        var optDateTime = $.extend(opt['datetime'], opt['default']);
        var optTime = $.extend(opt['time'], opt['default']);

    });
</script>
</body>
</html>