<%@ page language="C#" autoeventwireup="true" inherits="e_tuan_do, ZKCMS" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register TagName="meta" TagPrefix="UC" Src="~/e/meta.ascx" %>
<%@ Register TagName="head" TagPrefix="UC" Src="~/e/head.ascx" %>
<%@ Register TagName="foot" TagPrefix="UC" Src="~/e/foot.ascx" %>
<!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 runat="server">
    <UC:meta ID="meta1" runat="server" />
</head>
<body>
    <form id="form1" runat="server" autocomplete="off">
    <asp:Label ID="pathcode" runat="server" Style="display: none">
    &nbsp;&raquo;&nbsp;团购频道&nbsp;&raquo;&nbsp;发布/编辑
    </asp:Label>
    <UC:head ID="head1" runat="server" />
    <%--main start--%>
    <div class="c1">
        <div class="b1">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="b1_l">
                    </td>
                    <td>
                        <div class="con1">
                            <ul>
                                <li class="on"><a title="刷新本页" href="javascript:void(0)" onclick="window.location=location.href">
                                    <asp:Literal ID="Literal_pathname" runat="server">添加团购</asp:Literal></a></li>
                            </ul>
                            <div class="clear">
                            </div>
                        </div>
                    </td>
                    <td align="right">
                        <div class="con2">
                        </div>
                    </td>
                    <td class="b1_r">
                    </td>
                </tr>
            </table>
        </div>
        <div class="v1">
            <div class="do1">

                <script type="text/javascript" src="../s/skin/image.js"></script>

                <script type="text/javascript">
                function check(){ 
                document.getElementById("oldprice").value=document.getElementById("oldprice").value.replace("-","");
                document.getElementById("tuanprice").value=document.getElementById("tuanprice").value.replace("-","");
                if(document.getElementById("shorttitle").value.replace(/ /g,"").replace(/　/g,"")==""){alert("团购标题不能为空！");return false;}
                else if(document.getElementById("fulltitle").value.replace(/ /g,"").replace(/　/g,"")==""){alert("完整标题不能为空！");return false;}
                else if(document.getElementById("oldprice").value.replace(/ /g,"").replace(/　/g,"")==""){alert("原价不能为空！");return false;}
                else if(document.getElementById("tuanprice").value.replace(/ /g,"").replace(/　/g,"")==""){alert("团购价格不能为空！");return false;}
                else if(document.getElementById("lowestbuy").value.replace(/ /g,"").replace(/　/g,"")==""){alert("最低团购人数不能为空！");return false;}
                else if(document.getElementById("starttime").value.replace(/ /g,"").replace(/　/g,"")==""){alert("开始时间不能为空！");return false;}
                else if(document.getElementById("endtime").value.replace(/ /g,"").replace(/　/g,"")==""){alert("结束时间不能为空！");return false;}
                else if(document.getElementById("classid").value.replace(/ /g,"").replace(/　/g,"")==""){alert("请选择团购类别！");return false;}
                if (/[^\d]/.test(document.getElementById("oldprice").value.replace(".",""))){alert("原价输入不正确！");return false;}
                if (/[^\d]/.test(document.getElementById("tuanprice").value.replace(".",""))){alert("团购价输入不正确！");return false;}
                if(parseInt(document.getElementById("tuanprice").value)<1){alert("团购价格不能小于1元！");return false;}
                if(parseInt(document.getElementById("tuanprice").value)>9999){alert("团购价格不能大于9999元！");return false;}
                if(!self_comparePrice(document.getElementById("oldprice").value,document.getElementById("tuanprice").value)){alert("团购价必须小于原价！");return false;}
                if(!self_compareDate(document.getElementById("starttime").value,document.getElementById("endtime").value)){alert("团购结束日期必须大于开始日期！");return false;}                
                }
                
                
                function del_thumbnail(){
                document.getElementById("HiddenField_thumbnail").value="";document.getElementById("thumbnail_td_td1").style.display="none";document.getElementById("thumbnail_td_td2").style.display="none";
                }

