feat 添加订单详情接口(80%)
This commit is contained in:
parent
5983f3d743
commit
ad0d91ca2f
@ -12,8 +12,9 @@ namespace ARW.Model.Dto.Api.OrderManage.OrderRefunds
|
||||
/// @author lwh
|
||||
/// @date 2023-10-16
|
||||
/// </summary>
|
||||
public class OrderRefundQueryDtoApi : PagerInfo
|
||||
public class OrderRefundQueryDtoApi : PagerInfo
|
||||
{
|
||||
public long CustomerGuid { get; set; }
|
||||
public int? RefundType { get; set; }
|
||||
public int? RefundReason { get; set; }
|
||||
public int? GoodsReceiveStatus { get; set; }
|
||||
|
36
ARW.Model/Dto/Api/OrderManage/Orders/AddCommentDto.cs
Normal file
36
ARW.Model/Dto/Api/OrderManage/Orders/AddCommentDto.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.OrderManage.Orders;
|
||||
|
||||
namespace ARW.Model.Dto.Api.OrderManage.Orders
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 添加评论对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-19
|
||||
/// </summary>
|
||||
public class AddCommentDto
|
||||
{
|
||||
public long CustomerGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "订单guid不能为空")]
|
||||
public long OrderGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "商品guid不能为空")]
|
||||
public long GoodsGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "评分分数不能为空")]
|
||||
public float GoodsCommentRating { get; set; }
|
||||
|
||||
|
||||
[Required(ErrorMessage = "评价内容不能为空")]
|
||||
public string GoodsCommentContent { get; set; }
|
||||
|
||||
public string GoodsCommentImages { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ namespace ARW.Model.Dto.Api.OrderManage.Orders
|
||||
/// </summary>
|
||||
public class OrderQueryDtoApi : PagerInfo
|
||||
{
|
||||
public long CustomerGuid { get; set; }
|
||||
public string OrderNumber { get; set; }
|
||||
public int? PayType { get; set; }
|
||||
public int? PayStatus { get; set; }
|
||||
@ -36,5 +37,5 @@ namespace ARW.Model.Dto.Api.OrderManage.Orders
|
||||
[Required(ErrorMessage = "OrderGuid不能为空")]
|
||||
public long OrderGuid { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
62
ARW.Model/Vo/Api/OrderManage/Orders/Logistics.cs
Normal file
62
ARW.Model/Vo/Api/OrderManage/Orders/Logistics.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ARW.Model.Vo.Api.OrderManage.Orders
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单详情地址展示对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-19
|
||||
/// </summary>
|
||||
public class Logistics
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 收货地址Guid
|
||||
/// </summary>
|
||||
public long ReceiverAddressId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 收货人名称
|
||||
/// </summary>
|
||||
public string ReceiverName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 收货人电话
|
||||
/// </summary>
|
||||
public string ReceiverPhone { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 省
|
||||
/// </summary>
|
||||
public string ReceiverProvince { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 市
|
||||
/// </summary>
|
||||
public string ReceiverCity { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 区
|
||||
/// </summary>
|
||||
public string receiverCountry { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 详细地址
|
||||
/// </summary>
|
||||
public string ReceiverAddress { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -104,79 +104,90 @@ namespace ARW.Model.Vo.Api.OrderManage.Orders
|
||||
{
|
||||
[EpplusIgnore]
|
||||
public int OrderId { get; set; }
|
||||
|
||||
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusIgnore]
|
||||
public long OrderGuid { get; set; }
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusTableColumn(Header = "商品guid")]
|
||||
public long GoodsGuid { get; set; }
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusTableColumn(Header = "订单流水guid")]
|
||||
public long PaymentGuid { get; set; }
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusTableColumn(Header = "客户guid")]
|
||||
public long CustomerGuid { get; set; }
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusIgnore]
|
||||
public long? ShopGuid { get; set; }
|
||||
[EpplusTableColumn(Header = "订单号")]
|
||||
public string OrderNumber { get; set; }
|
||||
[EpplusTableColumn(Header = "商品总金额")]
|
||||
public decimal GoodsTotalAmoun { get; set; }
|
||||
[EpplusTableColumn(Header = "订单金额")]
|
||||
public decimal OrderAmount { get; set; }
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusIgnore]
|
||||
public long? CouponGuid { get; set; }
|
||||
[EpplusIgnore]
|
||||
public decimal CouponMoney { get; set; }
|
||||
[EpplusIgnore]
|
||||
public decimal PointsMoney { get; set; }
|
||||
[EpplusIgnore]
|
||||
public decimal PointsNum { get; set; }
|
||||
[EpplusTableColumn(Header = "实际付款金额(包含运费)")]
|
||||
public decimal PayPrice { get; set; }
|
||||
[EpplusIgnore]
|
||||
public decimal UpdatePrice { get; set; }
|
||||
[EpplusIgnore]
|
||||
public string OrderRemark { get; set; }
|
||||
[EpplusTableColumn(Header = "支付方式(1微信支付 2余额支付)")]
|
||||
public int PayType { get; set; }
|
||||
[EpplusTableColumn(Header = "付款状态(1未付款 2已付款)")]
|
||||
public int PayStatus { get; set; }
|
||||
[EpplusTableColumn(Header = "付款时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
|
||||
public DateTime? PayTime { get; set; }
|
||||
[EpplusTableColumn(Header = "配送方式(1快递配送)")]
|
||||
public int DeliveryType { get; set; }
|
||||
[EpplusTableColumn(Header = "运费金额")]
|
||||
public decimal ExpressPrice { get; set; }
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusIgnore]
|
||||
public long? LogisticsCompanyGuid { get; set; }
|
||||
[EpplusIgnore]
|
||||
public string LogisticsCompany { get; set; }
|
||||
[EpplusIgnore]
|
||||
public string LogisticsTrackingNumber { get; set; }
|
||||
[EpplusTableColumn(Header = "发货状态(1未发货 2已发货)")]
|
||||
public int DeliveryStatus { get; set; }
|
||||
[EpplusIgnore]
|
||||
public DateTime? DeliveryTime { get; set; }
|
||||
[EpplusTableColumn(Header = "收货状态(1未收货 2已收货)")]
|
||||
public int ReceiptStatus { get; set; }
|
||||
[EpplusIgnore]
|
||||
public DateTime? ReceiptTime { get; set; }
|
||||
[EpplusTableColumn(Header = "订单状态(1进行中 2取消 3待取消 4已完成)")]
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 店铺名称
|
||||
/// </summary>
|
||||
public string StoreName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单号
|
||||
/// </summary>
|
||||
public string OrderNo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单状态
|
||||
/// </summary>
|
||||
public int OrderStatus { get; set; }
|
||||
[EpplusIgnore]
|
||||
public decimal PointsBonus { get; set; }
|
||||
[EpplusTableColumn(Header = "订单是否已结算(1未结算 2已结算)")]
|
||||
public int IsSettled { get; set; }
|
||||
[EpplusIgnore]
|
||||
public string TransactionId { get; set; }
|
||||
[EpplusTableColumn(Header = "是否已评价(1否 2是)")]
|
||||
public int IsComment { get; set; }
|
||||
[EpplusTableColumn(Header = "订单来源(1普通订单)")]
|
||||
public int OrderSource { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单总额
|
||||
/// </summary>
|
||||
public decimal TotalAmount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品总额
|
||||
/// </summary>
|
||||
public decimal GoodsAmount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付金额
|
||||
/// </summary>
|
||||
public decimal PaymentAmount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 运费
|
||||
/// </summary>
|
||||
public decimal FreightFee { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 优惠券金额
|
||||
/// </summary>
|
||||
public decimal CouponAmount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单商品
|
||||
/// </summary>
|
||||
public List<OrderItem> OrderItemVOs { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
public Logistics LogisticsVO { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自动取消时间
|
||||
/// </summary>
|
||||
public DateTime AutoCancelTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单状态名称
|
||||
/// </summary>
|
||||
public string OrderStatusName { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
56
ARW.Model/Vo/Api/OrderManage/Orders/OrderItem.cs
Normal file
56
ARW.Model/Vo/Api/OrderManage/Orders/OrderItem.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ARW.Model.Vo.Api.OrderManage.Orders
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单详情商品展示对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-19
|
||||
/// </summary>
|
||||
public class OrderItem
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 商品Id
|
||||
/// </summary>
|
||||
public long SpuId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 商品SkuId
|
||||
/// </summary>
|
||||
public int? SkuId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 商品名称
|
||||
/// </summary>
|
||||
public string GoodsName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品规格
|
||||
/// </summary>
|
||||
public List<OrderGoodsSpecApiVo> Specifications { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :商品图片
|
||||
/// </summary>
|
||||
public string GoodsPictureUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :购买数量
|
||||
/// </summary>
|
||||
public decimal BuyQuantity { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -46,6 +46,7 @@ namespace ARW.Service.Api.BusinessService.OrderManage.OrderRefunds
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<OrderRefund>();
|
||||
|
||||
predicate = predicate.AndIF(parm.CustomerGuid != 0, s => s.CustomerGuid == parm.CustomerGuid);
|
||||
predicate = predicate.AndIF(parm.RefundType != null, s => s.RefundType == parm.RefundType);
|
||||
predicate = predicate.AndIF(parm.RefundReason != null, s => s.RefundReason == parm.RefundReason);
|
||||
predicate = predicate.AndIF(parm.GoodsReceiveStatus != null, s => s.GoodsReceiveStatus == parm.GoodsReceiveStatus);
|
||||
|
@ -18,6 +18,17 @@ using ARW.Repository.Business.GoodsManager.GoodsSpecs.Specs;
|
||||
using ARW.Repository.Business.GoodsManager.GoodsSpecs.SpecValues;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSkus;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.SpecValues;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsComments;
|
||||
using ARW.Repository.Business.GoodsManager.GoodsComments;
|
||||
using ARW.Repository.Business.ShopManager.Shops;
|
||||
using ARW.Model.Models.Business.ShopManager.Shops;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using ARW.Model.Vo.Api.GoodsManager.Goodss;
|
||||
using Newtonsoft.Json;
|
||||
using Senparc.CO2NET.Extensions;
|
||||
using ARW.Repository.Business.OrderManage.OrderCustomerAddreses;
|
||||
using ARW.Repository.Business.Custom.Regions;
|
||||
using ARW.Service.Business.IBusinessService.Custom.Regions;
|
||||
|
||||
namespace ARW.Service.Api.BusinessService.OrderManage.Orders
|
||||
{
|
||||
@ -32,12 +43,16 @@ namespace ARW.Service.Api.BusinessService.OrderManage.Orders
|
||||
{
|
||||
private readonly OrderRepository _OrderRepository;
|
||||
private readonly OrderGoodsRepository _OrderGoodsRepository;
|
||||
private readonly OrderCustomerAddressRepository _OrderCustomerAddressRepository;
|
||||
private readonly GoodsRepository _GoodsRepository;
|
||||
private readonly GoodsSkuRepository _GoodsSkuRepository;
|
||||
private readonly GoodsCommentRepository _GoodsCommentRepository;
|
||||
private readonly SpecRepository _SpecRepository;
|
||||
private readonly SpecValueRepository _SpecValueRepository;
|
||||
private readonly ShopRepository _ShopRepository;
|
||||
private readonly IRegionService _RegionService;
|
||||
|
||||
public OrderServiceImplApi(OrderRepository OrderRepository, OrderGoodsRepository orderGoodsRepository, GoodsRepository goodsRepository, GoodsSkuRepository goodsSkuRepository, SpecRepository specRepository, SpecValueRepository specValueRepository)
|
||||
public OrderServiceImplApi(OrderRepository OrderRepository, OrderGoodsRepository orderGoodsRepository, GoodsRepository goodsRepository, GoodsSkuRepository goodsSkuRepository, SpecRepository specRepository, SpecValueRepository specValueRepository, GoodsCommentRepository goodsCommentRepository, ShopRepository shopRepository, OrderCustomerAddressRepository orderCustomerAddressRepository, IRegionService regionService)
|
||||
{
|
||||
this._OrderRepository = OrderRepository;
|
||||
_OrderGoodsRepository = orderGoodsRepository;
|
||||
@ -45,6 +60,10 @@ namespace ARW.Service.Api.BusinessService.OrderManage.Orders
|
||||
_GoodsSkuRepository = goodsSkuRepository;
|
||||
_SpecRepository = specRepository;
|
||||
_SpecValueRepository = specValueRepository;
|
||||
_GoodsCommentRepository = goodsCommentRepository;
|
||||
_ShopRepository = shopRepository;
|
||||
_OrderCustomerAddressRepository = orderCustomerAddressRepository;
|
||||
_RegionService = regionService;
|
||||
}
|
||||
|
||||
#region Api接口代码
|
||||
@ -60,6 +79,7 @@ namespace ARW.Service.Api.BusinessService.OrderManage.Orders
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<Order>();
|
||||
|
||||
predicate = predicate.AndIF(parm.CustomerGuid != 0, s => s.CustomerGuid == parm.CustomerGuid);
|
||||
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.OrderNumber), s => s.OrderNumber.Contains(parm.OrderNumber));
|
||||
predicate = predicate.AndIF(parm.OrderStatus != 0, s => s.OrderStatus == parm.OrderStatus);
|
||||
predicate = predicate.AndIF(parm.PayType != null, s => s.PayType == parm.PayType);
|
||||
@ -130,9 +150,9 @@ namespace ARW.Service.Api.BusinessService.OrderManage.Orders
|
||||
foreach (var item in orderGoodsList)
|
||||
{
|
||||
var good = await _GoodsRepository.GetFirstAsync(s => s.GoodsGuid == item.GoodsGuid);
|
||||
if(good.GoodsDeductStockType == 1)
|
||||
if (good.GoodsDeductStockType == 1)
|
||||
{
|
||||
if(item.GoodsSkuId != 0)
|
||||
if (item.GoodsSkuId != 0)
|
||||
{
|
||||
var sku = await _GoodsSkuRepository.GetFirstAsync(s => s.GoodsSkuId == item.GoodsSkuId);
|
||||
sku.GoodsSkuStockNum += item.GoodsTotalNum;
|
||||
@ -202,6 +222,44 @@ namespace ARW.Service.Api.BusinessService.OrderManage.Orders
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 评价
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> AddComment(GoodsComment model)
|
||||
{
|
||||
var good = await _GoodsRepository.GetFirstAsync(s => s.GoodsGuid == model.GoodsGuid);
|
||||
var shop = await _ShopRepository.GetFirstAsync(s => s.ShopGuid == good.ShopGuid);
|
||||
|
||||
model.ShopGuid = shop.ShopGuid;
|
||||
|
||||
if (model.GoodsCommentRating < 3)
|
||||
{
|
||||
model.GoodsCommentRatingType = 3;
|
||||
}
|
||||
if (model.GoodsCommentRating < 3.5 && model.GoodsCommentRating >= 2.5)
|
||||
{
|
||||
model.GoodsCommentRatingType = 2;
|
||||
}
|
||||
if (model.GoodsCommentRating >= 3.5)
|
||||
{
|
||||
model.GoodsCommentRatingType = 1;
|
||||
}
|
||||
|
||||
|
||||
model.GoodsCommentRecoverStatus = 1;
|
||||
model.GoodsCommentSort = 100;
|
||||
var response = await _GoodsCommentRepository.InsertReturnSnowflakeIdAsync(model);
|
||||
|
||||
var order = await _OrderRepository.UpdateAsync(f => new Order
|
||||
{
|
||||
IsComment = 2
|
||||
}, f => f.OrderGuid == model.OrderGuid);
|
||||
|
||||
return "添加成功!";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询订单详情(Api)
|
||||
@ -214,44 +272,81 @@ namespace ARW.Service.Api.BusinessService.OrderManage.Orders
|
||||
var query = _OrderRepository
|
||||
.Queryable()
|
||||
.Where(s => s.OrderGuid == parm.OrderGuid)
|
||||
.Select(s => new OrderApiDetailsVo
|
||||
.LeftJoin<Shop>((s, c) => s.ShopGuid == c.ShopGuid)
|
||||
.Select((s, c) => new OrderApiDetailsVo
|
||||
{
|
||||
OrderId = s.OrderId,
|
||||
OrderGuid = s.OrderGuid,
|
||||
PaymentGuid = s.PaymentGuid,
|
||||
CustomerGuid = s.CustomerGuid,
|
||||
OrderNumber = s.OrderNumber,
|
||||
GoodsTotalAmoun = s.GoodsTotalAmoun,
|
||||
OrderAmount = s.OrderAmount,
|
||||
CouponGuid = s.CouponGuid,
|
||||
CouponMoney = s.CouponMoney,
|
||||
PointsMoney = s.PointsMoney,
|
||||
PointsNum = s.PointsNum,
|
||||
PayPrice = s.PayPrice,
|
||||
UpdatePrice = s.UpdatePrice,
|
||||
OrderRemark = s.OrderRemark,
|
||||
PayType = s.PayType,
|
||||
PayStatus = s.PayStatus,
|
||||
PayTime = s.PayTime,
|
||||
DeliveryType = s.DeliveryType,
|
||||
ExpressPrice = s.ExpressPrice,
|
||||
LogisticsCompanyGuid = s.LogisticsCompanyGuid,
|
||||
LogisticsCompany = s.LogisticsCompany,
|
||||
LogisticsTrackingNumber = s.LogisticsTrackingNumber,
|
||||
DeliveryStatus = s.DeliveryStatus,
|
||||
DeliveryTime = s.DeliveryTime,
|
||||
ReceiptStatus = s.ReceiptStatus,
|
||||
ReceiptTime = s.ReceiptTime,
|
||||
OrderStatus = s.OrderStatus,
|
||||
PointsBonus = s.PointsBonus,
|
||||
IsSettled = s.IsSettled,
|
||||
TransactionId = s.TransactionId,
|
||||
IsComment = s.IsComment,
|
||||
OrderSource = s.OrderSource,
|
||||
StoreName = c.ShopName,
|
||||
OrderNo = s.OrderNumber,
|
||||
TotalAmount = s.OrderAmount,
|
||||
GoodsAmount = s.GoodsTotalAmoun,
|
||||
PaymentAmount = s.PayPrice,
|
||||
FreightFee = s.OrderAmount,
|
||||
CouponAmount = s.CouponMoney,
|
||||
Remark = s.OrderRemark,
|
||||
}).Take(1);
|
||||
|
||||
|
||||
return await query.ToJsonAsync();
|
||||
var json = await query.ToJsonAsync();
|
||||
|
||||
if (json != "[]")
|
||||
{
|
||||
json = json.Remove(0, 1);
|
||||
json = json.Substring(0, json.Length - 1);
|
||||
var data = JsonConvert.DeserializeObject<OrderApiDetailsVo>(json);
|
||||
|
||||
// 订单商品
|
||||
var orderItemList = new List<OrderItem>();
|
||||
var orderGoodsList = await _OrderGoodsRepository.GetListAsync(s => s.OrderGuid == data.OrderGuid);
|
||||
foreach (var item in orderGoodsList)
|
||||
{
|
||||
var orderItem = new OrderItem();
|
||||
|
||||
var good = await _GoodsRepository.GetFirstAsync(s => s.GoodsGuid == item.GoodsGuid);
|
||||
|
||||
orderItem.SpuId = item.GoodsGuid;
|
||||
orderItem.SkuId = item.GoodsSkuId;
|
||||
orderItem.GoodsName = good.GoodsName;
|
||||
orderItem.GoodsPictureUrl = good.GoodsPicture.Split(',').First();
|
||||
orderItem.BuyQuantity = item.GoodsTotalNum;
|
||||
|
||||
if (item.GoodsSkuId != 0)
|
||||
{
|
||||
orderItem.Specifications = await GetGoodsSpecList(orderItem.SkuId);
|
||||
}
|
||||
|
||||
orderItemList.Add(orderItem);
|
||||
}
|
||||
data.OrderItemVOs = orderItemList;
|
||||
|
||||
// 用户地址
|
||||
var customerAddress = await _OrderCustomerAddressRepository.GetFirstAsync(s => s.OrderGuid == data.OrderGuid);
|
||||
if (customerAddress != null)
|
||||
{
|
||||
var logistics = new Logistics
|
||||
{
|
||||
ReceiverAddressId = customerAddress.CustomerAddressGuid,
|
||||
ReceiverName = customerAddress.ConsigneeName,
|
||||
ReceiverPhone = customerAddress.Phont,
|
||||
ReceiverProvince = await _RegionService.GetRegionName(customerAddress.ProvinceId),
|
||||
ReceiverCity = await _RegionService.GetRegionName(customerAddress.CityId),
|
||||
receiverCountry = await _RegionService.GetRegionName(customerAddress.RegionId),
|
||||
ReceiverAddress = customerAddress.Detail
|
||||
};
|
||||
data.LogisticsVO = logistics;
|
||||
}
|
||||
|
||||
// 处理订单状态
|
||||
//if ()
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
json = data.ToJson();
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Api.OrderManage.Orders;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsComments;
|
||||
using ARW.Model.Models.Business.OrderManage.Orders;
|
||||
using ARW.Model.Vo.Api.OrderManage.Orders;
|
||||
|
||||
@ -50,6 +51,14 @@ namespace ARW.Service.Api.IBusinessService.OrderManage.Orders
|
||||
Task<string> ConfirmReceipt(OrderDtoApi parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 评价
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddComment(GoodsComment parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取订单详情(Api)
|
||||
/// </summary>
|
||||
|
@ -161,6 +161,18 @@ namespace ARW.Service.Business.BusinessService.Custom.Regions
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取省市区名称
|
||||
/// </summary>
|
||||
/// <param name="id">id</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetRegionName(int id)
|
||||
{
|
||||
var province = await _RegionRepository.GetFirstAsync(s => s.RegionId == id);
|
||||
return province.RegionName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取省市区完整名称
|
||||
|
@ -56,6 +56,13 @@ namespace ARW.Service.Business.IBusinessService.Custom.Regions
|
||||
/// <returns></returns>
|
||||
Task<int> GetRegionId(string RegionCode, int level);
|
||||
|
||||
/// <summary>
|
||||
/// 获取省市区名称
|
||||
/// </summary>
|
||||
/// <param name="id">id</param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetRegionName(int id);
|
||||
|
||||
/// <summary>
|
||||
/// 获取省市区完整名称
|
||||
/// </summary>
|
||||
|
@ -19,6 +19,7 @@ using ARW.Model.Dto.Business.OrderManage.OrderRefunds;
|
||||
using ARW.Service.Business.IBusinessService.OrderManage.OrderRefunds;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
using ARW.Service.Business.IBusinessService.LogisticsManage.LogisticsCompanys;
|
||||
using ARW.Service.System.IService;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.OrderManage.OrderRefunds
|
||||
{
|
||||
@ -34,15 +35,17 @@ namespace ARW.WebApi.Controllers.Api.OrderManage.OrderRefunds
|
||||
{
|
||||
private readonly IOrderRefundServiceApi _OrderRefundServiceApi;
|
||||
private readonly ILogisticsCompanyService _LogisticsCompanyService;
|
||||
private readonly ISysDictDataService _SysDictDataService;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="OrderRefundServiceApi">售后单记录表售后单记录表Api服务</param>
|
||||
public OrderRefundApiController(IOrderRefundServiceApi OrderRefundServiceApi, ILogisticsCompanyService logisticsCompanyService)
|
||||
public OrderRefundApiController(IOrderRefundServiceApi OrderRefundServiceApi, ILogisticsCompanyService logisticsCompanyService, ISysDictDataService sysDictDataService)
|
||||
{
|
||||
_OrderRefundServiceApi = OrderRefundServiceApi;
|
||||
_LogisticsCompanyService = logisticsCompanyService;
|
||||
_SysDictDataService = sysDictDataService;
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +57,9 @@ namespace ARW.WebApi.Controllers.Api.OrderManage.OrderRefunds
|
||||
[HttpGet("getOrderRefundList")]
|
||||
public async Task<IActionResult> GetOrderRefundListApi([FromQuery] OrderRefundQueryDtoApi parm)
|
||||
{
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||
parm.CustomerGuid = user.UserId;
|
||||
|
||||
var res = await _OrderRefundServiceApi.GetOrderRefundListApi(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
@ -97,6 +103,18 @@ namespace ARW.WebApi.Controllers.Api.OrderManage.OrderRefunds
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取退款原因
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getRefundReason")]
|
||||
public async Task<IActionResult> GetRefundReason()
|
||||
{
|
||||
var res = _SysDictDataService.SelectDictDataByType("refund_reason");
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加售后单记录表
|
||||
/// </summary>
|
||||
|
@ -17,6 +17,10 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Geocoding;
|
||||
using ARW.Model.Dto.Api.Carts;
|
||||
using ARW.Service.Api.IBusinessService.Carts;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsComments;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
using ARW.Service.Business.IBusinessService.ShopManager.Shops;
|
||||
using ARW.Model.Vo.Api.GoodsManager.Goodss;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.OrderManage.Orders
|
||||
{
|
||||
@ -50,6 +54,9 @@ namespace ARW.WebApi.Controllers.Api.OrderManage.Orders
|
||||
[HttpGet("getOrderList")]
|
||||
public async Task<IActionResult> GetOrderListApi([FromQuery] OrderQueryDtoApi parm)
|
||||
{
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||
parm.CustomerGuid = user.UserId;
|
||||
|
||||
var res = await _OrderServiceApi.GetOrderListApi(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
@ -103,6 +110,25 @@ namespace ARW.WebApi.Controllers.Api.OrderManage.Orders
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 评价
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addComment")]
|
||||
[Log(Title = "评价", BusinessType = BusinessType.UPDATE)]
|
||||
public async Task<IActionResult> AddComment([FromBody] AddCommentDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||
parm.CustomerGuid = user.UserId;
|
||||
|
||||
var modal = parm.Adapt<GoodsComment>().ToCreate(HttpContext);
|
||||
var res = await _OrderServiceApi.AddComment(modal);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取Order详情(Api)
|
||||
/// </summary>
|
||||
@ -111,14 +137,12 @@ namespace ARW.WebApi.Controllers.Api.OrderManage.Orders
|
||||
[HttpGet("getOrderDetails")]
|
||||
public async Task<IActionResult> GetOrderDetails([FromQuery] OrderDtoApi parm)
|
||||
{
|
||||
//if (parm == null) throw new CustomException("参数错误!");
|
||||
if (parm == null) throw new CustomException("参数错误!");
|
||||
|
||||
var res = await _OrderServiceApi.GetOrderDetails(parm);
|
||||
|
||||
if (res != "[]")
|
||||
{
|
||||
res = res.Remove(0, 1);
|
||||
res = res.Substring(0, res.Length - 1);
|
||||
{
|
||||
var data = res.FromJSON<OrderApiDetailsVo>();
|
||||
return SUCCESS(data);
|
||||
}
|
||||
@ -126,6 +150,7 @@ namespace ARW.WebApi.Controllers.Api.OrderManage.Orders
|
||||
{
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user