<template>
|
<PageLayoutWithBg title="资源详情" class="resourceDetail-page-wrapper" :need-auth="false">
|
<LoadingLayout :loading="isLoading" :error="isError" :loadError="refetch">
|
<ContentScrollView style="background-color: transparent">
|
<Cell :title="detail?.title ?? ''" titleSize="large">
|
<div class="orderDetail-industryTypeName">
|
{{ detail?.industryTypeName ?? '' }}
|
</div>
|
<div class="detail-page-avatar-wrapper">
|
<CardAvatar
|
:src="detail?.avatarUrl"
|
:name="detail?.contact"
|
:jobTitle="detail?.jobTitle"
|
:isCertified="detail?.isCertified"
|
:userId="detail?.userId"
|
/>
|
<div class="detail-page-time">
|
发布于:{{ format(detail?.lastShelfTime, 'YYYY-MM-DD HH:mm') }}
|
</div>
|
</div>
|
</Cell>
|
<Cell title="基本信息">
|
<div class="detail-info-list">
|
<div class="detail-info-list-item">
|
<div class="detail-info-list-item-label">交付人数:</div>
|
<div class="detail-info-list-item-content">{{ detail?.resourceCount ?? 0 }}人</div>
|
</div>
|
<div class="detail-info-list-item">
|
<div class="detail-info-list-item-label">资源城市:</div>
|
<div class="detail-info-list-item-content">
|
{{ cities }}
|
</div>
|
</div>
|
<div class="detail-info-list-item">
|
<div class="detail-info-list-item-label">意向城市:</div>
|
<div class="detail-info-list-item-content">
|
{{ intendedDeliveryCities }}
|
</div>
|
</div>
|
<div class="detail-info-list-item">
|
<div class="detail-info-list-item-label">合作费用:</div>
|
<div class="detail-info-list-item-content">{{ detail?.cooperationFee ?? '' }}</div>
|
</div>
|
</div>
|
</Cell>
|
<Cell title="资源介绍">
|
<div class="detail-introduction">
|
{{ resourceIntros }}
|
</div>
|
</Cell>
|
<Cell>
|
<template #title>
|
<div class="safe-cell-title-wrapper">
|
<img :src="IconSafe" class="safe-cell-title-icon" />
|
<div class="safe-cell-title">安全提示</div>
|
</div>
|
</template>
|
<div class="safe-cell-content">
|
该信息由用户自主发布,如遇虚假信息、诈骗、传销等违法违规行为,请立即
|
<div class="safe-cell-content-btn" @click="goComplaint">投诉举报</div>
|
</div>
|
</Cell>
|
</ContentScrollView>
|
<PageFooter>
|
<PageFooterAction
|
:icon="IconShare"
|
text="分享"
|
:isFlex="false"
|
openType="share"
|
></PageFooterAction>
|
|
<PageFooterBtn v-if="isSelf || isCollapse" type="primary" @click="makePhoneCall">{{
|
contactPhone
|
}}</PageFooterBtn>
|
<PageFooterBtn v-else type="primary" @click="handleGoAcontact">去对接</PageFooterBtn>
|
</PageFooter>
|
</LoadingLayout>
|
</PageLayoutWithBg>
|
</template>
|
|
<script setup lang="ts">
|
import Taro from '@tarojs/taro';
|
import { useQuery } from '@tanstack/vue-query';
|
import { useUserStore } from '@/stores/modules/user';
|
import {
|
useUser,
|
useAccessLogin,
|
useToggleMatchMakingIdentityOnLaunch,
|
useAccessPersonalInfo,
|
} from '@/hooks';
|
import { MatchMakingIdentityEnum, EditorType } from '@12333/constants';
|
import * as resourceServices from '@12333/services/api/Resource';
|
import IconSafe from '@/assets/order/icon-safe.png';
|
import IconShare from '@/assets/order/icon-share.png';
|
import { OrderUtils, filterJoin, setOSSLink, format } from '@12333/utils';
|
import { useAllAreaList } from '@12333/hooks';
|
import { useToggle } from 'senin-mini/hooks';
|
import * as orderServices from '@12333/services/api/Order';
|
|
defineOptions({
|
name: 'resourceDetail',
|
});
|
|
const router = Taro.useRouter();
|
const resourceId = router.params?.id ?? '';
|
|
const { userDetail } = useUser();
|
|
const { findAreaNameFromCode } = useAllAreaList();
|
|
useToggleMatchMakingIdentityOnLaunch({
|
matchMakingIdentity: MatchMakingIdentityEnum.Employing,
|
});
|
|
const {
|
isLoading,
|
data: detail,
|
isError,
|
refetch,
|
} = useQuery({
|
queryKey: ['resourceServices/getFrontResourceInfo', resourceId],
|
queryFn: async () => {
|
return await resourceServices.getFrontResourceInfo(
|
{ id: resourceId },
|
{
|
showLoading: false,
|
}
|
);
|
},
|
placeholderData: () => ({} as API.ResourceFrontInfoDto),
|
onSuccess(data) {
|
if (data.isExistTradeChatRecord) setTrue();
|
},
|
});
|
|
const isSelf = computed(() => userDetail.value?.userId === detail.value?.userId);
|
|
const cities = computed(() => {
|
return detail.value.cities
|
?.map((x) => `${findAreaNameFromCode(x.provinceCode)}${x.areaName}`)
|
.join('、');
|
});
|
|
const intendedDeliveryCities = computed(() => {
|
return detail.value.intendedDeliveryCities
|
?.map((x) => `${findAreaNameFromCode(x.provinceCode)}${x.areaName}`)
|
.join('、');
|
});
|
|
const resourceIntros = computed(() => {
|
if (detail.value?.resourceIntros?.length > 0) {
|
return detail.value?.resourceIntros.find((x) => x.type === EditorType.Text)?.content ?? '';
|
}
|
return '';
|
});
|
|
const contactPhone = computed(() => {
|
if (detail.value) {
|
return detail.value?.parkOrHRSimpleInfo?.contactPhone
|
? detail.value?.parkOrHRSimpleInfo?.contactPhone
|
: detail.value?.contactNumber
|
? detail.value?.contactNumber
|
: '';
|
}
|
return '';
|
});
|
|
Taro.showShareMenu({
|
showShareItems: ['shareAppMessage', 'shareTimeline'],
|
});
|
|
Taro.useShareAppMessage((res) => {
|
return {
|
title: detail.value?.title ?? '',
|
};
|
});
|
|
function goComplaint() {
|
Taro.navigateTo({
|
url: `${RouterPath.complaint}?id=${resourceId}`,
|
});
|
}
|
|
const { isCollapse, setTrue } = useToggle();
|
|
const handleGoAcontact = useAccessPersonalInfo(async () => {
|
try {
|
let res = await orderServices.addTradeChatRecord({
|
relationalId: resourceId,
|
applyUserId: userDetail.value?.userId,
|
});
|
if (res) {
|
setTrue();
|
}
|
} catch (error) {}
|
});
|
|
const makePhoneCall = useAccessPersonalInfo(() => {
|
if (contactPhone.value) {
|
Taro.makePhoneCall({
|
phoneNumber: contactPhone.value,
|
});
|
}
|
});
|
</script>
|
|
<style lang="scss">
|
@import '@/styles/common.scss';
|
@import '../../order/orderDetail/common.scss';
|
</style>
|