<%@ 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/bill/list?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>
                <%--<a href="" id="qu" class="shai"></a>--%>
                <input class="input-text input-tiao" readonly="readonly" type="text" id="sel_region" placeholder="请选择"/>
                <%--<input type="text" style="display: none" placeholder="请选择">--%>
            </li>
            <li>
                <span>销售开始时间</span>
                <input class="input-text input-tiao" readonly="readonly" type="text" id="start-time" placeholder="请选择"/>
            </li>
            <li>
                <span>销售结束时间</span>
                <input class="input-text input-tiao" readonly="readonly" name="city" type="text" id="end-time" placeholder="请选择"/>
            </li>
            <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_company" 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_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_region").click(function(){
            window.location.href="/weixin/bill/bill-condition-city?product_type=${p.product_type}";
        });
        $("#sel_project").click(function(){
            window.location.href="/weixin/bill/bill-condition-project?product_type=${p.product_type}";
        });
        $("#sel_company").click(function(){
            window.location.href="/weixin/bill/bill-condition-company?product_type=${p.product_type}";
        });
        $("#sureBtn").click(function () {
            window.location.href="/weixin/bill/list?product_type=${p.product_type}";
        });
        $("#resetBtn").click(function () {
            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>