var CZMX = new Array(); //首先声明数组 //然后遍历表格数据 $("#tbOffice tbody tr").each(function () { var a = $(this).children(); //获取每一行 var unit; if (a[4].innerText == "按月") { unit = 1; } else { unit = 2; } //将表格数据赋值给后台实体类相应的字段 var item = { CardId: a[0].innerText, CardNo: a[1].innerText, PackageId: a[2].innerText, PackageName: a[3].innerText, PriceUnit: unit, Price: a[5].innerText, Cycle: a[6].innerText, Amount: a[7].innerText } //然后将item对象添加到数组里 CZMX.push(item); }); var dto = { RechargeOrderCode: $("#txtRechargeOrderCode").text(), TotalMoney: $("#txtTotalMoney").text(), ItemList: CZMX, CZtype: type2 } abp.ajax({ url: "/Card/PackageRecharge/TCRecharge", type: "post", data: JSON.stringify(dto) //JSON.stringify(dto) }).done(function (data) { if (data.total == 1) { parent.toastr.success("更新成功!"); parent.$("#tbOffice").bootstrapTable(‘refresh‘); closePage(); return; } else { parent.toastr.warning("提交失败!"); return; } });
前台Js
原文地址:https://www.cnblogs.com/lxyang/p/8483794.html
时间: 2024-10-31 09:45:14