receivingOrder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <view class="hflex acenter jbetween cell">
  5. <view class="label required">姓名</view>
  6. <u-input v-model="name" placeholder="请填写姓名" inputAlign="right" border="none"></u-input>
  7. </view>
  8. <view class="hflex acenter jbetween cell">
  9. <view class="label required">所在单位</view>
  10. <u-input v-model="work" placeholder="请填写所在单位名称" inputAlign="right" border="none"></u-input>
  11. </view>
  12. <view class="cell">
  13. <view class="label required">营业执照照片</view>
  14. <view class="upload hflex acenter jcenter">
  15. <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="1" multiple :previewFullImage="true" width="530rpx" height="324rpx">
  16. <view class="" style="position: relative;">
  17. <image src="https://ship.shipcc.cn/common/upload-business.png" style="width: 530rpx;height: 324rpx;"></image>
  18. <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:102rpx;left: 216rpx; width: 120rpx;height: 120rpx;"></image>
  19. </view>
  20. </u-upload>
  21. </view>
  22. </view>
  23. <view class="cell" style="border: none;">
  24. <view class="label required">身份证正反面</view>
  25. <view class="hflex acenter jbetween" style="margin-top: 28rpx;">
  26. <u-upload :fileList="fileList2" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="2" multiple :previewFullImage="true" width="310rpx" height="188rpx">
  27. <view class="" style="position: relative;">
  28. <image src="@/static/images/index/upload-back.png" style="width: 310rpx;height: 188rpx;"></image>
  29. <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:40rpx;left: 116rpx; width: 80rpx;height: 80rpx;"></image>
  30. <view style="position: absolute;bottom: 16rpx;left: 70rpx;font-size: 16rpx;color: #506DFF;">上传身份证人像面照片</view>
  31. </view>
  32. </u-upload>
  33. <u-upload :fileList="fileList3" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="3" multiple :previewFullImage="true" width="310rpx" height="188rpx">
  34. <view class="" style="position: relative;">
  35. <image src="https://ship.shipcc.cn/common/upload-back.png" style="width: 310rpx;height: 188rpx;"></image>
  36. <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:40rpx;left: 116rpx; width: 80rpx;height: 80rpx;"></image>
  37. <view style="position: absolute;bottom: 16rpx;left: 70rpx;font-size: 16rpx;color: #506DFF;">上传身份证国徽面图片</view>
  38. </view>
  39. </u-upload>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="box">
  44. <view class="hflex acenter jbetween cell">
  45. <view class="label required">手机号</view>
  46. <u-input v-model="phone" placeholder="请填写你的手机号" inputAlign="right" border="none"></u-input>
  47. </view>
  48. <view class="hflex acenter jbetween cell">
  49. <view class="label required">邮箱</view>
  50. <u-input v-model="email" placeholder="请填写你的邮箱" inputAlign="right" border="none"></u-input>
  51. </view>
  52. <view class="hflex acenter jbetween cell" style="border: none;">
  53. <view class="label required">地址</view>
  54. <u-input v-model="address" placeholder="请填写你的详细地址" inputAlign="right" border="none"></u-input>
  55. </view>
  56. </view>
  57. <view class="box">
  58. <view class="cell vflex jbetween">
  59. <view class="label">工作简历</view>
  60. <u-input v-model="resume" placeholder="请详细描述你的工作经历" border="none"></u-input>
  61. </view>
  62. <view class="cell vflex jbetween" style="border: none;">
  63. <view class="label">特长</view>
  64. <u-input v-model="speciality" placeholder="请简单叙述一下你的优点及特长" border="none"></u-input>
  65. </view>
  66. </view>
  67. <view class="box" style="margin-bottom: 186rpx;">
  68. <view class="hflex acenter jbetween">
  69. <view class="title">是否隐藏需求</view>
  70. <u-switch v-model="hidden" inactiveColor="rgb(230, 230, 230)" @change="changeHide1"></u-switch>
  71. </view>
  72. <view class="text">
  73. 说明:灰色开关为显示需求,蓝色开关为隐藏需求,默认为显示需求
  74. </view>
  75. </view>
  76. <view class="bottom">
  77. <view class="bottom_btn" @click="open" v-if="id == ''">立即发布</view>
  78. <view class="bottom_btn" @click="open" v-if="id != ''">立即修改</view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import $api from '@/static/js/api.js'
  84. var that = ''
  85. export default {
  86. data() {
  87. return {
  88. name: '',
  89. work: '',
  90. fileList1: [],
  91. fileList2: [],
  92. fileList3: [],
  93. phone: '',
  94. email: '',
  95. address: '',
  96. resume: '',
  97. speciality: '',
  98. id: '',
  99. hidden: false
  100. }
  101. },
  102. onLoad() {
  103. that = this
  104. that.getData()
  105. },
  106. methods: {
  107. getData() {
  108. $api.req({
  109. url: '/data/api.auth.Center/myneed',
  110. method: 'POST',
  111. data: {
  112. type: '2'
  113. }
  114. },function(res) {
  115. if(res.code == 1) {
  116. console.log(res);
  117. if(res.data) {
  118. that.name = res.data.name
  119. that.work = res.data.company_name
  120. that.fileList1.push({
  121. url:res.data.business_img
  122. })
  123. that.fileList2.push({
  124. url:res.data.id_card_zheng
  125. })
  126. that.fileList3.push({
  127. url:res.data.id_card_fan
  128. })
  129. that.id = res.data.id
  130. // that.fileList1[0].url = res.data.business_img
  131. // that.fileList2[0].url = res.data.id_card_zheng
  132. // that.fileList3[0].url = res.data.id_card_fan
  133. that.phone = res.data.phone
  134. that.email = res.data.email
  135. that.address = res.data.address
  136. that.resume = res.data.job_resume
  137. that.speciality = res.data.specialty
  138. that.hidden = res.data.hidden == 2 ? true: false
  139. }
  140. }
  141. })
  142. },
  143. // 立即发布
  144. open() {
  145. if(that.name == '') {
  146. $api.info('请填写姓名')
  147. return
  148. }
  149. if(that.work == '') {
  150. $api.info('请填写所在单位')
  151. return
  152. }
  153. if(that.fileList1 == '') {
  154. $api.info('请上传营业执照')
  155. return
  156. }
  157. if(that.fileList2 == '' || that.fileList3 == '') {
  158. $api.info('请上传身份证照片')
  159. return
  160. }
  161. if(that.phone == '') {
  162. $api.info('请填写你的手机号')
  163. return
  164. }
  165. if(that.email == '') {
  166. $api.info('请填写你的邮箱')
  167. return
  168. }
  169. if(that.address == '' ) {
  170. $api.info('请填写你的详细地址')
  171. return
  172. }
  173. uni.showLoading({
  174. title: '发布中',
  175. mask: true
  176. })
  177. if($api.formCheck(that.name,'required') && $api.formCheck(that.work,'required') && $api.formCheck(that.fileList1,'required') && $api.formCheck(that.fileList2,'required') && $api.formCheck(that.fileList3,'required')
  178. && $api.formCheck(that.phone,'mobile') && $api.formCheck(that.email,'required') && $api.formCheck(that.address,'required')) {
  179. $api.req({
  180. url: '/data/api.auth.ShipEngineMaintenance/subacceptance',
  181. method: 'POST',
  182. data: {
  183. name: that.name,
  184. company_name: that.work,
  185. business_img: that.fileList1[0].url,
  186. id_card_zheng: that.fileList2[0].url,
  187. id_card_fan: that.fileList3[0].url,
  188. phone: that.phone,
  189. email: that.email,
  190. address: that.address,
  191. job_resume: that.resume,
  192. specialty: that.speciality,
  193. hidden: that.hidden? '2' : '1',
  194. // province: uni.getStorageSync('location').province,
  195. // city: uni.getStorageSync('location').city,
  196. // area: uni.getStorageSync('location').district,
  197. id: that.id,
  198. }
  199. }, function(res) {
  200. uni.hideLoading()
  201. if(res.code == 1) {
  202. $api.info(res.info)
  203. $api.jump(-1)
  204. }
  205. })
  206. }
  207. },
  208. changeHide1(e) {
  209. console.log(e);
  210. },
  211. // 删除图片
  212. deletePic(event) {
  213. this[`fileList${event.name}`].splice(event.index, 1)
  214. },
  215. // 新增图片
  216. async afterRead(event) {
  217. uni.showLoading({
  218. title: '上传中',
  219. mask: true
  220. })
  221. let lists = [].concat(event.file)
  222. let fileListLen = this[`fileList${event.name}`].length
  223. lists.map((item) => {
  224. this[`fileList${event.name}`].push({
  225. ...item,
  226. status: 'uploading',
  227. message: '上传中'
  228. })
  229. })
  230. for (let i = 0; i < lists.length; i++) {
  231. const result = await this.uploadFilePromise(lists[i].url)
  232. let item = this[`fileList${event.name}`][fileListLen]
  233. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  234. status: 'success',
  235. message: '',
  236. url: result.url
  237. }))
  238. fileListLen++
  239. if(lists.length - 1 == i) {
  240. uni.hideLoading()
  241. }
  242. }
  243. },
  244. uploadFilePromise(url) {
  245. return new Promise((resolve, reject) => {
  246. let a = uni.uploadFile({
  247. url: $api.config.baseUrl + '/data/api.auth.Center/upload',
  248. filePath: url,
  249. name: 'file',
  250. header: {
  251. 'content-type': 'application/x-www-form-urlencoded',
  252. 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
  253. 'api-name': 'wxapp'
  254. },
  255. formData: {
  256. user: 'test'
  257. },
  258. success: (res) => {
  259. setTimeout(() => {
  260. var data = JSON.parse(res.data)
  261. resolve(data.data)
  262. }, 1000)
  263. }
  264. });
  265. })
  266. },
  267. },
  268. }
  269. </script>
  270. <style lang="scss" scoped>
  271. .content::v-deep {
  272. background: #F4F4F4;
  273. .box {
  274. width: 690rpx;
  275. margin: 20rpx 30rpx 0;
  276. background: #FFFFFF;
  277. border-radius: 10px;
  278. box-sizing: border-box;
  279. padding: 20rpx;
  280. .required {
  281. position: relative;
  282. padding-left: 15rpx;
  283. }
  284. .required::after {
  285. content: '*';
  286. position: absolute;
  287. top: 5rpx;
  288. left: 0;
  289. font-size: 26rpx;
  290. font-weight: 400;
  291. color: #FF3232;
  292. }
  293. .text {
  294. font-size: 24rpx;
  295. font-weight: 400;
  296. color: #d75a59;
  297. margin: 16rpx 0;
  298. }
  299. .cell {
  300. width: 100%;
  301. padding: 32rpx 0 24rpx;
  302. border-bottom: 1rpx solid #F4F4F4;
  303. .label {
  304. font-size: 28rpx;
  305. font-weight: 400;
  306. color: #222222;
  307. line-height: 40rpx;
  308. }
  309. .upload {
  310. box-sizing: border-box;
  311. padding: 40rpx 60rpx;
  312. position: relative;
  313. width: 100%;
  314. height: 400rpx;
  315. background: #F4F4F4;
  316. border-radius: 16rpx;
  317. margin-top: 24rpx;
  318. .upload_img {
  319. position: absolute;
  320. width: 120rpx;
  321. height: 120rpx;
  322. top: 142rpx;
  323. left: 266rpx;
  324. }
  325. }
  326. .upload2 {
  327. position: relative;
  328. .upload_img2 {
  329. position: absolute;
  330. width: 80rpx;
  331. height: 80rpx;
  332. top: 40rpx;
  333. left: 116rpx;
  334. }
  335. }
  336. }
  337. }
  338. .bottom {
  339. width: 100%;
  340. z-index: 9;
  341. position: fixed;
  342. bottom: 0;
  343. height: 166rpx;
  344. background: #FFFFFF;
  345. box-sizing: border-box;
  346. padding: 8rpx 40rpx 74rpx;
  347. .bottom_btn {
  348. width: 100%;
  349. height: 84rpx;
  350. background: #506DFF;
  351. border-radius: 42rpx;
  352. font-size: 36rpx;
  353. font-weight: 500;
  354. color: #FFFFFF;
  355. text-align: center;
  356. line-height: 84rpx;
  357. }
  358. }
  359. }
  360. </style>