页面:
<script> function improve() { var improveForm = $('#improveForm'); if (!improveForm.valid()) { abp.message.warn("请完善信息"); return; } agencyLevelArray = $("[name='agencyLevel']"); isFirstArray = $("[name='isFirst']"); purchaseCountArray = $("[name='purchaseCount']"); priceArray = $("[name='price']"); package = []; for (i = 0; i < agencyLevelArray.length; i++) { package[i] = { ProductId: @product.Id, AgencyLevel: agencyLevelArray[i].value, IsFirst: isFirstArray[i].value, PurchaseCount: purchaseCountArray[i].value, Price: priceArray[i].value } }; abp.services.app.product.improveProductPackage({ ProductPackage: package }).done(function () { abp.message.warn("msg", "添加成功"); }) } </script>
Dto:
public class ProductPackageDto { /// <summary> /// 商品Id /// </summary> [Required] public long ProductId { get; set; } /// <summary> /// 代理等级 /// </summary> [Required] public AgencyLevel AgencyLevel { get; set; } /// <summary> /// 是否为初次 /// </summary> public bool IsFirst { get; set; } /// <summary> /// 单次购买量 /// </summary> public decimal PurchaseCount { get; set; } /// <summary> /// 分销价格 /// </summary> [Required] public decimal Price { get; set; } } public class ProductPackageList { public List<ProductPackageDto> ProductPackage { get; set; } }
后台:
public async Task ImproveProductPackage(ProductPackageList input) { }