From 4249ad39549a882930ef25fa4ca362910c7b23c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=96=B9=E6=88=90?= Date: Fri, 26 Dec 2025 12:58:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=86=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=9A=84=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E4=B8=BAtap=E4=BA=8B=E4=BB=B6=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/address/index.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pages/address/index.vue b/pages/address/index.vue index bc44454..8772444 100644 --- a/pages/address/index.vue +++ b/pages/address/index.vue @@ -52,17 +52,17 @@ - + {{ item.is_default ? '默认地址' : '设为默认' }} - + 编辑 - + 🗑 删除 @@ -140,13 +140,19 @@ function onDelete(item) { } async function onSetDefault(item) { - if (item.is_default) return + console.log('onSetDefault called', item.id, 'is_default:', item.is_default) + if (item.is_default) { + console.log('Already default, skipping') + return + } try { const user_id = uni.getStorageSync('user_id') + console.log('Calling setDefaultAddress API', user_id, item.id) await setDefaultAddress(user_id, item.id) uni.showToast({ title: '设置成功', icon: 'none' }) fetchList() } catch (e) { + console.error('setDefaultAddress error', e) uni.showToast({ title: '设置失败', icon: 'none' }) } }