<%@ Page Language="C#" MasterPageFile="Admin.Master" AutoEventWireup="true" CodeBehind="Ordermanage.aspx.cs" Inherits="Mvcb2b.admin.Ordermanage" Title="订单管理" %>
<%@ Import Namespace="Mvcmode"%>
<%@ MasterType VirtualPath="Admin.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"><%string status = "";
                                                                                       if (Status1 != null)
                                                                                           status = Status1.ToString();
                                                                                       string curstatus0 = "";
                                                                                       string curstatus1 = "";
                                                                                       string curstatus3 = "";
                                                                                       switch (status)
                                                                                       {
                                                                                           case "0":
                                                                                               curstatus0 = "class=\"act-state\"";
                                                                                               break;
                                                                                           case "1":
                                                                                               curstatus1 = "class=\"act-state\"";
                                                                                               break;
                                                                                           case "3":
                                                                                               curstatus3 = "class=\"act-state\"";
                                                                                               break;
                                                                                           case "7": 
                                                                                               break;
                                                                                           default:
                                                                                               break;
                                                                                       }
        %>
<script type="text/javascript" src="../Comja/val_num.js"></script>  
<script type="text/javascript" src="Comja/fapiaom.js"></script>   
<script type="text/javascript">
    $(document).ready(function () {
        $(".com_suc_cancel").click(function (e) { e.preventDefault(); hidesucbox(); });
	});
	function upstate(id)
	{
		if (confirm("确认更新付款状态，付款流程完成将不能撤销！"))
		{
		var paystate=escape($("#paystate_"+id).val());
		 $.ajax({
			   type: "POST",
			   url: "jquery/upstate.aspx",
			   dataType: "html",
			   data: { "id": "" + id+ "","paystate": "" + paystate + ""}, /*传输的参数*/
			   success: function(msg) {
				   if (msg =="ok") {
					   alert("更新成功!");	
					   window.location.href="Ordermanage.aspx";	  
				  }
				  if (msg=="have")
				  {
					  alert("该订单已付款，系统已完成授权流程，不能撤销！");
				  }
			   }, error: function(e) { alert("error-$.ajax"+e);}
		   });	
		}
	}
function delorder(id)
{
	if (confirm("确认删除此订单吗？"))
	{
		$.ajax({
			type: "POST",
			url: "jquery/orderdel.aspx",
			dataType: "text",
			data: { "id": "" + id+ ""}, /*传输的参数*/
			success: function(msg) {
				if (msg =="ok") {
					/*显示*/
					tr_orderid="order"+id;
					$('#'+tr_orderid).remove();		  
				}
			}, error: function(html) { alert("error-$.ajax"+html); }
		});	
	}
}

function showsucbox() {
    $(".com_suc_mask").show();
    $(".com_suc_box").show();
}
function hidesucbox() {
    $(".com_suc_mask").hide();
    $(".com_suc_box").hide();
}

</script>    
<div class="path">当前位置： 系统管理 >>  订单管理</div>
<h3 class="nob">订单管理 </h3>
<div class="menusearch">
    <div style="float:left;padding-left:20px;"><input type="button" value="重置搜索" onclick="javascript:window.location.href='Ordermanage.aspx';" class="submit"  /> &nbsp; 订单号码：</div>
    <div style="float:left;padding-left:0px;"><input type="text" class="key" name="key" id="key" value="<%=keyword %>" /> </div>
    <div style="float:left;padding-left:0px;">
    &nbsp;<asp:Button ID="Search1" runat="server" Text="搜索"  CssClass="submit"   onclick="Search1_Click" />  <a href="Ordermanage.aspx"  style="margin-left:20px;margin-right:10px;">所有订单</a> <a href="Ordermanage.aspx?status=0" <%=curstatus0 %> style="margin-left:10px;margin-right:10px;">未付款</a> <a href="Ordermanage.aspx?status=1" <%=curstatus1 %> style="margin-left:10px;margin-right:10px;">已付款</a> <a href="Ordermanage.aspx?status=3" <%=curstatus3 %> style="margin-left:10px;margin-right:10px;">已开发票</a> </div>
