步步为盈
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.

315 lines
14 KiB

3 years ago
using BBWY.Client.Models;
using BBWY.Common.Http;
using BBWY.Common.Models;
using System;
using System.Collections.Generic;
3 years ago
using System.Linq;
3 years ago
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,
3 years ago
string productId,
3 years ago
string productNo,
string waybill,
string contactName,
int pageIndex,
int pageSize,
long? shopId,
bool onlyDF,
bool excludeSD,
3 years ago
bool excludeCanceled,
bool includeExceptionOrder,
string sdOperator)
3 years ago
{
return SendRequest<OrderListResponse>(globalContext.BBYWApiHost, "api/order/getOrderList", new
{
orderId,
startDate,
endDate,
3 years ago
orderState,
pageIndex,
pageSize,
shopId,
sku,
3 years ago
productId,
3 years ago
productNo,
waybill,
contactName,
onlyDF,
excludeSD,
3 years ago
excludeCanceled,
includeExceptionOrder,
sdOperator
3 years ago
}, 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);
}
3 years ago
/// <summary>
/// 解密收货人信息
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
3 years ago
public ApiResponse<ConsigneeSimpleResponse> DecodeConsignee(string orderId, string plaintextMobile)
3 years ago
{
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,
3 years ago
plaintextMobile,
3 years ago
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)
3 years ago
{
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/AutoCalculationCost", new { orderId, isSetStorageType, storageType, platformCommissionRatio }, null, HttpMethod.Post);
3 years ago
}
/// <summary>
/// 手动计算成本
/// </summary>
/// <param name="orderId"></param>
3 years ago
/// <param name="isSetStorageType"></param>
3 years ago
/// <param name="storageType"></param>
3 years ago
/// <param name="manualEditCostOrderSkuList"></param>
/// <param name="platformCommissionRatio"></param>
3 years ago
/// <returns></returns>
3 years ago
public ApiResponse<object> ManualCalculationCost(string orderId, bool isSetStorageType, StorageType storageType, IList<ManualEditCostOrderSku> manualEditCostOrderSkuList, decimal platformCommissionRatio)
3 years ago
{
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/ManualCalculationCost",
new
{
orderId,
isSetStorageType,
storageType,
3 years ago
OrderCostDetailList = manualEditCostOrderSkuList.Select(osku => new
{
SkuId = osku.Id,
osku.ConsumableAmount,
osku.DeliveryExpressFreight,
osku.FirstFreight,
DeductionQuantity = osku.ItemTotal,
3 years ago
osku.InStorageAmount,
osku.OutStorageAmount,
3 years ago
osku.PurchaseFreight,
osku.ProductId,
osku.SkuAmount,
osku.StorageAmount,
osku.TotalCost,
osku.UnitCost
}),
platformCommissionRatio
3 years ago
}, 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,
3 years ago
decimal sdOrderAmount,
3 years ago
decimal deliveryExpressFreight,
SDType sdType,
3 years ago
string sdKey,
PayBillType? sdPayChannel,
string sdPaybillNo,
string sdOperator,
3 years ago
string flag,
string venderRemark,
3 years ago
Shop shop)
3 years ago
{
return SendRequest<object>(globalContext.BBYWApiHost, "api/order/SDCalculationCost", new
{
orderId,
isSetStorageType,
flag,
venderRemark,
sdType,
sdCommissionAmount,
3 years ago
sdOrderAmount,
3 years ago
deliveryExpressFreight,
3 years ago
platformCommissionRatio = shop.PlatformCommissionRatio ?? 0.05M,
3 years ago
sdKey,
sdPayChannel,
sdPaybillNo,
sdOperator,
3 years ago
Platform = shop.Platform,
AppKey = shop.AppKey,
AppSecret = shop.AppSecret,
AppToken = shop.AppToken
3 years ago
}, 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);
}
3 years ago
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);
}
3 years ago
public ApiResponse<object> SyncOrder(long shopId, DateTime startTime, DateTime endTime)
{
return SendRequest<object>(globalContext.BBYWApiHost, "/Api/OrderSync/SyncOrderByDate", new { shopId, startTime, endTime }, null, HttpMethod.Post);
3 years ago
}
/// <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);
}
3 years ago
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,
3 years ago
long? shopId,
3 years ago
bool onlyDF,
bool excludeSD,
3 years ago
bool excludeCanceled,
string sdOperator)
3 years ago
{
return SendRequest<IList<ExportOrderResponse>>(globalContext.BBYWApiHost, "api/order/ExportOrderList", new
{
orderId,
startDate,
endDate,
orderState,
pageIndex,
pageSize,
shopId,
sku,
productNo,
waybill,
contactName,
onlyDF,
excludeSD,
3 years ago
excludeCanceled,
sdOperator
3 years ago
}, null, HttpMethod.Post);
}
3 years ago
public ApiResponse<OrderResponse> SDGroupPullOrder(string orderId, Shop shop)
{
return SendRequest<OrderResponse>(globalContext.BBYWApiHost, "Api/Order/SDGroupPullOrder", new
{
orderId,
shop.ShopId,
shop.Platform,
shop.AppKey,
shop.AppSecret,
shop.AppToken
}, null, HttpMethod.Post);
}
2 years ago
public ApiResponse<ExportOrderSkuListResponse> QueryOrderSkuList(DateTime startDate,
DateTime endDate,
int? purchasePlatform,
IList<long> shopIds,
int pageIndex,
int pageSize)
{
return SendRequest<ExportOrderSkuListResponse>(globalContext.BBYWApiHost, "api/order/queryorderskulist", new
{
shopIds,
purchasePlatform,
startTime = startDate,
endTime = endDate,
pageIndex,
pageSize
}, null, HttpMethod.Post);
}
public ApiResponse<IList<ExportOrderSkuResponse>> ExportOrderSkuList(DateTime startDate,
DateTime endDate,
int? purchasePlatform,
IList<long> shopIds)
{
return SendRequest<IList<ExportOrderSkuResponse>>(globalContext.BBYWApiHost, "api/order/exportorderskulist", new
{
shopIds,
purchasePlatform,
startTime = startDate,
endTime = endDate
}, null, HttpMethod.Post);
}
3 years ago
}
}