applyMaintenance.vue 14 KB

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