{layout:default} {class:Shop.Admin.agent.productagentuser}
<lbhead>
    <title><%=Tag("代理资格")%>-<%=Tag("商品代理")%>-<%=site.title%></title>
</lbhead>
<lbpath>
    <div class="tools">
    <ul>
    <li class="add"><a href="javascript:void(0);" onclick="Edit(0);"><b></b><span><%=Tag("添加")%></span></a></li>
    <li class="del"><a href="javascript:void(0);" onclick="DEL();"><b></b><span><%=Tag("删除")%></span></a></li>
    <li class="name"><span id="navIgation"><%=Tag("当前位置")%>：<a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a> > <%=Tag("商品代理")%> > <%=Tag("代理资格")%></span></li>
    </ul>
    </div>
</lbpath>
<lbbody>
    <div class="searchbox clear">
        <input type="text" id="key" name="key" class="input-query" value="<%=key %>" onkeydown="if(event.keyCode==13){search_();}" /><input type="button" id="btnSou" class="btn-query" onclick="search_();" value="" />
    </div>
    <table class="datalist">
        <tr class="title">
            <th style="width: 40px" class="selectAll">
                <a href="javascript:void(0);" onclick="$('input[name=\'sid\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
            </th>
            <th style="width: 150px">
                <%=Tag("会员")%>
            </th>
            <th style="width: 100px">
                <%=Tag("等级")%>
            </th>
            <th style="width: 80px">
                <%=Tag("佣金")%> %
            </th>
            <th style="width: 130px">
                <%=Tag("代理商品数")%>/<%=Tag("上限")%>
            </th>
            <th style="width: 130px">
                <%=Tag("修改商品次数")%>/<%=Tag("上限")%>
            </th>
             <th style="width: 130px">
                <%=Tag("添加时间")%>
            </th>
            <th style="width: 130px">
                <%=Tag("过期时间")%>
            </th>
            <th style="width: 80px">
                <%=Tag("状态")%>
            </th>
            <th>
                <%=Tag("操作")%>
            </th>
        </tr>
        <%foreach (DB.LebiShop.Lebi_Agent_Product_User model in models)
          {%>
        <tr class="list" ondblclick="Edit(<%=model.id %>)">
            <td style="text-align:center">
                <input type="checkbox" value="<%=model.id %>" name="sid" />
            </td>
            <td>
                <%=model.User_UserName%>
            </td>
            <td>
                <%=GetLevelName(model.Agent_Product_Level_id)%>
            </td>
            <td>
                <%=model.Commission%>
            </td>
            <td>
                <a href="product.aspx?key=<%=model.User_UserName %>"><%=DB.LebiShop.B_Lebi_Agent_Product.Counts("User_id=" + model.User_id + "")%>/<%=model.Count_Product%></a>
            </td>
            <td>
                <%=model.Count_product_change_used%>/<%=model.Count_product_change%>
            </td>
            <td>
                <%=model.Time_add.ToShortDateString()%>
            </td>
            <td>
                <%=model.Time_end.ToShortDateString()%>
            </td>
            <td>
                <%=model.IsFailure==1?Tag("失效"):Tag("正常")%>
            </td>
            <td>
                <a href="javascript:void(0)" onclick="Edit(<%=model.id %>)"><%=Tag("编辑")%></a>
                <a href="product.aspx?key=<%=model.User_UserName %>"><%=Tag("查看商品")%></a>
                <a href="agentmoney.aspx?username=<%=model.User_UserName %>"><%=Tag("查看佣金")%></a>
            </td>
        </tr>
        <%} %>
    </table> 
    <script type="text/javascript">
        function search_() {
            var key = $("#key").val();
            window.location.href = "?key=" + escape(key);
        }
        function Edit(id) {
            if (id == 0) { var title_ = "<%=Tag("添加商品代理")%>"; } else { var title_ = "<%=Tag("编辑商品代理")%>"; }
            var url_ = "paoductagentuser_edit_window.aspx?id=" + id;
            var width_ = 600;
            var height_ = 500;
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
        function DEL() {
            if (!confirm("<%=Tag("确认要删除吗？")%>"))
                return false;
            var ids = GetChkCheckedValues("sid");
            var postData = { "ids": ids };
            var url = "<%=site.AdminPath %>/ajax/ajax_agent.aspx?__Action=ProductAgentUser_Del";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
    </script>
</lbbodyt>
<lbbottom>
<div class="bottom" id="body_bottom">
    <%=PageString%>
</div>
</lbbottom>