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

396 lines
12 KiB

6 months ago
4 months ago
6 months ago
4 months ago
6 months ago
4 months ago
3 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
4 months ago
6 months ago
4 months ago
6 months ago
4 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
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
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
6 months ago
3 months ago
6 months ago
3 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. <!-- @click="showPicker=true" -->
  7. <u-form-item label="请选择地址" class="se-b-b" prop="area" @click="handleAreaChange()">
  8. <u--input readonly v-model="form.area" placeholder="请选择地址" border="none"></u--input>
  9. <u-icon slot="right" name="arrow-right" ></u-icon>
  10. </u-form-item>
  11. <!-- <u-form-item label="详细地址" prop="address">
  12. <u--textarea v-model="form.address" count placeholder="请输入详细地址"></u--textarea>
  13. </u-form-item> -->
  14. <u-form-item label="所属行业" class="se-b-b" prop="industry" @click="handleindustryChange()">
  15. <u--input @click="handleindustryChange" readonly v-model="form.industry" placeholder="请选择行业" border="none"></u--input>
  16. <u-icon @click="handleindustryChange" slot="right" name="arrow-right"></u-icon>
  17. </u-form-item>
  18. <u-form-item label="所属工种" class="se-b-b" prop="typeName" @click="handleTypeChange">
  19. <u--input @click="handleTypeChange" v-model="form.typeName" readonly placeholder="请选择工种"
  20. border="none"></u--input>
  21. <u-icon @click="handleTypeChange" slot="right" name="arrow-right"></u-icon>
  22. </u-form-item>
  23. <!-- <u-form-item label="预约时间" prop="date" @click="show=true">
  24. <u--input v-model="form.date" readonly placeholder="请选择预约时间"
  25. border="none"></u--input>
  26. <u-icon slot="right" name="arrow-right"></u-icon>
  27. </u-form-item> -->
  28. <u-form-item label="出行方式" labelPosition="top" prop="travel">
  29. <view class="se-flex se-flex-ai-c se-flex-ff-rw se-pt-10">
  30. <view class="se-py-10 se-px-30 se-fs-22 se-br-10 se-mr-15 se-mt-10" :class="item.select ? 'se-bgc-orange se-c-white se-b-orange' : 'se-b se-c-text'" @click="handleIntellect(index)" v-for="(item,index) in travelList" :key="index">
  31. {{item.text}}
  32. </view>
  33. </view>
  34. </u-form-item>
  35. <u-form-item label="结算方式" prop="settlement">
  36. <u-radio-group v-model="form.settlement" placement="row">
  37. <u-radio activeColor="#FF7A31" name="1" label="直接支付日薪"></u-radio>
  38. <u-radio activeColor="#FF7A31" class="se-ml-20" name="2" label="试用以后支付"></u-radio>
  39. </u-radio-group>
  40. </u-form-item>
  41. <u-form-item label="薪资区间" prop="salary">
  42. <view class="se-flex se-flex-h-c">
  43. <u--input v-model="form.salaryMin" type="number" class="se-w-200" placeholder="最小值"></u--input>
  44. <text class="se-mx-10">~</text>
  45. <u--input v-model="form.salaryMax" type="number" class="se-w-200" placeholder="最大值"></u--input>
  46. </view>
  47. </u-form-item>
  48. <u-form-item label="日薪" prop="dayMoney">
  49. <view class="se-flex se-flex-h-c">
  50. <u--input v-model="form.dayMoney" type="number" class="se-w-200" placeholder="固定值"></u--input>
  51. </view>
  52. </u-form-item>
  53. <!-- <u-form-item label="时间" prop="date">
  54. <view class="se-flex se-flex-h-c">
  55. <u--input v-model="form.dateMin" class="se-w-200" placeholder="0:00"></u--input>
  56. <text class="se-mx-10">~</text>
  57. <u--input v-model="form.dateMax" class="se-w-200" placeholder="0:00"></u--input>
  58. </view>
  59. </u-form-item>
  60. <u-form-item label="联系电话" prop="mobile">
  61. <u--input v-model="form.mobile" placeholder="请输入联系方式"></u--input>
  62. </u-form-item> -->
  63. <u-form-item label="工作内容" prop="introduce">
  64. <u--textarea v-model="form.introduce" count
  65. placeholder="请选择工作内容"></u--textarea>
  66. </u-form-item>
  67. </view>
  68. </view>
  69. <view class="se-px-20 se-pt-20">
  70. <view class="se-px-20 se-pb-80 se-fs-20 se-flex">
  71. <view @click="submit"
  72. 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">
  73. <text>发布订单</text>
  74. </view>
  75. </view>
  76. </view>
  77. </u--form>
  78. <!-- 行业 -->
  79. <u-action-sheet :show="showIndustry" :actions="industryList" title="请选择行业" @close="showIndustry = false" @select="industrySelect">
  80. </u-action-sheet>
  81. <!-- 种类 -->
  82. <u-action-sheet :show="showType" :actions="typeList" title="请选择种类" @close="showType = false" @select="typeSelect">
  83. </u-action-sheet>
  84. </view>
  85. </template>
  86. <script>
  87. import QQMapWX from "@/util/qqmap-wx-jssdk.min.js"
  88. import { industryById,industryList,addTask2 } from "@/common/api.js"
  89. export default {
  90. components:{
  91. },
  92. data() {
  93. return {
  94. show:false,
  95. showPicker: false,
  96. showIndustry: false,
  97. industryList: [],
  98. showType: false,
  99. typeList: [],
  100. travelList:[
  101. {
  102. text:"出租车",
  103. value:"all",
  104. select:true
  105. },
  106. {
  107. text:"网约车",
  108. value:"all",
  109. select:false
  110. },
  111. {
  112. text:"公交/地铁",
  113. value:"all",
  114. select:false
  115. },
  116. {
  117. text:"无",
  118. value:"all",
  119. select:false
  120. }
  121. ],
  122. dates:[
  123. ['2024','2025','2026','2027','2028'],
  124. ['01','02','03','04','05','06','07','08','09','10','11','12'],
  125. ['01','02','03','04','05','06','07','08','09','10','11','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30'],
  126. ],
  127. form: {
  128. title:"",
  129. area:'',
  130. address:'',
  131. industryId:"",
  132. industry:"",
  133. settlement:1,
  134. date:"",
  135. dateMin:"",
  136. dateMax:"",
  137. mobile: '',
  138. typeId:"",
  139. typeName: '',
  140. salary:'',
  141. salaryMin: '',
  142. salaryMax: '',
  143. dayMoney:'',
  144. introduce: '',
  145. longitude:'',
  146. latitude:''
  147. },
  148. rules: {
  149. title:[
  150. {
  151. type: 'string',
  152. required: true,
  153. message: '请在此输入标题',
  154. trigger: ['blur', 'change']
  155. }
  156. ],
  157. area:[
  158. {
  159. type: 'string',
  160. required: true,
  161. message: '请选择地址',
  162. trigger: ['blur', 'change']
  163. }
  164. ],
  165. address:[
  166. {
  167. type: 'string',
  168. required: true,
  169. message: '请填写详细地址',
  170. trigger: ['blur', 'change']
  171. }
  172. ],
  173. industry:[
  174. {
  175. type: 'string',
  176. required: true,
  177. message: '请选择行业',
  178. trigger: ['blur', 'change']
  179. }
  180. ],
  181. settlement:[
  182. {
  183. type: 'string',
  184. required: true,
  185. message: '请选择结算方式',
  186. trigger: ['blur', 'change']
  187. }
  188. ],
  189. mobile: [
  190. {
  191. required: true,
  192. message: '请输入手机号',
  193. trigger: ['change','blur'],
  194. },
  195. {
  196. validator: (rule, value, callback) => {
  197. return uni.$u.test.mobile(value);
  198. },
  199. message: '手机号码不正确',
  200. trigger: ['change','blur'],
  201. },
  202. ],
  203. date: [{
  204. type: 'string',
  205. max: 1,
  206. required: true,
  207. message: '请填写时间',
  208. trigger: ['blur', 'change']
  209. }],
  210. salary: [{
  211. type: 'string',
  212. required: true,
  213. message: '请输入试用日薪',
  214. trigger: ['blur', 'change']
  215. }],
  216. introduce: [{
  217. type: 'string',
  218. required: true,
  219. message: '请输入工作内容',
  220. trigger: ['blur', 'change']
  221. }],
  222. },
  223. }
  224. },
  225. watch: {
  226. 'form.salaryMin': {
  227. handler(newVal, oldVal) {
  228. if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.salaryMax)) {
  229. this.form.salary = '有'
  230. } else {
  231. this.form.salary = ''
  232. }
  233. },
  234. immediate: true
  235. },
  236. 'form.salaryMax': {
  237. handler(newVal, oldVal) {
  238. if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.salaryMin)) {
  239. this.form.salary = '有'
  240. } else {
  241. this.form.salary = ''
  242. }
  243. },
  244. immediate: true
  245. },
  246. 'form.dateMin': {
  247. handler(newVal, oldVal) {
  248. if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.dateMax)) {
  249. this.form.date = '有'
  250. } else {
  251. this.form.date = ''
  252. }
  253. },
  254. immediate: true
  255. },
  256. 'form.dateMax': {
  257. handler(newVal, oldVal) {
  258. if (!uni.$u.test.isEmpty(newVal) && !uni.$u.test.isEmpty(this.form.dateMin)) {
  259. this.form.date = '有'
  260. } else {
  261. this.form.date = ''
  262. }
  263. },
  264. immediate: true
  265. },
  266. },
  267. mounted() {
  268. industryList({}).then(response=>{
  269. this.industryList = response.result
  270. }).catch(error=>{
  271. })
  272. },
  273. methods: {
  274. dateConfirm(event){
  275. this.form.date = event.value[0]+"-"+event.value[1]+"-"+event.value[2]
  276. console.info(event.value)
  277. this.show = false
  278. },
  279. handleIntellect(index){
  280. this.travelList.forEach((items)=>{
  281. items.select=false
  282. })
  283. this.travelList[index].select = !this.travelList[index].select
  284. },
  285. handleAreaChange(){
  286. const that = this;
  287. wx.chooseLocation({
  288. // type: 'wgs84',
  289. success: function (res) {
  290. const qqmapsdk = new QQMapWX({
  291. key: 'TT7BZ-Z3LW4-KOAUB-KWHOA-SBJJ6-Y5B6R' // 必填
  292. });
  293. uni.showLoading({
  294. title:"获取中...."
  295. })
  296. qqmapsdk.reverseGeocoder({
  297. location: {
  298. latitude: res.latitude,
  299. longitude: res.longitude
  300. },
  301. success: function(response) {
  302. console.log('逆地理编码结果:', response);
  303. uni.hideLoading()
  304. that.form.longitude = response.result.location.lng
  305. that.form.latitude = response.result.location.lat
  306. that.form.area = response.result.address
  307. },
  308. fail: function(error) {
  309. uni.hideLoading()
  310. console.error('逆地理编码失败:', error);
  311. }
  312. });
  313. }
  314. })
  315. },
  316. handleindustryChange() {
  317. this.showIndustry = true
  318. },
  319. industrySelect(e) {
  320. console.info(e)
  321. this.form.industryId = e.id
  322. this.form.industry = e.name
  323. this.form.typeId = ""
  324. this.form.type = ""
  325. industryById({pid:e.id}).then(response=>{
  326. this.typeList=response.result
  327. }).catch(error=>{
  328. })
  329. this.$refs.uForm.validateField('industry')
  330. },
  331. handleTypeChange() {
  332. this.showType = true
  333. },
  334. typeSelect(e) {
  335. this.form.typeId = e.id
  336. this.form.typeName = e.name
  337. this.$refs.uForm.validateField('type')
  338. },
  339. submit() {
  340. let that = this
  341. that.$refs.uForm.validate().then(res => {
  342. that.onAddTask()
  343. }).catch(errors => {
  344. // uni.$u.toast('校验失败')
  345. })
  346. },
  347. onAddTask(){
  348. let that = this
  349. let params ={
  350. "bossPhone": that.form.mobile,//招聘方联系方式
  351. "dayMoney": that.form.dayMoney,//期望日薪
  352. // "endTime": that.form.dateMax,
  353. "industryId": that.form.typeId,
  354. "industryName": that.form.typeName,
  355. "latitude": that.form.latitude,
  356. "longitude": that.form.longitude,
  357. "moneymax": that.form.salaryMax,//期望薪资最大值
  358. "moneymin": that.form.salaryMin,//期望薪资最小值
  359. "payType": that.form.settlement,//结算方式 0提前支付 1 试用后支付
  360. // "startTime": that.form.dateMin,
  361. // "title": that.form.title,//工作标题
  362. "workAddress": that.form.area,//工作地址
  363. "workDetail": that.form.introduce,
  364. // "workPic": that.form.fileList.map(item => item.url).join(','),//照片
  365. }
  366. // 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"}
  367. addTask2(params).then(response=>{
  368. // console.info("response",response)
  369. // uni.$u.toast("提交成功!")
  370. // setTimeout(()=>{
  371. // uni.navigateBack({
  372. // delta:1
  373. // })
  374. // },1500)
  375. }).catch(error=>{
  376. })
  377. },
  378. },
  379. onReady() {
  380. this.$refs.uForm.setRules(this.rules)
  381. },
  382. }
  383. </script>
  384. <style>
  385. </style>