Commit 2f4c09b1 authored by liudong1993's avatar liudong1993

区域+售后

parent e47294ad
......@@ -18,9 +18,9 @@ namespace Mall.Common.Enum.Goods
[EnumField("快递配送")]
ExpressDistribution = 1,
/// <summary>
/// 到店核销
/// 到店自提
/// </summary>
[EnumField("到店核销")]
[EnumField("到店自提")]
VerificationShop = 2,
/// <summary>
/// 同城配送
......
......@@ -43,6 +43,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public int? GoodsId { get; set; }
/// <summary>
/// 分销用户id
/// </summary>
public int? DistributionUserId { get; set; }
/// <summary>
/// 商品订单数量
/// </summary>
public int? OrderNum { get; set; }
......
......@@ -1136,6 +1136,19 @@ namespace Mall.Module.Product
var mpriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsIds = GoodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
//区域
var AreaList = goods_AreaRepository.GetList(new RB_Goods_Area_Extend() { GoodsIds = GoodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
#region 查询外部设置区域限购
List<int> RAreaList = new List<int>();
var RulesAreaModel = logistics_RulesRepository.GetLogisticsRulesList(new Model.Extend.BaseSetUp.RB_Logistics_Rules_Extend() { RulesType = Common.Enum.MallBase.RulesTypeEnum.AreaBuy, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }).FirstOrDefault();
if (RulesAreaModel != null && RulesAreaModel.IsOpenMinPrice == 1)
{
var RegionAreaList = logistics_RulesRegionRepository.GetListForSingle(new Model.Extend.BaseSetUp.RB_Logistics_RulesRegion_Extend() { RulesPriceId = RulesAreaModel.ID, RulesType = Common.Enum.MallBase.RulesTypeEnum.AreaBuy, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
if (RegionAreaList.Any()) {
//允许以下区域购买
RAreaList = RegionAreaList.Select(x => x.RegionId).Distinct().ToList();
}
}
#endregion
//返佣
var DistributionCommissionList = new List<RB_Goods_DistributionCommission_Extend>();
if (demodel.DetailList.Where(x => x.SeparateDistribution == 1).Any())
......@@ -1687,12 +1700,27 @@ namespace Mall.Module.Product
var areaGoods = AreaList.Where(x => x.GoodsId == item.GoodsId).ToList();
bool address_disabled = false;
if (gmodel.IsAreaBuy == 1 && areaGoods.Any())
if (demodel.DeliveryMethod != OrderDeliveryMethodEnum.VerificationShop)
{
if (!areaGoods.Where(x => disList.Contains(x.AreaId ?? 0)).Any())
if (gmodel.IsAreaBuy == 1 && areaGoods.Any())
{
if (!areaGoods.Where(x => disList.Contains(x.AreaId ?? 0)).Any())
{
address_disabled = true;
address_enable = false;
}
}
else
{
address_disabled = true;
address_enable = false;
//验证基础设置区域购买
if (RAreaList.Any())
{
if (!RAreaList.Where(x => disList.Contains(x)).Any())
{
address_disabled = true;
address_enable = false;
}
}
}
}
......@@ -4079,7 +4107,74 @@ namespace Mall.Module.Product
OperatorEnum=OperatorEnum.Equal
}
};
return goods_OrderAfterSaleRepository.Update(keyValues, wheres);
bool flag = goods_OrderAfterSaleRepository.Update(keyValues, wheres);
if (flag) {
//流程
goods_OrderAfterSaleLogRepository.Insert(new RB_Goods_OrderAfterSaleLog()
{
Id = 0,
Content = "买家已发货",
Type = 1,
ReOrderId = reOrderId,
TenantId = tenantId,
CreateDate = DateTime.Now,
MallBaseId = mallBaseId
});
return true;
}
return flag;
}
/// <summary>
/// 后台处理买家发货
/// </summary>
/// <param name="reOrderId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetUserOrderAfterSaleSendGoods(int reOrderId, int tenantId, int mallBaseId)
{
var omodel = goods_OrderAfterSaleRepository.GetEntity(reOrderId);
if (omodel == null)
{
return false;
}
if (omodel.ReOrderStatus != OrderAfterSaleStatusEnum.DeliveryToBuyer)
{
return false;
}
Dictionary<string, object> keyValues = new Dictionary<string, object>();
if (omodel.Type == 2)
{
keyValues.Add(nameof(RB_Goods_OrderAfterSale.ReOrderStatus), OrderAfterSaleStatusEnum.ReceivedBySeller);
}
else {
keyValues.Add(nameof(RB_Goods_OrderAfterSale.ReOrderStatus), OrderAfterSaleStatusEnum.RefundedBySeller);
}
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_OrderAfterSale.ReOrderId),
FiledValue=reOrderId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = goods_OrderAfterSaleRepository.Update(keyValues, wheres);
if (flag)
{
//流程
goods_OrderAfterSaleLogRepository.Insert(new RB_Goods_OrderAfterSaleLog()
{
Id = 0,
Content = "管理员操作无需客人发货",
Type = 1,
ReOrderId = reOrderId,
TenantId = tenantId,
CreateDate = DateTime.Now,
MallBaseId = mallBaseId
});
return true;
}
return flag;
}
/// <summary>
......
......@@ -1662,6 +1662,26 @@ namespace Mall.Module.Product
IsAllowShare = 2;
}
if ((model.IsCustomSpecification ?? 2) != 1) {
var VauleL = new List<RB_Goods_SpecificationValue_Extend>
{
new RB_Goods_SpecificationValue_Extend()
{
Sort = 0,
Name = model.DefaultSpecificationName,
ImagePath = ""
}
};
model.SpecificationList = new List<RB_Goods_Specification_Extend> {
new RB_Goods_Specification_Extend()
{
Sort = 0,
Name = "规格",
SpecificationValueList = VauleL
}
};
}
return new
{
goods = new
......
......@@ -57,6 +57,42 @@ LEFT JOIN {DestinationTableName} as c on b.ParentID = c.ID WHERE a.{nameof(RB_
}
/// <summary>
/// 获取物流地区列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Logistics_RulesRegion_Extend> GetListForSingle(RB_Logistics_RulesRegion_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@$" SELECT a.* FROM {TableName} as a WHERE a.{nameof(RB_Logistics_RulesRegion_Extend.Status)}=0");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_RulesRegion_Extend.TenantId)}={query.TenantId}");
}
if (query.RulesType > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_RulesRegion_Extend.RulesType)}={(int)query.RulesType}");
}
if (query.MallBaseId > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_RulesRegion_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.RulesPriceId > 0)
{
builder.Append($" AND a.{nameof(RB_Logistics_RulesRegion_Extend.RulesPriceId)}={query.RulesPriceId}");
}
if (!string.IsNullOrWhiteSpace(query.PriceIds))
{
builder.Append($" AND a.{nameof(RB_Logistics_RulesRegion_Extend.RulesPriceId)} in ({query.PriceIds})");
}
}
return Get<RB_Logistics_RulesRegion_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -326,10 +326,15 @@ where {where} order by o.CreateDate desc";
{
where += $@" and o.{nameof(RB_Goods_Order.Recycled)}={(int)dmodel.Recycled}";
}
if (dmodel.DistributionUserId > 0)
{
where += $@" and oc.{nameof(RB_Goods_OrderCommission.UserId)}={dmodel.DistributionUserId}";
}
string sql = $@"SELECT o.*,u.Name as UserName FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
INNER JOIN rb_member_user u on o.UserId=u.Id
LEFT JOIN rb_goods_ordercommission oc on o.OrderId = oc.OrderId
where {where} group by o.OrderId order by o.CreateDate desc";
return GetPage<RB_Goods_Order_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
......
......@@ -1757,7 +1757,25 @@ namespace Mall.WebApi.Controllers.MallBase
}
/// <summary>
/// 后台处理用户发货
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetUserOrderAfterSaleSendGoods()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
JObject parms = JObject.Parse(req.msg.ToString());
int ReOrderId = parms.GetInt("ReOrderId", 0);
if (ReOrderId <= 0)
{
return ApiResult.ParamIsNull();
}
bool flag = orderModule.SetUserOrderAfterSaleSendGoods(ReOrderId, userInfo.TenantId, userInfo.MallBaseId);
if (flag) { return ApiResult.Success(); } else { return ApiResult.Failed(); }
}
/// <summary>
......
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