|
@@ -13,7 +13,8 @@ var vm = new Vue({
|
|
|
editGroupNameDialog: {
|
|
|
show: false,
|
|
|
type: '', // 状态:add/edit
|
|
|
- value: ''
|
|
|
+ value: '',
|
|
|
+ tipText: ''
|
|
|
},
|
|
|
},
|
|
|
computed: {
|
|
@@ -343,6 +344,7 @@ var vm = new Vue({
|
|
|
editGroupName: function (editType, item, index) {
|
|
|
this.editGroupNameDialog.type = editType
|
|
|
this.editGroupNameDialog.show = true
|
|
|
+ this.editGroupNameDialog.tipText = ''
|
|
|
if (editType === 'edit') {
|
|
|
this.editGroupNameDialog.value = item.name
|
|
|
this.editGroupNameDialog.gIndex = index
|
|
@@ -353,17 +355,23 @@ var vm = new Vue({
|
|
|
$('.group-name-edit .van-dialog__confirm').prop('disabled', !this.editGroupNameDialog.value)
|
|
|
})
|
|
|
},
|
|
|
- confirmEditGroupName: function () {
|
|
|
- // 关键词分类名判重
|
|
|
- var classNameArr = this.getAllGroupName()
|
|
|
- if (classNameArr.indexOf(this.editGroupNameDialog.value) === -1) {
|
|
|
- // 分类名不重复,新建分类
|
|
|
- this.saveGroupEdit(this.editGroupNameDialog.type)
|
|
|
- } else {
|
|
|
- // this.showToast('分类名不能重复')
|
|
|
+ confirmEditGroupName: function (action, done) {
|
|
|
+ if (action === 'cancel') {
|
|
|
+ done()
|
|
|
+ } else if (action === 'confirm') {
|
|
|
+ // 关键词分类名判重
|
|
|
+ var classNameArr = this.getAllGroupName()
|
|
|
+ if (classNameArr.indexOf(this.editGroupNameDialog.value) === -1) {
|
|
|
+ // 分类名不重复,新建分类
|
|
|
+ this.saveGroupEdit(this.editGroupNameDialog.type, done)
|
|
|
+ } else {
|
|
|
+ // this.showToast('分类名不能重复')
|
|
|
+ this.editGroupNameDialog.tipText = '该关键词分类已存在'
|
|
|
+ done(false)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- saveGroupEdit: function (type) {
|
|
|
+ saveGroupEdit: function (type, done) {
|
|
|
var _this = this
|
|
|
var data = {}
|
|
|
var toastType = ''
|
|
@@ -385,13 +393,12 @@ var vm = new Vue({
|
|
|
} else {
|
|
|
return
|
|
|
}
|
|
|
- var loading = this.showLoading()
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/subscribepay/afterPay/setUserInfo',
|
|
|
data: data,
|
|
|
success: function (res) {
|
|
|
- loading && loading.clear()
|
|
|
+ done && done()
|
|
|
if (res.flag) {
|
|
|
_this.showToast(toastType + '分类成功')
|
|
|
_this.getKeywordsGroupList()
|
|
@@ -401,7 +408,7 @@ var vm = new Vue({
|
|
|
}
|
|
|
},
|
|
|
error: function () {
|
|
|
- loading && loading.clear()
|
|
|
+ done && done()
|
|
|
}
|
|
|
})
|
|
|
}
|