You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
263 lines
11 KiB
263 lines
11 KiB
using BBWY.Client.Models;
|
|
using BBWY.Common.Http;
|
|
using BBWY.Common.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
|
|
namespace BBWY.Client.APIServices
|
|
{
|
|
public class OrderService : BaseApiService, IDenpendency
|
|
{
|
|
public OrderService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
|
|
{
|
|
|
|
}
|
|
|
|
public ApiResponse<OrderListResponse> GetOrderList(string orderId,
|
|
DateTime startDate,
|
|
DateTime endDate,
|
|
OrderState? orderState,
|
|
string sku,
|
|
string productId,
|
|
string productNo,
|
|
string waybill,
|
|
string contactName,
|
|
int pageIndex,
|
|
int pageSize,
|
|
long shopId,
|
|
bool onlyDF,
|
|
bool excludeSD,
|
|
bool excludeCanceled,
|
|
bool? isContainsAfterSaleOrder)
|
|
{
|
|
return SendRequest<OrderListResponse>(globalContext.BBYWApiHost, "api/order/getOrderList", new
|
|
{
|
|
orderId,
|
|
startDate,
|
|
endDate,
|
|
orderState,
|
|
pageIndex,
|
|
pageSize,
|
|
shopId,
|
|
sku,
|
|
productId,
|
|
productNo,
|
|
waybill,
|
|
contactName,
|
|
onlyDF,
|
|
excludeSD,
|
|
excludeCanceled,
|
|
isContainsAfterSaleOrder
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取订单详情
|
|
/// </summary>
|
|
/// <param name="orderId"></param>
|
|
/// <returns></returns>
|
|
public ApiResponse<OrderResponse> GetOrderById(string orderId)
|
|
{
|
|
return SendRequest<OrderResponse>(globalContext.BBYWApiHost, $"api/order/GetOrderById/{orderId}", null, null, HttpMethod.Get);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 解密收货人信息
|
|
/// </summary>
|
|
/// <param name="orderId"></param>
|
|
/// <returns></returns>
|
|
public ApiResponse<ConsigneeSimpleResponse> DecodeConsignee(string orderId, string plaintextMobile)
|
|
{
|
|
return SendRequest<ConsigneeSimpleResponse>(globalContext.BBYWApiHost, "Api/Order/DecryptConsignee", new
|
|
{
|
|
globalContext.User.Shop.Platform,
|
|
globalContext.User.Shop.AppKey,
|
|
globalContext.User.Shop.AppSecret,
|
|
globalContext.User.Shop.AppToken,
|
|
saveResponseLog = true,
|
|
orderId,
|
|
plaintextMobile,
|
|
saveDb = true
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 自动计算成本
|
|
/// </summary>
|
|
/// <param name="orderId"></param>
|
|
/// <param name="isSetStorageType">是否设置仓储类型</param>
|
|
/// <param name="storageType"></param>
|
|
/// <returns></returns>
|
|
public ApiResponse<object> AutoCalculationCost(string orderId, bool isSetStorageType, StorageType storageType, decimal platformCommissionRatio)
|
|
{
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/AutoCalculationCost", new { orderId, isSetStorageType, storageType, platformCommissionRatio }, null, HttpMethod.Post);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 手动计算成本
|
|
/// </summary>
|
|
/// <param name="orderId"></param>
|
|
/// <param name="isSetStorageType"></param>
|
|
/// <param name="storageType"></param>
|
|
/// <param name="manualEditCostOrderSkuList"></param>
|
|
/// <param name="platformCommissionRatio"></param>
|
|
/// <returns></returns>
|
|
public ApiResponse<object> ManualCalculationCost(string orderId, bool isSetStorageType, StorageType storageType, IList<ManualEditCostOrderSku> manualEditCostOrderSkuList, decimal platformCommissionRatio)
|
|
{
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/ManualCalculationCost",
|
|
new
|
|
{
|
|
orderId,
|
|
isSetStorageType,
|
|
storageType,
|
|
OrderCostDetailList = manualEditCostOrderSkuList.Select(osku => new
|
|
{
|
|
SkuId = osku.Id,
|
|
osku.ConsumableAmount,
|
|
osku.DeliveryExpressFreight,
|
|
osku.FirstFreight,
|
|
DeductionQuantity = osku.ItemTotal,
|
|
osku.InStorageAmount,
|
|
osku.OutStorageAmount,
|
|
osku.PurchaseFreight,
|
|
osku.ProductId,
|
|
osku.SkuAmount,
|
|
osku.StorageAmount,
|
|
osku.TotalCost,
|
|
osku.UnitCost
|
|
}),
|
|
platformCommissionRatio
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置刷单成本
|
|
/// </summary>
|
|
/// <param name="orderId"></param>
|
|
/// <param name="isSetStorageType"></param>
|
|
/// <param name="sdCommissionAmount"></param>
|
|
/// <param name="deliveryExpressFreight"></param>
|
|
/// <param name="sdType"></param>
|
|
/// <param name="flag"></param>
|
|
/// <param name="venderRemark"></param>
|
|
/// <returns></returns>
|
|
public ApiResponse<object> SDCalculationCost(string orderId,
|
|
bool isSetStorageType,
|
|
decimal sdCommissionAmount,
|
|
decimal deliveryExpressFreight,
|
|
SDType sdType,
|
|
string sdKey,
|
|
PayBillType? sdPayChannel,
|
|
string sdPaybillNo,
|
|
string sdOperator,
|
|
string flag,
|
|
string venderRemark,
|
|
decimal platformCommissionRatio)
|
|
{
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/SDCalculationCost", new
|
|
{
|
|
orderId,
|
|
isSetStorageType,
|
|
flag,
|
|
venderRemark,
|
|
sdType,
|
|
sdCommissionAmount,
|
|
deliveryExpressFreight,
|
|
platformCommissionRatio,
|
|
sdKey,
|
|
sdPayChannel,
|
|
sdPaybillNo,
|
|
sdOperator,
|
|
Platform = globalContext.User.Shop.Platform,
|
|
AppKey = globalContext.User.Shop.AppKey,
|
|
AppSecret = globalContext.User.Shop.AppSecret,
|
|
AppToken = globalContext.User.Shop.AppToken
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<object> RelationPurchaseOrderV2(IList<OrderDropShipping> orderDropShippingList, decimal platformCommissionRatio)
|
|
{
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/RelationPurchaseOrderV2", new
|
|
{
|
|
orderDropShippingList,
|
|
platformCommissionRatio,
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<object> OutStock(string orderId, string waybillNo, string logisticsId)
|
|
{
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/outstock", new
|
|
{
|
|
orderId,
|
|
waybillNo,
|
|
logisticsId,
|
|
Platform = globalContext.User.Shop.Platform,
|
|
AppKey = globalContext.User.Shop.AppKey,
|
|
AppSecret = globalContext.User.Shop.AppSecret,
|
|
AppToken = globalContext.User.Shop.AppToken
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<object> SyncOrder(long shopId, DateTime startTime, DateTime endTime)
|
|
{
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "/Api/Order/SyncOrderByDate", new { shopId, startTime, endTime }, null, HttpMethod.Post);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改商家备注
|
|
/// </summary>
|
|
/// <param name="orderId"></param>
|
|
/// <param name="venderRemark"></param>
|
|
/// <param name="flag"></param>
|
|
/// <returns></returns>
|
|
public ApiResponse<object> EditVenderRemark(string orderId, string venderRemark, string flag)
|
|
{
|
|
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/EditVenderRemark", new
|
|
{
|
|
orderId,
|
|
venderRemark,
|
|
flag,
|
|
globalContext.User.Shop.Platform,
|
|
globalContext.User.Shop.AppKey,
|
|
globalContext.User.Shop.AppSecret,
|
|
globalContext.User.Shop.AppToken
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<IList<ExportOrderResponse>> ExportOrderList(string orderId,
|
|
DateTime startDate,
|
|
DateTime endDate,
|
|
OrderState? orderState,
|
|
string sku,
|
|
string productNo,
|
|
string waybill,
|
|
string contactName,
|
|
int pageIndex,
|
|
int pageSize,
|
|
long shopId,
|
|
bool onlyDF,
|
|
bool excludeSD,
|
|
bool excludeCanceled)
|
|
{
|
|
return SendRequest<IList<ExportOrderResponse>>(globalContext.BBYWApiHost, "api/order/ExportOrderList", new
|
|
{
|
|
orderId,
|
|
startDate,
|
|
endDate,
|
|
orderState,
|
|
pageIndex,
|
|
pageSize,
|
|
shopId,
|
|
sku,
|
|
productNo,
|
|
waybill,
|
|
contactName,
|
|
onlyDF,
|
|
excludeSD,
|
|
excludeCanceled
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
}
|
|
}
|
|
|