diff --git a/litemall-admin/src/views/goods/create.vue b/litemall-admin/src/views/goods/create.vue index 5e043327..0947a9d8 100644 --- a/litemall-admin/src/views/goods/create.vue +++ b/litemall-admin/src/views/goods/create.vue @@ -370,11 +370,9 @@ attributes: this.attributes } publishGoods(finalGoods).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建成功' }) this.$router.push({ path: '/goods/list' }) }).catch(response => { diff --git a/litemall-admin/src/views/goods/edit.vue b/litemall-admin/src/views/goods/edit.vue index 49d1026f..7e329c98 100644 --- a/litemall-admin/src/views/goods/edit.vue +++ b/litemall-admin/src/views/goods/edit.vue @@ -364,11 +364,9 @@ export default { attributes: this.attributes } editGoods(finalGoods).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建成功' }) this.$router.push({ path: '/goods/list' }) }).catch(response => { diff --git a/litemall-admin/src/views/goods/list.vue b/litemall-admin/src/views/goods/list.vue index 022051d3..3def66f6 100644 --- a/litemall-admin/src/views/goods/list.vue +++ b/litemall-admin/src/views/goods/list.vue @@ -196,14 +196,17 @@ export default { }, handleDelete(row) { deleteGoods(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/mall/brand.vue b/litemall-admin/src/views/mall/brand.vue index 2cf3811e..84260f32 100644 --- a/litemall-admin/src/views/mall/brand.vue +++ b/litemall-admin/src/views/mall/brand.vue @@ -204,11 +204,14 @@ export default { createBrand(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -234,11 +237,14 @@ export default { } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -246,14 +252,17 @@ export default { }, handleDelete(row) { deleteBrand(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/mall/category.vue b/litemall-admin/src/views/mall/category.vue index 003592a0..c01d4e82 100644 --- a/litemall-admin/src/views/mall/category.vue +++ b/litemall-admin/src/views/mall/category.vue @@ -264,11 +264,14 @@ export default { createCategory(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -294,11 +297,14 @@ export default { } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -306,14 +312,17 @@ export default { }, handleDelete(row) { deleteCategory(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/mall/issue.vue b/litemall-admin/src/views/mall/issue.vue index c1d46c9b..a6778fef 100644 --- a/litemall-admin/src/views/mall/issue.vue +++ b/litemall-admin/src/views/mall/issue.vue @@ -140,11 +140,14 @@ export default { createIssue(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -170,11 +173,14 @@ export default { } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -182,14 +188,17 @@ export default { }, handleDelete(row) { deleteIssue(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/mall/keyword.vue b/litemall-admin/src/views/mall/keyword.vue index 7851659a..ed319a49 100644 --- a/litemall-admin/src/views/mall/keyword.vue +++ b/litemall-admin/src/views/mall/keyword.vue @@ -175,11 +175,14 @@ export default { createKeyword(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -205,11 +208,14 @@ export default { } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -217,14 +223,17 @@ export default { }, handleDelete(row) { deleteKeyword(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/mall/order.vue b/litemall-admin/src/views/mall/order.vue index 2588c07d..f9bcd4ae 100644 --- a/litemall-admin/src/views/mall/order.vue +++ b/litemall-admin/src/views/mall/order.vue @@ -262,13 +262,16 @@ export default { if (valid) { shipOrder(this.shipForm).then(response => { this.shipDialogVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '确认发货成功', - type: 'success', - duration: 2000 + message: '确认发货成功' }) this.getList() + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) } }) @@ -287,13 +290,16 @@ export default { if (valid) { refundOrder(this.refundForm).then(response => { this.refundDialogVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '确认退款成功', - type: 'success', - duration: 2000 + message: '确认退款成功' }) this.getList() + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) } }) diff --git a/litemall-admin/src/views/mall/region.vue b/litemall-admin/src/views/mall/region.vue index 2bc87ab3..8335a40b 100644 --- a/litemall-admin/src/views/mall/region.vue +++ b/litemall-admin/src/views/mall/region.vue @@ -68,8 +68,7 @@ export default { const typeMap = { '1': '省', '2': '市', - '3': '区', - '4': '街道' + '3': '区' } return typeMap[status] } diff --git a/litemall-admin/src/views/promotion/ad.vue b/litemall-admin/src/views/promotion/ad.vue index 99e00f3b..3f126424 100644 --- a/litemall-admin/src/views/promotion/ad.vue +++ b/litemall-admin/src/views/promotion/ad.vue @@ -234,11 +234,14 @@ export default { createAd(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -264,11 +267,14 @@ export default { } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新广告成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -276,14 +282,17 @@ export default { }, handleDelete(row) { deleteAd(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/promotion/grouponRule.vue b/litemall-admin/src/views/promotion/grouponRule.vue index 62976b58..7f35e031 100644 --- a/litemall-admin/src/views/promotion/grouponRule.vue +++ b/litemall-admin/src/views/promotion/grouponRule.vue @@ -178,11 +178,14 @@ publishGroupon(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建团购规则成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -208,11 +211,14 @@ } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新团购规则成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -220,14 +226,17 @@ }, handleDelete(row) { deleteGroupon(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除团购规则成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/promotion/topic.vue b/litemall-admin/src/views/promotion/topic.vue index 809e2819..bdac76cc 100644 --- a/litemall-admin/src/views/promotion/topic.vue +++ b/litemall-admin/src/views/promotion/topic.vue @@ -253,11 +253,14 @@ export default { createTopic(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '创建专题成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -287,11 +290,14 @@ export default { } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新专题成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -299,14 +305,17 @@ export default { }, handleDelete(row) { deleteTopic(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除专题成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/sys/admin.vue b/litemall-admin/src/views/sys/admin.vue index a7eb2029..e5042924 100644 --- a/litemall-admin/src/views/sys/admin.vue +++ b/litemall-admin/src/views/sys/admin.vue @@ -221,11 +221,14 @@ export default { createAdmin(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '添加管理员成功' + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }) } @@ -251,11 +254,14 @@ export default { } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新管理员成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -263,14 +269,17 @@ export default { }, handleDelete(row) { deleteAdmin(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除管理员成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/sys/os.vue b/litemall-admin/src/views/sys/os.vue index 4f74083d..f6a0eb7b 100644 --- a/litemall-admin/src/views/sys/os.vue +++ b/litemall-admin/src/views/sys/os.vue @@ -147,11 +147,9 @@ export default { createStorage(formData).then(response => { this.list.unshift(response.data.data) this.createDialogVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '上传成功' }) }).catch(() => { this.$message.error('上传失败,请重新上传') @@ -176,11 +174,14 @@ export default { } } this.updateDialogVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -188,14 +189,17 @@ export default { }, handleDelete(row) { deleteStorage(row).then(response => { - this.$notify({ + this.$notify.success({ title: '成功', - message: '删除成功', - type: 'success', - duration: 2000 + message: '删除成功' }) const index = this.list.indexOf(row) this.list.splice(index, 1) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg + }) }) }, handleDownload() { diff --git a/litemall-admin/src/views/user/user.vue b/litemall-admin/src/views/user/user.vue index 016762e0..71be4a83 100644 --- a/litemall-admin/src/views/user/user.vue +++ b/litemall-admin/src/views/user/user.vue @@ -70,10 +70,7 @@ - - - - + @@ -125,25 +122,6 @@ import { fetchList, createUser, updateUser } from '@/api/user' export default { name: 'User', data() { - var validatePass = (rule, value, callback) => { - if (value === '') { - callback(new Error('请输入密码')) - } else { - if (this.dataForm.checkPassword !== '') { - this.$refs.dataForm.validateField('checkPassword') - } - callback() - } - } - var validatePass2 = (rule, value, callback) => { - if (value === '') { - callback(new Error('请再次输入密码')) - } else if (value !== this.dataForm.password) { - callback(new Error('两次输入密码不一致!')) - } else { - callback() - } - } return { list: null, total: null, @@ -161,7 +139,6 @@ export default { username: '', mobile: '', password: undefined, - checkPassword: undefined, gender: 0, userLevel: 0, birthday: undefined, @@ -176,14 +153,7 @@ export default { rules: { username: [{ required: true, message: '用户名不能为空', trigger: 'blur' }], mobile: [{ required: true, message: '手机号码不能为空', trigger: 'blur' }], - password: [ - { required: true, message: '密码不能为空', trigger: 'blur' }, - { validator: validatePass, trigger: 'blur' } - ], - checkPassword: [ - { required: true, message: '密码不能为空', trigger: 'blur' }, - { validator: validatePass2, trigger: 'blur' } - ] + password: [{ required: true, message: '密码不能为空', trigger: 'blur' }] }, downloadLoading: false, genderDic: ['未知', '男', '女'], @@ -246,11 +216,14 @@ export default { createUser(this.dataForm).then(response => { this.list.unshift(response.data.data) this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '创建成功', - type: 'success', - duration: 2000 + message: '添加用户成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } @@ -276,22 +249,23 @@ export default { } } this.dialogFormVisible = false - this.$notify({ + this.$notify.success({ title: '成功', - message: '更新成功', - type: 'success', - duration: 2000 + message: '更新成功' + }) + }).catch(response => { + this.$notify.error({ + title: '失败', + message: response.data.errmsg }) }) } }) }, handleDelete(row) { - this.$notify({ + this.$notify.error({ title: '警告', - message: '用户删除操作不支持!', - type: 'warning', - duration: 3000 + message: '用户删除操作不支持!' }) }, handleDownload() {