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

@ -33,7 +33,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
&.share { &.material {
background: #feba00; background: #feba00;
> image { > image {
width: 40px; width: 40px;

View File

@ -1,13 +1,17 @@
import { Button, Image } from '@tarojs/components'; import { Button, Image } from '@tarojs/components';
import { Popup } from '@taroify/core'; import { Popup, Dialog } from '@taroify/core';
import { Fragment, useCallback, useState } from 'react';
import JobBuy from '@/components/product-dialog/steps-ui/job-buy';
import SafeBottomPadding from '@/components/safe-bottom-padding'; import SafeBottomPadding from '@/components/safe-bottom-padding';
import { PageUrl } from '@/constants/app';
import { GET_CONTACT_TYPE } from '@/constants/job'; import { GET_CONTACT_TYPE } from '@/constants/job';
import { navigateTo } from '@/utils/route';
import './index.less'; import './index.less';
interface IProps { interface IProps {
open: boolean;
onCancel: () => void; onCancel: () => void;
onConfirm: (type: GET_CONTACT_TYPE) => void; onConfirm: (type: GET_CONTACT_TYPE) => void;
} }
@ -15,21 +19,41 @@ interface IProps {
const PREFIX = 'prejob-popup'; const PREFIX = 'prejob-popup';
const GET_CONTACT_TYPE_OPTIONS = [ const GET_CONTACT_TYPE_OPTIONS = [
{
type: GET_CONTACT_TYPE.MATERIAL,
icon: 'https://publiccdn.neighbourhood.com.cn/img/file.svg',
title: '创建模卡(免费报单)',
desc: '免费报单,优先推荐给企业,机会更多',
btnText: '创建',
},
{ {
type: GET_CONTACT_TYPE.VIP, type: GET_CONTACT_TYPE.VIP,
icon: 'https://publiccdn.neighbourhood.com.cn/img/diamond.svg', icon: 'https://publiccdn.neighbourhood.com.cn/img/diamond.svg',
title: '播络会员', title: '播络会员',
desc: '开通会员每天可查看5个', desc: '开通会员每天可查看10个',
btnText: '开通', btnText: '开通',
}, },
]; ];
export function PrejobPopup({ open, onCancel, onConfirm }: IProps) { export function PrejobPopup({ onCancel, onConfirm }: IProps) {
const [openPopup, setOpenPopup] = useState(true);
const [openDialog, setOpenDialog] = useState(false);
const handleClick = (type: GET_CONTACT_TYPE) => () => { const handleClick = (type: GET_CONTACT_TYPE) => () => {
if (type === GET_CONTACT_TYPE.MATERIAL) {
navigateTo(PageUrl.MaterialUploadVideo);
onConfirm(type); onConfirm(type);
}
if (type === GET_CONTACT_TYPE.VIP) {
setOpenPopup(false);
setOpenDialog(true);
}
}; };
const handleAfterBuy = useCallback(async () => {
onConfirm(GET_CONTACT_TYPE.VIP);
}, [onConfirm]);
return ( return (
<Popup rounded className={PREFIX} placement="bottom" open={open} onClose={onCancel}> <Fragment>
<Popup rounded className={PREFIX} placement="bottom" open={openPopup} onClose={onCancel}>
<div className={`${PREFIX}__content`}> <div className={`${PREFIX}__content`}>
<div className={`${PREFIX}__title`}></div> <div className={`${PREFIX}__title`}></div>
<div className={`${PREFIX}__body`}> <div className={`${PREFIX}__body`}>
@ -55,5 +79,11 @@ export function PrejobPopup({ open, onCancel, onConfirm }: IProps) {
</div> </div>
<SafeBottomPadding /> <SafeBottomPadding />
</Popup> </Popup>
<Dialog open={openDialog} onClose={onCancel}>
<Dialog.Content>
<JobBuy onConfirm={handleAfterBuy} buyOnly />
</Dialog.Content>
</Dialog>
</Fragment>
); );
} }

View File

@ -16,6 +16,7 @@ import { postSubscribe, subscribeMessage } from '@/utils/subscribe';
import Toast from '@/utils/toast'; import Toast from '@/utils/toast';
interface IProps { interface IProps {
buyOnly?: boolean;
onConfirm: () => void; onConfirm: () => void;
} }
@ -23,6 +24,7 @@ interface Item {
id: ProductSpecId; id: ProductSpecId;
title: string; title: string;
content: string; content: string;
buyOnlyContent?: string;
price: string; price: string;
amt: number; amt: number;
badge?: string; badge?: string;
@ -33,7 +35,8 @@ const LIST: Item[] = [
{ {
id: ProductSpecId.DailyVIP, id: ProductSpecId.DailyVIP,
title: '日会员', title: '日会员',
content: '每日+5次', content: '每日+10次',
buyOnlyContent: '每日12次',
price: '60播豆', price: '60播豆',
amt: 6, amt: 6,
badge: '限时体验', badge: '限时体验',
@ -41,7 +44,8 @@ const LIST: Item[] = [
{ {
id: ProductSpecId.WeeklyVIP, id: ProductSpecId.WeeklyVIP,
title: '周会员', title: '周会员',
content: '每日+5次', content: '每日+10次',
buyOnlyContent: '每日12次',
price: '180播豆', price: '180播豆',
amt: 18, amt: 18,
badge: ' 超值', badge: ' 超值',
@ -62,7 +66,7 @@ const subscribe = async () => {
}; };
export default function JobBuy(props: IProps) { export default function JobBuy(props: IProps) {
const { onConfirm } = props; const { onConfirm, buyOnly } = props;
const [selectItem, setSelectItem] = useState(LIST[1]); const [selectItem, setSelectItem] = useState(LIST[1]);
const handleClickItem = useCallback((newSelectItem: Item) => setSelectItem(newSelectItem), []); const handleClickItem = useCallback((newSelectItem: Item) => setSelectItem(newSelectItem), []);
@ -106,18 +110,30 @@ export default function JobBuy(props: IProps) {
return ( return (
<div className={`${PREFIX}__job-buy`}> <div className={`${PREFIX}__job-buy`}>
{buyOnly ? (
<div className={`${PREFIX}__job-buy__header`}></div>
) : (
<div className={`${PREFIX}__job-buy__header`}> <div className={`${PREFIX}__job-buy__header`}>
<div></div> <div></div>
<div className="highlight"></div> <div className="highlight"></div>
</div> </div>
)}
{buyOnly ? (
<div className={`${PREFIX}__job-buy__describe`}>12</div>
) : (
<div className={`${PREFIX}__job-buy__describe`}> <div className={`${PREFIX}__job-buy__describe`}>
<div></div> <div></div>
<div className="highlight"></div> <div className="highlight"></div>
<div> </div> <div> </div>
<div className="highlight"></div> <div className="highlight"></div>
</div> </div>
)}
<div className={`${PREFIX}__job-buy__container`}> <div className={`${PREFIX}__job-buy__container`}>
{LIST.map(item => ( {LIST.map(item => {
if (buyOnly && !item.amt) {
return null;
}
return (
<div <div
key={item.price} key={item.price}
className={classNames(`${PREFIX}__job-buy__item`, { className={classNames(`${PREFIX}__job-buy__item`, {
@ -126,12 +142,15 @@ export default function JobBuy(props: IProps) {
})} })}
onClick={item.amt === 0 ? undefined : () => handleClickItem(item)} onClick={item.amt === 0 ? undefined : () => handleClickItem(item)}
> >
<div className={classNames(`${PREFIX}__job-buy__item__title`, { free: item.amt === 0 })}>{item.title}</div> <div className={classNames(`${PREFIX}__job-buy__item__title`, { free: item.amt === 0 })}>
<div className={`${PREFIX}__job-buy__item__content`}>{item.content}</div> {item.title}
</div>
<div className={`${PREFIX}__job-buy__item__content`}>{buyOnly ? item.buyOnlyContent : item.content}</div>
<div className={`${PREFIX}__job-buy__item__price`}>{item.price}</div> <div className={`${PREFIX}__job-buy__item__price`}>{item.price}</div>
{item.badge && <Badge className={`${PREFIX}__job-buy__item__badge`} text={item.badge} />} {item.badge && <Badge className={`${PREFIX}__job-buy__item__badge`} text={item.badge} />}
</div> </div>
))} );
})}
</div> </div>
<Button className={`${PREFIX}__job-buy__button`} onClick={handleBuy}> <Button className={`${PREFIX}__job-buy__button`} onClick={handleBuy}>
{`支付 ${selectItem.amt}`} {`支付 ${selectItem.amt}`}

View File

@ -177,4 +177,5 @@ export const FULL_PRICE_OPTIONS = FULL_EMPLOY_SALARY_OPTIONS.filter(o => !!o.val
export enum GET_CONTACT_TYPE { export enum GET_CONTACT_TYPE {
VIP = 'vip', VIP = 'vip',
MATERIAL = 'material',
} }

View File

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

View File

@ -72,6 +72,7 @@ interface ILoadProps {
chatId: string; chatId: string;
jobId?: string; jobId?: string;
job?: string; job?: string;
initText?: boolean;
material?: string; material?: string;
} }
@ -90,6 +91,7 @@ export default function MessageChat() {
const [input, setInput] = useState(''); const [input, setInput] = useState('');
const [showMore, setShowMore] = useState(false); const [showMore, setShowMore] = useState(false);
const [chat, setChat] = useState<IChatInfo | null>(null); const [chat, setChat] = useState<IChatInfo | null>(null);
const [initText, setInitText] = useState('');
const [reject, setReject] = useState<boolean>(false); const [reject, setReject] = useState<boolean>(false);
const [receiver, setReceiver] = useState<IChatUser | null>(null); const [receiver, setReceiver] = useState<IChatUser | null>(null);
const [messages, setMessages] = useState<IChatMessage[]>([]); const [messages, setMessages] = useState<IChatMessage[]>([]);
@ -100,7 +102,7 @@ export default function MessageChat() {
const [material, setMaterial] = useState<IMaterialMessage>(); const [material, setMaterial] = useState<IMaterialMessage>();
const [scrollItemId, setScrollItemId] = useState<string>(); const [scrollItemId, setScrollItemId] = useState<string>();
const scrollToLowerRef = useRef(false); const scrollToLowerRef = useRef(false);
const autoSendRef = useRef({ sendJob: false, sendMaterial: false }); const autoSendRef = useRef({ sendJob: false, sendMaterial: false, sendText: false });
const loadMoreRef = useRef(async (chatId: string, currentMessages: IChatMessage[], forceScroll?: boolean) => { const loadMoreRef = useRef(async (chatId: string, currentMessages: IChatMessage[], forceScroll?: boolean) => {
try { try {
const lastMsgId = last(currentMessages)?.msgId; const lastMsgId = last(currentMessages)?.msgId;
@ -278,7 +280,11 @@ export default function MessageChat() {
} }
job && handleSendJobMessage(); job && handleSendJobMessage();
material && handleSendMaterialMessage(); material && handleSendMaterialMessage();
}, [chat, job, material, handleSendJobMessage, handleSendMaterialMessage]); if (initText && !autoSendRef.current.sendText) {
autoSendRef.current.sendText = true;
handleSendMessage({ type: MessageType.Text, content: '你好,想了解下这个岗位' });
}
}, [chat, job, material, handleSendJobMessage, handleSendMaterialMessage, initText, handleSendMessage]);
useLoad(async () => { useLoad(async () => {
const query = getPageQuery<ILoadProps>(); const query = getPageQuery<ILoadProps>();
@ -309,6 +315,9 @@ export default function MessageChat() {
setScrollItemId(getScrollItemId(last(chatDetail.messages)?.msgId)); setScrollItemId(getScrollItemId(last(chatDetail.messages)?.msgId));
parseJob && setJob(parseJob); parseJob && setJob(parseJob);
parseMaterial && setMaterial(parseMaterial); parseMaterial && setMaterial(parseMaterial);
if (!parseMaterial && query.initText && watchType === ChatWatchType.AnchorReject) {
setInitText('你好,想了解下这个岗位');
}
Taro.setNavigationBarTitle({ title: toUserInfo.nickName }); Taro.setNavigationBarTitle({ title: toUserInfo.nickName });
setReceiver(toUserInfo); setReceiver(toUserInfo);
setReject(!watchStatus); setReject(!watchStatus);

View File

@ -49,6 +49,7 @@ export type JobDetails = JobInfo &
declarationType: DeclarationType; // 报单类型 declarationType: DeclarationType; // 报单类型
userId: string; // 发布人的 userId userId: string; // 发布人的 userId
verifyFailReason?: string; // 审核不通过的原因 verifyFailReason?: string; // 审核不通过的原因
sourcePlat?: string;
}; };
export interface JobManageInfo { export interface JobManageInfo {