driverIdentityThree.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <view class="center">
  3. <view class="picture">
  4. <view style="margin: 0 auto;height: 240px;" v-if="travels != ''">
  5. <!-- <image v-bind:src="travels" class="picture"></image>
  6. <view class="floats" v-if="certificates == true">
  7. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;">
  8. </image>
  9. <view class="words">
  10. 上传行驶证
  11. </view>
  12. </view> -->
  13. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  14. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  15. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions"
  16. :custom="uploadCustom" @on-progress="onProgress"></upload>
  17. </view>
  18. <view style="margin: 0 auto;height: 240px;" v-if="drives != ''">
  19. <!-- <image v-bind:src="drives" class="picture"></image>
  20. <view class="floats" v-if="certificatesTwo == true">
  21. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;">
  22. </image>
  23. <view class="words">
  24. 上传驾驶证
  25. </view>
  26. </view> -->
  27. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  28. :size-type="['compressed']" @on-success="getImgUrl1" @on-error="onError" @on-remove="onRemove"
  29. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions1"
  30. :custom="uploadCustom1" @on-progress="onProgress"></upload>
  31. </view>
  32. <view style="margin: 0 auto;height: 240px;" v-if="practices != ''" >
  33. <!-- <image v-bind:src="practices" class="picture"></image>
  34. <view class="floats" v-if="certificatesThree == true">
  35. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;">
  36. </image>
  37. <view class="words">
  38. 上传道路运营证
  39. </view>
  40. </view> -->
  41. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  42. :size-type="['compressed']" @on-success="getImgUrl2" @on-error="onError" @on-remove="onRemove"
  43. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions2"
  44. :custom="uploadCustom2" @on-progress="onProgress"></upload>
  45. </view>
  46. <view style="margin: 0 auto;height: 240px;" v-if="operates != ''" class="fujian" >
  47. <!-- <image v-bind:src="operates" class="picture"></image>
  48. <view class="floats" v-if="certificatesFour == true">
  49. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;">
  50. </image>
  51. <view class="words">
  52. 上传从业资格证
  53. </view>
  54. </view> -->
  55. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  56. :size-type="['compressed']" @on-success="getImgUrl3" @on-error="onError" @on-remove="onRemove"
  57. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions3"
  58. :custom="uploadCustom3" @on-progress="onProgress"></upload>
  59. </view>
  60. <button class="btns btn" @click="commit">提交</button>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import upload from '@/components/upload.vue';
  66. import {
  67. mapState
  68. } from 'vuex';
  69. export default {
  70. components: {
  71. upload
  72. },
  73. data() {
  74. return {
  75. action: this.$uploadUrl,
  76. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  77. btnLoading: false, //防止重复点击
  78. isAdd: true,
  79. imgUrls: [],
  80. uploadCustom: true,
  81. uploadCustom1: true,
  82. uploadCustom2: true,
  83. uploadCustom3: true,
  84. uploadOptions: {
  85. "text": "上传行驶证",
  86. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/travel.png"
  87. },
  88. uploadOptions1: {
  89. "text": "上传驾驶证",
  90. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/drive.png"
  91. },
  92. uploadOptions2: {
  93. "text": "上传道路运营证",
  94. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/admin/0dd1401f54e34affaa11c711d808a0a0.png"
  95. },
  96. uploadOptions3: {
  97. "text": "上传从业资格证",
  98. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/admin/0dd1401f54e34affaa11c711d808a0a0.png"
  99. },
  100. travels: "../../static/img/authentication/travel(3).png",
  101. drives: "../../static/img/authentication/drive(3).png",
  102. practices: "../../static/img/authentication/business@3x.png",
  103. operates: "../../static/img/authentication/business@3x.png",
  104. DriverViewInfo: {},
  105. addressUrl: [],
  106. certificates: true,
  107. certificatesTwo: true,
  108. certificatesThree: true,
  109. certificatesFour: true,
  110. identityAuthenticationInfo: {},
  111. }
  112. },
  113. computed: {
  114. ...mapState(['hasLogin', 'userInfo'])
  115. },
  116. onLoad(options) {
  117. this.DriverViewInfo = JSON.parse(options.DriverViewInfo)
  118. },
  119. methods: {
  120. filterFileType(index, lists) {
  121. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  122. lists.splice(index, 1);
  123. // 当前文件不支持
  124. uni.showModal({
  125. title: '暂不支持当前图片类型',
  126. showCancel: false
  127. });
  128. } else {
  129. this.isAdd = false;
  130. }
  131. },
  132. getImgUrl(res) {
  133. console.log(res)
  134. console.log('------------res1-----------')
  135. this.travels = res.data.appendixPath
  136. this.addressUrl[0] = res.data.appendixPath
  137. this.certificates = false
  138. },
  139. getImgUrl1(res) {
  140. console.log(res)
  141. console.log('------------res2-----------')
  142. this.drives = res.data.appendixPath
  143. this.addressUrl[1] = res.data.appendixPath
  144. this.certificatesTwo = false
  145. },
  146. getImgUrl2(res) {
  147. console.log(res)
  148. console.log('------------res3-----------')
  149. this.practices = res.data.appendixPath
  150. this.addressUrl[2] = res.data.appendixPath
  151. this.certificatesThree = false
  152. },
  153. getImgUrl3(res) {
  154. console.log(res)
  155. console.log('------------res4-----------')
  156. this.operates =res.data.appendixPath
  157. this.addressUrl[3] =res.data.appendixPath
  158. this.certificatesFour = false
  159. },
  160. onError(error) {
  161. alert(error)
  162. console.log('------------error-----------')
  163. console.log(error)
  164. },
  165. onProgress(e) {
  166. console.log(e)
  167. },
  168. onRemove(index) {
  169. this.imgUrls.splice(index, 1);
  170. },
  171. commit() {
  172. if (this.addressUrl[0] == "" || this.addressUrl[0] == null) {
  173. this.$api.msg('请上传行驶证!')
  174. return
  175. }
  176. if (this.addressUrl[1] == "" || this.addressUrl[1] == null) {
  177. this.$api.msg('请上传驾驶证!')
  178. return
  179. }
  180. if (this.addressUrl[2] == "" || this.addressUrl[2] == null) {
  181. this.$api.msg('请上传道路运营证!')
  182. return
  183. }
  184. if (this.addressUrl[3] == "" || this.addressUrl[3] == null) {
  185. this.$api.msg('请上传从业资格证')
  186. return
  187. }
  188. this.DriverViewInfo.addressUrl = this.addressUrl.toString()
  189. this.DriverViewInfo.commonId = this.userInfo.id
  190. this.DriverViewInfo.pcFlag = 0
  191. // this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  192. var that = this
  193. that.identityAuthenticationInfo.driverPhone = that.DriverViewInfo.driverPhone
  194. uni.showModal({
  195. content: "确认提交司机信息?",
  196. showCancel: true,
  197. confirmText: '确定',
  198. success: function(res) {
  199. if (res.confirm) {
  200. uni.showLoading({
  201. title:"正在提交",
  202. mask:true
  203. })
  204. that.$api.doRequest('get', '/driverViewInfo/selectPhone', that
  205. .identityAuthenticationInfo)
  206. .then(res => {
  207. if (res.data.code == '11018') {
  208. uni.showModal({
  209. title: '提示',
  210. content: '该手机号已认证过司机,再次认证将覆盖之前的认证信息,是否确定认证?',
  211. success: function(res) {
  212. if (res.confirm) {
  213. console.log(that
  214. .identityAuthenticationInfo, "已覆盖")
  215. that.$api.doRequest('post',
  216. '/driverViewInfo/api/addInfo', that
  217. .DriverViewInfo).then(res => {
  218. if (res.data.code == 200) {
  219. uni.showToast({
  220. title: '提交成功',
  221. icon: 'none',
  222. duration: 2000
  223. })
  224. setTimeout(()=>{uni.navigateBack({
  225. delta: 3
  226. })},2000);
  227. } else if (res.data.code ==
  228. 'ERROR002') {
  229. uni.showModal({
  230. title: '提示',
  231. content: '司机身份证号重复,添加失败',
  232. });
  233. } else if (res.data.code ==
  234. 'ERROR003') {
  235. uni.showModal({
  236. title: '提示',
  237. content: '收款人身份证号重复,添加失败',
  238. });
  239. }
  240. })
  241. }
  242. }
  243. });
  244. } else if (res.data.code == 200) {
  245. that.$api.doRequest('post', '/driverViewInfo/api/addInfo', that
  246. .DriverViewInfo).then(res => {
  247. if (res.data.code == 200) {
  248. uni.showToast({
  249. title: '提交成功',
  250. icon: 'none',
  251. duration: 2000
  252. })
  253. setTimeout(()=>{uni.navigateBack({
  254. delta: 3
  255. })},2000);
  256. } else if (res.data.code == 'ERROR002') {
  257. uni.showModal({
  258. title: '提示',
  259. content: '司机身份证号重复,添加失败',
  260. });
  261. } else if (res.data.code == 'ERROR003') {
  262. uni.showModal({
  263. title: '提示',
  264. content: '收款人身份证号重复,添加失败',
  265. });
  266. }
  267. })
  268. }
  269. uni.hideLoading()
  270. }).catch(res => {
  271. uni.showToast({
  272. title: res.data.message,
  273. icon: 'none',
  274. duration: 2000
  275. })
  276. uni.hideLoading()
  277. })
  278. // that.$api.doRequest('post', '/driverViewInfo/api/addInfo', that.DriverViewInfo)
  279. // .then(res => {
  280. // if (res.data.code == 'ERROR001') {
  281. // uni.showModal({
  282. // title: '提示',
  283. // content: '该手机号已认证过司机,再次认证将覆盖之前的认证信息,是否确定认证?',
  284. // success: function(res) {
  285. // if (res.confirm) {
  286. // that.DriverViewInfo.cover = 1
  287. // that.$api.doRequest('post',
  288. // '/driverViewInfo/api/editInfo',
  289. // that.DriverViewInfo).then(
  290. // res => {}).catch(res => {
  291. // uni.showToast({
  292. // title: '提交成功',
  293. // icon: 'none',
  294. // duration: 2000
  295. // })
  296. // uni.navigateTo({
  297. // url: `/pages/attestation/indexThree`
  298. // })
  299. // })
  300. // } else if (res.cancel) {
  301. // uni.showToast({
  302. // title: '提交失败',
  303. // icon: 'none',
  304. // duration: 2000
  305. // })
  306. // }
  307. // }
  308. // });
  309. // } else if (res.data.code == 'ERROR002') {
  310. // uni.showModal({
  311. // title: '提示',
  312. // content: '司机身份证号重复',
  313. // });
  314. // } else if (res.data.code == 'ERROR003') {
  315. // uni.showModal({
  316. // title: '提示',
  317. // content: '收款人身份证号重复',
  318. // });
  319. // } else if (res.data.code == 200) {
  320. // uni.showToast({
  321. // title: '提交成功',
  322. // icon: 'none',
  323. // duration: 2000
  324. // })
  325. // uni.navigateTo({
  326. // url: `/pages/attestation/indexThree`
  327. // })
  328. // } else if (res.data.code == 200) {
  329. // uni.showToast({
  330. // title: '提交成功',
  331. // icon: 'none',
  332. // duration: 2000
  333. // })
  334. // uni.navigateTo({
  335. // url: `/pages/attestation/indexThree`
  336. // })
  337. // }
  338. // }).catch(res => {
  339. // uni.showToast({
  340. // title: res.data.message,
  341. // icon: 'none',
  342. // duration: 2000
  343. // })
  344. // })
  345. } else if (res.cancel) {
  346. // console.log('用户点击取消');
  347. }
  348. },
  349. })
  350. },
  351. // travel() {
  352. // var that = this
  353. // uni.chooseImage({
  354. // success: function(res) {
  355. // uni.uploadFile({
  356. // url: 'https://www.zthymaoyi.com/upload/admin',
  357. // filePath: res.tempFilePaths[0],
  358. // name: 'file',
  359. // success(res) {
  360. // var data = res.data
  361. // var strToObj = JSON.parse(data)
  362. // that.travels = strToObj.url
  363. // that.addressUrl[0] = strToObj.url
  364. // that.certificates = false
  365. // }
  366. // })
  367. // }
  368. // })
  369. // },
  370. // drive() {
  371. // var that = this
  372. // uni.chooseImage({
  373. // success: function(res) {
  374. // uni.uploadFile({
  375. // url: 'https://www.zthymaoyi.com/upload/admin',
  376. // filePath: res.tempFilePaths[0],
  377. // name: 'file',
  378. // success(res) {
  379. // var data = res.data
  380. // var strToObj = JSON.parse(data)
  381. // that.drives = strToObj.url
  382. // that.addressUrl[1] = strToObj.url
  383. // that.certificatesTwo = false
  384. // }
  385. // })
  386. // }
  387. // })
  388. // },
  389. // practice() {
  390. // var that = this
  391. // uni.chooseImage({
  392. // success: function(res) {
  393. // uni.uploadFile({
  394. // url: 'https://www.zthymaoyi.com/upload/admin',
  395. // filePath: res.tempFilePaths[0],
  396. // name: 'file',
  397. // success(res) {
  398. // var data = res.data
  399. // var strToObj = JSON.parse(data)
  400. // that.practices = strToObj.url
  401. // that.addressUrl[2] = strToObj.url
  402. // that.certificatesThree = false
  403. // }
  404. // })
  405. // }
  406. // })
  407. // },
  408. // operate() {
  409. // var that = this
  410. // uni.chooseImage({
  411. // success: function(res) {
  412. // uni.uploadFile({
  413. // url: 'https://www.zthymaoyi.com/upload/admin',
  414. // filePath: res.tempFilePaths[0],
  415. // name: 'file',
  416. // success(res) {
  417. // var data = res.data
  418. // var strToObj = JSON.parse(data)
  419. // that.operates = strToObj.url
  420. // that.addressUrl[3] = strToObj.url
  421. // that.certificatesFour = false
  422. // }
  423. // })
  424. // }
  425. // })
  426. // },
  427. }
  428. }
  429. </script>
  430. <style lang="scss" scoped>
  431. .center {
  432. padding: 10px 20px;
  433. background-color: #F5F6FA;
  434. }
  435. .picture {
  436. width: 100%;
  437. height: 220px;
  438. text-align: center;
  439. margin-top: 10px;
  440. }
  441. .btn {
  442. margin-top: 10px;
  443. background-color: #FFFFFF;
  444. border-radius: 25px;
  445. border: none;
  446. }
  447. .btns {
  448. background-color: #22C572;
  449. margin-bottom: 30rpx;
  450. color: white;
  451. }
  452. .words {
  453. font-size: 18px;
  454. font-weight: 600;
  455. color: #617E8B;
  456. }
  457. .floats {
  458. position: relative;
  459. top: -150px;
  460. }
  461. </style>