public async Task <APIResult> ThirdOrderQuery([FromBody] COrderInfoQueryModel model) { ThirdServer thirdServer = new ThirdServer(_db, thirdConfig); var thirdorder = await thirdServer.ThirdOrderQuery(model); return(Success(thirdServer)); }
public async Task <APIResult> GetOrderInfo([FromBody] GetOrderInfoArgsModel args) { if (!args.shopOrderId.HasValue) { throw new Exception("shopOrderId不能为空"); } ShopOrder shopOrder = db.Query <ShopOrder>() .Where(m => m.Id == args.shopOrderId.Value) .Include(m => m.ShopOrderOtherFee) .Include(m => m.ShopOrderSelfHelp) .Include(m => m.ShopOrderMoneyOffRule) .Include(m => m.ShopPart) .FirstOrDefault(); if (shopOrder == null) { throw new Exception("订单记录不存在"); } ShopOrderServer shopOrderServer = new ShopOrderServer(shopOrder); GetOrderInfoResultModel rtn = new GetOrderInfoResultModel() { Code = shopOrder.OrderNumber, CreateTime = shopOrder.AddTime.ToString("yyyy-MM-dd HH:mm:ss"), PayTime = shopOrder.PayTime?.ToString("yyyy-MM-dd HH:mm:ss"), PayMent = shopOrder.Payment / 100m, PayStatus = shopOrderServer.GetPayStatus(), OrderStatus = shopOrder.Status.ToString(), Remark = shopOrder.Remark ?? "", IsTakeOut = shopOrder.IsTakeOut, PayWay = shopOrder.PayWay }; if (shopOrder.ShopOrderMoneyOffRule != null) { rtn.MoneyOffRule = new MoneyOffRule() { Discount = shopOrder.ShopOrderMoneyOffRule.Discount / 100m, FullAmount = shopOrder.ShopOrderMoneyOffRule.FullAmount / 100m }; } if (shopOrder.ShopOrderOtherFee != null) { rtn.OtherFee = new OtherFee() { BoxFee = shopOrder.ShopOrderOtherFee.BoxFee / 100m, DeliveryFee = shopOrder.ShopOrderOtherFee.DeliveryFee / 100m }; } if (shopOrder.ShopOrderSelfHelp != null) { rtn.SelfHelp = new SelfHelpInfo() { SelfHelpCode = shopOrder.ShopOrderSelfHelp.Number, TakeWay = shopOrder.ShopOrderSelfHelp.IsTakeOut ? "外带" : "堂食" }; } if (shopOrder.ShopPart != null) { rtn.ShopPartName = shopOrder.ShopPart.Title; } if (shopOrder.IsTakeOut) { var takeOut = db.Query <ShopOrderTakeout>() .Where(m => m.ShopOrderId == shopOrder.Id) .FirstOrDefault(); if (takeOut != null) { rtn.TakeOutInfo = new TakeOutInfo() { DiningWay = takeOut.TakeWay.ToString(), PickTile = takeOut.TakeWay == TakeWay.自提 ? "预计自提时间" : "期望配送时间", PickUpTime = takeOut.PickupTime.ToString("yyyy-MM-dd HH:mm:ss"), Address = takeOut.Address, Person = takeOut.Name, Phone = takeOut.Phone }; } } var orderItems = db.Query <ShopOrderItem>() .Where(m => !m.IsDel && m.ShopOrderId == args.shopOrderId.Value) .Select(m => new CommodityInfo() { Cover = m.CommodityStock.Sku.Commodity.Cover, Count = m.Count, VipPrice = (m.CommodityStock.Sku.Commodity.CategoryId != 0 && m.CommodityStock.Sku.Commodity.UseMemberPrice), PrimePrice = m.PrimePrice * m.Count / 100m, Name = $"{m.CommodityName}({m.SkuSummary})", SalePrice = m.SalePrice * m.Count / 100m }).ToList(); rtn.Items = orderItems; if (shopOrder.takeDistributionType == TakeDistributionType.达达配送) { ThirdServer thirdServer = new ThirdServer(db, thirdConfig); var thirdqueryresult = await thirdServer.ThirdOrderQuery(new BLL.Third.COrderInfoQueryModel() { ShopId = shopOrder.ShopId, order_id = shopOrder.OrderNumber }); rtn.cThirdInfoQuery = thirdqueryresult; } return(Success(rtn)); }