<%@ page language="C#" autoeventwireup="true" inherits="ECMe_Setting_AddDistributeArea, ECMe_Deploy" %>

<!-- Put IE into quirks mode -->
<!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/Admin/CSS/ECMe.css" rel="stylesheet" type="text/css" />
    <link href="../CSS/Admin/CSS/body63.css" rel="stylesheet" type="text/css" />
    <link href="../CSS/Admin/CSS/AdminIndex.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../JS/jquery.js"></script>
    <script type="text/javascript" src="../JS/Common.js"></script>
    <script type="text/javascript" src="../JS/Pcasunzip.js"></script>
    <script type="text/javascript">
        //创建配送公式
        function CreateExpressions(StartHeft, EndHeft, StartHeftPrice, EndHeftPrice) {
            var Ex = StartHeftPrice + "+c((w-" + StartHeft + ")/" + EndHeft + ")*" + EndHeftPrice;
            $("#TExpressions")[0].value = Ex;
        }
        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 += "<li><span class=\"tle_witheouit\"><input type=\"checkbox\" name=\"DistrubuteArea\" value=\"" + obj.options[index].text + "\" checked=\"checked\"/>" + obj.options[index].text + "</span></li>";
            }
            //obj.options[index].value; // 选中值
        }
        
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="header">
        <h2>
            网站设置 &gt; <a href="#" class="admin_blue">配送区域</a></h2>
    </div>
    <div class="container">
        <div class="title">
            区域配送价格或公式</div>
        <asp:ValidationSummary ID="MainValidationSummary" DisplayMode="List" CssClass="error"
            runat="server" />
        <div class="all_1">
            <table border="0" cellspacing="0" cellpadding="0" style="width: 100%">
                <tr>
                    <td valign="top">
                        <div class="right">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="ADDGood_table_1">
                                <tr>
                                    <th style="width: 90px">
                                        配送公式：
                                    </th>
                                    <td>
                                        <asp:TextBox ID="TExpressions" CssClass="input_1" Width="200px" runat="server"></asp:TextBox>
                                        <img src="../CSS/Admin/images/help.png" alt=" " width="10" height="10" />
                                        [<a href="javascript:ShowHide('HelpID')" class="blue">查看帮助</a>] 此配送公式的区域价格，你可以更改。
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        配送公式生成：
                                    </th>
                                    <td>
                                        <input name="" type="checkbox" onclick="ShowHide('UrlId')" value="" />
                                        <span style="color: #333333">生成简单常用的配送公式</span>
                                    </td>
                                </tr>
                            </table>
                            <table id="UrlId" style="display: none" width="100%" border="0" cellpadding="0" cellspacing="0"
                                class="ADDGood_table_1">
                                <tr>
                                    <th style="text-align: right; width: 90px; color: #333333">
                                        填写项目：
                                    </th>
                                    <td>
                                        <h4>
                                            首重（克/g）：</h4>
                                        <input name="StartHeft" type="text" id="StartHeft" style="width: 40px" class="input_4"
                                            value="0" />
                                        <h4>
                                            首重费用：</h4>
                                        <input name="StartHeftPrice" type="text" id="StartHeftPrice" style="width: 40px"
                                            class="input_4" value="0" />
                                        <h4>
                                            续重（克/g）：</h4>
                                        <input name="EndHeft" type="text" id="EndHeft" style="width: 40px" class="input_4"
                                            value="0" />
                                        <h4>
                                            续重费用：</h4>
                                        <input name="EndHeftPrice" type="text" id="EndHeftPrice" style="width: 40px" class="input_4"
                                            value="0" />
                                        <input type="button" value="立即生成公式" onclick="CreateExpressions($('#StartHeft')[0].value,$('#EndHeft')[0].value,$('#StartHeftPrice')[0].value,$('#EndHeftPrice')[0].value)" />
                                    </td>
                                </tr>
                            </table>
                            <table id="HelpID" style="display: none" width="100%" border="0" cellpadding="0"
                                cellspacing="0" class="ADDGood_table_1">
                                <tr>
                                    <th style="width: 90px">&nbsp;
                                        
                                    </th>
                                    <td>
                                        <div class="ys_bf_bj">
                                            ECMe商品重量是按克（g）计算，同时ECMe还为配送特别加了商品数量和总金额两个单位。<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>
                            </table>
                            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="ADDGood_table_1">
                                <tr>
                                    <th style="width: 90px">
                                        货到付款 ：
                                    </th>
                                    <td style="color: #333333">
                                        <asp:CheckBox ID="CIsDelivery" runat="server" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="title">
            添加配送区域（<span style="font-weight: 100; color: #FF3300">自上而下，也就是说，如果你选择了四川省，即所有四川相关城市都包含进配送区域</span>）</div>
        <div class="all_1">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td class="all">
                        <div class="Fast_group_all">
                            <div class="title_1">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td style="font-size: 12px">
                                            <select id="China" name="China">
                                                <option value="All">全国</option>
                                            </select>
                                            <input type="button" value="添加" onclick="AddArea('China')" />
                                            <select id="Province" name="Province">
                                                <option value="All">--请选择省份--</option>
                                            </select>
                                            <input type="button" value="添加" onclick="AddArea('Province')" />
                                            <select id="City" name="City">
                                                <option value="All">--请先择城市--</option>
                                            </select>
                                            <input type="button" value="添加" onclick="AddArea('City')" />
                                            <select id="Area" name="Area">
                                                <option value="All">--请先择地区--</option>
                                            </select>
                                            <input type="button" value="添加" onclick="AddArea('Area')" />
                                        </td>
                                    </tr>
                                </table>
                                <script type="text/javascript">
                                    new PCAS("Province", "City", "Area", "北京市", "市辖区", "东城区")
                                </script>
                            </div>
                            <div class="Fast_group_labe">
                                <div class="box">
                                    <ul id="AddArea">
                                        <li class="tle_top"><span class="tle_witheouit">已选择的配送地址</span></li>
                                        <asp:Literal ID="LArea" runat="server"></asp:Literal>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="footer">
        <div class="footer_button">
            <asp:Button ID="BSubmit" runat="server" Text="保存当前操作" CssClass="footer_but" OnClick="BSubmit_Click" />
        </div>
    </div>
    </form>
</body>
</html>
