<%@ page import="com.lightinit.hsdataportal.dictionary.*" %>
<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
    String basePath = request.getContextPath();
    String resourcePath = basePath + "/resource";
%>
<!doctype html>
<html>
<head>
    <title>我的数据</title>
    <meta charset="utf-8">
    <jsp:include page="../common/head.jsp"></jsp:include>
</head>
<body>
<jsp:include page="../common/body_header.jsp"></jsp:include>
<jsp:include page="../common/user_center_header.jsp"></jsp:include>
<div class="user-mid2" id="shouyeId">
    <div class="xinxi0">
        <div class="user-mid0">
            <div class="if">
                <input type="hidden" id="type" value="${tab}"/>
                <span onclick="fnApplyData()" class="xx0" id="applyDataId"><a class="qxbm" href="javascript:void(0);">申请的数据</a></span>
                <span onclick="fnFollowData()" class="xx"  id="followDataId"><a class="qxbm" href="javascript:void(0);">关注的数据</a></span>
            </div>
            <div class="clearfix"></div>
            <div class="xx-main" id="fnApplyDataView" >
                <table >
                    <tr bgcolor="#f2f2f2" class="biaotou1">
                        <td class="td5">数据名称</td>
                        <td class="td6">数据描述</td>
                        <td class="td3">发布机构</td>
                        <td class="td3">申请时间</td>
                        <td class="td3">开放类型</td>
                        <td class="td3">状态</td>
                        <td class="td3">操作</td>
                    </tr>
                    <c:if test="${outputModel !=null}">
                    <c:forEach items="${outputModel}" var="item">
                        <tr>
                            <td><a class="qxbm" href="<%=basePath%>/open/data/detail.htm/${item.publishSettingId}">${item.resourceName}</a></td>
                            <td>${item.resourceSummary}</td>
                            <td>${item.sectorName}</td>
                            <td><fmt:formatDate value="${item.applyTime}" pattern="yyyy-MM-dd"/></td>
                            <td>${item.openType}</td>
                            <td class="td3" >${item.orderState !=null ?'已申请': item.authState}</td>
                            <td class="td3" >
                                <c:choose>
                                    <c:when test="${item.orderState != null}">
                                        <a class="qxbm" href='<%=basePath%>/open/mydata/download.action/${item.resourceAuthId}'>下载</a>
                                    </c:when>
                                    <c:when test="${item.orderState ==null && item.authState =='待授权'}">
                                        --
                                    </c:when>
                                    <c:when test="${item.orderState ==null && item.authState =='授权成功'}">
                                        <input type="hidden"  value="${item.authState}"/>
                                        <input type="hidden"  value="${item.auditOpinion}"/>
                                        <input type="hidden"  value="${item.sectorName}"/>
                                        <input type="hidden"  value="${item.publishSettingId}"/>
                                        <a  class="qxbm" href='javascript:void(0)' onclick="showApply(this)">申请</a>|<a  class="qxbm" href='javascript:void(0)' onclick="showDiv(this)">查看反馈</a>
                                    </c:when>
                                    <c:when test="${item.orderState ==null && item.authState !='授权成功'}">
                                        <input type="hidden"  value="${item.authState}"/>
                                        <input type="hidden"  value="${item.auditOpinion}"/>
                                        <input type="hidden"  value="${item.sectorName}"/>
                                        <a class="qxbm" href='javascript:void(0)' onclick="showDiv(this)">查看反馈</a>
                                    </c:when>
                                </c:choose>
                            </td>
                        </tr>
                    </c:forEach>
                    </c:if>
                </table>
            </div>
            <%--///////////////////付费页面///////////////////////--%>
            <div id="divUnConditionApply" class="fade" style="display: none;">
                <div class="window">
                    <div class="top00">
                        <span class="p">申请信息</span>
                        <img src="<%=resourcePath%>/images/icon_guanbi.png" alt="" class="guanbi" onclick="closeDivApply11()">
                    </div>
                    <div class="form6">
                        <form id="unCoditionApplyFrom">
                            <div class="application-font0">
                                <span class="application-font1">开放类型：</span>
                                <span class="application-font2">${toPay.openType}</span>
                            </div>
                            <div class="application-font">
                                <span class="application-font1">资源名称：</span>
                                <span class="application-font2">${toPay.resourceName}</span>
                            </div>
                               <div class="application-font">
                                   <span class="application-font1">资源价格：</span>
                                   <span class="application-font2">${toPay.packagePrice ==null?0:toPay.packagePrice}</span>元
                               </div>
                               <div class="jiage-xinxi">
                                   已选择<span class="shuzi">1</span>个套餐，应付：¥<span class="shuzi">${toPay.packagePrice==null?0:toPay.packagePrice}</span>元
                               </div>
                               <div class="clearfix"></div>
                               <div>
                                   <div class="xieyi0">
                                       <span><input type="checkbox" class="box0" value="我已阅读并接受" checked="checked"></span>
                                       <span class="fuwu00">阅读并接受<a class="xieyi" target="_blank" href="<%=basePath%>/open/static/agreement_service">《平台服务协议》</a></span>
                                   </div>
                                   <input type="hidden" id="orderNumber" value="${toPay.orderNumber}">
                                   <input type="hidden" id="packagePrice" value="${toPay.packagePrice}">
                                   <div class="shenqing" onclick="fnApply(this)">立即支付</div>
                               </div>
                        </form>
                    </div>
                </div>
            </div>
            <%--//////////////////////////////////////////--%>
            <div class="xx-main" id="fnFollowDataView" >
                <table >
                    <tr bgcolor="#f2f2f2" class="biaotou1">
                        <td class="td5">数据名称</td>
                        <td class="td6">数据描述</td>
                        <td class="td3">发布机构</td>
                        <td class="td3">发布时间</td>
                        <td class="td3">关注时间</td>
                        <td class="td3">操作</td>
                    </tr>
                    <c:if test="${followDataList !=null}">
                        <c:forEach items="${followDataList}" var="item">
                            <tr>
                                <td><a class="qxbm" href="<%=basePath%>/open/data/detail.htm/${item.publishSettingId}">${item.resourceName}</a></td>
                                <td>${item.resourceSummary}</td>
                                <td>${item.sectorName}</td>
                                <td><fmt:formatDate value="${item.auditedAt}" pattern="yyyy-MM-dd"/></td>
                                <td><fmt:formatDate value="${item.createdAt}" pattern="yyyy-MM-dd"/></td>
                                <td class="td3"><a class="qxbm" href='<%=basePath%>/open/mydata/delFollow.action/2/${item.followId}'>取消关注</a></td>
                            </tr>
                        </c:forEach>
                    </c:if>
                </table>
            </div>
        </div>
    </div>
