// Generated by CoffeeScript 1.8.0
(function() {
  $(function() { 
    $(".toast").hide();
    $("#text").html("添加银行卡");
    return $("button.am-button").click(function() {
        if (!isNotNull($("#bank")[0], "开户银行")) {
          return;
        }else if(!isNotNull($("#name")[0], "开户人姓名")){
        	return;
        }else if(!isBankCard($("#cardno")[0], "银行卡卡号")){
        	return;
        }
        return Ajax({
          url: baseUrl + '/api/user/add_bankcard.do',
          data: $("#bankAdd").serialize(),
          success: function(data) {
            if (data.status === 200) {
            	 toast.success({msg:"添加成功"});
                 setTimeout(function(){
                	 var id=localStorage.getItem("orderId");
               	  if(id!=null&&id!="null"){
                     	localStorage.clear();
                     	return location.href ="./bankCard.html?id="+id;
                     }else{
                   	return location.href ="./bankCard.html";
                     }
                 },2000);
            }else{
          	  wrongMsg(data.message);
            }
          }
        });
      });
  
  });
  
}).call(this);
