标签:
function GetUsernamelist() {//获取黑名单用户名
var blist;
$.ajax({
async: false,
type: "POST",
url: "/Pay/GetUsernamelist.do?",
cache: false,
timeout: 60 * 60 * 1000,
dataType: "json",
success: function (result) {
if (result != null) {
blist = result;
//usernamelist = result;
}
else {
blist = null;
}
}
});
return blist;
//blacklist = blist;
}
后台
[HttpPost]
public JsonResult GetBlacklist()
{
List<string> list = new List<string>();
for (int i = 0; i < blacklist.Length;i++ )
{
string str = blacklist[i];
list.Add(str);
}
var a = Json(list);
return Json(list);
}
完整地ajax
function search() {
var blist1 = GetBlacklist();//黑名单姓名
var ulist = GetUsernamelist();//黑名单用户名
var PayOutState = $("#txtPayOutState option:selected").val();
var SelectConditon = $("#txtSelectConditon option:selected").val();
var UserTypeState = $("#userTypeState option:selected").val();
//查询
$.ajax({
async: true,
type: "POST",
url: "/Pay/GetPayOutManagementList.do?Radom=" + $.date.now(),
cache: false,
timeout: 60 * 60 * 1000,
dataType: "json",
data: {
PayOutCreateBeginTime: encodeURI($("#txtPayOutCreateBeginTime").val()),
PayOutCreateEndTime: encodeURI($("#txtPayOutCreateEndTime").val()),
PayOutState: encodeURI(PayOutState),
UserTypeState: encodeURI(UserTypeState),
AuditCreateBeginTime: encodeURI($("#txtAuditCreateBeginTime").val()),
AuditCreateEndTime: encodeURI($("#txtAuditCreateEndTime").val()),
SelectConditon: encodeURI(SelectConditon),
KeyWord: encodeURI($("#txtKeyWord").val()),
PageSize: encodeURI($("#txtPageSize").val()),
CurrentPage: encodeURI($("#txtCurrentPage").val()),
Token: ‘@(SlToken.GetToken())‘
},
success: function (result) {
$(".sldatatable .sldatatablerow").remove();
if (result != null && result.Message == "@(SlStandardMessage.Success)") {
$("#TotalCount").html(result.TotalCount);
$("#TotalMoneyQuantity").html(result.TotalMoneyQuantity);
$("#TotalAvailableAmount").html(result.TotalAvailableAmount);
//$("#TotalFreePayOutMoneyQuantity").html(result.TotalFreePayOutMoneyQuantity);
//$("#TotalUsedFreePayOutMoneyQuantity").html(result.TotalUsedFreePayOutMoneyQuantity);
$("#txtMaxPage").val(result.MaxPage);
var currentPage = parseInt($("#txtCurrentPage").val());
if (currentPage > result.MaxPage && result.MaxPage!=0) {
$("#txtCurrentPage").val(1);
search();
}
if (result.Rows != null) {
for (var i = 0; i < result.Rows.length; i++) {
var row = result.Rows[i];
var rowHtml = $(".sldatatabletemplate").html();
if (row.State == ‘@(Business.SlPayOutState.提现申请.ToString())‘) {
if (row.IsCompany == ‘1‘)//公司用户
{
rowHtml = rowHtml.replace("{10}", "<a class=‘sldatatablerowedit‘ key=‘{Key}‘>确认</a>|<a class=‘sldatatableroweditCancel‘ key=‘{Key}‘>取消</a>");
rowHtml = rowHtml.replace("{18}", "");
}
else {
rowHtml = rowHtml.replace("{10}", "<a class=‘sldatatableroweditCancel‘ key=‘{Key}‘>取消</a>");
}
}
else {
rowHtml = rowHtml.replace("{10}", "");
}
if (row.State == ‘@(Business.SlPayOutState.提现申请.ToString())‘ && ($.inArray(row.CardName, blist1) == -1 && $.inArray(row.UserName, ulist) ==-1)) {
rowHtml = rowHtml.replace("{18}", "<a class=‘sldatatablerowedit1‘ key=‘{Key}‘>点击提交</a>");
} else {
rowHtml = rowHtml.replace("{18}", "");
}
//循环设置每行数据
rowHtml = rowHtml.replace(/{Key}/g, row.ID);
rowHtml = rowHtml.replace(/{Name}/g, row.UserName);
rowHtml = rowHtml.replace(/{UserID}/g, row.UserID);
rowHtml = rowHtml.replace("{0}", row.No);
rowHtml = rowHtml.replace("{1}", row.UserName);
rowHtml = rowHtml.replace("{2}", row.MoneyQuantity);
rowHtml = rowHtml.replace("{3}", row.Fee);
rowHtml = rowHtml.replace("{4}", row.AvailableAmount);
rowHtml = rowHtml.replace("{5}", row.CreateTime);
rowHtml = rowHtml.replace("{6}", row.AuditCreateTime);
rowHtml = rowHtml.replace("{7}", row.Type);
rowHtml = rowHtml.replace("{8}", row.AuditorName);
rowHtml = rowHtml.replace("{9}", row.State);
rowHtml = rowHtml.replace("{11}", row.BankName);
rowHtml = rowHtml.replace("{12}", row.CardName);
rowHtml = rowHtml.replace("{13}", row.CardNumber);
rowHtml = rowHtml.replace("{14}", row.ProvinceName);
rowHtml = rowHtml.replace("{15}", row.CityName);
rowHtml = rowHtml.replace("{16}", row.DistrictName);
rowHtml = rowHtml.replace("{17}", row.SubbranchName);
rowHtml = rowHtml.replace("{OrderID}", row.ID);
rowHtml = rowHtml.replace("{19}", row.FreeQuantity);
//rowHtml = rowHtml.replace("{20}", row.FreePayOutMoneyQuantity);
//rowHtml = rowHtml.replace("{21}", row.UsedFreePayOutMoneyQuantity);
//rowHtml = rowHtml.replace("{22}", row.RemainFreePayOutMoneyQuantity);
$(".sldatatable").append($(rowHtml).html());
}
} else {
$(".sldatatable").append($(""));
}
}
else {
$(".sldatatable .sldatatablerow").remove();
}
}
});
}
标签:
原文地址:http://www.cnblogs.com/qinge/p/4910995.html