From 93efdd425b15874f85ac400eeea0d21aab07c6ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=81=B0=E7=81=B0?= Date: Wed, 11 May 2022 21:06:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=AF=A6=E6=83=85=E6=96=B0=E5=A2=9Esku=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E5=8C=BA=E9=97=B4=E5=B1=95=E7=A4=BA=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E3=80=90=C2=A5100~395=E3=80=91=EF=BC=8C=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=8D=95=E4=B8=AAsku=E5=90=8E=E8=87=AA=E5=8A=A8=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E5=85=B6=E5=85=B7=E4=BD=93=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Good/CoreCmsGoodsPartial.cs | 20 +++++++++++++++++++ .../Good/CoreCmsGoodsServices.cs | 9 +++++++++ .../coreshop-spec/coreshop-spec.vue | 3 --- .../pages/goods/goodDetails/goodDetails.vue | 17 +++++++++++++--- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/CoreCms.Net.Model/Entities/Good/CoreCmsGoodsPartial.cs b/CoreCms.Net.Model/Entities/Good/CoreCmsGoodsPartial.cs index bd86af63..59891c5e 100644 --- a/CoreCms.Net.Model/Entities/Good/CoreCmsGoodsPartial.cs +++ b/CoreCms.Net.Model/Entities/Good/CoreCmsGoodsPartial.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using CoreCms.Net.Model.FromBody; using SqlSugar; namespace CoreCms.Net.Model.Entities @@ -108,6 +109,11 @@ namespace CoreCms.Net.Model.Entities [SugarColumn(IsIgnore = true)] public List sku { get; set; } = new(); + /// + /// 商品规格 + /// + [SugarColumn(IsIgnore = true)] + public Dictionary> specification { get; set; } = new(); /// /// 是否收藏 @@ -176,5 +182,19 @@ namespace CoreCms.Net.Model.Entities [SugarColumn(IsIgnore = true)] public DateTime groupEndTime { get; set; } [SugarColumn(IsIgnore = true)] public int groupTimestamp { get; set; } + + + /// + /// sku最小价格 + /// + [SugarColumn(IsIgnore = true)] + public decimal minPrice { get; set; } = 0; + + /// + /// sku最大价格 + /// + [SugarColumn(IsIgnore = true)] + public decimal maxPrice { get; set; } = 0; + } } \ No newline at end of file diff --git a/CoreCms.Net.Services/Good/CoreCmsGoodsServices.cs b/CoreCms.Net.Services/Good/CoreCmsGoodsServices.cs index c6ca0960..ef57b02f 100644 --- a/CoreCms.Net.Services/Good/CoreCmsGoodsServices.cs +++ b/CoreCms.Net.Services/Good/CoreCmsGoodsServices.cs @@ -538,6 +538,15 @@ namespace CoreCms.Net.Services model.freezeStock = getProductInfo.freezeStock; model.weight = getProductInfo.weight; + var minProduct = await _productsServices.QueryByClauseAsync(p => p.isDel == false && p.goodsId == id, + p => p.price, OrderByType.Asc); + + var maxProduct = await _productsServices.QueryByClauseAsync(p => p.isDel == false && p.goodsId == id, + p => p.price, OrderByType.Desc); + + model.minPrice = minProduct.price; + model.maxPrice = maxProduct.price; + //获取品牌 var brand = await _brandServices.QueryByIdAsync(model.brandId); model.brand = brand; diff --git a/CoreCms.Net.Uni-App/CoreShop/components/coreshop-spec/coreshop-spec.vue b/CoreCms.Net.Uni-App/CoreShop/components/coreshop-spec/coreshop-spec.vue index b6724634..d881f971 100644 --- a/CoreCms.Net.Uni-App/CoreShop/components/coreshop-spec/coreshop-spec.vue +++ b/CoreCms.Net.Uni-App/CoreShop/components/coreshop-spec/coreshop-spec.vue @@ -1,6 +1,5 @@