|                                                                                                                                                                                                                                                                                                                                                              |  | <template>	<view>		<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" labelWidth="80">			<view class="se-p-20">				<view class="se-px-20 se-bgc-white se-br-10 se-fs-20">					 <!-- @click="showPicker=true" -->					<u-form-item label="请选择居住地址" class="se-b-b" prop="area" @click="handleAreaChange()">						<u--input readonly v-model="form.area"  placeholder="请选择地址" border="none"></u--input>						<u-icon slot="right" name="arrow-right" ></u-icon>					</u-form-item>					<!-- <u-form-item label="详细地址" prop="address">						<u--textarea v-model="form.address" count placeholder="请输入详细地址"></u--textarea>					</u-form-item> -->					<u-form-item label="所属行业" class="se-b-b" prop="industry" @click="handleindustryChange()">						<u--input @click="handleindustryChange" readonly v-model="form.industry" placeholder="请选择行业" border="none"></u--input>						<u-icon @click="handleindustryChange" slot="right" name="arrow-right"></u-icon>					</u-form-item>					<u-form-item label="所属工种" class="se-b-b" prop="typeName" @click="handleTypeChange">						<u--input @click="handleTypeChange" v-model="form.typeName" readonly placeholder="请选择工种"							border="none"></u--input>						<u-icon @click="handleTypeChange" slot="right" name="arrow-right"></u-icon>					</u-form-item>					<!-- <u-form-item label="预约时间" prop="date" @click="show=true">						<u--input  v-model="form.date" readonly placeholder="请选择预约时间"							border="none"></u--input>						<u-icon slot="right" name="arrow-right"></u-icon>					</u-form-item> -->					<u-form-item label="出行方式" labelPosition="top"  prop="travel">						<view class="se-flex se-flex-ai-c se-flex-ff-rw se-pt-10">							<view class="se-py-10 se-px-30   se-fs-22 se-br-10 se-mr-15 se-mt-10" :class="item.select ? 'se-bgc-orange se-c-white se-b-orange' : 'se-b se-c-text'" @click="handleIntellect(index)" v-for="(item,index) in travelList" :key="index">								{{item.text}}							</view>						</view>					</u-form-item>					<u-form-item label="结算方式" prop="settlement">						<u-radio-group  v-model="form.settlement" placement="row">							<u-radio activeColor="#FF7A31" name="0" label="提前支付"></u-radio>							<u-radio activeColor="#FF7A31" class="se-ml-20" name="1" label="试用以后支付"></u-radio>						</u-radio-group>					</u-form-item>					<u-form-item label="薪资区间" prop="salary">						<view class="se-flex se-flex-h-c">							<u--input v-model="form.salaryMin" type="number" class="se-w-200" placeholder="最小值"></u--input>							<text class="se-mx-10">~</text>							<u--input v-model="form.salaryMax" type="number" class="se-w-200" placeholder="最大值"></u--input>						</view>					</u-form-item>					<u-form-item label="试工日薪" prop="dayMoney">						<view class="se-flex se-flex-h-c">							<u--input v-model="form.dayMoney" type="number" class="se-w-200" placeholder="试工日薪"></u--input>						</view>					</u-form-item>					<!-- <u-form-item label="时间" prop="date">						<view class="se-flex se-flex-h-c">							<u--input v-model="form.dateMin" class="se-w-200" placeholder="0:00"></u--input>							<text class="se-mx-10">~</text>							<u--input v-model="form.dateMax" class="se-w-200" placeholder="0:00"></u--input>						</view>					</u-form-item>					<u-form-item label="联系电话" prop="mobile">						<u--input v-model="form.mobile"  placeholder="请输入联系方式"></u--input>					</u-form-item> -->					<u-form-item label="期望工作" prop="introduce">						<u--textarea v-model="form.introduce" count 							placeholder="请选择期望工作"></u--textarea>					</u-form-item>				</view>			</view>						<view class="se-px-20 se-pt-20">				<view class="se-px-20 se-pb-80 se-fs-20 se-flex">					<view @click="submit"					class="se-mx-10 se-flex-1 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-28 se-c-white se-bgc-orange">					<text>{{ editId ? '更新求职信息' : '发布订单' }}</text>				</view>				</view>			</view>		</u--form>		<!-- 行业 -->		<u-action-sheet :show="showIndustry" :actions="industryList" title="请选择行业" @close="showIndustry = false" @select="industrySelect">		</u-action-sheet>		<!-- 种类 -->		<u-action-sheet :show="showType" :actions="typeList" title="请选择种类" @close="showType = false" @select="typeSelect">		</u-action-sheet>	</view></template>
<script>	import QQMapWX from "@/util/qqmap-wx-jssdk.min.js"	import { industryById,industryList,addTask2,addSeek,updateSeek,querySeekById } from "@/common/api.js"	export default {		props: {			editId: {				type: String,				default: null			}		},		components:{					},		data() {			return {				show:false,				showPicker: false,				showIndustry: false,				industryList: [],				showType: false,				typeList: [],				travelList:[					{						text:"出租车",						value:"all",						select:true					},					{						text:"网约车",						value:"all",						select:false					},					{						text:"公交/地铁",						value:"all",						select:false					},					{						text:"无",						value:"all",						select:false					}				],				dates:[					['2024','2025','2026','2027','2028'],					['01','02','03','04','05','06','07','08','09','10','11','12'],					['01','02','03','04','05','06','07','08','09','10','11','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30'],				],				form: {					title:"",					area:'',					selectGo:"出租车",					address:'',					industryId:"",					industry:"",					settlement:1,					date:"",					dateMin:"",					dateMax:"",					mobile: '',					typeId:"",					typeName: '',					salary:'',					salaryMin: '',					salaryMax: '',					dayMoney:'',					introduce: '',					longitude:'',					latitude:''				},				rules: {					title:[						{							type: 'string',							required: true,							message: '请在此输入标题',							trigger: ['blur', 'change']						}					],					area:[						{							type: 'string',							required: true,							message: '请选择地址',							trigger: ['blur', 'change']						}					],					address:[						{							type: 'string',							required: true,							message: '请填写详细地址',							trigger: ['blur', 'change']						}					],					industry:[						{							type: 'string',							required: true,							message: '请选择行业',							trigger: ['blur', 'change']						}					],					settlement:[						{							type: 'string',							required: true,							message: '请选择结算方式',							trigger: ['blur', 'change']						}					],					mobile: [						{							required: true, 							message: '请输入手机号',							trigger: ['change','blur'],						},						{							validator: (rule, value, callback) => {								return uni.$u.test.mobile(value);							},							message: '手机号码不正确',							trigger: ['change','blur'],						},					],										date: [{						type: 'string',						max: 1,						required: true,						message: '请填写时间',						trigger: ['blur', 'change']					}],					salary: [{						type: 'string',						required: true,						message: '请输入试用日薪',						trigger: ['blur', 'change']					}],					introduce: [{						type: 'string',						required: true,						message: '请输入工作内容',						trigger: ['blur', 'change']					}],									},			}		},		watch: {			'form.salaryMin': {			  handler(newVal, oldVal) {				if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.salaryMax)) {					this.form.salary = '有'				} else {					this.form.salary = ''				}			  },			  immediate: true			},			'form.salaryMax': {			  handler(newVal, oldVal) {				if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.salaryMin)) {					this.form.salary = '有'				} else {					this.form.salary = ''				}			  },			  immediate: true			},			'form.dateMin': {			  handler(newVal, oldVal) {				if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.dateMax)) {					this.form.date = '有'				} else {					this.form.date = ''				}			  },			  immediate: true			},			'form.dateMax': {			  handler(newVal, oldVal) {				if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.dateMin)) {					this.form.date = '有'				} else {					this.form.date = ''				}			  },			  immediate: true			},		},		mounted() {			industryList({}).then(response=>{				this.industryList = response.result				// 如果是编辑模式,在行业列表加载完成后获取求职详情数据
				if (this.editId) {					this.getSeekDetail()				}			}).catch(error=>{							})		},		methods: {			dateConfirm(event){				this.form.date = event.value[0]+"-"+event.value[1]+"-"+event.value[2]				console.info(event.value)				this.show = false			},			handleIntellect(index){				this.travelList.forEach((items)=>{					items.select=false				})				this.travelList[index].select = !this.travelList[index].select				this.form.selectGo = this.travelList[index].text			},
			handleAreaChange(){				const that = this;				wx.chooseLocation({                    type: 'gcj02',					// type: 'wgs84',
					success: function (res) {
                        that.form.latitude = res.latitude                        that.form.longitude = res.longitude
                        if (!res.address && res.name) { //用户直接选择城市的逻辑
                            return that.form.area = res.name                        }                        if (res.address || res.name) {                            return that.form.area = res.address + res.name                        }                        that.form.area = '' //用户啥都没选就点击勾选
					}				})			},
			handleindustryChange() {				this.showIndustry = true			},			industrySelect(e) {				console.info(e)				this.form.industryId = e.id				this.form.industry = e.name				this.form.typeId = ""				this.form.type = ""				industryById({pid:e.id}).then(response=>{					this.typeList=response.result				}).catch(error=>{									})				this.$refs.uForm.validateField('industry')			},			handleTypeChange() {				this.showType = true			},			typeSelect(e) {				this.form.typeId = e.id				this.form.typeName = e.name				this.$refs.uForm.validateField('type')			},			getSeekDetail() {				querySeekById({ id: this.editId }).then(response => {					const data = response.result					// 回填表单数据
					this.form.area = data.address || ''					this.form.industryId = data.categoryOne || ''					this.form.industry = data.categoryOne || ''					this.form.typeId = data.categoryTwo || ''					this.form.typeName = data.categoryTwo || ''					this.form.selectGo = data.selectGo || '出租车'					this.form.settlement = data.payType || 1					this.form.salaryMin = data.salaryMin || ''					this.form.salaryMax = data.salaryMax || ''					this.form.dayMoney = data.dayMoney || ''					this.form.introduce = data.workDetail || ''					this.form.latitude = data.latitude || ''					this.form.longitude = data.longitude || ''										// 设置出行方式选中状态
					this.travelList.forEach(item => {						item.select = item.text === data.selectGo					})										// 确保行业列表已加载,然后设置选中状态
					if (data.categoryOne && this.industryList.length > 0) {						const selectedIndustry = this.industryList.find(item => item.id === data.categoryOne)						if (selectedIndustry) {							this.form.industry = selectedIndustry.name						}					}										// 获取工种列表并设置选中状态
					if (data.categoryOne) {						industryById({pid: data.categoryOne}).then(typeResponse => {							this.typeList = typeResponse.result							// 设置工种选中状态
							if (data.categoryTwo && this.typeList.length > 0) {								const selectedType = this.typeList.find(item => item.id === data.categoryTwo)								if (selectedType) {									this.form.typeName = selectedType.name								}							}						})					}				}).catch(error => {					console.error('获取求职详情失败:', error)				})			},			submit() {				let that = this				that.$refs.uForm.validate().then(res => {					that.onAddTask()				}).catch(errors => {					// uni.$u.toast('校验失败')
				})			},			onAddTask(){				let that = this				let params ={				  "phone": that.form.mobile,//招聘方联系方式
				  "dayMoney": that.form.dayMoney,//期望日薪
				  "selectGo": that.form.selectGo,//出行方式
				  // "endTime": that.form.dateMax,
				  "categoryOne": that.form.industryId,				  "categoryTwo": that.form.typeId,				  "latitude": that.form.latitude,				  "longitude": that.form.longitude,				  "salaryMax": that.form.salaryMax,//期望薪资最大值
				  "salaryMin": that.form.salaryMin,//期望薪资最小值
				  "payType": that.form.settlement,//结算方式 0提前支付 1 试用后支付
				  // "startTime": that.form.dateMin,
				  // "title": that.form.title,//工作标题
				  "address": that.form.area,//工作地址
				  "workDetail": that.form.introduce,				  // "workPic": that.form.fileList.map(item => item.url).join(','),//照片
				}
                if(this.editId){                    params.id = this.editId                }
				// let p={"bossPhone":"13189698115","dayMoney":"500","endTime":"2016-01-01 00:00:00","industryId":"1865299999310622721","industryName":"木工","latitude":28.23529,"longitude":112.93134,"moneymax":"15000","moneymin":"12000","payType":"1","startTime":"2015-01-01 00:00:00","title":"木工师傅","workAddress":"湖南省长沙市岳麓区金星北路一段517号","workDetail":"阿萨法大多数发斯蒂芬撒旦法撒旦法阿斯蒂芬撒旦法撒旦法撒旦法三大法师打","workPic":"https://tennis-oss.xzaiyp.top/2025-02-19/341d669a-ef66-4abb-8b98-ac71c08814c9.jpg"}
				addSeek(params).then(response=>{					// console.info("response",response)
					uni.$u.toast("提交成功!")					setTimeout(()=>{						uni.switchTab({							url: '/pages/home/index'						})					},800)				}).catch(error=>{									})			},		},		onReady() {			this.$refs.uForm.setRules(this.rules)		},	}</script>
<style></style>
 |