diff --git a/pagesC/addequipment/addequipment.vue b/pagesC/addequipment/addequipment.vue index 969ea8e..25c8b4b 100644 --- a/pagesC/addequipment/addequipment.vue +++ b/pagesC/addequipment/addequipment.vue @@ -89,38 +89,39 @@ return z.y + '-' + z.M + '-' + z.d + ' ' + z.h + ':' + z.m + ':' + z.s }, submit() { - if (this.data.sn) { - if (this.data.deviceType) { - binding(this.data).then(res => { - if (res.code == 200) { - this.$refs.uToast.show({ - title: '绑定成功', - type: 'success', - }) - setTimeout(function() { - uni.navigateBack({ - delta: 1 - }) - }, 2000); - } else { - this.$refs.uToast.show({ - title: res.msg, - type: 'error', - }) - } - }) - } else { - this.$refs.uToast.show({ - title: '请选择设备类型', - type: 'error', - }) - } - } else { + if (!this.data.sn) { this.$refs.uToast.show({ title: '请输入设备序列号', type: 'error', }) + return } + if (!this.data.deviceType) { + this.$refs.uToast.show({ + title: '请选择设备类型', + type: 'error', + }) + return + } + binding(this.data).then(res => { + if (res.code == 200) { + this.$refs.uToast.show({ + title: '绑定成功', + type: 'success', + }) + setTimeout(function() { + uni.navigateBack({ + delta: 1 + }) + }, 2000); + } else { + this.$refs.uToast.show({ + title: res.msg, + type: 'error', + }) + } + }) + } } }