<%@ page language="C#" autoeventwireup="true" inherits="ims.web.eShopSetting, ims.web" trace="false" enableviewstatemac="false" enableEventValidation="false" %>
<!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" id="eShopSetting">
<head runat="server">
    <title>电子商务选项设置</title>
</head>
<body class="waiting">
    <div class="hide"><img src="images/loading.gif" />正在生成，请稍候 …</div>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="s1" runat="server">
        <Scripts><asp:ScriptReference Name="MicrosoftAjax.js" ScriptMode="Auto" Path="~/js/MsAjax.js"/><asp:ScriptReference Name="MicrosoftAjaxWebForms.js" ScriptMode="Auto" Path="~/js/MsAjax.js"/></Scripts>
    </asp:ScriptManager>
    <asp:ValidationSummary ID="ValSum" runat="server" ValidationGroup="newRule" ShowMessageBox="True" ShowSummary="False" />
        
    <div id="tabs" class="ui-tabs">
        <ul>
            <li><a href="#sendwayDiv">送货方式管理</a></li>
            <li><a href="#paywayDiv">付款方式管理</a></li>
            <li><a href="#pricerule">订单计费规则管理</a></li>
            <li><a href="#ment">订单计费规则说明</a></li>
            <li><a href="#mailnotify">邮件通知设置</a></li>
        </ul>
        <div id="sendwayDiv">
            <asp:UpdatePanel ID="up3" runat="server" RenderMode="Inline" ChildrenAsTriggers="true" UpdateMode="Conditional">
            <ContentTemplate>
            <table class="normal autoWidth" cellspacing="1">
            <asp:Repeater ID="rptSendWays" runat="server" OnItemCommand="rptSendWays_cmd" OnItemDataBound="rptSendWays_Bound">
            <ItemTemplate>
            <tr><td style="width:120px"><%# (string)Container.DataItem %></td><td style="width:45px;text-align:center"><asp:LinkButton CommandName="del" ID="lbDel" runat="server">删除</asp:LinkButton></td></tr>
            </ItemTemplate>
            <FooterTemplate>
            <tr><td style="width:120px">
                <asp:TextBox ID="tbSendWay" Width="96%" MaxLength="255" ToolTip="输入要添加的送货方式" runat="server"></asp:TextBox></td><td style="width:45px;text-align:center">
                    <asp:LinkButton ID="lbAddSendWay" runat="server" OnClick="addSendWay">添加</asp:LinkButton></td></tr>
            </FooterTemplate>
            </asp:Repeater>
            </table>
            </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div id="paywayDiv">
            <asp:UpdatePanel ID="up4" runat="server" RenderMode="Inline" ChildrenAsTriggers="true" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:GridView ID="GvPayWay" runat="server"
                GridLines="None"
                ShowFooter="false"
                AutoGenerateColumns="False"
                CellSpacing="1"
                CellPadding="0"
                BorderWidth="0px"
                CssClass="normal"
                OnRowDeleting="GvPaywayRowDeleting"
                RowStyle-HorizontalAlign="center">
                        <Columns>
                        <asp:BoundField HeaderText="付款方式" HeaderStyle-Width="120" DataField="Key"></asp:BoundField>
                        <asp:TemplateField HeaderText="付款方式说明" ItemStyle-HorizontalAlign="left">
                            <ItemTemplate><%# Eval("Value") %></ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="管理" FooterStyle-VerticalAlign="Bottom" ItemStyle-HorizontalAlign="center" FooterStyle-HorizontalAlign="center">
                            <HeaderStyle Width="84" Wrap="False" />
                            <ItemTemplate>
                                <asp:LinkButton ID="lbDelPayway" runat="server" CausesValidation="False" CommandName="Delete" Text="删除"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="addPayway" EventName="Click" />
            </Triggers>
            </asp:UpdatePanel>
            <table cellpadding="0" cellspacing="1" class="normal" style="margin-top:-1px">
            <tr><td style="width:120px;vertical-align:bottom">
                <asp:TextBox ID="tbPayway" Height="16" runat="server" Width="95%" MaxLength="255" ToolTip="输入新的付款方式"></asp:TextBox>
            </td><td>
                <asp:TextBox runat="server" ID="ckPayMent" TextMode="MultiLine" CssClass="ck"></asp:TextBox>
            </td><td style="width:84px;vertical-align:bottom;text-align:center">
                <asp:LinkButton ID="addPayway" runat="server" OnClientClick="UpdateEditorElement();" OnClick="AddPayway">添加付款方式</asp:LinkButton>
            </td></tr>
            </table>
        </div>
        <div id="pricerule">
            <asp:UpdatePanel ID="up2" runat="server" RenderMode="Inline" ChildrenAsTriggers="true" UpdateMode="Conditional">
            <ContentTemplate>
            <asp:GridView ID="GvRules" runat="server"
            GridLines="None"
            DataKeyNames="RuleName"
            ShowFooter="true"
            AutoGenerateColumns="False"
            CellSpacing="1"
            CellPadding="0"
            BorderWidth="0px"
            CssClass="normal"
            OnRowDeleting="GvRowDeleting"
            OnRowDataBound="GvRowBound" RowStyle-HorizontalAlign="center">
                    <Columns>
                    <asp:TemplateField HeaderText="规则名称" HeaderStyle-Width="120">
                        <ItemTemplate><%# Eval("RuleName") %></ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="tbRuleName" Height="16" runat="server" ValidationGroup="newRule" Width="95%" MaxLength="255" ToolTip="输入新规则的名称"></asp:TextBox>
                            <asp:RequiredFieldValidator SetFocusOnError="true" Display="none" ControlToValidate="tbRuleName" ID="RequiredFieldValidator1" ValidationGroup="newRule" runat="server" ErrorMessage="请输入规则名称！"></asp:RequiredFieldValidator>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="应用条件" ItemStyle-HorizontalAlign="left">
                        <FooterTemplate>
                            <asp:DropDownList ID="ddlBasis" runat="server">
                                <asp:ListItem Value="无">无</asp:ListItem>
                                <asp:ListItem Value="订单金额">订单金额</asp:ListItem>
                                <asp:ListItem Value="下单时间">下单时间</asp:ListItem>
                                <asp:ListItem Value="消费总额">消费总额</asp:ListItem>
                                <asp:ListItem Value="送货方式">送货方式</asp:ListItem>
                                <asp:ListItem Value="用户角色">用户角色</asp:ListItem>
                                <asp:ListItem Value="不需发票">不需发票</asp:ListItem>
                                <asp:ListItem Value="需要发票">需要发票</asp:ListItem>
                            </asp:DropDownList>
                            <asp:DropDownList ID="ddlSendWays" runat="server"></asp:DropDownList>
                            <asp:DropDownList ID="ddlRoles" runat="server"></asp:DropDownList>
                            <asp:DropDownList ID="ddlCondOperator" runat="server"></asp:DropDownList>
                            <asp:TextBox ID="tbValue1" runat="server" Width="100" Height="16" MaxLength="50"></asp:TextBox>
                            <span id="input2" style="display:none">～<asp:TextBox ID="tbValue2" runat="server" Width="100" Height="16" MaxLength="50"></asp:TextBox></span>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作" HeaderStyle-Width="128" ItemStyle-HorizontalAlign="left">
                        <FooterTemplate>
                            <asp:DropDownList ID="ddlOperaChar" runat="server">
                                <asp:ListItem Value="＋" Selected="true">＋</asp:ListItem>
                                <asp:ListItem Value="－">－</asp:ListItem>
                                <asp:ListItem Value="×">×</asp:ListItem>
                                <asp:ListItem Value="÷">÷</asp:ListItem>
                            </asp:DropDownList>
                            <asp:TextBox ID="tbOperaNum" runat="server" Width="80" Height="16" enchars="-.%"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Display="none" ControlToValidate="tbOperaNum" ValidationGroup="newRule" runat="server" ErrorMessage="请输入操作数！" SetFocusOnError="true"></asp:RequiredFieldValidator>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="管理" ItemStyle-HorizontalAlign="center" FooterStyle-HorizontalAlign="center">
                        <HeaderStyle Width="55" Wrap="False" />
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
                                Text="删除"></asp:LinkButton>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:LinkButton ID="addRule" runat="server" OnClick="AddRule" ValidationGroup="newRule">添加规则</asp:LinkButton>
                        </FooterTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        <div id="ment">
            <asp:TextBox runat="server" ID="ckRuleMent" Width="98%" TextMode="MultiLine" CssClass="ck"></asp:TextBox>
        </div>
        <div id="mailnotify">            
            <div class="optionItem"><asp:CheckBox ID="cbNotifyAdministrator" runat="server" Text="给管理人员发送订单通知" /><span id="spanEmail">到邮箱：<asp:TextBox
                ID="tbAdminEmail" runat="server" Width="160"></asp:TextBox></span></div>
            <div id="adminNotifyTemplet" class="box bold">
                邮件主题：<asp:TextBox ID="tbAdminNotifySubject" runat="server" Width="350"></asp:TextBox>
                <asp:TextBox runat="server" ID="ckAdminTemplet" TextMode="MultiLine" CssClass="ck"></asp:TextBox>
            </div>
            <div class="optionItem"><asp:CheckBox ID="cbNotifyCustomer" runat="server" Text="给客户发送订单通知邮件" /></div>
            <div id="customerNotityTemplet" class="box bold">
                邮件主题：<asp:TextBox ID="tbCustomerNotifySubject" runat="server" Width="350"></asp:TextBox>
                <asp:TextBox runat="server" ID="ckCustomerTemplet" TextMode="MultiLine" CssClass="ck"></asp:TextBox>
            </div>
            <div class="box" id="comment" style="margin-top:2em;line-height:1.5">
                <div class="bold red">邮件模板说明：</div>
                    　　在邮件模板中，可使用下表中的符号来代表与其对应的订单相关数据，在发送邮件时，这些符号会被替换为对应的值。
                <table cellspacing="1" class="normal" id="symbols">
                <tr>
                    <th style="width:60px">项目</th>
                    <th>符号</th>
                    <th style="width:60px">项目</th>
                    <th>符号</th>
                    <th style="width:60px">项目</th>
                    <th>符号</th>
                    <th style="width:60px">项目</th>
                    <th>符号</th>
                </tr>
                <tr>
                    <td>订单号</td>
                    <td class="sym">$OrderID$</td>
                    <td>订单金额</td>
                    <td class="sym">$Amount$</td>
                    <td>下单时间</td>
                    <td class="sym">$SubmitTime$</td>
                    <td>订购人</td>
                    <td class="sym">$UserName$</td>
                </tr>
                <tr>
                    <td>送货方式</td>
                    <td class="sym">$SendWay$</td>
                    <td>付款方式</td>
                    <td class="sym">$PayWay$</td>
                    <td>付款说明</td>
                    <td class="sym">$PayComment$</td>
                    <td>联系邮箱</td>
                    <td class="sym">$Email$</td>
                </tr>
                <tr>
                    <td>需要发票</td>
                    <td class="sym">$NeedInvoice$</td>
                    <td>发票抬头</td>
                    <td class="sym">$InvoiceTitle$</td>
                    <td>送货地址</td>
                    <td class="sym">$Address$</td>
                    <td>邮政编码</td>
                    <td class="sym">$Zip$</td>
                </tr>
                <tr>
                    <td>联系人</td>
                    <td class="sym">$Contact$</td>
                    <td>联系电话</td>
                    <td class="sym">$Phone$</td>
                    <td>客户备注</td>
                    <td class="sym">$Comment$</td>
                    <td></td>
                    <td class="sym"></td>
                </tr>
                </table>
            </div>
        </div>
    </div>
 
    <div runat="server" id="upgs"></div>    
    <asp:UpdatePanel ID="footup" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
    <ContentTemplate>
        <div class="footBtnArea">
            <asp:Button ID="btnSave" runat="server" Text="保存" OnClientClick="UpdateEditorElement()" OnClick="saveOption" CssClass="btn" />
            <input type="button" onclick="history.go(-1);" value="返回" class="btn" />
        </div>
    </ContentTemplate>
    </asp:UpdatePanel>
    <script src="js/comm.js"></script><script src="js/eshopsetting.js"></script>
    </form>
</body>
</html>