<%@ page language="C#" autoeventwireup="true" inherits="Admin_WebSetting_AddDistribute, ShopWe" validaterequest="false" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!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">
    <title>添加配送方式</title>
    <link href="../css/my.css" rel="stylesheet" type="text/css" />
    <link href="../css/volti.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="../css/jquery.js"></script>

    <script type="text/javascript" src="../css/admin.js"></script>

    <script type="text/javascript">
    function CreateExpressions(StartHeft,EndHeft,StartHeftPrice,EndHeftPrice)
    {
       var Ex=StartHeftPrice +"+c((w-" + StartHeft + ")/" + EndHeft + ")*" + EndHeftPrice; 
       $("#DistributeExpressions")[0].value=Ex;
    }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div id="all">
            <div class="validate">
                <asp:ValidationSummary ID="ValidationSummaryPage" CssClass="val_ys" runat="server"
                    DisplayMode="List" ForeColor="#FF6600" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidatorName" runat="server" ErrorMessage="配送方式名称不能为空"
                    ControlToValidate="DistributeName" Display="None"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidatorExpressions" runat="server"
                    ControlToValidate="DistributeExpressions" Display="None" ErrorMessage="配送公式不能为空"></asp:RequiredFieldValidator></div>
            <div class="come_title">
              <h2>
                    添加配送方式</h2>
                <div class="title_help">
						 <a href="http://www.shopwe.cn/bbs/" target="_blank">
                                <img src="../Themes/Default/Images/help_1.jpg" alt="shopwe论坛" width="50" height="20" /></a>
								 <a href="http://help.shopwe.cn/video/dis_demo/dis_demo.htm" target="_blank">
                                <img src="../Themes/Default/Images/video_help.jpg" alt="shopwe视频教程" width="50" height="20" /></a>
                            <a href="http://help.shopwe.cn/help/Show.asp?id=28" target="_blank">
                                <img src="../Themes/Default/Images/help.jpg" alt="shopwe帮助中心" width="50" height="20" /></a></div>
            </div>
            <div class="k_all6">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td class="bg_1" style="text-align: right; width: 100px; height: 36px;">
                            配送方式名称：
                        </td>
                        <td class="bg_1">
                            <asp:TextBox ID="DistributeName" CssClass="input4" Width="200" runat="server"></asp:TextBox>&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="bg_1" style="text-align: right; width: 100px; height: 36px;">
                            默认价格或公式：
                        </td>
                        <td>
                            <asp:TextBox ID="DistributeExpressions" CssClass="input" Width="200" runat="server"></asp:TextBox>
                          <h4><img src="../css/images/help.png" alt="ico" />
                            <a href="javascript:ShowHideDiv('HelpID')" class="blue">[查看帮助]</a>&nbsp;<span style="color:#999999">此配送公式的区域价格，你可以更改。</span></h4>
                        </td>
                    </tr>
                    <tr>
                        <td class="bg_1" style="text-align: right; width: 90px;">
                            配送公式生成：
                        </td>
                        <td class="bg_1">
                            <input type="checkbox" onclick="ShowHideDiv('UrlId')" />生成简单常用的配送公式
                        </td>
                    </tr>
                    <tr id="UrlId" style="display: none">
                        <td class="bg_1" style="text-align: right; width: 90px;">
                            填写项目：
                        </td>
                        <td>
                            <h4>首重（克/g）：</h4><input id="StartHeft" runat="server" style="width: 40px" class="input" value="0" />
                             <h4>首重费用：</h4><input id="StartHeftPrice" runat="server" style="width: 40px" class="input"
                                value="0" />
                             <h4>续重（克/g）：</h4><input id="EndHeft" runat="server" style="width: 40px" class="input" value="0" />
                             <h4>续重费用：</h4><input id="EndHeftPrice" runat="server" style="width: 40px" class="input" value="0" />
							 
                            <input type="button" value="立即生成公式" class="butt_tle" onclick="CreateExpressions($('#StartHeft')[0].value,$('#EndHeft')[0].value,$('#StartHeftPrice')[0].value,$('#EndHeftPrice')[0].value)" style="height:20px; width:90px"/>
                        </td>
                    </tr>
                    <tr id="HelpID" style="display: none">
                        <td>
                        </td>
                        <td>
                            <div class="ys_bf_bj">ShopWe商品重量是按克（g）计算，同时ShopWe还为配送特别加了商品数量和总金额两个单位。<br />
                                    <br />
                                    <span style="color:#333333">在公式里：</span>
                                    <br />
                                    <br />
                                    字母<span style="color:#ff0000">&quot;w&quot;</span>表示订单物品<span style="color:#ff0000">总重量</span>
                                    <br />
									<br />
                                    字母<span style="color:#ff0000">&quot;p&quot;</span>代表订单<span style="color:#ff0000">总金额</span>
                                    <br />
									<br />
                                    字母<span style="color:#ff0000">&quot;q&quot;</span>代表订单物品<span style="color:#ff0000">总数量</span>
                                    <br />
									<br />
                                    字符<span style="color:#ff0000">&quot;c()&quot;</span>代表"ceiling”,指偏大<span style="color:#ff0000">取整</span>（如c(0.4/0.5)=1）
                                    <br />
									<br />
                                    字符<span style="color:#ff0000">&quot;z()&quot;</span>代表<span style="color:#ff0000">>0 取1=0 取0.5 小于0取0</span>
                                    <br />
                                    <br />
                                    比如：20+(c(w/500)-1)*6（代表首重为20元次重为6元,单位重量为500克的配送费用）
                                    <br />
                                    <br />
                                     <span style="color:#333333">配送公式实际举例：</span>
                                    <br />
                                    <br />
                                    固定价格20元：20
                                    <br />
                                    <br />
                                    首500克是100元，续重每500克是40元：100+c((w-500)/500)*40
                                    <br />
                                    <br />
                                    首重是15元/1000克，续重是5元/0.5千克：15+c((w-1000)/500)*5
                                    <br />
                                    <br />
                                    满200免运费，不满200加收5元运费：z(z(200-p)-0.6)*5 
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="bg_1" style="text-align: right; width: 90px;">
                            保价：
                        </td>
                        <td class="bg_1">
                            <asp:RadioButton ID="IsProtectYes" runat="server" Text="是" GroupName="IsProtect" />&nbsp;&nbsp;<asp:RadioButton
                                ID="IsProtectNo" runat="server" Text="否" GroupName="IsProtect" />
                        </td>
                    </tr>
                    <tr>
                        <td class="bg_1" style="text-align: right; width: 90px;">
                            保价百分率：
                        </td>
                        <td>
                            <asp:TextBox ID="ProtectPercent" CssClass="input" Width="200" runat="server">0</asp:TextBox><h4><span style="color:#999999">%</span></h4>
                        </td>
                    </tr>
                    <tr>
                         <td class="bg_1" style="text-align: right; width: 90px;">
                            最低保价金额：
                        </td>
                        <td>
                            <asp:TextBox ID="ProtectPrice" CssClass="input" Width="200" runat="server">0</asp:TextBox><h4><span style="color:#999999">元</span></h4>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="come_title_bai">
              <h2>
                    详细介绍</h2>
		  </div>
            <div class="k_all6">
                <FCKeditorV2:FCKeditor ID="DistributeRemarks" runat="server">
                </FCKeditorV2:FCKeditor>
            </div>
        </div>
        <div class="sub">
            <asp:Button ID="Submit" runat="server" Text="添加配送方式" OnClick="Submit_Click"  CssClass="but_add"/>
        
        </div>
    </form>
</body>
</html>
