<%@ 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">
    <base href="@@baseUrl">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <script src="/static/weixin/js/flexible.js"></script>
    <link rel="stylesheet" href="/static/weixin/css/public.css">
    <link rel="stylesheet" href="/static/weixin/css/basic.css">
    <link rel="stylesheet" href="/static/weixin/css/wechat_add_new.css">
    <link rel="stylesheet" href="/static/weixin/css/new_basic.css">
    <link rel="stylesheet" href="/static/weixin/css/management_system.css?v=1.0.6">
    <link href="/static/weixin/css/mobiscroll/mobiscroll_002.css" rel="stylesheet" type="text/css">
    <link href="/static/weixin/css/mobiscroll/mobiscroll.css" rel="stylesheet" type="text/css">
    <link href="/static/weixin/css/mobiscroll/mobiscroll_003.css" rel="stylesheet" type="text/css">
    <title>收入管理</title>
    <style>
        .product-head-img{
            display: inline-block;
            width: 1.30667rem;
            height: 1.30667rem;
        }
        .revenue-bill .revenue-management {
            display: flex;
            justify-content: space-between;
            background: #fff;
            min-height: 1.5rem;
        }
        .revenue-bill .revenue-management .a1-left {
            width: 50%;
            border-right: 1px solid #DBE2EE;
            box-sizing: border-box;
            position: relative;
        }
    </style>
</head>
<body id="contain">
<div class="contain">
<div class="bai-head">
    <span>收入管理</span>
    <a href="/weixin/primaryPage/listNew" class="left">
        <img src="/static/weixin/images/head-left.png"/>
    </a>
</div>
<div class="revenue-bill">
    <div class="revenue-management">
        <div class="a1-left">
            <h3>当前总收入</h3>
            <p><span id="currAmountTotal">￥0.00</span></p>
        </div>
        <div class="a1-left">
            <h3>当前总单数</h3>
            <p>共<span id="totalCount">0</span>单</p>
        </div>
    </div>
    </div>
</div>
<div class="bill-product revenue-product" id="proList">
    <%--<div class="product-cont">--%>
        <%--<div class="revenue-head">--%>
            <%--<p>--%>
                <%--<img src="/static/weixin/images/new_bill-banner-s1.png"/>--%>
                <%--<span>保险产品</span>--%>
            <%--</p>--%>
            <%--<a href="javascript:;">查看详情</a>--%>
        <%--</div>--%>
        <%--<div class="revenue-cont">--%>
            <%--<ul>--%>
                <%--<li>--%>
                    <%--<span>总收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
                <%--<li>--%>
                    <%--<span>下级收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
                <%--<li>--%>
                    <%--<span>净收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
            <%--</ul>--%>
        <%--</div>--%>
    <%--</div>--%>
    <%--<div class="product-cont">--%>
        <%--<div class="revenue-head">--%>
            <%--<p>--%>
                <%--<img src="/static/weixin/images/new_bill-banner-s2.png"/>--%>
                <%--<span>风评产品</span>--%>
            <%--</p>--%>
            <%--<a href="javascript:;">查看详情</a>--%>
        <%--</div>--%>
        <%--<div class="revenue-cont">--%>
            <%--<ul>--%>
                <%--<li>--%>
                    <%--<span>总收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
                <%--<li>--%>
                    <%--<span>下级收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
                <%--<li>--%>
                    <%--<span>净收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
            <%--</ul>--%>
        <%--</div>--%>
    <%--</div>--%>
    <%--<div class="product-cont">--%>
        <%--<div class="revenue-head">--%>
            <%--<p>--%>
                <%--<img src="/static/weixin/images/new_bill-banner-s3.png"/>--%>
                <%--<span>培训产品</span>--%>
            <%--</p>--%>
            <%--<a href="javascript:;">查看详情</a>--%>
        <%--</div>--%>
        <%--<div class="revenue-cont">--%>
            <%--<ul>--%>
                <%--<li>--%>
                    <%--<span>总收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
                <%--<li>--%>
                    <%--<span>下级收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
                <%--<li>--%>
                    <%--<span>净收入</span>--%>
                    <%--<p>共<i>80</i>单</p>--%>
                    <%--<em>￥5000000.00</em>--%>
                <%--</li>--%>
            <%--</ul>--%>
        <%--</div>--%>
    <%--</div>--%>
