<template>
	<div class="job-list g_bg_page">
		<template v-for="item in list" :key="item.id">
			<view class="g_p_12">
				{{ item.itemType }}
			</view>
			<div class="">
				<view class="item g_position_rela  g_mb_10 g_ml_12 g_mr_12 r_box g_border_e_b" :class="item.from == 'share' ? 'g_pl_32' : ''">
					<view class="g_p_10 g_position_rela" style="" @click="handleCard(item, index)">
						<i class="iconfont icon-yitingzhao" v-if="item.recruitment == 2 && item.from != 'mine'" style="position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); color: #ff4d4f; font-size: 80px; z-index: 1"></i>
						<view class="m-top g_flex_row_between">
							<view class="g_flex_1 g_flex_column_between">
								<view class="g_flex_1 g_flex_row_between g_lh_1">
									<view class="g_flex_none g_flex_row_start flex_center">
										<img class="g_w_32 g_h_16 g_mr_4" v-if="item.picked == 1" src="https://matripe-cms.oss-cn-beijing.aliyuncs.com/bocaigongyinglian/zhen.svg" alt="" />
										<view class="g_ell_1 g_fs_18 g_fw_600" style="color: rgba(0, 0, 0, 0.85); max-width: 480rpx; line-height: 1.3">{{ item.jobName }}</view>
									</view>
									<view class="g_fs_14 g_flex_row_end" style="color: rgba(0, 0, 0, 0.45)">
										<view>{{ timeShowXXX(item.updateTime) }}</view>
									</view>
								</view>

								<view class="g_flex_none g_flex_row_between g_mt_6">
									<view class="g_flex_row_between flex_center g_fs_14 g_flex_1" style="color: rgba(0, 0, 0, 0.45)">
										<view class="g_ell_1" style="max-width: calc(100vw - 40px)">
											<view class="" style=""> {{ item.district }}{{ item.district ? "丨" : "" }}{{ (item.gender || "-") + "丨" + item.age }} </view>
										</view>
										<view class="" hover-class="none" hover-stop-propagation="false">
											{{ item.distance && item.storeDistrict ? item.distance : "" }}
										</view>
									</view>
									<view class="g_flex_none g_flex_column_center b_btn" @click.stop="openApplyPop(item, index)" v-if="false"> 立即报名 </view>
								</view>
							</view>
						</view>
						<view class="m-bottom g_flex_row_between g_mt_8">
							<view class="g_flex_1 g_flex_row_between flex_center">
								<view class="g_flex_1 g_flex_row_between">
									<view class="g_flex_row_start_none g_flex_1" style="max-width: 75%; flex-wrap: wrap; height: 22px; overflow: hidden">
										<view class="label_btn" v-for="(itm, inx) in item.jobSpecialLabelNameArray" :key="inx">{{ itm }}</view>
										<view class="label_btn" v-if="item.jobSpecialLabelNameArray && item.jobSpecialLabelNameArray.length == 0"> 暂无特色 </view>
									</view>
								</view>
							</view>
						</view>
						<view class="g_mt_6">
							<view class="g_flex_row_between flex_center g_fs_18 g_c_f40 g_fw_600">
								<rich-text class="g_lh_1" :nodes="item.cus_price" v-if="item.cus_price != '月薪'"></rich-text>
								<view v-else>{{ item.monthlyPay }}<span class="g_fs_14"> 元/月 </span> </view>
								<view class="g_flex_row_start g_fs_12 g_pr_4 g_h_20 g_fw_400" style="background: linear-gradient(138deg, #fde0ad 22%, #fac474); border-radius: 2px; color: #754300; line-height: 20px">
									<view class>
										<image class="g_mr_4" style="width: 20px; height: 20px; display: block" src="https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/fee.svg" mode="aspecFill" lazy-load="false"></image>
									</view>
									<view class="g_fs_13">{{ (recordStatus == 3 || recordStatus == 4 || recordStatus == 5) && !isSelf ? "关注查看" : item.fuWuFei }}</view>
								</view>
							</view>
						</view>
					</view>
					<view class="" @click.stop>
						<view class="g_flex_row_between flex_center g_border_e_t g_p_8" v-if="item.from == 'mine'">
							<u-switch v-model="item.recruitmentValue" :showText="true" openText="开" closeText="停" class="" size="44" @change="recruitmentChange($event, item)" activeColor="#07C160"></u-switch>
							<view class="g_flex_column_center g_pl_10 g_h_all biggerSize" @click.stop="showConfig(item)">
								<i class="iconfont icon-gengduo2 icon g_c_b1" style="font-size: 32rpx"></i>
							</view>
						</view>
						<view class="g_border_e_t g_p_8" style="line-height: 23px" v-if="item.from != 'shareList' && item.from != 'mine'">
							<view class="g_flex_row_between flex_center" v-if="item.from != 'chat'">
								<view class="g_c_6 g_fs_12 g_pr_4 g_radius_4 g_flex_row_start flex_center" style="background: #f1faff" @click="toApplyInfo(item)">
									<img class="g_w_36 g_h_20 g_mr_4" src="https://matripe-cms.oss-cn-beijing.aliyuncs.com/bocaigongyinglian/icon-fadanhao.svg" alt="" />
									<view>
										{{ item.fullName || item.agencyName || "-" }}
									</view>
								</view>
								<view class="g_c_6 g_fs_12 g_pr_4 g_radius_4 g_flex_row_start flex_center" style="background: #f1faff" v-if="userinfo.agencyId == item.agencyId">
									<img class="g_w_36 g_h_20 g_mr_4" src="https://matripe-cms.oss-cn-beijing.aliyuncs.com/bocaigongyinglian/xmf.svg" alt="" />
									<view>
										{{ item.upFullName || item.upAgencyName || item.upProviderName || "-" }}
									</view>
								</view>
							</view>
							<view class="g_flex_row_end flex_center" v-if="item.from == 'chat'">
								<g-button btnText="发送" fontSize="14" type="primary" size="mini" @clickBtn="sendJob(item)" />
							</view>
						</view>
					</view>
					<view class="checkBox" hover-class="none" v-if="item.from == 'share'" @click.stop="checkJob(item)">
						<checkbox class="biggerSize" style="transform: scale(0.8, 0.8)" color="g_c_main" :checked="item.checked" :value="item.checked"></checkbox>
					</view>
				</view>
			</div>
		</template>
	</div>
