diff --git a/pages/experience-coupon/claim.vue b/pages/experience-coupon/claim.vue index ffc21bc..dcf74b4 100644 --- a/pages/experience-coupon/claim.vue +++ b/pages/experience-coupon/claim.vue @@ -38,6 +38,7 @@ const tip = ref(""); const claiming = ref(false); const autoPrompted = ref(false); const posterVisible = ref(false); +const bindingTeamId = ref(""); const projectNameText = computed(() => { const projects = Array.isArray(issue.value?.projectSnapshot) ? issue.value.projectSnapshot : []; @@ -79,40 +80,31 @@ async function loadIssueDetail() { async function hasBoundArchive() { const openid = account.value?.openid || ""; - if (!openid || !corpId.value) return false; - - if (memberId.value) { - try { - const detail = await api( - "getCustomerByCustomerId", - { corpId: corpId.value, customerId: memberId.value }, - false - ); - const customer = detail?.data || null; - if (customer && String(customer.miniAppId || "") === String(openid)) { - return true; - } - } catch (e) { - console.warn("getCustomerByCustomerId failed", e); - } - } + if (!openid || !corpId.value || !memberId.value) return false; try { - const countRes = await api( - "getWxAppCustomerCount", - { miniAppId: openid, corpId: corpId.value }, + const detail = await api( + "getCustomerByCustomerId", + { corpId: corpId.value, customerId: memberId.value }, false ); - return Number(countRes?.data || 0) > 0; + const customer = detail?.data || null; + const teamIds = Array.isArray(customer?.teamId) ? customer.teamId : [customer?.teamId]; + bindingTeamId.value = teamIds.find(Boolean) || ""; + return Boolean(customer && String(customer.miniAppId || "") === String(openid)); } catch (e) { - console.warn("getWxAppCustomerCount failed", e); + console.warn("getCustomerByCustomerId failed", e); return false; } } function goBindArchive() { + const params = [ + `corpId=${encodeURIComponent(corpId.value || "")}`, + `teamId=${encodeURIComponent(bindingTeamId.value || "")}`, + ].join("&"); uni.navigateTo({ - url: `/pages/archive/archive-manage?corpId=${encodeURIComponent(corpId.value || "")}`, + url: `/pages/archive/edit-archive?${params}`, }); }