function bankcard(flag){
   var id =GetQueryString("id");
   // 判断否有订单
    if(  id!="null" &&id!="" &&id!=undefined){
    	$("#img").attr("onclick","location.href='../product/appointmentDetail.html?id="+id+"'");
    	if(flag){
    		 $("#btn").html("确定");
    		 $("#addBankcard")[0].setAttribute("style","display:block");
    		 $("#addBankcard").on("click",function() {
     	    	localStorage.setItem("orderId", GetQueryString("id"));
     	    	return location.href="./bankAdd.html"
     	      });
     	 
    	$(document).on("tap", ".item", function() {
 	      $(this).parents(".am-flexbox").addClass("active").siblings().removeClass("active");
 	    });
     	
     	 $("#btn").on("tap", function() {
     		 var bankcardId=$(".active").children()[1].getAttribute("data-id");
     		 if(bankcardId!=undefined&&bankcardId!="null"){
     	  	     return  Ajax({
     	  	            url: baseUrl + '/api/order/add_order_bankcard.do',
     	  	            data:{orderId:id,bankCardId:bankcardId,
     	  	            	majorStatus:1073,
     	   	        	   minorStatus:1082 
     	  	            },
     	  	            callback: function(data) {
     	  	            	toast.success({msg:"申请返佣成功"});
     	  	            	setTimeout(function(){
     	  	            		return location.href = "../product/appointmentDetail.html" + (id ? "?id="+id  : "");
     	  	            	},1000);
     	  	            }
     	  	      });
     	  	 }else{
     	  		 wrongMsg("请选择返佣银行卡");
     	  		 toast.hide(2000);
     	  	 }
     	    });
    	}else{
    		$("#btn").on("click", function() {
    			localStorage.setItem("orderId", GetQueryString("id"));
     	    	return location.href="./bankAdd.html"
    		});
    	}
    	 
    }else{
    	 $("#img").attr("onclick","location.href='../user/userInfo.html'");
    	 $(document).on("tap", ".item,.icon-duigou", function() {
  	    	var cardId;
  	        cardId=$(this).data("id");
  	        $("#sure").val(cardId);
  	        return $("#mask").show();
  	      });
     	 $(".am-message-main").html("设为我的首选银行卡");
     	 $("#sure").on("click", function() {
     	    	
              var cardId=$("#sure").val();
         
              return Ajax({
                 url: baseUrl + '/api/user/default_bankcard.do',
                 data:{
                 	bankCardId:cardId
                 },
                 callback: function(data) {
                      $("#mask").hide();
                      return location.href = "./bankCard.html";
                  }
              });
 	    });
    	 
    	$("#btn").on("click",function(){
    		return location.href = "./bankAdd.html" ;
    	}); 
       }
 }