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

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="form" style="width: 320px; height:180px; padding: 10px;">
        <table cellpadding="0" cellspacing="0" border="0" class="table_form">
            <tr>
                <td class="right">
                    商品：
                </td>
                <td>
                    <input id="txtSKUName" type="text" class="text" />
                    <input type="button" value="选择" class="Good" />
                    <input id="hdfSkuId" type="hidden" />
                    <input id="hdfProductId" type="hidden" />
                    <input id="hdfSKUCode" type="hidden" />

                    <input id="hdfHasSn" type="hidden" />
                    <input id="hdfSellorRent" type="hidden" />
                </td>
            </tr>
            <tr>
                <td class="right">
                    数量：
                </td>
                <td>
                    <input id="txtPyaSum" type="text" class="text width50" value="1" /><span class="unit"></span>
                </td>
            </tr>
            <tr>
                <td class="right">
                    成交价：
                </td>
                <td>
                    <input id="txtPrice" type="text" class="text width50" />元
                </td>
            </tr>
            <tr>
                <td class="right">
                    总价：
                </td>
                <td >
                <span class="amount">0.00</span>元
                </td>
            </tr>
            <tr class="tr_sn" style="display:none;">
                <td class="right">
                    序列号：
                </td>
                <td>
                    <input id="txtSN" type="text" class="text" readonly="readonly" />
                    <input class="SN" type="button" value="选择" />
                    <input id="hdfIsRenewal" type="hidden" value="0"/>
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".Good").click(function () {
                OpenRadioDialog('/Dialog/OrderProductSelectDialog.aspx', '选择商品', function (text, value) {
                    var json = eval("(" + value + ")");
                    $("#txtSKUName").val(json.name);
                    $("#hdfSkuId").val(json.Id);
                    $("#hdfProductId").val(json.ProductId);
                    $(".unit").text(json.Unit);
                    $("#txtPrice").val(json.Price);
                    $(".amount").text(json.Price);
                    $("#hdfSKUCode").val(json.SKUCode)
                    $("#hdfHasSn").val(json.HasSN)
                    $("#hdfSellorRent").val(json.SellorRent)
                    
                    if (json.HasSN == "1" && json.SellorRent == "2") {
                        $(".tr_sn").show();
                    } else {
                        $(".tr_sn").hide();
                    }
                });
            })
            $(".SN").click(function () {
                var url = "SelectSNDialog.aspx?ProductId=" + $("#hdfProductId").val();
                OpenRadioDialog(url, '选择序列号', function (text, value) {
                    $("#txtSN").val(text);
                    $("#hdfIsRenewal").val(value);
                });
            })
            $("#txtPyaSum").blur(function () { $(".amount").text(parseFloat($("#txtPrice").val()) * parseInt($("#txtPyaSum").val())) })
            $("#txtPrice").blur(function () { $(".amount").text(parseFloat($("#txtPrice").val()) * parseInt($("#txtPyaSum").val())) })
        });
    </script>
</asp:Content>
