feat(invite): 优化邀请参数解析和处理逻辑

- 重构 invite 工具函数,增强参数解析能力
- 添加参数调试工具,便于排查问题
- 优化用户登录后的邀请关系处理流程- 调整 API调用,统一使用 dealerId替代 refereeId
- 移除未使用的导入和冗余代码
This commit is contained in:
2025-08-26 18:53:14 +08:00
parent 0a6f21d182
commit 24c6e6c0fd
13 changed files with 358 additions and 64 deletions

View File

@@ -8,7 +8,7 @@ import {TenantId} from "@/config/app";
import {getOrganization} from "@/api/system/organization";
import {myUserVerify} from "@/api/system/userVerify";
import { useShopInfo } from '@/hooks/useShopInfo';
import {handleInviteRelation} from "@/utils/invite";
import {handleInviteRelation, getStoredInviteParams} from "@/utils/invite";
import {View,Text} from '@tarojs/components'
import MySearch from "./MySearch";
import './Header.scss';
@@ -88,6 +88,14 @@ const Header = (props: any) => {
/* 获取用户手机号 */
const handleGetPhoneNumber = ({detail}: {detail: {code?: string, encryptedData?: string, iv?: string}}) => {
const {code, encryptedData, iv} = detail
// 获取存储的邀请参数
const inviteParams = getStoredInviteParams()
const refereeId = inviteParams?.inviter ? parseInt(inviteParams.inviter) : 0
console.log('登录时检测到的邀请参数:', inviteParams)
console.log('推荐人ID:', refereeId)
Taro.login({
success: function () {
if (code) {
@@ -99,7 +107,7 @@ const Header = (props: any) => {
encryptedData,
iv,
notVerifyPhone: true,
refereeId: 0,
refereeId: refereeId, // 使用解析出的推荐人ID
sceneType: 'save_referee',
tenantId: TenantId
},