</template>

<script>
export default {
	// 组件名称
	name: "",
	// 局部注册的组件
	components: {},
	// 组件参数 接收来自父组件的数据
	props: {},
	// 组件状态值
	data() {
		return {
			userinfo: {
				agencyId: 3088,
			},
			list: [
				{
					itemType: "我的职位样式",
					from: "mine",
					recruitmentValue: true,
					active: 2,
					address: "湖北省丨武汉市18-40岁",
					age: "18-40岁",
					agencyCode: "5258",
					agencyId: 3087,
					agencyLogo: "https://file.matripe.com.cn/images/2025/05/13/1747101728480749.png",
					agencyName: "郑州稻田信息技术有限公司",
					agencyReturnFee: "",
					agencyReturnFeeDesp: "",
					agencyReturnFeeType: "",
					applyNum: 2,
					classify: 1,
					collect: 1,
					collected: 2,
					cozeStructureRes: "",
					creator: 128266,
					creatorName: "薄荷",
					cus_price: "<span style='font-size:18px'>18<span style='font-size:14px'>元/小时</span></span>",
					customServiceTel: "",
					customServiceUserIdIM: "",
					customServiceUserIds: "",
					customServiceWechatImage: "",
					distance: 0,
					district: "湖北省丨武汉市",
					fuWuFei: "2元/小时",
					fullName: "稻田工作",
					gender: "男女不限",
					id: 116423,
					ignore: 0,
					imgs: "",
					isToday: false,
					jobInfo: "",
					jobName: "武汉市藏龙岛国企操作工小时工",
					jobRequestLabelId: "177,572,579",
					jobRequestLabelNames: "免费住宿, 长白班, 空调车间",
					jobSpecialLabelNameArray: ["免费住宿", "长白班", "空调车间"],
					jobSpecialLabelNames: "",
					jobType: 2,
					lastNotice: "",
					leafCateId: 116423,
					logo: "https://file.matripe.com.cn/images/2025/05/13/1747101728480749.png",
					maxAge: 40,
					maxAgeMan: 40,
					maxAgeWoman: 40,
					maxMonthlyPay: 520000,
					minAge: 18,
					minAgeMan: 18,
					minAgeWoman: 18,
					minMonthlyPay: 450000,
					monthlyPay: "4500-5200",
					onSiteUsers: "",
					owner: false,
					policyClassify: 1,
					price: "18元/小时",
					recommend: 0,
					recruitment: 1,
					recruitmentImage: 2,
					recruitmentSwitch: false,
					returnFee: 200,
					returnFeeDesp: "",
					returnFeeType: 0,
					salaryClassify: 0,
					salaryClassifyValue: 1800,
					serverPrice: "-",
					storeAddr: "湖北省武汉市",
					storeDistrict: "",
					storeId: "",
					storeLat: "30.5931",
					storeLng: "114.3054",
					storeName: "",
					supplier: "",
					supplierId: "",
					teamType: 2,
					templateId: "",
					time: "34天前",
					tip: 2,
					title: "武汉市藏龙岛国企操作工小时工",
					today: 0,
					totalPrice: "",
					up: 2,
					upAgencyId: 3087,
					upAgencyName: "郑州稻田信息技术有限公司",
					upFullName: "稻田工作",
					upProviderId: "",
					upProviderName: "",
					updateTime: 1754992288000,
				},
				{
					itemType: "聊天发送职位样式",

					from: "chat",
					active: 2,
					address: "湖北省丨武汉市18-40岁",
					age: "18-40岁",
					agencyCode: "5258",
					agencyId: 3087,
					agencyLogo: "https://file.matripe.com.cn/images/2025/05/13/1747101728480749.png",
					agencyName: "郑州稻田信息技术有限公司",
					agencyReturnFee: "",
					agencyReturnFeeDesp: "",
					agencyReturnFeeType: "",
					applyNum: 2,
					classify: 1,
					collect: 1,
					collected: 2,
					cozeStructureRes: "",
					creator: 128266,
					creatorName: "薄荷",
					cus_price: "<span style='font-size:18px'>18<span style='font-size:14px'>元/小时</span></span>",
					customServiceTel: "",
					customServiceUserIdIM: "",
					customServiceUserIds: "",
					customServiceWechatImage: "",
					distance: 0,
					district: "湖北省丨武汉市",
					fuWuFei: "2元/小时",
					fullName: "稻田工作",
					gender: "男女不限",
					id: 116424,
					ignore: 0,
					imgs: "",
					isToday: false,
					jobInfo: "",
					jobName: "武汉市藏龙岛国企操作工小时工",
					jobRequestLabelId: "177,572,579",
					jobRequestLabelNames: "免费住宿, 长白班, 空调车间",
					jobSpecialLabelNameArray: ["免费住宿", "长白班", "空调车间"],
					jobSpecialLabelNames: "",
					jobType: 2,
					lastNotice: "",
					leafCateId: 116424,
					logo: "https://file.matripe.com.cn/images/2025/05/13/1747101728480749.png",
					maxAge: 40,
					maxAgeMan: 40,
					maxAgeWoman: 40,
					maxMonthlyPay: 520000,
					minAge: 18,
					minAgeMan: 18,
					minAgeWoman: 18,
					minMonthlyPay: 450000,
					monthlyPay: "4500-5200",
					onSiteUsers: "",
					owner: false,
					policyClassify: 1,
					price: "18元/小时",
					recommend: 0,
					recruitment: 1,
					recruitmentImage: 2,
					recruitmentSwitch: false,
					returnFee: 200,
					returnFeeDesp: "",
					returnFeeType: 0,
					salaryClassify: 0,
					salaryClassifyValue: 1800,
					serverPrice: "-",
					storeAddr: "湖北省武汉市",
					storeDistrict: "",
					storeId: "",
					storeLat: "30.5931",
					storeLng: "114.3054",
					storeName: "",
					supplier: "",
					supplierId: "",
					teamType: 2,
					templateId: "",
					time: "34天前",
					tip: 2,
					title: "武汉市藏龙岛国企操作工小时工",
					today: 0,
					totalPrice: "",
					up: 2,
					upAgencyId: 3087,
					upAgencyName: "郑州稻田信息技术有限公司",
					upFullName: "稻田工作",
					upProviderId: "",
					upProviderName: "",
					updateTime: 1754992288000,
				},
				{
					itemType: "默认职位样式",

					active: 2,
					address: "湖北省丨武汉市18-40岁",
					age: "18-40岁",
					agencyCode: "5258",
					agencyId: 3088,
					agencyLogo: "https://file.matripe.com.cn/images/2025/05/13/1747101728480749.png",
					agencyName: "郑州稻田信息技术有限公司",
					agencyReturnFee: "",
					agencyReturnFeeDesp: "",
					agencyReturnFeeType: "",
					applyNum: 2,
					classify: 1,
					collect: 1,
					collected: 2,
					cozeStructureRes: "",
					creator: 128266,
					creatorName: "薄荷",
					cus_price: "<span style='font-size:18px'>18<span style='font-size:14px'>元/小时</span></span>",
					customServiceTel: "",
					customServiceUserIdIM: "",
					customServiceUserIds: "",
					customServiceWechatImage: "",
					distance: 0,
					district: "湖北省丨武汉市",
					fuWuFei: "2元/小时",
					fullName: "稻田工作",
					gender: "男女不限",
					id: 116425,
					ignore: 0,
					imgs: "",
					isToday: false,
					jobInfo: "",
					jobName: "武汉市藏龙岛国企操作工小时工",
					jobRequestLabelId: "177,572,579",
					jobRequestLabelNames: "免费住宿, 长白班, 空调车间",
					jobSpecialLabelNameArray: ["免费住宿", "长白班", "空调车间"],
					jobSpecialLabelNames: "",
					jobType: 2,
					lastNotice: "",
					leafCateId: 116425,
					logo: "https://file.matripe.com.cn/images/2025/05/13/1747101728480749.png",
					maxAge: 40,
					maxAgeMan: 40,
					maxAgeWoman: 40,
					maxMonthlyPay: 520000,
					minAge: 18,
					minAgeMan: 18,
					minAgeWoman: 18,
					minMonthlyPay: 450000,
					monthlyPay: "4500-5200",
					onSiteUsers: "",
					owner: false,
					policyClassify: 1,
					price: "18元/小时",
					recommend: 0,
					recruitment: 2,
					recruitmentImage: 2,
					recruitmentSwitch: false,
					returnFee: 200,
					returnFeeDesp: "",
					returnFeeType: 0,
					salaryClassify: 0,
					salaryClassifyValue: 1800,
					serverPrice: "-",
					storeAddr: "湖北省武汉市",
					storeDistrict: "",
					storeId: "",
					storeLat: "30.5931",
					storeLng: "114.3054",
					storeName: "",
					supplier: "",
					supplierId: "",
					teamType: 2,
					templateId: "",
					time: "34天前",
					tip: 2,
					title: "武汉市藏龙岛国企操作工小时工",
					today: 0,
					totalPrice: "",
					up: 2,
					upAgencyId: 3087,
					upAgencyName: "郑州稻田信息技术有限公司",
					upFullName: "稻田工作",
					upProviderId: "",
					upProviderName: "",
					updateTime: 1754992288000,
				},
			],
		};
	},
	// 计算属性
	computed: {},
	// 侦听器
	watch: {},
	created() {},
	mounted() {},
	// 组件方法
	methods: {
		recruitmentChange() {},
		showConfig() {},
		toApplyInfo() {},
		sendJob() {},
		checkJob() {},
		openApplyPop() {},
		handleCard() {},
		timeShowXXX(updateTime) {
			const now = Date.now();
			const diff = now - updateTime;

			const seconds = Math.floor(diff / 1000);
			const minutes = Math.floor(seconds / 60);
			const hours = Math.floor(minutes / 60);
			const days = Math.floor(hours / 24);

			if (days < 2) {
				if (hours > 0) {
					return `${hours}小时前`;
				} else if (minutes > 0) {
					return `${minutes}分钟前`;
				} else {
					return `刚刚`;
				}
			} else {
				return `${days}天前`;
			}
		},
	},
};
</script>

<style scoped lang="scss">
.label_btn {
	display: inline-block;
	height: 20px;
	box-sizing: border-box;
	font-size: 12px;
	font-weight: 400;
	color: #666;
	background: #f1faff;
	border-radius: 2px;
	padding: 0 4px 0px;
	line-height: 20px;
	margin-right: 6px;
	margin-bottom: 0px;
	position: relative;
	top: 1px;
}
</style>
