用工小程序前端代码
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.

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