Exemplo n.º 1
0
        /// <summary>
        /// 商品咨询
        /// </summary>
        /// <param name="user"></param>
        /// <param name="model"></param>
        public static void SendSMS_ask(Lebi_User user, Lebi_Comment model)
        {
            BaseConfig conf          = ShopCache.GetBaseConfig();
            int        IsAdminSms    = 0;
            int        IsSupplierSms = 0;

            if (conf.SMS_sendmode.Contains("SMSTPL_ask"))
            {
                IsAdminSms = 1;
            }
            Lebi_Product product = B_Lebi_Product.GetModel(model.Product_id);

            if (product == null)
            {
                product = new Lebi_Product();
            }
            if (product.Supplier_id > 0)
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(product.Supplier_id);
                if (supplier.IsSupplierTransport == 0)  //商家发货
                {
                    if (ShopCache.GetBaseConfig_Supplier(product.Supplier_id).SMS_sendmode.Contains("SMSTPL_ask"))
                    {
                        IsSupplierSms = 1;
                    }
                }
            }
            if (IsAdminSms == 0 && IsSupplierSms == 0)
            {
                return;
            }
            if (user.Language == "")
            {
                user.Language = Language.Languages().FirstOrDefault().Code;
            }
            string list          = "" + Language.Tag("商品名称", user.Language) + ":" + Language.Content(product.Name, user.Language) + ";" + Language.Tag("内容", user.Language) + ":" + model.Content + ";";
            string Admin_content = Language.Content(conf.SMSTPL_Admin_ask, user.Language);

            Admin_content = ReplaceSMSTag(Admin_content, user, conf);
            Admin_content = Admin_content.Replace("{$Content}", list);
            if (IsAdminSms == 1)
            {
                Send(conf.SMS_reciveno, Admin_content);
            }
            if (IsSupplierSms == 1)
            {
                BaseConfig_Supplier config_supplier = ShopCache.GetBaseConfig_Supplier(product.Supplier_id);
                Send(config_supplier.SMS_reciveno, Admin_content);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 购物车商品总价格
        /// </summary>
        /// <returns></returns>
        public decimal Basket_Product_Price()
        {
            decimal price = 0;
            List <Lebi_User_Product> models = Basket_Product();

            foreach (Lebi_User_Product model in models)
            {
                Lebi_Product pro = B_Lebi_Product.GetModel(model.Product_id);
                if (pro != null)
                {
                    price = price + pro.Price;
                }
            }
            return(price);
        }
Exemplo n.º 3
0
        public static decimal GetYunFei(List <Lebi_User_Product> pros, Lebi_Transport_Price price, decimal ordermoney = 0)
        {
            decimal weight = 0;
            decimal tiji   = 0;

            foreach (Lebi_User_Product pro in pros)
            {
                Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id);
                if (product == null)
                {
                    continue;
                }
                weight = weight + product.Weight * pro.count;                                    //总重量:单位:克
                tiji   = tiji + product.VolumeL * product.VolumeH * product.VolumeW * pro.count; //总体积:单位:立方厘米
            }
            return(GetYunFei(weight, tiji, price, ordermoney));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 单品代理佣金
        /// </summary>
        private void AgentProductMoney()
        {
            List <Lebi_Order_Product> Products = B_Lebi_Order_Product.GetList("Order_id=" + Order.id + "", "");

            if (Products == null)
            {
                return;
            }
            int     pid   = 0;
            decimal money = 0;
            Lebi_Agent_Product_User auser;

            foreach (Lebi_Order_Product model in Products)
            {
                Lebi_Product pro = B_Lebi_Product.GetModel(model.Product_id);
                pid = pro.Product_id == 0 ? pro.id : pro.Product_id;
                Lebi_Agent_Product apro = B_Lebi_Agent_Product.GetModel("Product_id=" + pid + "");
                if (apro == null)
                {
                    continue;
                }
                auser = B_Lebi_Agent_Product_User.GetModel("User_id=" + apro.User_id + " and IsFailure=0");
                if (auser == null)
                {
                    continue;
                }
                if (auser.Time_end.Date < System.DateTime.Now.Date)
                {
                    continue;
                }
                Lebi_User user = B_Lebi_User.GetModel(apro.User_id);
                if (user == null)
                {
                    continue;
                }
                money = model.Price * model.Count * auser.Commission / 100;
                AddMoney(money, user, 392, 0, model.Product_id, pid, pro.Number);
            }
        }
Exemplo n.º 5
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Search'");
            keyword     = Rstring_Para("0");
            list        = Rstring_Para("1");
            sort        = Rstring_Para("2");
            pageindex   = Rint_Para("3");
            id          = Rint_Para("4");
            pid         = Rint_Para("5");
            path        = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a class=\"text\"><span>" + Tag("商品搜索") + "</span></a><em>&raquo;</em><a class=\"text\"><span>“" + keyword + "”</span></a>";
            where       = ProductWhere + " and Type_id_ProductType <> 323";
            if (keyword != "")
            {
                //增加空格划词搜索 by kingdge 2013-09-18
                string wherekeyword = "";
                if (keyword.IndexOf(" ") > -1)
                {
                    string[] keywordsArr;
                    keywordsArr = keyword.Split(new char[1] {
                        ' '
                    });
                    foreach (string keywords in keywordsArr)
                    {
                        if (keywords != "")
                        {
                            if (wherekeyword == "")
                            {
                                wherekeyword = "Name like lbsql{'%" + keywords + "%'}";
                            }
                            else
                            {
                                wherekeyword += " and Name like lbsql{'%" + keywords + "%'}";
                            }
                        }
                    }
                }
                else
                {
                    wherekeyword = "Name like lbsql{'%" + keyword + "%'}";
                }
                where += " and ((" + wherekeyword + ") or Number like lbsql{'%" + keyword + "%'} or Code like lbsql{'%" + keyword + "%'})";
            }
            if (id > 0)
            {
                where += " and " + CategoryWhere(id);
            }
            if (pid > 0)
            {
                where += " and Brand_id=" + pid + "";
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else if (sort == "6")
            {
                order = " Count_Stock desc"; ordertmp = "a";
            }
            else if (sort == "6a")
            {
                order = " Count_Stock asc"; ordertmp = "";
            }
            else
            {
                order = " Sort desc,id desc"; ordertmp = "";
            }
            SQLDataAccess.SQLPara sp = new SQLDataAccess.SQLPara(where, order, "*");
            products    = B_Lebi_Product.GetList(sp, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(sp);
            string url = URL("P_Search", keyword + "," + list + "," + sort + ",{0}");

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
        }
Exemplo n.º 6
0
        public decimal Money_Tax              = 0;        //税金
        /// <summary>
        /// sid=0,取得全部供应商的商品
        /// </summary>
        /// <param name="type"></param>
        public Basket(int sid)
        {
            Products = Basket.UserProduct(CurrentUser, 142);

            PromotionTypes = new List <Lebi_Promotion_Type>();
            FreeProducts   = new List <Lebi_User_Product>();
            Shops          = new List <BasketShop>();
            List <BasketShop> tempShops   = new List <BasketShop>();
            List <string>     brandstring = new List <string>();

            foreach (Lebi_User_Product pro in Products)
            {
                try
                {
                    Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id);
                    if (product == null)
                    {
                        continue;
                    }
                    bool ishavebrand = false;
                    for (int i = 0; i < brandstring.Count(); i++)
                    {
                        if (brandstring[i].Contains(product.Brand_id.ToString() + ":"))
                        {
                            brandstring[i] += "," + pro.Product_id;
                            ishavebrand     = true;
                            break;
                        }
                    }
                    if (!ishavebrand)
                    {
                        brandstring.Add(product.Brand_id.ToString() + ":" + pro.Product_id);
                    }
                    if (product.Type_id_ProductType == 324)        //预定商品
                    {
                        pro.Product_Price = product.Price_reserve; //预定金额
                    }
                    else
                    {
                        pro.Product_Price = EX_Product.ProductPrice(product, CurrentUserLevel, CurrentUser, pro.count);//单价
                    }
                    //<-{计算品牌不含税商品总额  by lebi.kingdge 2015-08-22
                    Lebi_Brand brand = B_Lebi_Brand.GetModel(product.Brand_id);
                    if (brand != null)
                    {
                        if (brand.IsVAT == 0)
                        {
                            Money_Product_NOVAT += pro.Product_Price * pro.count;
                        }
                    }
                    //}->
                    Lebi_Supplier shop = B_Lebi_Supplier.GetModel(product.Supplier_id);
                    if (shop == null)
                    {
                        product.Supplier_id = 0;    //容错,商品供应商删除时,商城发货
                        shop = new Lebi_Supplier(); //自营商品
                    }
                    else
                    {
                        if (shop.IsSupplierTransport == 0)//商城代发货的情况
                        {
                            product.Supplier_id = 0;
                            shop = new Lebi_Supplier();//自营商品
                        }
                    }

                    BasketShop bshop = (from m in tempShops
                                        where m.Shop.id == product.Supplier_id
                                        select m).ToList().FirstOrDefault();
                    if (bshop == null)
                    {
                        if (product.Supplier_id == 0)
                        {
                            //shop = new Lebi_Supplier();//自营商品
                            bshop          = new BasketShop();
                            bshop.Shop     = shop;
                            bshop.Products = new List <Lebi_User_Product>();
                            tempShops.Add(bshop);
                        }
                        else
                        {
                            bshop          = new BasketShop();
                            bshop.Shop     = shop;
                            bshop.Products = new List <Lebi_User_Product>();
                            tempShops.Add(bshop);
                        }
                    }
                    (from m in tempShops
                     where m.Shop.id == product.Supplier_id
                     select m).ToList().FirstOrDefault().Products.Add(pro);
                }
                catch (System.NullReferenceException)
                {
                }
            }
            tempShops = tempShops.OrderBy(a => a.Shop.id).ToList();
            if (SYS.IsSupplierCash == "1")
            {
                if (sid == 0)
                {
                    sid = RequestTool.RequestInt("sid");
                }
                if (sid == 0)
                {
                    string tempid = CookieTool.GetCookieString("supplier");
                    int.TryParse(tempid, out sid);
                }
                cashsupplierid = sid;
                bool flag = false;
                foreach (BasketShop shop in tempShops)
                {
                    if (shop.Shop.IsCash == 1)
                    {
                        IsMutiCash = true;
                    }
                    if (shop.Shop.id == cashsupplierid)
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    try
                    {
                        cashsupplierid = tempShops.FirstOrDefault().Shop.id;
                    }
                    catch
                    {
                        cashsupplierid = 0;
                    }
                }

                if (sid > 0)
                {
                    //只保留当前结算供应商的数据
                    List <int> ids = new List <int>();
                    for (int i = 0; i < tempShops.Count; i++)
                    {
                        if (tempShops[i].Shop.id == cashsupplierid)
                        {
                            Shops.Add(tempShops[i]);
                        }
                    }
                }
                else
                {
                    Shops = tempShops;
                }
            }
            else
            {
                Shops = tempShops;
            }
            Products = new List <Lebi_User_Product>();
            for (int i = 0; i < Shops.Count; i++)
            {
                Shops[i]             = SetMoneyAndPoint(CurrentUser, CurrentUserLevel, Shops[i]);
                Weight              += Shops[i].Weight;
                Volume              += Shops[i].Volume;
                Money_Product       += Shops[i].Money_Product;
                Money_Product_begin += Shops[i].Money_Product_begin;
                Money_Property      += Shops[i].Money_Property;
                Money_Cut           += Shops[i].Money_Cut;
                Money_Give          += Shops[i].Money_Give;
                Money_Market        += Shops[i].Money_Market;
                Count         += Shops[i].Count;
                Point         += Shops[i].Point;
                Point_Buy     += Shops[i].Point_Buy;
                Point_Product += Shops[i].Point_Product;
                Point_Free    += Shops[i].Point_Free;
                FreeProducts.AddRange(Shops[i].FreeProducts);
                PromotionTypes.AddRange(Shops[i].PromotionTypes);
                Products.AddRange(Shops[i].Products);
            }
            //<-{退税计算  by lebi.kingdge 2015-08-22
            decimal Refund_MinMoney = 0;
            decimal Refund_VAT      = 0;

            decimal.TryParse(SYS.Refund_MinMoney, out Refund_MinMoney);
            decimal.TryParse(SYS.Refund_VAT, out Refund_VAT);
            if (Refund_MinMoney > 0)
            {
                if ((Money_Product - Money_Product_NOVAT) > Refund_MinMoney)
                {
                    Money_Refund_VAT = (Money_Product - Money_Product_NOVAT) * Refund_VAT / 100;
                    Money_Refund_Fee = Refund_Fee(SYS.Refund_StepR, Money_Refund_VAT, Money_Product - Money_Product_NOVAT);
                    Money_Refund     = Money_Refund_VAT - Money_Refund_Fee;
                }
                else
                {
                    Money_Refund     = 0;
                    Money_Refund_VAT = 0;
                    Money_Refund_Fee = 0;
                }
                //循环品牌计算各品牌退税
                if (Refund_VAT > 0)
                {
                    foreach (string bran in brandstring)
                    {
                        string[]   arr   = bran.Split(':');
                        Lebi_Brand brand = B_Lebi_Brand.GetModel("id=" + arr[0] + " and IsVAT = 1");
                        if (brand != null)
                        {
                            decimal Brand_Money_Product            = 0;
                            decimal OtherSite_Money_Refund_VAT     = 0;
                            decimal OtherSite_Money_Refund_Fee     = 0;
                            List <Lebi_User_Product> user_products = (from m in Products where ("," + arr[1] + ",").Contains("," + m.Product_id + ",") select m).ToList();
                            foreach (Lebi_User_Product user_product in user_products)
                            {
                                Brand_Money_Product += user_product.Product_Price * user_product.count;
                            }
                            if (Brand_Money_Product >= Refund_MinMoney)
                            {
                                OtherSite_Money_Refund_VAT = Brand_Money_Product * Refund_VAT / 100;
                                OtherSite_Money_Refund_Fee = Refund_Fee(SYS.Refund_StepR, OtherSite_Money_Refund_VAT, Brand_Money_Product);
                                OtherSite_Money_Refund    += OtherSite_Money_Refund_VAT - OtherSite_Money_Refund_Fee;
                            }
                        }
                    }
                }
            }
            //}->
            //<-{税金计算  by lebi.kingdge 2017-02-17
            decimal TaxRate = 0;

            decimal.TryParse(SYS.TaxRate, out TaxRate);
            if (TaxRate > 0)
            {
                Money_Tax = Money_Product * TaxRate / 100;
            }
            //}->
        }
Exemplo n.º 7
0
        /// <summary>
        /// 计算促销活动
        /// </summary>
        /// <param name="Products">商品信息</param>
        /// <param name="CurrentUser">购买者</param>
        /// <param name="shop">供应商,为空表示自营商品</param>
        /// <param name="basketshop"></param>
        public static BasketShop SetMoneyAndPoint(Lebi_User CurrentUser, Lebi_UserLevel CurrentUserLevel, BasketShop basketshop)
        {
            string  pids = "0";
            decimal Money_Product_begin = 0;
            int     Count  = 0;
            decimal Weight = 0; //订单总重量
            decimal Volume = 0; //订单总体积

            int     Money_Transport_One = 0;
            bool    IsTransportPriceOne = false;
            decimal Money_Market        = 0;
            decimal Money_Cut           = 0;
            decimal Money_Give          = 0;
            decimal Point_Free          = 0; //赠送积分
            decimal Point_Product       = 0; //商品获得的积分
            decimal Point          = 0;      //获得的积分总数
            decimal Point_Buy      = 0;      //积分换购所需积分
            decimal Money_Product  = 0;
            decimal Money_Property = 0;
            List <Lebi_User_Product>   FreeProducts   = new List <Lebi_User_Product>();
            List <Lebi_Promotion_Type> PromotionTypes = new List <Lebi_Promotion_Type>();

            if (CurrentUserLevel == null)
            {
                CurrentUserLevel = B_Lebi_UserLevel.GetModel(CurrentUser.UserLevel_id);
            }
            List <Lebi_User_Product> Products = basketshop.Products;
            Lebi_Supplier            shop     = basketshop.Shop;

            foreach (Lebi_User_Product pro in Products)
            {
                Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id);
                if (product == null)
                {
                    continue;
                }
                pro.Discount   = 100;
                pro.Pointagain = 1;
                //pro.Product_Price = EX_Product.ProductPrice(product, CurrentUserLevel,pro.count);//单价
                if (CurrentUserLevel.MoneyToPoint > 0)
                {
                    pro.Product_Point = pro.Product_Price * CurrentUserLevel.MoneyToPoint + pro.Product_Point;//单个产品可得的积分
                }
                pids += "," + pro.Product_id;
                Money_Product_begin = Math.Round(Money_Product_begin + pro.Product_Price * pro.count, 2);
                Count          = Count + pro.count;
                Money_Market   = Money_Market + EX_Product.ProductMarketPrice(product) * pro.count; //兼容分销  2018.3.8 by lebi.kingdge
                Money_Property = Money_Property + pro.ProPerty_Price * pro.count;
                Money_Product  = Money_Product + pro.Product_Price * pro.count;
                Weight         = Weight + product.Weight * pro.count;
                Volume         = Volume + product.VolumeH * product.VolumeL * product.VolumeW * pro.count;
                Point_Product  = Point_Product + Math.Round(pro.Product_Point * pro.count, 2);
                Point          = Point_Product + Point_Free;
                //320一般商品321限时抢购322团购323积分换购
                if (product.Type_id_ProductType == 323 && product.Time_Expired > System.DateTime.Now)
                {
                    Point_Buy = Point_Buy + product.Price_Sale * pro.count;
                }
            }

            List <Lebi_Promotion_Type> cps = Promotion.CurrentPromotionType();

            if (shop == null)
            {
                shop = new Lebi_Supplier();
            }
            foreach (Lebi_Promotion_Type cp in cps)
            {
                //检查是否商铺单独促销
                if (cp.Type_id_PromotionType == 421)
                {
                    if (shop.id > 0)
                    {
                        continue;
                    }
                }
                if (cp.Type_id_PromotionType == 422)
                {
                    if (shop.id != cp.Supplier_id)
                    {
                        continue;
                    }
                }
                //检查会员组别
                if (!("," + cp.UserLevel_ids + ",").Contains("," + CurrentUserLevel.id + ","))
                {
                    continue;
                }

                bool flag = true;
                string where = "1=1";
                List <Lebi_User_Product> sps = null;
                foreach (Lebi_Promotion p in Promotion.GetPromotion(cp.id))//只匹配一个条件
                {
                    flag = true;
                    if (p.Case804 == "")
                    {
                        p.Case804 = "0";
                    }
                    if (p.Case805 == "")
                    {
                        p.Case805 = "0";
                    }
                    //验证订单金额:801
                    if (p.IsCase801 == 1)
                    {
                        if (Money_Product_begin < p.Case801)
                        {
                            flag = false;
                            continue;
                        }
                    }
                    //验证订单商品数量:802

                    if (p.IsCase802 == 1)
                    {
                        if (Count < p.Case802)
                        {
                            flag = false;
                            continue;
                        }
                    }
                    //验证商品分类:804
                    if (p.IsCase804 == 1)
                    {
                        where += " and Pro_Type_id in (" + p.Case804 + ")";
                        if (B_Lebi_Product.Counts("id in (" + pids + ") and Pro_Type_id in (" + p.Case804 + ")") == 0)
                        {
                            flag = false;
                            continue;
                        }
                    }
                    //验证限制商品:805
                    if (p.IsCase805 == 1)
                    {
                        where += "and id in (" + p.Case805 + ")";
                        if (B_Lebi_Product.Counts("id in (" + pids + ") and id in (" + p.Case805 + ")") == 0)
                        {
                            flag = false;
                            continue;
                        }
                    }
                    //验证单品数量:803
                    if (p.IsCase803 == 1)
                    {
                        string tids = "0";
                        //取出购物车中,数量大于水平线的商品
                        foreach (Lebi_User_Product up in Products)
                        {
                            if (up.count >= p.Case803)
                            {
                                tids += "," + up.Product_id;
                            }
                        }
                        if (tids == "0")
                        {
                            flag = false;
                            continue;
                        }
                        where += " and id in (" + tids + ")";
                        if (B_Lebi_Product.Counts(where) == 0)
                        {
                            flag = false;
                            continue;
                        }
                    }
                    //验证订单内指定商品数量:806
                    if (p.IsCase806 == 1)
                    {
                        if (p.Case804 == "" && p.Case805 == "")//未设置限制条件的话,直接失败
                        {
                            flag = false;
                            continue;
                        }
                        int count = 0;
                        //计算购物车中包含商品的总数
                        foreach (Lebi_User_Product up in Products)
                        {
                            if (("," + p.Case804 + ",").Contains("," + up.Pro_Type_id + ",") || ("," + p.Case805 + ",").Contains("," + up.Product_id + ","))
                            {
                                count = count + up.count;
                            }
                        }
                        if (count < p.Case806)
                        {
                            flag = false;
                            continue;
                        }
                    }
                    //条件检查结束
                    if (flag)
                    {
                        //取出验证成功的指定商品
                        sps = B_Lebi_User_Product.GetList("User_id=" + CurrentUser.id + " and type_id_UserProductType=142 and Product_id in (select id from [Lebi_Product] where " + where + ")", "");

                        //计算定额运费901
                        if (p.IsRule901 == 1)
                        {
                            Money_Transport_One = p.Rule901;
                            IsTransportPriceOne = true;
                        }
                        //计算折扣902
                        if (p.IsRule902 == 1)
                        {
                            foreach (Lebi_User_Product pro in Products)
                            {
                                pro.Discount = pro.Discount * p.Rule902 / 100;
                            }
                        }
                        //计算指定商品折扣903
                        if (p.IsRule903 == 1)
                        {
                            if (sps != null)
                            {
                                foreach (Lebi_User_Product pro in Products)
                                {
                                    foreach (Lebi_User_Product sp in sps)
                                    {
                                        if (pro.id == sp.id)
                                        {
                                            pro.Discount = pro.Discount * p.Rule903 / 100;
                                        }
                                    }
                                }
                            }
                        }
                        //计算减免金额904
                        if (p.IsRule904 == 1)
                        {
                            Money_Cut = p.Rule904;
                        }
                        //计算返还金额905
                        if (p.IsRule905 == 1)
                        {
                            Money_Give = p.Rule905;
                        }
                        //计算赠送积分906
                        if (p.IsRule906 == 1)
                        {
                            Point_Free = p.Rule906;
                        }
                        //计算翻倍积分907
                        if (p.IsRule907 == 1)
                        {
                            foreach (Lebi_User_Product pro in Products)
                            {
                                pro.Pointagain = pro.Pointagain + p.Rule907;
                            }
                        }
                        //计算指定商品折扣翻倍积分908
                        if (p.IsRule908 == 1)
                        {
                            if (sps != null)
                            {
                                foreach (Lebi_User_Product pro in Products)
                                {
                                    foreach (Lebi_User_Product sp in sps)
                                    {
                                        if (pro.id == sp.id)
                                        {
                                            pro.Pointagain = pro.Pointagain + p.Rule908;
                                        }
                                    }
                                }
                            }
                        }
                        //赠送商品909
                        if (p.IsRule909 == 1)
                        {
                            //暂时不做
                        }
                        //赠送指定商品910
                        if (p.IsRule910 == 1)
                        {
                            if (sps != null)
                            {
                                foreach (Lebi_User_Product sp in sps)
                                {
                                    sp.count         = p.Rule910;
                                    sp.Product_Price = 0;
                                    sp.Product_Point = 0;
                                    sp.Pointagain    = 0;
                                    sp.Discount      = 0;
                                    FreeProducts.Add(sp);
                                }
                            }
                        }
                        //第N个指定商品打折
                        if (p.IsRule912 == 1 && p.IsCase803 == 1 && p.Case803 > 0)
                        {
                            foreach (Lebi_User_Product pro in Products)
                            {
                                foreach (Lebi_User_Product sp in sps)
                                {
                                    if (pro.id == sp.id)
                                    {
                                        if (pro.count > p.Case803)
                                        {
                                            int n = sp.count / p.Case803;
                                            Money_Cut = Money_Cut + pro.Product_Price * (100 - p.Rule912) / 100 * n;
                                        }
                                    }
                                }
                            }
                        }
                        //重新计算价格积分,

                        Money_Product = 0;
                        Point_Product = 0;
                        Point         = 0;
                        foreach (Lebi_User_Product pro in Products)
                        {
                            Money_Product += Math.Round(pro.Product_Price * pro.count * pro.Discount / 100, 2);
                            Point_Product += Math.Round(pro.Product_Point * pro.count * pro.Pointagain);
                            Point          = Point_Product + Point_Free;
                        }

                        break;//验证成功不再验证
                    }
                }
                if (flag)
                {
                    PromotionTypes.Add(cp);
                }
            }
            basketshop = new BasketShop();
            basketshop.FreeProducts        = FreeProducts;
            basketshop.Money_Cut           = Money_Cut;
            basketshop.Money_Give          = Money_Give;
            basketshop.Money_Market        = Money_Market;
            basketshop.Money_Product       = Money_Product;
            basketshop.Money_Product_begin = Money_Product_begin;
            basketshop.Money_Transport     = 0;
            basketshop.Point               = Point;
            basketshop.Point_Free          = Point_Free;
            basketshop.Point_Buy           = Point_Buy;
            basketshop.Point_Product       = Point_Product;
            basketshop.Products            = Products;
            basketshop.PromotionTypes      = PromotionTypes;
            basketshop.Shop                = shop;
            basketshop.Volume              = Volume;
            basketshop.Weight              = Weight;
            basketshop.IsTransportPriceOne = IsTransportPriceOne;
            basketshop.Money_Transport_One = Money_Transport_One;
            basketshop.Count               = Count;
            basketshop.Money_Property      = Money_Property;
            return(basketshop);
        }
