<%@ page language="C#" autoeventwireup="true" inherits="Cart, LebiMall" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title><%=model.Title %>-购物车</title>
    <meta name="description" content=<%=model.Description %> />
    <meta name="keywords" content=<%=model.Keywords %> />
    <meta name="generator" content="LBMall 3.0.0" />
    <link href="images/css/css.css" rel="stylesheet" type="text/css" />
    <link href="images/css/cart.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="images/js/shopjs.js"></script>
    <script type="text/javascript" src="images/js/prototype-1.4.0.js"></script>
    <link href="images/css/s-4.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="images/js/dialog-4c.js"></script>
    <script type="text/javascript" src="images/js/Ajax.js"></script>
    <script type="text/javascript" src="images/js/cartdiv.js"></script>
    <script type="text/javascript">
       
        function init(){
          doRequest("ListCart.ashx");
        }
        //全选
        function chdecboxAll(){
      
            var form =document.forms[0];
            for(i=0;i<form.elements.length;i++)
            {
                if(form.elements[i].type=="checkbox")
                {
                    form.elements[i].checked=true;
                }
            }
        }
        //批量的删除取id
        function del_sumid(){
            var str=document.getElementsByName("checkboxc");
            var list_id="";
            for(var i=0;i<str.length;i++){
                if(str[i].checked==true){
                    list_id+=str[i].value+",";
                }
            }
            if(list_id!=""){
                doRequest("DelCart.ashx?del_id="+list_id);
            }
        }
        //删除id
        function del_id(sic){
            
           var id_=sic+",";
           doRequest("DelCart.ashx?del_id="+id_);
            
        }
        //查看不支持货到付款的产品的窗口
        function is_showCart(){
            var str=document.getElementsByName("checkboxc");
            var list_id="";
            for(var i=0;i<str.length;i++){
                if(str[i].checked==true){
                    list_id+=str[i].value+",";
                }
            }
            if(list_id!=""){
                addCod(list_id);
            }
        }
        //跳转到确认订单
        function to_ordreform(){
            var str=document.getElementsByName("checkboxc");
            var list_id="";
            for(var i=0;i<str.length;i++){
                if(str[i].checked==true){
                    list_id+=str[i].value+",";
                }
            }
            if(list_id!=""){
                window.location.href="OrderForm.aspx?idlist="+escape(list_id)+"&idcod=0";
            }
        }
        
         function search2(){
            var texts2=document.getElementById("ser2").value;
            var select_v2=document.getElementById("Select3").value;
            window.location="list.aspx?tid="+select_v2+"&titlec="+escape(texts2);
        }
    </script>

</head>
<body onload="init();">
    <form id="form1" runat="server">

        <div id="top-menu02">
        <div id="top-menu">
            <div class="right">
                <script type="text/javascript">indexhead();</script>
            </div>
        </div>
    </div>
    <div id="top">
        <div id="logo">
            <a href="http://<%=Request.Url.Host %><%=model.WebPath %>/">
                <img src="Upload/WebAdminImages/<%=model.Logoimg %>" border="0" /></a></div>
    </div>
    <div id="sp-menu">
        <ul>
            <li><a href="http://<%=Request.Url.Host %><%=model.WebPath %>/">首页</a></li>
            <%for (int i = 0; i < ds_tab.Tables[0].Rows.Count; i++){ %>
            <li><%if (model.Tab == "1")
                  { %>
                <a href="<%= ds_tab.Tables[0].Rows[i]["tdirname"]%>/" target="_blank"><%= ds_tab.Tables[0].Rows[i]["tname"]%></a>
                <%}else{%>
                <a href="TopTab.aspx?type=<%= ds_tab.Tables[0].Rows[i]["tdirname"]%>" target="_blank"><%= ds_tab.Tables[0].Rows[i]["tname"]%></a>
                <%} %></li>
            <%} %>
            <li><a href="http://<%=Request.Url.Host %><%=model.WebPath %>/News/" target="_blank">资讯</a></li>
        </ul>
        <p>
            <span><a href="ShopCoupon.aspx">优惠券</a></span></p>
    </div>
    

        <div id="contenter2">
            <div id="contenter">
                <div class="cart_1">
                    <div class="cart_1_l">
                        您的位置：<a href="Default.aspx">首页</a>&nbsp;&gt;&nbsp;我的购物车</div>
                    <div class="cart_1_r">
                        购物车帮您一次性完成批量购买与付款，下单更便捷，付款更简单！</div>
                </div>
                <div class="cart_2">
                    <table cellpadding="0" cellspacing="0" class="table_t">
                        <tr>
                            <td class="c_td1" align="center">
                                <a href="#" onclick="chdecboxAll()">全选</a>
                            </td>
                            <td class="c_td2" align="center">
                                店铺商品
                            </td>
                            <td class="c_td3" align="center">
                                单价（元）
                            </td>
                            <td class="c_td4" align="center">
                                数量
                            </td>
                            <td class="c_td5" align="center">
                                小计（元）
                            </td>
                            <td class="c_td6" align="center">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                    <div class="concc" id="serverResponse">
                    </div>
                    <br />

                    <script type="text/javascript">
                    var numcc=null;
                    function update(id,num,cnum){
                        var name='msg'+id
                        if((num/1)>(cnum/1)){
                            document.getElementById(name).style.display="block";
                            document.getElementById(name).innerHTML="购买数量大于库存!";
                        }
                        else if (num==0){
                            document.getElementById(name).innerHTML="购买数量不能为0!";
                            document.getElementById(name).style.display="block";
                        }
                        else if (cnum==0){
                            document.getElementById(name).innerHTML="库存为0不能购买!";
                        }else{
                            doRequest("Update.ashx?id="+id+"&num="+num);
                        }
                    }
                    </script>

                    <!--addCod()-->
                    <input type="button" id="btn_hd" runat="server" value="货到付款" onclick="is_showCart()" />
                    <input type="button" id="btn_lj" runat="server" value="立即购买" onclick="to_ordreform()" />
                </div>

               <div id="footer">
                <div id="copyright">
                    <div class="search">
                        <div class="search-left">
                            <div class="search-left-title">
                                搜索：</div>
                            <div class="search-left-form">
                                <input type="text" runat="server" id="ser2" size="30" /></div>
                            <div class="search-left-list">
                                <select id="Select3" runat="server">
                                </select>
                            </div>
                            <div class="search-left-button">
                                <img src="images/search-buttom.gif" width="60" height="20" onclick="search2()" /></div>
                        </div>
                        <div class="search-right">
                            <div runat=server id="div_s2"></div>
                        </div>
                    </div>
                </div>
            </div>
                <div class="copyright" runat="server" id="copr"></div>

                <div id="hdiv">
                </div>
            </div>
        </div>
    </form>
    <form id="del_form" method="post" action="DelCart.ashx">
        <input type="hidden" value="" id="del_id" name="del_id" />
    </form>
</body>
</html>
