Commit d0082dbe authored by 黄奎's avatar 黄奎

页面修改

parent 4fc29488
......@@ -193,5 +193,10 @@ namespace Mall.Model.Entity.Product
/// 商户编号
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 是否自定义规格 1是 2否
/// </summary>
public int IsCustomSpecification { get; set; }
}
}
......@@ -138,10 +138,6 @@ namespace Mall.Model.Entity.Product
get;
set;
}
/// <summary>
/// 阶梯编号
/// </summary>
public int StepId { get; set; }
}
}
......@@ -127,6 +127,9 @@ namespace Mall.Model.Extend.Product
/// </summary>
public List<RB_Groupbuy_Activity_Specificationprice_Extend> SpecificationPriceList { get; set; }
/// <summary>
/// 服务列表
/// </summary>
public List<RB_ImageCommonModel> ServiceList { get; set; }
}
}
using Mall.Model.Extend.Product;
using Mall.Repository.Product;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
using System.Linq;
using Mall.Model.Entity.Product;
using Mall.AOP.CustomerAttribute;
namespace Mall.Module.Product
{
......@@ -176,7 +175,8 @@ namespace Mall.Module.Product
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetGroupbuyActivityModule(RB_Groupbuy_Activity_Extend extModel)
[TransactionCallHandler]
public virtual bool SetGroupbuyActivityModule(RB_Groupbuy_Activity_Extend extModel)
{
bool flag = false;
if (extModel.ActivityId > 0)
......@@ -216,6 +216,7 @@ namespace Mall.Module.Product
{ nameof(RB_Groupbuy_Activity_Extend.CardIds),extModel.CardIds},
{ nameof(RB_Groupbuy_Activity_Extend.App_share_title),extModel.App_share_title},
{ nameof(RB_Groupbuy_Activity_Extend.App_share_pic),extModel.App_share_pic},
{ nameof(RB_Groupbuy_Activity_Extend.IsCustomSpecification),extModel.IsCustomSpecification},
};
flag = groupbuy_ActivityRepository.Update(fileds, new WhereHelper(nameof(RB_Groupbuy_Activity_Extend.ActivityId), extModel.ActivityId));
}
......@@ -227,14 +228,57 @@ namespace Mall.Module.Product
}
if (flag)
{
if (extModel.SpecificationList != null && extModel.SpecificationList.Count>0)
flag= SetGoodsSpecificationModule(extModel);
flag= SetGoodGroupStepModule(extModel);
}
flag = false;
return flag;
}
/// <summary>
/// 添加修改商品规格
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
private bool SetGoodsSpecificationModule(RB_Groupbuy_Activity_Extend extModel)
{
bool flag = false;
if (extModel.IsCustomSpecification == 1)
{
var oldSpecList= GetGroupbuyActivitySpecificationListModule(new RB_Groupbuy_Activity_Specification_Extend()
{
MallBaseId = extModel.MallBaseId,
TenantId = extModel.TenantId,
GoodsId = extModel.GoodId,
});
if (oldSpecList.Count() != extModel.SpecificationList.Count() || oldSpecList.Count() != extModel.SpecificationList.Where(x => x.Id > 0).Count())
{
//删除规格
IList<WhereHelper> specWheres = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Groupbuy_Activity_Specification_Extend.TenantId),extModel.TenantId),
new WhereHelper(nameof(RB_Groupbuy_Activity_Specification_Extend.MallBaseId),extModel.MallBaseId),
new WhereHelper(nameof(RB_Groupbuy_Activity_Specification_Extend.GoodsId),extModel.GoodId),
};
groupbuy_Activity_SpecificationRepository.Delete(specWheres);
//删除值
IList<WhereHelper> specValuesWheres = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Groupbuy_Activity_Specificationvalue_Extend.TenantId),extModel.TenantId),
new WhereHelper(nameof(RB_Groupbuy_Activity_Specificationvalue_Extend.MallBaseId),extModel.MallBaseId),
new WhereHelper(nameof(RB_Groupbuy_Activity_Specificationvalue_Extend.GoodsId),extModel.GoodId),
};
groupbuy_Activity_SpecificationValueRepository.Delete(specValuesWheres);
foreach (var specItem in extModel.SpecificationList)
{
specItem.TenantId = extModel.TenantId;
specItem.MallBaseId = extModel.MallBaseId;
specItem.GoodsId = extModel.GoodId;
var newSpecId = groupbuy_Activity_SpecificationRepository.Insert(specItem);
specItem.Id = newSpecId;
if (specItem.SpecificationValueList != null && specItem.SpecificationValueList.Count > 0)
{
foreach (var specValueItem in specItem.SpecificationValueList)
......@@ -243,30 +287,45 @@ namespace Mall.Module.Product
specValueItem.TenantId = extModel.TenantId;
specValueItem.SpecificationId = newSpecId;
specValueItem.GoodsId = extModel.GoodId;
var newSpecValueId = groupbuy_Activity_SpecificationValueRepository.Insert(specValueItem);
flag = groupbuy_Activity_SpecificationValueRepository.Insert(specValueItem) > 0;
}
}
}
}
else
{
}
}
return flag;
}
if (extModel.GroupList != null && extModel.GroupList.Count > 0)
/// <summary>
/// 新增修改阶梯团价
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
private bool SetGoodGroupStepModule(RB_Groupbuy_Activity_Extend extModel)
{
bool flag = false;
if (extModel.GroupList != null && extModel.GroupList.Count > 0)
{
foreach (var groupItem in extModel.GroupList)
{
foreach (var groupItem in extModel.GroupList)
groupItem.TenantId = extModel.TenantId;
groupItem.MallBaseId = extModel.MallBaseId;
groupItem.GoodId = extModel.GoodId;
var newGroupId = stepRepository.Insert(groupItem);
flag = newGroupId > 0;
if (newGroupId > 0)
{
groupItem.TenantId = extModel.TenantId;
groupItem.MallBaseId = extModel.MallBaseId;
groupItem.GoodId = extModel.GoodId;
var newGroupId = stepRepository.Insert(groupItem);
if (newGroupId > 0)
foreach (var priceItem in extModel.SpecificationPriceList)
{
foreach (var priceItem in extModel.SpecificationPriceList)
{
priceItem.MallBaseId = extModel.MallBaseId;
priceItem.TenantId = extModel.TenantId;
priceItem.GoodsId = extModel.GoodId;
priceItem.StepId = newGroupId;
groupbuy_Activity_SpecificationPriceRepository.Insert(priceItem);
}
priceItem.MallBaseId = extModel.MallBaseId;
priceItem.TenantId = extModel.TenantId;
priceItem.GoodsId = extModel.GoodId;
//priceItem.StepId = newGroupId;
groupbuy_Activity_SpecificationPriceRepository.Insert(priceItem);
}
}
}
......
......@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.AOP\Mall.AOP.csproj" />
<ProjectReference Include="..\Mall.CacheManager\Mall.CacheManager.csproj" />
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
......
......@@ -75,6 +75,10 @@ namespace Mall.WebApi.Controllers
//背景插件
case "background":
var backgroundData = subItem.data as backgroundItem;
if (backgroundData != null && !string.IsNullOrWhiteSpace(backgroundData.backgroundPicUrl))
{
backgroundData.backgroundPicUrl = Common.Config.GetFileUrl(backgroundData.backgroundPicUrl);
}
obj = new
{
id = subItem.Id,
......
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.AOP;
using Mall.Common.API;
using Mall.Model.Extend.Product;
using Mall.Model.Extend.User;
......@@ -25,10 +26,12 @@ namespace Mall.WebApi.Controllers.Product
/// </summary>
private readonly GroupBuyConfigModule groupBuyConfigModule = new GroupBuyConfigModule();
/// <summary>
/// 拼团活动
/// </summary>
private readonly GroupBuyConfigActivityModule groupBuyConfigActivityModule = new GroupBuyConfigActivityModule();
private readonly GroupBuyConfigActivityModule groupBuyConfigActivityModule = AOPHelper.CreateAOPObject<GroupBuyConfigActivityModule>();
#region 拼团配置设置
/// <summary>
......@@ -125,6 +128,10 @@ namespace Mall.WebApi.Controllers.Product
var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_Groupbuy_Activity_Extend>(RequestParm.msg.ToString());
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
if (extModel.ServiceList != null && extModel.ServiceList.Count > 0)
{
extModel.GoodsService = Common.Plugin.JsonHelper.Serialize(extModel.ServiceList);
}
bool flag = groupBuyConfigActivityModule.SetGroupbuyActivityModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment