Beispiel #1
0
        /// <summary>
        /// 获得用户的购物车
        /// </summary>
        /// <param name="ht"></param>
        /// <returns></returns>
        public static string GetCustomerShoppingCart(Hashtable ht)
        {
            int    productCount                 = 0;
            float  productTotalPrice            = 0;
            string siteBaseURL                  = YoeJoyConfig.SiteBaseURL;
            List <FrontDsiplayProduct> products = CustomerShoppingCartService.GetShoppingCartProducts(ht);
            string shoppingCartHTML             = String.Empty;

            if (products != null)
            {
                productCount = products.Count;
                StringBuilder strb = new StringBuilder();

                string liHTML = @"<p class='l'>
                        <a href='{0}'>
                            <img alt='{1}' src='{2}' width='30' height='30'></a><a class='goodsName'
                                href='{3}'>{4}</a><b>¥{5}</b>
                    </p>
                    <div class='r'>
                        <a class='sub' href='javascript:void(0)'>-</a>
                        <input class='num' maxlength='3' value='1' type='text'/>
                        <a class='add' href='javascript:void(0)'>+</a>
                        <p onClick='javascript:DeleteShoppingCartItem(this);'>
                            删除 <input type='hidden' value='{6}'/></p>
                    </div>";

                foreach (FrontDsiplayProduct product in products)
                {
                    string deeplink = YoeJoyConfig.SiteBaseURL + "Pages/Product.aspx?c1=" + product.C1SysNo + "&c2=" + product.C2SysNo + "&c3=" + product.C3SysNo + "&pid=" + product.ProductSysNo;
                    string image    = YoeJoyConfig.ImgVirtualPathBase + product.ImgPath;
                    strb.Append(String.Format(liHTML, deeplink, product.ProductBriefName, image, deeplink, product.ProductBriefName, product.Price, product.ProductSysNo));
                    productTotalPrice += float.Parse(product.Price);
                }

                shoppingCartHTML = strb.ToString();
            }

            string shoppingCartHTMLWrapper1 = String.Format(@"<div id='chart'>
        <span>购物车:<b><a href='{0}Shopping/ShoppingCart.aspx'>{1}</a></b> 件
        </span>
        <img alt='购物车' src='../static/images/gwcbt0.png' width='39' height='32' />
        <a href='{2}Shopping/ShoppingCart.aspx'>结算</a>
    </div>
    <div id='chartContent'>
        <img alt='背景' src='../static/images/gwctop.png' width='374' height='18' />
        <div id='myShoppingCart' class='shopping'>", siteBaseURL, productCount, siteBaseURL);


            string shoppingCartHTMLWrapper2 = String.Format(@"</div>
        <div class='payNow'>
            <div class='l'>
                共<b><a href='{0}Shopping/ShoppingCart.aspx'>{1}</a></b>件商品
            </div>
            <div class='r'>
                <p>
                    合计:<b id='CartTotalPrice'>¥{2}</b></p>
                <a href='{3}Shopping/ShoppingCart.aspx'>
                    <img alt='结算' src='../static/images/jsbt.png' width='61' height='25' /></a>
            </div>
        </div>
    </div>", siteBaseURL, productCount, productTotalPrice.ToString("0.00"), siteBaseURL);


            return(String.Concat(shoppingCartHTMLWrapper1, shoppingCartHTML, shoppingCartHTMLWrapper2));
        }
Beispiel #2
0
        /// <summary>
        /// 获得用户的购物车
        /// </summary>
        /// <param name="ht"></param>
        /// <returns></returns>
        public static string GetCustomerShoppingCart(Hashtable ht)
        {
            float  productTotalPrice            = 0;
            int    productTotalWeight           = 0;
            string siteBaseURL                  = YoeJoyConfig.SiteBaseURL;
            List <FrontDsiplayProduct> products = CustomerShoppingCartService.GetShoppingCartProducts(ht);
            string shoppingCartHTML             = String.Empty;

            if (products != null)
            {
                StringBuilder strb = new StringBuilder(@"<table id='ProductAcount' cellspacing='0' cellpadding='0'>
                <thead>
                    <tr>
                        <td>商品名称</td>
                        <td>攸怡价</td>
                        <td>积分</td>
                        <td>数量</td>
                        <td>重量(含包装)</td>
                        <td>商品合计</td>
                        <th>操作</th>
                    </tr>
                </thead><tbody>");

                string trHTML = @"<tr>
                        <td>
                            <p class='ProductAcountTitle'>
                                <input type='checkbox' checked='checked'/>
                                <input type='hidden' class='productId' value='{1}'/>
                                <a href='{2}'><img src='{3}'/></a>
                                <a href='{4}'>{5}</a>
                            </p>
                        </td>
                        <td>
                            <em>¥{6}</em><br/>
                            <span>¥{7}</span>
                        </td>
                        <td>
                            <span>{8}</span>
                        </td>
                        <td class='AllNum'>
                   <a class='sub' href='javascript:void(0);' onClick='YoeJoy.Site.ShoppingCart.MainCart.DecreaseItemNum(this);'>-</a>
                  <input class='num' type='text' maxlength='3' value='{9}'>
                  <input type='hidden' class='limitQty' value='{12}'/>
                  <input type='hidden' class='availableQty' value='{0}'/>
                  <a class='add' href='javascript:void(0);' onClick='YoeJoy.Site.ShoppingCart.MainCart.IncreaseItemNum(this);'>+</a>
                            <br>
                            <a class='kc' href='javascript:void(0);'>库存充足</a>
                        </td>
                        
                        <td>
                            <span>{10}g</span>
                        </td>
                        <td>
                            <b>¥{11}</b>
                        </td>
                        <th>
                            <a href='#'>收藏</a>
                            &nbsp;&nbsp;
                            <a href='javascript:void(0);' onClick='YoeJoy.Site.ShoppingCart.MainCart.DeleteCartItem(this);'>删除</a>
                        </th>
                    </tr>";

                foreach (FrontDsiplayProduct product in products)
                {
                    string deeplink   = YoeJoyConfig.SiteBaseURL + "Pages/Product.aspx?c1=" + product.C1SysNo + "&c2=" + product.C2SysNo + "&c3=" + product.C3SysNo + "&pid=" + product.ProductSysNo;
                    string image      = YoeJoyConfig.ImgVirtualPathBase + product.ImgPath;
                    int    productQty = ((CartInfo)ht[int.Parse(product.ProductSysNo)]).Quantity;
                    float  currentProductTotalPrice = float.Parse(product.Price) * productQty;
                    int    totalPoints = product.Point * productQty;
                    strb.Append(String.Format(trHTML, product.AvailableQty, product.ProductSysNo, deeplink, image, deeplink, product.ProductBriefName, product.BaiscPrice, product.Price, totalPoints, productQty, product.Weight, currentProductTotalPrice.ToString("0.00"), product.LimitQty));
                    productTotalPrice  += currentProductTotalPrice;
                    productTotalWeight += (int)product.Weight * productQty;
                }

                strb.Append("<tbody></table>");
                shoppingCartHTML = strb.ToString();
            }

            string shoppingCartHTMLWrapper1 = String.Format(@"<p class='priceAll'>
                <span>总重量共计:{0}kg</span>
				<span><b>运费:</b>(以结算为准)</span>
                <b>商品金额:</b>
                <strong>{1}</strong>
                <input type='hidden' value='{2}' id='totalPrice'/>
                <span>元</span>
            </p>", productTotalWeight / 1000, productTotalPrice, productTotalPrice);

            return(String.Concat(shoppingCartHTML, shoppingCartHTMLWrapper1));
        }