You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1274 lines
36 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="p-root-home-jobForm g_kuaishou">
<form class="" ref="formInfo">
<view class="">
<view class="g_flex_row_start g_mb_8 g_pl_10">
职位名称
<view class="xing g_c_fa2b"> * </view>
</view>
<view class="g_flex_row_start flex_center g_bg_f g_h_44 g_pl_10 g_radius_8">
<u-input height="22" v-model="formInfo.jobName" class="weui-input" style="width: 97%" placeholder="请输入职位名称" placeholder-style="color:#999" />
</view>
</view>
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10">
员工薪资
<view class="xing g_c_fa2b"> * </view>
</view>
<view class="showdoc g_flex_row_start g_clear_scroll g_pb_12">
<view class="g_flex_row_start_none menu-obj">
<view v-for="(item, index) in staffPrice.list" :key="item.id" class="menu-btn g_flex_column_center" :class="formInfo.salaryClassify == item.id ? 'menu-active' : ''" @click="changeSex(item, 'staffPrice')">
<view class="btn g_radius_4 g_pl_8 g_pr_8 g_pt_4 g_pb_4 g_fs_12">{{ item.text }}</view>
</view>
</view>
</view>
<view class="g_flex_row_around flex_center g_h_44 g_bg_f g_pl_10 g_pr_10 g_radius_8" v-if="formInfo.salaryClassify != 4 && formInfo.salaryClassify != 6 && formInfo.salaryClassify != 7">
<!-- <view class="g_mr_16">
{{staffPrice.list[formInfo.salaryClassify].pre}}
</view> -->
<u-input height="22" v-model="formInfo.salaryClassifyValue" @input="handlerPrice" type="digit" class="weui-input g_flex_1" :placeholder="currentPrice.placeholder" placeholder-style="color:#999" />
<view class="">
{{ currentPrice.suffix }}
</view>
</view>
<view class="g_flex_row_start flex_center g_h_44 g_bg_f g_pl_10 g_pr_10 g_radius_8" v-else>
<view class="g_mr_16" v-if="formInfo.salaryClassify == 4 || formInfo.salaryClassify == 6">
{{ currentPrice.pre }}
</view>
<u-input height="22" v-model="monthValue" v-if="formInfo.salaryClassify == 7" class="weui-input g_flex_1" :placeholder="currentPrice.placeholder" placeholder-style="color:#999" />
<view class="">
{{ currentPrice.suffix }}
</view>
</view>
</view>
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10">
性别年龄
<view class="xing g_c_fa2b"> * </view>
</view>
<view class="showdoc g_flex_row_start g_clear_scroll g_pb_12">
<view class="g_flex_row_start_none menu-obj">
<view v-for="(item, index) in ageSex.list" :key="index" class="menu-btn g_flex_column_center" :class="ageSex.ageSexActive == item.id ? 'menu-active' : ''" @click="changeSex(item, 'ageSex')">
<view class="btn g_radius_4 g_pl_8 g_pr_8 g_pt_4 g_pb_4 g_fs_12">{{ item.text }}</view>
</view>
</view>
</view>
<!-- v-if='ageSex.ageSexActive != 1' -->
<view class="g_flex_row_between flex_center g_h_44 g_bg_f g_pl_10 g_pr_10 g_radius_8" v-if="ageSex.ageSexActive != 1" @click="ageShow = true">
<!-- <view class="g_mr_16">
{{ageSex.list[ageSex.ageSexActive].text}}
</view> -->
<!-- <u-input height="22" v-model="ageHandler" class="weui-input g_flex_1" placeholder="如20-30" placeholder-style="color:#999" /> -->
<!-- <view :class="">选择年龄</view> -->
<picker mode="multiSelector" class="g_flex_1" @columnchange="handlerAge($event, 'man')" @cancel="cancelAge" @change="getAgeValue($event, 'all')" :value="ageValue" :range="ageList">
<view class="g_flex_row_between">
<view class="g_flex_1" :class="ageHandler ? 'g_c_3' : 'g_c_9'">{{ ageHandler || "请选择年龄" }}</view>
<view class="g_flex_none">岁</view>
</view>
</picker>
<!-- <view class=""> 岁 </view> -->
</view>
<view class="g_flex_row_around" v-else>
<view class="g_flex_row_around flex_center g_h_44 g_pl_10 g_pr_10 g_flex_1 g_bg_f g_mr_12 g_radius_8">
<view class=""> 男 </view>
<!-- <u-input height="22" v-model="manAgeHandler" class="weui-input g_pl_16 g_flex_1" placeholder="如20-30" placeholder-style="color:#999" /> -->
<picker mode="multiSelector" class="g_flex_1" @columnchange="handlerAge($event, 'man')" @cancel="cancelAge" @change="getAgeValue($event, 'man')" :value="ageValue" :range="ageList">
<view class="g_ml_6" :class="manAgeHandler ? 'g_c_3' : 'g_c_9'">{{ manAgeHandler || "请选择年龄" }}</view>
</picker>
<view class=""> 岁 </view>
</view>
<view class="g_flex_row_around flex_center g_h_44 g_pl_10 g_pr_10 g_bg_f g_flex_1 g_radius_8">
<view class=""> 女 </view>
<!-- <u-input height="22" v-model="womanAgeHandler" class="weui-input g_pl_16 g_flex_1" placeholder="如20-30" placeholder-style="color:#999" /> -->
<picker mode="multiSelector" class="g_flex_1" @columnchange="handlerAge($event, 'woman')" @cancel="cancelAge" @change="getAgeValue($event, 'woman')" :value="ageWomanValue" :range="ageList">
<view class="g_ml_6" :class="womanAgeHandler ? 'g_c_3' : 'g_c_9'">{{ womanAgeHandler || "请选择年龄" }}</view>
</picker>
<view class=""> </view>
</view>
</view>
</view>
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10"> 职位标签 </view>
<view class="g_flex_row_start flex_center g_bg_f g_h_44 g_pl_10 g_radius_8" @click="goTable">
<div class="weui-input g_flex_row_between" style="width: 97%; height: 21px; color: #999; background-color: #fff">
<div class="g_flex_column_center">请添加职位标签</div>
<div class="g_flex_column_center">
<i class="iconfont icon-gengduo11 g_c_9"></i>
</div>
</div>
</view>
</view>
<view class="g_mt_16" v-if="false">
<view class="g_flex_row_start g_mb_8 g_pl_10"> 驻场信息 </view>
<view class="g_flex_row_start flex_center g_h_44 g_pl_10 g_pr_10 g_flex_1 g_bg_f g_radius_8" @click="handleOpenModal">
<view class="g_flex_row_start" v-if="selectedOnsite.length > 0">
<view class="onsiteSub" v-for="(item, index) in selectedOnsite" @click.stop="delSelectedOnsite(index, item)" :key="item.id">
<view class="g_flex_row_start flex_center">
{{ item.userName }}
<i class="iconfont icon-guanbi g_fsi_6 g_ml_10"></i>
</view>
</view>
</view>
<view class="g_c_9 g_fs_15" v-else> 请选择驻场信息 </view>
</view>
</view>
<!-- 隐藏字段容器 -->
<view class="" v-if="false" hover-class="none" hover-stop-propagation="false">
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10">
招聘企业
<view class="xing g_c_fa2b"> * </view>
</view>
<view class="g_flex_row_start flex_center g_h_44 g_bg_f g_pl_10 g_radius_8">
<u-input height="22" v-model="formInfo.storeName" class="weui-input" style="width: 97%" placeholder="请输入企业名称" placeholder-style="color:#999" />
</view>
</view>
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10">
企业地址
<view class="xing g_c_fa2b"> * </view>
</view>
<view class="g_flex_row_around flex_center g_h_44 g_bg_f g_pl_10 g_radius_8">
<!-- <u-input height="22" v-model="formInfo.storeAddr" :clearable="false" class="weui-input g_flex_1" @click="chooseAddress" placeholder="请选择企业地址" placeholder-style="color:#999" /> -->
<view class="g_flex_1" @click="chooseAddress" v-if="formInfo.storeAddr">{{ formInfo.storeAddr }}</view>
<view class="g_flex_1 g_c_9" @click="chooseAddress" v-else>请选择企业地址</view>
<view class="iconfont icon-dizhi1 g_fs_16 g_c_9 g_mr_16 g_ml_12" @click="chooseAddress"></view>
</view>
</view>
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10">
代理费
<view class="xing g_c_fa2b"> * </view>
</view>
<view class="showdoc g_flex_row_start g_clear_scroll g_pb_12">
<view class="g_flex_row_start_none menu-obj">
<view v-for="(item, index) in serviceFee.list" :key="item.id" class="menu-btn g_flex_column_center" :class="formInfo.returnFeeType == item.id ? 'menu-active' : ''" @click="changeSex(item, 'serviceFee')">
<view class="btn g_radius_4 g_pl_8 g_pr_8 g_pt_4 g_pb_4 g_fs_12">{{ item.text }}</view>
</view>
</view>
</view>
<view class="g_flex_row_around flex_center g_bg_f g_h_44 g_pl_10 g_pr_10 g_radius_8" v-if="formInfo.returnFeeType != 7">
<!-- <view class="g_mr_16">
{{serviceFee.list[formInfo.returnFeeType].pre}}
</view> -->
<u-input height="22" v-model="formInfo.returnFee" type="digit" class="g_flex_1 weui-input" placeholder="仅数字" placeholder-style="color:#999" />
<view class="">
{{ serviceFee.list[formInfo.returnFeeType].suffix }}
</view>
</view>
<view class="g_flex_row_start flex_center g_bg_f g_h_44 g_pl_10 g_pr_10 g_radius_8" v-else>
<view class="g_mr_16">
{{ serviceFee.list[formInfo.returnFeeType].pre }}
</view>
</view>
</view>
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10">
代理费详情
<view class="xing g_c_fa2b"> * </view>
</view>
<view class="g_flex_row_around flex_center g_bg_f g_pl_10 g_pr_10 g_radius_8">
<u-input v-model="formInfo.returnFeeDesp" type="textarea" class="g_flex_1 weui-input" placeholder="请输入代理费详情" placeholder-style="color:#999" :clearable="false" />
</view>
</view>
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10">
政策模式
<view class="xing g_c_fa2b"> * </view>
</view>
<view class="g_flex_row_around flex_center g_h_44 g_bg_f g_pl_10 g_radius_8">
<view class="g_flex_1" @click="uploadZhengce">政策一</view>
<view class="iconfont icon-gengduo11 g_fs_16 g_c_9 g_mr_16 g_ml_12" @click="uploadZhengce"></view>
</view>
</view>
</view>
<view class="g_mt_16">
<view class="g_flex_row_start g_mb_8 g_pl_10"> 职位描述 </view>
<view class="g_bg_f g_pt_16 g_pb_16 g_pl_10 g_radius_8">
<textarea class="weui-input" bindinput="bothwayBind" data-type="desp" v-model="formInfo.jobInfo" placeholder="请描述薪资、岗位、吃住等" placeholder-style="color:#999" :maxlength="-1" auto-height style="min-height: 137px; width: 100%"></textarea>
<view class="g_flex_row_start g_mt_12">
<view class="g_mr_12 g_mb_12" v-for="(item, index) in imgList" :key="index" style="position: relative">
<i class="iconfont icon-guanbi img-close" @click="delImg(item.url)"></i>
<image :src="item.url" mode="" class="g_w_56 g_h_56 g_radius_6" @click="showImgs(item.url)" v-if="item.type == 'image'"></image>
<view class="g_w_56 g_h_56 g_radius_4 videoContainer" style="overflow: hidden" @click="showVideo(item)" v-else>
<video class="theVideo" :show-fullscreen-btn="false" :show-play-btn="false" :show-center-play-btn="false" :enable-play-gesture="true" :id="item.id" :src="item.url" @fullscreenchange="fullScreen"></video>
</view>
</view>
<view class="g_w_56 g_h_56 g_bg_e g_text_c g_flex_column_center g_radius_6" @click="chooseMedia">
<i class="iconfont icon-tianjia g_mb_8 g_c_6"></i>
<view class="g_fs_10 g_c_6"> 添加图片 </view>
</view>
</view>
</view>
</view>
<view class="g_h_100"></view>
<g-panel-fixed>
<slot>
<view class="g_flex_row_between g_pl_12 g_pr_12">
<view @click.stop="onSubmit" class="g_ml_24" style="flex: 3">
<g-button size="height" type="primary" :btnText="jobId ? '确定' : '发布职位'"></g-button>
</view>
</view>
</slot>
</g-panel-fixed>
</form>
<u-popup v-model="isOnsiteShow" mode="bottom" border-radius="16" height="1000" :mask-close-able="true">
<view class="g_fs_18 g_c_3 g_flex_row_center g_pt_16"> 选择驻场 </view>
<scroll-view scroll-y="true" style="height: 710rpx">
<view class="g_pl_12 g_pr_12">
<view class="g_flex_row_between g_pt_16 g_pb_16 g_border_d_b" v-for="(item, index) in residentList" :key="index" @click="handleChooseResident(item, index)">
<view class="g_fs_17 g_c_3">{{ item.userName }}</view>
<view class="g_flex_column_center">
<i
class="iconfont icon-a-duigoubeifen2"
style="font-size: 18px"
:style="{
color: item.isSelected ? '#00b666' : '#fff',
}"
></i>
</view>
</view>
</view>
</scroll-view>
<view class="g_flex_row_center g_mt_40 g_pb_16">
<view class="g_w_260 g_h_42 g_radius_25 g_bg_main g_c_f g_flex_c g_fs_18" @click="submitRes">确定</view>
</view>
</u-popup>
<u-popup v-model="zhengceModal.isShow" mode="bottom" border-radius="16" height="980" :mask-close-able="true">
<view class="g_fs_18 g_c_3 g_flex_row_center g_pt_16"> 选择政策 </view>
<scroll-view scroll-y="true" style="height: 710rpx">
<view class="g_pl_12 g_pr_12">
<view class="g_flex_row_between g_pt_16 g_pb_16 g_border_d_b" v-for="(item, index) in zhengceList" :key="index" @click="handleChooseZhengce(item, index)">
<view class="g_fs_17 g_c_3">{{ item.name }}</view>
<view class="g_flex_column_center">
<i
class="iconfont icon-a-duigoubeifen2"
style="font-size: 24px"
:style="{
color: item.isSelected ? '#00b666' : '#fff',
}"
></i>
</view>
</view>
</view>
</scroll-view>
<g-panel-fixed>
<slot>
<view class="g_flex_row_center">
<g-button btnText="确定" type="primary" @clickBtn="submitZhengce" />
</view>
</slot>
</g-panel-fixed>
</u-popup>
</view>
</template>
<script>
export default {
onReady() {
this.G.setNavStyle();
},
onShow() {
this.getResident();
},
onShareAppMessage() {
return this.G.shareFun();
},
// 组件名称
name: "",
// 局部注册的组件
components: {},
// 组件参数 接收来自父组件的数据
props: {},
// 组件状态值
data() {
return {
appId: uni.getAccountInfoSync().miniProgram.appId,
formInfo: {
jobName: "",
returnFeeType: 0,
salaryClassify: 0,
},
ageShow: false, //
ageValue: [0, 44],
ageWomanValue: [0, 44],
imgList: [], // 上传图片的列表
serviceFee: {
// 服务费类型
list: [
{
id: 0,
text: "按小时",
pre: "按时",
suffix: "元/小时",
},
{
id: 1,
text: "按天数",
pre: "按天",
suffix: "元/天",
},
{
id: 2,
text: "按月数",
pre: "按月",
suffix: "元/月",
},
{
id: 3,
text: "按次数",
pre: "按次",
suffix: "元/次",
},
{
id: 4,
text: "按件数",
pre: "按件",
suffix: "元/件",
},
{
id: 5,
text: "工人收入",
pre: "工人收入",
suffix: "%",
},
{
id: 6,
text: "共计",
pre: "共计",
suffix: "元",
},
{
id: 7,
text: "待定",
pre: "待定",
suffix: "待定",
},
],
},
staffPrice: {
// 薪资类型
list: [
{
id: 0,
text: "时薪",
placeholder: "仅数字",
pre: "时薪",
suffix: "元/小时",
},
{
id: 1,
text: "日薪",
placeholder: "仅数字",
pre: "日薪",
suffix: "元/天",
},
{
id: 7,
text: "月薪",
placeholder: "如3000-5000",
pre: "月薪",
suffix: "元/月",
},
{
id: 2,
text: "补贴",
placeholder: "仅数字",
pre: "补贴",
suffix: "元",
},
{
id: 3,
text: "返费",
placeholder: "仅数字",
pre: "返费",
suffix: "元",
},
{
id: 4,
text: "计件",
placeholder: "",
pre: "计件",
suffix: "",
},
{
id: 5,
text: "保底",
placeholder: "仅数字",
pre: "保底",
suffix: "元",
},
{
id: 6,
text: "面议",
placeholder: "",
pre: "面议",
suffix: "",
},
],
},
currentPrice: {
id: 0,
text: "时薪",
placeholder: "仅数字",
pre: "时薪",
suffix: "元/小时",
},
ageSex: {
// 性别年龄类型
list: [
{
id: 0,
text: "男女不限",
},
{
id: 1,
text: "男女不同",
},
{
id: 2,
text: "仅限男生",
},
{
id: 3,
text: "仅限女生",
},
],
ageSexActive: 0,
},
ageHandler: "",
manAgeHandler: "",
womanAgeHandler: "",
monthValue: "",
jobId: "",
residentList: [],
isOnsiteShow: false,
selectedOnsite: [],
zhengceModal: {
isShow: false,
},
zhengceList: [
{
name: "政策一",
id: 1,
isSelected: false,
},
{
name: "政策二",
id: 2,
isSelected: false,
},
{
name: "政策三",
id: 3,
isSelected: false,
},
{
name: "政策四",
id: 4,
isSelected: false,
},
{
name: "政策五",
id: 5,
isSelected: false,
},
{
name: "政策六",
id: 6,
isSelected: false,
},
{
name: "政策七",
id: 7,
isSelected: false,
},
{
name: "政策八",
id: 8,
isSelected: false,
},
{
name: "政策九",
id: 9,
isSelected: false,
},
],
};
},
// 计算属性
computed: {
ageList() {
let val = [[], []];
for (let i = 0; i <= 60; i++) {
if (i >= 16) {
val[0].push(i);
val[1].push(i);
}
}
return val;
},
},
// 侦听器
watch: {
"ageSex.ageSexActive"(val) {
if (val != 1) {
this.sexHandler(this.ageHandler);
} else {
this.formInfo.minAgeWoman = "";
this.formInfo.maxAgeWoman = "";
this.formInfo.minAgeMan = "";
this.formInfo.maxAgeMan = "";
this.sexHandler(this.manAgeHandler, this.womanAgeHandler, "all");
}
},
"formInfo.salaryClassify"(val) {
console.log("formInfo.salaryClassify", val);
// this.formInfo.salaryClassifyValue = ''
this.priceHandler(this.formInfo.salaryClassifyValue);
},
monthValue(val) {
if (val != "") {
this.priceHandler(val);
}
},
ageHandler(val) {
this.sexHandler(val);
},
manAgeHandler(val) {
this.sexHandler(val, "", "man");
},
womanAgeHandler(val) {
// console.log(val)
this.sexHandler(val, "", "woman");
},
},
// 生命周期钩子 注:没用到的钩子请自行删除
/**
* 组件实例创建完成属性已绑定但DOM还未生成$ el属性还不存在
*/
created() {},
onLoad(options) {
console.log(options);
if (options.id) {
uni.setNavigationBarTitle({
title: "编辑职位",
});
this.jobId = options.id;
this.getJobDetail();
} else {
uni.setNavigationBarTitle({
title: "新增职位",
});
}
},
/**
* el 被新创建的 vm.el 替换,并挂载到实例上去之后调用该钩子。
* 如果 root 实例挂载了一个文档内元素,当 mounted 被调用时 vm.el 也在文档内。
*/
mounted() {},
// 组件方法
methods: {
// 性别年龄特殊处理
sexHandler(val, val1, type) {
if (this.ageSex.ageSexActive == 0) {
let ageObj = this.G.specStrReg(val);
this.formInfo.minAgeWoman = ageObj.min;
this.formInfo.maxAgeWoman = ageObj.max;
this.formInfo.minAgeMan = ageObj.min;
this.formInfo.maxAgeMan = ageObj.max;
} else if (this.ageSex.ageSexActive == 1) {
let ageObj = this.G.specStrReg(val);
if (type == "man") {
this.formInfo.minAgeMan = ageObj.min;
this.formInfo.maxAgeMan = ageObj.max;
} else if (type == "woman") {
this.formInfo.minAgeWoman = ageObj.min;
this.formInfo.maxAgeWoman = ageObj.max;
} else if (type == "all") {
let ageObj1 = this.G.specStrReg(val1);
this.formInfo.minAgeMan = ageObj.min;
this.formInfo.maxAgeMan = ageObj.max;
this.formInfo.minAgeWoman = ageObj1.min;
this.formInfo.maxAgeWoman = ageObj1.max;
}
console.log(this.formInfo);
} else if (this.ageSex.ageSexActive == 2) {
let ageObj = this.G.specStrReg(val);
this.formInfo.minAgeWoman = 0;
this.formInfo.maxAgeWoman = 0;
this.formInfo.minAgeMan = ageObj.min;
this.formInfo.maxAgeMan = ageObj.max;
} else if (this.ageSex.ageSexActive == 3) {
let ageObj = this.G.specStrReg(val);
this.formInfo.minAgeMan = 0;
this.formInfo.maxAgeMan = 0;
this.formInfo.minAgeWoman = ageObj.min;
this.formInfo.maxAgeWoman = ageObj.max;
}
console.log(this.formInfo);
},
/**
* 年龄选择的回调
*/
getAgeValue(e, type) {
console.log(e, type);
let val;
val = this.ageList[0][e.detail.value[0]] + "-" + this.ageList[1][e.detail.value[1]];
console.log(val);
if (type == "all") {
this.manAgeHandler = "";
this.womanAgeHandler = "";
this.ageHandler = val;
} else if (type == "man") {
this.ageHandler = "";
this.manAgeHandler = val;
} else if (type == "woman") {
this.ageHandler = "";
this.womanAgeHandler = val;
}
},
/**
* 选择列变化回调(最大最小年龄联动)
*/
handlerAge(e, type) {
console.log(e, type);
// e: { column: 1,index: 41}
if (type == "woman") {
this.ageWomanValue[e.detail.column] = e.detail.value;
if (e.detail.column == 0) {
if (e.detail.value > this.ageWomanValue[1]) {
this.ageWomanValue[1] = e.detail.value;
}
} else {
if (e.detail.value < this.ageWomanValue[0]) {
this.ageWomanValue[0] = e.detail.value;
}
}
} else {
this.ageValue[e.detail.column] = e.detail.value;
if (e.detail.column == 0) {
if (e.detail.value > this.ageValue[1]) {
this.ageValue[1] = e.detail.value;
}
} else {
if (e.detail.value < this.ageValue[0]) {
this.ageValue[0] = e.detail.value;
}
}
}
this.$forceUpdate();
console.log(this.ageValue);
},
// 年龄选择取消事件
cancelAge(e) {
console.log("cancel", e);
},
// 薪资输入的监听
handlerPrice(e) {
console.log(e);
},
// 薪资的特殊处理
priceHandler(val) {
console.log("val", val);
this.formInfo.minMonthlyPay = "";
this.formInfo.maxMonthlyPay = "";
if (this.formInfo.salaryClassify == 7) {
let ageObj = this.G.specStrReg(val);
console.log("ageObj", ageObj);
this.formInfo.minMonthlyPay = ageObj.min * 100;
this.formInfo.maxMonthlyPay = ageObj.max * 100;
this.formInfo.salaryClassifyValue = "";
} else if (this.formInfo.salaryClassify == 4) {
this.formInfo.salaryClassifyValue = "";
this.monthValue = "";
} else if (this.formInfo.salaryClassify == 6) {
this.formInfo.salaryClassifyValue = "";
this.monthValue = "";
}
console.log(this.formInfo);
},
// 新增职位的提交
onSubmit(e) {
console.log(e);
let that = this;
let newImg = [];
that.imgList.forEach((item) => {
newImg.push(item.url);
});
let onloadInfo = {
...this.formInfo,
jobInfoYuQue: this.formInfo.jobInfo,
imgs: newImg.join(","),
};
console.log(this.formInfo);
if (!this.formInfo.jobName) {
uni.showToast({
title: "请输入职位名称",
icon: "none",
});
return;
}
// if (this.formInfo.returnFeeType != 7 && !this.formInfo.returnFee) {
// uni.showToast({
// title: "请输入代理费信息",
// icon: "none",
// });
// return;
// } else {
// onloadInfo.returnFee = Number(this.formInfo.returnFee).toFixed(2) * 100;
// }
let priceWatch = false;
if (onloadInfo.salaryClassify != 4 && onloadInfo.salaryClassify != 6) {
if (this.formInfo.salaryClassifyValue === "" && !this.formInfo.minMonthlyPay) {
uni.showToast({
title: "请输入薪资信息",
icon: "none",
});
priceWatch = true;
} else {
priceWatch = false;
onloadInfo.salaryClassifyValue = Number(this.formInfo.salaryClassifyValue).toFixed(2) * 100;
}
}
if (priceWatch) {
return;
}
if (!this.formInfo.minAgeMan && !this.formInfo.maxAgeMan && !this.formInfo.minAgeWoman && !this.formInfo.maxAgeWoman) {
uni.showToast({
title: "请输入年龄信息",
icon: "none",
});
return;
}
// if (!this.formInfo.storeName) {
// uni.showToast({
// title: "请输入企业名称",
// icon: "none",
// });
// return;
// }
// if (!this.formInfo.storeLat) {
// uni.showToast({
// title: "请通过地图选择企业地址",
// icon: "none",
// });
// return;
// }
// console.log(this.formInfo.salaryClassifyValue.toFix())
if (onloadInfo.salaryClassifyValue >= 10000000) {
uni.showToast({
title: "请输入少于10万的薪资",
icon: "none",
});
return;
}
// if (onloadInfo.returnFee >= 10000000) {
// uni.showToast({
// title: "请输入少于10万的代理费",
// icon: "none",
// });
// return;
// }
let newArr = [this.formInfo.minAgeMan, this.formInfo.maxAgeMan, this.formInfo.minAgeWoman, this.formInfo.maxAgeWoman];
newArr.sort();
console.log("newArr", newArr);
onloadInfo.minAge = newArr[0] == 0 ? newArr[2] : newArr[0];
onloadInfo.maxAge = newArr[3];
let onsite = [];
this.selectedOnsite.forEach((item) => {
onsite.push(item.id);
});
onloadInfo.onSiteUserIds = onsite.join(",");
console.log("onloadInfo", onloadInfo);
// return
if (this.jobId) {
onloadInfo.recordId = this.jobId;
that.G.handleConfirm(
"发布后,您的下游可直接查看您发布的职位",
() => {
that.G.Post(that.api.job_updateJob, onloadInfo, (res) => {
uni.navigateBack({
delta: -1,
});
});
},
() => {},
"发布职位"
);
} else {
that.G.handleConfirm(
"发布后,您的下游可直接查看您发布的职位",
() => {
that.G.Post(that.api.job_addJob, onloadInfo, (res) => {
uni.navigateBack({
delta: -1,
});
});
},
() => {},
"发布职位"
);
}
},
// 年龄, 服务费, 薪资, 类型变化
changeSex(e, type) {
let that = this;
console.log(e);
if (type == "ageSex") {
this.ageSex.ageSexActive = e.id;
} else if (type == "serviceFee") {
this.formInfo.returnFeeType = e.id;
} else if (type == "staffPrice") {
this.formInfo.salaryClassify = e.id;
this.currentPrice = this.staffPrice.list[this.staffPrice.list.findIndex((item) => item.id == e.id)];
}
// ageSex.ageSexActive = item.id
},
// 地址选择的回调
chooseAddress() {
let that = this;
console.log("chooseAddress");
uni.chooseLocation({
success(e) {
console.log(e);
var reg = /.+?(省|市|自治区|自治州|县|区)/g; // 省市区的正则
let arr = e.address.match(reg);
that.formInfo.storeDistrict = [arr[0], arr[1]].join(",");
that.formInfo.storeAddr = e.name;
that.formInfo.storeLat = e.latitude;
that.formInfo.storeLng = e.longitude;
that.$forceUpdate();
},
fail(e) {
console.log("err", e);
},
});
},
// 编辑职位获取信息
getJobDetail() {
let that = this;
that.G.Get(that.api.job_personDetail + "/" + this.jobId, "", (res) => {
console.log(res);
if (res.salaryClassify == 7 && res.minMonthlyPay != "") {
that.monthValue = res.minMonthlyPay / 100 + "-" + res.maxMonthlyPay / 100;
} else if (res.salaryClassify == 4) {
res.salaryClassifyValue = 0;
} else if (res.salaryClassify == 6) {
res.salaryClassifyValue = 0;
} else {
res.salaryClassifyValue = res.salaryClassifyValue / 100;
}
that.currentPrice = that.staffPrice.list[that.staffPrice.list.findIndex((item) => item.id == res.salaryClassify)];
let img = [];
res.imgs.forEach((item, index) => {
let obj = {};
console.log(item);
if (item.url.indexOf(".mp4") > -1) {
obj.type = "video";
} else {
obj.type = "image";
}
obj.url = item.url;
obj.id = index;
img.push(obj);
});
that.imgList = img;
console.log("that.imgList", that.imgList);
if (res.returnFeeType != 7) {
res.returnFee = res.returnFee / 100;
}
console.log("that.ageList", that.ageList);
console.log(that.ageList[0].indexOf(res.minAgeWoman));
if (Boolean(res.minAgeWoman) === true && Boolean(res.minAgeMan) === false) {
// 女 4
that.ageSex.ageSexActive = 3;
that.ageHandler = res.minAgeWoman + "-" + res.maxAgeWoman;
that.ageValue[0] = that.ageList[0].indexOf(res.minAgeWoman);
that.ageValue[1] = that.ageList[0].indexOf(res.maxAgeWoman);
} else if (Boolean(res.minAgeWoman) === false && Boolean(res.minAgeMan) === true) {
// 男 3
that.ageSex.ageSexActive = 2;
that.ageHandler = res.minAgeMan + "-" + res.maxAgeMan;
that.ageValue[0] = that.ageList[0].indexOf(res.minAgeMan);
that.ageValue[1] = that.ageList[0].indexOf(res.maxAgeMan);
} else {
if (res.minAgeMan == res.minAgeWoman && res.maxAgeMan == res.maxAgeWoman) {
// 男女不限 1
that.ageSex.ageSexActive = 0;
that.ageHandler = res.minAgeMan + "-" + res.maxAgeMan;
that.ageValue[0] = that.ageList[0].indexOf(res.minAgeMan);
that.ageValue[1] = that.ageList[0].indexOf(res.maxAgeMan);
} else {
// 男女不同 2
that.ageSex.ageSexActive = 1;
that.womanAgeHandler = res.minAgeWoman + "-" + res.maxAgeWoman;
that.manAgeHandler = res.minAgeMan + "-" + res.maxAgeMan;
that.ageValue[0] = that.ageList[0].indexOf(res.minAgeMan);
that.ageValue[1] = that.ageList[0].indexOf(res.maxAgeMan);
// 女性年龄选择列表单独处理
that.ageWomanValue[0] = that.ageList[0].indexOf(res.minAgeWoman);
that.ageWomanValue[1] = that.ageList[0].indexOf(res.maxAgeWoman);
}
}
that.selectedOnsite = res.onSiteUsers;
that.residentList.forEach((item) => {
res.onSiteUsers.forEach((item1) => {
if (item.id == item1.id) {
item.isSelected = true;
}
});
});
that.formInfo = {
...res,
};
console.log("that.formInfo", that.formInfo);
});
},
// 驻场上拉框的选择
handleChooseResident($item, $index) {
let that = this;
that.residentList.forEach((item, index) => {
if (index == $index) {
if (item.isSelected) {
item.isSelected = false;
} else {
item.isSelected = true;
}
}
});
},
// 打开驻场上拉框
handleOpenModal() {
let that = this;
// 处理回显
// let ids = that.orderDetail.onSiteUsers.length == 0 ? '' : that.orderDetail.onSiteUsers.map(item => {
// return item.userId;
// }).join(',');
// that.residentList.filter(item => {
// return ids.indexOf(item.userId) > -1
// }).forEach((item,index) => {
// item.isSelected = true;
// })
that.isOnsiteShow = true;
},
// 获取驻场列表
getResident() {
let that = this;
that.G.Post(
that.api.order_residentList,
{
agencyId: uni.getStorageSync("apply-agencyId"),
keys: "",
pageNum: 1,
pageSize: 1000,
},
(res) => {
console.log("驻场列表:", res);
if (res.recordCount == 0) {
that.residentList = [];
} else {
res.recordList.forEach((item) => {
item.isSelected = false;
});
that.residentList = res.recordList;
}
}
);
},
delSelectedOnsite(ind, i) {
this.selectedOnsite.splice(ind, 1);
this.residentList.forEach((item) => {
if (item.id == i.id) {
item.isSelected = false;
}
});
},
// 上传媒体文件
chooseMedia() {
let that = this;
that.G.uploadMedia((res) => {
console.log(res);
if (res.status == "上传成功") {
let newArr = [];
res.imgList.forEach((item, index) => {
let obj = {};
if (item.indexOf(".mp4") > -1) {
obj.type = "video";
} else {
obj.type = "image";
}
obj.url = item;
obj.id = that.imgList.length == 0 ? index : that.imgList[that.imgList.length - 1].id + 1 + index;
newArr.push(obj);
});
if (that.imgList.length != 0) {
that.imgList = that.imgList.concat(newArr);
} else {
that.imgList = newArr;
}
console.log(that.imgList);
uni.showToast({
title: "上传成功",
icon: "success",
});
}
uni.hideLoading();
});
},
delImg(e) {
this.imgList.splice(
this.imgList.findIndex((item) => e == item),
1
);
console.log(e);
},
// 显示
showImgs(e) {
var that = this;
console.log(e);
console.log(that.imgList);
let curr = [];
that.imgList.forEach((item) => {
curr.push(item.url);
});
console.log(curr);
uni.previewImage({
current: e, // 当前显示图片的 http 链接
urls: curr, // 需要预览的图片 http 链接列表
});
},
// 显示视频
showVideo(e) {
console.log(e);
var that = this;
this.videoContext = uni.createVideoContext(`${e.id}`, this);
this.videoContext.requestFullScreen();
this.videoContext.hideStatusBar();
this.videoContext.play();
},
fullScreen(e) {
console.log(e);
if (!e.detail.fullScreen) {
this.videoContext.stop();
}
},
submitRes() {
let that = this;
let selectedOnsite = [];
selectedOnsite = that.residentList.filter((item) => {
return item.isSelected;
});
if (selectedOnsite.length == 0) {
uni.showToast({
title: "最少选择一个驻场人员",
icon: "none",
});
return false;
}
if (selectedOnsite.length > 3) {
uni.showToast({
title: "最多选择3个驻场人员",
icon: "none",
});
return false;
}
console.log(selectedOnsite);
this.isOnsiteShow = false;
this.selectedOnsite = selectedOnsite;
// that.G.Post(that.api.order_residentSubmit, {
// onSiteUserIds: ids.join(','),
// orderId: that.oid,
// }, () => {
// that.residentModal.isShow = false;
// uni.showToast({
// title: "修改成功",
// icon: 'success'
// })
// that.getDetail();
// });
},
// 更新政策
uploadZhengce() {
let that = this;
// 处理回显
let ids = "";
that.zhengceList
.filter((item) => {
return ids.indexOf(item.id) > -1;
})
.forEach((item, index) => {
item.isSelected = true;
});
that.zhengceModal.isShow = true;
},
handleChooseZhengce($item, $index) {
let that = this;
that.zhengceList.forEach((item, index) => {
if (index == $index) {
if (item.isSelected) {
item.isSelected = false;
} else {
item.isSelected = true;
}
} else {
item.isSelected = false;
}
});
},
submitZhengce() {
let that = this;
let ids = [];
ids = that.zhengceList
.filter((item) => {
return item.isSelected;
})
.map((item) => {
return item.id;
});
if (ids.length == 0) {
uni.showToast({
title: "请选择一个政策",
icon: "none",
});
return false;
}
// that.G.Post(
// that.api.order_residentSubmit,
// {
// onSiteUserIds: ids.join(","),
// orderId: that.oid,
// },
// () => {
that.zhengceModal.isShow = false;
uni.showToast({
title: "修改成功",
icon: "success",
});
// }
// );
},
goTable() {
uni.navigateTo({
url: "/root/merchantManagement/child/jobLabels",
});
},
},
};
</script>
<style lang="scss">
.p-root-home-jobForm {
background-color: #f5f5f5;
padding: 24px 10px;
font-size: 16px;
position: relative;
min-height: 100%;
.showdoc {
// box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 0 6px rgba(0, 0, 0, 0.02);
overflow-x: auto;
.menu-obj {
// min-width: 422px;
.menu-btn {
margin-right: 8px;
.btn {
background: rgba(204, 204, 204, 0.2);
border: 1rpx solid transparent;
color: #666666;
white-space: nowrap;
}
&:first-child {
margin-left: 12px;
}
}
.menu-active {
.btn {
background: rgba(53, 120, 246, 0.1);
border: 1rpx solid #3578f6;
color: #3578f6;
}
}
}
}
.bottom-btn {
position: fixed;
width: 100%;
bottom: 0;
left: 0;
background-color: #fff;
padding-top: 12px;
padding-bottom: constant(safe-area-inset-bottom); /* IOS<11.2*/
padding-bottom: env(safe-area-inset-bottom); /* IOS>11.2*/
// padding: 16px 0;
min-height: 72px;
border-top: 1rpx solid #eee;
}
.u-input__input {
font-size: 16px !important;
}
.onsiteSub {
padding-left: 8px;
padding-right: 8px;
margin-right: 8px;
height: 24px;
background: rgba(0, 182, 102, 0.05);
border: 1px solid #00b666;
border-radius: 4px;
color: #00b666;
}
.input-close {
// position: absolute;
// width: 18px;
// height: 18px;
// right: 7px;
// top: 2px;
// z-index: 99;
// background-color: #ccc;
// color: #fff;
// font-size: 8px;
// text-align: center;
// line-height: 18px;
// border-radius: 50%;
}
.img-close {
position: absolute;
width: 18px;
height: 18px;
right: -6px;
top: -6px;
z-index: 99;
background-color: #ccc;
color: #fff;
font-size: 8px;
text-align: center;
line-height: 18px;
border-radius: 50%;
}
}
</style>