using BBWY.Client.Models; using BBWY.Common.Http; using BBWY.Common.Models; using System; using System.Collections.Generic; using System.Net.Http; namespace BBWY.Client.APIServices { public class OrderService : BaseApiService, IDenpendency { public OrderService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } public ApiResponse GetOrderList(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(globalContext.BBYWApiHost, "api/order/getOrderList", new { orderId, startDate, endDate, orderState, pageIndex, pageSize, shopId, sku, productNo, waybill, contactName, onlyDF, excludeSD, excludeCanceled }, null, HttpMethod.Post); } /// /// 获取订单详情 /// /// /// public ApiResponse GetOrderById(string orderId) { return SendRequest(globalContext.BBYWApiHost, $"api/order/GetOrderById/{orderId}", null, null, HttpMethod.Get); } /// /// 解密收货人信息 /// /// /// public ApiResponse DecodeConsignee(string orderId, string plaintextMobile) { return SendRequest(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); } /// /// 自动计算成本 /// /// /// 是否设置仓储类型 /// /// public ApiResponse AutoCalculationCost(string orderId, bool isSetStorageType, StorageType storageType) { return SendRequest(globalContext.BBYWApiHost, "api/order/AutoCalculationCost", new { orderId, isSetStorageType, storageType }, null, HttpMethod.Post); } /// /// 手动计算成本 /// /// /// 是否设置仓储类型 /// /// public ApiResponse ManualCalculationCost(string orderId, bool isSetStorageType, StorageType storageType, decimal purchaseCost, decimal deliveryExpressFreight) { return SendRequest(globalContext.BBYWApiHost, "api/order/ManualCalculationCost", new { orderId, isSetStorageType, storageType, purchaseCost, deliveryExpressFreight }, null, HttpMethod.Post); } /// /// 设置刷单成本 /// /// /// /// /// /// /// /// /// public ApiResponse SDCalculationCost(string orderId, bool isSetStorageType, decimal sdCommissionAmount, decimal deliveryExpressFreight, SDType sdType, string flag, string venderRemark) { return SendRequest(globalContext.BBYWApiHost, "api/order/SDCalculationCost", new { orderId, isSetStorageType, flag, venderRemark, sdType, sdCommissionAmount, deliveryExpressFreight, 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 RelationPurchaseOrder(OrderDropShipping orderDropShipping, IList relationPurchaseOrderSkuList) { return SendRequest(globalContext.BBYWApiHost, "api/order/RelationPurchaseOrder", new { orderDropShipping, relationPurchaseOrderSkuList }, null, HttpMethod.Post); } public ApiResponse OutStock(string orderId, string waybillNo, string logisticsId) { return SendRequest(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 SyncOrder(long shopId, DateTime startTime, DateTime endTime) { return SendRequest(globalContext.BBYWApiHost, "/Api/Order/SyncOrderByDate", new { shopId, startTime, endTime }, null, HttpMethod.Post); } /// /// 修改商家备注 /// /// /// /// /// public ApiResponse EditVenderRemark(string orderId, string venderRemark, string flag) { return SendRequest(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); } } }