demandform.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <view>
  3. <view class="solids-bottom margin-bottom-sm">
  4. <view class="bg-white padding">
  5. <view class="cu-steps">
  6. <view class="cu-item" :class="0>stepsnum?'':'text-red'">
  7. <text class="num" data-index="1"></text> 基本信息
  8. </view>
  9. <view class="cu-item" :class="1>stepsnum?'':'text-red'">
  10. <text class="num" data-index="2"></text> 详细信息
  11. </view>
  12. <view class="cu-item" :class="2>stepsnum?'':'text-red'">
  13. <text class="num" data-index="3"></text> 提交成功
  14. </view>
  15. </view>
  16. <view class="text-gray text-sm padding-top">
  17. 请填写真是有效的信息,如有发现诈骗、虚假信息,我们会协助公安与相关法律部门进行调查。
  18. </view>
  19. </view>
  20. </view>
  21. <form>
  22. <view class="echo-formmain" v-if="stepsnum==0">
  23. <view class="cu-form-group">
  24. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 订单标题</view>
  25. <input placeholder="比如:郑州富士康招聘普工" data-field="title" name="title" :value="demandinfo.title" @input="setInput"></input>
  26. </view>
  27. <view class="cu-form-group margin-top-sm">
  28. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 招聘人数</view>
  29. <input placeholder="请输入招聘人数" data-field="num" name="num" :value="demandinfo.num" @input="setInput"></input>
  30. </view>
  31. <view class="cu-form-group">
  32. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 岗位类型</view>
  33. <picker mode="selector" range-key="title" name="cateid" @change="cateidChange" :value="cateidindex" :range="catelist">
  34. <view class="picker">{{cateidindex>-1 ? catelist[cateidindex].title : "请选择岗位类型"}}</view>
  35. </picker>
  36. </view>
  37. <view class="cu-form-group">
  38. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 类型</view>
  39. <radio-group class="block" @change="typeChange">
  40. <view class="flex justify-start">
  41. <label class="flex align-center"> <radio class='red' :class="demandinfo.type==1?'checked':''" :checked="demandinfo.type==1?true:false" value="1"></radio> <text> 代招</text></label>
  42. <label class="flex align-center"> <radio class='red' :class="demandinfo.type==2?'checked':''" :checked="demandinfo.type==2?true:false" value="2"></radio> <text> 劳务派遣</text></label>
  43. </view>
  44. </radio-group>
  45. </view>
  46. <view class="cu-form-group">
  47. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 工作地点</view>
  48. <view style="flex: 1; font-size: 30rpx; color: #AAAAAA; line-height: 100rpx;">
  49. <pickerAddress @change="regionChange">{{region}}</pickerAddress>
  50. </view>
  51. </view>
  52. <view class="cu-form-group">
  53. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 招工年龄</view>
  54. <input placeholder="比如:16-35岁" data-field="agegroup" name="agegroup" :value="demandinfo.agegroup" @input="setInput"></input>
  55. </view>
  56. <view class="cu-form-group">
  57. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 招聘标签</view>
  58. <input placeholder="比如:包食宿 高工资" data-field="tags" name="tags" :value="demandinfo.tags" @input="setInput"></input>
  59. </view>
  60. <view class="cu-form-group">
  61. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 截止日期</view>
  62. <picker mode="date" :value="demandinfo.enddate" @change="bindDateChange">
  63. <view class="picker">{{demandinfo.enddate!='' ? demandinfo.enddate : "请选择本次招聘截止日期"}}</view>
  64. </picker>
  65. </view>
  66. <view class="cu-form-group">
  67. <view class="title">任职要求</view>
  68. <view class="textareabox">
  69. <textarea maxlength="-1" placeholder="请输入..." data-field="requirement" name="requirement" :value="demandinfo.requirement"
  70. @input="setInput"></textarea>
  71. </view>
  72. </view>
  73. <view class="cu-form-group align-start">
  74. <view class="title">企业简介</view>
  75. <view class="textareabox">
  76. <textarea maxlength="-1" placeholder="请输入..." data-field="comdetails" name="comdetails" :value="demandinfo.comdetails"
  77. @input="setInput"></textarea>
  78. </view>
  79. </view>
  80. <view class="padding-tb padding-lr-xs bg-white solids-top">
  81. <view class="title padding-bottom-sm text-lg">环境照片</view>
  82. <view class="grid col-4 grid-square flex-sub">
  83. <block v-for="(picitem,picindex) in demandinfo.picall" :key="picindex">
  84. <view class="bg-img" @tap="viewImage" :data-url="picitem">
  85. <image :src="picitem" mode="aspectFill"></image>
  86. <view class="cu-tag bg-red" @tap.stop="delImg" :data-index="index">
  87. <text class='cuIcon-close'></text>
  88. </view>
  89. </view>
  90. </block>
  91. <view class="solids" @tap="chooseImage" v-if="demandinfo.picall.length <= 12">
  92. <text class='cuIcon-cameraadd'></text>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="padding-tb padding-lr-xs bg-white solids-top">
  97. <view class="title padding-bottom-sm text-lg">上传视频</view>
  98. <view class="grid col-4 grid-square flex-sub" v-if="demandinfo.video==''">
  99. <view class="solids" @click="chooseVideo">
  100. <text class='cuIcon-record'></text>
  101. </view>
  102. </view>
  103. <view class="grid col-1 grid-square flex-sub" v-if="demandinfo.video!=''">
  104. <view class="bg-img">
  105. <video v-if="video!==null" id="myVideo" class="myVideo" :src="demandinfo.video" @error="videoErrorCallback" enable-danmu controls></video>
  106. <view class="cu-tag bg-red" @tap.stop="delVideo">
  107. <text class='cuIcon-close'></text>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="padding flex flex-direction bg-white">
  113. <button class="cu-btn bg-themeBtn margin-tb-sm lg" @tap="stepsNum(1)">下一步</button>
  114. <view class="padding"></view>
  115. </view>
  116. </view>
  117. <view class="echo-formmain" v-if="stepsnum==1">
  118. <view class="cu-form-group">
  119. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 薪资类型</view>
  120. <radio-group class="block" @change="wtypeChange">
  121. <view class="flex justify-start">
  122. <label class="flex align-center"> <radio class='red' :class="demandinfo.wtype==1?'checked':''" :checked="demandinfo.wtype==1?true:false" value="1"></radio> <text> 按月</text></label>
  123. <label class="flex align-center"> <radio class='red' :class="demandinfo.wtype==2?'checked':''" :checked="demandinfo.wtype==2?true:false" value="2"></radio> <text> 按时</text></label>
  124. <label class="flex align-center"> <radio class='red' :class="demandinfo.wtype==3?'checked':''" :checked="demandinfo.wtype==3?true:false" value="3"></radio> <text> 按件</text></label>
  125. <label class="flex align-center"> <radio class='red' :class="demandinfo.wtype==4?'checked':''" :checked="demandinfo.wtype==4?true:false" value="4"></radio> <text> 按项目</text></label>
  126. <label class="flex align-center"> <radio class='red' :class="demandinfo.wtype==5?'checked':''" :checked="demandinfo.wtype==5?true:false" value="5"></radio> <text> 其他</text></label>
  127. </view>
  128. </radio-group>
  129. </view>
  130. <view class="cu-form-group" v-if="demandinfo.wtype!=4">
  131. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> {{demandinfo.wtype==1?'基本':demandinfo.wtype==2?'每日':'每时'}}工资</view>
  132. <input placeholder="请输入" data-field="bwagall" name="bwagall" :value="demandinfo.bwagall" @input="setInput"></input>
  133. <view class="unit">元</view>
  134. </view>
  135. <view class="cu-form-group" v-if="demandinfo.wtype==1">
  136. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 综合月薪</view>
  137. <input placeholder="请输入" data-field="zwagall" name="zwagall" :value="demandinfo.zwagall" @input="setInput"></input>
  138. <view class="unit">元</view>
  139. </view>
  140. <view class="cu-form-group">
  141. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 返利类型</view>
  142. <radio-group class="block" @change="ftypeChange">
  143. <view class="flex justify-start">
  144. <label class="flex align-center"> <radio class='red' :class="demandinfo.ftype==1?'checked':''" :checked="demandinfo.ftype==1?true:false" value="1"></radio> <text> 一次性</text></label>
  145. <label class="flex align-center"> <radio class='red' :class="demandinfo.ftype==2?'checked':''" :checked="demandinfo.ftype==2?true:false" value="2"></radio> <text> 小时工</text></label>
  146. <label class="flex align-center"> <radio class='red' :class="demandinfo.ftype==3?'checked':''" :checked="demandinfo.ftype==3?true:false" value="3"></radio> <text> 管理费</text></label>
  147. <label class="flex align-center"> <radio class='red' :class="demandinfo.ftype==4?'checked':''" :checked="demandinfo.ftype==4?true:false" value="4"></radio> <text> 其他</text></label>
  148. </view>
  149. </radio-group>
  150. </view>
  151. <view class="cu-form-group">
  152. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 返费政策</view>
  153. <input placeholder="比如:入职满一个月返2000元" data-field="fwagall" name="fwagall" :value="demandinfo.fwagall" @input="setInput"></input>
  154. </view>
  155. <view class="cu-form-group margin-top-sm">
  156. <view class="title">手机号码</view>
  157. <input placeholder="请输入联系人手机号码" data-field="telephone" name="telephone" :value="demandinfo.telephone" @input="setInput"></input>
  158. </view>
  159. <view class="cu-form-group align-start">
  160. <view class="title">补充说明</view>
  161. <view class="textareabox">
  162. <textarea maxlength="-1" placeholder="请输入..." data-field="remark" name="remark" :value="demandinfo.remark"
  163. @input="setInput"></textarea>
  164. </view>
  165. </view>
  166. <view class="padding flex flex-direction bg-white">
  167. <button class="cu-btn bg-themeBtn margin-tb-sm lg" @tap="editDemand">立即提交</button>
  168. <button class="cu-btn lg" @tap="stepsNum(0)">返回上一步</button>
  169. <view class="padding"></view>
  170. </view>
  171. </view>
  172. </form>
  173. <view class="echo-formmain padding bg-white" v-if="stepsnum==2">
  174. <view class="padding">
  175. <view class="flex-sub text-center padding-tb">
  176. <view class="solid-bottom text-xsl padding">
  177. <text class="cuIcon-emoji text-green"></text>
  178. </view>
  179. <view class="text-xl padding-tb">
  180. <text class="text-black text-bold">招聘订单信息提交成功,请耐心等待审核!</text>
  181. </view>
  182. <view class="flex flex-direction padding-tb">
  183. <navigator class="cu-btn bg-themeBtn margin-tb-sm lg" open-type="redirect" url="/pages/demand/wdemandlist?status=1">我发布的订单</navigator>
  184. <navigator class="cu-btn lg" open-type="redirect" url="/pages/demand/demandform">继续发布</navigator>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. </view>
  190. </template>
  191. <script>
  192. var _this;
  193. import avatar from "@/components/yq-avatar/yq-avatar.vue";
  194. import pickerAddress from "@/components/pickerAddress/pickerAddress.vue";
  195. export default {
  196. components: {
  197. avatar,
  198. pickerAddress
  199. },
  200. data() {
  201. return {
  202. isRotate: false,
  203. stepsnum: 0,
  204. userinfo: false,
  205. workerinfo: false,
  206. demandinfo: {
  207. id: 0,
  208. workerid: 0,
  209. type: 1,
  210. title: "",
  211. num: 1,
  212. cateid: 0,
  213. province: "",
  214. city: "",
  215. district: "",
  216. agegroup: "",
  217. tags: "",
  218. enddate: "",
  219. requirement: "",
  220. picall: [],
  221. video: "",
  222. comdetails: "",
  223. wtype: 1,
  224. bwagall: "",
  225. zwagall: "",
  226. ftype: 1,
  227. fwagall: "",
  228. telephone: "",
  229. remark: ""
  230. },
  231. cateidindex: -1,
  232. region: "请选择工作地点",
  233. catelist: []
  234. }
  235. },
  236. onLoad: function(option) {
  237. _this = this;
  238. var demandid = option.demandid || 0;
  239. _this.userinfo = _this.checkLogin("/pages/my/my");
  240. _this.workerinfo = uni.getStorageSync('workerinfo') || false;
  241. if (_this.userinfo === false || _this.workerinfo === false) {
  242. uni.reLaunch({
  243. url: "/pages/my/my"
  244. });
  245. return false;
  246. }
  247. _this.$req.ajax({
  248. path: "wdemand/getdemand",
  249. data: {
  250. demandid: demandid,
  251. workerid: _this.workerinfo.id
  252. }
  253. }).then((data) => {
  254. _this.catelist = data.catelist;
  255. if (data.demand != "NULL") {
  256. _this.demandinfo = data.demand;
  257. _this.region = _this.demandinfo.province + " " + _this.demandinfo.city + " " + _this.demandinfo.district;
  258. if ( _this.demandinfo.fwagall=="" ){
  259. _this.isfwagall = 2;
  260. }
  261. for( var i=0,len=_this.catelist.length; i<len; i++ ){
  262. if(_this.demandinfo.cateid == _this.catelist[i].id){
  263. _this.cateidindex = i;
  264. }
  265. }
  266. }
  267. }).catch((err) => {
  268. uni.showModal({
  269. title: '信息提示',
  270. content: err,
  271. showCancel: false
  272. });
  273. });
  274. },
  275. methods: {
  276. // 视频上传
  277. chooseVideo: function(e) {
  278. uni.chooseVideo({
  279. count: 1,
  280. sourceType: ['camera', 'album'],
  281. success: (res) => {
  282. _this.$req.ajaxFile({
  283. path: "attachment/tplfieldvideo",
  284. title: '正在上传',
  285. filePath: res.tempFilePath,
  286. fileName: 'file',
  287. }).then((vfiledata) => {
  288. var vdata = JSON.parse(vfiledata.data);
  289. _this.demandinfo.video = vdata.data.src;
  290. }).catch((err) => {
  291. uni.showModal({
  292. title: '信息提示',
  293. content: err,
  294. showCancel: false
  295. });
  296. });
  297. }
  298. });
  299. },
  300. delVideo: function(e) {
  301. uni.showModal({
  302. title: '信息提示',
  303. content: "删除后不可恢复,确认要删除吗?",
  304. showCancel: true,
  305. success: function (res) {
  306. if (res.confirm) {
  307. _this.demandinfo.video = "";
  308. } else if (res.cancel) {
  309. console.log('用户点击取消');
  310. }
  311. }
  312. });
  313. },
  314. // 图片上传
  315. chooseImage: function(e) {
  316. uni.chooseImage({
  317. count: 12,
  318. sizeType: ['original', 'compressed'],
  319. sourceType: ['album'],
  320. success: (res) => {
  321. _this.$req.ajaxFile({
  322. path: "attachment/tplfieldimage",
  323. title: '正在上传',
  324. filePath: res.tempFilePaths[0],
  325. fileName: 'file',
  326. }).then((filedata) => {
  327. var data = JSON.parse(filedata.data);
  328. _this.demandinfo.picall.push(data.data.src);
  329. console.log("_this.demandinfo.picall: " + JSON.stringify(_this.demandinfo.picall));
  330. }).catch((err) => {
  331. uni.showModal({
  332. title: '信息提示',
  333. content: err,
  334. showCancel: false
  335. });
  336. });
  337. }
  338. });
  339. },
  340. viewImage: function(e) {
  341. uni.previewImage({
  342. urls: _this.demandinfo.picall,
  343. current: e.currentTarget.dataset.url
  344. });
  345. },
  346. delImg: function(e) {
  347. _this.demandinfo.picall.splice(e.currentTarget.dataset.index, 1);
  348. },
  349. // 填写字段
  350. setInput: function(e) {
  351. var field = e.currentTarget.dataset.field;
  352. _this.demandinfo[field] = e.detail.value;
  353. },
  354. bindDateChange: function(e) {
  355. _this.demandinfo.enddate = e.target.value;
  356. },
  357. cateidChange: function(e) {
  358. _this.cateidindex = e.detail.value;
  359. _this.demandinfo.cateid = _this.catelist[_this.cateidindex].id;
  360. },
  361. regionChange: function(data) {
  362. console.log("data: " + JSON.stringify(data));
  363. _this.demandinfo.province = data.data[0];
  364. _this.demandinfo.city = data.data[1];
  365. _this.demandinfo.district = data.data[2];
  366. _this.region = data.data.join(' ');
  367. },
  368. typeChange: function(e) {
  369. _this.demandinfo.type = e.detail.value;
  370. },
  371. wtypeChange: function(e) {
  372. _this.demandinfo.wtype = e.detail.value;
  373. },
  374. ftypeChange: function(e) {
  375. _this.demandinfo.ftype = e.detail.value;
  376. },
  377. // 提交信息
  378. editDemand: function() {
  379. if (_this.isRotate) {
  380. return false;
  381. }
  382. _this.isRotate = true;
  383. _this.$req.ajax({
  384. path: "wdemand/editdemand",
  385. title: "正在提交信息",
  386. data: {
  387. userid: _this.userinfo.id,
  388. id: _this.demandinfo.id,
  389. workerid: _this.workerinfo.id,
  390. title: _this.demandinfo.title,
  391. num: _this.demandinfo.num,
  392. cateid: _this.demandinfo.cateid,
  393. province: _this.demandinfo.province,
  394. city: _this.demandinfo.city,
  395. district: _this.demandinfo.district,
  396. agegroup: _this.demandinfo.agegroup,
  397. tags: _this.demandinfo.tags,
  398. enddate: _this.demandinfo.enddate,
  399. requirement: _this.demandinfo.requirement,
  400. comdetails: _this.demandinfo.comdetails,
  401. picall: _this.demandinfo.picall.join(","),
  402. video: _this.demandinfo.video,
  403. wtype: _this.demandinfo.wtype,
  404. bwagall: _this.demandinfo.bwagall,
  405. zwagall: _this.demandinfo.zwagall,
  406. ftype: _this.demandinfo.ftype,
  407. fwagall: _this.demandinfo.fwagall,
  408. telephone: _this.demandinfo.telephone,
  409. remark: _this.demandinfo.remark
  410. }
  411. }).then((data) => {
  412. _this.stepsNum(2);
  413. _this.isRotate = false;
  414. }).catch((err) => {
  415. uni.showModal({
  416. title: '信息提示',
  417. content: err,
  418. showCancel: false
  419. });
  420. _this.isRotate = false;
  421. });
  422. },
  423. stepsNum: function(num) {
  424. _this.stepsnum = num;
  425. }
  426. }
  427. }
  428. </script>
  429. <style>
  430. .echo-formmain {
  431. min-height: calc(100vh - 290rpx);
  432. background-color: #FFFFFF;
  433. padding-left: 30rpx;
  434. padding-right: 30rpx;
  435. }
  436. .cu-form-group{ display: flex; flex-wrap: wrap; padding: 40rpx 10rpx 0rpx 10rpx; }
  437. .cu-form-group .title{ width: 100%; }
  438. .cu-form-group>input{ display: block; width: 670rpx; height: 100rpx; color: #AAAAAA; }
  439. .cu-form-group>radio-group{ width: 670rpx; height: 100rpx; line-height: 100rpx; color: #AAAAAA; text-align: left; }
  440. .cu-form-group .textareabox{ width: 670rpx; }
  441. .cu-form-group .textareabox textarea{ width: 670rpx; margin-top: 20rpx !important; margin-bottom: 0rpx; }
  442. .cu-form-group .placeholder{ color: #AAAAAA; }
  443. .cu-form-group picker .picker{ text-align: left; color: #AAAAAA; }
  444. .fieldpic {
  445. width: 150rpx;
  446. height: 150rpx;
  447. }
  448. .fieldpictil {
  449. width: 230rpx;
  450. text-align: center;
  451. }
  452. .myVideo{ width: 670rpx; height: 670rpx; }
  453. </style>