;
var repairDetailPage = new Vue({
    el: "#repairDetailPage",
    data: {
        userId: 0,
        currenflag:1,
        id:'',
        info:{},
        params:{
             id:'',
             solveStatus:1,// 0未解决 1 已解决
             serviceRating:'',//服务频分
             serviceEvaluate:'',//服务频率
        },
        spanIndex:[],
    },
    computed: {

    },
    methods: {
        submit:function(){ //提交评论
            var _this = this;
            if( _this.params.serviceRating==0){
                CAIMEI.Alert('请评价服务态度','确定')
            }else if( _this.params.serviceEvaluate==''){
                CAIMEI.Alert('请输入具体评价','确定')
            }else {
                 RepairApi.evaluation(_this.params,function (res) {
                    if (res.code==0){
                        CAIMEI.dialog('提交成功');
                        location.reload();
                    }else {
                       CAIMEI.Alert(response.msg,'确定',false);
                    }
               })
            }

        },
        Evaluation:function (index) {
            var _this = this;
            _this.currenflag = index;
            _this.params.solveStatus = index;
        },
        currenindex:function(index){
            var _this = this;
            var  arrIndex = _this.spanIndex.indexOf(index);
             if(arrIndex>-1){
                    _this.spanIndex.splice(arrIndex,1);
                     _this.params.serviceRating =_this.spanIndex.length;
                }else{
                    _this.spanIndex.push(index);
                    _this.params.serviceRating = _this.spanIndex.length;
                }
        },
      Detailinfo:function () {
        var _this = this;
        RepairApi.MaintenanceDetail({id:_this.id},function (res) {
           if(res.code==0){
            console.log(res)
            _this.info = res.data
           }
        })
      }
    },
    mounted: function () {
        var _self=this;
        if(globalUserData){
            _self.userId = globalUserData.userId;
        }
        _self.id = CAIMEI.getUrlParam('id');
        _self.params.id=CAIMEI.getUrlParam('id');
        _self.Detailinfo();
        $('.navLayout').find('.navList').removeClass("on").find('.con').hide().find('a').removeClass("on");
        $('.navLayout').find('.navList').eq(0).addClass("on").find('.con').show().find('a').eq(1).addClass("on");
    }
});