</div>
</div>
</body>
<script src="/static/weixin/js/jquery-1.8.3.min.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?v=1.0.6"></script>
<script>
    $(function () {
        //清空查询条件缓存
        function clearConditionCache(){
            sessionStorage.removeItem("sel_orderNo");
            sessionStorage.removeItem("sel_region");
            sessionStorage.removeItem("sel_startTime");
            sessionStorage.removeItem("sel_endTime");
            sessionStorage.removeItem("sel_project");
            sessionStorage.removeItem("sel_company");
        }(clearConditionCache())

        bindData();

        layer.open({type:2});

        g_ajax("/weixin/billNew/getBillTotalByProduct",{},function(json){
            console.log(json);
            var html="";
            for(var i in json){
                var productType=json[i].productType;
                var productName=json[i].productTypeName;
                //总记录数
                var totalCount=json[i].totalCount;
                //净收入记录数
                var currTotalCount=json[i].currTotalCount;
                //下级收入记录数
                var lowerTotalCount=json[i].lowerTotalCount;
                //总收入
                var currAmountTotal=number_format(json[i].currAmountTotal,2,'.',',');
                //下级收入
                var lowerAmountTotal=number_format(json[i].lowerAmountTotal,2,'.',',');
                //净收入
                var currAmount=number_format(json[i].currAmount,2,'.',',');
                var img="";
                if(productType==6){
                    img="new_bill-banner-s1.png";
                }else if(productType==7){
                    img="new_bill-banner-s2.png";
                }else if(productType==8){
                    img="new_bill-banner-s3.png";
                }else{
                    img="new_bill-banner-s1.png";
                }

                var companyType='${p.weixin_login_company_type}';

                html+='<div class="product-cont">';
                html+='<div class="revenue-head">';
                html+='<p>';
                html+='<img class="product-head-img" src="/static/weixin/images/'+ img +'"/>';
                html+='<span>'+ productName +'</span>';
                html+='</p>';
                html+='<a href="javascript:void(0);" onclick=gotoBillPage('+productType+')>查看详情</a>';
                html+='</div>';
                html+='<div class="revenue-cont">';
                html+='<ul>';
                html+='<li>';
                html+='<span>总收入</span>';
                html+='<p>共<i>'+ totalCount +'</i>单</p>';
                html+='<em>￥'+ currAmountTotal +'</em>';
                html+='</li>';

                if(companyType!='4') {
                    // html += '<li>';
                    // html += '<span>下级收入</span>';
                    // html += '<p>共<i>' + lowerTotalCount + '</i>单</p>';
                    // html += '<em>￥' + lowerAmountTotal + '</em>';
                    // html += '</li>';

                    html += '<li>';
                    html += '<span>净收入</span>';
                    html += '<p>共<i>' + currTotalCount + '</i>单</p>';
                    html += '<em>￥' + currAmount + '</em>';
                    html += '</li>';
                }

                html+='</ul>';
                html+='</div>';
                html+='</div>';

                $('#proList').html(html);
                }

            layer.closeAll();
        },true);
    });

    /**
     * 绑定数据
     */
    function bindData(){
        var currAmountTotal=number_format('${billOrderTotal.currAmountTotal}',2,'.',',');
        $("#currAmountTotal").html('￥'+currAmountTotal);

        var totalCount='${billOrderTotal.totalCount}';
        $("#totalCount").html(totalCount);
    }

    /**
     * 跳转到账单列表页面
     * @param productType
     */
    function gotoBillPage(productType) {
        sessionStorage.setItem("sel_product_type",productType);
        window.location.href="/weixin/billNewPage/gotoBillPage?product_type="+productType;
    }
</script>
</html>