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

476 lines
14 KiB

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