Exemplo n.º 8
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = Rint_Para("0");    //商品分类
            pid       = Rint_Para("1");    //品牌
            cid       = Rstring_Para("2"); //属性
            list      = Rstring_Para("3"); //列表或网格
            sort      = Rstring_Para("4"); //排序
            tid       = Rint_Para("5");    //商品标签
            transport = Rint_Para("7");    //配送 0全部 1商城 2商家
            stock     = Rint_Para("8");    //是否有库存 1只显示有货
            pageindex = RequestTool.RequestInt("page", 1);
            pro_type  = B_Lebi_Pro_Type.GetModel(id);
            if (pro_type == null)
            {
                pro_type = new Lebi_Pro_Type();
            }
            if (Lang(pro_type.Url) != "")  //如果存在自定义URL 跳转至自定义URL by kingdge 2014-10-30
            {
                Response.Redirect(Lang(pro_type.Url));
                Response.End();
                return;
            }
            property = EX_Product.ProductType_ProPerty(pro_type);
            if (property == null)
            {
                property = new Lebi_Pro_Type(); property.ProPerty132 = "0";
            }
            if (property.ProPerty132 == "")
            {
                property.ProPerty132 = "0";
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (pro_type.id > 0)
            {
                CategoryPath = Categorypath(id);
                for (int i = 0; i <= CategoryPath.GetUpperBound(0); i++)
                {
                    path += "<a href=\"" + URL("P_ProductCategory", "" + CategoryPath[i, 0] + "", CategoryPath[i, 2]) + "\"><span>" + CategoryPath[i, 1] + "</span></a>";
                    if (i < CategoryPath.GetUpperBound(0))
                    {
                        path += "<em>&raquo;</em>";
                    }
                }
            }
            else if (tid == 0)
            {
                path += "<a href=\"" + URL("P_ProductCategory", "0") + "\"><span>" + Tag("商品列表") + "</span></a>";
            }
            if (tid > 0)
            {
                tag   = B_Lebi_Pro_Tag.GetModel(tid);
                path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + ",$,$,$,$," + tid + "") + "\"><span>" + Lang(tag.Name) + "</span></a>";
            }
            where = ProductWhere + " and Type_id_ProductType <> 323";
            if (pid > 0)
            {
                where += " and Brand_id=" + pid + "";
                brand  = B_Lebi_Brand.GetModel(pid);
                path  += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + ",$,$,$,$") + "\"><span>" + Lang(brand.Name) + "</span></a>";
            }
            if (cid != "")
            {
                where += " and " + Categorywhere(cid);
                string _cidlast = "";
                if (cid.IndexOf("$") > -1)
                {
                    string[] cidarr = cid.Split('$');
                    for (int i = 0; i < cidarr.Count(); i++)
                    {
                        if (cidarr[i].IndexOf("|") > -1)
                        {
                            string[] _cids = cidarr[i].Split('|');
                            _cidlast = _cids[1];
                            Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast));
                            if (ProPerty != null)
                            {
                                path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + "," + ProPerty.parentid + "|" + ProPerty.id + ",$,$,$") + "\"><span>" + Lang(ProPerty.Name) + "</span></a>";
                            }
                        }
                    }
                }
                else
                {
                    if (cid.IndexOf("|") > -1)
                    {
                        string[] _cids = cid.Split('|');
                        _cidlast = _cids[1];
                        Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast));
                        if (ProPerty != null)
                        {
                            path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + "," + ProPerty.parentid + "|" + ProPerty.id + ",$,$,$") + "\"><span>" + Lang(ProPerty.Name) + "</span></a>";
                        }
                    }
                }
            }
            if (id > 0)
            {
                where += " and " + CategoryWhere(id);
                //where += " and (Pro_Type_id in (" + Categorywhereforid(id) + ")";
                //if (DataBase.DBType == "sqlserver")
                //{
                //    where += " or Charindex('," + id + ",',','+Pro_Type_id_other+',')>0)";
                //}
                //if (DataBase.DBType == "access")
                //{
                //    where += " or Instr(','+Pro_Type_id_other+',','," + id + ",')>0)";
                //}
            }
            if (tid > 0)
            {
                if (DataBase.DBType == "sqlserver")
                {
                    where += " and Charindex('," + tid + ",',','+Pro_Tag_id+',')>0";
                }
                if (DataBase.DBType == "access")
                {
                    where += " and Instr(','+Pro_Tag_id+',','," + tid + ",')>0";
                }
            }
            if (transport == 1)
            {
                where += " and IsSupplierTransport  = 0";
            }
            else if (transport == 2)
            {
                where += " and IsSupplierTransport  = 1";
            }
            if (stock == 1)
            {
                where += " and Count_Stock > 0";
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else if (sort == "6")
            {
                order = " Count_Stock desc"; ordertmp = "a";
            }
            else if (sort == "6a")
            {
                order = " Count_Stock asc"; ordertmp = "";
            }
            else
            {
                order = " Sort desc,id desc"; ordertmp = "";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);
            //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6}
            string url = URL("P_ProductCategory", id + "," + pid + "," + cid + "," + list + "," + sort + "," + tid + ",{0}," + transport + "," + stock + "", Lang(pro_type.Url));

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
        }
