<template>
|
<view class="full-page c-m-b-40">
|
<view class="list">
|
<up-form labelPosition="left" :model="publicJob" ref="form1" labelWidth='160rpx'>
|
<view class="content c-p-l-24">
|
<up-form-item label="工作名称" prop="publicJob.orderName" :borderBottom='false' ref="item1">
|
<up-input v-model="publicJob.orderName" border="none" placeholder="请填写工作名称"></up-input>
|
<!-- <template #right>
|
<up-icon name="arrow-right"></up-icon>
|
</template> -->
|
</up-form-item>
|
</view>
|
<view class="content c-p-l-24">
|
<up-form-item label="工作时间" prop="workTime" :borderBottom='false' ref="item1" @click="clickTime">
|
<up-input v-model="workTime" border="none" readonly placeholder="点击选择工作时间"></up-input>
|
<up-icon #right name="arrow-right"></up-icon>
|
</up-form-item>
|
</view>
|
<view class="content c-p-l-24">
|
<up-form-item label="用工要求" prop="publicJob.demand" :borderBottom='false' ref="item1">
|
<view class="c-p-b-20">
|
<up-textarea v-model="publicJob.demand" border="none" placeholder="请输入用工要求" count
|
maxlength='400'></up-textarea>
|
</view>
|
</up-form-item>
|
<view class="c-p-t-20 c-p-b-20">
|
<up-form-item label="招工人数" prop="publicJob.worderCount" :borderBottom='false' ref="item1">
|
<up-number-box v-model="publicJob.worderCount" @change="valChange"></up-number-box>
|
</up-form-item>
|
</view>
|
<view class="c-p-t-20 c-p-b-20">
|
<up-form-item label="工作地点" prop="publicJob.worderAddress" :borderBottom='false' ref="item1">
|
<up-input v-model="publicJob.worderAddress" border="none" placeholder="请输入工作地点"></up-input>
|
<up-icon #right name="arrow-right"></up-icon>
|
</up-form-item>
|
</view>
|
</view>
|
<view class="content c-p-l-24">
|
<up-form-item label="联系电话" prop="publicJob.contactPhone" :borderBottom='false' ref="item1">
|
<up-input v-model="publicJob.contactPhone" border="none" placeholder="请输入联系电话"></up-input>
|
</up-form-item>
|
</view>
|
<view class="content c-p-l-24">
|
<up-form-item label="方式" prop="publicJob.workerType" :borderBottom='false' ref="item1">
|
<up-tag class='c-p-r-14' text="计时" type="warning" :plain='!(publicJob.workerType=="0")' size="large"
|
@click='changStyle(0)'></up-tag>
|
<up-tag class='c-p-r-14' text="计件" type="warning" :plain='!(publicJob.workerType=="1")' size="large"
|
@click='changStyle(1)'></up-tag>
|
</up-form-item>
|
</view>
|
<view class="content c-p-l-24">
|
<up-form-item label="计时工价" prop="publicJob.workPrice" :borderBottom='false' ref="item1">
|
<up-input v-model="publicJob.workPrice" border="none" placeholder="请输入工价">
|
<template #suffix>{{publicJob.workerType=="0"?'元/小时':'元/件'}}</template></up-input>
|
</up-form-item>
|
</view>
|
<!-- <view class="coreshop-bg-white c-m-t-20 c-p-20">
|
<view class="c-p-b-20 colorgray">
|
招工要求或福利(可多选)
|
</view>
|
<view class="c-p-b-20">
|
<up-tag class='c-p-l-14 c-p-b-14' :text="item" plain v-for="(item,index) in tags" :key="index"> </up-tag>
|
</view>
|
<view class="c-p-b-20 colorgray">
|
招工详细描述
|
</view>
|
<view class="c-p-b-20">
|
<up-textarea v-model="value1" placeholder="请输入:可以补充招工要求和福利" ></up-textarea>
|
</view>
|
</view> -->
|
</up-form>
|
</view>
|
<view class="tabbtns">
|
<up-button color='#fece01' class="text-69" text="发布招工" @click="saveOrder"></up-button>
|
</view>
|
<!-- <fui-fab :zIndex="10" background='#fff' bottom='250'>
|
<fui-icon name="kefu-fill" color='#000'></fui-icon>
|
</fui-fab> -->
|
<fui-date-picker range :show="datePickerShow" type="5" @change="changePicker" :minDate='minDate'
|
@cancel="cancel"></fui-date-picker>
|
</view>
|
</template>
|
|
<script setup>
|
import {
|
ref,
|
reactive,
|
getCurrentInstance
|
} from 'vue';
|
import {
|
onLoad,
|
onShow
|
} from "@dcloudio/uni-app";
|
const {
|
$upload,
|
$api,
|
$util,
|
$db
|
} = getCurrentInstance().appContext.config.globalProperties
|
import {
|
useStore
|
} from 'vuex'
|
onLoad(() => {
|
let data = JSON.parse($db.get('userInfo')).userCompany
|
if (data) {
|
publicJob.orderUserId = 5
|
}
|
})
|
let minDate = $util.formatDate(new Date())
|
let longitude = ref(0)
|
let latitude = ref(0)
|
let workTime = ref('')
|
const store = useStore()
|
let datePickerShow = ref(false)
|
const publicJob = reactive({
|
id: 0, //招工Id
|
orderUserId: '', //招工用户id
|
orderName: '', //招工名称
|
wordStartTime: '', //工作开始时间
|
wordEndTime: '', //工作结束时间
|
demand: '', //需求
|
worderCount: '', //招工人数
|
worderAddress: '', //工作地点
|
contactPhone: '', //联系电话
|
workerType: 0, //工作方式 0计时1计件
|
workPrice: '', //工价
|
})
|
|
const style = ref('time')
|
const changStyle = (val) => {
|
publicJob.workerType = val
|
}
|
const clickTime = () => {
|
datePickerShow.value = !datePickerShow.value
|
}
|
const changePicker = (val) => {
|
console.log(val);
|
workTime.value = val.startDate.result + '至' + val.endDate.result
|
publicJob.wordStartTime = new Date(val.startDate.result) //工作开始时间
|
publicJob.wordEndTime = new Date(val.endDate.result)
|
}
|
const saveOrder = () => {
|
// publicJob.worderCount = (+publicJob.worderCount)
|
$api.saveOrder(publicJob).then(res => {
|
$util.showToast({
|
title: "保存成功!",
|
icon: "success"
|
})
|
uni.navigateTo({
|
url:'/pages/order/order'
|
})
|
})
|
}
|
const toMap = () => {
|
// #ifdef MP-WEIXIN
|
console.log(store, 'store’');
|
const txMapkey = store.state.config.qqMapKey; //使用在腾讯位置服务申请的key
|
const referer = store.state.config.shopName; //调用插件的app的名称
|
const location = JSON.stringify({
|
latitude: publicJob.latitude == "" ? latitude : publicJob.latitude,
|
longitude: publicJob.longitude == "" ? longitude : publicJob.longitude
|
});
|
const category = '';
|
|
wx.navigateTo({
|
url: 'plugin://chooseLocation/index?key=' + txMapkey + '&referer=' + referer +
|
'&location=' +
|
location + '&category=' + category
|
});
|
// #endif
|
|
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
uni.chooseLocation({
|
success: (res) => {
|
console.log(res, 'res');
|
}
|
});
|
// #endif
|
}
|
</script>
|
|
<style>
|
.list {}
|
|
.content {
|
width: 100%;
|
box-sizing: border-box;
|
background-color: #fff;
|
}
|
|
.u-textarea {
|
padding: 0 !important;
|
}
|
</style>
|