feat(dealer): 更新经销商申请功能

- 将页面标题从"注册会员"改为"成为经销商"
- 在经销商注册成功后触发dealerUser:changed事件以通知其他页面刷新
- 优化API响应处理,当用户未注册为分销商时返回null而不是抛出错误
- 使用useDidShow钩子在页面显示时自动刷新经销商数据
- 添加事件监听器支持通过dealerUser:changed事件主动触发数据刷新
This commit is contained in:
2026-02-09 22:00:34 +08:00
parent 50ac79d055
commit 4951c3202d
4 changed files with 25 additions and 4 deletions

View File

@@ -95,8 +95,9 @@ export async function getShopDealerUser(userId: number) {
const res = await request.get<ApiResult<ShopDealerUser>>(
'/shop/shop-dealer-user/' + userId
);
if (res.code === 0 && res.data) {
return res.data;
if (res.code === 0) {
// 未注册为分销商时,后端可能返回 data=null这里用 null 表示“没有分销商信息”
return res.data || null;
}
return Promise.reject(new Error(res.message));
}