/**/      
function self_check_price(obj){ 
if(obj.value!=""){
if(obj.value.indexOf(".")==-1)obj.value=obj.value+".00";
else{
if(obj.value.substring(obj.value.indexOf(".")).length>3){alert("货币格式不正确！");return false; }
}
if(obj.value.match(/\d+.\d{2}/))return true; 
alert("货币格式不正确，请重新输入！");obj.value="";return false; 
}
}
/**/
function self_check_DateTime(obj)
{
   var str=obj.value;
   var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/; 
   var r = str.match(reg); 
   if(r==null){alert("错误的日期格式！");return false;}
   var d = new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]); 
   var whe1=(d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]&&d.getSeconds()==r[7]);
   if(!whe1){alert("日期格式不正确！");return false;}
} 
/**/
function self_compareDate(d1,d2)
{
    return ((new Date(d1.replace(/-/g,"\/"))) < (new Date(d2.replace(/-/g,"\/"))));
}
/**/
function self_comparePrice(p1,p2)
{
    return (parseInt(p1)>parseInt(p2));
}
                </script>

                <table border="0" cellpadding="0" cellspacing="0" class="table1">
                    <tr>
                        <td class="tt">
                            UID：
                        </td>
                        <td>
                            <asp:TextBox ID="uid" runat="server" MaxLength="8" CssClass="inp1" Width="100" autocomplete="off"></asp:TextBox><span style="margin-left: 10px"><span class="msgon">请输入会员编号，只有该会员才能管理该团购产品的所有订单！<a href="city_m.aspx" target="_blank" style="color:#f30;">查看会员编号&raquo;</a></span></span><div class="clear"></div>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>团购标题：</b>
                        </td>
                        <td>
                            <asp:TextBox ID="shorttitle" runat="server" MaxLength="60" CssClass="inp1" Width="350" autocomplete="off"></asp:TextBox>
                            <span class="msgon" style="background-image: none; padding-left: 0">
                                <asp:HyperLink ID="HyperLink1" runat="server" Visible="false" Target="_blank" Style="color: #ff0000">[打开页面]</asp:HyperLink></span>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>完整标题：</b>
                        </td>
                        <td>
                            <asp:TextBox ID="fulltitle" runat="server" TextMode="MultiLine" CssClass="inp1" Width="600"
                                Height="100" autocomplete="off"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>摘要：</b>
                        </td>
                        <td>
                            <asp:TextBox ID="tuannote" runat="server" TextMode="MultiLine" CssClass="inp1" Width="600"
                                Height="100" autocomplete="off"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>原价：</b>
                        </td>
                        <td>
                            <asp:TextBox ID="oldprice" runat="server" MaxLength="8" CssClass="inp1" Width="100"
                                onblur="return self_check_price(this)" autocomplete="off"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>团购价格：</b>
                        </td>
                        <td>
                            <asp:TextBox ID="tuanprice" runat="server" MaxLength="8" CssClass="inp1" Width="100"
                                onblur="return self_check_price(this)" autocomplete="off"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>最低团购人数：</b>
                        </td>
                        <td>
                            <asp:TextBox ID="lowestbuy" runat="server" MaxLength="4" CssClass="inp1" Width="100"
                                Text="1" autocomplete="off"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>开始时间：</b>
                        </td>
                        <td>
                            <asp:TextBox ID="starttime" runat="server" MaxLength="30" CssClass="inp1" Width="200"
                                onblur="return self_check_DateTime(this)" autocomplete="off"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>结束时间：</b>
                        </td>
                        <td>
                            <asp:TextBox ID="endtime" runat="server" MaxLength="30" CssClass="inp1" Width="200"
                                onblur="return self_check_DateTime(this)" autocomplete="off"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>其它标语：</b>
                        </td>
                        <td>
                            <asp:DropDownList ID="slogan1" runat="server" CssClass="s12" Width="200">
                                <asp:ListItem></asp:ListItem>
                                <asp:ListItem>今日团购：</asp:ListItem>
                                <asp:ListItem>本期团购：</asp:ListItem>
                                <asp:ListItem>精品团购：</asp:ListItem>
                                <asp:ListItem>超值团购：</asp:ListItem>
                                <asp:ListItem>推荐：</asp:ListItem>
                                <asp:ListItem>本期：</asp:ListItem>
                                <asp:ListItem>精品推荐：</asp:ListItem>
                                <asp:ListItem>本期热荐：</asp:ListItem>
                                <asp:ListItem>优惠促销：</asp:ListItem>
                                <asp:ListItem>超值放送：</asp:ListItem>
                            </asp:DropDownList>
                            <asp:DropDownList ID="slogan2" runat="server" CssClass="s12" Width="200">
                                <asp:ListItem>数量有限，先购先得</asp:ListItem>
                                <asp:ListItem>优惠促销，超值团购</asp:ListItem>
                                <asp:ListItem>精品团购，不容错过</asp:ListItem>
                                <asp:ListItem>名额有限，抓紧团购</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            所属类别：
                        </td>
                        <td>
                            <asp:DropDownList ID="classid" runat="server" CssClass="s12" Width="200">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            代表图片：<asp:HiddenField ID="HiddenField_thumbnail" runat="server" />
                        </td>
                        <td>
                            <table border="0" cellpadding="0" cellspacing="0" style="cursor: default">
                                <tr>
                                    <td>
                                        <div class="abs" style="*display: none">
                                            <table width="400" border="0" cellspacing="0" cellpadding="0" height="24">
                                                <tr>
                                                    <td id="upimg1_txt" width="322" style="border: solid 1px #ccc">
                                                        &nbsp;
                                                    </td>
                                                    <td>
                                                        &nbsp;
                                                    </td>
                                                    <td width="72" style="border: solid 1px #ccc" class="ce" style="color: #333">
                                                        浏览...
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                        <asp:FileUpload ID="upimg1" runat="server" size="55" CssClass="inp1 self_inp1" ToolTip="jpg,jpeg,png,bmp,gif" autocomplete="off" />
                                    </td>
                                    <td style="padding-left: 15px" id="thumbnail_td_td1" class="thumbnail_td">
                                        <asp:Literal ID="Literal_thumbnail" runat="server"></asp:Literal>
                                    </td>
                                    <td style="padding-left: 10px" id="thumbnail_td_td2" class="thumbnail_td">
                                        <asp:HyperLink ID="HyperLink_thumbnail" runat="server" Visible="false" href="javascript:void(0)"
                                            onclick="del_thumbnail()">[删除图片]</asp:HyperLink>
                                        <style type="text/css">
                                            .thumbnail_td a
                                            {
                                                color: #666;
                                            }
                                            .thumbnail_td a:hover
                                            {
                                                color: #ff6600;
                                            }
                                        </style>
                                    </td>
                                </tr>
                            </table>
                            <style type="text/css">
                                .self_inp1
                                {
                                    width: 393px; *width:400px;height:20px;*height:24px;filter:-moz-opacity:0;opacity:0;}</style>

                            <script type="text/javascript">
                                     if (navigator.userAgent.indexOf('Firefox') >= 0){document.getElementById("upimg1").style.width="400px";  document.getElementById("upimg1").style.height="24px";}
                            </script>

                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>详细内容：</b>
                        </td>
                        <td>
                            <%@ register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>
                            <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" BasePath="~/s/tool/fck/" Height="450"
                                Width="710" ToolbarSet="Edit2_a_fontsize">
                            </FCKeditorV2:FCKeditor>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>其它属性：</b>
                        </td>
                        <td>
                            <asp:DropDownList ID="usecar" runat="server" CssClass="s12" Width="300">
                                <asp:ListItem Value="0">不使用</asp:ListItem>
                                <asp:ListItem Value="1">使用购物车(不支持上门付款，适合虚拟物品！)</asp:ListItem>
                               
                            </asp:DropDownList>
                            <asp:DropDownList ID="receiving" runat="server" CssClass="s12" Width="300" ToolTip="此项不针对使用购物车属性的团购！">
                                     <asp:ListItem Value="0">不填写</asp:ListItem>
                                <asp:ListItem Value="1">收货信息必填(如果是团购实物请务必选择此项)</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            <b>显示已购买：</b>
                        </td>
                        <td>
                            <asp:DropDownList ID="ShowHaveBoughtMember" runat="server" CssClass="s12" Width="300">
                                <asp:ListItem Value="">不显示</asp:ListItem>
                                <asp:ListItem Value="显示全部">显示</asp:ListItem>
                                <asp:ListItem Value="显示">显示(不显示重复会员)</asp:ListItem>                               
                            </asp:DropDownList>
                            
                        </td>
                    </tr>
                     <tr>
                        <td class="tt">
                          团购说明：
                        </td>
                        <td>
                            <asp:TextBox ID="ordernote" runat="server" MaxLength="500" CssClass="inp1" Width="600" Text="本单支持取货付款，对一些在线付款不方便的顾客，可以上门取货时再付款。" autocomplete="off"></asp:TextBox>                           
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            发布时间：
                        </td>
                        <td>
                            <asp:TextBox ID="time" runat="server" MaxLength="19" CssClass="inp1" Width="150" autocomplete="off"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            &nbsp;
                        </td>
                        <td>
                            <asp:CheckBox ID="CheckBox1" runat="server" Text="保存远程图片" Style="color: #999" />
                            &nbsp;&nbsp;
                            <asp:CheckBox ID="CheckBox2" runat="server" Text="添加水印" Style="color: #999" />
                            &nbsp;&nbsp;
                            <asp:CheckBox ID="CheckBox3" runat="server" Text="过滤内容中的链接" Style="color: #999" />
                            &nbsp;&nbsp;
                            <asp:CheckBox ID="CheckBox4" runat="server" Text="限制图片宽度" Style="color: #999" Checked="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="tt">
                            &nbsp;
                        </td>
                        <td>
                            <asp:Button ID="ButtonSubmit" runat="server" CssClass="but1" Text="添加" OnClick="ButtonSubmit_Click"
                                OnClientClick="return check()" />&nbsp;
                            <input type="button" value="返回" class="but1" onclick="window.location='tuan.aspx'" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <%--main end--%>
    <UC:foot ID="foot1" runat="server" />
    </form>
</body>
</html>
