<%@ page language="C#" masterpagefile="MyShop.master" enableeventvalidation="false" autoeventwireup="true" inherits="Shop_Manage_shop_setup, WebApp_deploy" title="商品分类" validaterequest="false" %>

<%@ Register Src="../UserControls/HowaveProvinceCity.ascx" TagName="HowaveProvinceCity"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script src="../Skin/CommStyle/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="../CKEdit/kindedit/themes/default/default.css" />
    <link rel="stylesheet" href="../CKEdit/kindedit/plugins/code/prettify.css" />
    <script type="text/javascript" src="../CKEdit/kindedit/kindeditor.js"></script>
    <script type="text/javascript" src="../CKEdit/kindedit/lang/zh_CN.js"></script>
    <script type="text/javascript" src="../CKEdit/kindedit/plugins/code/prettify.js"></script>
    <style type="text/css">
        #previewImage
        {
            filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
        }
        #previewImage2
        {
            filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
        }
    </style>
    <div class="pageTitle">
        基本设置</div>
    <script type="text/javascript" src="../Js/howave_time.js"></script>
    <div class="tips_onclick" style="width: 94%">
        店长您好！在这里您可以随时装修您的店铺。店标，公告不要空哦，让买家感觉到你的用心，自然愿意多逛逛。</div>
    <table class="ShopOrderStyle">
        <caption>
            店铺信息</caption>
        <tr>
            <td class="OrderTitle">
                店 铺 名：
            </td>
            <td>
                <asp:TextBox MaxLength="30" ID="TxtShopName" runat="server" Width="500px" />
            </td>
        </tr>
        <tr>
            <td class="OrderTitle">
                店铺类别：
            </td>
            <td>
                <asp:DropDownList ID="DropShopClass" runat="server" Width="500px" />
            </td>
        </tr>
        <tr id="tr_SecUrl" runat="server">
            <td class="OrderTitle">
                二级域名：
            </td>
            <td>
                <asp:HiddenField ID="hfSecUrl" runat="server" Value="" />
                <asp:TextBox ID="txt_SecUrl" onblur="CheckDifrent()" runat="server" Width="500px" />
                <font id="secUrlFail" runat="server" style="color: Red; display: none;">此域名已经存在！</font>
                <font id="secUrlSuccess" style="color: Green; display: none;">此域名可以注册！</font>
            </td>
        </tr>
        <tr>
            <td class="OrderTitle">
                店铺状态：
            </td>
            <td>
                <div style="float: left;">
                    <asp:RadioButtonList ID="ShopStatus" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Text="正常" Value="1" />
                        <asp:ListItem Text="暂停营业" Value="0" />
                    </asp:RadioButtonList>
                </div>
                <div style="float: left; padding-left: 20px;">
                    <a href="#" onmouseover="showHelp('help1');" onmouseout="hidenHelp('help1');">
                        <img src="../Images/tooltip.png" border="0" /></a>
                </div>
            </td>
        </tr>
        <tr>
            <td class="OrderTitle">
                主营项目：
            </td>
            <td>
                <asp:TextBox ID="TxtOperatorItem" runat="server" Height="50px" Width="500px" TextMode="MultiLine" />
            </td>
        </tr>
        <tr>
            <td class="OrderTitle">
                店铺介绍：
            </td>
            <td>
                <asp:TextBox runat="server" ID="TxtShopIntro" TextMode="MultiLine" Rows="13" Columns="85" />
            </td>
        </tr>
        <script type="text/javascript">

            $(function () {
                KindEditor.ready(function (K) {
                    var editor1 = K.create('#ctl00_ContentPlaceHolder1_TxtShopIntro', {
                        cssPath: '../CKEdit/kindedit/plugins/code/prettify.css',
                        uploadJson: '../CKEdit/kindedit/asp.net/upload_json_two.ashx',
                        fileManagerJson: '../CKEdit/kindedit/asp.net/file_manager_json_two.ashx',
                        allowFileManager: true,
                        afterCreate: function () {

                        }
                    });
                    prettyPrint();
                });
            });
        </script>
        <tr>
            <td colspan="2">
            </td>
        </tr>
    </table>
    <table class="ShopOrderStyle">
        <tr>
            <td class="OrderTitle">
                店 &nbsp; 标：
            </td>
            <td>
                <div style="width: 100%; position: relative">
                    <div style="float: left; width: 350px;">
                        <div style="width: 100%">
                            <asp:FileUpload ID="FileUpload1" runat="server" Width="320px" /></div>
                        <div id="previewImage" style="height: 100px; width: 100px; border: solid 1px gray;
                            text-align: center;">
                            <asp:Image ID="ImageURL" runat="server" Height="100px" Width="100px" ImageUrl="~/Images/nopicture.gif" />
                        </div>
                        <br />
                        (仅支持gif和jpg，建议规格为100px*100px,若上传后店标为原有店标为浏览器图片缓存所影响！)
                    </div>
                    <div style="float: right; width: 150px; text-align: right;">
                        <img src="/images/shop_21.gif" style="width: 128px; height: 181px" />
                    </div>
                </div>
            </td>
        </tr>
        <tr style="display: none;">
            <td class="OrderTitle">
                横 &nbsp; 幅：
            </td>
            <td>
                <div style="width: 100%; position: relative">
                    <div style="width: 100%">
                        <asp:FileUpload ID="FileUpload2" runat="server" Width="320px" /></div>
                    <div id="previewImage2" style="height: 100px; width: 95%; margin: 0 auto; border: solid 1px gray;
                        text-align: center;">
                        <asp:Image ID="ImageBanner" runat="server" Height="100px" Width="600px" ImageUrl="~/Images/nopicture.gif" />
                    </div>
                    <br />
                    (仅支持gif和jpg，建议规格为950px*120px,若上传后横幅为原有横幅为浏览器图片缓存所影响！)
                </div>
            </td>
        </tr>
        <tr>
            <td class="OrderTitle">
                公 &nbsp; 告：
            </td>
            <td>
                <asp:TextBox runat="server" ID="TxtShopAnnouncement" TextMode="MultiLine" Rows="13"
                    Columns="85" />
                <script type="text/javascript">
                    var editor_ShopAnnouncement;
                    $(function () {
                        KindEditor.ready(function (K) {
                            editor_ShopAnnouncement = K.create('#<%=TxtShopAnnouncement.ClientID %>', {                                
                                cssPath: '../CKEdit/kindedit/plugins/code/prettify.css',
                                uploadJson: '../../CKEdit/kindedit/asp.net/upload_json_two.ashx',
                                fileManagerJson: '../CKEdit/kindedit/asp.net/file_manager_json_two.ashx',
                                allowFileManager: true,
                                afterCreate: function () {

                                }, 
                                //上传文件后执行的回调函数,获取上传图片的路径
                                afterUpload: function (url) {
                                    //alert(url);
                                }
                            });
                            prettyPrint();
                        });
                    });
                    //公告预览
                    function view() {
                        var editor1_html = editor_ShopAnnouncement.html();//取得HTML内容
                        editor_ShopAnnouncement.sync();//同步数据后获取公告控件的值
                        var showview = document.getElementById("showview");
                        var Announce = $("#<%=TxtShopAnnouncement.ClientID %>");

                        if (Announce.val().length == 0) {
                            alert("公告不能为空！");
                            Announce.focus();
                        } else {
                            var ShopAnnounceContent = document.getElementById("ShopAnnounceContent");
                            ShopAnnounceContent.style.display = "";
                            showview.innerHTML = Announce.val();
                        }
                        return false;
                    }
                </script>
                <div align="center" style="display: block">
                    <input id="Button1" onclick="return view()" value="公告预览" type="button" />
                </div>
                <div id="ShopAnnounceContent" style="border: solid 1px gray; background-color: white;
                    display: none;">
                    <marquee id="showview" direction="up" onmouseout="this.start()" onmouseover="this.stop()"
                        scrollamount="1" style="position: relative; left: 0px; width: 505px; top: 0px;
                        height: 142px;"></marquee>
                </div>
                <div id="VipCardTitle" style="display: none">
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <asp:Button ID="ButSaveBaseShop" runat="server" Text=" 提 交 " Width="48px" OnClick="ButSaveBaseShop_Click" />
            </td>
        </tr>
    </table>
    <div style="clear: both; height: 3px; overflow: hidden">
    </div>
    <div id="help1" style="position: absolute; z-index: 1; border: solid 1px black; padding: 10px;
        background: white; display: none;" onmouseover="this.style.display='';" onmouseout="this.style.display='none'">
        <ul>
            <li><b>正常：</b>店铺正常营业，会员可以正常浏览店铺和购买卖家的商品</li><li><b>关闭：</b>店铺停止营业，会员浏览该店铺时显示关闭状态，所有出售中的商品会即时下架</li><li>
                <b>暂停营业：</b>店铺暂时停止营业，会员浏览该店铺显示暂时关闭状态，出售中的商品不会下架</li></ul>
        <iframe src="#" frameborder="0" style="position: absolute; visibility: inherit; top: 0px;
            left: 0px; width: 400px; height: 80px; z-index: -1; filter='progid:dximagetransform.microsoft.alpha(style=0,opacity=0)';">
        </iframe>
    </div>
    <script language="javascript" type="text/javascript">

        //店标
        function viewimg(obj) {
            // var upload = document.getElementById("ctl00_ContentPlaceHolder1_FileUpload1");
            // document.getElementById(obj).innerHTML = '预览<br><img src=\'' + dianbiao_img.value + '\' width=100px height=100px align=absmiddle>';

            //火狐浏览器
            if (navigator.userAgent.indexOf("Firefox") > 0) {
                var img_src = window.URL.createObjectURL(obj.files[0]); //obj.files[0].getAsDataURL() 
                document.getElementById("previewImage").innerHTML = '预览<br><img src=\'' + img_src + '\' width=100px height=100px align=absmiddle>';
            }
            //IE浏览器
            if (navigator.userAgent.indexOf("MSIE") > 0) {
                var preview_img = document.getElementById("previewImage");
                preview_img.innerHTML = "";
                preview_img.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = obj.value;
                preview_img.style.width = "100px";
                preview_img.style.height = "100px";
            }
        }
        function viewimg2(obj) {
            //var upload = document.getElementById("ctl00_ContentPlaceHolder1_FileUpload2");
            //document.getElementById(obj).innerHTML = '预览<br><img src=\'' + upload.value + '\' width=600px height=80px  align=absmiddle>';
            //火狐浏览器
            if (navigator.userAgent.indexOf("Firefox") > 0) {
                var img_src = window.URL.createObjectURL(obj.files[0]); //obj.files[0].getAsDataURL() 
                document.getElementById("previewImage2").innerHTML = '预览<br><img src=\'' + img_src + '\' width=600px height=80px align=absmiddle>';
            }
            //IE浏览器
            if (navigator.userAgent.indexOf("MSIE") > 0) {
                var preview_img = document.getElementById("previewImage2");
                preview_img.innerHTML = "";
                preview_img.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = obj.value;
                preview_img.style.width = "600px";
                preview_img.style.height = "80px";
            }
        }
        //检测二级域名
        function CheckDifrent() {
            var secUrl = document.getElementById("ctl00_ContentPlaceHolder1_txt_SecUrl").value;
            var hf_secUrl = $("#<%=hfSecUrl.ClientID %>");
            if (secUrl.length != 0) {
                if (hf_secUrl.val().length != 0) {
                    if (hf_secUrl.val() != secUrl) {

                        $.post("../WebService/ShopService.ashx", { "Action": "CheckIsExistSecUrl", "SecUrl": secUrl }, function (data, state) {
                            if (state == "success") {
                                if (data == "yes") {
                                    $("#ctl00_ContentPlaceHolder1_secUrlFail").css("display", "block");
                                    $("#secUrlSuccess").css("display", "none");
                                } else if (data == "no") {
                                    $("#ctl00_ContentPlaceHolder1_secUrlFail").css("display", "none");
                                    $("#secUrlSuccess").css("display", "block");
                                }
                            } else {
                                alert("Ajxa错误！");
                            }
                        }, false);

                    } else {
                        $("#ctl00_ContentPlaceHolder1_secUrlFail").css("display", "none");
                        $("#secUrlSuccess").css("display", "none");
                    }
                }
            }
        } 
    </script>
</asp:Content>
