feat(wechat): 集成微信原生地址导入、头像选择与昵称填写能力

- 新增微信收货地址导入功能(chooseAddress),含地区匹配与错误处理
- 个人资料页接入微信头像选择(chooseAvatar)与昵称填写(type="nickname")
- 重构收货地址添加页与管理页的UI布局,抽取公共样式 address-page.scss
- 地址页与个人页增加加载失败提示、请求防抖与保存状态反馈
- 下拉刷新改用 Promise.allSettled 避免单接口失败阻断其他数据更新
- manifest 新增 chooseAddress 隐私权限声明,版本号更新至 5.03
This commit is contained in:
pikachu1995@126.com
2026-11-04 11:09:34 +08:00
parent 7b2b045fd4
commit d72f02f7cf
9 changed files with 507 additions and 247 deletions

View File

@@ -182,8 +182,15 @@ onShow(() => {
})
onPullDownRefresh(() => {
getUserOrderNum()
userInfo.value = isLogin()
userInfo.value = isLogin() || {}
if (isLogin('auth')) {
getUserOrderNum()
} else {
walletNum.value = 0
couponNum.value = 0
footNum.value = 0
uni.stopPullDownRefresh()
}
})
// #ifndef MP
@@ -205,17 +212,24 @@ function userDetail() {
}
async function getUserOrderNum() {
uni.stopPullDownRefresh()
Promise.all([
getCouponsNum(),
getFootprintNum(),
getUserWallet(),
]).then((res: any[]) => {
couponNum.value = res[0].data.result
footNum.value = res[1].data.result
walletNum.value = res[2].data.result.memberWallet
})
try {
// Each request can fail independently; a missing wallet must not break the other counts.
const results = await Promise.allSettled([
getCouponsNum(),
getFootprintNum(),
getUserWallet(),
])
// The user may have logged out while these requests were running.
if (!isLogin('auth')) return
const targets = [couponNum, footNum, walletNum]
results.forEach((result, index) => {
if (result.status !== 'fulfilled' || !result.value?.data?.success) return
const data = result.value.data.result
targets[index].value = index === 2 ? (data?.memberWallet ?? 0) : (data ?? 0)
})
} finally {
uni.stopPullDownRefresh()
}
}
</script>
@@ -486,4 +500,4 @@ async function getUserOrderNum() {
}
}
}
</style>
</style>