/* 
* @Author: anchen
* @Date:   2017-05-04 09:51:59
* @Last Modified by:   anchen
* @Last Modified time: 2017-05-11 17:39:02
*/
var categoriesId = "";
var dataIdarr = [];
var serviceId ="";
var code ="";
var name ="";
var serviceIcon ="";
var typeCode = "";
var nunbers = "";
var renewalContractId = "";
var salegood = [];
$(document).ready(function(){
	var contextPath = $("#contextPath").val();
	serviceId = $("#serviceId").val();
	var visitPrefix = $("#visitPrefix").val();
	dataIdarr = $("#dataIdarr").val();
	renewalContractId = $("#renewalContractId").val();
	var userId = $("#userId").val();
	var virtualArchitectureId = $("#virtualArchitectureId").val();
	if(serviceId == null || serviceId == ""){
		$.ajax({
			type:'POST',
			url:contextPath+'/wechat/signContract/queryServiceList',
			dataType: 'json',//返回值类型 一般设置为json
			data:{"userId":userId,"virtualArchitectureId":virtualArchitectureId},
			async: false,
			success: function (data)  //服务器成功响应处理函数
			{
				$("#showsevicemask").empty();
				var subs = data.list;// 获取data中list的数组
				if(null == subs || subs == ""){
					return;
				}
				var service = ('<div class="showsevice">');
				for ( var i = 0; i < subs.length; i++) {//循环列表
    				service +='<dl class="sevice-item" serviceId="'+subs[i].id+'" code="'+subs[i].code+'" name="'+subs[i].name+'" serviceIcon="'+subs[i].serviceIcon+'" >';
    				service +='<dt><img src='+visitPrefix+subs[i].serviceIcon+' alt="" /></dt>';
    				service +='<dd><em>'+subs[i].name+'</em><span class="goodsnum"></span></dd></dl>';
    			}
				service +="</div>";
				$("#showsevicemask").html(service);
				//默认第一个服务
				var reshowitem = "";
				var orderpay = "<span>支付方式</span>";
				for ( var i = 0; i < 1; i++) {
					reshowitem +='<img src='+visitPrefix+subs[i].serviceIcon+' alt="" />';
					reshowitem +='<span>'+subs[i].name+'</span>';
					reshowitem +='<i class="arrow-down"></i>';
					serviceId = subs[i].id;//默认第一个项目的id
					code = subs[i].code;//默认第一个项目的code
					name = subs[i].name;//默认第一个项目的name
					serviceIcon = subs[i].serviceIcon;//默认第一个项目的serviceIcon
					var paymentType = subs[i].paymentType;
					paymentType = paymentType.split(",");
					$("#serviceId").val(serviceId);
					//支付方式默认第一个
					$.each(paymentType, function (index, value) {
						 if(value == '0'){
							orderpay +='<label class="label-checkbox orderpayradio" style="margin-left: 1.5rem;">';
							orderpay +='<input type="radio" name="paymentType" id="cashpPymentType" value="'+value+'">';
							orderpay +='<i class="icon icon-form-checkbox"></i>';
							orderpay +='<span>现付</span></label>';
						 }
						 if(value == '1'){
							orderpay +='<label class="label-checkbox orderpayradio">';
							orderpay +='<input type="radio" name="paymentType" id="monthlyType" checked="checked" value="'+value+'">';
							orderpay +='<i class="icon icon-form-checkbox"></i>';
							orderpay+='<span>月结</span></label>';
						 }
					});
				}
				$("#orderpay").html(orderpay);
				$("#reshowitem").html(reshowitem);
				
			}
		});
		
		//加载押金子项
		deposit(serviceId);
		
	}else{
		var paymentMethod = $("#paymentType").val();
		//初始化加载服务项目
		$.ajax({
			type:'POST',
			url:contextPath+'/wechat/signContract/queryServiceDetails',
			dataType: 'json',//返回值类型 一般设置为json
			data:{"serviceId":serviceId,"virtualArchitectureId":virtualArchitectureId},
			success: function (data)  //服务器成功响应处理函数
			{
				var json = data.map;// 获取data中list的数组
				//默认当前签约服务
				var reshowitem = "";
				var orderpay = "<span>支付方式</span>";
				if(null != json){
					reshowitem +='<img src='+visitPrefix+json.serviceIcon+' alt="" />';
					reshowitem +='<span>'+json.name+'</span>';
					reshowitem +='<i class="arrow-down"></i>';
					serviceId = json.id;//默认第一个项目的id
					code = json.code;//默认第一个项目的code
					name = json.name;//默认第一个项目的name
					serviceIcon = json.serviceIcon;//默认第一个项目的serviceIcon
					var paymentType = json.paymentType;
					paymentType = paymentType.split(",");
					$("#serviceId").val(serviceId);
					$("#code").val(code);
					$("#name").val(name);
					$("#serviceIcon").val(serviceIcon);
					//支付方式默认第一个
					$.each(paymentType, function (index, value) {
						if(value == '0'){
//							orderpay +='<label class="label-checkbox orderpayradio" style="margin-left: 1.5rem;">';
							orderpay +='<label class="orderpayradio" style="margin-left: 1.5rem;">';
							if(paymentMethod == value){
								orderpay +='<input type="radio" name="paymentType" id="cashpPymentType" checked="checked" value="'+value+'">';
							}else{
								orderpay +='<input type="radio" name="paymentType" id="cashpPymentType" value="'+value+'">';
							}
							orderpay +='<i class="icon icon-form-checkbox"></i>';
							orderpay +='<span>现付</span></label>';
						}
						if(value == '1'){
							orderpay +='<label class="orderpayradio">';
							if(paymentMethod == value){
								orderpay +='<input type="radio" name="paymentType" id="monthlyType" checked="checked" value="'+value+'">';
							}else{
								orderpay +='<input type="radio" name="paymentType" id="monthlyType" value="'+value+'">';
							}
							orderpay +='<i class="icon icon-form-checkbox"></i>';
							orderpay+='<span>月结</span></label>';
						}
					});
				}
				$("#orderpay").html(orderpay);
				$("#reshowitem").html(reshowitem);
				
			}
		});
		
		if(null == renewalContractId || renewalContractId == ""){
			//加载押金子项
			deposit(serviceId);
		}
		
		//加载签约押金信息
		var renewalContractId = $("#renewalContractId").val();
		if(null != renewalContractId && renewalContractId != ""){
			$.ajax({
				type : 'POST',
				url : contextPath+'/wechat/signContract/findSignBasics',
				data:{"signContractId":renewalContractId},
				dataType : 'json',// 返回值类型 一般设置为json
				success : function(data) // 服务器成功响应处理函数
				{
					$("#deposititem").empty();
					var subs = data.list;// 获取data中list的数组
					if(null == subs || subs == ""){
						return;
					}
					var deposititem = "";
					for(var i=0;i<subs.length;i++){
						nunbers = subs[i].id;
						deposititem +='<div class="deposititem">';
						deposititem +='<span>'+subs[i].name+'</span>'
						deposititem +='<div class="depositnum"><a href="javascript: void(0);" class="deminus"></a>';
						deposititem +='<input type="hidden" value="'+subs[i].basicsId+'" name="deposititemId" id="deposititemId_'+subs[i].basicsId+'"/>';
						deposititem +='<input type="input" class="numberdeposit" value="'+subs[i].number+'" name="deposititem" id="deposititem_'+subs[i].basicsId+'"/>';
						deposititem +='<a href="javascript: void(0);" class="deplus"></a></div>';
						deposititem +='<em>￥'+subs[i].deposit+'元</em></div>';
					}
					$("#deposititem").html(deposititem);
					
					if(subs.length > 0){
						$(".deposit").show();
					}
				}
				
			});
		}
		
		//加载签约商品
		var renewalContractId = $("#renewalContractId").val();
		if(null != renewalContractId && renewalContractId != ""){
			$.ajax({
				type : 'POST',
				url : contextPath+'/wechat/signContract/findProductSign',
				data:{"signContractId":renewalContractId},
				dataType : 'json',// 返回值类型 一般设置为json
				success : function(data) // 服务器成功响应处理函数
				{
					$("#commodity").empty();
					var subs = data.list;// 获取data中list的数组
					if(subs.length <= 0){
						return;
					}
					var commodity = '';
					for(var i=0;i<subs.length;i++){
						commodity +='<div class="deposititem">';
						commodity +='<span>'+subs[i].name+'</span>'
						commodity +='<em>￥'+subs[i].price+'</em></div>';
					}
					$("#commodity").html(commodity);
				}
				
			});
		}
		
	}
	
	$("#startTime").change(function(){
		var this_=$(this);
//		var bgDateValue=this_.val().substring(5);
		this_.siblings("em").html(this_.val());
	});
	$("#endTime").change(function(){
		var this_=$(this);
		this_.siblings("em").html(this_.val());
	});
	
	//商品类型切换
    $(".goodsitems").on("click", ".goods", function(){
        var _this = $(this);
        _this.addClass("goodstextsel").siblings(".goods").removeClass("goodstextsel");
        if(categoriesId == _this.attr("categories_Id")){
        	return;
        }
//        dataIdarr = [];//切换商品类型，清空所选意向商品
        
        categoriesId = _this.attr("categories_Id");
        typeCode = _this.attr("typeCode");
		// 根据商品分类id加载商品信息
		$.ajax({
			type : 'POST',
			url : contextPath+'/wechat/signContract/queryServicePackDetailsList',
			data :{"categoriesId":categoriesId},
			dataType : 'json',// 返回值类型 一般设置为json
			async : false,
			success : function(data) // 服务器成功响应处理函数
			{
				$("#showgoods").empty();
				var subs = data.list;// 获取data中list的数组
				if(subs.length <= 0){
					return;
				}
				var showgoods = "";

				for(var i=0;i<subs.length;i++){
						showgoods +='<div class="showgoodsitem" data-id="'+ subs[i].id + '">';
						showgoods +='<span><dt><img src="'+visitPrefix+subs[i].logoPath+'" alt="" /><i id="'+subs[i].id+'"></i></dt></span>';
						showgoods +='<dd>'+subs[i].name+'<br/>￥'+subs[i].price+'元</dd></div>';
						$("#showgoods").html(showgoods);
				}
				
				for(var j=0;j<subs.length;j++){
					$.each(dataIdarr,function(index,item){
						if(item==subs[j].id){ 
							$("#"+subs[j].id).addClass("showsel");
							
						}
					});
				}
			}
			
		});

    });
    
    
    //商品点击效果
    
    $(".showgoods").on("click", ".showgoodsitem", function(){
        var _this = $(this);
        var dataId =  _this.attr("data-id");
        if(!_this.find("i").hasClass("showsel")){
        	_this.find("i").addClass("showsel");
        	var flag=contains(dataIdarr,dataId);
        	if(!flag){
        		dataIdarr.push(dataId);
        	}
        } else {
            _this.find("i").removeClass("showsel");
            var flag=contains(dataIdarr,dataId);
            if(flag){
            	dataIdarr.remove(dataId);
            }
        }
    });

    // 点击出现服务列表2
    $(".reshowitem").click(function(){
    	if(null != renewalContractId && renewalContractId != ""){
    		return;
    	}
    	var virtualArchitectureId = $("#virtualArchitectureId").val();
    	//初始化加载服务项目
    	$.ajax({
    		type:'POST',
    		url:contextPath+'/wechat/signContract/queryServiceList',
    		dataType: 'json',//返回值类型 一般设置为json
    		data:{"userId":userId,"virtualArchitectureId":virtualArchitectureId},
    		success: function (data)  //服务器成功响应处理函数
    		{
    			$("#showsevicemask").empty();
    			var subs = data.list;// 获取data中list的数组
    			if(subs.length <= 0){
					return;
				}
    			var service = ('<div class="showsevice">');
    			for ( var i = 0; i < subs.length; i++) {//循环列表
    				service +='<dl class="sevice-item" serviceId="'+subs[i].id+'" code="'+subs[i].code+'" name="'+subs[i].name+'" serviceIcon="'+subs[i].serviceIcon+'" >';
    				service +='<dt><img src='+visitPrefix+subs[i].serviceIcon+' alt="" /></dt>';
    				service +='<dd><em>'+subs[i].name+'</em><span class="goodsnum"></span></dd></dl>';
    			}
    			service +="</div>";
    			$("#showsevicemask").html(service);
    		}
    	});
        $(".showsevicemask").show();
    });

    //展开意向商品
    $(".intentiontit").click(function(event){
//    	dataIdarr = [];
    	$.popup(".popup");
    	var sId = $("#serviceId").val();
    	if(sId == null || sId == ""){
    		sId = serviceId;
    	}
    	// 根据服务项id加载商品分类信息
		$.ajax({
			type : 'POST',
			url : contextPath+'/wechat/signContract/queryCategoriesList',
			data:{"serviceId":sId},
			dataType : 'json',// 返回值类型 一般设置为json
			async: false,
			success : function(data) // 服务器成功响应处理函数
			{
				$("#goodsitems").empty();
				var subs = data.list;// 获取data中list的数组
				if(subs.length <= 0){
					return;
				}
				var goodsitems = "";
				for(var i=0;i<subs.length;i++){
					if(i==0){
						goodsitems +='<div class="goods goodstextsel" categories_Id="'+subs[i].id+'" typeCode="'+subs[i].typeCode+'">';
						categoriesId = subs[i].id;
						typeCode = subs[i].typeCode;
					}else{
						goodsitems +='<div class="goods" categories_Id="'+subs[i].id+'" typeCode="'+subs[i].typeCode+'">';
					}
					goodsitems +='<span class="leftline"></span>';
					goodsitems +='<em class="goodstext ">'+subs[i].name+'</em>';
					goodsitems +='<span class="goodsnum"></span></div>';
				}
				$("#goodsitems").html(goodsitems);
				if(subs.length <= 0){
					$("#showgoods").empty();
					return;
				}
				// 根据商品分类id加载商品信息--默认加载第一个
				$.ajax({
					type : 'POST',
					url : contextPath+'/wechat/signContract/queryServicePackDetailsList',
					data:{"categoriesId":categoriesId},
					dataType : 'json',// 返回值类型 一般设置为json
					async: false,
					success : function(data) // 服务器成功响应处理函数
					{
						$("#showgoods").empty();
						var subs = data.list;// 获取data中list的数组
						if(subs.length <= 0){
							return;
						}
						var showgoods = "";
						for(var i=0;i<subs.length;i++){
							showgoods +='<div class="showgoodsitem" data-id="'+ subs[i].id + '">';
							showgoods +='<dt><img src="'+visitPrefix+subs[i].logoPath+'" alt="" /><i id="'+subs[i].id+'"></i></dt></span>'
							showgoods +='<dd>'+subs[i].name+'<br/>￥'+subs[i].price+'元</dd></div>';
						}
						$("#showgoods").html(showgoods);
					}
					
				});
				
				for(var j=0;j<subs.length;j++){
					$.each(dataIdarr,function(index,item){
						if(item==subs[j].id){ 
							$("#"+subs[j].id).addClass("showsel");
							
						}
					});
				}
			}
			
		});
    })
    
    //选中服务大项
    $(".showsevicemask").click(function(event){
        var _con = $(".showsevice");
        $("#commodity").empty();
        $("#showgoods").empty();
        dataIdarr = [];
        //初始化加载服务项目
		$.ajax({
			type:'POST',
			url:contextPath+'/wechat/signContract/queryServiceDetails',
			dataType: 'json',//返回值类型 一般设置为json
			data:{"serviceId":serviceId},
			success: function (data)  //服务器成功响应处理函数
			{
				var json = data.map;// 获取data中list的数组
				//默认第一个服务
				var reshowitem = "";
				var orderpay = "<span>支付方式</span>";
				if(null != json){
					reshowitem +='<img src='+visitPrefix+json.serviceIcon+' alt="" />';
					reshowitem +='<span>'+json.name+'</span>';
					reshowitem +='<i class="arrow-down"></i>';
					serviceId = json.id;//默认第一个项目的id
					code = json.code;//默认第一个项目的code
					name = json.name;//默认第一个项目的name
					serviceIcon = json.serviceIcon;//默认第一个项目的serviceIcon
					var paymentType = json.paymentType;
					paymentType = paymentType.split(",");
					$("#serviceId").val(serviceId);
					$("#code").val(code);
					$("#name").val(name);
					$("#serviceIcon").val(serviceIcon);
					//支付方式默认第一个
					$.each(paymentType, function (index, value) {
						if(value == '0'){
							orderpay +='<label class="label-checkbox orderpayradio" style="margin-left: 1.5rem;">';
							orderpay +='<input type="radio" name="paymentType" id="cashpPymentType" value="'+value+'">';
							orderpay +='<i class="icon icon-form-checkbox"></i>';
							orderpay +='<span>现付</span></label>';
						}
						if(value == '1'){
							orderpay +='<label class="label-checkbox orderpayradio">';
							orderpay +='<input type="radio" name="paymentType" id="monthlyType" checked="checked" value="'+value+'">';
							orderpay +='<i class="icon icon-form-checkbox"></i>';
							orderpay+='<span>月结</span></label>';
						}
					});
				}
				$("#orderpay").html(orderpay);
				$("#reshowitem").html(reshowitem);
				
			}
		});
		
        if(!_con.is(event.target) && _con.has(event.target).length === 0) {
            $(".showsevicemask").hide();
        }
    });
    
    //选择服务大项
    $(".showsevicemask").on("click", ".sevice-item", function(){
        var _this = $(this);
        var textval = _this.find("em").html();
        var imgval = _this.find("dt").children("img").eq(0)[0].src;
        $(".reshowitem").find("img")[0].src = imgval;
        $(".reshowitem").find("span").html(textval);
        _this.addClass("choiceitem").siblings(".sevice-item").removeClass("choiceitem");
        serviceId = _this.attr("serviceId");
        code = _this.attr("code");
        name = _this.attr("name");
        $("#serviceId").val(serviceId);
        $("#name").val(name);
        $("#serviceIcon").val(serviceIcon);
        $(".showsevicemask").hide();
        
        // 根据服务项id加载押金信息
        deposit(serviceId);
    });

    //添加押金子项
    $(".plusopen").click(function(){
    	$(".deposit").show();
        var _this = $(this);
        _this.toggleClass("zhankaiplus");
        $(".js-deposit").slideToggle(300);
        var serviceId = $("#serviceId").val();
        if(_this.prop("class")=='plusopen' || nunbers != ""){
        	return;
        }
        // 根据服务项id加载押金信息
        deposit(serviceId);
    });
	
    //添加商品展示到主页面
    $(".js-goods").click(function(){
    	$.closeModal(".popup");
        if(dataIdarr == null || dataIdarr == "" || dataIdarr == 'undefined'){
        	dataIdarr=[];
        	$("#commodity").empty();
        	return;
        }
        // 根据商品id加载商品列表信息
        var jsonString = JSON.stringify(dataIdarr);
		$.ajax({
			type : 'POST',
			url : contextPath+'/wechat/signContract/queryServiceDetailsList',
			data:{"dataIdarr":jsonString},
			dataType : 'json',// 返回值类型 一般设置为json
			success : function(data) // 服务器成功响应处理函数
			{
				$("#commodity").empty();
				var subs = data.list;// 获取data中list的数组
				if(subs.length <= 0){
					return;
				}
				var commodity = '';
				for(var i=0;i<subs.length;i++){
					commodity +='<div class="deposititem">';
					commodity +='<span>'+subs[i].name+'</span>'
					commodity +='<em>￥'+subs[i].price+'</em></div>';
				}
				$("#commodity").html(commodity);
			}
			
		});
    });
    
    //删除元素
    Array.prototype.indexOf = function(val) {              
        for (var i = 0; i < this.length; i++) {  
            if (this[i] == val) return i;  
        }  
        return -1;  
    }; 
    Array.prototype.remove = function(val) {  
        var index = this.indexOf(val);  
        if (index > -1) {  
            this.splice(index, 1);  
        }  
    }; 
});

