

/*短信余额查询*/
function smscx(myurl){
var index = null;
	$.ajax({
		type: "POST",
		url: myurl,
		beforeSend: function (request) {
		index = layer.load();
		},
		success: function(msg){
		layer.close(index);
		layer.msg(msg,{icon:1,time:4000});  
		}
		});            
}


/*定义单个删除操作*/
function ew80_del(obj,myurl,myid){
layer.confirm('确认要删除吗？删除后不可恢复！',{title:'提醒',icon:0},function(index){
//发异步删除
var index = null;
	$.ajax({
		type: "GET",
		url: myurl + "?did=" + myid,
		beforeSend: function (request) {
		index = layer.load();
		},
		success: function(msg){
		layer.close(index);
		$(obj).parents("tr").remove();
		layer.msg(msg,{icon:1,time:1000});  
		}
});
               
});
//异步处理完成
}

/*锁定操作设置*/
function user_lock(obj,myurl,myid,myname){
layer.confirm("是否将会员 " + myname + " 锁定？",{title:'提醒',icon:0},function(index){
//发异步锁定用户
var index = null;
	$.ajax({
		type: "GET",
		url: myurl + "?lock=lock&id="+ myid,
		beforeSend: function (request) {
		index = layer.load();
		},
		success: function(msg){
		layer.close(index);
        $(obj).parents("tr").find(".lock").html('<a title="点击取消锁定该用户" href="javascript:void();" onclick="user_ulock(this,\'' +myurl+"',"+ "'"+ myid + "','"+ myname +"')\">" +'<eq name="vo.u_zt" value="no"><span class="label label-default">已锁定</span></eq></a>');
		$(obj).remove();
		layer.msg(msg,{icon:1,time:1000});  
		}
});
               
});
//异步处理完成
}


/*解锁操作设置*/
function user_ulock(obj,myurl,myid,myname){
layer.confirm("是否将会员 "+ myname +" 取消锁定？",{title:'提醒',icon:0},function(index){
//发异步取消锁定用户
var index = null;
	$.ajax({
		type: "GET",
		url: myurl + "?lock=ulock&id="+ myid,
		beforeSend: function (request) {
		index = layer.load();
		},
		success: function(msg){
		layer.close(index);
        $(obj).parents("tr").find(".lock").html('<a title="点击锁定该用户" href="javascript:void();" onclick="user_lock(this,\'' +myurl+"',"+ "'"+ myid + "','"+ myname +"')\">" +'<eq name="vo.u_zt" value="yes"><span class="label label-success">正常</span></eq></a>');
		$(obj).remove();
		layer.msg(msg,{icon:1,time:1000});  
		}
});
               
});
//异步处理完成
}



	
/*会员等级禁用*/
function status_lock(obj,myurl,myid,myname){
layer.confirm("是否将等级 " + myname + " 禁用？",{title:'提醒',icon:0},function(index){
//发异步锁定用户
var index = null;
	$.ajax({
		type: "GET",
		url: myurl + "?lock=lock&id="+ myid,
		beforeSend: function (request) {
		index = layer.load();
		},
		success: function(msg){
		layer.close(index);
        $(obj).parents("tr").find(".lock").html('<a title="点击启用" href="javascript:void();" onclick="status_ulock(this,\'' +myurl+"',"+ "'"+ myid + "','"+ myname +"')\">" +'<eq name="vo.shqy" value="no"><span class="label label-default">未启用</span></eq></a>');
		$(obj).remove();
		layer.msg(msg,{icon:1,time:1000});  
		}
});
               
});
//异步处理完成
}


/*会员等级启用*/
function status_ulock(obj,myurl,myid,myname){
layer.confirm("是否将等级 "+myname+" 启用？",{title:'提醒',icon:0},function(index){
//发异步取消锁定用户
var index = null;
	$.ajax({
		type: "GET",
		url: myurl + "?lock=ulock&id="+ myid,
		beforeSend: function (request) {
		index = layer.load();
		},
		success: function(msg){
		layer.close(index);
        $(obj).parents("tr").find(".lock").html('<a title="点击停用" href="javascript:void();" onclick="status_lock(this,\'' +myurl+"',"+ "'"+ myid + "','"+ myname +"')\">" +'<eq name="vo.shqy" value="yes"><span class="label label-success">启用</span></eq></a>');
		$(obj).remove();
		layer.msg(msg,{icon:1,time:1000});  
		}
});
               
});
//异步处理完成
}

/*定义删除客服人员操作*/
function ew80_del_kf(obj,myurl,myid){
layer.confirm('确认要删除该客服吗？删除后不可恢复！',{title:'提醒',icon:0},function(index){
//发异步删除
var index = null;
	$.ajax({
		type: "GET",
		url: myurl + "?del=del&id="+ myid,
		beforeSend: function (request) {
		index = layer.load();
		},
		success: function(msg){
		layer.close(index);
		$(obj).parents(".col-sm-6").remove();
		layer.msg(msg,{icon:1,time:1000});  
		}
});
               
});
//异步处理完成
}

//全选或反选
function CheckAll(form)
		{
		for (var i=0;i<form.elements.length;i++)
			{
			var e = form.elements[i];
			if (e.Name != "chkall"&&e.disabled==false)
			e.checked = form.chkall.checked;
			}
}
	