fix: 问题修复

This commit is contained in:
huxuejian 2026-03-04 17:19:52 +08:00
parent 51a184f11e
commit e2d6a964bf
9 changed files with 51 additions and 15 deletions

View File

@ -141,6 +141,12 @@ async function addArchive() {
externalUserId: externalUserId.value,
realUnionid: account.value.unionid || '',
}
if (externalUserId.value) {
const corpUserId = await getResponsiblePerson();
if (corpUserId) {
params.personResponsibles = [{ corpUserId, teamId: teamId.value }]
}
}
loading.value = false;
const res = await api('addCustomer', { params });
if (res && res.success) {
@ -154,8 +160,18 @@ async function addArchive() {
}
}
async function getResponsiblePerson() {
const res = await api('getResponsiblePerson', { corpId: corpId.value, externalUserId: externalUserId.value, teamId: teamId.value });
return res && res.data ? res.data : ''
}
async function bindArchive(customerId) {
const res = await api('bindMiniAppArchive', { id: customerId, corpId: corpId.value, teamId: teamId.value, miniAppId: account.value.openid });
let responsiblePerson = '';
if (externalUserId.value) {
const corpUserId = await getResponsiblePerson();
responsiblePerson = corpUserId || '';
}
const res = await api('bindMiniAppArchive', { id: customerId, corpId: corpId.value, teamId: teamId.value, miniAppId: account.value.openid, externalUserId: externalUserId.value, responsiblePerson });
if (res && res.success) {
await toast('绑定成功');
uni.$emit('reloadTeamCustomers')

View File

@ -169,7 +169,8 @@ const loadArticleList = async (reset = false) => {
miniAppId,
page: page.value,
pageSize,
customerIds
customerIds,
teamId: teamId.value
};
if (activeTab.value) params.customerIds = [activeTab.value];

View File

@ -173,7 +173,7 @@ async function getBadgeCount() {
loading = false
return
}
const res = await api('getMiniAppHomeStats', { corpId: props.corpId, customerIds })
const res = await api('getMiniAppHomeStats', { corpId: props.corpId, teamId: props.teamId, customerIds })
const data = res?.data || {};
const article = typeof data.article === 'number' ? data.article : 0;
const survey = typeof data.survey === 'number' ? data.survey : 0;
@ -182,8 +182,7 @@ async function getBadgeCount() {
loading = false;
}
watch(() => props.customers, n => {
console.error('wwwwatch: ')
watch(() => [props.customers, props.teamId, props.corpId], n => {
getBadgeCount()
}, { immediate: true })

View File

@ -93,6 +93,7 @@ const props = defineProps({
});
const emit = defineEmits(["update:customers"]);
let loading = false;
const { account } = storeToRefs(useAccount());
const current = ref(null);
@ -177,10 +178,12 @@ async function auth() {
}
async function getCustomers() {
if (loading) return;
loading = true
const res = await api("getMiniAppCustomers", {
miniAppId: account.value.openid,
corpId: props.corpId,
});
}, false);
if (res && res.success) {
customers.value = res && Array.isArray(res.data) ? res.data : [];
const customer = customers.value.find(
@ -192,6 +195,7 @@ async function getCustomers() {
} else {
toast(res.message || "获取档案失败");
}
loading = false
}
onMounted(() => {
@ -209,6 +213,10 @@ watch(
},
{ immediate: true }
);
defineExpose({
getCustomers,
})
</script>
<style scoped>
.archive-container {

View File

@ -5,7 +5,7 @@
<team-head :team="team" :teams="teams" @changeTeam="changeTeam" />
</template>
<view class="home-section home-section--first">
<customer-archive :corpId="corpId" :team="team" @update:customers="handleCustomersUpdate" />
<customer-archive ref="archiveRef" :corpId="corpId" :team="team" @update:customers="handleCustomersUpdate" />
</view>
<view class="home-section">
<consult ref="consultRef" :corpId="corpId" :teamId="team.teamId" :team="team" :customers="customers" />
@ -46,7 +46,8 @@ const team = ref(null);
const teams = ref([]);
const loading = ref(false);
const customers = ref([]);
const consultRef = ref(null)
const consultRef = ref(null);
const archiveRef = ref(null);
const corpId = computed(() => team.value?.corpId);
@ -106,6 +107,9 @@ onShow(async () => {
if (consultRef.value && typeof consultRef.value.getBadgeCount === 'function') {
consultRef.value.getBadgeCount()
}
if (archiveRef.value && typeof archiveRef.value.getCustomers === 'function') {
archiveRef.value.getCustomers()
}
});
watch(account, (n, o) => {

View File

@ -12,7 +12,7 @@
</view>
</view>
<view class="px-15 py-10">
<view class="text-sm mb-10">请您对我的本次服务进行评价</view>
<view class="text-base mb-10">请您对我的本次服务进行评价</view>
<view class="flex items-center px-10 py-5 mb-10 border rounded">
<view v-for="i in 5" :key="i" class="mr-5 w-star" @click="changeRate(i)">
<uni-icons v-if="i <= starCount" type="star-filled" :size="30" color="#FF9900"></uni-icons>
@ -33,8 +33,8 @@
</view>
</view>
<view class="px-10 py-5 border rounded">
<textarea v-model="words" :auto-height="true" class="text-sm block w-full min-h-100"
placeholder="展开说说您对我本次服务的想法吧……" placeholder-class="text-gray text-sm" :maxlength="1000" />
<textarea v-model="words" :auto-height="true" class="text-base block w-full min-h-100"
placeholder="展开说说您对我本次服务的想法吧……" placeholder-class="text-gray text-base" :maxlength="1000" />
<view class="text-gray text-right">
{{ words.length }} / {{ 1000 }}
</view>

View File

@ -96,6 +96,8 @@ const { openid } = storeToRefs(useAccountStore());
const tabs = ref([{ name: "全部", value: "" }]);
const activeTab = ref("");
const corpId = ref('')
const teamId = ref('')
const inited = ref(false);
const { list, page, pages, pageSize, total, loading, hasMore, changePage } = usePageList(getList)
@ -133,7 +135,8 @@ async function getList() {
corpId: corpId.value,
page: page.value,
pageSize: pageSize.value,
customerIds
customerIds,
teamId: teamId.value
})
const arr = res && Array.isArray(res.list) ? res.list.map(i => ({
...i,
@ -158,6 +161,7 @@ function getMore() {
onLoad(opts => {
corpId.value = opts.corpId
teamId.value = opts.teamId
})
onShow(async () => {

View File

@ -89,7 +89,8 @@ const { openid } = storeToRefs(useAccountStore());
const tabs = ref([{ name: "全部", value: "" }]);
const activeTab = ref("");
const corpId = ref('')
const corpId = ref('');
const teamId = ref('');
const surveys = ref([]);
const total = ref(0);
@ -158,6 +159,7 @@ const loadSurveyList = async (reset = false) => {
const params = {
corpId: corpId.value,
miniAppId,
teamId: teamId.value,
page: page.value,
pageSize,
};
@ -190,7 +192,8 @@ function goToDetail(item) {
onLoad(opts => {
corpId.value = opts.corpId
corpId.value = opts.corpId;
teamId.value = opts.teamId;
})
onShow(async () => {

View File

@ -13,7 +13,8 @@ const urlsConfig = {
bindWxappWithTeam: 'bindWxappWithTeam',
getWxappRelateTeams: 'getWxappRelateTeams',
getTeamMemberAvatarsAndName: "getTeamMemberAvatarsAndName",
getMiniAppHomeStats: "getMiniAppHomeStats"
getMiniAppHomeStats: "getMiniAppHomeStats",
getResponsiblePerson: 'getTeamResponsiblePerson'
},
knowledgeBase: {