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; } //}-> }
public override string ThemePageMeta(string code, string tag) { string str = ""; string Page_Title = ""; string Page_Keywords = ""; if (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) { Page_Title += Lang(ProPerty.Name) + " - "; Page_Keywords += Lang(ProPerty.Name) + ","; } } } } 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) { Page_Title += Lang(ProPerty.Name) + " - "; Page_Keywords += Lang(ProPerty.Name) + ","; } } } } if (pid > 0) { Lebi_Brand brand = B_Lebi_Brand.GetModel(pid); Page_Title += Lang(brand.Name) + " - "; Page_Keywords += Lang(brand.Name) + ","; } if (pro_type.id > 0) { string[,] parr = Categorypath(id); for (int i = parr.GetUpperBound(0); i >= 0; i--) { Page_Title += parr[i, 1]; Page_Keywords += parr[i, 1]; if (i < parr.GetUpperBound(0)) { Page_Title += " - "; Page_Keywords += ","; } } } if (tid > 0) { Lebi_Pro_Tag Tag = B_Lebi_Pro_Tag.GetModel(tid); Page_Title += Lang(Tag.Name) + " - "; } switch (tag.ToLower()) { case "description": if (Lang(pro_type.SEO_Description) == "") { str = Page_Keywords; } else { str = Lang(pro_type.SEO_Description) + ","; } break; case "keywords": if (Lang(pro_type.SEO_Keywords) == "") { str = Page_Keywords; } else { str = Lang(pro_type.SEO_Keywords) + ","; } break; default: if (Lang(pro_type.SEO_Title) == "") { str = Page_Title; } else { str = Lang(pro_type.SEO_Title); } break; } return(ThemePageMeta(code, tag, str)); }
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\">»</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>»</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>»</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>»</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>»</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>»</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); }
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\">»</em><a href=\"" + URL("P_BrandList", "") + "\"><span>" + Tag("品牌列表") + "</span></a><em>»</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); }