function contains(arr, obj) {  
    var i = arr.length;  
    while (i--) {  
        if (arr[i] === obj) {  
            return true;  
        }  
    }  
    return false;  
}  


//点击确认跳转到确认页面
function saveServicelectit(){
	var contextPath = $("#contextPath").val();
	var sId = $("#serviceId").val();
	var userId = $("#userId").val();
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	var remarks = $("#remarks").val();
	sIcon = $("#serviceIcon").val();
	var organizationId = $("#organizationId").val();
	var virtualArchitectureId = $("#virtualArchitectureId").val();
	sname = $("#name").val();
	var paymentType = $("input[name='paymentType']:checked").val();
	renewalContractId = $("#renewalContractId").val();
	var signContractId = $("#signContractId").val();
	var codes = $("#code").val();
	if(sId == null || sId == ""){
		sId = serviceId;
	}
	if(sIcon == null || sIcon == ""){
		sIcon = serviceIcon;
	}
	if(sname == null || sname == ""){
		sname = name;
	}
	if(codes == null || codes == ""){
		codes = code;
	}
	if(startTime == null || startTime == ""){
		layer.alert("请选择协议开始时间");
		return;
	}
	if(endTime == null || endTime == ""){
		layer.alert("请选择协议结束时间");
		return;
	}
	if(paymentType == null || paymentType == ""){
		layer.alert("请选择支付方式");
		return;
	}
	/*if(dataIdarr == null || dataIdarr == "" || dataIdarr == 'undefined'){
    	layer.alert("请选择商品！");
    	return;
    }*/
	//押金子项
	var deposititemArray = document.getElementsByName("deposititem");
	var deposititem ="";
	for(i=0; i < deposititemArray.length; i++){
		deposititem += deposititemArray[i].value+",";
	}
	//押金子项id
	var deposititemIdArray = document.getElementsByName("deposititemId");
	var deposititemId = "";
	for(i=0; i < deposititemIdArray.length; i++){
		deposititemId += deposititemIdArray[i].value+",";
	}
	sname = encodeURI(encodeURI(sname));
	remarks = encodeURI(encodeURI(remarks));
	var url = contextPath+"/wechat/signContract/ordersevice?dataIdarr="+dataIdarr+"&organizationId="+organizationId+"&virtualArchitectureId="+virtualArchitectureId+"&deposititem="+deposititem+"&userId="+userId+"&typeCode="+typeCode+"&signContractId="+signContractId+
	"&serviceId="+sId+"&code="+codes+"&startTime="+startTime+"&endTime="+endTime+"&remarks="+remarks+"&dataIdarr="+dataIdarr+"&paymentType="+paymentType+"&serviceIcon="+sIcon+"&name="+sname+"&deposititemId="+deposititemId+"&renewalContractId="+renewalContractId;
	window.location.href=url;
//	window.location.href=contextPath+"/wechat/signContract/toOrderSeviceselectitem?virtualArchitectureId="+data.virtualArchitectureId+"&organizationId="+organizationId;
}

