{
  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("ecid");
    if(this.eaccount_id && this.eaccount_id != "undefined") {
      if(ecid && ecid != "null" && ecid != "undefined") {
        this.$root.postReq("/web/dksignCtl/twaitsign", {
          id: ecid,
          eaccount_id: this.eaccount_id,
        }).then(function (d) {
          if (d.status == 0) {
            var dkcompany = d.data;
            dkcompany.isInsure = true;
            dkcompany.companyid = d.data.dkcompany_id;
            dkcompany.companyname = d.data.dkcompany.name;
            that.cs = [dkcompany];
            console.log(dkcompany, "aaaaaaaaaaaaaaaaaaaaaaaaaaaa ecid");
          }
        });
      }
    } else {
      var signinforouter = localStorage.getItem("signinforouter");
      this.$router.push(signinforouter || "/ecompany/tsigninfo");
    }
    this.getTsAccount();
  },
  created: function () {

  },
  methods: {
    startsign(item) {
      item.isInsure = false;

      var self = this;
      self.signloading = true;

      var id = item.id;
      var ecompany_id = localStorage.getItem("ecompany_id");
      var apply_id = localStorage.getItem("apply_id") || "";

      var ctl = item.dkaggreement.ctlname || "dksignCtl/genContract";
      this.$root.postReq("/web/" + ctl, {
        dktemplate_id: 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 => {}
          });
        }
        setTimeout(() => {
          self.signloading = false;  
        }, 2000);
      });
    },
    getTsAccount() {
      if (!this.eaccount_id) {
        return;
      }
      var self = this;
      this.$root.postReq("/web/dksignCtl/getAccount", {
        id: this.eaccount_id
      }).then(function (d) {
        if (d.status == 0) {
          self.eaccount = d.data;
        }
      });
    },
  },
  vname: "gsb-twaitsign"
}