<%@ 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/basic.css">
    <link rel="stylesheet" href="/static/weixin/css/SG_area_select.css">
    <script src="/static/weixin/js/flexible.js"></script>
    <script src="/static/weixin/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="/static/weixin/js/g.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            //账单的分为资源方和分销商，资源方不需要看到下级收入和实际收益
            //字典列表， 数据列表，现场翻译
            var row  = JSON.parse('${row}');
            var str = '';
            var companyType = '${p.weixin_login_company_type}'; //2分销商，4资源方
            var projectName =  row.project_name ?row.project_name : row.product_name;
            if(row.activity_name!=undefined){
                projectName = row.activity_name;
            }
          console.log(row);
            $("#contain p").each(function(){
                var name = $(this).attr('name');

//                if(row[name]==undefined){
//                    return;
//                }

                var str = row[name];
                if("stages_number"==name){
                    if(row[name]==1){
                        str = "否";
                    }else{
                        str = "分"+row[name]+"期";
                    }
                }else if("effective_time"==name){
                    if(row.start_date!=undefined || row.end_date!=undefined){
                        str=row.start_date.substr(0,11)+"至"+row.end_date.substr(0,11);
                    }
                }else if("project_name"==name){
                    var project=projectName;
                    if (project==null||project==""){
                        str="-"
                    }else {
                        str=project;
                    }
                    //特殊显示控制
                }else if("settled_commission"==name){
                    str="0";
                }else if("tax_money"==name){
                    str="-";
                }else if("withholding_costs"==name){
                    str="-";
                }else if("platform_management_fee"==name){
                    str="-";
                }else if("low_level_actual_brokerage"==name){
                    if(row.display_sys_company_id == '${p.weixin_login_company_id}'){
                        str="-"
                    }
                }
                console.log("字段",name,str,this);
                $(this).html(str);
            });

            g_ajax("/weixin/bill/detail/isPay/"+row.order_no,{},function (json) {
                var str  = "";
                if(json!=undefined && json.is_pay !=undefined){
                    if(json.is_pay==0) str="已支付";
                    if(json.is_pay==1) str="已部分支付";
                    if(json.is_pay==-1) str="未支付";
                }
                $("#is_pay").html(str);
            },false);

        });
    </script>
    <title>账单详情</title>
</head>
<body id="contain">
<div class="contain">
    <div class="bai-head">
        <span>账单详情</span>
        <a href="javascript:history.go(-1);" class="left">
            <img src="/static/weixin/images/head-left.png"/>
        </a>
    </div>
    <div class="lower-level bill-level">
        <h2>账单详情</h2>
        <ul class="basic-information distributor-level">
            <li>
                <span>订单编号</span>
                <p name="order_no"></p>
            </li>
            <li>
                <span>产品名称</span>
                <p name="product_name"></p>
            </li>
            <li>
                <span>产品分类</span>
                <p name="type_name"></p>
            </li>
            <li>
                <span>项目</span>
                <p id="project_name" name="project_name"></p>
            </li>
            <li>
                <span>有效日期</span>
                <p id="effective_time" name="effective_time"></p>
            </li>
            <li>
                <span>是否分期</span>
                <p id="stages_number" name="stages_number"></p>
            </li>
            <li>
                <span>支付情况</span>
                <p id="is_pay" name="is_pay"></p>
            </li>
            <li>
                <span>订单费用</span>
                <p id="fee_fcy" name="fee_fcy"></p>
            </li>
            <li>
                <span>销售方</span>
                <p id="company_name" name="company_name"></p>
            </li>
            <li>
                <span>购买时间</span>
                <p name="order_date"></p>
            </li>
        </ul>
        <h2>结算信息</h2>
        <ul class="basic-information distributor-level">
            <li>
                <span>收入</span>
                <p name="avalil_brokerage"> </p>
            </li>
            <c:if test="${p.weixin_login_distribution_level!='3' }">
                <c:if test="${p.weixin_login_company_type!=4}">
                <li>
                    <span>下级收入</span>
                    <p name="low_level_actual_brokerage"> </p>
                </li>
                </c:if>
            </c:if>
            <%--<li>--%>
                <%--<span>实际收益</span>--%>
                <%--<p name="real_actual_brokerage"> </p>--%>
            <%--</li>--%>
           <%--
            <li>
                <span>平台管理费</span>
                <p name="platform_management_fee"> </p>
            </li>
            <li>
                <span>实得收入</span>
                <p name="actual_brokerage"> </p>
            </li>
            <li>
                <span>已结算收入</span>
                <p name="settled_commission"> </p>
            </li>--%>
            <%--<li>--%>
                <%--<span>当前状态</span>--%>
                <%--<p>已派发</p>--%>
            <%--</li>--%>
        </ul>
    </div>
</div>

</body>
</html>