driverIdentityThree.vue 12 KB

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