</div>
<table width="96%" border="0" align="center" cellpadding="2" style="background-color:#f5f5f5;" cellspacing="1">
          <tr style="background-color:#ffffff;font-weight:bold;">
            <td>编号</td>
            <td style="width:100px;">订单号码</td>
            <td >下单时间</td>
            <td>套餐名称</td>            
            <td style="width:80px;text-align:center">价格（元）</td>  
            <td style="width:80px;text-align:center">支付方式</td> 
            <td style="width:150px;text-align:center">有效日期</td>
            <td style="width:200px;text-align:center">用户名</td>  
            <td style="width:110px;text-align:center">状态</td>
            <td style="width:50px;text-align:center">删除</td>
          </tr>
        <asp:Repeater ID="Repeater1" runat="server">
          <ItemTemplate>
          <tr style="background-color:#ffffff" id="order<%#(Container.DataItem as E_order).Id%>">
            <td><%#Eval("id")%></td>       
            <td><%#(Container.DataItem as E_order).Ordernum%></td>
	        <td><%#(Container.DataItem as E_order).Ordertime%></td>   
            <td class="name" ><%#(Container.DataItem as E_order).Package.Pname%> <%#Statusstr2((Container.DataItem as E_order).Status,(Container.DataItem as E_order).Isfapiao, (Container.DataItem as E_order).Id)%></td>
            <td style="text-align:center"><%#(Container.DataItem as E_order).Package.Pfee%></td> 
            <td style="text-align:center"><%#Paywaystr((Container.DataItem as E_order).Payway)%></td>
             <td style="text-align:center"><%#Fun.Totime((Container.DataItem as E_order).Package.Startdate).ToShortDateString()%> - <%#Fun.Totime((Container.DataItem as E_order).Package.Enddate).ToShortDateString()%></td>
            <td style="text-align:center"><%#Userstr((Container.DataItem as E_order).Userid)%></td>
            <td style="text-align:center">
            <select id="paystate_<%#(Container.DataItem as E_order).Id%>" name="paystate_<%#(Container.DataItem as E_order).Id%>">
            <option value="<%#(Container.DataItem as E_order).Status%>"><%#Statusstr((Container.DataItem as E_order).Status)%></option>
            <option value="0">未付款</option>
            <option value="1">已付款</option>
            <option value="3">开发票</option>
            </select> <span style="padding-left:2px;"><input type="button" name="up2" id="up2" onclick="upstate(<%#(Container.DataItem as E_order).Id%>);"  value="更新" /></span>
            </td>

            <td style="text-align:center"><a href="javascript:void(0);" onclick="delorder(<%#(Container.DataItem as E_order).Id%>);"><span>删除</span></a></td>
          </tr></ItemTemplate>
         </asp:Repeater>
         <asp:Literal runat="server"  ID="noms"  />
        </table> 
<div class="pagemsg" >
<table  border="0" align="center" cellpadding="0" cellspacing="0" width="90%">
          <tr><td><asp:Literal id="Message" runat="server" ></asp:Literal></td>
          </tr><tr>
          <td style="text-align:right;">&nbsp; 直接进入 <asp:textbox  id="gopage" Width="30px"   runat="server"  CssClass="gopage" > </asp:textbox> 页   <asp:button id ="Submithao"  Text="Go" runat="server" OnClick="Submithao_Click" CssClass="gopage" ></asp:button> </td>
          </tr></table>
</div>   

<p style="text-align:left;padding-left:80px;font-size:12px;line-height:20px;">? 帮助：<br />

</p>
<div class="com_suc_mask"></div>
<div class="com_suc_box">
<div class="com_suc"> 
<div class="com_suc_form">
<span class="com_suc_tip">发票信息</span> 
<div class="clearfix"> 
<span class="com_suc_con"><span class="fatd1">发票抬头：</span><span class="fatd2" id="companyname_txt"><strong></strong></span></span>
<span class="com_suc_con2"><span class="fatd1">税号：</span><span class="fatd2" id="shuihao_txt"><strong></strong></span></span>
<span class="com_suc_con2"><span class="fatd1">收件人：</span><span class="fatd2" id="contact_txt"><strong></strong></span></span>
<span class="com_suc_con2"><span class="fatd1">地址：</span><span class="fatd2" id="address_txt"><strong></strong></span></span>
<span class="com_suc_con2"><span class="fatd1">手机：</span><span class="fatd2" id="mobile_txt"><strong></strong></span></span>
<span class="com_suc_con2" style="height:102px;"><span class="fatd1">备注：</span><span class="fatd2" id="remark_txt"><strong></strong></span></span>
<input type="hidden" name="orderid_txt" id="orderid_txt"  value="">
 </div> 
 </div><!--com_suc_form-->
<div class="com_suc_action"> <a href="javascript:void(0);" class="com_suc_cancel">关闭</a> </div><!--com_suc_action-->
 </div></div><!--com_suc_box-->    
</asp:Content>
