{
    template:'${tmpl}',
    data:function(){
        return {
          id : "",
          pageSize : 500,
          currentPage : 1,
          failId : 0,
          successId:0,
          dialogFormVisible: false,
          dialogFormVisible2: false,
          form:{
            reason:""
          },
          form2:{
            money:"",
            notes:""
          },
          datalist:[],
        };
    },
    mounted:function(){
    },
    created:function(){
      this.getList();
    },
    methods:{
      getList() {
        var self = this;
        var params = {
          search : {user_id : this.$root.currentUser.id}
        };
        params.pageInfo={pageSize:this.pageSize,pageNo:this.currentPage};
        params.pageType = 2;
        this.$root.postReq("/web/businessallotCtl/findAndCountAll", params).then(d=>{
          console.log(d);
          if(d.status == 0) {
            self.datalist = self.datalist.concat(d.data.rows);
          }
        });
      },
      successop(id){
        this.successId = id;
        this.dialogFormVisible2 = true;
      },
      success(){
        var self = this;
        if(!this.form2.money) {
          this.dialogFormVisible2=false;
          this.$alert('请填写成单金额', '提示', {
             confirmButtonText: '确定',
             callback: action => {
             }
           });
          return;
        }
        if(isNaN(this.form2.money)) {
          this.dialogFormVisible2=false;
          this.$alert('成单金额必须为数字', '提示', {
             confirmButtonText: '确定',
             callback: action => {
             }
           });
          return;
        }
        var params={
          id:this.successId,
          money:this.form2.money,
          reason:this.form2.notes
        };
        this.$root.postReq("/web/businessallotCtl/success",params).then(d=>{
          if(d.status==0){
            self.$root.$refs.bottommenu.trigger("dealed");
          }
        });
      },
      failop(id) {
        this.failId = id;
        this.dialogFormVisible = true;
      },
      fail(){
        var self = this;
        if(!this.form.reason) {
          this.dialogFormVisible=false;
          this.$alert('请填写失败原因', '提示', {
             confirmButtonText: '确定',
             callback: action => {
             }
           });
          return;
        }
        this.$root.postReq("/web/businessallotCtl/failue", {id : this.failId, reason: this.form.reason}).then(d=>{
          if (d.status == 0) {
            self.$root.$refs.bottommenu.trigger("dealed");
          }
        });
      }
  },
    vname:"gsb-dealing"
}
