| | |
| | | <up-input v-model="workDate" border="none" readonly placeholder="点击选择工作日期"></up-input> |
| | | <up-icon #right name="arrow-right"></up-icon> |
| | | </up-form-item> |
| | | <up-form-item label="工作时间" prop="StartTime" required :borderBottom='false' ref="item1" |
| | | @click="clickTime(6)"> |
| | | <up-form-item label="自行安排" prop="startTime" :borderBottom='false' ref="item1" |
| | | v-if="publicJob.workerType==1"> |
| | | <up-checkbox :customStyle="{marginBottom: '8px'}" label="自行安排时间" name="agree" usedAlone |
| | | v-model:checked="publicJob.zixinganpai" /> |
| | | </up-form-item> |
| | | <up-form-item label="工作时间" prop="startTime" required :borderBottom='false' ref="item1" |
| | | v-if="!publicJob.zixinganpai" @click="clickTime(6)"> |
| | | <up-input v-model="workTime" border="none" readonly placeholder="点击选择工作时间"></up-input> |
| | | <up-icon #right name="arrow-right"></up-icon> |
| | | </up-form-item> |
| | |
| | | <up-input v-model="publicJob.workPrice" border="none" placeholder="请输入工价" type="digit"> |
| | | <template #suffix>{{publicJob.workerType=="0"?'元/小时':'元/件'}}</template></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="工价上限" prop="workPriceMax" required :borderBottom='false' ref="item1"> |
| | | <up-input v-model="publicJob.workPriceMax" border="none" placeholder="请输入工价上限" type="digit"> |
| | | <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"> |
| | |
| | | </up-form> |
| | | </view> |
| | | <view class="tabbtns"> |
| | | <up-button color='#fece01' class="text-69" text="发布招工" :loading='isLoading' loadingText="发布中" |
| | | <up-button color='#fece01' :text="editItem?'修改招工':'发布招工'" :loading='isLoading' :loadingText="editItem?'修改中':'发布中'" |
| | | @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="dateType" @change="changePicker" :minDate='minDate' |
| | | :start="dateType==6?'8:00':'开始日期'" :value="dateType==6?'8:00':sDate" :end="dateType==6?'18:00':'结束日期'" |
| | | :start="dateType==6?'8:00':'开始日期'" :value="dateType==6?'8:00':sDate" :end="dateType==6?'18:00':eDate" |
| | | @cancel="cancel" :param='$util.formatDate(new Date())'></fui-date-picker> |
| | | </view> |
| | | </template> |
| | |
| | | import { |
| | | onLoad, |
| | | onShow, |
| | | onReady |
| | | onReady, |
| | | onHide |
| | | } from "@dcloudio/uni-app"; |
| | | const { |
| | | $upload, |
| | |
| | | useStore |
| | | } from 'vuex' |
| | | onLoad(() => { |
| | | let data = JSON.parse($db.get('userInfo')).userCompany |
| | | let data = $db.get('userInfo').userCompany |
| | | editItem = $db.get('editItem') |
| | | if (data) { |
| | | publicJob.orderUserId = 5 |
| | | publicJob.worderAddress = data.address |
| | | publicJob.contactPhone = data.phone //联系电话 |
| | | } |
| | | if (editItem) { |
| | | publicJob = reactive(editItem) |
| | | workDate.value = editItem.wordStartTimeName + '至' + editItem.wordEndTimeName |
| | | sDate = editItem.wordStartTimeName |
| | | eDate = editItem.wordEndTimeName |
| | | $db.del('editItem') |
| | | } |
| | | }) |
| | | let rules = { |
| | |
| | | message: '工作日期不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | StartTime: { |
| | | startTime: { |
| | | required: true, |
| | | message: '工作时间不能为空', |
| | | trigger: ['blur', 'change'] |
| | |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | workPrice: { |
| | | type: 'number', |
| | | required: true, |
| | | message: '工价不能为空', |
| | | trigger: ['blur', 'change'] |
| | | } |
| | | }, |
| | | workPriceMax: { |
| | | type: 'number', |
| | | required: true, |
| | | message: '工价上限不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | } |
| | | const formRef = ref(null); |
| | | onReady(() => { |
| | | formRef.value.setRules(rules); |
| | | }) |
| | | onShow(()=>{ |
| | | console.log('Show-------------',publicJob); |
| | | }) |
| | | onHide(()=>{ |
| | | publicJob = reactive({ |
| | | id: 0, //招工Id |
| | | orderUserId: '', //招工用户id |
| | | orderName: '', //招工名称 |
| | | wordStartTime: '', //工作开始日期 |
| | | wordEndTime: '', //工作结束日期 |
| | | startTime: `${$util.formatDate(new Date())}T08:00:00.000`, //工作开始时间 |
| | | endTime: `${$util.formatDate(new Date())}T18:00:00.000`, //工作结束时间 |
| | | demand: '', //需求 |
| | | zixinganpai: false, //自行安排时间 |
| | | worderCount: 1, //招工人数 |
| | | worderAddress: '', //工作地点 |
| | | contactPhone: '', //联系电话 |
| | | workerType: 0, //工作方式 0计时1计件 |
| | | workPrice: '', //工价 |
| | | }) |
| | | workDate.value = '' |
| | | }) |
| | | onMounted(() => { |
| | | formRef.value.setRules(rules); |
| | |
| | | let dateType = ref() |
| | | let minDate = $util.formatDate(new Date()) |
| | | let sDate = $util.formatDate(new Date(), null, 1) |
| | | let eDate = '结束日期' |
| | | let longitude = ref(0) |
| | | let latitude = ref(0) |
| | | let workDate = ref('') |
| | |
| | | const store = useStore() |
| | | let datePickerShow = ref(false) |
| | | let isLoading = ref(false) |
| | | const publicJob = reactive({ |
| | | let editItem = null |
| | | let publicJob = reactive({ |
| | | id: 0, //招工Id |
| | | orderUserId: '', //招工用户id |
| | | orderName: '', //招工名称 |
| | | wordStartTime: '', //工作开始日期 |
| | | wordEndTime: '', //工作结束日期 |
| | | StartTime: `${$util.formatDate(new Date())}T08:00:00.000`, //工作开始时间 |
| | | EndTime: `${$util.formatDate(new Date())}T18:00:00.000`, //工作结束时间 |
| | | startTime: `${$util.formatDate(new Date())}T08:00:00.000`, //工作开始时间 |
| | | endTime: `${$util.formatDate(new Date())}T18:00:00.000`, //工作结束时间 |
| | | demand: '', //需求 |
| | | zixinganpai: false, //自行安排时间 |
| | | worderCount: 1, //招工人数 |
| | | worderAddress: '', //工作地点 |
| | | contactPhone: '', //联系电话 |
| | |
| | | const style = ref('time') |
| | | const changStyle = (val) => { |
| | | publicJob.workerType = val |
| | | if (val == 0) { |
| | | publicJob.zixinganpai = false |
| | | } |
| | | } |
| | | const clickTime = (type) => { |
| | | dateType.value = type |
| | |
| | | } |
| | | } |
| | | const saveOrder = () => { |
| | | console.log(publicJob, 'publicJob', !publicJob.wordStartTime); |
| | | console.log(publicJob, 'publicJob', publicJob.workPrice); |
| | | formRef.value.validate().then(res => { |
| | | isLoading.value = true |
| | | let time = publicJob.wordStartTime |
| | | publicJob.wordStartTime = new Date(publicJob.wordStartTime) |
| | | $api.saveOrder(publicJob).then(res => { |
| | | if (res.code == 1) { |
| | | if (editItem) { |
| | | uni.navigateBack() |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: '/pages/order/order' |
| | | }) |
| | | } |
| | | $util.showToast({ |
| | | title: "保存成功!", |
| | | title: editItem?'修改成功!':"保存成功!", |
| | | icon: "success" |
| | | }) |
| | | uni.redirectTo({ |
| | | url: '/pages/order/order' |
| | | }) |
| | | } else { |
| | | publicJob.wordStartTime = time |
| | | $util.showToast({ |
| | | title: res.msg |
| | | title: res.error |
| | | }) |
| | | } |
| | | isLoading.value = false |