<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <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" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css" media="all">
    <style>
        .layui-form-select dl{
            max-height:200px;
            width: 80%;
        }
        .w-130{width: 130px}
        .ml120 .layui-input-block{margin-left: 130px}
        .ml-130{margin-left:  130px}
        .border-grey{border: 1px solid #DDD; border-radius: 10px;}
        .table-input{width: 30px; border: none; text-align: center; height: 30px; line-height: 30px}
        .layui-elem-field legend{font-size: 16px}
        .img-80{display: flex; justify-content: center;}
        .img-80 .bj-img{margin-right: 0}
        .a-link{
            color: #2890ac;
        }
    </style>
</head>
<body>
<div class="layui-form">
    <div class="layui-card mt-10">

        <div class="layui-tab layui-tab-brief over pt-20 pb-40 h-350" lay-filter="docDemoTabBrief" id="detailSet">
            <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
            <div class="layui-col-xs12 mb-20 pr-30 mt-20" id="tb_table">
                <c:forEach items="${agents}" var="agent">
                <fieldset class="layui-elem-field border-grey layui-field-title entryList" style="margin-top: 20px;">
                    <legend>代理区域</legend>
                    <div class="layui-col-xs9 mb-10 mt-20 pr-30">
                        <label class="layui-form-label"><i class="red">*</i>代理区域：</label>
                            <div class="layui-input-block w-200" >
                                <input type="text"  autocomplete="off" class="layui-input layui-bg-gray" readonly value="${agent.columns.agent_province}${agent.columns.agent_city}${agent.columns.agent_area}">
                            </div>
                    </div>
                    <div class="layui-col-xs3 mb-10 mt-20 pr-30">
                        <label class="layui-form-label"><i class="red">*</i>代理合同：</label>
                        <c:if test="${agent.columns.sign_contract eq '0'}">

                        </c:if>
                        <c:choose>
                            <c:when test="${agent.columns.sign_contract eq '1'}">
                                <div class="layui-input-block w-200" style="margin-top: 6px">
                                    <a  class="a-link" href="${agent.columns.contract_url}" target="_blank">查看合同</a>
                                </div>
                            </c:when>
                            <c:otherwise>
                                <div class="layui-input-block w-200" style="margin-top: 6px">
                                    <a href="#" class="a-link" onclick="inviteSign('${agent.columns.id}')">邀请签署</a>
                                </div>
                            </c:otherwise>
                        </c:choose>
                       <%-- <div class="layui-input-block w-200" >

                            <a href="">签署中</a>

                        </div>--%>

                    </div>
                    <div class="layui-col-xs12 mb-10 pr-30">
                        <label class="layui-form-label"><i class="red">*</i>年度任务：</label>
                        <div class="layui-input-block">
                            <table lay-filter="parse-table-demo">
                                <thead>
                                <tr>
                                    <th lay-data="{field:'username', minWidth:120}">2023年</th>
                                    <th lay-data="{field:'joinTime', minWidth:60}">1月</th>
                                    <th lay-data="{field:'january', minWidth: 60}">2月</th>
                                    <th lay-data="{field:'february', minWidth: 60}">3月</th>
                                    <th lay-data="{field:'march', minWidth: 60}">4月</th>
                                    <th lay-data="{field:'april', minWidth: 60}">5月</th>
                                    <th lay-data="{field:'may', minWidth: 60}">6月</th>
                                    <th lay-data="{field:'june', minWidth: 60}">7月</th>
                                    <th lay-data="{field:'august', minWidth: 60}">8月</th>
                                    <th lay-data="{field:'september', minWidth: 60}">9月</th>
                                    <th lay-data="{field:'october', minWidth: 60}">10月</th>
                                    <th lay-data="{field:'november', minWidth: 60}">11月</th>
                                    <th lay-data="{field:'december', minWidth: 60}">12月</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>装机容量(MW)</td>
                                    <td>${agent.columns.january}</td>
                                    <td>${agent.columns.february}</td>
                                    <td>${agent.columns.march}</td>
                                    <td>${agent.columns.april}</td>
                                    <td>${agent.columns.may}</td>
                                    <td>${agent.columns.may}</td>
                                    <td>${agent.columns.july}</td>
                                    <td>${agent.columns.august}</td>
                                    <td>${agent.columns.september}</td>
                                    <td>${agent.columns.october}</td>
                                    <td>${agent.columns.november}</td>
                                    <td>${agent.columns.december}</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </fieldset>
                </c:forEach>
            </div>

            </div>

            </div>
        </div>

            <div style="height: 20px"></div>
            <input type="hidden" name="id" id="id" value="${trader.id}">
            <div class="layui-col-xs12 mb-20 pr-30 mt-20">
            </div>

        <div class="layui-form-item operate-footer" style="text-align: center;">

            <input type="button"   value="取消" class="layui-btn layui-btn-primary " onclick="closeDiv();" >
        </div>
    </div>
</div>
<div id="lookImg" class="hide pos-r">
    <div style="position:relative;width:90%;height:450px;">
        <div class="w-500 h-450 lookImg">
            <img src="" width="80%" id="image">
        </div>
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/data.js"></script>
<script type="text/javascript">
    //初始数据
    var $form;
    var form;
    var upload;
    var $;
    var imgs='';
    var myreg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
    var reg = /^(\d{2})(\d{4})(\d{4})(\d{2})(\d{2})\d{2}(\d)(\d|X)$/;
    var shuzi = /^\d+(\.\d+)?$/;
    layui.use(['form', 'table', 'upload', 'jquery','element'], function () {
        $ = layui.jquery;
        form = layui.form;
        upload = layui.upload;
        $form = $('form');
        var table = layui.table;
        var element = layui.element;

        table.init('parse-table-demo',{
            height: 75
        })
    })



    var noRepeatAdd = false;
    function inviteSign(id) {
        if (noRepeatAdd) {
            return;
        }
        noRepeatAdd = true;
        $.ajax({
            url: '${ctx}/trader/inviteSignQr',
            type: 'post',
            data: {
                id:id
            },
            success: function (data) {
                if (data.code == "200") {
                   /* layer.msg("邀请成功！", {icon: 1});*/
                   /* parent.layer.closeAll(); //关闭弹层*/
                    closeDiv();
                    parent.layer.msg("邀请成功！", {icon: 1});
                    parent.table.reload('test'); //数据刷新
                } else {
                    layer.msg(data.errMsg, {icon: 2});
                }
            },
            complete: function () {
                noRepeatAdd = false;
            }
        });
    }

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

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



</script>
</body>
</html>
