-
zhangwei
2024-08-23 e6dccb3b16847f4bda31f305113070596677caff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<template>
    <view class="full-page c-m-b-40">
        <view class="list c-p-t-10">
            <up-form labelPosition="left" :model="publicJob" ref="form1" labelWidth='160rpx'>
                <view class="content c-p-10 c-p-l-24 c-m-t-10 c-m-b-20">
                    <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-10 c-p-l-24 c-m-t-10 c-m-b-20">
                    <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-10 c-p-l-24 c-m-t-10 c-m-b-20">
                    <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-10 c-p-l-24 c-m-t-10 c-m-b-20">
                    <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-10 c-p-l-24 c-m-t-10 c-m-b-20">
                    <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-10 c-p-l-24 c-m-t-10 c-m-b-20">
                    <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 = data.id
        }
    })
    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>