Exemplo n.º 9
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_LimitBuy'");
            list        = Rstring_Para("0");
            sort        = Rstring_Para("1");
            pageindex   = RequestTool.RequestInt("page", 1);
            path        = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a class=\"text\"><span>" + Tag("限时抢购") + "</span></a>";
            where       = "Type_id_ProductStatus = 101 and Type_id_ProductType = 321 and Product_id=0";
            if (sort == "1")
            {
                order = " Count_Sales desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else if (sort == "6")
            {
                order = " Count_Stock desc"; ordertmp = "a";
            }
            else if (sort == "6a")
            {
                order = " Count_Stock asc"; ordertmp = "";
            }
            else
            {
                order = " Count_Sales desc"; ordertmp = "a";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple("?page={0}&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage);
        }
Exemplo n.º 10
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            pcode = "P_ShopProducts";
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = Rint_Para("0");    //商家ID
            cid       = Rint_Para("1");    //商品分类
            list      = Rstring_Para("2"); //列表或网格
            sort      = Rstring_Para("3"); //排序
            key       = Rstring_Para("5"); //关键词
            pageindex = RequestTool.RequestInt("page", 1);
            parentcid = 0;
            supplier  = B_Lebi_Supplier.GetModel("id = " + id);
            if (supplier == null)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            int Supplier_id = supplier.User_id;

            if (cid != 0)
            {
                producttype = B_Lebi_Supplier_ProductType.GetModel(cid);
                if (producttype.parentid > 0)
                {
                    parentcid = producttype.parentid;
                }
                else
                {
                    parentcid = cid;
                }
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_ShopIndex", id) + "\"><span>" + Lang(supplier.Name) + "</span></a>";
            if (key != "")
            {
                path += " > " + key;
            }

            where = "Type_id_ProductStatus = 101 and Product_id=0 and Supplier_id = " + id + "";
            if (cid > 0)
            {
                if (DataBase.DBType == "sqlserver")
                {
                    where += " and Charindex('," + cid + ",',','+Supplier_ProductType_ids+',')>0";
                }
                if (DataBase.DBType == "access")
                {
                    where += " and Instr(','+Supplier_ProductType_ids+',','," + cid + ",')>0";
                }
            }
            if (key != "")
            {
                where += " and Name like '%" + key + "%'";
            }
            if (sort == "")
            {
                sort = "1";
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);
            //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6}
            string url = URL("P_ShopProducts", id + "," + cid + "," + list + "," + sort + ",{0}," + key + "");

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
            string supplierservicepannelcon = supplier.ServicePanel;

            supplierservicepannel = B_ServicePanel.GetModel(supplierservicepannelcon);

            headcontent = supplier.head;
            longbar     = supplier.longbar;
            shortbar    = supplier.shortbar;
        }
Exemplo n.º 11
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Brand'");
            id          = Rint_Para("0");
            cid         = Rstring_Para("1");
            list        = Rstring_Para("2");
            sort        = Rstring_Para("3");
            pageindex   = RequestTool.RequestInt("page", 1);
            brand       = B_Lebi_Brand.GetModel(id);
            if (brand == null)
            {
                Response.Redirect(URL("P_BrandList", ""));
                Response.End();
            }
            path  = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_BrandList", "") + "\"><span>" + Tag("品牌列表") + "</span></a><em>&raquo;</em><a class=\"text\"><span>" + Lang(brand.Name) + "</span></a>";
            where = "Type_id_ProductStatus = 101 and Product_id=0 and Type_id_ProductType <> 323";
            if (id > 0)
            {
                where += " and Brand_id = " + id + "";
            }
            if (cid != "")
            {
                where += " and " + Categorywhere(cid);
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else if (sort == "6")
            {
                order = " Count_Stock desc"; ordertmp = "a";
            }
            else if (sort == "6a")
            {
                order = " Count_Stock asc"; ordertmp = "";
            }
            else
            {
                order = " Sort desc,id desc"; ordertmp = "";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple("?page={0}&id=" + id + "&cid=" + cid + "&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&id=" + id + "&cid=" + cid + "&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage);
        }
Exemplo n.º 12
0
        public string Get_guigeforwap(Lebi_Product model)
        {
            string res = "";

            if (model.ProPerty134 != "")
            {
                List <Lebi_ProPerty> ps134 = B_Lebi_ProPerty.GetList("id in (" + model.ProPerty134 + ")", "Sort desc");
                string Msige = Language.DefaultCurrency().Msige;
                if (ps134.Count > 0)
                {
                    foreach (Lebi_ProPerty p in ps134)
                    {
                        res += "<dd class=\"clearfix\"><em>" + Lang(p.Name) + ":</em><em><input type=\"hidden\" name=\"Property134\" propertyid=\"" + p.id + "\" value=\"" + Lang(p.Name) + Msige + p.Price + ":\" />";
                        List <Lebi_ProPerty> ps134list = B_Lebi_ProPerty.GetList("parentid = " + p.id + "", "Sort desc");
                        if (ps134list.Count > 0)
                        {
                            res += "<select id=\"Property134_" + p.id + "\" >";
                            foreach (Lebi_ProPerty pl in ps134list)
                            {
                                if (pl.Price > 0)
                                {
                                    res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + Msige + pl.Price + "\">" + Lang(pl.Name) + " " + Msige + pl.Price + "</option>";
                                }
                                else
                                {
                                    res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + "\">" + Lang(pl.Name) + "</option>";
                                }
                            }
                            res += "</select>";
                        }
                        else
                        {
                            res += "<input type=\"text\" id=\"Property134_" + p.id + "\" class=\"input\" value=\"\" />";
                        }
                        res += "</em></dd>";
                    }
                }
            }
            List <ProductProperty> rmodels = new List <ProductProperty>();

            if (model.Product_id == 0)
            {
                //无同款子商品
                return(res);
            }
            List <Lebi_Product> pros = B_Lebi_Product.GetList("Product_id=" + model.Product_id + "", "");

            if (pros.Count == 0)
            {
                return(res);
            }
            Lebi_Product pmodel = B_Lebi_Product.GetModel(model.Product_id);

            if (pmodel == null)
            {
                return(res);
            }
            string property = EX_Product.ProductType_ProPertystr(model.Pro_Type_id, 131);

            if (property == "")
            {
                return(res);
            }
            List <Lebi_ProPerty> pps = B_Lebi_ProPerty.GetList("id in (" + property + ")", "Sort desc");
            List <Lebi_ProPerty> ps  = B_Lebi_ProPerty.GetList("parentid in (" + property + ")", "Sort desc");
            //分析当前商品的规格
            //将当前商品的规格与主父规格进行对应
            List <Lebi_ProPerty> Currentpps = new List <Lebi_ProPerty>();//保存当前商品的父规则值

            string[] temps = model.ProPerty131.Split(',');
            foreach (string k in temps)
            {
                Lebi_ProPerty p = (from m in ps
                                   where m.id == Convert.ToInt32(k)
                                   select m).ToList().FirstOrDefault();
                if (p != null)
                {
                    Lebi_ProPerty kv = (from m in pps
                                        where m.id == p.parentid
                                        select m).ToList().FirstOrDefault();
                    kv.Sort = p.id;//临时征用排序字段,存放规格
                    Currentpps.Add(kv);
                }
            }
            foreach (Lebi_ProPerty pp in Currentpps)
            {
                List <Lebi_ProPerty> cps = (from m in ps
                                            where m.parentid == pp.id
                                            select m).ToList();
                if (cps.Count == 0)
                {
                    continue;
                }


                res += "<dd class=\"cartOption\"><em>" + Lang(pp.Name) + ":</em><em><select name=\"select_same_goods_\" onChange=\"window.location=$(this).val();\">";

                foreach (Lebi_ProPerty p in cps)
                {
                    //计算对应的商品
                    string       propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ",");
                    Lebi_Product pro         = (from m in pros
                                                where ("," + m.ProPerty131 + ",") == propertystr
                                                select m).ToList().FirstOrDefault();
                    if (pro == null)
                    {
                        continue;
                    }
                    if (pp.Sort == p.id)
                    {
                        res += " <option value=\"" + URL("P_Product", pro.id) + "\" selected>" + Lang(p.Name) + "</option>";
                    }
                    else
                    {
                        res += " <option value=\"" + URL("P_Product", pro.id) + "\">" + Lang(p.Name) + "</option>";
                    }
                }

                res += "</select></em><em></em></dd>";
            }
            return(res);
        }
Exemplo n.º 13
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Product'");
            int id = Rint_Para("0");

            product = GetProduct(id);
            if (product.id == 0)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            int num = 0;

            if (SYS.ClickFlag == "0")
            {
                int.TryParse(SYS.ClickNum1, out num);
                product.Count_Views_Show = product.Count_Views_Show + num;
            }
            else
            {
                int.TryParse(SYS.ClickNum2, out num);
                Random r = new Random();
                int    c = r.Next(1, num);
                product.Count_Views_Show = product.Count_Views_Show + c;
            }
            product.Count_Views = product.Count_Views + 1;
            B_Lebi_Product.Update(product);
            Protype = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id);
            images  = EX_Product.ProductImages(product, CurrentTheme);
            //===============================================================
            //处理规格选项
            //ProductProperty = Get_guige(product);
            //处理规格选项结束
            //==================================================================


            //添加访问记录
            int Product_id = product.Product_id == 0 ? product.id : product.Product_id;

            EX_User.UserProduct_Edit(CurrentUser, Product_id, 0, 143, "", 0, "");
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (product.Type_id_ProductType == 321)
            {
                path += "<a href=\"" + URL("P_LimitBuy", "") + "\"><span>" + Tag("限时抢购") + "</span></a><em>&raquo;</em>";
            }
            else if (product.Type_id_ProductType == 322)
            {
                path += "<a href=\"" + URL("P_GroupPurchase", "") + "\"><span>" + Tag("团购") + "</span></a><em>&raquo;</em>";
            }
            else if (product.Type_id_ProductType == 323)
            {
                path += "<a href=\"" + URL("P_Exchange", "") + "\"><span>" + Tag("积分换购") + "</span></a><em>&raquo;</em>";
            }
            else
            {
                if (Protype != null)
                {
                    string[,] parr = Categorypath(Protype.id);
                    for (int i = 0; i <= parr.GetUpperBound(0); i++)
                    {
                        path += "<a href=\"" + URL("P_ProductCategory", "" + parr[i, 0] + "") + "\"><span>" + parr[i, 1] + "</span></a><em>&raquo;</em>";
                    }
                }
            }
            path += "<a href=\"" + URL("P_Product", id) + "\"><span>" + Lang(product.Name) + "</span></a>";


            GetProWords();
            ProductStar = Convert.ToInt32(product.Star_Comment);
            if (ProductStar > 5)
            {
                ProductStar = 5;
            }
            if (ProductStar < 0)
            {
                ProductStar = 0;
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 生成规格选项
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Get_guige(Lebi_Product model)
        {
            string res = "";

            if (model.ProPerty134 != "")
            {
                List <Lebi_ProPerty> ps134 = B_Lebi_ProPerty.GetList("id in (" + model.ProPerty134 + ")", "Sort desc");
                string Msige = Language.DefaultCurrency().Msige;
                foreach (Lebi_ProPerty p in ps134)
                {
                    res += "<dl class=\"clearfix\"><dt>" + Lang(p.Name) + ":</dt><dd><input type=\"hidden\" name=\"Property134\" propertyid=\"" + p.id + "\" value=\"" + Lang(p.Name) + "\" />";
                    List <Lebi_ProPerty> ps134list = B_Lebi_ProPerty.GetList("parentid = " + p.id + "", "Sort desc");
                    if (ps134list.Count > 0)
                    {
                        Lebi_ProPerty ps134listfirst = ps134list.FirstOrDefault();
                        res += "<select id=\"Property134_" + p.id + "\">";
                        foreach (Lebi_ProPerty pl in ps134list)
                        {
                            if (pl.Price > 0)
                            {
                                res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + Msige + pl.Price + "\">" + Lang(pl.Name) + " " + Msige + pl.Price + "</option>";
                            }
                            else
                            {
                                res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + "\">" + Lang(pl.Name) + "</option>";
                            }
                        }
                        res += "</select>";
                    }
                    else
                    {
                        res += "<input type=\"text\" id=\"Property134_" + p.id + "\" class=\"input\" value=\"\" />";
                    }
                    res += "</dd></dl>";
                }
            }
            List <ProductProperty> rmodels = new List <ProductProperty>();

            if (model.Product_id == 0)
            {
                //无同款子商品
                return(res);
            }
            List <Lebi_Product> pros = B_Lebi_Product.GetList("Product_id=" + model.Product_id + "", "");

            if (pros.Count == 0)
            {
                return(res);
            }
            Lebi_Product pmodel = B_Lebi_Product.GetModel(model.Product_id);

            if (pmodel == null)
            {
                return(res);
            }
            string property = EX_Product.ProductType_ProPertystr(model.Pro_Type_id, 131);

            if (property == "")
            {
                return(res);
            }
            List <Lebi_ProPerty> pps = B_Lebi_ProPerty.GetList("id in (" + property + ")", "Sort desc");
            List <Lebi_ProPerty> ps  = B_Lebi_ProPerty.GetList("parentid in (" + property + ")", "Sort desc");
            //分析当前商品的规格
            //将当前商品的规格与主父规格进行对应
            List <Lebi_ProPerty> Currentpps = new List <Lebi_ProPerty>();//保存当时商品的父规则值

            string[] temps = model.ProPerty131.Split(',');
            foreach (string k in temps)
            {
                Lebi_ProPerty p = (from m in ps
                                   where m.id == Convert.ToInt32(k)
                                   select m).ToList().FirstOrDefault();
                if (p != null)
                {
                    Lebi_ProPerty kv = (from m in pps
                                        where m.id == p.parentid
                                        select m).ToList().FirstOrDefault();
                    kv.Sort = p.id;//临时征用排序字段,存放规格
                    Currentpps.Add(kv);
                }
            }
            foreach (Lebi_ProPerty pp in Currentpps)
            {
                List <Lebi_ProPerty> cps = (from m in ps
                                            where m.parentid == pp.id
                                            select m).ToList();
                if (cps.Count == 0)
                {
                    continue;
                }
                if (pp.id == model.ProPertyMain)
                {
                    res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>";
                    foreach (Lebi_ProPerty p in cps)
                    {
                        //计算对应的商品
                        string       propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ",");
                        Lebi_Product pro         = (from m in pros
                                                    where ("," + m.ProPerty131 + ",") == propertystr
                                                    select m).ToList().FirstOrDefault();
                        if (pro == null)
                        {
                            continue;
                        }
                        if (pro.Type_id_ProductStatus == 100 || EX_Product.ProductStock(pro) < 1)//下架 无库存
                        {
                            if (pp.Sort == p.id)
                            {
                                res += "<div><a class=\"spva-imgonout\"><img src=\"" + WebPath + model.ImageSmall + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>";
                            }
                            else
                            {
                                res += "<div><a class=\"spva-imgout\" href=\"" + URL("P_Product", pro.id) + "\"><img src=\"" + WebPath + pro.ImageSmall + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>";
                            }
                            continue;
                        }
                        if (pp.Sort == p.id)
                        {
                            res += "<div><a class=\"spva-imgon\" href=\"" + URL("P_Product", model.id) + "\"><img src=\"" + WebPath + model.ImageSmall + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>";
                        }
                        else
                        {
                            res += "<div><a class=\"spva-img\" href=\"" + URL("P_Product", pro.id) + "\"><img src=\"" + WebPath + pro.ImageSmall + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>";
                        }
                    }
                }
                else
                {
                    if (cps.FirstOrDefault().ImageUrl == "")
                    {
                        res += "<dl class=\"choose-text clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>";
                    }
                    else
                    {
                        res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>";
                    }
                    foreach (Lebi_ProPerty p in cps)
                    {
                        //计算对应的商品
                        string       propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ",");
                        Lebi_Product pro         = (from m in pros
                                                    where ("," + m.ProPerty131 + ",") == propertystr
                                                    select m).ToList().FirstOrDefault();
                        if (pro == null)
                        {
                            continue;
                        }
                        string tt     = "";
                        string aclass = "";
                        if (p.ImageUrl == "")
                        {
                            tt = Lang(p.Name);
                        }
                        else
                        {
                            tt = "<img src=\"" + p.ImageUrl + "\" width=\"50\"\" />";
                        }

                        if (pro.Type_id_ProductStatus == 100 || EX_Product.ProductStock(pro) < 1)//下架 无库存
                        {
                            if (pp.Sort == p.id)
                            {
                                if (cps.FirstOrDefault().ImageUrl == "")
                                {
                                    aclass = "spvaonout";
                                }
                                else
                                {
                                    aclass = "spva-imgonout";
                                }
                                res += "<div><a class=\"" + aclass + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>";
                            }
                            else
                            {
                                if (cps.FirstOrDefault().ImageUrl == "")
                                {
                                    aclass = "spvaout";
                                }
                                else
                                {
                                    aclass = "spva-imgout";
                                }
                                res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", pro.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>";
                            }
                            continue;
                        }

                        if (pp.Sort == p.id)
                        {
                            if (cps.FirstOrDefault().ImageUrl == "")
                            {
                                aclass = "spvaon";
                            }
                            else
                            {
                                aclass = "spva-imgon";
                            }
                            res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", model.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>";
                        }
                        else
                        {
                            if (cps.FirstOrDefault().ImageUrl == "")
                            {
                                aclass = "spva";
                            }
                            else
                            {
                                aclass = "spva-img";
                            }
                            res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", pro.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>";
                        }
                    }
                }

                res += "</dd></dl>";
            }
            return(res);
        }