Commit c50c9158 authored by 吴春's avatar 吴春

提交小程序评价标签以及规格日期

parent 649b18d4
......@@ -204,6 +204,6 @@ namespace Mall.Model.Entity.Product
/// <summary>
/// 评论标签Id
/// </summary>
public int LabelId { get; set; }
public string LabelIds { get; set; }
}
}
......@@ -7,5 +7,9 @@ namespace Mall.Model.Extend.Product
/// </summary>
public class RB_Comment_Label_Extend: RB_Comment_Label
{
/// <summary>
/// 评价数
/// </summary>
public int CommentNum { get; set; }
}
}
......@@ -38,16 +38,25 @@ namespace Mall.Model.Extend.Product
/// </summary>
public int CommentNum { get; set; }
/// <summary>
/// 评论标签ids 2024-02-18 add by:W
/// </summary>
public List<string> CommentLabelList { get; set; }
/// <summary>
/// 评论标签id 2024-02-18 add by:W
/// </summary>
public int CommentLabelId { get; set; }
/// <summary>
/// 评论总分
/// </summary>
public decimal TotalScore { get; set; }
#region 司导信息
/// <summary>
/// 导游名称
/// </summary>
......
......@@ -29,5 +29,15 @@ namespace Mall.Model.Extend.Product
/// 查询排序
/// </summary>
public int? SortNum { get; set; }
/// <summary>
/// 是否日期格式 2024-02-19 add by:W
/// </summary>
public int IsDateFormat { get; set; }
/// <summary>
/// 日期信息 2024-02-19 add by:W
/// </summary>
public DateTime? DateTimeInfo { get; set; }
}
}
......@@ -112,7 +112,7 @@ namespace Mall.Module.Product
List<object> DList = new List<object>();
decimal TotalGoodsMoney = 0, TotalGoodsOriginalMoney = 0, TotalGoodsSellMoney = 0;// 总商品价格 总原价 总售价
decimal member_discount = 0;//总会员优惠
decimal Total_integral_price = 0;//总积分金额
int Total_use_integral = 0;//总积分
......@@ -120,7 +120,7 @@ namespace Mall.Module.Product
decimal EducationMoney = 0;//课程卡抵扣金额
int EducationNum = 0;//课程卡抵扣数量
bool IsPointsDeduction = false;//是否有商品可使用积分抵扣
List<object> goods_list = new List<object>();
if (demodel.DetailList.Any())
{
......@@ -129,7 +129,7 @@ namespace Mall.Module.Product
var clist = goods_CategoryRepository.GetList(new RB_Goods_Category_Extend() { GoodsIds = GoodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
var mpriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsIds = GoodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
//返佣
var DistributionCommissionList = new List<RB_Goods_DistributionCommission_Extend>();
if (demodel.DetailList.Where(x => x.SeparateDistribution == 1).Any())
......@@ -177,17 +177,20 @@ namespace Mall.Module.Product
List<RB_Education_CouponProduct_Extend> edcpList = new List<RB_Education_CouponProduct_Extend>();
if (demodel.Use_Education_Id > 0)
{
if (demodel.User_Coupon_Id > 0) {
if (demodel.User_Coupon_Id > 0)
{
return ApiResult.Failed("课程卡与优惠券不能同时使用");
}
if (demodel.Use_Integral > 0) {
if (demodel.Use_Integral > 0)
{
return ApiResult.Failed("课程卡与积分抵扣不能同时使用");
}
eList = education_MemberCouponRepository.GetList(new RB_Education_MemberCoupon_Extend() { Ids = (demodel.Use_Education_Id ?? 0).ToString(), UserId = umodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
if (eList.Any())
{
var educationModel = eList.FirstOrDefault();
if (educationModel.HeXiao <= educationModel.UseHeXiao) {
if (educationModel.HeXiao <= educationModel.UseHeXiao)
{
return ApiResult.Failed("课程卡剩余次数不足");
}
string cIds = string.Join(",", eList.Select(x => x.CouponId).Distinct());
......@@ -206,7 +209,7 @@ namespace Mall.Module.Product
}
}
}
}
}
}
#endregion
List<RB_Goods_CouponModel> GoodsCouponList = new List<RB_Goods_CouponModel>();//商品优惠卷 价格(每个商品优惠的价格)
......@@ -594,7 +597,8 @@ namespace Mall.Module.Product
}
}
}
if (demodel.Use_Education_Id > 0 && GoodsCouponList.Any()) {
if (demodel.Use_Education_Id > 0 && GoodsCouponList.Any())
{
var ccmodel = eList.Where(x => x.Id == demodel.Use_Education_Id).FirstOrDefault();
GoodsCouponList = GoodsCouponList.OrderBy(x => x.TotalMoney).Take(ccmodel.HeXiao - ccmodel.UseHeXiao).ToList();
}
......@@ -618,9 +622,11 @@ namespace Mall.Module.Product
}
}
bool IsUseEducation = false;
if (demodel.Use_Education_Id > 0) {
if (demodel.Use_Education_Id > 0)
{
var couponModel = GoodsCouponList.Where(x => x.GoodsId == item.GoodsId).FirstOrDefault();
if (couponModel != null) {
if (couponModel != null)
{
EducationNum += 1;
EducationMoney += couponModel.TotalMoney;
TotalGoodsMoney -= couponModel.TotalMoney;//总价格需减去课程卡金额
......@@ -734,7 +740,8 @@ namespace Mall.Module.Product
user_coupon_id = CouponsMoney > 0 ? demodel.User_Coupon_Id ?? 0 : 0
},
integral = IntegralObj,
education = new {
education = new
{
enabled = true,
use = demodel.Use_Education_Id > 0,
use_education_id = demodel.Use_Education_Id ?? 0,
......@@ -766,7 +773,7 @@ namespace Mall.Module.Product
promptNoSuperiorFY = PromptNoSuperiorFY,
total_price = TotalGoodsMoney,
price_enable = true,
template_message_list
template_message_list
};
#endregion
return ApiResult.Success("", Robj);
......@@ -792,7 +799,7 @@ namespace Mall.Module.Product
{
return ApiResult.Failed("您在黑名单状态无法下单,请联系管理员核实");
}
decimal TotalMoney = 0;
string GoodsIds = "";
int TotalIntegralNumber = 0;//总使用积分
......@@ -914,7 +921,8 @@ namespace Mall.Module.Product
{
return ApiResult.Failed("有商品不存在或者商品已失效");
}
if (gmodel.GoodsClassify != 2) {
if (gmodel.GoodsClassify != 2)
{
return ApiResult.Failed("有非网课类商品");
}
var categoryList = clist.Where(x => x.GoodsId == item.GoodsId).ToList();
......@@ -927,7 +935,7 @@ namespace Mall.Module.Product
item.PresentFXGrade = gmodel.PresentFXGrade ?? 0;//赠送粉象分销等级
item.PresentFXMonth = gmodel.PresentFXMonth ?? 0;
item.CategoryIdList = categoryList.Select(x => x.CategoryId ?? 0).ToList();
item.CategoryIdList = categoryList.Select(x => x.CategoryId ?? 0).ToList();
#region 规格
item.SmallShopsCostPrice = gmodel.SellingPrice ?? 0;
......@@ -1508,7 +1516,8 @@ namespace Mall.Module.Product
member_UserRepository.Update(keyValues, wheres, trans);
#region 课程卡使用
if (demodel.Use_Education_Id > 0 && EducationNum > 0) {
if (demodel.Use_Education_Id > 0 && EducationNum > 0)
{
education_MemberUseCouponRepository.Insert(new Model.Entity.Education.RB_Education_MemberUseCoupon()
{
Id = 0,
......@@ -1523,7 +1532,8 @@ namespace Mall.Module.Product
UseHeXiao = EducationNum
}, trans);
var educationModel = eList.FirstOrDefault();
if (educationModel != null) {
if (educationModel != null)
{
//更新用户课程卡 已使用数量
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Education_MemberCoupon_Extend.UseHeXiao),educationModel.UseHeXiao + EducationNum}
......@@ -1644,7 +1654,8 @@ namespace Mall.Module.Product
{
//修改订单明细 其他收入
var list = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { OrderId = orderModel.OrderId, TenantId = tenantId, MallBaseId = mallBaseId });
foreach (var item in list) {
foreach (var item in list)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail.YSMoney),0},
{ nameof(RB_Goods_OrderDetail.ServiceCharge),0}
......@@ -1712,10 +1723,10 @@ namespace Mall.Module.Product
{
TenantId = demodel.TenantId,
MallBaseId = demodel.MallBaseId,
QGoodsIds=GoodsIds
QGoodsIds = GoodsIds
});
var GList = goodsRepository.GetSingleListForGoodsSubName(new RB_Goods_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, GoodsIds = GoodsIds }, true);
#region 查询商品申请售后
string OrderDetialIds = string.Join(",", dlist.Select(x => x.Id));
var afterSaleList = goods_OrderAfterSaleRepository.GetList(new RB_Goods_OrderAfterSale_Extend() { OrderDetailIds = OrderDetialIds, Type = 1, MallBaseId = demodel.MallBaseId, TenantId = demodel.TenantId });
......@@ -3701,14 +3712,16 @@ namespace Mall.Module.Product
#endregion
#region 储值卡退回
if (omodel.DepositId > 0) {
if (omodel.DepositId > 0)
{
var remodel = goods_OrderAfterSaleRepository.GetEntity(reOrderId);
var dlist = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = omodel.OrderId });
if (dlist.Where(x => x.DepositMoney > 0 && x.DepositRefundMoney == 0).Count() == 1)
{
//最后一个退款 对比一下总额 与 明细金额
var dmodel = dlist.Where(x => x.DepositMoney > 0 && x.DepositRefundMoney == 0).FirstOrDefault();
if (dmodel.Id == remodel.OrderDetialId) {
if (dmodel.Id == remodel.OrderDetialId)
{
decimal RMoney = omodel.DepositMoney - (dlist.Sum(x => x.DepositRefundMoney));//怕运费产生四舍五入问题,直接用总的 - 其他已退回的
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail_Extend.DepositRefundMoney),RMoney}
......@@ -3758,9 +3771,11 @@ namespace Mall.Module.Product
}
}
}
else {
else
{
var dmodel = dlist.Where(x => x.Id == remodel.OrderDetialId).FirstOrDefault();
if (dmodel != null && dmodel.DepositMoney > 0 && dmodel.DepositRefundMoney == 0) {
if (dmodel != null && dmodel.DepositMoney > 0 && dmodel.DepositRefundMoney == 0)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail_Extend.DepositRefundMoney),dmodel.DepositMoney + dmodel.DepositFreightMoney}
};
......@@ -4725,7 +4740,8 @@ namespace Mall.Module.Product
goodsRepository.Update(keyValues1, wheres1, trans);
}
}
if (omodel.DepositId > 0) {
if (omodel.DepositId > 0)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail_Extend.DepositRefundMoney),item.DepositMoney + item.DepositFreightMoney}
};
......@@ -4807,9 +4823,11 @@ namespace Mall.Module.Product
}
}
//储值卡回滚
if (omodel.DepositId > 0) {
if (omodel.DepositId > 0)
{
var depositModel = member_DepositBuyRepository.GetEntity(omodel.DepositId);
if (depositModel != null) {
if (depositModel != null)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Member_DepositBuy_Extend.SurplusPrice),depositModel.SurplusPrice + omodel.DepositMoney}
};
......@@ -5155,7 +5173,7 @@ namespace Mall.Module.Product
}
var detailList = new List<object>() {
new
{
{
financeConfig.CostTypeId,
Number = 1,
OriginalMoney = Money,
......@@ -6137,7 +6155,8 @@ namespace Mall.Module.Product
#region 调高成本重新返佣
// ld 2021-09-17
//暂只有 赞羊使用
if (orderModel.MallBaseId == 1 && orderModel.FXCommission > 0 && orderModel.OriginalCostMoney > 0 && costMoney > orderModel.OriginalCostMoney && (orderModel.Unit_Price ?? 0) - orderModel.OriginalCostMoney > 0) {
if (orderModel.MallBaseId == 1 && orderModel.FXCommission > 0 && orderModel.OriginalCostMoney > 0 && costMoney > orderModel.OriginalCostMoney && (orderModel.Unit_Price ?? 0) - orderModel.OriginalCostMoney > 0)
{
//先计算 调高返佣后 应发佣金
decimal NewCommission = (orderModel.FXCommission / ((orderModel.Unit_Price ?? 0) - orderModel.OriginalCostMoney)) * ((orderModel.Unit_Price ?? 0) - costMoney);
NewCommission -= Math.Round((orderModel.DeductionCommission ?? 0) / (orderModel.Number ?? 1), 2, MidpointRounding.AwayFromZero);// 减去下单已抵扣的佣金 (这个佣金 需除以数量)
......@@ -6413,7 +6432,7 @@ namespace Mall.Module.Product
}
}
//只插入非抵扣类型的佣金
foreach (var qitem in gocList.Where(x => !((x.Commission ?? 0) == 0 && (x.DeductionCommission??0) >0)))
foreach (var qitem in gocList.Where(x => !((x.Commission ?? 0) == 0 && (x.DeductionCommission ?? 0) > 0)))
{
qitem.Commission = (qitem.Commission ?? 0) * (item.Number ?? 0);
goods_OrderCommissionRepository.Insert(qitem, trans);
......@@ -6969,7 +6988,7 @@ namespace Mall.Module.Product
item.GoodsRelevanceList,
});
}
return ApiResult.Success("", new
{
......@@ -8095,6 +8114,52 @@ namespace Mall.Module.Product
return list;
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Comment_Extend> GetAppletCommentList(RB_Goods_Comment_Extend dmodel)
{
var list = goods_CommentRepository.GetAppletCommentList(dmodel);
if (list.Any())
{
//List<RB_Member_User_Extend> userList = new List<RB_Member_User_Extend>();
//if (list.Where(x => x.UserId > 0).Any())
//{
// string uids = string.Join(",", list.Where(x => x.UserId > 0).Select(x => x.UserId ?? 0));
// userList = member_UserRepository.GetList(new RB_Member_User_Extend() { UserIds = uids, TenantId = dmodel.TenantId, MallBaseId = dmodel.MallBaseId });
//}
foreach (var item in list)
{
item.CommentLabelList = new List<string>();
if (!string.IsNullOrWhiteSpace(item.LabelIds))
{
item.CommentLabelList = item.LabelIds.Split(",")?.ToList() ?? new List<string>();
}
//评论图片
//item.CommentImgList = new List<string>();
//if (!string.IsNullOrEmpty(item.CommentImage))
//{
// item.CommentImgList = JsonConvert.DeserializeObject<List<string>>(item.CommentImage);
//}
//if (item.UserId > 0)
//{
// item.UserPhotoPath = userList.Where(x => x.Id == item.UserId).FirstOrDefault()?.Photo ?? "";
//}
//if (item.UserId == 0 && item.UserPhoto > 0)
//{
// item.UserPhotoPath = material_InfoRepository.GetEntity(item.UserPhoto)?.Path ?? "";
//}
}
}
return list;
}
/// <summary>
/// 管理新增评论
/// </summary>
......@@ -8142,11 +8207,11 @@ namespace Mall.Module.Product
//}
//更新订单商品为已评价
Dictionary<string, object> keyValues = new Dictionary<string, object>()
Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(RB_Goods_OrderDetail.IsComment),1}
};
List<WhereHelper> wheres = new List<WhereHelper>()
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper()
{
......@@ -8173,7 +8238,7 @@ namespace Mall.Module.Product
{
nameof(RB_Goods.CourseScore),score}
};
List<WhereHelper> wheres1 = new List<WhereHelper>()
List<WhereHelper> wheres1 = new List<WhereHelper>()
{
new WhereHelper()
{
......@@ -8197,7 +8262,7 @@ namespace Mall.Module.Product
{
{ nameof(RB_Goods_Order.OrderStatus),OrderStatusEnum.Completed}
};
List<WhereHelper> wheres1 = new List<WhereHelper>()
List<WhereHelper> wheres1 = new List<WhereHelper>()
{
new WhereHelper()
{
......@@ -8223,12 +8288,12 @@ namespace Mall.Module.Product
if (disInfo != null && disInfo.AuditStatus == DistributorAuditStatusEnum.Audited)
{
//更新分销商佣金
Dictionary<string, object> keyValues2 = new Dictionary<string, object>()
Dictionary<string, object> keyValues2 = new Dictionary<string, object>()
{
{ nameof(RB_Distributor_Info_Extend.TotalCommission),(disInfo.TotalCommission??0)+(item.Commission??0)},
{ nameof(RB_Distributor_Info_Extend.CommissionWithdrawal),(disInfo.CommissionWithdrawal??0)+(item.Commission??0)},
};
List<WhereHelper> wheres2 = new List<WhereHelper>()
List<WhereHelper> wheres2 = new List<WhereHelper>()
{
new WhereHelper()
{
......@@ -8241,12 +8306,12 @@ namespace Mall.Module.Product
if (flag1)
{
//更新返佣状态
Dictionary<string, object> keyValues3 = new Dictionary<string, object>()
Dictionary<string, object> keyValues3 = new Dictionary<string, object>()
{
{ nameof(RB_Goods_OrderCommission_Extend.CommissionState),2},
{ nameof(RB_Goods_OrderCommission_Extend.UpdateDate),DateTime.Now},
};
List<WhereHelper> wheres3 = new List<WhereHelper>()
List<WhereHelper> wheres3 = new List<WhereHelper>()
{
new WhereHelper()
{
......@@ -8279,11 +8344,11 @@ namespace Mall.Module.Product
//保存积分赠送
var umodel = member_UserRepository.GetEntity(demodel.UserId);
//用户订单数增加
Dictionary<string, object> keyValues12 = new Dictionary<string, object>()
Dictionary<string, object> keyValues12 = new Dictionary<string, object>()
{
{ nameof(RB_Member_User_Extend.Integral), (umodel.Integral ?? 0)+IntegralGoodsPresent }
};
List<WhereHelper> wheres12 = new List<WhereHelper>()
List<WhereHelper> wheres12 = new List<WhereHelper>()
{
new WhereHelper()
{
......@@ -8475,9 +8540,39 @@ namespace Mall.Module.Product
{
Id = Convert.ToInt32(item.Value),
Name = item.Key,
Count = cmodel?.CommentNum ?? 0
Count = cmodel?.CommentNum ?? 0,
Type = 1,
});
}
if (tenantId == 29)
{
var listComment = GetAppletCommentList(new RB_Goods_Comment_Extend { GoodsId = goodsId, TenantId = tenantId, MallBaseId = mallBaseId });
//获取标签信息
var commentLabelList = GetCommentLabelListModule(new RB_Comment_Label_Extend { TenantId = tenantId, MallBaseId = mallBaseId });
foreach (var itemLabel in commentLabelList)
{
itemLabel.CommentNum = 0;
foreach (var item in listComment)
{
if (item.CommentLabelList != null && item.CommentLabelList.Any(x => x == itemLabel.Id.ToString()))
{
itemLabel.CommentNum += 1;
}
}
if (itemLabel.CommentNum > 0) {
RList.Add(new
{
Id = Convert.ToInt32(itemLabel.Id),
Name = itemLabel.Name,
Count = itemLabel.CommentNum,
Type = 2,
});
}
}
// RList.AddRange(commentLabelList.Where(x => x.CommentNum > 0).Select(x => new { Count = x.CommentNum, x.Name, x.Id, Type = 2 }));
}
return ApiResult.Success("", new
{
TotalNum = clist.Sum(x => x.CommentNum),
......@@ -9624,9 +9719,11 @@ namespace Mall.Module.Product
},
};
bool flag = eduGoods_OrderRepository.Update(keyValues1, wheres1);
if (flag) {
if (flag)
{
var eduList = eduGoods_OrderDetailRepository.GetList(new RB_Goods_OrderDetail_ViewModel() { OrderId = eduOrderId });
foreach (var qitem in eduList) {
foreach (var qitem in eduList)
{
var dmdoel = dlist.Where(x => x.Id == qitem.MallOrderDetailId).FirstOrDefault();
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail_ViewModel.FreightCostMoney), dmdoel?.FreightCostMoney??0}
......
......@@ -1611,6 +1611,7 @@ namespace Mall.Module.Product
decimal MaxSellMoney = model.SellingPrice ?? 0;
model.SpecificationList = new List<RB_Goods_Specification_Extend>();
model.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
List<RB_Goods_SpecificationPrice_Extend> specificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
if (model.IsCustomSpecification == 1)
{
model.SpecificationList = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
......@@ -2000,7 +2001,7 @@ namespace Mall.Module.Product
else
{
//判断是否开启和平返佣
List<WhereHelper> wheres = new List<WhereHelper>()
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper()
{
......@@ -2026,7 +2027,7 @@ namespace Mall.Module.Product
FiledValue=MallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
};
if (distributor_HPCommissionRepository.Exists(wheres))
{
//获取和平分销返佣
......@@ -2144,6 +2145,7 @@ namespace Mall.Module.Product
{
if (model.SpecificationPriceList.Any() && model.SpecificationList.Any())
{
List<RB_Goods_Specification_Extend> SpecificationListToPrice = new List<RB_Goods_Specification_Extend>();
List<RB_Goods_SpecificationValue_Extend> SpecificationValueListToPrice = new List<RB_Goods_SpecificationValue_Extend>();
bool IsHaveSellingPriceZero = false;
......@@ -2175,6 +2177,7 @@ namespace Mall.Module.Product
for (int i = 0; i < ssarr.Length; i++)
{
var smodel = model.SpecificationList[i];
if (IsHaveSellingPriceZero && !SpecificationListToPrice.Where(x => x.Id == smodel.Id).Any())
{
SpecificationListToPrice.Add(smodel);
......@@ -2184,6 +2187,21 @@ namespace Mall.Module.Product
{
SpecificationValueListToPrice.Add(svmodel);
}
//2024-02-19 add by:W 日期格式的话过滤掉小于当前日期的价格
if (smodel.IsDateFormat == 1 && !string.IsNullOrWhiteSpace(svmodel?.Name ?? ""))
{
try
{
DateTime startTime = Convert.ToDateTime(svmodel?.Name ?? "");
if (startTime >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")))
{
specificationPriceList.Add(item);
}
}
catch (Exception ex)
{
}
}
attr_list.Add(new
{
attr_group_name = smodel.Name,
......@@ -2401,7 +2419,16 @@ namespace Mall.Module.Product
{
if (model.IsCustomSpecification == 1 && model.SpecificationPriceList != null && model.SpecificationPriceList.Count > 0)
{
var tempList = model.SpecificationPriceList.Where(x => x.SellingPrice > 0)?.ToList() ?? new List<RB_Goods_SpecificationPrice_Extend>();
List<RB_Goods_SpecificationPrice_Extend> tempList = new List<RB_Goods_SpecificationPrice_Extend>();
if (model?.SpecificationList?.Where(x => x.IsDateFormat == 1)?.Count() > 0)//有日期格式的规格
{
tempList = specificationPriceList.Where(x => x.SellingPrice > 0)?.ToList() ?? new List<RB_Goods_SpecificationPrice_Extend>();
}
else
{
tempList = model.SpecificationPriceList.Where(x => x.SellingPrice > 0)?.ToList() ?? new List<RB_Goods_SpecificationPrice_Extend>();
}
if (tempList != null && tempList.Count > 0)
{
price_member_min = price_min = tempList?.Min(x => x.SellingPrice ?? 0) ?? 0;
......@@ -2443,7 +2470,7 @@ namespace Mall.Module.Product
GetGoodsOrderPeopleInfo(out decimal payment_amount, out int payment_num, out int payment_order, out int payment_people, goodsId);
#endregion
#region 返回参数
......@@ -2485,7 +2512,7 @@ namespace Mall.Module.Product
ImagePath = ""
}
};
model.SpecificationList = new List<RB_Goods_Specification_Extend>
model.SpecificationList = new List<RB_Goods_Specification_Extend>
{
new RB_Goods_Specification_Extend()
{
......@@ -2585,7 +2612,7 @@ namespace Mall.Module.Product
attr_group_name = x.Name,
//购买次数(进阶小课堂使用)
service_time = model.ServiceTime,
attr_list =attrList,
attr_list = attrList,
//dateList,
});
}
......@@ -2623,7 +2650,7 @@ namespace Mall.Module.Product
// pic_url = z.ImagePath
// })
//}),
attr_groups= groupsList,
attr_groups = groupsList,
attr = priceList,
goodsRelevanceList = goodsRelevanceList?.Select(qitem => new
{
......@@ -2681,7 +2708,7 @@ namespace Mall.Module.Product
video_url = model?.VideoAddress ?? "",
level_show = (userModel?.MemberGrade ?? 0) > 0 ? 1 : 2,//是否显示会员价
is_sales = model.GoodsStatus == 1 && model.InventoryNum > 0 ? 1 : 2,//是否可购买
//goods_num = model.InventoryNum,
goods_no = model.GoodsNumbers,
goods_weight = model.GoodsWeight,
......@@ -8194,6 +8221,33 @@ namespace Mall.Module.Product
foreach (var item in model.SpecificationList)
{
item.SpecificationValueList = svlist.Where(x => x.SpecificationId == item.Id).ToList();
#region 注释过期日期对应的规格 2024-02-19 add by:W
//var tempSpecificationValueList = svlist.Where(x => x.SpecificationId == item.Id).ToList();
//if (item.IsDateFormat == 1)
//{
// item.SpecificationValueList = new List<RB_Goods_SpecificationValue_Extend>();
// DateTime nowDay = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
// foreach (var itemSpecificationValue in tempSpecificationValueList)
// {
// try
// {
// if (!string.IsNullOrWhiteSpace(itemSpecificationValue?.Name ?? "")&&Convert.ToDateTime(itemSpecificationValue?.Name ?? "") >= nowDay)
// {
// item.SpecificationValueList.Add(itemSpecificationValue);
// }
// }
// catch (Exception ex)
// {
// }
// }
//}
//else
//{
// item.SpecificationValueList = tempSpecificationValueList;
//}
#endregion
}
}
int SortNum = 1;
......
......@@ -39,6 +39,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Comment_Label_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND a.{nameof(RB_Comment_Label_Extend.Name)} like '%{query.Name}%'");
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Comment_Label_Extend.Id));
return GetPage<RB_Comment_Label_Extend>(pageIndex, pageSize, out totalCount, builder.ToString()).ToList();
......@@ -69,6 +73,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Comment_Label_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND a.{nameof(RB_Comment_Label_Extend.Name)} like '%{query.Name}%'");
}
}
builder.AppendFormat(" ORDER BY A.{0} DESC ", nameof(RB_Comment_Label_Extend.Id));
return Get<RB_Comment_Label_Extend>(builder.ToString()).ToList();
......
......@@ -88,7 +88,10 @@ where {where} order by c.Id desc";
{
where += $@" and c.{nameof(RB_Goods_Comment.GoodsId)}={dmodel.GoodsId}";
}
if (dmodel.CommentLabelId > 0)
{
where += $@" AND FIND_IN_SET({dmodel.CommentLabelId},c.{nameof(RB_Goods_Comment.LabelIds)})";
}
if (dmodel.UserId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.UserId)}={dmodel.UserId}";
......@@ -109,11 +112,71 @@ where {where} order by c.Id desc";
{
where += $@" and c.{nameof(RB_Goods_Comment.Content)} like '%{dmodel.Content}%'";
}
if (dmodel.CommentGrade.HasValue && dmodel.CommentGrade.Value > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.CommentGrade)}={(int)dmodel.CommentGrade}";
}
string sql = $@"SELECT c.* FROM RB_Goods_Comment c where {where} order by c.Is_Top asc,c.Id desc";
return GetPage<RB_Goods_Comment_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Comment_Extend> GetAppletCommentList(RB_Goods_Comment_Extend dmodel)
{
string where = $" 1=1 and c.{nameof(RB_Goods_Comment.Status)}=0 ";
if (dmodel.TenantId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.Id)}={dmodel.Id}";
}
if (dmodel.GoodsId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.GoodsId)}={dmodel.GoodsId}";
}
if (dmodel.UserId > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.UserId)}={dmodel.UserId}";
}
if (dmodel.PlatformSource > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.PlatformSource)}={(int)dmodel.PlatformSource}";
}
if (dmodel.Is_Show > 0)
{
where += $@" and c.{nameof(RB_Goods_Comment.Is_Show)}={dmodel.Is_Show}";
}
if (!string.IsNullOrEmpty(dmodel.UserName))
{
where += $@" and c.{nameof(RB_Goods_Comment.UserName)} like '%{dmodel.UserName}%'";
}
if (!string.IsNullOrEmpty(dmodel.Content))
{
where += $@" and c.{nameof(RB_Goods_Comment.Content)} like '%{dmodel.Content}%'";
}
string sql = $@"SELECT c.* FROM RB_Goods_Comment c where {where} order by c.Is_Top asc,c.Id desc";
return Get<RB_Goods_Comment_Extend>(sql).ToList();
}
/// <summary>
/// 获取评论数量统计
/// </summary>
......
......@@ -522,7 +522,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
if (userInfo.TenantId == 29)
{
if (string.IsNullOrWhiteSpace(demodel?.CustomFormInfo??""))
if (string.IsNullOrWhiteSpace(demodel?.CustomFormInfo ?? ""))
{
return ApiResult.ParamIsNull("请填写旅客信息");
}
......@@ -1385,6 +1385,43 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取商品评论分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetAppletGoodsCommentLabelList()
{
var parms = RequestParm;
RB_Goods_Comment_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Comment_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.Is_Show = 1;
var list = orderModule.GetAppletCommentList(demodel);
//获取标签信息
var commentLabelList = orderModule.GetCommentLabelListModule(new RB_Comment_Label_Extend { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
foreach (var itemLabel in commentLabelList)
{
itemLabel.CommentNum = 0;
foreach (var item in list)
{
if (item.CommentLabelList != null && item.CommentLabelList.Any(x => x == itemLabel.Id.ToString()))
{
itemLabel.CommentNum += 1;
}
}
}
var result = commentLabelList.Where(x => x.CommentNum > 0).Select(x => new { x.CommentNum, x.Name, x.Id });
return ApiResult.Success("", result);
}
/// <summary>
/// 获取商品评论统计
/// </summary>
......
......@@ -4818,16 +4818,13 @@ namespace Mall.WebApi.Controllers.MallBase
Name = parm.GetStringValue("Name"),
Status = 0,
TenantId = userInfo.TenantId,
MallBaseId = userInfo.MallBaseId,
MallBaseId = base.RequestParm.MallBaseId,
};
if (extModel.Id > 0)
{
extModel.UpdateDate = DateTime.Now;
}
else
if (extModel.Id == 0)
{
extModel.CreateDate = DateTime.Now;
}
extModel.UpdateDate = DateTime.Now;
bool flag = orderModule.SetCommentLabelModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......@@ -4869,16 +4866,18 @@ namespace Mall.WebApi.Controllers.MallBase
var parm = JObject.Parse(base.RequestParm.msg.ToString());
ResultPageModel pageModel = new ResultPageModel()
{
pageIndex=parm.GetInt("pageIndex"),
pageSize=parm.GetInt("pageSize"),
pageIndex = parm.GetInt("pageIndex"),
pageSize = parm.GetInt("pageSize"),
};
var query = new RB_Comment_Label_Extend()
{
Name=parm.GetStringValue("Name"),
Name = parm.GetStringValue("Name"),
TenantId = base.RequestParm.TenantId,
MallBaseId = base.RequestParm.MallBaseId,
};
var dataList = orderModule.GetCommentLabelPageModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = dataList;
pageModel.pageData = dataList.Select(x => new { x.Id, x.MallBaseId, x.TenantId, x.Name, UpdateDate = x.UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") });
return ApiResult.Success(data: pageModel);
}
......@@ -4893,8 +4892,10 @@ namespace Mall.WebApi.Controllers.MallBase
var query = new RB_Comment_Label_Extend()
{
Name = parm.GetStringValue("Name"),
// TenantId = base.RequestParm.TenantId,
MallBaseId = base.RequestParm.MallBaseId,
};
var dataList = orderModule.GetCommentLabelListModule( query);
var dataList = orderModule.GetCommentLabelListModule(query);
return ApiResult.Success(data: dataList);
}
#endregion
......
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