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

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <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 colspan="3">
                    <asp:TextBox ID="txtProductSN" runat="server" CssClass="text width400"></asp:TextBox>
                    &nbsp;
                    <asp:CheckBox ID="chkAuditState" runat="server" Text="已交付" />
                    &nbsp;状态：<asp:DropDownList ID="ddlUseState" runat="server">
                        <asp:ListItem Value="1">正常</asp:ListItem>
                        <asp:ListItem Value="2">停用</asp:ListItem>
                        <asp:ListItem Value="-1">废置</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="right">
                    <span class="red">*</span> 品项：
                </td>
                <td>
                    <asp:TextBox ID="txtSKUName" runat="server" CssClass="text_box " ReadOnly="true"></asp:TextBox><input
                        type="button" value="选择" onclick="OpenRadioDialog('/Dialog/SNProductSelectDialog.aspx','选择商品',CallbackRadioFun);" /><input
                            type="button" value="置空" onclick=" Reset();" />
                </td>
                <td class="right">
                    客户Id：
                </td>
                <td>
                    <asp:Label ID="LabelCustomerID" runat="server" Text=""></asp:Label>
                    <input type="button" value="选择" onclick="OpenRadioDialog('/Dialog/CustomerDialog.aspx','选择客户',CallbackCustomerFun);" /><input
                        type="button" value="置空" onclick=" ResetCustomer();" />
                </td>
            </tr>
            <tr>
                <td class="right">
                    联系人：
                </td>
                <td>
                    <asp:TextBox ID="txtContact" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
                <td class="right">
                    自定义名称：
                </td>
                <td>
                    <asp:TextBox ID="txtCustomerName" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    电话：
                </td>
                <td>
                    <asp:TextBox ID="txtTelephone" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
                <td class="right">
                    手机：
                </td>
                <td>
                    <asp:TextBox ID="txtMobilePhone" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    传真：
                </td>
                <td>
                    <asp:TextBox ID="txtFax" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
                <td class="right">
                    QQ：
                </td>
                <td>
                    <asp:TextBox ID="txtQQ" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    MSN：
                </td>
                <td>
                    <asp:TextBox ID="txtMSN" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
                <td class="right">
                    旺旺：
                </td>
                <td>
                    <asp:TextBox ID="txtWangwang" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    Email：
                </td>
                <td>
                    <asp:TextBox ID="txtEmail" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
                <td class="right">
                    所在地区：
                </td>
                <td>
                    <asp:DropDownList ID="ddlProvinceId" runat="server">
                        <asp:ListItem Value="0">省份</asp:ListItem>
                    </asp:DropDownList>
                    <asp:DropDownList ID="ddlCityId" runat="server">
                        <asp:ListItem Value="0">城市</asp:ListItem>
                    </asp:DropDownList>
                    <asp:TextBox ID="txtAddress" runat="server" CssClass="text width120"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    注册时间：
                </td>
                <td>
                    <asp:TextBox ID="txtRegDate" runat="server" CssClass="text width200" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"></asp:TextBox>
                </td>
                <td class="right">
                    有效期：
                </td>
                <td>
                    <asp:TextBox ID="txtAvailDate" runat="server" CssClass="text width200" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    验证密码：
                </td>
                <td>
                    <asp:TextBox ID="txtPassword" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
                <td class="right">
                    用户数：
                </td>
                <td>
                    <asp:TextBox ID="txtUserCount" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    机器码：</td>
                <td>
                    <asp:TextBox ID="txtMachineCode" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
                <td class="right">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="right">
                    备注:
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtRemark" runat="server" CssClass="text" Width="99%" Height="125px"
                        TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="4" align="center">
                    <asp:HiddenField ID="hdfSKUId" runat="server" />
                    <asp:HiddenField ID="hdfCustomerID" runat="server" />
                    <input id="btnSave" type="button" value=" 保 存 " class="btn_77px" />
                    <input id="btnClose" type="button" value=" 返 回 " onclick="art.dialog.close();return false;"
                        class="btn_77px" />
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%=ddlProvinceId.ClientID %>").change(function () {
                ProvinceCtiyCounty(this.value, 'LoadCityJson', '<%=ddlCityId.ClientID %>');
            })

            rulesValue = { '<%=txtProductSN.UniqueID %>': { required: true }, '<%=hdfSKUId.UniqueID %>': { required: true }, '<%=txtTelephone.UniqueID %>': { number: true }, '<%=txtMobilePhone.UniqueID %>': { Mobile: true }, '<%=txtFax.UniqueID %>': { number: true }, '<%=txtQQ.UniqueID %>': { number: true} };
            messagesValue = { '<%=txtProductSN.UniqueID %>': { required: "请输入序列号" }, '<%=hdfSKUId.UniqueID %>': { required: "请选择序列号归属的品项" }, '<%=txtTelephone.UniqueID %>': { number: "电话格式输入错误" }, '<%=txtMobilePhone.UniqueID %>': {}, '<%=txtFax.UniqueID %>': { number: "传真格式输入错误" }, '<%=txtQQ.UniqueID %>': { number: "QQ格式输入错误"} }
            var form = jQuery.validator.ValidateForm($("#aspnetForm"), rulesValue, messagesValue);
            $("#btnSave").click(function () {
                if (form.form()) {
                    FormPostAjax("/crm/product/SNEdit.aspx?op=Save&Id=<%=Id %>", "ok", CloseReload);
                }
                return false;
            })
        });
        function CallbackRadioFun(text, value) {
            $('#<%=txtSKUName.ClientID %>').val(text);
            $('#<%=hdfSKUId.ClientID %>').val(value);
        }
        function Reset() {
            $('#<%=txtSKUName.ClientID %>').val("");
            $('#<%=hdfSKUId.ClientID %>').val("");
            return false;
        }
        function CallbackCustomerFun(text, value) {
            if ($('#<%=txtCustomerName.ClientID %>').val().length == 0)
                $('#<%=txtCustomerName.ClientID %>').val(text);
            $('#<%=hdfCustomerID.ClientID %>').val(value);
            $('#<%=LabelCustomerID.ClientID %>').html(text);
        }
        function ResetCustomer() {
            $('#<%=hdfCustomerID.ClientID %>').val("");
            $('#<%=LabelCustomerID.ClientID %>').html("");
            return false;
        }
        
    </script>
</asp:Content>
