用工小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

425 lines
12 KiB

7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
7 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
7 months ago
4 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
7 months ago
4 months ago
7 months ago
  1. <template>
  2. <view>
  3. <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" labelWidth="80">
  4. <view class="se-p-20">
  5. <view class="se-px-20 se-bgc-white se-br-10 se-fs-20">
  6. <u-form-item labelWidth="0">
  7. <view class="se-flex se-flex-ai-c">
  8. <view class="line-orange"></view>
  9. <view class="se-ml-10 se-fs-32 se-c-black se-fw-6">
  10. 标题
  11. </view>
  12. </view>
  13. </u-form-item>
  14. <u-form-item labelWidth="0" prop="title">
  15. <u--input v-model="form.title" placeholder="请在此输入标题"></u--input>
  16. </u-form-item>
  17. <u-form-item label="工作地点" prop="area" @click="handleAreaChange">
  18. <u--input @click="handleAreaChange" readonly v-model="form.area" placeholder="请选择工作地点"
  19. border="none"></u--input>
  20. <u-icon @click="handleAreaChange" slot="right" name="arrow-right"></u-icon>
  21. </u-form-item>
  22. <!-- <u-form-item label="详细地址" prop="address">
  23. <u--textarea v-model="form.address" count
  24. placeholder="请输入详细地址"></u--textarea>
  25. </u-form-item> -->
  26. <u-form-item label="所属行业" prop="industryName" @click="handleindustryChange">
  27. <u--input @click="handleindustryChange" readonly v-model="form.industryName" placeholder="请选择行业"
  28. border="none"></u--input>
  29. <u-icon @click="handleindustryChange" slot="right" name="arrow-right"></u-icon>
  30. </u-form-item>
  31. <u-form-item label="所属工种" prop="typeId" @click="handleTypeChange">
  32. <u--input @click="handleTypeChange" v-model="form.typeName" readonly placeholder="请选择工种"
  33. border="none"></u--input>
  34. <u-icon @click="handleTypeChange" slot="right" name="arrow-right"></u-icon>
  35. </u-form-item>
  36. <u-form-item label="期望月薪" prop="salary">
  37. <view class="se-flex se-flex-h-c">
  38. <u--input v-model="form.salaryMin" class="se-w-200" placeholder="最小值"></u--input>
  39. <text class="se-mx-10">~</text>
  40. <u--input v-model="form.salaryMax" class="se-w-200" placeholder="最大值"></u--input>
  41. </view>
  42. </u-form-item>
  43. <u-form-item label="期望日薪" prop="dayMoney">
  44. <u--input v-model="form.dayMoney" placeholder="期望日薪"></u--input>
  45. </u-form-item>
  46. <u-form-item label="结算方式" prop="settlement">
  47. <u-radio-group v-model="form.settlement" placement="row">
  48. <u-radio activeColor="#FF7A31" name="0" label="提前支付"></u-radio>
  49. <u-radio activeColor="#FF7A31" class="se-ml-20" name="1" label="试用以后支付"></u-radio>
  50. </u-radio-group>
  51. </u-form-item>
  52. <u-form-item label="开始时间" prop="dateMin" @click="showMinDate=true">
  53. <u--input v-model="form.dateMin" disabled placeholder="开始时间"></u--input>
  54. </u-form-item>
  55. <u-form-item label="结束时间" prop="dateMax" @click="showMaxDate=true">
  56. <u--input v-model="form.dateMax" disabled placeholder="结束时间"></u--input>
  57. </u-form-item>
  58. <u-form-item label="联系电话" prop="mobile">
  59. <u--input v-model="form.mobile" placeholder="请输入联系方式"></u--input>
  60. </u-form-item>
  61. <u-form-item label="工作内容" prop="introduce">
  62. <u--textarea v-model="form.introduce" count placeholder="请选择工作内容"></u--textarea>
  63. </u-form-item>
  64. </view>
  65. </view>
  66. <view class="se-p-20">
  67. <view class="se-px-20 se-pb-20 se-bgc-white se-br-10 se-fs-20">
  68. <u-form-item prop="fileList" labelWidth="2">
  69. <view class="se-flex se-flex-v-sa">
  70. <view class="se-py-20 se-w-p-100 se-flex">
  71. <view class="line-orange"></view>
  72. <view class="se-ml-10">
  73. 图片上传
  74. </view>
  75. </view>
  76. <view class="se-py-20 se-w-p-100">
  77. <u-upload :fileList="form.fileList" @afterRead="afterRead" @delete="deletePic" name="1"
  78. multiple :maxCount="10"></u-upload>
  79. </view>
  80. </view>
  81. </u-form-item>
  82. </view>
  83. </view>
  84. <view class="se-px-20 se-pt-20">
  85. <view class="se-px-20 se-pb-80 se-fs-20 se-flex">
  86. <view @click="submit"
  87. 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">
  88. <text>发布订单</text>
  89. </view>
  90. </view>
  91. </view>
  92. </u--form>
  93. <!-- 性别 -->
  94. <u-action-sheet :show="showIndustry" :actions="indList" title="请选择行业" @close="showIndustry = false"
  95. @select="industrySelect">
  96. </u-action-sheet>
  97. <!-- 种类 -->
  98. <u-action-sheet :show="showType" :actions="typeList" title="请选择种类" @close="showType = false"
  99. @select="typeSelect">
  100. </u-action-sheet>
  101. <!-- 地址 -->
  102. <citySelect v-model="showPicker" @city-change="handleCityChange"></citySelect>
  103. <!-- 时间 Min-->
  104. <u-datetime-picker :show="showMinDate" :value="form.dateMin" mode="datetime" closeOnClickOverlay
  105. @confirm="dateMinConfirm" @cancel="dateMinClose" @close="dateMinClose"></u-datetime-picker>
  106. <u-datetime-picker :show="showMaxDate" :value="form.dateMax" mode="datetime" closeOnClickOverlay
  107. @confirm="dateMaxConfirm" @cancel="dateMaxClose" @close="dateMaxClose"></u-datetime-picker>
  108. </view>
  109. </template>
  110. <script>
  111. import {
  112. addTask,
  113. industryList,
  114. industryById
  115. } from "@/common/api.js"
  116. import citySelect from '@/components/cityselect/index.vue'
  117. export default {
  118. components: {
  119. citySelect
  120. },
  121. data() {
  122. return {
  123. showMinDate: false,
  124. showMaxDate: false,
  125. showPicker: false,
  126. showIndustry: false,
  127. indList: [],
  128. industryList: [{
  129. name: '打铁',
  130. },
  131. {
  132. name: '打牌',
  133. }
  134. ],
  135. showType: false,
  136. typeList: [],
  137. form: {
  138. title: "宜佳营业员",
  139. area: '河北省-秦皇岛市-抚宁区',
  140. address: '',
  141. industryId: "1865294357074157570",
  142. industryName: "建筑",
  143. settlement: '0',
  144. date: "",
  145. dateMin: "2016-02-01 09:00:00",
  146. dateMax: "2016-12-05 18:00:00",
  147. mobile: '13189698114',
  148. typeId: '',
  149. typeName: "",
  150. salary: '',
  151. dayMoney: "300",
  152. salaryMin: '6000',
  153. salaryMax: '8000',
  154. introduce: '宜佳营业员,每天工作8个小时,上班轻松!',
  155. fileList: [{
  156. url: "https://tennis-oss.xzaiyp.top/2024-12-31/4b65131c-41f8-4714-a31e-491d08dfb8c4.jpg"
  157. }],
  158. latitude: '12.34',
  159. longitude: "146.74"
  160. },
  161. rules: {
  162. title: [{
  163. type: 'string',
  164. required: true,
  165. message: '请在此输入标题',
  166. trigger: ['blur', 'change']
  167. }],
  168. area: [{
  169. type: 'string',
  170. required: true,
  171. message: '请选择地址',
  172. trigger: ['blur', 'change']
  173. }],
  174. address: [{
  175. type: 'string',
  176. required: true,
  177. message: '请填写详细地址',
  178. trigger: ['blur', 'change']
  179. }],
  180. industryName: [{
  181. type: 'string',
  182. required: true,
  183. message: '请选择行业',
  184. trigger: ['blur', 'change']
  185. }],
  186. typeId: [{
  187. type: 'string',
  188. required: true,
  189. message: '请选择工种',
  190. trigger: ['blur', 'change']
  191. }],
  192. dayMoney: [{
  193. type: 'string',
  194. required: true,
  195. message: '期望日薪',
  196. trigger: ['blur', 'change']
  197. }],
  198. settlement: [{
  199. type: 'string',
  200. required: true,
  201. message: '请选择结算方式',
  202. trigger: ['blur', 'change']
  203. }],
  204. mobile: [{
  205. required: true,
  206. message: '请输入手机号',
  207. trigger: ['change', 'blur'],
  208. },
  209. {
  210. validator: (rule, value, callback) => {
  211. return uni.$u.test.mobile(value);
  212. },
  213. message: '手机号码不正确',
  214. trigger: ['change', 'blur'],
  215. },
  216. ],
  217. date: [{
  218. type: 'string',
  219. max: 1,
  220. required: true,
  221. message: '请填写时间',
  222. trigger: ['blur', 'change']
  223. }],
  224. salary: [{
  225. type: 'string',
  226. required: true,
  227. message: '请输入试用日薪',
  228. trigger: ['blur', 'change']
  229. }],
  230. introduce: [{
  231. type: 'string',
  232. required: true,
  233. message: '请输入工作内容',
  234. trigger: ['blur', 'change']
  235. }],
  236. fileList: [{
  237. validator: (rule, value, callback) => {
  238. if (value === null || value === undefined || value === '' || (Array.isArray(
  239. value) && value.length === 0)) {
  240. callback(new Error('照片不能为空'));
  241. } else {
  242. callback();
  243. }
  244. },
  245. trigger: 'blur'
  246. }],
  247. },
  248. }
  249. },
  250. watch: {
  251. 'form.salaryMin': {
  252. handler(newVal, oldVal) {
  253. if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.salaryMax)) {
  254. this.form.salary = '有'
  255. } else {
  256. this.form.salary = ''
  257. }
  258. },
  259. immediate: true
  260. },
  261. 'form.salaryMax': {
  262. handler(newVal, oldVal) {
  263. if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.salaryMin)) {
  264. this.form.salary = '有'
  265. } else {
  266. this.form.salary = ''
  267. }
  268. },
  269. immediate: true
  270. },
  271. 'form.dateMin': {
  272. handler(newVal, oldVal) {
  273. if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.dateMax)) {
  274. this.form.date = '有'
  275. } else {
  276. this.form.date = ''
  277. }
  278. },
  279. immediate: true
  280. },
  281. 'form.dateMax': {
  282. handler(newVal, oldVal) {
  283. if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.dateMin)) {
  284. this.form.date = '有'
  285. } else {
  286. this.form.date = ''
  287. }
  288. },
  289. immediate: true
  290. },
  291. },
  292. methods: {
  293. dateMinConfirm(event) {
  294. console.info(event)
  295. this.showMinDate = false
  296. this.form.dateMin = uni.$u.timeFormat(event.value, 'yyyy-mm-dd hh:MM:ss')
  297. },
  298. dateMinClose() {
  299. this.showMinDate = false
  300. },
  301. dateMaxConfirm(event) {
  302. this.showMaxDate = false
  303. this.form.dateMax = uni.$u.timeFormat(event.value, 'yyyy-mm-dd hh:MM:ss')
  304. },
  305. dateMaxClose() {
  306. this.showMaxDate = false
  307. },
  308. handleAreaChange() {
  309. this.showPicker = true
  310. },
  311. handleCityChange(e) {
  312. console.info(e)
  313. this.form.area = e.province.label + '-' + e.city.label + '-' + e.area.label;
  314. },
  315. handleindustryChange() {
  316. this.showIndustry = true
  317. },
  318. industrySelect(e) {
  319. this.form.industryId = e.id
  320. this.form.industryName = e.name
  321. this.$refs.uForm.validateField('industryName')
  322. this.onIndustryById()
  323. },
  324. onIndustryById() {
  325. let that = this
  326. industryById({
  327. pid: that.form.industryId
  328. }).then(response => {
  329. that.typeList = response.result
  330. }).catch(error => {
  331. })
  332. },
  333. handleTypeChange() {
  334. if (!this.form.industryId) {
  335. return uni.$u.toast('请选择行业')
  336. }
  337. this.showType = true
  338. },
  339. typeSelect(e) {
  340. this.form.typeId = e.id
  341. this.form.typeName = e.name
  342. this.$refs.uForm.validateField('typeId')
  343. },
  344. submit() {
  345. this.$refs.uForm.validate().then(res => {
  346. this.onaddTask()
  347. // uni.$u.toast('校验通过')
  348. }).catch(errors => {
  349. // uni.$u.toast('校验失败')
  350. })
  351. },
  352. onaddTask() {
  353. let that = this
  354. let params = {
  355. "bossPhone": that.form.mobile, //招聘方联系方式
  356. "dayMoney": that.form.dayMoney, //期望日薪
  357. "endTime": that.form.dateMax,
  358. // "industryId": that.form.industryId,
  359. // "industryName": that.form.industryName,
  360. "industryId": that.form.typeId,
  361. "industryName": that.form.typeName,
  362. "latitude": that.form.latitude,
  363. "longitude": that.form.longitude,
  364. "moneymax": that.form.salaryMax, //期望薪资最大值
  365. "moneymin": that.form.salaryMin, //期望薪资最小值
  366. "payType": that.form.settlement, //结算方式 0提前支付 1 试用后支付
  367. "startTime": that.form.dateMin,
  368. "title": that.form.title, //工作标题
  369. "workAddress": that.form.area, //工作地址
  370. "workDetail": that.form.introduce,
  371. "workPic": that.form.fileList.map(item => item.url).join(','), //照片
  372. }
  373. addTask(params).then(response => {
  374. const {
  375. code
  376. } = response
  377. if (code === 200) {
  378. uni.$u.toast("提交成功!")
  379. setTimeout(() => {
  380. uni.switchTab({
  381. url: "/pages/home/index"
  382. })
  383. }, 1500)
  384. }
  385. }).catch(error => {
  386. })
  387. },
  388. deletePic(event) {
  389. this.form.fileList.splice(e.index, 1)
  390. },
  391. async afterRead(e) {
  392. let self = this
  393. e.file.forEach(file => {
  394. self.$Oss.ossUpload(file.url).then(url => {
  395. self.form.fileList.push({
  396. url
  397. })
  398. })
  399. })
  400. },
  401. onIndustryList() {
  402. industryList({}).then(response => {
  403. this.indList = response.result
  404. }).catch(error => {
  405. })
  406. },
  407. },
  408. onReady() {
  409. this.$refs.uForm.setRules(this.rules)
  410. this.onIndustryList()
  411. },
  412. }
  413. </script>
  414. <style>
  415. </style>