<%@ Page Language="C#" MasterPageFile="~/AngelShopMasters.Master" AutoEventWireup="true"
    CodeBehind="dingdan.aspx.cs" Inherits="AngelShop.dingdan" Title="Orders" %>
<%@ Register Src="~/usercontrol/Member.ascx" TagName="mem" TagPrefix="URL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     <script src="JS/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="JS/lhgdialog/lhgdialog.js" type="text/javascript"></script>
    <div class="neiye">
        <div class="neiye_1" style="width: 207px;">
            <URL:mem ID="me" runat="server" />
        </div>
        <div class="neiye_2">
            <div class="neiye_24">
                <div class="dd_r_t">
                    <span>My Order</span><img src="images/dindan_03.jpg" width="32" height="30" />
                    <div class="clear">
                    </div>
                </div>

                <table width="100%" id="tb" runat="server" border="0" cellspacing="0" cellpadding="0">
                <tr><td align="center"><div id="spanOrderNo"  style="font-size:18px;font-weight:bold;"><%= Request.Params["pid"]%></div></td></tr>
                <tr><td align="right"><font  style="font-size:18px;font-weight:bold;">Order Time:</font><asp:Label ID="OrderAddtime"
                        runat="server" Text="Label"></asp:Label></td></tr>
                    <tr>
                        <td>
                            <div style="clear: both">
                                <asp:Repeater ID="rptOrders" runat="server">
                                    <HeaderTemplate>
                                        <table width="100%" border="0" cellspacing="1" cellpadding="0" style="background: #dbdbdb;
                                            line-height: 30px;">
                                            <tr>
                                                <td width="9%" bgcolor="#ededed">
                                                    <div align="center">
                                                        Serial</div>
                                                </td>
                                                <td width="24%" bgcolor="#ededed">
                                                    <div align="center">
                                                        Name
                                                    </div>
                                                </td>
                                                <td width="8%" bgcolor="#ededed">
                                                    <div align="center">
                                                        ID
                                                    </div>
                                                </td>
                                                <td width="10%" bgcolor="#ededed">
                                                    <div align="center">
                                                        Qty
                                                    </div>
                                                </td>
                                                <td width="18%" bgcolor="#ededed">
                                                    <div align="center">
                                                        Weight(KG)
                                                    </div>
                                                </td>
                                                <td width="10%" bgcolor="#ededed">
                                                    <div align="center">
                                                        Color
                                                    </div>
                                                </td>
                                                <td width="13%" bgcolor="#ededed">
                                                    <div align="center">
                                                        Price
                                                    </div>
                                                </td>
                                                <td width="18%" bgcolor="#ededed">
                                                    <div align="center">
                                                      Goods Total($)</div>
                                                </td>
                                            </tr>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <tr>
                                            <td bgcolor="#FFFFFF">
                                                <div align="center">
                                                    <%# Eval("ROWID")%></div>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <div align="center">
                                                    <%# Eval("titles") %></div>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <div align="center">
                                                    <%# Eval("ids") %></div>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <div align="center">
                                                    <%# Eval("qty") %></div>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <div align="center">
                                                    <asp:Label ID="lbW" runat="server" Text=' <%# Eval("weight")%>'></asp:Label>
                                                </div>
                                            </td>
                                             <td bgcolor="#FFFFFF">
                                                <div align="center">
                                                    <%# Eval("color")%></div>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <div align="center">
                                                    <%# Eval("Pv")%></div>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <div align="center">
                                                    <asp:Label ID="lbT" runat="server" Text=' <%# Eval("Total")%>'></asp:Label>
                                                    $</div>
                                                   <!--<a href="xx.aspx?id=<%# Eval("ids")%>">Comment message</a>-->
                                            
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        </table> </td> </tr> </table>
                                    </FooterTemplate>
                                </asp:Repeater>



                    <div style="height:auto;width:100%;padding-top:10px;">
                    <div style="width:180px;float:left;height:88px;">
                                    Weight :
                                    <asp:Label ID="lbWeight" runat="server" Text="Label"></asp:Label>KG
                                    <br />
                                    Credits Price :
                                    <asp:Label ID="CreditsPrice" runat="server" Text="Label"></asp:Label>$
                                   
                                    <br />
                                    Total : 
                                    <asp:Label ID="lbFreight" runat="server" Text="Label"></asp:Label>$
                     </div>
                    <div class="remakscontent"> 
                        <%if (order_state != 4)
                          { %>
                        <%if (UserRemarks != "")
                          { %>
                          <div id="Order_Remark" class="order_remaks"><%=UserRemarks%></div>
                          <img src="images/updateremaks.jpg" onclick="EditOrderRemark()"/>
                         
                        <%}
                          else
                          {%>
                          <img src="images/addremaks.jpg" onclick="EditOrderRemark()"/>

                           <%}
                          }
                          else
                          {%>
                         <div class="order_remaks"><%=UserRemarks%></div>
                          <%} %>    
                    </div>          
                    </div>

                                <div style="width:100%;clear:both;">
                                    Shipping Method :
                                    <asp:Label ID="SMethod" runat="server" Text=" "></asp:Label>
                                    <br />
                                    Tracking Number :
                                    <asp:Label ID="lbTracking" runat="server" Text="Label"></asp:Label>
                                </div>
                                  
                            </div>
                            <div style="clear: both; text-align: center">
                                <div id="PageInfo" runat="server" class="anpager">
                                </div>
                            </div>

                <script type="text/javascript">
                    function cal() {
                        var a = document.getElementById("txtOrderRemark");
                        if (a.value.length > 200) {
                            a.value = a.value.slice(0, 200);
                        }
                    }  
                
                    function EditOrderRemark() {
                        var dialog = $.dialog({
                            title: 'Orders Remaks',
                            content: '<textarea id="txtOrderRemark" name="txtOrderRemark" oninput="cal()" onpropertychange="cal()"  rows="6" cols="39" class="input">' + $("#Order_Remark").html() + '</textarea>',
                            min: false,
                            max: false,
                            lock: true,
                            ok: function () {
                                var remark = $("#txtOrderRemark", parent.document).val();
                                if (remark == "") {
                                    $.dialog.alert('Sorry, please enter the order form!', function () { }, dialog);
                                    return false;
                                }
                                //alert(remark);

                                var postData = { "order_no": $("#spanOrderNo").text(), "remark": remark };
                                //发送AJAX请求
                                sendAjaxUrl(dialog, postData, "tools/submit_ajax.ashx?action=edit_order_remaks");
                                return false;
                            },
                            cancel: true
                        });
                    }

                    //发送AJAX请求
                    function sendAjaxUrl(winObj, postData, sendUrl) {
                        $.ajax({
                            type: "post",
                            url: sendUrl,
                            data: postData,
                            dataType: "json",
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                $.dialog.alert('Attempt to send failed with error message:' + errorThrown, function () { }, winObj);
                            },
                            success: function (data, textStatus) {
                                if (data.status == 1) {
                                    winObj.close();
                                    $.dialog.tips(data.msg, 2, '32X32/succ.png', function () { location.reload(); }); //刷新页面
                                } else {
                                    $.dialog.alert('Error message:' + data.msg, function () { location.reload(); }, winObj);
                                }
                            }
                        });
                    }



                </script>



                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</asp:Content>

