<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShoppingCarts_Wap.aspx.cs" Inherits="Hidistro.UI.Web.WAP.ShoppingCarts_Wap" %>
<%@ Register TagPrefix="Hi" Namespace="Hidistro.UI.Common.Controls" Assembly="Hidistro.UI.Common.Controls" %>
<%@ Import Namespace="Hidistro.Core" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>购物车列表</title>
<link rel="stylesheet" type="text/css" href="style/css.css"/>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />

<script>
    function ChangeNumbers(num,obj) {
        if (isNaN(num)) {
            alert("格式有误！");
            return false;
        }
        var txtobj;
        var quantiy = $(obj).parent("td").parent("tr").find("td:eq(2)").find("input").val() - 0 + parseInt(num);
        if (quantiy <= 1)
            quantiy=1
        $(obj).parent("td").parent("tr").find("td:eq(2)").find("input").val(quantiy);
    }

    function CheckProductNum(obj) {
        obj.value = obj.value.replace(/[^0-9_]/g, '');
        var pronum = obj.value.replace(/\s/g, "");
        if (pronum == "" || parseInt(pronum) <= 0) {
            obj.value = "1";
            return false;
        }
    }

//关闭商品
    function DeleteProduct(skuId) {
        $.ajax({
            url: "ShoppingHandler.aspx",
            type: 'post', dataType: 'json', timeout: 10000,
            data: { action: "DeletProduct", sku_id: skuId },
            async: false,
            success: function(resultData) {
                if (resultData.Status == "1") {
                    $("#li_" + skuId).remove();
                }
                else {
                    alert("收货地址选择出错，请重试!");
                }
            }
        });
    }
</script>
   <Hi:Script ID="Script2" runat="server" Src="/utility/jquery-1.3.2.min.js" />   
</head>

<body>
<form runat="server">
<div class="ddwctop">购物车</div>
<div class="gouwuche">
<ul>
<asp:Repeater ID="rp_goods" runat="server">
<ItemTemplate>
<li id="li_<%# Eval("SkuId") %>">
<div class="gouwuchelitop"><img src="images/gouwuchecha.jpg" onclick="javascript:DeleteProduct('<%# Eval("SkuId")%>')"/></div>
<div class="gouwuchelicont">
<div class="gouwuchelicontl"><Hi:ListImage ID="ListImage1"  runat="server" DataField="ThumbnailUrl60"/></div>
<div class="gouwuchelicontr"><em><%# Eval("Name")%>
         	<div class="color_36c">
                <asp:HyperLink ID="hlinkPurchase" runat="server" NavigateUrl='<%# string.Format(Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails"),  Eval("PurchaseGiftId"))%>'
                    Text='<%# Eval("PurchaseGiftName")%>' Target="_blank"></asp:HyperLink><asp:HyperLink ID="hlinkWholesaleDiscount" runat="server"
                    NavigateUrl='<%# string.Format(Globals.GetSiteUrls().UrlData.FormatUrl("FavourableDetails"),  Eval("WholesaleDiscountId"))%>'
                    Text='<%# Eval("WholesaleDiscountName")%>' Target="_blank"></asp:HyperLink></div>
</em>
<span><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>购买</td>
    <td><img src="images/jianhao.jpg" width="18" height="18" style="cursor:pointer" onclick="javascript:return ChangeNumbers(-1,this)" /></td>
    <td><input id="txtnumbers" runat="server" type="text" class="inputtext" value='<%# Eval("Quantity")%>' onkeyup="javascript:CheckProductNum(this)" onkeypress="javascript:CheckProductNum(this)"  onblur='CheckProductNum(this)'/></td>
    <td><img src="images/jiahao.jpg" width="18" height="18"  style="cursor:pointer" onclick="javascript:return ChangeNumbers(1,this)" /></td>
    <td>件</td>
  </tr>
</table>
</span>
</div>
<input type="hidden" id="hdskuId" runat="server" value='<%# Eval("SkuId") %>' />
</div>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>

</div>
<div class="zfaniu1"><p><asp:Button ID="btnTotal" runat="server" CssClass="totalbtn" runat="server" Text="结算" /></p></div>
<!--[if lt IE 9]>
　　　　<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
　　<![endif]-->
　　</form>
</body>
</html>
