using BBWYB.Client.Models; using BBWYB.Common.Http; using BBWYB.Common.Models; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; namespace BBWYB.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 productId, string skuId, string clientOrderId, string purchaseOrderId, string sourceShopName, string sourceSku, int pageIndex, int pageSize, long? shopId, bool excludeCanceled, bool isWaitConfig) { return SendRequest(globalContext.BBWYApiHost, "api/order/getorderlist", new { orderId, shopId, startDate, endDate, orderState, pageIndex, pageSize, productId, Sku = skuId, clientOrderId, purchaseOrderId, sourceShopName, sourceSku, isWaitConfig }, null, HttpMethod.Post); } public ApiResponse CancelOrder(string orderId, string remark) { return SendRequest(globalContext.BBWYApiHost, "api/order/CancelOrder", new { orderId, remark, globalContext.User.Shop.AppKey, globalContext.User.Shop.AppSecret, globalContext.User.Shop.AppToken, globalContext.User.Shop.Platform }, null, HttpMethod.Post); } public ApiResponse EditPrice(string orderId, IList orderSkuList) { return SendRequest(globalContext.BBWYApiHost, "api/order/EditPrice", new { orderId, EditItems = orderSkuList.Select(osku => new { OrderSkuId = osku.Id, SkuId = osku.SkuId, Price = osku.NewPrice, Freight = osku.FreightAmount, Quantity = osku.ItemTotal }), globalContext.User.Shop.AppKey, globalContext.User.Shop.AppSecret, globalContext.User.Shop.AppToken, globalContext.User.Shop.Platform }, null, HttpMethod.Post); } } }