feat:
This commit is contained in:
@ -8,7 +8,7 @@ import PageLoading from '@/components/page-loading';
|
||||
import { PublishJobQrCodeDialog } from '@/components/product-dialog/publish-job';
|
||||
import CompanyPublishJobBuy from '@/components/product-dialog/steps-ui/company-publish-job-buy';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { ISelectOption } from '@/components/select';
|
||||
import { ISelectOption, PopupSelect } from '@/components/select';
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import { JobManageStatus } from '@/constants/job';
|
||||
import { OrderStatus, OrderType, ProductSpecId, ProductType } from '@/constants/product';
|
||||
@ -77,16 +77,23 @@ const calcPrice = (city: CityValue | null) => {
|
||||
const productSpecId = GROUP_OPTIONS.find(o => o.value === count)?.productSpecId || ProductSpecId.GroupBatchPublish20;
|
||||
return { price, originalPrice, productSpecId };
|
||||
};
|
||||
|
||||
export default function UserBatchPublish({ cityCode, jobId }: { cityCode: string; jobId: string }) {
|
||||
const cityOptions: CityOption[] = cityValues.map(value => ({ value, label: value.cityName }));
|
||||
export default function UserBatchPublish({ cityCode, jobId }: { cityCode?: string; jobId?: string }) {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [showQrCode, setShowQrCode] = useState(false);
|
||||
const [selectable, setSelectable] = useState(false);
|
||||
const [showCitySelect, setShowCitySelect] = useState(false);
|
||||
const [city, setCity] = useState<CityOption['value'] | null>(null);
|
||||
const { price, originalPrice, productSpecId } = calcPrice(city);
|
||||
const [showPublishJob, setShowPublishJob] = useState(false);
|
||||
|
||||
const [showBuy, setShowBuy, handlePublishJob] = usePublishJob(jobId);
|
||||
const handleClickCity = useCallback(() => setShowCitySelect(true), []);
|
||||
|
||||
const handleSelectCity = useCallback(value => {
|
||||
setCity(value);
|
||||
setShowCitySelect(false);
|
||||
}, []);
|
||||
const handleClickViewGroup = useCallback(() => navigateTo(PageUrl.GroupList, { city: city?.cityCode }), [city]);
|
||||
|
||||
const handleClickBuy = useCallback(async () => {
|
||||
@ -108,12 +115,14 @@ export default function UserBatchPublish({ cityCode, jobId }: { cityCode: string
|
||||
return;
|
||||
}
|
||||
|
||||
const jobDetail = await requestJobDetail(jobId);
|
||||
if (jobId && cityCode) {
|
||||
const jobDetail = await requestJobDetail(jobId);
|
||||
|
||||
if (jobDetail.status !== JobManageStatus.Open) {
|
||||
Taro.hideLoading();
|
||||
setShowPublishJob(true);
|
||||
return;
|
||||
if (jobDetail.status !== JobManageStatus.Open) {
|
||||
Taro.hideLoading();
|
||||
setShowPublishJob(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const { payOrderNo, createPayInfo } = await requestCreatePayInfo({
|
||||
@ -146,11 +155,13 @@ export default function UserBatchPublish({ cityCode, jobId }: { cityCode: string
|
||||
}, [jobId, price, productSpecId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!cityCode) {
|
||||
return;
|
||||
}
|
||||
// if (!cityCode) {
|
||||
// return;
|
||||
// }
|
||||
try {
|
||||
const initCity = cityValues.find(o => o.cityCode === cityCode);
|
||||
const initCity = cityCode ? cityValues.find(o => o.cityCode === cityCode) : cityValues[0];
|
||||
|
||||
setSelectable(!cityCode);
|
||||
|
||||
setLoading(false);
|
||||
if (initCity) {
|
||||
@ -174,8 +185,18 @@ export default function UserBatchPublish({ cityCode, jobId }: { cityCode: string
|
||||
<div className={`${PREFIX}__illustrate`}>
|
||||
服务方式:帮您把招聘需求<div className="underline">发到本地主播群,投递量大幅增加</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__title`}>当前通告城市</div>
|
||||
<Cell align="center" className={`${PREFIX}__cell`} title={city ? city.cityName : '暂不支持代发'} />
|
||||
{selectable ? (
|
||||
<Fragment>
|
||||
<div className={`${PREFIX}__title`}>请选择城市</div>
|
||||
<Cell isLink align="center" className={`${PREFIX}__cell`} title={city?.cityName} onClick={handleClickCity} />
|
||||
</Fragment>
|
||||
) : (
|
||||
<Fragment>
|
||||
<div className={`${PREFIX}__title`}>当前通告城市</div>
|
||||
<Cell align="center" className={`${PREFIX}__cell`} title={city ? city.cityName : '暂不支持代发'} />
|
||||
</Fragment>
|
||||
)}
|
||||
|
||||
{city && (
|
||||
<Fragment>
|
||||
<div className={`${PREFIX}__extra`} onClick={handleClickViewGroup}>
|
||||
@ -196,6 +217,13 @@ export default function UserBatchPublish({ cityCode, jobId }: { cityCode: string
|
||||
)}
|
||||
<SafeBottomPadding />
|
||||
<div>
|
||||
<PopupSelect
|
||||
value={city}
|
||||
options={cityOptions}
|
||||
open={showCitySelect}
|
||||
onSelect={handleSelectCity}
|
||||
onClose={() => setShowCitySelect(false)}
|
||||
/>
|
||||
<PublishJobQrCodeDialog onClose={() => setShowQrCode(false)} open={showQrCode} />
|
||||
<Dialog open={showBuy} onClose={() => setShowBuy(false)}>
|
||||
<Dialog.Content>
|
||||
|
||||
Reference in New Issue
Block a user