{
    template:'${tmpl}',
    data:function(){
        return {
          multipleSelection: [],
          tableData: [],
          file:"",
          activeNames: ['1']
        }
    },
    mounted:function(){

    },
    created:function(){

    },
    methods:{
      pageChanged(ps,cp,searchObj){
        var obj={
            search:searchObj,
            pageInfo:{
              pageSize:ps,
              pageNo:cp
            }
        };
        var that=this;

        this.$root.postReq("/web/byslsearchCtl/findAndCountAll",obj).then(function(d){
            that.$refs.grid.data=d.data.rows;
        }).catch(function(e){
          that.$message.warning(`操作失败，请刷新页面后重新操作`);
        });
      },
      rowClick(row,key){
        var that=this;
        if(row.file=="" || row.file==null){
          that.$message.warning(`文档为空`);
          return false;
        }
        this.$confirm('此操作将消费宝币, 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(()=>{
         var productId=this.$router.currentRoute.params.id;
         this.$root.getReq("/web/userCtl/checkAccountBalance",{"productId":productId}).then(function(d){
           if(d){
             that.$root.postReq("/web/byslsearchCtl/createTrade",{"productId":productId}).then(function(d){
               if(d!=null && d.id!=null && d.id!=""){
                 that.file=row.file;
                 that.$store.state.currentUser["accountBalance"]=d.accountBalance;
                 that.$refs.card.changeButtonState();
                 that.$refs.grid.showDlgForm();
                 that.getContactInfo(row);
               }
             });
           }
         });
       }).catch(()=>{

       });
      },
      getContactInfo(row){
        var that=this;
        var searchOptions={
          companyName:row.companyName,
          pagesize:"1",
          page:"1",
          appKey:"wx76a324c5d201d1a4"
        };
        this.$root.postReq("/api/company/pageAnnualReport",searchOptions).then(function(d){
          if(d.status==0){
            if(d.data && d.data.result==1){
              row["phone"]=d.data.list[0].phoneNumber==""?"未公开":d.data.list[0].phoneNumber;
              row["email"]=d.data.list[0].email==""?"未公开":d.data.list[0].email;
            }else{
              row["phone"]="未公开";
              row["email"]="未公开";
            }

          }else{
            row["phone"]="未公开";
            row["email"]="未公开";
          }
          that.$refs.grid.setInitFormData(row);
        });

      },
      onColFormater(row,column,cellvalue,index){
        if(column.property=="created_at"){
           return new Date(cellvalue).toLocaleString();
        }
        if(column.property=="sex"){
          if(cellvalue=='male'){
            return "男";
          }
           if(cellvalue=='female'){
              return "女";
          }
        }else{
            return cellvalue;
        }
      },

    },
    computed: Vuex.mapState({
      count:state=>state.count,
      headStyle:function(){
        return {"background-color":"white"};
      }
    }),
    vname:"gsb-byslsearch"
}
