mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-02-05 05:09:49 +08:00
【新增】普通商品详情新增显示代理商价格体系,只有登陆后的代理商才会显示。
This commit is contained in:
@@ -124,6 +124,59 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<!--代理价格体系-->
|
||||||
|
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white" v-if="userAgentGrade && userAgent">
|
||||||
|
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row">
|
||||||
|
<view class="coreshop-basis-4">
|
||||||
|
<text class="coreshop-text-black coreshop-font-weight-bold coreshop-font-15">代理价格</text>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-basis-6">
|
||||||
|
<view class="coreshop-float-right">
|
||||||
|
您的等级:{{userAgentGrade.name}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="agentProducts.length">
|
||||||
|
<view class="goods-agent-box">
|
||||||
|
<view class="goods-agent-line">
|
||||||
|
<view class="name coreshop-line-height-34">
|
||||||
|
<text>货品名称</text>
|
||||||
|
</view>
|
||||||
|
<view class="productPrice coreshop-line-height-34">
|
||||||
|
<text>销售价</text>
|
||||||
|
</view>
|
||||||
|
<view class="agentGradePrice coreshop-line-height-34">
|
||||||
|
<text>代理价</text>
|
||||||
|
</view>
|
||||||
|
<view class="profit coreshop-line-height-34">
|
||||||
|
<text>利润</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods-agent-line" v-for="(item, index) in agentProducts" :key="index">
|
||||||
|
<view class="name coreshop-line-height-24 coreshop-padding-4">
|
||||||
|
<text>{{item.name}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="productPrice coreshop-display-flex coreshop-align-center coreshop-justify-center">
|
||||||
|
<text>{{item.productPrice}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="agentGradePrice coreshop-display-flex coreshop-align-center coreshop-justify-center">
|
||||||
|
<text>{{item.agentGradePrice}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="profit coreshop-display-flex coreshop-align-center coreshop-justify-center">
|
||||||
|
<text>{{ parseFloat(item.productPrice-item.agentGradePrice).toFixed(2)}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-font-12 coreshop-line-height-34">
|
||||||
|
注:此利润不为最终用户下单后利润,因为订单可能存在优惠。
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="coreshop-margin-top-8" v-else>
|
||||||
|
<text class="coreshop-text-gray coreshop-font-12">该商品暂未录入商品池价格</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!--评论-->
|
<!--评论-->
|
||||||
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
|
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
|
||||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row">
|
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-flex-direction-row">
|
||||||
@@ -439,6 +492,9 @@
|
|||||||
service: [],
|
service: [],
|
||||||
},
|
},
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
|
userAgent: {},
|
||||||
|
userAgentGrade: {},
|
||||||
|
agentProducts: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@@ -662,7 +718,24 @@
|
|||||||
_this.product = res.data.product;
|
_this.product = res.data.product;
|
||||||
_this.goodsInfo = info;
|
_this.goodsInfo = info;
|
||||||
_this.goodsSkuInfo = res.data.skuList;
|
_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) {
|
if (res.data.minPrice != res.data.maxPrice) {
|
||||||
|
|||||||
@@ -359,6 +359,11 @@ view, text { box-sizing: border-box; }
|
|||||||
.coreshop-min-height-#{$i} { min-height: $i + px; }
|
.coreshop-min-height-#{$i} { min-height: $i + px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 定义字体(px)单位
|
||||||
|
@for $i from 0 through 100 {
|
||||||
|
.coreshop-line-height-#{$i} { line-height: $i + px; }
|
||||||
|
}
|
||||||
|
|
||||||
// 定义flex等分
|
// 定义flex等分
|
||||||
@for $i from 0 through 12 {
|
@for $i from 0 through 12 {
|
||||||
.coreshop-flex-#{$i} { flex: $i; }
|
.coreshop-flex-#{$i} { flex: $i; }
|
||||||
|
|||||||
@@ -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 .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-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; }
|
.line-70 { background: #c3c3c3; height: 1px; margin-top: 3px; width: 34.5px; }
|
||||||
|
|
||||||
/*购买按钮*/
|
/*购买按钮*/
|
||||||
|
|||||||
@@ -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 .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-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; }
|
.line-70 { background: #c3c3c3; height: 1px; margin-top: 3px; width: 34.5px; }
|
||||||
|
|
||||||
/*购买按钮*/
|
/*购买按钮*/
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
namespace CoreCms.Net.Web.WebApi.Controllers
|
namespace CoreCms.Net.Web.WebApi.Controllers
|
||||||
@@ -55,6 +56,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
private ICoreCmsGoodsParamsServices _goodsParamsServices;
|
private ICoreCmsGoodsParamsServices _goodsParamsServices;
|
||||||
private ICoreCmsGoodsCollectionServices _goodsCollectionServices;
|
private ICoreCmsGoodsCollectionServices _goodsCollectionServices;
|
||||||
private ICoreCmsUserServices _userServices;
|
private ICoreCmsUserServices _userServices;
|
||||||
|
private ICoreCmsAgentServices _agentServices;
|
||||||
|
private ICoreCmsAgentProductsServices _agentProductsServices;
|
||||||
|
private ICoreCmsAgentGradeServices _agentGradeServices;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数
|
/// 构造函数
|
||||||
@@ -71,7 +75,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
, ICoreCmsGoodsParamsServices goodsParamsServices
|
, ICoreCmsGoodsParamsServices goodsParamsServices
|
||||||
, ICoreCmsGoodsCollectionServices goodsCollectionServices
|
, ICoreCmsGoodsCollectionServices goodsCollectionServices
|
||||||
, ICoreCmsUserServices userServices
|
, ICoreCmsUserServices userServices
|
||||||
)
|
, ICoreCmsAgentServices agentServices, ICoreCmsAgentProductsServices agentProductsServices, ICoreCmsAgentGradeServices agentGradeServices)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_user = user;
|
_user = user;
|
||||||
@@ -85,7 +89,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
_goodsParamsServices = goodsParamsServices;
|
_goodsParamsServices = goodsParamsServices;
|
||||||
_goodsCollectionServices = goodsCollectionServices;
|
_goodsCollectionServices = goodsCollectionServices;
|
||||||
_userServices = userServices;
|
_userServices = userServices;
|
||||||
|
_agentServices = agentServices;
|
||||||
|
_agentProductsServices = agentProductsServices;
|
||||||
|
_agentGradeServices = agentGradeServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
//公共接口====================================================================================================
|
//公共接口====================================================================================================
|
||||||
@@ -484,6 +490,14 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
{
|
{
|
||||||
userId = _user.ID;
|
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());
|
var model = await _goodsServices.GetGoodsDetail(entity.id, userId, false, "goods", 0, entity.data.ObjectToBool());
|
||||||
|
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@@ -491,6 +505,23 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
|||||||
jm.msg = "商品获取失败";
|
jm.msg = "商品获取失败";
|
||||||
return jm;
|
return jm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var userAgent = await _agentServices.QueryByClauseAsync(p => p.userId == user.id);
|
||||||
|
var agentProducts = new List<CoreCmsAgentProducts>();
|
||||||
|
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 },
|
await _goodsServices.UpdateAsync(p => new CoreCmsGoods() { viewCount = p.viewCount + 1 },
|
||||||
p => p.id == entity.id);
|
p => p.id == entity.id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user