From e6960b8c2a45a1887eca058a8a6f70b53274f978 Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Wed, 22 May 2024 14:11:21 +0800 Subject: [PATCH] =?UTF-8?q?Fix(=E6=88=91=E7=9A=84/=E6=94=B6=E8=97=8F):[#16?= =?UTF-8?q?22]=E6=9C=AA=E9=80=89=E6=8B=A9=E4=BB=BB=E4=BD=95=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=82=B9=E5=87=BB=E2=80=9C=E5=88=A0=E9=99=A4=E2=80=9D?= =?UTF-8?q?=EF=BC=8C=E4=BB=8D=E4=BC=9A=E5=BC=B9=E5=87=BA=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=88=A0=E9=99=A4=E5=AF=B9=E8=AF=9D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg_user/views/myFavorite.vue | 50 ++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 24 deletions(-) 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() } } }