applyMaintenance.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <template>
  2. <view class="content">
  3. <view class="box1">
  4. <view class="steps hflex acenter jcenter">
  5. <u-steps :current="current">
  6. <u-steps-item title="个人信息"></u-steps-item>
  7. <u-steps-item title="工作信息"></u-steps-item>
  8. <u-steps-item title="审核"></u-steps-item>
  9. </u-steps>
  10. </view>
  11. <view v-if="current == 0">
  12. <view class="title">个人信息</view>
  13. <view class="hflex acenter jbetween cell">
  14. <view class="left required">姓名</view>
  15. <u-input v-model="userInfo.name" placeholder="请输入您的姓名" inputAlign="right" border="none"></u-input>
  16. </view>
  17. <view class="hflex acenter jbetween cell">
  18. <view class="left required">身份证号</view>
  19. <u-input v-model="userInfo.idNumber" placeholder="请输入您的身份证号" inputAlign="right" border="none"></u-input>
  20. </view>
  21. <view class="hflex acenter jbetween cell">
  22. <view class="left required">邮箱</view>
  23. <u-input v-model="userInfo.eamil" placeholder="请输入您的邮箱" inputAlign="right" border="none"></u-input>
  24. </view>
  25. <!-- <picker mode="region" @change="changeAddress" :value="index" >
  26. <view class="hflex acenter jbetween cell">
  27. <view class="left required">所在地区</view>
  28. <u-input border="none" inputAlign="right" disabled disabledColor="#fff" v-model="userInfo.region" placeholder="请选择省市区" suffixIcon="arrow-right" suffixIconStyle="color: #b7b7b7"></u-input>
  29. </view>
  30. </picker> -->
  31. <view class="hflex acenter jbetween cell">
  32. <view class="left required">地址</view>
  33. <u-input v-model="userInfo.address" placeholder="请输入您的地址" inputAlign="right" border="none"></u-input>
  34. </view>
  35. <view class="line"></view>
  36. <view class="cell">
  37. <view class="img_title required">身份证人像面照片</view>
  38. <view class="upload_img hflex acenter jcenter">
  39. <u-upload :fileList="userInfo.fileList1" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="1" multiple :previewFullImage="true" width="550rpx" height="324rpx">
  40. <view class="" style="position: relative;">
  41. <image src="https://ship.shipcc.cn/common/upload-just.png" style="width: 550rpx;height: 324rpx;"></image>
  42. </view>
  43. </u-upload>
  44. </view>
  45. </view>
  46. <view class="cell">
  47. <view class="img_title required">身份证国徽面照片</view>
  48. <view class="upload_img hflex acenter jcenter">
  49. <u-upload :fileList="userInfo.fileList2" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="2" multiple :previewFullImage="true" width="550rpx" height="324rpx">
  50. <view class="" style="position: relative;">
  51. <image src="https://ship.shipcc.cn/common/upload-back.png" style="width: 550rpx;height: 324rpx;"></image>
  52. <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:102rpx;left: 216rpx; width: 120rpx;height: 120rpx;"></image>
  53. </view>
  54. </u-upload>
  55. </view>
  56. </view>
  57. <view class="bottom">
  58. <view class="btn2" v-if="state != 2" @click="next">下一步</view>
  59. </view>
  60. </view>
  61. <view v-if="current == 1">
  62. <view class="title">工作信息</view>
  63. <view class="cell">
  64. <view class="img_title required">营业执照(必填)</view>
  65. <view class="upload_img hflex acenter jcenter">
  66. <u-upload :fileList="userInfo.fileList3" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="3" multiple :previewFullImage="true" width="550rpx" height="324rpx">
  67. <!-- <image src="https://ship.shipcc.cn/common/upload-business.png" style="width: 550rpx;height: 324rpx;"></image> -->
  68. <view class="" style="position: relative;">
  69. <image src="https://ship.shipcc.cn/common/upload-business.png" style="width: 550rpx;height: 324rpx;"></image>
  70. <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:102rpx;left: 216rpx; width: 120rpx;height: 120rpx;"></image>
  71. </view>
  72. </u-upload>
  73. </view>
  74. </view>
  75. <view class="cell">
  76. <view class="img_title">厂家授权(非必填)</view>
  77. <view class="upload_img hflex acenter jcenter">
  78. <u-upload :fileList="userInfo.fileList4" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="4" multiple :previewFullImage="true" width="550rpx" height="324rpx">
  79. <!-- <image src="https://ship.shipcc.cn/common/upload-business.png" style="width: 550rpx;height: 324rpx;"></image> -->
  80. <view class="" style="position: relative;">
  81. <image src="https://ship.shipcc.cn/common/upload-business.png" style="width: 550rpx;height: 324rpx;"></image>
  82. <image src="@/static/images/mine/upload_center.png" style="position: absolute;top:102rpx;left: 216rpx; width: 120rpx;height: 120rpx;"></image>
  83. </view>
  84. </u-upload>
  85. </view>
  86. </view>
  87. <view class="cell">
  88. <view class="img_title">以往业绩</view>
  89. <view class="img_subtitle">请详细描述您的以往业绩</view>
  90. <u-input v-model="userInfo.achievement" border="bottom"></u-input>
  91. </view>
  92. <view class="bottom hflex acenter jbetween">
  93. <view class="btn1" @click="pro">上一步</view>
  94. <view class="btn" @click="submit">提交</view>
  95. </view>
  96. </view>
  97. <view v-if="current == 2" class="box vflex acenter jcenter">
  98. <view v-if="state == 1" class="vflex acenter jcenter">
  99. <image src="https://ship.shipcc.cn/common/wait.png" class="box1_img"></image>
  100. <view class="box1_title">审核中</view>
  101. <view class="box1_subTitle">预计审核时间3个工作日</view>
  102. <view class="box1_subTitle">请留意当前页面变动</view>
  103. <view class="btn" @click="result">返回</view>
  104. </view>
  105. <view v-if="state == 2" class="vflex acenter jcenter">
  106. <image src="https://ship.shipcc.cn/common/wait.png" class="box1_img"></image>
  107. <view class="box1_title">已通过</view>
  108. <view class="btn" @click="result">返回</view>
  109. </view>
  110. <view v-if="state == 3" class="vflex acenter jcenter">
  111. <image src="https://ship.shipcc.cn/common/error.png" class="box1_img"></image>
  112. <view class="box1_title">审核失败</view>
  113. <view class="box1_subTitle">驳回原因</view>
  114. <view class="box1_subTitle">{{reason}}<span style="color: #506dff;margin-left: 8rpx;" @click="edit">立即修改></span></view>
  115. <view class="btn" @click="result">返回</view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. import $api from '@/static/js/api.js'
  123. var that = ''
  124. export default {
  125. data() {
  126. return {
  127. current: 0,
  128. userInfo: {
  129. id: '',
  130. name: '',
  131. idNumber: '',
  132. eamil: '',
  133. // region: '',
  134. address: '',
  135. /* province: '',
  136. city:'',
  137. area: '', */
  138. fileList1: [],
  139. fileList2: [],
  140. fileList3: [],
  141. fileList4: [],
  142. achievement: '',
  143. },
  144. fileList1: '',
  145. fileList2: '',
  146. fileList3: '',
  147. fileList4: '',
  148. state: 1,
  149. reason: '',
  150. }
  151. },
  152. onLoad() {
  153. that = this
  154. that.getPreData()
  155. },
  156. methods: {
  157. getPreData() {
  158. var pages = getCurrentPages()
  159. var prePage = pages[pages.length - 2]
  160. var maintenance = prePage.$vm.user.maintenance
  161. if(maintenance) {
  162. that.userInfo = {
  163. name: maintenance.name,
  164. idNumber: maintenance.id_card,
  165. eamil: maintenance.email,
  166. // region: maintenance.province + maintenance.city + maintenance.area,
  167. address: maintenance.address,
  168. // province: maintenance.province,
  169. // city:maintenance.city,
  170. // area: maintenance.area,
  171. fileList1: [],
  172. fileList2: [],
  173. fileList3: [],
  174. fileList4: [],
  175. achievement: maintenance.results,
  176. id: maintenance.id
  177. }
  178. that.userInfo.fileList1.push({
  179. url: maintenance.id_card_img1
  180. })
  181. that.userInfo.fileList2.push({
  182. url: maintenance.id_card_img2
  183. })
  184. that.userInfo.fileList3.push({
  185. url: maintenance.business_img
  186. })
  187. if(maintenance.authorization_img != '') {
  188. that.userInfo.fileList4.push({
  189. url: maintenance.authorization_img
  190. })
  191. }
  192. that.fileList1 = maintenance.id_card_img1
  193. that.fileList2 = maintenance.id_card_img2
  194. that.fileList3 = maintenance.business_img
  195. if(maintenance.authorization_img != '') {
  196. that.fileList4 = maintenance.authorization_img
  197. }
  198. /* var imgs2 = maintenance.id_card_img2
  199. that.userInfo.fileList2 = {
  200. url: imgs2
  201. }
  202. console.log('第2个',imgs2);
  203. var imgs3 = maintenance.business_img
  204. that.userInfo.fileList2 = {
  205. url: imgs3
  206. }
  207. console.log('第3个',that.userInfo.fileList3);
  208. var imgs4 = maintenance.authorization_img
  209. that.userInfo.fileList2 = {
  210. url: imgs4
  211. }
  212. console.log('第4个',that.userInfo.fileList4); */
  213. that.state = maintenance.audit
  214. that.reason = maintenance.why
  215. if(that.state) {
  216. that.current = 2
  217. }
  218. }
  219. },
  220. // 选择所在地区
  221. changeAddress(e) {
  222. console.log(e);
  223. that.userInfo.region = e.detail.value[0] + '-' + e.detail.value[1] + '-' + e.detail.value[2]
  224. that.userInfo.province = e.detail.value[0]
  225. that.userInfo.city = e.detail.value[1]
  226. that.userInfo.area = e.detail.value[2]
  227. },
  228. // 删除图片
  229. deletePic(event) {
  230. // that.userInfo.imgList.splice(event.index, 1)
  231. that[`fileList${event.name}`] = ''
  232. that.userInfo[`fileList${event.name}`].splice(event.index, 1)
  233. if(that.userInfo[`fileList${event.name}`].length > 0) {
  234. for(var i=0;i<that.userInfo[`fileList${event.name}`].length;i++) {
  235. if(i == that.userInfo[`fileList${event.name}`].length -1) {
  236. that[`fileList${event.name}`] += that.userInfo[`fileList${event.name}`][i].url
  237. } else {
  238. that[`fileList${event.name}`] += that.userInfo[`fileList${event.name}`][i].url + ','
  239. }
  240. }
  241. }
  242. },
  243. // 新增图片
  244. async afterRead(event) {
  245. uni.showLoading({
  246. title: '上传中',
  247. mask: true
  248. })
  249. console.log(`fileList${event.name}`);
  250. console.log(this.userInfo[`fileList${event.name}`]);
  251. let lists = [].concat(event.file)
  252. let fileListLen = this.userInfo[`fileList${event.name}`].length
  253. lists.map((item) => {
  254. this.userInfo[`fileList${event.name}`].push({
  255. ...item,
  256. status: 'uploading',
  257. message: '上传中'
  258. })
  259. })
  260. for (let i = 0; i < lists.length; i++) {
  261. const result = await this.uploadFilePromise(lists[i].url)
  262. let item = this.userInfo[`fileList${event.name}`][fileListLen]
  263. this.userInfo[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  264. status: 'success',
  265. message: '',
  266. url: result.url
  267. }))
  268. fileListLen++
  269. if(lists.length - 1 == i) {
  270. uni.hideLoading()
  271. }
  272. }
  273. that[`fileList${event.name}`] = ''
  274. if(that.userInfo[`fileList${event.name}`].length > 0) {
  275. for(var i=0;i<that.userInfo[`fileList${event.name}`].length;i++) {
  276. if(i == that.userInfo[`fileList${event.name}`].length -1) {
  277. that[`fileList${event.name}`] += that.userInfo[`fileList${event.name}`][i].url
  278. } else {
  279. that[`fileList${event.name}`] += that.userInfo[`fileList${event.name}`][i].url + ','
  280. }
  281. }
  282. }
  283. },
  284. // 上传图片
  285. uploadFilePromise(url) {
  286. return new Promise((resolve, reject) => {
  287. let a = uni.uploadFile({
  288. url: $api.config.baseUrl + '/data/api.auth.Center/upload',
  289. filePath: url,
  290. name: 'file',
  291. header: {
  292. 'content-type': 'application/x-www-form-urlencoded',
  293. 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
  294. 'api-name': 'wxapp'
  295. },
  296. formData: {
  297. user: 'test'
  298. },
  299. success: (res) => {
  300. console.log(res);
  301. setTimeout(() => {
  302. var data = JSON.parse(res.data)
  303. resolve(data.data)
  304. }, 1000)
  305. }
  306. });
  307. })
  308. },
  309. next() {
  310. if(that.userInfo.name == '') {
  311. $api.info('请先输入姓名')
  312. return
  313. }
  314. if(that.userInfo.idNumber == '') {
  315. $api.info('请先输入身份证号')
  316. return
  317. }
  318. if(that.userInfo.eamil == '') {
  319. $api.info('请先输入邮箱')
  320. return
  321. }
  322. /* if(that.userInfo.region == '') {
  323. $api.info('请选择所在地区')
  324. return
  325. } */
  326. if(that.userInfo.address == '') {
  327. $api.info('请先输入地址')
  328. return
  329. }
  330. if(that.fileList1 == '') {
  331. $api.info('请先上传身份证人像面照片')
  332. return
  333. }
  334. if(that.fileList2 == '') {
  335. $api.info('请先上传身份证国徽面照片')
  336. return
  337. }
  338. that.current = that.current + 1
  339. /* console.log(that.fileList2);
  340. if ($api.formCheck(that.userInfo.name,'truename') && $api.formCheck(that.userInfo.idNumber,'identity') && $api.formCheck(that.userInfo.eamil,'email') && $api.formCheck(that.fileList1,'required') && $api.formCheck(that.fileList2,'required')) {
  341. that.current = that.current + 1
  342. } */
  343. },
  344. pro() {
  345. that.current = that.current - 1
  346. },
  347. submit() {
  348. if(that.fileList3 == '') {
  349. $api.info('请先上传营业执照')
  350. return
  351. }
  352. var u = that.userInfo
  353. // that.current = that.current + 1
  354. $api.req({
  355. url: '/data/api.auth.Center/addupmaintenance',
  356. method: 'POST',
  357. data: {
  358. id: u.id?u.id: '',
  359. name: u.name,
  360. id_card: u.idNumber,
  361. email: u.eamil,
  362. // province: u.province,
  363. // city: u.city,
  364. // area: u.area,
  365. address: u.address,
  366. id_card_img1: that.fileList1,
  367. id_card_img2: that.fileList2,
  368. business_img: that.fileList3,
  369. authorization_img: that.fileList4,
  370. results: u.achievement,
  371. }
  372. }, function(res) {
  373. $api.info(res.info)
  374. if(res.code == 1) {
  375. that.current = that.current + 1
  376. that.state = 1
  377. }
  378. })
  379. },
  380. edit() {
  381. that.state = 0
  382. that.current = 0
  383. },
  384. result() {
  385. $api.jump('/pages/tabbar/mine/mine',3)
  386. }
  387. },
  388. }
  389. </script>
  390. <style lang="scss" scoped>
  391. .content::v-deep {
  392. padding: 0 40rpx;
  393. .required {
  394. position: relative;
  395. padding-left: 15rpx;
  396. }
  397. .required::after {
  398. content: '*';
  399. position: absolute;
  400. top: 5rpx;
  401. left: 0;
  402. font-size: 26rpx;
  403. font-weight: 400;
  404. color: #FF3232;
  405. }
  406. .box1 {
  407. .steps {
  408. width: 100%;
  409. height: 188rpx;
  410. }
  411. .title {
  412. font-size: 32rpx;
  413. color: #444;
  414. margin: 8rpx 0;
  415. position: relative;
  416. z-index: 9;
  417. }
  418. .title::before {
  419. width: 120rpx;
  420. height: 16rpx;
  421. background: linear-gradient(270deg, #506dff 0%, #fff 100%);
  422. content: "";
  423. position: absolute;
  424. left: 0;
  425. bottom: 0;
  426. z-index: 2;
  427. opacity: 0.8;
  428. }
  429. .u-input {
  430. width: 100%;
  431. // margin-top: 30rpx;
  432. }
  433. .cell {
  434. width: 100%;
  435. padding: 20rpx 0;
  436. .left {
  437. font-size: 28rpx;
  438. color: #222;
  439. }
  440. .u-input {
  441. font-size: 28rpx;
  442. color: #222;
  443. }
  444. .img_title {
  445. font-size: 28rpx;
  446. color: #444;
  447. }
  448. .upload_img {
  449. width: 670rpx;
  450. height: 404rpx;
  451. background-color: #f4f4f4;
  452. border-radius: 20rpx;
  453. margin: 28rpx 0 40rpx;
  454. }
  455. .u-upload__wrap {
  456. display: flex;
  457. align-items: center !important;
  458. justify-content: center !important;
  459. }
  460. .img_subtitle {
  461. font-size: 28rpx;
  462. color: #A3A3A3;
  463. padding: 12rpx 0;
  464. }
  465. .u-input {
  466. width: 100%;
  467. // margin-top: 30rpx;
  468. }
  469. }
  470. .line {
  471. width: 100%;
  472. height: 1rpx;
  473. background-color: #f4f4f4;
  474. }
  475. .bottom {
  476. width: 100%;
  477. margin: 40rpx 0 64rpx;
  478. .btn1 {
  479. width: 330rpx;
  480. height: 88rpx;
  481. text-align: center;
  482. line-height: 88rpx;
  483. border-radius: 44rpx;
  484. border: 1px solid #eee;
  485. background-color: #eee;
  486. color: #000;
  487. font-size: 36rpx;
  488. }
  489. .btn {
  490. width: 330rpx;
  491. height: 88rpx;
  492. text-align: center;
  493. line-height: 88rpx;
  494. border-radius: 44rpx;
  495. background-color: #506dff;
  496. color: #fff;
  497. font-size: 36rpx;
  498. }
  499. .btn2 {
  500. width: 690rpx;
  501. height: 88rpx;
  502. text-align: center;
  503. line-height: 88rpx;
  504. border-radius: 44rpx;
  505. background-color: #506dff;
  506. color: #fff;
  507. font-size: 36rpx;
  508. }
  509. }
  510. }
  511. .box {
  512. width: 100%;
  513. // height: 100vh;
  514. background-color: #fff;
  515. .box1_img {
  516. width: 124rpx;
  517. height: 124rpx;
  518. margin: 108rpx 0 40rpx;
  519. }
  520. .box1_title {
  521. font-size: 32rpx;
  522. color: #222;
  523. margin-bottom: 24rpx;
  524. }
  525. .box1_subTitle {
  526. margin: 12rpx 0;
  527. font-size: 26rpx;
  528. color: #999999;
  529. }
  530. .btn {
  531. width: 530rpx;
  532. height: 88rpx;
  533. background-color: #506dff;
  534. color: #fff;
  535. text-align: center;
  536. line-height: 88rpx;
  537. border-radius: 44rpx;
  538. font-size: 36rpx;
  539. margin-top: 122rpx;
  540. }
  541. }
  542. }
  543. </style>