</div>
<div class="clearfix"></div>
<%--////////////////////查看反馈//////////////////////--%>
<div id="feekbackId" class="fade" style="display: none;">
    <div class="window" >
        <div class="top00">
            <span class="p">反馈详情</span>
            <img src="<%=resourcePath%>/images/icon_guanbi.png" alt="" class="guanbi" onclick="closeDivApply()">
        </div>
        <div class="form6">
            <form id="requirementFormId">
                <div class="application-font0">
                    <span class="application-font1">授权状态：</span>
                    <span class="application-font2" id="area11"></span>
                </div>
                <div class="application-font">
                    <span class="application-font1">授权反馈：</span>
                    <span class="application-font2" id="area22"></span>
                </div>
                <div class="application-font">
                    <span class="application-font1">授权部门：</span>
                    <span class="application-font2" id="area33"></span>
                </div>
            </form>
        </div>
    </div>
</div>
<%--//////////////////////////////////////////--%>
<jsp:include page="../common/body_footer.jsp"></jsp:include>
</body>
<script type="text/javascript">

    //是否弹出付费框
    if(${paramType=="2"}){
        $('#divUnConditionApply').show();
    }
    //关闭付费框
    function closeDivApply11(){
        $('#divUnConditionApply').hide();
    }
    //tab页切换
   if ($("#type").val() !=2){
       fnApplyData();
   }else{
       fnFollowData();
   }
    function fnApplyData(){
        $('#fnApplyDataView').show();
        $('#fnFollowDataView').hide();
        $("#applyDataId").addClass("xx01");
        $("#followDataId").removeClass("xx01");
    }
    function fnFollowData(){
        $('#fnApplyDataView').hide();
        $('#fnFollowDataView').show();
        $("#followDataId").addClass("xx01");
        $("#applyDataId").removeClass("xx01");
    }

    //显示反馈页面
    function showDiv(tr){
        $('#area11').text($(tr).parent().children('input:eq(0)').val());
        var option=$(tr).parent().children('input:eq(1)').val()
        $('#area22').text(option==''?'无':option);
        $('#area33').text($(tr).parent().children('input:eq(2)').val());
        $('#feekbackId').show();
    }
    //关闭
    function closeDivApply(){
        $('#feekbackId').hide();
    }

    //支付
    function fnApply(tr){
        var packagePrice = $('#packagePrice').val();
        var orderNumber = $('#orderNumber').val();
        window.location.href="<%=basePath%>/alipay/index.htm/"+orderNumber+"/"+packagePrice;
    }

</script>
</html>