driverIdentityThree.vue 12 KB

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