<%@ page language="C#" autoeventwireup="true" inherits="Admin_WebSetting_AddDistributeArea, ShopWe" %>

<!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" src="../css/pcasunzip.js"></script>

    <script type="text/javascript">
    function AddArea(id)
    {
    var obj=document.getElementById(id)
    var index = obj.selectedIndex; // 选中索引
    if(obj.options[index].text!="--请选择省份--"&&obj.options[index].text!="--请选择城市--"&&obj.options[index].text!="--请选择地区--")
    {
    document.getElementById("AddArea").innerHTML+="<input type=\"checkbox\" name=\"DistrubuteArea\" value=\""+obj.options[index].text+"\" checked=\"checked\"/>"+obj.options[index].text;
    }
    //obj.options[index].value; // 选中值
    }
    //创建配送公式
    function CreateExpressions(StartHeft,EndHeft,StartHeftPrice,EndHeftPrice)
    {
       var Ex=StartHeftPrice +"+c((w-" + StartHeft + ")/" + EndHeft + ")*" + EndHeftPrice; 
       $("#Expressions")[0].value=Ex;
    }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div class="validate">
            <asp:ValidationSummary ID="ValidationSummaryPage" CssClass="val_ys" runat="server"
                DisplayMode="List" ForeColor="#FF6600" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidatorName" runat="server" ErrorMessage="配送公式不能为空"
                ControlToValidate="Expressions" Display="None"></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>
                        <asp:TextBox ID="Expressions" CssClass="input" Width="200" runat="server"></asp:TextBox><h4><img
                            src="../css/images/help.png" />
                        <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: 100px; height: 36px;">
                        货到付款：
                    </td>
                    <td class="bg_1">
                        <asp:RadioButton ID="IsDeliveryYes" runat="server" Text="是" GroupName="IsDelivery" />
                        <asp:RadioButton ID="IsDeliveryNo" runat="server" Text="否" GroupName="IsDelivery"
                            Checked="True" />
                    </td>
                </tr>
            </table>
        </div>
        <div class="come_title_bai">
          <h2>
                添加配送区域</h2>
          <h3>（自上而下，也就是说，如果你选择了四川省，即所有四川相关城市都包含进配送区域）</h3>
      </div>
       <div class="k_all7">
            <select id="China" name="China">
                <option value="All">全国</option>
            </select>
            <input type="button" value="添加" onclick="AddArea('China')" />
            <select id="Province" name="Province">
            </select>
            <input type="button" value="添加" onclick="AddArea('Province')" />
            <select id="City" name="City">
            </select>
            <input type="button" value="添加" onclick="AddArea('City')" />
            <select id="Area" name="Area">
            </select>
            <input type="button" value="添加" onclick="AddArea('Area')" />

            <script type="text/javascript">
           new PCAS("Province","City","Area")
            </script>

        </div>
		
        <div class="k_all6">
<p>已选择的配送地址：</p>
<p>&nbsp;</p>
            <div class="ys_bf_bj">
                <div class="din" id="AddArea">
                    <!--<input type="checkbox" name="DistrubuteArea" value="全国" />全国-->
                    <asp:Literal ID="LiteralBody" runat="server"></asp:Literal>
                </div>
            </div>
        </div>
        <div class="sub">
            <asp:Button ID="Submit" runat="server" Text="确认提交" OnClick="Submit_Click"  CssClass="but_add"/>
        </div>
    </form>
</body>
</html>
