diff --git a/pkg_user/views/myFavorite.vue b/pkg_user/views/myFavorite.vue index abceba5..afe1612 100644 --- a/pkg_user/views/myFavorite.vue +++ b/pkg_user/views/myFavorite.vue @@ -248,8 +248,29 @@ export default { } }, - async remove() { - let that = this + remove() { + const _this = this + const ids = [] + switch (that.tabsIndex) { + case 0: + _this.productList.forEach(item => { + if (item['state']) ids.push(item.id) + }) + break + case 1: + _this.storeList.forEach(item => { + if (item['state']) ids.push(item.id) + }) + break + case 2: + _this.videoList.forEach(item => { + if (item['state']) ids.push(item.id) + }) + break + } + if (ids.length < 1) { + return + } uni.showModal({ title: '确认删除已选项目?', content: '', @@ -258,30 +279,11 @@ export default { confirmText: '确认', success: async (r) => { if (r.confirm) { - let ids = [] - switch (that.tabsIndex) { - case 0: - that.productList.forEach(item => { - if (item['state']) ids.push(item.id) - }) - break - case 1: - that.storeList.forEach(item => { - if (item['state']) ids.push(item.id) - }) - break - case 2: - that.videoList.forEach(item => { - if (item['state']) ids.push(item.id) - }) - break - } - const res = await removeFavorite(ids) if (res.success) { - that.isAll = false - that.fetchData() - that.removeAfter() + _this.isAll = false + _this.fetchData() + _this.removeAfter() } } }