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.
80 lines
3.3 KiB
80 lines
3.3 KiB
using BBWY.Client.Models;
|
|
using BBWY.Common.Http;
|
|
using BBWY.Common.Models;
|
|
using System.Collections.Generic;
|
|
using System.Net.Http;
|
|
|
|
namespace BBWY.Client.APIServices
|
|
{
|
|
public class BatchPurchaseService : BaseApiService, IDenpendency
|
|
{
|
|
public BatchPurchaseService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取包含对应平台采购方案的sku列表
|
|
/// </summary>
|
|
/// <param name="sku"></param>
|
|
/// <param name="spu"></param>
|
|
/// <returns></returns>
|
|
public ApiResponse<IList<ProductSkuWithSchemeResponse>> GetProductSkuAndSchemeList(string sku, string spu)
|
|
{
|
|
return SendRequest<IList<ProductSkuWithSchemeResponse>>(globalContext.BBYWApiHost, "api/BatchPurchase/GetProductSkuAndSchemeList", new
|
|
{
|
|
globalContext.User.Shop.Platform,
|
|
globalContext.User.Shop.AppKey,
|
|
globalContext.User.Shop.AppSecret,
|
|
globalContext.User.Shop.AppToken,
|
|
globalContext.User.Shop.ShopId,
|
|
sku,
|
|
spu
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
|
|
public ApiResponse<PreviewOrderResponse> PreviewOrder(IList<ProductSkuWithScheme> productSkuWithSchemeList,
|
|
Consignee consignee,
|
|
PurchaseOrderMode purchaseOrderMode,
|
|
IList<PurchaseAccount> purchaseAccountList)
|
|
{
|
|
|
|
/*
|
|
public string PurchaseProductId { get; set; }
|
|
public string PuchaseSkuId { get; set; }
|
|
public string PurchaseSpecId { get; set; }
|
|
public int Quantity { get; set; }
|
|
public string PurchaserId { get; set; }
|
|
public string PurchaserName { get; set; }
|
|
public Enums.Platform PurchasePlatform { get; set; }
|
|
public string BelongSkuId { get; set; }
|
|
*/
|
|
|
|
var productParamList = new List<object>();
|
|
foreach (var productSkuWithScheme in productSkuWithSchemeList)
|
|
{
|
|
foreach (var purchaseSchemeProductSku in productSkuWithScheme.PurchaseSchemeProductSkuList)
|
|
{
|
|
productParamList.Add(new
|
|
{
|
|
purchaseSchemeProductSku.PurchaseProductId,
|
|
purchaseSchemeProductSku.PurchaseSkuId,
|
|
PurchaseSpecId = purchaseSchemeProductSku.PurchaseSkuSpecId,
|
|
Quantity = purchaseSchemeProductSku.ItemTotal,
|
|
PurchaserId = productSkuWithScheme.PurchaserId,
|
|
PurchaserName = productSkuWithScheme.PurchaserName,
|
|
PurchasePlatform = productSkuWithScheme.PurchasePlatform,
|
|
BelongSkuId = productSkuWithScheme.SkuId
|
|
});
|
|
}
|
|
}
|
|
|
|
return SendRequest<PreviewOrderResponse>(globalContext.BBYWApiHost, "api/BatchPurchase/PreviewOrder", new
|
|
{
|
|
consignee,
|
|
purchaseOrderMode,
|
|
purchaseAccountList,
|
|
productParamList
|
|
}, null, HttpMethod.Post);
|
|
}
|
|
}
|
|
}
|
|
|