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

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <style type="text/css">
        .list .table_list th, .list .table_list td
        {
            line-height: 14px;
            height: 14px;
        }
    </style>
    <div class="form" style="width: 720px; padding: 10px;">
        <table cellpadding="0" cellspacing="0" border="0" class="table_form">
            <tr>
                <td class="right">
                    订单号：
                </td>
                <td>
                    <asp:Literal ID="ltlOrderSN" runat="server"></asp:Literal>
                </td>
                <td class="right">
                    退货单号：
                </td>
                <td>
                    <asp:TextBox ID="txtDeliveryCode" runat="server" CssClass="text" 
                        ReadOnly="True"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    客户：
                </td>
                <td>
                    <asp:Literal ID="ltlCustomerName" runat="server"></asp:Literal>
                </td>
                <td class="right ">
                    负责人：
                </td>
                <td>
                    <asp:TextBox ID="txtTrackUserName" runat="server" CssClass="text" ReadOnly="True"></asp:TextBox>&nbsp;<input
                        id="btnSelect" type="button" value="选择" onclick="OpenRadioDialog('/Dialog/EmploySelectDialog.aspx?user=0','选择负责人',CallRadioFun);" />
                </td>
            </tr>
            <tr>
                <td class="right">
                    <span class="red">*</span> 配送方式：
                </td>
                <td>
                    <asp:DropDownList ID="ddlShippingMothod" runat="server">
                        <asp:ListItem Value="">请选择退送方式</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td class="right ">
                    运费：
                </td>
                <td>
                    <asp:TextBox ID="txtMoney" runat="server" CssClass="text width50" MaxLength="8" Text="0"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    物流公司：
                </td>
                <td>
                    <asp:TextBox ID="txtLogiName" runat="server" CssClass="text "></asp:TextBox>
                </td>
                <td class="right ">
                    物流单号：
                </td>
                <td>
                    <asp:TextBox ID="txtLogiNo" runat="server" CssClass="text "></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    退货人：
                </td>
                <td>
                    <asp:TextBox ID="txtShipName" runat="server" CssClass="text" Text="XXX"></asp:TextBox>
                </td>
                <td class="right ">
                    电话：
                </td>
                <td>
                    <asp:TextBox ID="txtTelePhone" runat="server" CssClass="text" Text="12345679"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    手机：
                </td>
                <td>
                    <asp:TextBox ID="txtMobile" runat="server" CssClass="text" Text="12345678912"></asp:TextBox>
                </td>
                <td class="right ">
                     邮编：
                </td>
                <td>
                    <asp:TextBox ID="txtZipCode" runat="server" CssClass="text" Text="12345678912"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    退货地区：
                </td>
                <td colspan="3">
                    <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 width400" Text=""></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    退货原因：
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtRemark" runat="server" CssClass="text width400" TextMode="MultiLine"
                        Height="45px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <div class="list" style="height: 100px; overflow-y: auto; margin-top: 10px; overflow-x: hidden">
                        <asp:Repeater ID="rptData" runat="server">
                            <HeaderTemplate>
                                <table class="table_list" cellspacing="0" cellpadding="0" border="0" id="ctl00_ContentPlace_gvData"
                                    style="border-collapse: collapse;">
                                    <tr>
                                        <th scope="col">
                                            商品货号
                                        </th>
                                        <th scope="col">
                                            商品名称
                                        </th>
                                        <th scope="col">
                                            购买数量
                                        </th>
                                        <th scope="col">
                                            已发货
                                        </th>
                                        <th scope="col">
                                            此单退货数量
                                        </th>
                                    </tr>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <tr align="left">
                                    <td>
                                        <%#Eval("ProductSN")%>
                                    </td>
                                    <td>
                                        <%#Eval("ProductName")%>
                                    </td>
                                    <td>
                                        <%#Eval("PayNum")%><%#Eval("Unit")%>
                                    </td>
                                    <td class="product_price">
                                        <%#Eval("SendNum")%><%#Eval("Unit")%>
                                    </td>
                                    <td>
                                        <input type="text" name="OrdersItems_UnSendNum[<%#Eval("Id") %>]" class="text width50"
                                            value="<%#Eval("SendNum")%>" />
                                        <input type="hidden" name="OrdersItems_ProductName[<%#Eval("Id") %>]" value="<%#Eval("ProductName") %>" />
                                        <input type="hidden" name="OrdersItems_Unit[<%#Eval("Id") %>]" value="<%#Eval("Unit") %>" />
                                        <input type="hidden" name="OrdersItems_ProductId[<%#Eval("Id") %>]" value="<%#Eval("ProductId") %>" />
                                        <input type="hidden" name="OrdersItems_Id[<%#Eval("Id") %>]" value="<%#Eval("Id") %>" />
                                        <input type="hidden" name="OrdersItems_SendNum[<%#Eval("Id") %>]" value="<%#Eval("SendNum") %>" />
                                        <input type="hidden" name="OrdersItems_Count[<%#Eval("Id") %>]" value="<%#Eval("PayNum") %>" />
                                        <input type="hidden" name="OrdersItems_ProductSN[<%#Eval("Id") %>]" value="<%#Eval("ProductSN") %>" />
                                        <input type="hidden" name="OrdersItems_SN[<%#Eval("Id") %>]" value="<%#Eval("SN") %>" />
                                        <input type="hidden" name="OrdersItems_IsRenewal[<%#Eval("Id") %>]" value="<%#Eval("IsRenewal") %>" />
                                    </td>
                                </tr>
                            </ItemTemplate>
                            <FooterTemplate>
                                </table>
                            </FooterTemplate>
                        </asp:Repeater>
                        <asp:Repeater ID="rptData2" runat="server">
                            <HeaderTemplate>
                                <table class="table_list" cellspacing="0" cellpadding="0" border="0" id="ctl00_ContentPlace_gvData"
                                    style="border-collapse: collapse;">
                                    <tr>
                                        <th scope="col">
                                            商品名称
                                        </th>
                                        <th scope="col">
                                            商品货号
                                        </th>
                                        <th scope="col">
                                            购买数量
                                        </th>
                                        <th scope="col">
                                            此单退货数量
                                        </th>
                                    </tr>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <tr align="left">
                                    <td>
                                        <%#Eval("ProductSN")%>
                                    </td>
                                    <td>
                                        <%#Eval("ProductName")%>
                                    </td>
                                    <td>
                                        <%#Eval("oCount")%>
                                    </td>
                                    <td>
                                        <%#Math.Abs(Convert.ToInt32(Eval("Count")))%>
                                    </td>
                                </tr>
                            </ItemTemplate>
                            <FooterTemplate>
                                </table>
                            </FooterTemplate>
                        </asp:Repeater>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="4" style="text-align: center">
                    <asp:HiddenField ID="hdfCustomerId" runat="server" />
                    <asp:HiddenField ID="hdfCustomerName" runat="server" />
                    <asp:HiddenField ID="hdfTrackUserID" 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 () {
            function ChangeCity() {
                if (this.value == "0") return;
                var cityText = $("#<%=ddlCity.ClientID %> option:selected").text();
                var provinceText = $("#<%=ddlProvince.ClientID %> option:selected").text();
                $("#<%=txtAddress.ClientID %>").val(provinceText + cityText);
            }

            $("#<%=ddlShippingMothod.ClientID %>").change(function () {
                var freight = $("#<%=ddlShippingMothod.ClientID %> option:selected").attr("freight");
                $("#<%=txtMoney.ClientID %>").val(freight);
            });
            $("#<%=ddlProvince.ClientID %>").change(function () {
                ProvinceCtiyCounty(this.value, 'LoadCityJson', '<%=ddlCity.ClientID %>');
            })
            $("#<%=ddlCity.ClientID %>").change(ChangeCity);
            $("#<%=txtAddress.ClientID %>").blur(function () {
                if (this.value == "") {
                    $("#<%=ddlCity.ClientID %>").change(ChangeCity);
                } else {
                    $("#<%=ddlCity.ClientID %>").unbind("change");
                }
            });

            $("#btnSave").click(function () {
                return FormPostAjax("/crm/orders/RefundProductEdit.aspx?op=Save&Id=<%=Id %>&OrderId=<%=OrderId %>", "ok", CloseReload); 
            })
        });
        function CallRadioFun(text, value) {
            $('#<%=txtTrackUserName.ClientID %>').val(text);
            $('#<%=hdfTrackUserID.ClientID %>').val(value);
        }
    </script>
</asp:Content>
