<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>电站详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" type="text/css" href="${ctxPlugin}/static/css/reset.css"/>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.css" media="all">
    <style>
        html {
            background-color: #fff;
            padding-bottom: 50px;
        }
        .form-span {
            display: block;
            padding: 8px 0;
            margin-left: 110px;
        }

        .page-iframe {
            border: none;
            width: 100%;
            min-height: calc(100vh - 250px);
        }
        .mb-10{
            margin-bottom: 10px !important;
        }
        .pd-10{
            padding: 10px;
        }
        .idea-text{
            width: 320px; height: 100px;outline: none; padding: 3px
        }
        .msg-title{
            text-align: center;
            margin: 10px 0;
            font-size: 16px;
        }
        .title1 {
            border-left: 4px solid #1b6073;
            padding-left: 20px;
            font-size: 14px;
            margin: 10px auto;
            font-weight: 600;
            height: 34px;
            line-height: 34px;
            background-color: #f4f6f9;
            color: #666666;
        }
        .layui-input-block {
            margin-left: 110px;
        }

        .layui-form-label {
            width: 110px;
        }
        .clearfix{*zoom:1;}
        .clearfix:before,.clearfix:after{display:table; line-height:0; content:"";}
        .clearfix:after{clear:both;}

        .layui-tab-title{
            margin: 0 0 0 20px;
        }
        .layui-tab-content{
            margin: 0 0 0 20px;
        }
        .layui-tab-content1{
            margin: 0 0 0 20px;
        }

        .blank-img {
            background: url('${ctxPlugin}/static/imgs/blankImg.png') center center no-repeat;
            width: 80px;
            height: 80px;
            display: inline-block;
        }

        .link-blue{ color: #1b6073; cursor: pointer;}

        .download-link {
            display: inline-block;
            padding: 8px 16px;
            color: #007bff;
            text-decoration: none;
            border-radius: 4px;
        }

        .download-link:hover {
            color: #0056b3;
        }
        input[disabled]{
            color: white !important;
            background-color: rgb(188, 188, 188) !important;
        }
        .disabled-radio {
            background-color: transparent; !important; /* 设置背景颜色为透明 */
        }

        .layui-form-item .layui-input-inline {
            float: left;
            width: 300px;
            margin-right: 10px;
        }
    </style>
</head>
<body>
<div class="layui-fluid pd-10">
    <div class="order-win layui-form" id="LAY_app">
        <blockquote class="layui-elem-quote">投放信息</blockquote>
        <div class="layui-form-item layui-row">
            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">投放单号：</label>
                <span class="form-span">
                    ${releOrder.columns.rele_code}
                </span>
            </div>
            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">投放单状态：</label>
                <span class="form-span" >
                    <c:choose>
                        <c:when test="${releOrder.columns.rele_order_status eq '0'}">
                            业务员审核中
                        </c:when>
                    </c:choose>
                </span>
            </div>
            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">投放金额合计：</label>
                <span class="form-span">${releOrder.columns.putin_amount_total}</span>
            </div>
            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">实付金额合计：</label>
                <span class="form-span"> ${releOrder.columns.actual_payment_amount}</span>
            </div>
            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">内控金额汇总：</label>
                <span class="form-span"> ${releOrder.columns.buckle_amount_total}</span>
            </div>
            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">项目公司名称：</label>
                <span class="form-span"> ${releOrder.columns.project_job_name}</span>
            </div>
            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">证件类型：</label>
                <span class="form-span">
                    ${releOrder.columns.certificate_type}
                </span>
            </div>
            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">证件号：</label>
                <span class="form-span">${releOrder.columns.certificate_number}</span>
            </div>

            <div class="layui-col-sm4 layui-col-md4">
                <label class="layui-form-label">投放日期：</label>
                <span class="form-span"> ${releOrder.columns.rele_order_date}</span>
            </div>
            <div class="layui-col-sm12 layui-col-md12">
                <label class="layui-form-label">发票状态：</label>
                <span class="form-span">
                    <c:choose>
                        <c:when test="${releOrder.columns.invoice_status eq '1'}">
                            已开票
                        </c:when>
                        <c:when test="${releOrder.columns.invoice_status eq '2'}">
                            未开票
                        </c:when>
                        <c:when test="${releOrder.columns.invoice_status eq '3'}">
                            待确认
                        </c:when>
                        <c:when test="${releOrder.columns.invoice_status eq '4'}">
                            待重新开票
                        </c:when>
                    </c:choose>
                </span>
            </div>
        </div>
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <ul class="layui-tab-title">
                <li class="layui-this">投放明细</li>
                <li>发票信息</li>
            </ul>
            <div class="layui-tab-content">
                <table class="layui-table materialTable" style="margin: 10px 10px 10px 10px;">
                    <tr>
                        <th>电站编号</th>
                        <th>备案类型</th>
                        <th>承租人名称</th>
                        <th>承租人证件类型</th>
                        <th>承租人证件号码</th>
                        <th>设备总价款</th>
                        <th>进件日期</th>
                        <th>并网时间</th>
                        <th>发电户号</th>
                    </tr>
                    <c:forEach items="${releOrder.columns.deList}" varStatus="vs" var="rele">
                        <tr>
                            <td>${rele.columns.power_station_code}</td>
                            <c:if test="${rele.columns.filing_type eq '1'}">
                                <td>农户备案</td>
                            </c:if>
                            <c:if test="${rele.columns.filing_type eq '2'}">
                                <td>项目公司备案</td>
                            </c:if>
                            <c:if test="${rele.columns.filing_type eq null}">
                                <td></td>
                            </c:if>
                            <td>${rele.columns.customer_name}</td>
                            <td>${rele.columns.id_card_type}</td>
                            <td>${rele.columns.id_card_no}</td>
                            <td>${rele.columns.amount}</td>
                            <td>${rele.columns.incoming_date}</td>
                            <td>${rele.columns.ongrid_date}</td>
                            <td>${rele.columns.power_generation_no}</td>
                        </tr>
                    </c:forEach>
                </table>
            </div>
            <div class="layui-tab-content layui-hide">
                <table class="layui-table materialTable" style="margin: 10px 10px 10px 10px;">
                    <tr>
                        <th width="10%">发票号码</th>
                        <th width="10%">发票金额</th>
                        <th width="10%">开票税率</th>
                        <th width="10%">发票名称</th>
                        <th width="10%">开票时间</th>
                        <th width="25%">备注</th>
                        <th width="15%">文件</th>
                    </tr>
                    <c:forEach items="${releOrder.columns.invoiceList}" varStatus="vs" var="invoice">
                        <tr>
                            <td>${invoice.columns.invoice_number}</td>
                            <td>${invoice.columns.invoice_amount}</td>
                            <td>${invoice.columns.invoice_tax}</td>
                            <td>${invoice.columns.invoice_name}</td>
                            <td>${invoice.columns.invoice_date}</td>
                            <td>${invoice.columns.remark}</td>
                            <td>
                        <c:forEach items="${invoice.columns.fileList}" varStatus="vs" var="file">
                            <div style="float: left">
                                    ${file.columns.file_name}&nbsp;&nbsp;
                            </div>

                        </c:forEach>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </div>
        </div>
        <div class="layui-form-item operate-footer" style="text-align: center;">
            <input type="button"  class="layui-btn layui-btn-primary" value="返回" onclick="closeDiv();">
        </div>
    </div>
</div>


<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/dist/viewer.js"></script>
<script src="${ctxPlugin}/lib/base64.js"></script>
<script>
    //图片查看效果
    var viewer = new Viewer(document.getElementById('LAY_app'));
    layui.config({
        base: '${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'element', 'tableExt', 'jquery', 'layer', 'laypage', 'laydate', 'form'], function () {
        //layui.use(['table','layer','laypage','laydate','form'], function(){
        $ = layui.$;
        tableExt = layui.tableExt;
        layer = layui.layer;
        laypage = layui.laypage;
        laydate = layui.laydate;
        form = layui.form;
        table = tableExt.getLayTable();
        var element = layui.element;

        element.on('tab(docDemoTabBrief)', function (data) {
            console.log(data);
            $('.layui-tab-content').eq(data.index).removeClass('layui-hide').siblings('.layui-tab-content').addClass('layui-hide');
        });

    })

    function look(){
        layer.open({
            type: 2
            , title: '文件详情'
            , content: '${ctx}/rele/releOrderDetail?releCode=' + releCode
            , area: ['60%', '60%']
            , yes: function(index, layero){

            }
        });
    }

    window.closeSelf = function () {
        var index = parent.layer.getFrameIndex(window.name);
        // window.parent.location.reload();//刷新父级页面
        parent.layer.close(index);//关闭当前页
    }
    function previewUrl(_url) {
        if (!checkUrl(_url)) {
            return false;
        }
        var base = new Base64();
        var b64Encoded = base.encode(_url);
        if(_url.endsWith('pdf')){
            window.open('http://47.98.203.224:8012/onlinePreview?url=' + encodeURIComponent(b64Encoded)+'&officePreviewType=pdf');
        }else{
            window.open('http://47.98.203.224:8012/onlinePreview?url=' + encodeURIComponent(b64Encoded));
        }
    }

    function checkUrl(url) {
        //url= 协议://(ftp的登录信息)[IP|域名](:端口号)(/或?请求参数)
        var strRegex = '^((https|http|ftp)://)'//(https或http或ftp)
            + '(([\\w_!~*\'()\\.&=+$%-]+: )?[\\w_!~*\'()\\.&=+$%-]+@)?' //ftp的user@  可有可无
            + '(([0-9]{1,3}\\.){3}[0-9]{1,3}' // IP形式的URL- 3位数字.3位数字.3位数字.3位数字
            + '|' // 允许IP和DOMAIN（域名）
            + '(localhost)|'	//匹配localhost
            + '([\\w_!~*\'()-]+\\.)*' // 域名- 至少一个[英文或数字_!~*\'()-]加上.
            + '\\w+\\.' // 一级域名 -英文或数字  加上.
            + '[a-zA-Z]{1,6})' // 顶级域名- 1-6位英文
            + '(:[0-9]{1,5})?' // 端口- :80 ,1-5位数字
            + '((/?)|' // url无参数结尾 - 斜杆或这没有
            + '(/[\\w_!~*\'()\\.;?:@&=+$,%#-]+)+/?)$';//请求参数结尾- 英文或数字和[]内的各种字符
        var re = new RegExp(strRegex, 'i');//i不区分大小写
        //将url做uri转码后再匹配，解除请求参数中的中文和空字符影响
        if (re.test(encodeURI(url))) {
            return (true);
        } else {
            return (false);
        }
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }

    function closeDiv() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
    }
</script>
</body>
</html>
