<%@ page language="C#" masterpagefile="~/MasterPage/Restaurant.master" autoeventwireup="true" inherits="Shop_UserRate, DoodiiShop" title="Untitled Page" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Src="../Controls/Shop/RestStyle.ascx" TagName="RestStyle" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<style type="text/css">
.DivRateSum{display:inline;margin-top:10px;float:left;width:649px;height:51px;background-image:url(/images/shop/rate/pingjiatiao.jpg);}
.TableRateSum{border-collapse:collapse; width:610px;}
.TableRateSum th{word-wrap:break-word;overflow:hidden;background-color:#FDEAC9; border:1px solid #ce7b2d; height:37px; font-size:14px; font-weight:normal; color:#000;}
.TableRateSum td{word-wrap:break-word;overflow:hidden;text-align:center; background-color:#fff; border:1px solid #ce7b2d;height:37px; font-size:14px;}
.tabs_Default1
{
    height:31px;
    width:617px;
    background-image:url(/images/shop/rate/di.jpg);
    background-repeat:no-repeat;
    padding-left:30px;
}
.tabs_Default1 a:link, .tabs_Default1 a:visited, .tabs_Default1 a:hover
{
	display:block;
	float:left;
	font-size:14px;
	background-image:url(/images/shop/rate/ratevisited.jpg);
	color:#000;
	width:81px;
	height:31px;
	line-height:31px;
	text-align:center;
	margin-right:5px;
}
.tabs_Default1 a:hover
{
	background-image:url(/images/shop/rate/ratehover.jpg);
}
.tabs_Default1 a.selected:link, .tabs_Default1 a.selected:visited, .tabs_Default1 a.selected:hover
{
	background-image:url(/images/shop/rate/rateall.jpg);
	color:#000;
	width:81px;
	height;31px;
}
</style>
<script type="text/javascript">
var UserRate_vensonTabsht;
var UserRate_gPageSize = 10;
var UserRate_VensonNav = null;
var UserRate_Amount = -3;
var UserRate_loadht=function()
{
    var state = <%=State%>
  UserRate_vensonTabsht = new vensonTabs("divNavigtion","onChangeht","全&nbsp;&nbsp;&nbsp;&nbsp;部,好&nbsp;&nbsp;&nbsp;&nbsp;评,中&nbsp;&nbsp;&nbsp;&nbsp;评,差&nbsp;&nbsp;&nbsp;&nbsp;评",1, "Default1");
  UserRate_vensonTabsht.setIndex(state);
  UserRate_VensonNav = new vensonNav("UserRate_DivPage","userRate_GetList");
  UserRate_VensonNav.pageSize = UserRate_gPageSize;
  onChangeht(-3);
  UserRate_GetUserOrderRateTotal();
   
  
}
function onChangeht(index)
 {
    UserRate_VensonNav.pageIndex = 1;
        if(index ==0)
        {
            UserRate_Amount = -3;
        }
        else if(index == 1)
        {
            UserRate_Amount = 1;
        }
        else if(index == 2)
        {
            UserRate_Amount = 0;
        }
        else if(index == 3)
        {
            UserRate_Amount = -1 ;
        }
        userRate_GetList();
        
 }
 function userRate_GetList()
 {
    
    Shop_UserRate.GetUserRateList(<%=restId %>,UserRate_Amount,UserRate_VensonNav.pageSize,UserRate_VensonNav.pageIndex,UserRate_CallBackList);
     document.getElementById("divUserRateList").innerHTML = "<span style='font-size:14px; margin-left:260px'>数据正在加载...</span>";
 }
 function UserRate_CallBackList(res)
 {
    var ret = res.value;
    document.getElementById("divUserRateList").innerHTML = ret.HtmlStr;
    UserRate_VensonNav.render(ret.PageInfo.PageIndex,ret.PageInfo.TotalPage);  
     Shop_UserRate.UpdateRestManager(<%=restId %>,<%=State %>);
      
 }
function UserRate_GetUserOrderRateTotal()
{
    var ret = Shop_UserRate.GetUserRateData(<%=restId %>).value;
    if(ret != null)
    {
        var haoCount = ret.Rows[0]["haoCount"];
        var chaCount = ret.Rows[0]["chaCount"];
        var zhongCount = ret.Rows[0]["zhongCount"];
        var total = haoCount + chaCount + zhongCount;
        if(total == 0)
        {
             document.getElementById("spHaoRate").innerHTML = 0 +"%";
            document.getElementById("spChaRate").innerHTML = 0 +"%";
        }
        else
        {
            document.getElementById("spHaoRate").innerHTML = Math.round((haoCount/total)*100*100)/100 +"%";
            document.getElementById("spChaRate").innerHTML = Math.round((chaCount/total)*100*100)/100 +"%";
        }
        document.getElementById("spChaCount").innerHTML = chaCount;
        document.getElementById("spHaoCount").innerHTML = haoCount;
        document.getElementById("spZhongCount").innerHTML = zhongCount;
        
    }
}
 $(document).ready( function(){ UserRate_loadht()} );

</script>

<div class="DivRateSum">
    <div style="float:left;color:#000;padding-top:12px; padding-left:50px;display:inline;">好评率：<span class="f_import" id="spHaoRate">0%</span><br />差评率：<span class="f_import" id="spChaRate">0%</span></div>
    <div style="float:left;color:#000;padding-top:18px; padding-left:80px;font-size:14px;display:inline;">好评总数：<span class="f_import" id="spHaoCount">0</span>个&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;中评总数：<span class="f_import" id="spZhongCount">0</span>个&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;差评总数：<span class="f_import" id="spChaCount">0</span>个</div>
</div>
<div id="divNavigtion" style="float:left; margin-top:15px;display:inline;">
</div>
<div id="divUserRateList" style="background-color:#FFFAEE;border:1px solid #ffdd99; border-top:0px; width:615px; float:left; padding:15px; margin-bottom:15px;display:inline;">
    <table class="TableRateSum">
        <tr>
            <th style="width:60px;">序号</th>
            <th style="width:66px;">评价</th>
            <th style="width:246px;">附言</th>
            <th style="width:99px;">时间</th>
            <th style="width:139px;">评价人</th>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>

    </table>
</div>
<div style='clear:both;'></div>
<div id="UserRate_DivPage"></div>
</asp:Content>

