```
//积分批量请零
$(document).on("click", ".cancel_order", function () {
var data = table.bootstrapTable('getSelections');
var ids = [];
if (data.length === 0) {
Toastr.error("请选择操作订单");
return;
}
for (var i = 0; i < data.length; i++) {
ids[i] = data[i]['id']
}
Layer.confirm(
'确认取消选中的'+ids.length+'个订单吗?',
{icon: 3, title: __('Warning'), offset: '40%', shadeClose: true},
function (index) {
Layer.close(index);
Backend.api.ajax({
url: "trans/orderv2/batchCancelorder?ids=" + JSON.stringify(ids),
data: {}
}, function(data, ret){//成功的回调
if (ret.code === 1) {
table.bootstrapTable('refresh');
Layer.close(index);
} else {
Layer.close(index);
Toastr.error(ret.msg);
}
}, function(data, ret){//失败的回调
console.log(ret);
// Toastr.error(ret.msg);
Layer.close(index);
});
}
);
});
```