fix: 团队推荐

This commit is contained in:
huxuejian 2026-05-19 19:26:16 +08:00
parent b27bb9b33b
commit 6d802a4f07
6 changed files with 81 additions and 19 deletions

View File

@ -157,6 +157,7 @@ async function addArchive() {
params.referenceUserId = '';
params.reference = referenceCustomer.value.name;
params.referenceType = '客户';
params.customerSource = ['客户推荐']
}
loading.value = false;
const res = await api('addCustomer', { params });

View File

@ -2,7 +2,7 @@
<page-loading v-if="loading && teams.length === 0" />
<full-page v-else-if="teams.length && team" class="home-container" :pageStyle="pageStyle">
<!-- <template #header> -->
<team-head :team="team" :teams="teams" @changeTeam="changeTeam" />
<team-head :team="team" :customers="customers" :teams="teams" @changeTeam="changeTeam" />
<!-- </template> -->
<view class="home-section home-section--first">
<customer-archive ref="archiveRef" :corpId="corpId" :corpUserIds="corpUserIds"
@ -128,7 +128,7 @@ onShow(async () => {
});
onShareAppMessage((res) => {
if (team.value) {
if (team.value && team.value.supportPatientForward === 'YES') {
const customer = customers.value[0];
const referenceCustomerId = customer ? customer._id : '';
return {

View File

@ -6,23 +6,35 @@
<group-avatar classType="square" :size="120" :avatarList="currentTeam ? currentTeam.avatarList : []" />
</view>
<view class="w-0 flex-grow">
<view class="flex items-center mb-10">
<view class="team-name truncate flex-shrink-0" :style="teamStyle">{{ team.name }}</view>
<view v-if="teams.length > 1" class="flex-shrink-0 flex items-center switch-btn ml-10"
@click="showDropDown = true">
<image class="switch-icon" src="/static/home/switch-team.png" mode="aspectFit"></image>
<view class="flex items-center">
<view class="w-0 flex-grow flex items-center mb-10">
<view class="team-name truncate flex-shrink-0" :style="teamStyle">{{ team.name }}</view>
<view v-if="teams.length > 1" class="flex-shrink-0 flex items-center switch-btn ml-10"
@click="showDropDown = true">
<image class="switch-icon" src="/static/home/switch-team.png" mode="aspectFit"></image>
</view>
</view>
<view v-if="menuButtonInfo && menuButtonInfo.width > 0" class="flex-shrink-0" :style="{
width: menuButtonInfo.width + 'px',
height: menuButtonInfo.height + 'px',
}">
</view>
</view>
<view v-if="currentTeam" class="text-base text-white truncate">
{{ currentTeam.leaderCorp || currentTeam.corpName || '' }}
</view>
</view>
<view v-if="menuButtonInfo && menuButtonInfo.width > 0" class="flex-shrink-0" :style="{
width: menuButtonInfo.width + 'px',
height: menuButtonInfo.height + 'px',
}">
<div class="flex items-center">
<view v-if="currentTeam" class="w-0 flex-grow mr-5text-base text-white truncate">
{{ currentTeam.leaderCorp || currentTeam.corpName || '' }}
</view>
<view v-if="team && team.supportPatientForward === 'YES'"
class="relative flex-shrink-0 flex items-center bg-white rounded-sm px-10">
<image class="icon-share mr-5" src="/static/home/icon-share.svg"></image>
<view class="text-sm text-warning">推荐</view>
<button open-type="share" class="absolute w-full h-full opacity-0"></button>
</view>
</div>
</view>
</view>
<view class="relative">
<view v-if="showDropDown" class="team-dropdown py-12 bg-white shadow-lg">
<scroll-view scroll-y="true" style="max-height: 50vh">
@ -103,6 +115,10 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
customers: {
type: Array,
default: () => [],
},
teams: {
type: Array,
default: () => [],
@ -112,11 +128,13 @@ const props = defineProps({
const currentTeam = computed(() =>
props.teams.find((i) => props.team && i.teamId === props.team.teamId)
);
const qrcode = computed(() => {
const qrcodes = props.team && Array.isArray(props.team.qrcodes) ? props.team.qrcodes : [];
return qrcodes[0] || ''
})
const teamStyle = computed(() => `max-width:${props.teams.length ? 'calc(100% - 60rpx)' : '100%'}`)
const firstCustomer = computed(() => props.customers && props.customers[0] ? props.customers[0] : {})
function select(team) {
emits("changeTeam", team);
@ -126,7 +144,7 @@ function select(team) {
function toTeamDetail() {
if (props.team && props.team.teamId) {
uni.navigateTo({
url: `/pages/team/team-detail?teamId=${props.team.teamId}&corpId=${props.team.corpId}&corpName=${encodeURIComponent(props.team.corpName || '')}`
url: `/pages/team/team-detail?firstCustomerId=${firstCustomer.value._id || ''}&teamId=${props.team.teamId}&corpId=${props.team.corpId}&corpName=${encodeURIComponent(props.team.corpName || '')}`
});
}
}
@ -311,4 +329,13 @@ onMounted(() => {
.rounded-circle {
border-radius: 50%;
}
.icon-share {
width: 24rpx;
height: 24rpx;
}
.opacity-0 {
opacity: 0;
}
</style>

View File

@ -38,7 +38,10 @@ async function changeTeam({ teamId, corpId, corpUserId, qrid, referenceCustomerI
team.value.corpName = res.data.corpName;
set('home-invite-team-info', {
teamId: team.value.teamId,
corpUserId: corpUserId || ''
corpUserId: corpUserId || '',
corpUserId,
qrid,
referenceCustomerId: referenceCustomerId || ''
});
await login()
if (account.value && account.value.mobile) {

View File

@ -7,7 +7,15 @@
<group-avatar classType="square" :size="128" :avatarList="avatarList" />
</view>
<view class="w-0 flex-grow">
<view class="name-title font-semibold text-dark truncate">{{ team.name }}</view>
<view class="flex items-center">
<view class="w-0 flex-grow mr-5 name-title font-semibold text-dark truncate">{{ team.name }}</view>
<view v-if="team && team.supportPatientForward === 'YES'"
class="relative flex-shrink-0 flex items-center bg-white rounded py-5 px-5 border">
<image class="icon-share mr-5" src="/static/home/icon-share.svg"></image>
<view class="text-base text-warning">推荐</view>
<button open-type="share" class="absolute w-full h-full opacity-0"></button>
</view>
</view>
<view class="corp-title text-gray truncate">{{ corpName }}</view>
</view>
</view>
@ -54,7 +62,7 @@
</template>
<script setup>
import { computed, ref, watch } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { onLoad, onShow, onShareAppMessage } from '@dcloudio/uni-app';
import useJob from '@/hooks/useJob';
import api from '@/utils/api';
@ -65,6 +73,7 @@ const pageStyle = "background: linear-gradient(180deg, #065BD6 15.05%, #F6FAFA 9
const corpId = ref('');
const teamId = ref('');
const firstCustomerId = ref('');
const team = ref(null);
const corpName = ref('');
const { memberJob, memberList: list } = useJob();
@ -113,6 +122,7 @@ async function getTeam() {
onLoad(options => {
corpId.value = options.corpId;
teamId.value = options.teamId;
firstCustomerId.value = options.firstCustomerId || '';
corpName.value = decodeURIComponent(options.corpName || '');
})
onShow(() => {
@ -121,6 +131,17 @@ onShow(() => {
}
});
onShareAppMessage((res) => {
if (team.value && team.value.supportPatientForward === 'YES') {
const referenceCustomerId = firstCustomerId.value || '';
return {
title: team.value.name,
type: shareAppVersion || 0, // 0 | 1 | 2
path: `/pages/login/redirect-page?teamId=${team.value.teamId}&corpId=${team.value.corpId}&type=archive&referenceCustomerId=${referenceCustomerId}`
}
}
})
watch(memberList, n => {
list.value = n
}, { immediate: true })
@ -236,4 +257,13 @@ page {
height: 17px;
line-height: 17px;
}
.icon-share {
width: 24rpx;
height: 24rpx;
}
.opacity-0 {
opacity: 0;
}
</style>

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1779182564794" class="icon" viewBox="0 0 1152 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10762" xmlns:xlink="http://www.w3.org/1999/xlink" width="225" height="200"><path d="M851.2 736c0 32-19.2 70.4-51.2 70.4H230.4c-32 0-57.6-38.4-57.6-70.4V409.6c0-32 25.6-51.2 57.6-51.2h57.6l128-166.4H64c-32 0-64 19.2-64 51.2v659.2c0 32 32 57.6 64 57.6h902.4c32 0 57.6-25.6 57.6-57.6V505.6l-172.8 140.8v89.6zM390.4 627.2c0 6.4 0 6.4 6.4 12.8 51.2-140.8 153.6-249.6 288-268.8 25.6-6.4 83.2-6.4 83.2-6.4v192h44.8L1088 262.4 806.4 0h-44.8v160s-44.8 0-70.4 6.4c-198.4 38.4-339.2 243.2-300.8 460.8z" p-id="10763" fill="#ff9005"></path><path d="M851.2 736c0 32-19.2 70.4-51.2 70.4H230.4c-32 0-57.6-38.4-57.6-70.4V409.6c0-32 25.6-51.2 57.6-51.2h57.6l128-166.4H64c-32 0-64 19.2-64 51.2v659.2c0 32 32 57.6 64 57.6h902.4c32 0 57.6-25.6 57.6-57.6V505.6l-172.8 140.8v89.6zM390.4 627.2c0 6.4 0 6.4 6.4 12.8 51.2-140.8 153.6-249.6 288-268.8 25.6-6.4 83.2-6.4 83.2-6.4v192h44.8L1088 262.4 806.4 0h-44.8v160s-44.8 0-70.4 6.4c-198.4 38.4-339.2 243.2-300.8 460.8z" fill="#ff9005" p-id="10764"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB