{
    template:'${tmpl}',
    data:function(){
        return {
          multipleSelection: [],
          tableData: [],
          logo:"",
          d:{},

        }
    },
    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/tmqueryCtl/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/tmqueryCtl/createTrade",{"productId":productId}).then(function(d){
                   if(d!=null && d.id!=null && d.id!=""){
                     that.$refs.card.changeButtonState();
                     that.$store.state.currentUser["accountBalance"]=d.accountBalance;
                     that.$refs.grid.showDlgForm();
                     that.d=row;
                     that.getTmFlowInfo(row);
                     that.getTmNclSmallCodesInfo(row);
                     that.logo=row.logo;
                     that.$message({
                          type: 'success',
                          message: '本次查询消费了'+d.baoAmount+'宝币'
                        });
                   }else{
                     that.$message.warning(`操作失败，请刷新页面后重新操作`);
                   }

                 }).catch(function(e){
                   that.$message.warning(`操作失败，请刷新页面后重新操作`);
                 });
             }else{
               that.$message.warning(`宝币余额不足，请及时充值`);
               return false;
             }
         });
       }).catch(()=>{

       });



      },
      getTmFlowInfo(row){
        var that=this;
        this.$root.postReq("/web/tmqueryCtl/getTmFlowByRegNum",{"regNum":row.sbzch}).then(function(d){
          that.d["lcxx"]=d;
        });
      },
      getTmNclSmallCodesInfo(row){
        var that=this;
        this.$root.postReq("/web/tmqueryCtl/getTmNclSmallCodesByRegNum",{"regNum":row.sbzch,"nclOneCode":row.gjfl}).then(function(d){
          that.d["spfwxm"]=d;
        });
      },
      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-xzsearch"
}
