feat: 报单优化

This commit is contained in:
chashaobao
2025-07-27 23:23:29 +08:00
parent 0cd1a46762
commit 260e543fe6
7 changed files with 160 additions and 79 deletions

View File

@ -9,13 +9,13 @@ import DevDiv from '@/components/dev-div';
import JobRecommendList from '@/components/job-recommend-list';
import { JoinGroupHint } from '@/components/join-group-hint';
import LoginButton from '@/components/login-button';
import MaterialGuide from '@/components/material-guide';
import PageLoading from '@/components/page-loading';
import { PrejobPopup } from '@/components/prejob-popup';
import ProductJobDialog from '@/components/product-dialog/job';
import { RoleType, EventName, PageUrl } from '@/constants/app';
import { CertificationStatusType } from '@/constants/company';
import { CollectEventName, ReportEventId } from '@/constants/event';
import { EMPLOY_TYPE_TITLE_MAP } from '@/constants/job';
import { EMPLOY_TYPE_TITLE_MAP, GET_CONTACT_TYPE } from '@/constants/job';
import useInviteCode from '@/hooks/use-invite-code';
import useUserInfo from '@/hooks/use-user-info';
import useRoleType from '@/hooks/user-role-type';
@ -76,9 +76,12 @@ const AnchorFooter = (props: { data: JobDetails }) => {
reportEvent(ReportEventId.CLICK_JOB_CONTACT);
try {
const needCreateMaterial = await isNeedCreateMaterial();
if (needCreateMaterial) {
setShowMaterialGuide(true);
return;
if (data.sourcePlat !== 'bl') {
if (needCreateMaterial) {
setShowMaterialGuide(true);
return;
}
}
if (data.isAuthed) {
const toUserId = data.userId;
@ -86,19 +89,27 @@ const AnchorFooter = (props: { data: JobDetails }) => {
Toast.error('不能与自己聊天');
return;
}
const profile = await requestProfileDetail();
const chat = await postCreateChat(toUserId);
const materialMessage: IMaterialMessage = {
id: profile.id,
name: profile.name,
age: profile.age,
height: profile.height,
weight: profile.weight,
shoeSize: profile.shoeSize,
gender: profile.gender,
workedSecCategoryStr: profile.workedSecCategoryStr,
};
navigateTo(PageUrl.MessageChat, { chatId: chat.chatId, material: materialMessage, jobId: data.id });
let materialMessage: null | IMaterialMessage = null;
if (!needCreateMaterial) {
const profile = await requestProfileDetail();
materialMessage = {
id: profile.id,
name: profile.name,
age: profile.age,
height: profile.height,
weight: profile.weight,
shoeSize: profile.shoeSize,
gender: profile.gender,
workedSecCategoryStr: profile.workedSecCategoryStr,
};
}
navigateTo(PageUrl.MessageChat, {
chatId: chat.chatId,
initText: !materialMessage,
material: materialMessage,
jobId: data.id,
});
} else {
setDialogVisible(true);
}
@ -113,7 +124,15 @@ const AnchorFooter = (props: { data: JobDetails }) => {
}
}, [data]);
const handleDialogHidden = useCallback(() => setDialogVisible(false), []);
const handleDialogHidden = useCallback(() => {
setDialogVisible(false);
}, []);
const handleConfirmPrejob = useCallback((type: GET_CONTACT_TYPE) => {
setShowMaterialGuide(false);
if (GET_CONTACT_TYPE.VIP === type) {
setDialogVisible(true);
}
}, []);
return (
<>
<div className={`${PREFIX}__footer`}>
@ -126,7 +145,9 @@ const AnchorFooter = (props: { data: JobDetails }) => {
</div>
<div>
{dialogVisible && <ProductJobDialog data={data} onClose={handleDialogHidden} />}
{showMaterialGuide && <MaterialGuide onClose={() => setShowMaterialGuide(false)} />}
{showMaterialGuide && (
<PrejobPopup onCancel={() => setShowMaterialGuide(false)} onConfirm={handleConfirmPrejob} />
)}
<CommonDialog
content={errorTips}
confirm="确定"