{
    template:'${tmpl}',
    data:function(){
        return {
          multipleSelection: [],
          tagkey:"xzcolumnMetaData",
          tableData: []
        }
    },
    mounted:function(){

    },
    created:function(){

    },
    methods:{
      pageChanged(ps,cp,searchObj){
        if(searchObj==null){
          return false;
        }
        var obj={
            search:searchObj,
            pageInfo:{
              pageSize:ps,
              pageNo:cp
            }
        };
        var that=this;
        this.$root.postReq("/web/xzallCtl/findAndCountAll",obj).then(function(d){
            that.$refs.grid.data=d.data.rows;
        }).catch(function(e){
          that.$message.warning(`操作失败，请刷新页面后重新操作`);
        });
      },
      rowClick(row,key){
        var that=this;
        var search= this.$refs.grid.currentSearchObj;
        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/xzallCtl/createTrade",{"productId":productId,"companyName":row.companyName}).then(function(d){
                   if(d!=null && d.id!=null && d.id!=""){
                     that.$refs.card.changeButtonState();
                     console.log("123456543212345");
                     var qobj=that.$refs.grid.getSearchForm().$refs.baseform.formModel;
                     console.log(qobj);
                     that.$refs.grid.fetchData2(qobj);
                     that.$store.state.currentUser["accountBalance"]=d.accountBalance;
                     that.$refs.grid.showDlgForm();
                     that.$refs.grid.setInitFormData(row);
                     that.$nextTick(()=>{
                       if(key=="xz")
                       {
                         that.tagkey={tagkey:["xzcolumnMetaData"],companyName:row.companyName};
                       }
                       else if (key=="xzgq") {
                         that.tagkey={tagkey:["xzgqcolumnMetaData"],companyName:row.companyName};
                       }
                       else if (key=="yy") {
                         that.tagkey={tagkey:["yycolumnMetaData"],companyName:row.companyName};
                       }
                       else if (key=="by") {
                         that.tagkey={tagkey:["bycolumnMetaData"],companyName:row.companyName};
                       }

                     });
                     that.$message({
                          type: 'success',
                          message: '本次查询消费了'+d.baoAmount+'宝币'
                        });
                   }else{
                     that.$message.warning(`操作失败，请刷新页面后重新操作`);
                   tagkey}

                 }).catch(function(e){
                   that.$message.warning(`操作失败，请刷新页面后重新操作`);
                 });

             }else{
               that.$message.warning(`宝币余额不足，请及时充值`);
               return false;
             }
         });
       }).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-xzall"
}
