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

390 lines
11 KiB

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