diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/goods/goodDetails/goodDetails.vue b/CoreCms.Net.Uni-App/CoreShop/pages/goods/goodDetails/goodDetails.vue
index f909aa0e..653e8a73 100644
--- a/CoreCms.Net.Uni-App/CoreShop/pages/goods/goodDetails/goodDetails.vue
+++ b/CoreCms.Net.Uni-App/CoreShop/pages/goods/goodDetails/goodDetails.vue
@@ -124,6 +124,59 @@
+
+
+
+
+
+ 代理价格
+
+
+
+ 您的等级:{{userAgentGrade.name}}
+
+
+
+
+
+
+
+ 货品名称
+
+
+ 销售价
+
+
+ 代理价
+
+
+ 利润
+
+
+
+
+ {{item.name}}
+
+
+ {{item.productPrice}}
+
+
+ {{item.agentGradePrice}}
+
+
+ {{ parseFloat(item.productPrice-item.agentGradePrice).toFixed(2)}}
+
+
+
+
+ 注:此利润不为最终用户下单后利润,因为订单可能存在优惠。
+
+
+
+ 该商品暂未录入商品池价格
+
+
+
@@ -439,6 +492,9 @@
service: [],
},
autoplay: true,
+ userAgent: {},
+ userAgentGrade: {},
+ agentProducts: []
}
},
onLoad(options) {
@@ -662,7 +718,24 @@
_this.product = res.data.product;
_this.goodsInfo = info;
_this.goodsSkuInfo = res.data.skuList;
-
+ if (res.otherData.agentProducts) {
+ for (var i = 0; i < res.otherData.agentProducts.length; i++) {
+ for (var j = 0; j < res.data.skuList.sku_list.length; j++) {
+ if (res.data.skuList.sku_list[j]._id == res.otherData.agentProducts[i].productId) {
+ res.otherData.agentProducts[i].name = res.data.skuList.sku_list[j].sku_name_arr[0];
+ break;
+ }
+ }
+ }
+ console.log(res.otherData.agentProducts);
+ _this.agentProducts = res.otherData.agentProducts;
+ }
+ if (res.otherData.userAgentGrade) {
+ _this.userAgentGrade = res.otherData.userAgentGrade;
+ }
+ if (res.otherData.userAgent) {
+ _this.userAgent = res.otherData.userAgent;
+ }
//价格区间
if (res.data.minPrice != res.data.maxPrice) {
diff --git a/CoreCms.Net.Uni-App/CoreShop/static/style/coreCommon.scss b/CoreCms.Net.Uni-App/CoreShop/static/style/coreCommon.scss
index fd3a0f0e..9a459074 100644
--- a/CoreCms.Net.Uni-App/CoreShop/static/style/coreCommon.scss
+++ b/CoreCms.Net.Uni-App/CoreShop/static/style/coreCommon.scss
@@ -359,6 +359,11 @@ view, text { box-sizing: border-box; }
.coreshop-min-height-#{$i} { min-height: $i + px; }
}
+// 定义字体(px)单位
+@for $i from 0 through 100 {
+ .coreshop-line-height-#{$i} { line-height: $i + px; }
+}
+
// 定义flex等分
@for $i from 0 through 12 {
.coreshop-flex-#{$i} { flex: $i; }
diff --git a/CoreCms.Net.Uni-App/CoreShop/static/style/style.app.scss b/CoreCms.Net.Uni-App/CoreShop/static/style/style.app.scss
index 946bb7e1..69bd7fb6 100644
--- a/CoreCms.Net.Uni-App/CoreShop/static/style/style.app.scss
+++ b/CoreCms.Net.Uni-App/CoreShop/static/style/style.app.scss
@@ -688,6 +688,18 @@ u-icon { line-height: 0; }
.goods-param-line .name { background: #f3f3f3; border-right: 0.5px solid #c3c3c3; color: #616161; font-size: 12px; height: 34px; line-height: 34px; text-align: center; width: 95px; }
.goods-param-line .value { color: #2f2f2f; font-size: 12px; padding-left: 12px; width: 215px; }
+
+/*代理价格表格*/
+.goods-agent-box { border: 0.5px solid #c3c3c3; border-radius: 0px; margin-top: 12rpx; }
+.goods-agent-line { border-bottom: 0.5px solid #c3c3c3; display: flex;
+ .name { background: #f3f3f3; border-right: 0.5px solid #c3c3c3; color: #616161; font-size: 12px; text-align: center; width: 216px; }
+ .productPrice { color: #2f2f2f; border-right: 0.5px solid #c3c3c3; font-size: 12px; width: 50px; text-align: center; }
+ .agentGradePrice { color: #2f2f2f; border-right: 0.5px solid #c3c3c3; font-size: 12px; width: 50px; text-align: center; }
+ .profit { color: #2f2f2f; font-size: 12px; width: 50px; text-align: center; }
+}
+ .goods-agent-line:last-child { border-bottom: 0; }
+
+
.line-70 { background: #c3c3c3; height: 1px; margin-top: 3px; width: 34.5px; }
/*购买按钮*/
diff --git a/CoreCms.Net.Uni-App/CoreShop/static/style/style.mp.scss b/CoreCms.Net.Uni-App/CoreShop/static/style/style.mp.scss
index 946bb7e1..12845e04 100644
--- a/CoreCms.Net.Uni-App/CoreShop/static/style/style.mp.scss
+++ b/CoreCms.Net.Uni-App/CoreShop/static/style/style.mp.scss
@@ -688,6 +688,18 @@ u-icon { line-height: 0; }
.goods-param-line .name { background: #f3f3f3; border-right: 0.5px solid #c3c3c3; color: #616161; font-size: 12px; height: 34px; line-height: 34px; text-align: center; width: 95px; }
.goods-param-line .value { color: #2f2f2f; font-size: 12px; padding-left: 12px; width: 215px; }
+
+/*代理价格表格*/
+.goods-agent-box { border: 0.5px solid #c3c3c3; border-radius: 0px; margin-top: 12rpx; }
+.goods-agent-line { border-bottom: 0.5px solid #c3c3c3; display: flex;
+ .name { background: #f3f3f3; border-right: 0.5px solid #c3c3c3; color: #616161; font-size: 12px; text-align: center; width: 216px;}
+ .productPrice { color: #2f2f2f; border-right: 0.5px solid #c3c3c3; font-size: 12px; width: 50px; text-align: center; }
+ .agentGradePrice { color: #2f2f2f; border-right: 0.5px solid #c3c3c3; font-size: 12px; width: 50px; text-align: center; }
+ .profit { color: #2f2f2f; font-size: 12px; width: 50px; text-align: center; }
+}
+ .goods-agent-line:last-child { border-bottom: 0; }
+
+
.line-70 { background: #c3c3c3; height: 1px; margin-top: 3px; width: 34.5px; }
/*购买按钮*/
diff --git a/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs b/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
index 65de64d1..2840938d 100644
--- a/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
+++ b/CoreCms.Net.Web.WebApi/Controllers/GoodController.cs
@@ -31,6 +31,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
+using NPOI.SS.Formula.Functions;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
@@ -55,6 +56,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers
private ICoreCmsGoodsParamsServices _goodsParamsServices;
private ICoreCmsGoodsCollectionServices _goodsCollectionServices;
private ICoreCmsUserServices _userServices;
+ private ICoreCmsAgentServices _agentServices;
+ private ICoreCmsAgentProductsServices _agentProductsServices;
+ private ICoreCmsAgentGradeServices _agentGradeServices;
///
/// 构造函数
@@ -71,7 +75,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
, ICoreCmsGoodsParamsServices goodsParamsServices
, ICoreCmsGoodsCollectionServices goodsCollectionServices
, ICoreCmsUserServices userServices
- )
+ , ICoreCmsAgentServices agentServices, ICoreCmsAgentProductsServices agentProductsServices, ICoreCmsAgentGradeServices agentGradeServices)
{
_mapper = mapper;
_user = user;
@@ -85,7 +89,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers
_goodsParamsServices = goodsParamsServices;
_goodsCollectionServices = goodsCollectionServices;
_userServices = userServices;
-
+ _agentServices = agentServices;
+ _agentProductsServices = agentProductsServices;
+ _agentGradeServices = agentGradeServices;
}
//公共接口====================================================================================================
@@ -484,6 +490,14 @@ namespace CoreCms.Net.Web.WebApi.Controllers
{
userId = _user.ID;
}
+
+ var user = await _userServices.QueryByClauseAsync(p => p.id == _user.ID);
+ if (user == null)
+ {
+ jm.msg = "用户信息获取失败";
+ return jm;
+ }
+
var model = await _goodsServices.GetGoodsDetail(entity.id, userId, false, "goods", 0, entity.data.ObjectToBool());
if (model == null)
@@ -491,6 +505,23 @@ namespace CoreCms.Net.Web.WebApi.Controllers
jm.msg = "商品获取失败";
return jm;
}
+
+ var userAgent = await _agentServices.QueryByClauseAsync(p => p.userId == user.id);
+ var agentProducts = new List();
+ var userAgentGrade = new CoreCmsAgentGrade();
+ if (userAgent != null)
+ {
+ agentProducts = await _agentProductsServices.QueryListByClauseAsync(p => p.goodId == model.id && p.isDel == false && p.agentGradeId == userAgent.gradeId);
+ userAgentGrade = await _agentGradeServices.QueryByClauseAsync(p => p.id == userAgent.gradeId, true, true);
+ }
+
+ jm.otherData = new
+ {
+ userAgent,
+ userAgentGrade,
+ agentProducts
+ };
+
await _goodsServices.UpdateAsync(p => new CoreCmsGoods() { viewCount = p.viewCount + 1 },
p => p.id == entity.id);