{
    template:'${tmpl}',
    data:function(){
        return {
          cs:[],
          eaccount_id : 0,
          signloading : false,
          eaccount : {}
        }
    },
    mounted:function(){
      var that=this;

      this.eaccount_id = localStorage.getItem("eaccount_id") || 0;

      var ecid=localStorage.getItem("ecompany_id");
      if(ecid && ecid!="" && ecid!="undefined" && this.eaccount_id && this.eaccount_id != "undefined"){
        this.$root.postReq("/web/etemplateCtl/findReadyContracts",{ecompany_id:ecid, eaccount_id:this.eaccount_id}).then(function(d){
          if(d.status==0){
            that.cs=d.data;
            console.log(that.cs);
          }
        });
      }else{
        this.$router.push("/ecompany/signinfo");
      }
      /* this.getLoginUser(); */
      this.getAccount();
    },
    created:function(){

    },
    methods:{
     startsign:function(id) {
       var self = this;
       self.signloading=true;
       var ecid=localStorage.getItem("ecompany_id");

       this.$root.postReq("/web/econtractCtl/genContract",{
         etemplateid : id,
         eaccount_id : self.eaccount_id
       }).then(function(d){
         if(d.status==0){
           if(d.data.esignUrl) {
             window.location.href = d.data.esignUrl;
           }
         } else {
           self.$alert(d.msg || "系统忙，请稍候重试", '提示', {
              confirmButtonText: '确定',
              callback: action => {
              }
            });
         }
          self.signloading = false;
       });
     },
     getAccount : function (){
       if(!this.eaccount_id) {
         return;
       }
       var self =this;
       this.$root.postReq("/web/usereaccountCtl/findOne",{id:this.eaccount_id}).then(function(d){
         if(d.status==0){
           self.eaccount = d.data;
         }
       });
     }

     /*
     getLoginUser : function (){
       var self =this;
       this.$root.postReq("/web/userCtl/loginUser",{}).then(function(d){
         if(d.status==0){
           self.loginUser = d.data;
         }
       });
     }
     */
    },
    vname:"gsb-waitsign"
}