//押金子项
function deposit(serviceId){
	var contextPath = $("#contextPath").val();
	// 根据服务项id加载押金信息
	$.ajax({
		type : 'POST',
		url : contextPath+'/wechat/signContract/queryDepositItemList',
		data:{"serviceId":serviceId},
		dataType : 'json',// 返回值类型 一般设置为json
		success : function(data) // 服务器成功响应处理函数
		{
			$("#deposititem").empty();
			var subs = data.list;// 获取data中list的数组
			if(null == subs || subs == ""){
				$(".deposit").hide();
				return;
			}else{
				$(".deposit").show();
			}
			var deposititem = "";
			for(var i=0;i<subs.length;i++){
				nunbers = subs[i].id;
				deposititem +='<div class="deposititem">';
				deposititem +='<span>'+subs[i].deposName+'</span>'
				deposititem +='<div class="depositnum"><a href="javascript: void(0);" class="deminus"></a>';
				deposititem +='<input type="hidden" value="'+subs[i].id+'" name="deposititemId" id="deposititemId_'+subs[i].id+'"/>';
				deposititem +='<input type="input" class="numberdeposit" value="0" name="deposititem" id="deposititem_'+subs[i].id+'"/>';
				deposititem +='<a href="javascript: void(0);" class="deplus"></a></div>';
				deposititem +='<em>￥'+subs[i].price+'元</em></div>';
			}
			$("#deposititem").html(deposititem);
			
		    // 每次点击“+”往上加一
		    $(".deplus").click(function(event){
		        var _this = $(this);
		        var number = Number(_this.siblings(".numberdeposit").val());
		        if(isNaN(number)){
		            number = 0;
		        }
		        number++;
		        _this.siblings(".numberdeposit").val(number);
		    });
		    // 每次点击“-”减一，且减到小于等于零时为空
		    $(".deminus").click(function(event){
		        var _this = $(this);
		        var number = Number(_this.siblings(".numberdeposit").val());
		        if(isNaN(number)){
		            number = 0;
		        }
		        number--;
		        if(number <= 0) {
		            number = 0;
		        }
		        _this.siblings(".numberdeposit").val(number);
		        
		    });

		    $(".numberdeposit").keyup(function(event){
		        var _this = $(this);
		        var keyNumber = _this.val();
		        // 当输入为负数时为空
		        if(parseInt(keyNumber) <= 0 || isNaN(parseInt(keyNumber))){
		            keyNumber = 0;
		            _this.val(0);
		        } else if(parseInt(keyNumber)){
		            _this.val(parseInt(keyNumber));
		        }
		   });
		}
		
	});
}
