/// <summary>
        /// 根据订单ID获取结算详情(传入shopId防止跨店铺调用)
        /// </summary>
        /// <param name="orderId">订单ID</param>
        /// <param name="shopId">店铺ID</param>
        /// <returns></returns>
        public static OrderSettlementDetail GetPendingOrderSettlementDetail(long orderId, long?shopId = null)
        {
            var model = _iBillingService.GetPendingSettlementOrderDetail(orderId);

            if (shopId.HasValue && shopId.Value != model.ShopId)
            {
                throw new Core.HimallException("找不到该店铺的结算详情");
            }

            var order  = _iOrderService.GetOrder(orderId);
            var refund = _iRefundService.GetOrderRefundList(orderId);

            OrderSettlementDetail detail = new OrderSettlementDetail();

            detail.Freight                     = model.FreightAmount;
            detail.RefundAmount                = model.RefundAmount;
            detail.DistributorCommission       = model.DistributorCommission;
            detail.DistributorCommissionReturn = model.DistributorCommissionReturn;
            detail.PlatCommission              = model.PlatCommission;
            detail.PlatCommissionReturn        = model.PlatCommissionReturn;
            detail.ProductsTotal               = model.ProductsAmount;
            detail.OrderPayTime                = order.PayDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            if (refund != null && refund.Count > 0)
            {
                detail.OrderRefundTime = refund.FirstOrDefault().ManagerConfirmDate.ToString("yyyy-MM-dd HH:mm:ss");
            }
            return(detail);
        }
Esempio n. 2
0
 /// <summary>
 /// 结算
 /// </summary>
 /// <param name="orderId"></param>
 /// <returns></returns>
 public static List <OrderRefundInfo> GetOrderRefundList(long orderId)
 {
     return(_iRefundService.GetOrderRefundList(orderId));
 }