<%@ Page Title="" Language="C#" MasterPageFile="~/Dialog/DialogMaster.Master" AutoEventWireup="true"
    CodeBehind="CAddrsSelectDialog.aspx.cs" Inherits="OAWeb.Dialog.CAddrsSelectDialog"
    EnableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <style type="text/css">
        .table_list td
        {
            text-align: left;
        }
    </style>
    <script>
        function AddInfo() {
            location = "CAddrsSelectDialog.aspx?CId=<%=CId %>&type=add&Id=<%=Id %>";
        }
    </script>
    <!--客户收货地址选择hide-->
    <div style="width: 700px; padding: 10px">
        <div class="list">
            <table class="table_list" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse;">
                <asp:Repeater ID="rptData" runat="server">
                    <ItemTemplate>
                        <tr align="left">
                            <td align="center" style="width: 10px;">
                                <input id='rdoItem' name='rdoItem' type='radio' value='<%#Eval("Id") %>' text='<%#Eval("Province")%>-<%#Eval("City")%>  &nbsp;<%#Eval("Address")%> (收货人:<%#Eval("ShipTo")%> 电话:<%#Eval("TelePhone")%> 手机:<%#Eval("Mobile")%> 邮编:<%#Eval("ZipCode")%>)' />
                            </td>
                            <td>
                                <%#Eval("Province")%>-<%#Eval("City")%>&nbsp;<%#Eval("Address")%>(收货人:<%#Eval("ShipTo")%>电话:<%#Eval("TelePhone")%>手机:<%#Eval("Mobile")%>邮编:<%#Eval("ZipCode")%>)
                            </td>
                            <td>
                                <a href='CAddrsSelectDialog.aspx?CId=<%=CId %>&type=update&Id=<%# Eval("Id") %>'>编辑</a>
                                <a href="javascript:void(0);" onclick="return opAjax(this,null);" json="id:'<%#Eval("Id") %>',op:'Delete'">
                                    删除</a>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
                <tr align="left">
                    <td align="center" colspan="3">
                       <input id='rdoItemAdd' name='rdoItem' type='radio' value="" text="" onclick="AddInfo()" /> 添加新地址
                    </td>
                </tr>
            </table>
            <asp:Panel ID="pnlAdd" runat="server" Visible="false" >
                <div class="form" style="width: 720px; padding: 10px;">
                    <table cellpadding="0" cellspacing="0" border="0" class="table_form">
                        <tr>
                            <td class="right">
                                <span class="red">*</span> 收货人：
                            </td>
                            <td>
                                <asp:TextBox ID="txtShipTo" runat="server" CssClass="text" Text=""></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="right ">
                                电话：
                            </td>
                            <td>
                                <asp:TextBox ID="txtTelePhone" runat="server" CssClass="text" Text=""></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="right">
                                手机：
                            </td>
                            <td>
                                <asp:TextBox ID="txtMobile" runat="server" CssClass="text" Text=""></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="right">
                                <span class="red">*</span> 地区：
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlProvince" runat="server">
                                    <asp:ListItem Value="0">省份</asp:ListItem>
                                </asp:DropDownList>
                                <asp:DropDownList ID="ddlCity" runat="server">
                                    <asp:ListItem Value="0">城市</asp:ListItem>
                                </asp:DropDownList>
                                <asp:TextBox ID="txtAddress" runat="server" CssClass="text width200" Text=""></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="right ">
                                邮编：
                            </td>
                            <td>
                                <asp:TextBox ID="txtZipCode" runat="server" CssClass="text" Text=""></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="right ">
                                电子邮件：
                            </td>
                            <td>
                                <asp:TextBox ID="txtEmail" runat="server" CssClass="text" Text=""></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: center">
                                <input id="btnSave" type="button" value=" 保 存 " class="btn_77px" />
                                <input id="btnClose" type="button" value=" 取 消 " onclick="window.location.href='CAddrsSelectDialog.aspx?CId=<%=CId %>&Id=<%=Id %>'"
                                    class="btn_77px" />
                            </td>
                        </tr>
                    </table>
                </div>
                <script type="text/javascript">
                    $(document).ready(function () {
                        $("#<%=ddlProvince.ClientID %>").change(function () {
                            ProvinceCtiyCounty(this.value, 'LoadCityJson', '<%=ddlCity.ClientID %>');
                        })

                        $("#btnSave").click(function () {
                            $("#aspnetForm").ajaxSubmit({
                                url: "/Dialog/CAddrsSelectDialog.aspx?op=Save&CId=<%=CId %>&type=add&Id=<%=Id %>&r=" + Math.random(),
                                success: function (result) {
                                    if (result == "ok") {
                                        alert("保存成功");
                                        window.location.href = "/Dialog/CaddrsSelectDialog.aspx?CId=<%=CId %>";
                                        
                                    } else {
                                        alert(result);
                                    }
                                }
                            });
                            return false;
                        })
                    });
                </script>
                <script>
                  
                if("<%=PageType %>"=="add")
                    $("#rdoItemAdd").attr("checked",'checked');
                </script>
            </asp:Panel>
        </div>
</asp:Content>
