微信云开发传值判断问题

为什么这段代码只有账号和数据库相同 时才报错, 当账号不同时不报错?

            submit() {
                this.$refs.uLogin.validate().then(res => {
                uni.$u.toast('正在登录')
                
                    this.isConfirm = false;
                    setTimeout(() => {
                        this.isConfirm = true
                        const db = wx.cloud.database()
                        let vm = this
                        db.collection('userAccounts').where({
                            user:vm.login.userInfo.user,
                            
                        }).get({
                            success: function(res) {
                                
                                if((res.data[0].password==vm.login.userInfo.password)&&(res.data[0].user==vm.login.userInfo.user)){
                                    uni.$u.toast('欢迎回家!');
                                }else{
                                    uni.$u.toast('账号或密码错误!');
                                }
                                
                            }
                        })
                        // 这里此提示会被this.start()方法中的提示覆盖
                    
                        // 通知验证码组件内部开始倒计时

                    }, 2000);
                    // this.isConfirm=false;
                }).catch(errors => {
                    this.isConfirm = false;
                    setTimeout(() => {
                        this.isConfirm = true
                        // 这里此提示会被this.start()方法中的提示覆盖
                        uni.$u.toast('账号或密码错误');
                        // 通知验证码组件内部开始倒计时

                    }, 2000);
                })
            },

db.collection('userAccounts').where({
                            user:vm.login.userInfo.user,
                            password:vm.login.userInfo.password
                        }).get({
                            success: function(res) {
                                  //在这里面就算改变了this的指向也无法获取到 this.login.userinfo.user还有password值 所以一直没反应。
                                  if(res.data.length==0){
                                      uni.$u.toast('密码或账号错误')
                                  }else{
                                        uni.$u.toast('欢迎回家')
                                  }
                                   
                            }
                        })

采取曲线救国的方式, 搞定