<%@ Page Language="c#" Codebehind="Coupons.aspx.cs" AutoEventWireup="true" Inherits="XpShop.Manage.Coupons" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<!--#include file="../inc/head2.inc"-->
	    <title>Coupons</title>
		<script type="text/javascript" src="../inc/commond.js"></script>
	    <script src="inc/Coupons.function.js" type="text/javascript"></script>
        <script src="inc/Coupons.ready.js" type="text/javascript"></script>
        <script src="inc/PageBar.js" type="text/javascript"></script>
        <script type="text/javascript" src="../inc/multi_popup.js"></script>
		<script type="text/javascript" src="inc/jquery.easydrag.handler.beta2.js"></script>
		<script src="inc/ui.datepicker.cn.js" type="text/javascript"></script>
		<link type="text/css" rel="stylesheet" href="inc/ui.datepicker.css" />
		<link type="text/css" rel="stylesheet" href="../style/multi_popup.css" />
		<style type="text/css">
		    .c1{width:5%;}
            .c2{width:5%;}
            .c3{width:15%;}
            .c4{width:12%;}
            .c5{width:8%;}
            .c6{width:5%;}
            .c7{width:10%;}
            .c8{width:10%;}
            .c9{width:10%;}
            .c10{width:10%;}
            .c11{width:5%;}
            .c12{width:5%;}
            
            .cc1{width:5%;}
            .cc2{width:95%;}
            
            .bb1{ width:5%}
		    .bb2{ width:30%}
		    .bb3{ width:20%}
		    .bb4{ width:15%}
		    .bb5{ width:15%}
		    .bb6{ width:15%}
		</style>
		<script type="text/javascript">
		    var solution = '<%=solution %>';
		    var couponsID = '<%=Request.QueryString["CouponsID"] %>';
		</script>
	</head>
	<body>
	    <div class="container">
		<div class="sub_container">
		<form id="Form1" method="post" runat="server">
		    <% if (Request.QueryString["Action"] != "Add" && Request.QueryString["Action"] != "Modify") { %>
		        <div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img alt="" src="../images/admin_title.jpg" height="9px" width="8px" align="absmiddle" />优惠券管理</div>
		        <%--添加优惠券--%>
		        <div id="rule" style="display:none;">
		            <div style="border:solid 2px #6b94ad;background-color:White;">
		                <table width="100%">
    		                <tr style="background-color:White;">
    		                    <td colspan="2"><input type="button" id="btnAddRule" class="inputbtn" value="添加优惠券发放途径"/>&nbsp;&nbsp;
    		                        [您可以通过添加促销活动发放此优惠券]
    		                    </td>
    		                </tr>
    		                <tr style="background-color:#E3EAEE;">
    		                    <th class="cc1 ccenter"><input type="checkbox" id="chkRuleAll" name="chkRuleAll" /></th>
    		                    <th class="cc2">优惠券发放途径</th>
    		                </tr>
		                </table>
		                <table id="ruledatas" width="100%" cellspacing="0" cellpadding="0" class="llist">
		                    <tr id="ruletemplate" style="display:none;background-color:White;">
    		                    <td class="cc1 ccenter" id="rulecheckbox"></td>
    		                    <td class="cc2" id="ruleOperate"></td>
    		                </tr>
		                </table>
		            </div>
		        </div>
		        <div class="sub_container_operation">
		            <table width="100%">
		                <tr>
			                <td>
			                    <input type="button" id="btnAddCoupons" name="btnAddCoupons" value="添加优惠券" class="inputbtn" />
				                <input type="button" id="btnDelete" name="btnDelete" value="删除优惠券" class="inputbtn" />
			                </td>
			                <td align="center" style="visibility:hidden;">
				                
				            </td>
		                </tr>
		            </table>
		        </div>
		        <div class="sub_container_listhead" style="padding:0px;">
                    <table cellspacing="0" cellpadding="0" class="llist">
                        <tr id="listhead"><%--id="listhead不能少"--%>
	                        <th class="c1"><input type="checkbox" id="chkAll" name="chkAll" /></th>
	                        <th class="c2">下载</th>
	                        <th class="c3">优惠券名称</th>
	                        <th class="c4">优惠券号码</th>
	                        <th class="c5">已发数量</th>
	                        <th class="c6">状态</th>
	                        <th class="c7">类型</th>
	                        <th class="c8">兑换积分</th>
	                        <th class="c9">开始时间</th>
	                        <th class="c10">结束时间</th>
	                        <th class="c11 Modify">修改</th>
	                        <th class="c12">删除</th>               
	                    </tr>
                    </table>
                </div>
		        <div class="sub_container_content" style="padding:0px;">
			        <table id="datas" cellspacing="0" cellpadding="0" class="llist">
				        <tr id="template" style="display:none;"><%--id="template"不能少--%>
					        <td class="c1 ccenter" id="checkbox"></td>
					        <td class="c2 ccenter" id="DownLoad"></td>
					        <td class="c3" id="CouponsName"></td>
					        <td class="c4 ccenter" id="CouponsPrefix"></td>
					        <td class="c5 ccenter" id="CouponsGenQuantity"></td>
					        <td class="c6 ccenter" id="Status"></td>
					        <td class="c7 ccenter" id="Type"></td>
					        <td class="c8 ccenter" id="CouponsPoint"></td>
					        <td class="c9 ccenter" id="TimeBegin"></td>
					        <td class="c10 ccenter" id="TimeEnd"></td>
					        <td class="c11 ccenter" id="Modify"></td>
					        <td class="c12 ccenter" id="Delete"></td>
				        </tr>
			        </table>
		        </div>
		        <div class="sub_container_page" id="pageDataList1_Pager">
	                <!-- 翻页-->
	                <!-- 翻页结束-->
		        </div>
		        
		        
		        <%--添加优惠券End--%>
		    <%}else{ %>
		        <%--添加或修改--%>
		        <div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img alt="" src="../images/admin_title.jpg" height="9px" width="8px" align="absmiddle" />优惠券管理<img alt="" src="../images/admin_title.jpg" height="9px" width="8px" align="absmiddle" />优惠券内容</div>
		        
		        <div class="sub_container_content" id="sub_container">
		            <div class="frame">
		                <div class="frame_content">
		                    <div id="step_1">
		                        <table cellSpacing="0" cellPadding="0" class="ptable">
		                            <tr>
		                                <th class="tl">优惠券名称：</th>
		                                <td class="tr"><asp:TextBox ID="txtCouponsName" runat="server" Width="200px" Height="18px" style="line-height:18px;"></asp:TextBox> <font color="#FF3300">*</font></td>
		                            </tr>
		                            <tr>
		                                <th class="tl">优惠券号码：</th>
		                                <td class="tr"><span id='couponstype'>A</span><asp:TextBox ID="txtCouponsPrefix" runat="server" Width="192px" Height="18px" style="line-height:18px;"></asp:TextBox> <font color="#FF3300">*</font></td>
		                            </tr>
		                            <tr>
		                                <th class="tl">状态：</th>
		                                <td class="tr">
		                                    <asp:RadioButton ID="rbtnStatusNo" runat="server" Text="启用" GroupName="Status" />
                                            <asp:RadioButton ID="rbtnStatusOff" runat="server" Text="禁用" Checked="true" GroupName="Status" />
		                                </td>
		                            </tr>
		                            <tr>
		                                <th class="tl">类型：</th>
		                                <td class="tr">
		                                    <asp:RadioButton ID="rbtnTpyeA" runat="server" Text="一张可无限使用的优惠券" Checked="true" GroupName="Type" />
                                            <asp:RadioButton ID="rbtnTpyeB" runat="server" Text="多张只能使用一次的优惠券" GroupName="Type" />
		                                </td>
		                            </tr>
		                        </table>
		                    </div>
		                    
		                    <div id="step_2" style="display:none;">
		                        <table cellSpacing="0" cellPadding="0" class="ptable">
		                            <tr>
		                                <th class="tl"><input type="radio" name="promotion" value="1" checked="checked" /></th>
		                                <td class="tr">优惠券规则--商品直接打折，如全场女鞋8折。可以对商品任意折扣，适合低价清货促销</td>
		                            </tr>
		                            <tr>
		                                <th class="tl"><input type="radio" name="promotion" value="2" /></th>
		                                <td class="tr">优惠券规则--购物车中商品总金额大于指定金额，客户就可得到指定的%off折扣</td>
		                            </tr>
		                            <tr>
		                                <th class="tl"><input type="radio" name="promotion" value="3" /></th>
		                                <td class="tr">优惠券规则--购物车中商品总金额大于指定金额，就可立减某金额</td>
		                            </tr>
		                            <%--<tr>
		                                <th class="tl"><input type="radio" name="promotion" value="4" /></th>
		                                <td class="tr">优惠券规则--购物车中商品总金额大于指定金额，客户可获得一张优惠券</td>
		                            </tr>
		                            <tr>
		                                <th class="tl"><input type="radio" name="promotion" value="5" /></th>
		                                <td class="tr">优惠券规则--顾客购买指定的商品，可获得翻倍积分或者x倍积分</td>
		                            </tr>
		                            <tr>
		                                <th class="tl"><input type="radio" name="promotion" value="6" /></th>
		                                <td class="tr">优惠券规则--购物车中商品总金额大于指定金额，免运费</td>
		                            </tr>
		                            <tr>
		                                <th class="tl"><input type="radio" name="promotion" value="7" /></th>
		                                <td class="tr">优惠券规则--购物车中商品总金额大于指定金额，赠送某个赠品</td>
		                            </tr>--%>
		                        </table>
		                    </div>
		                    
		                    <div id="step_3" style="display:none;">
		                        <table cellSpacing="0" cellPadding="0" class="ptable">
		                            <tr id='ddyhtj'>
		                                <th class="tl">订单优惠条件：</th>
		                                <td class="tr">
		                                    <asp:TextBox ID="txtOrderMoneyFrom" runat="server" Height="18px" Style="line-height: 18px;" Width="80px" onkeyup="value=value.replace(/[^(\d|\.)]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^(\d|\.)]/g,''))"></asp:TextBox>
                                            ≤ 订单金额 ＜
                                            <asp:TextBox ID="txtOrderMoneyTo" runat="server" Height="18px" Style="line-height: 18px;" Width="80px" onkeyup="value=value.replace(/[^(\d|\.)]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^(\d|\.)]/g,''))"></asp:TextBox> <font color="#FF3300">*</font>
		                                </td>
		                            </tr>
		                            <tr>
		                                <th class="tl">允许参加会员等级：</th>
		                                <td class="tr"><asp:CheckBoxList ID="chkListMemberGroup" runat="server" RepeatDirection="Horizontal" nane="chkListMemberGroup"></asp:CheckBoxList></td>
		                            </tr>
		                            <tr>
		                                <th class="tl">优惠券开始时间：</th>
		                                <td class="tr"><asp:TextBox ID="txtTimeBegin" runat="server" Width="120px" Height="18px" style="line-height:18px;background-image:url(../images/calendar.gif);background-repeat:no-repeat;padding-left:20px;" ReadOnly="true"></asp:TextBox> <font color="#FF3300">*</font></td>
		                            </tr>
		                            <tr>
		                                <th class="tl">优惠券结束时间：</th>
		                                <td class="tr"><asp:TextBox ID="txtTimeEnd" runat="server" Width="120px" Height="18px" style="line-height:18px;background-image:url(../images/calendar.gif);background-repeat:no-repeat;padding-left:20px;" ReadOnly="true"></asp:TextBox> <font color="#FF3300">*</font></td>
		                            </tr>
		                            <tr id='gydzk'>
		                                <th class="tl">请输入给予的折扣：</th>
		                                <td class="tr"><asp:TextBox ID="txtDiscount" runat="server" Width="200px" Height="18px" style="line-height:18px;" onkeyup="value=value.replace(/[^(\d|\.)]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^(\d|\.)]/g,''))"></asp:TextBox> <font color="#FF3300">*</font>&nbsp;&nbsp;如果打9折，请输入0.9；</td>
		                            </tr>
		                            <tr id='yhdje'>
		                                <th class="tl">请输入优惠的金额：</th>
		                                <td class="tr"><asp:TextBox ID="txtReduce" runat="server" Width="200px" Height="18px" style="line-height:18px;" onkeyup="value=value.replace(/[^(\d|\.)]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^(\d|\.)]/g,''))"></asp:TextBox> <font color="#FF3300">*</font></td>
		                            </tr>
		                            <tr>
		                                <th class="tl">优惠券描述：</th>
		                                <td class="tr"><asp:TextBox ID="txtDescription" runat="server" Width="250px" Height="120px" TextMode="MultiLine" style="line-height:18px;"></asp:TextBox> <font color="#FF3300">*</font></td>
		                            </tr>
		                        </table>
		                    </div>
		                    
		                    <div id="step_4" style="display:none;">
		                        <table cellSpacing="0" cellPadding="0" class="ptable">
		                            <tr>
		                                <th class="tl"><span id="selectproduct">选择商品</span>：</th>
		                                <td class="tr"><input type="radio" name="allproduct" value="所有商品" checked="checked" /><span id='sysp'>所有商品</span></td>
		                            </tr>
		                        </table>
		                        <table cellSpacing="0" cellPadding="0" class="ptable" id='spxz'>
		                            <tr>
		                                <th class="tl">商品选择：</th>
		                                <td class="tr">
		                                    <div style="border:solid 1px #CCCCCC;margin:10px;width:94%;border-right:solid 2px #CCCCCC;border-bottom:solid 2px #CCCCCC;padding:5px;">
                                                <div class="sub_container_operation">
	                                                <table width="100%">
	                                                    <tr>
		                                                    <td>
			                                                    <input type="button" id="btnAdd" name="btnDelete" value="添加" class="inputbtn" />
			                                                    <input type="button" id="btnClear" name="btnClear" value="清空" class="inputbtn" />
			                                                    &nbsp;&nbsp;&nbsp;&nbsp;已选择商品数量:<span id="count">0</span>
		                                                    </td>
	                                                    </tr>
	                                                </table>
	                                            </div>                                            
                                                
                                                <div class="sub_container_listhead" style="padding:0px;width:100%;">
                                                    <table border="1" cellspacing="0" bordercolor="#000000" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
                                                        <tr>
                                                            <th class="cc1">操作</th>
                                                            <th class="cc2" style="text-align:left;">商品名称</th>
                                                        </tr>
                                                    </table>
                                                </div>
                                                <div class="sub_container_listhead" style="padding:0px;overflow-y:scroll;height:300px;width:98%;">
                                                    <table id="listresult">
                                                        <tr id="resulthead" style="display:none;">
                                                            <td class="c7 ccenter"></td>
                                                            <td class="c8"></td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
		                                </td>
		                            </tr>
		                        </table>
		                    </div>
		                    
		                    <div id="step_5" style="display:none;">
		                        <table cellSpacing="0" cellPadding="0" class="ptable">
		                            <tr>
		                                <th class="tl" colspan="2"><b>请确认优惠券信息</b></th>
		                            </tr>
		                            <tr>
		                                <th class="tl">优惠券名称：</th>
		                                <td class="tr"><asp:TextBox ID="promotionName_bak" runat="server" Width="200px" Height="18px" style="line-height:18px;" Enabled="false"></asp:TextBox></td>
		                            </tr>
		                            <tr>
		                                <th class="tl">开始时间：</th>
		                                <td class="tr"><asp:TextBox ID="promotionTimeBegin_bak" runat="server" Width="120px" Height="18px" style="line-height:18px;background-image:url(../images/calendar.gif);background-repeat:no-repeat;padding-left:20px;" ReadOnly="true" Enabled="false"></asp:TextBox></td>
		                            </tr>
		                            <tr>
		                                <th class="tl">结束时间：</th>
		                                <td class="tr"><asp:TextBox ID="promotionTimeEnd_bak" runat="server" Width="120px" Height="18px" style="line-height:18px;background-image:url(../images/calendar.gif);background-repeat:no-repeat;padding-left:20px;" ReadOnly="true" Enabled="false"></asp:TextBox></td>
		                            </tr>
		                            <tr>
		                                <th class="tl" colspan="2"><b>优惠券描述</b></th>
		                            </tr>
		                            <tr>
		                                <th class="tl">优惠券描述：</th>
		                                <td class="tr"><asp:TextBox ID="promotionDescription_bak" runat="server" Width="250px" Height="120px" TextMode="MultiLine" style="line-height:18px;" Enabled="false"></asp:TextBox></td>
		                            </tr>
		                        </table>
		                    </div>
		                    
		                </div>
		            </div>
		        </div>
		        
                <%--添加或修改End--%>
		    
		        <div class="save" style=" position:absolute;left:9px;">
		            <input type="button" id="btnPrev" value="上一步" style="display:none;" class="inputbtn" />
                    <input type="button" id="btnNext" value="下一步" class="inputbtn" />
                    <asp:Button ID="btnSave" OnClick="btnSave_Click" runat="server" Text="完 成" style="display:none;" class="inputbtn" />
                    <input type="button" id="btnCancel" value="取 消" class="inputbtn" />
                    <input type="hidden" id="step" value="1" />
		        </div>
		    
		        <%--弹出来的搜索框--%>
		        <div id="popupContact" class="popupContact" style="z-index:2; width:800px;">
                    <div id="popupHead" class="popupHead">
                        <div class="popupTitle">高级搜索</div>
                        <div class="popupClose" id="popupContactClose" title="关闭">关闭</div>
                        <div style="clear:both;"></div>
                    </div>
                    
                    <div style="position:relative; padding:5px; text-align:center;">
                        <div style="width:98%;">
                            <div>
                                <select id="sel_searchType" name="sel_searchType">
                                    <option value="1">商品编号</option>
                                    <option value="2">商品名称</option>
                                    <option value="3">商品关键词</option>
                                </select>
                                <input type="text" id="txtKeyword" name="txtKeyword" />
                                <input type="button" id="btnSearch" name="btnSearch" value="搜索" class="inputbtn" />
                                <a href="#" id="showadvsearch">高级搜索</a>
                            </div>
                            <div id="advsearch" style="position:absolute; display:none;">
                                <select id="sel_category" name="sel_category" size="10" multiple="multiple">
                                    <%=BindCategories() %>
                                </select>
                                <select id="sel_brand" name="sel_brand" size="10" multiple="multiple">
                                    <%=BindBrand("0")%>
                                </select>
                            </div>
                            <div class="sub_container_listhead" style="padding:0px;">
                                <table cellspacing="0" cellpadding="0" class="llist">
                                    <tr id="listhead"><%--id="listhead"不能少--%><%--这里的ID与上面的有重复，不过没关系，因为有If，Else来控制，如果确实看着不爽，那也要改上面的--%>
                                        <th class="bb1"><input type="checkbox" id="chkAll" name="chkAll" /></th>
                                        <th class="bb2">商品名称</th>
                                        <th class="bb3">商品代码</th>
                                        <th class="bb4">商品类别</th>
                                        <th class="bb5">商品品牌</th>
                                        <th class="bb6">会员价格</th>         
                                    </tr>
                                </table>           
                            </div>
                            <div class="sub_container_content" style="padding:0px;overflow-x:hidden;overflow-y:scroll;">
	                            <table id="datas" cellspacing="0" cellpadding="0" class="llist">
		                            <tr id="template" style="display:none;"><%--id="template"不能少--%>
			                            <td class="bb1 ccenter" id="checkbox"></td>
			                            <td class="bb2" id="Name"></td>
			                            <td class="bb3" id="ProductNo"></td>
			                            <td class="bb4 ccenter" id="Category"></td>
			                            <td class="bb5 ccenter" id="Brand"></td>
			                            <td class="bb6 ccenter" id="MemberPrice"></td>
		                            </tr>
	                            </table>
                            </div>
                            <div class="sub_container_page" id="pageDataList1_Pager" style="position:relative;">
                                <!-- 翻页-->
                                <!-- 翻页结束-->
                            </div>
                            <div style=" text-align:center;">
                                <input type="button" id="btnSubmit" value="确认" class="inputbtn" />
                                <input type="hidden" id="PIDs" name="PIDs" value="" /><%--商品的ID--%>
                                <input type="hidden" id="pnames" name="pnames" value="" /><%--商品名称--%>
                            </div>
	                    </div>
                        <div style="clear:both;"></div>
                    </div>
                </div>
                <div id="backgroundPopup" class="backgroundPopup"></div>
		        <%--弹出来的搜索框--%>
		        <%} %>
		</form>
		</div>
		</div>
		<iframe id="downloadcoupons" style="height:0px;display:none" src="#"></iframe>
	</body>
</html>
