public static Mall_ProductDetail[] GetMall_ProductDetailPriceList(Mall_ProductDetail[] list)
        {
            if (list.Length > 0)
            {
                var        tag_list              = Mall_Tag.GetMall_Tags().ToArray();
                List <int> ProductIDList         = list.Select(p => p.ID).ToList();
                var        variant_list          = Mall_Product_VariantDetail.GetMall_Product_VariantDetailListByProductIDList(ProductIDList);
                var        product_tag_list      = Mall_ProductTag.GetMall_ProductTagListByProductIDList(ProductIDList);
                var        BusinessIDList        = list.Where(p => p.BusinessID > 0).Select(p => p.BusinessID).ToList();
                var        discount_product_list = Mall_BusinessDiscountRequest_Product.GetMall_BusinessDiscountRequest_ProductListByBusinessIDList(BusinessIDList);
                foreach (var item in list)
                {
                    var my_discount_product = discount_product_list.FirstOrDefault(p => p.BusinessID == item.BusinessID && p.ProductID == item.ID);
                    if (my_discount_product != null)
                    {
                        item.DiscountPrice    = my_discount_product.Price;
                        item.DiscountQuantity = my_discount_product.Quantity;
                    }
                    item.VariantPrice      = (item.SalePrice > 0 ? item.SalePrice : 0);
                    item.VariantPointPrice = 0;
                    item.VariantPoint      = 0;
                    item.VariantVIPPrice   = 0;
                    item.VariantVIPPoint   = 0;
                    item.VariantStaffPrice = 0;
                    item.VariantStaffPoint = 0;
                    item.VariantInventory  = (item.TotalCount > 0 ? item.TotalCount : 0);
                    item.VariantID         = 0;
                    item.VariantName       = string.Empty;
                    var my_variant_list = variant_list.Where(q => q.ProductID == item.ID).OrderBy(q => q.FinalVariantPrice).ToArray();
                    if (my_variant_list.Length > 0)
                    {
                        item.VariantPrice      = (my_variant_list[0].FinalVariantPrice > 0 ? my_variant_list[0].FinalVariantPrice : item.VariantPrice);
                        item.VariantPointPrice = (my_variant_list[0].VariantPointPrice > 0 ? my_variant_list[0].VariantPointPrice : item.VariantPointPrice);
                        item.VariantPoint      = (my_variant_list[0].VariantPoint > 0 ? my_variant_list[0].VariantPoint : item.VariantPoint);
                        item.VariantVIPPrice   = (my_variant_list[0].VariantVIPPrice > 0 ? my_variant_list[0].VariantVIPPrice : item.VariantVIPPrice);
                        item.VariantVIPPoint   = (my_variant_list[0].VariantVIPPoint > 0 ? my_variant_list[0].VariantVIPPoint : item.VariantVIPPoint);
                        item.VariantStaffPrice = (my_variant_list[0].VariantStaffPrice > 0 ? my_variant_list[0].VariantStaffPrice : item.VariantStaffPrice);
                        item.VariantStaffPoint = (my_variant_list[0].VariantStaffPoint > 0 ? my_variant_list[0].VariantStaffPoint : item.VariantStaffPoint);
                        item.VariantInventory  = (my_variant_list[0].Inventory > 0 ? my_variant_list[0].Inventory : item.VariantInventory);
                        item.VariantID         = my_variant_list[0].ID;
                        item.VariantName       = my_variant_list[0].VariantName;
                    }

                    var my_product_tag_list = product_tag_list.Where(q => q.ProductID == item.ID).ToArray();
                    var my_tag_list         = tag_list.Where(q => (my_product_tag_list.Select(m => m.TagID).ToList()).Contains(q.ID)).ToArray();
                    if (my_tag_list.Length > 0)
                    {
                        item.TagNames = string.Join(",", my_tag_list.Select(q => q.TagName));
                    }
                }
            }
            return(list);
        }
 public static Mall_Product_VariantDetail GetMall_ProductVariantDetailPrice(Mall_Product_VariantDetail data)
 {
     if (data != null && data.BusinessID > 0)
     {
         var my_discount_product = Mall_BusinessDiscountRequest_Product.GetMall_BusinessDiscountRequest_ProductListByBusinessID(data.BusinessID, data.ProductID);
         if (my_discount_product != null)
         {
             data.DiscountPrice    = my_discount_product.Price;
             data.DiscountQuantity = my_discount_product.Quantity;
         }
     }
     return(data);
 }
        public static Mall_ProductDetail GetMall_ProductDetailPrice(Mall_ProductDetail data)
        {
            if (data == null)
            {
                return(null);
            }
            var my_discount_product = Mall_BusinessDiscountRequest_Product.GetMall_BusinessDiscountRequest_ProductListByBusinessID(data.BusinessID, data.ID);

            if (my_discount_product != null)
            {
                data.DiscountPrice    = my_discount_product.Price;
                data.DiscountQuantity = my_discount_product.Quantity;
            }
            data.VariantPrice      = (data.SalePrice > 0 ? data.SalePrice : 0);
            data.VariantPoint      = 0;
            data.VariantPointPrice = 0;
            data.VariantVIPPoint   = 0;
            data.VariantVIPPrice   = 0;
            data.VariantStaffPrice = 0;
            data.VariantStaffPoint = 0;
            data.VariantInventory  = (data.TotalCount > 0 ? data.TotalCount : 0);
            data.VariantID         = 0;
            data.VariantName       = string.Empty;
            var my_variant_list = Mall_Product_VariantDetail.GetMall_Product_VariantDetailListByProductID(data.ID).OrderBy(q => q.FinalVariantPrice).ToArray();

            if (my_variant_list.Length > 0)
            {
                data.VariantPrice      = (my_variant_list[0].FinalVariantPrice > 0 ? my_variant_list[0].FinalVariantPrice : data.VariantPrice);
                data.VariantPoint      = (my_variant_list[0].VariantPoint > 0 ? my_variant_list[0].VariantPoint : data.VariantPoint);
                data.VariantPointPrice = (my_variant_list[0].VariantPointPrice > 0 ? my_variant_list[0].VariantPointPrice : data.VariantPointPrice);
                data.VariantVIPPoint   = (my_variant_list[0].VariantVIPPoint > 0 ? my_variant_list[0].VariantVIPPoint : data.VariantVIPPoint);
                data.VariantVIPPrice   = (my_variant_list[0].VariantVIPPrice > 0 ? my_variant_list[0].VariantVIPPrice : data.VariantVIPPrice);
                data.VariantStaffPrice = (my_variant_list[0].VariantStaffPrice > 0 ? my_variant_list[0].VariantStaffPrice : data.VariantStaffPrice);
                data.VariantStaffPoint = (my_variant_list[0].VariantStaffPoint > 0 ? my_variant_list[0].VariantStaffPoint : data.VariantStaffPoint);
                data.VariantInventory  = (my_variant_list[0].Inventory > 0 ? my_variant_list[0].Inventory : data.VariantInventory);
                data.VariantID         = my_variant_list[0].ID;
                data.VariantName       = my_variant_list[0].VariantName;
            }
            return(data);
        }
        public static string GetOrderItemPriceDesc(Mall_Product product, Mall_Product_VariantDetail product_variant, int quantity, out decimal price, out int salepoint, out bool isallowproductsale, out bool isallowpointsale, out bool isallowvipsale, out bool isallowstaffsale, out string totalpricedesc, int ProductOrderType = 0)
        {
            string pricedesc = string.Empty;

            price              = product.OrderItemPrice;
            salepoint          = 0;
            isallowproductsale = false;
            isallowpointsale   = false;
            isallowvipsale     = false;
            isallowstaffsale   = false;
            string desc = string.Empty;

            totalpricedesc = string.Empty;
            if (product_variant != null)
            {
                desc = product_variant.FinalVariantTitle + ": " + product_variant.VariantName;
                if (ProductOrderType == 16)
                {
                    isallowproductsale = true;
                    price = product_variant.FinalVariantPrice;
                }
                else if (ProductOrderType == 17)
                {
                    isallowpointsale = true;
                    price            = product_variant.VariantPointPrice;
                    salepoint        = product_variant.VariantPoint;
                }
                else if (ProductOrderType == 18)
                {
                    isallowvipsale = true;
                    price          = product_variant.VariantVIPPrice;
                    salepoint      = product_variant.VariantVIPPoint;
                }
                else if (ProductOrderType == 25)
                {
                    isallowstaffsale = true;
                    price            = product_variant.VariantStaffPrice;
                    salepoint        = product_variant.VariantStaffPoint;
                }
                else
                {
                    if (product.IsAllowProductBuy)
                    {
                        isallowproductsale = true;
                        price = product_variant.FinalVariantPrice;
                    }
                    else if (product.IsAllowPointBuy)
                    {
                        isallowpointsale = true;
                        price            = product_variant.VariantPointPrice;
                        salepoint        = product_variant.VariantPoint;
                    }
                    else if (product.IsAllowVIPBuy)
                    {
                        isallowvipsale = true;
                        price          = product_variant.VariantVIPPrice;
                        salepoint      = product_variant.VariantVIPPoint;
                    }
                    else if (product.IsAllowStaffBuy)
                    {
                        isallowstaffsale = true;
                        price            = product_variant.VariantStaffPrice;
                        salepoint        = product_variant.VariantStaffPoint;
                    }
                }
            }
            if (price > 0 && salepoint > 0)
            {
                pricedesc      = "¥" + price.ToString("0.00") + " + " + salepoint.ToString() + "积分";
                totalpricedesc = "¥" + (price * quantity).ToString("0.00") + " + " + (salepoint * quantity).ToString() + "积分";
            }
            else if (price > 0)
            {
                pricedesc      = "¥" + price.ToString("0.00");
                totalpricedesc = "¥" + (price * quantity).ToString("0.00");
            }
            else if (salepoint > 0)
            {
                pricedesc      = salepoint.ToString() + "积分";
                totalpricedesc = (salepoint * quantity).ToString() + "积分";
            }
            return(pricedesc);
        }