driverIdentityThree.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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.navigateBack({
  122. delta:3
  123. })
  124. } else if (res.data.code ==
  125. 'ERROR002') {
  126. uni.showModal({
  127. title: '提示',
  128. content: '司机身份证号重复,添加失败',
  129. });
  130. } else if (res.data.code == 'ERROR003') {
  131. uni.showModal({
  132. title: '提示',
  133. content: '收款人身份证号重复,添加失败',
  134. });
  135. }
  136. })
  137. }
  138. }
  139. });
  140. }else if(res.data.code == 200){
  141. that.$api.doRequest('post','/driverViewInfo/api/addInfo', that.DriverViewInfo).then(res => {
  142. if (res.data.code == 200) {
  143. uni.showToast({
  144. title: '提交成功',
  145. icon: 'none',
  146. duration: 2000
  147. })
  148. uni.navigateBack({
  149. delta:3
  150. })
  151. } else if (res.data.code =='ERROR002') {
  152. uni.showModal({
  153. title: '提示',
  154. content: '司机身份证号重复,添加失败',
  155. });
  156. } else if (res.data.code == 'ERROR003') {
  157. uni.showModal({
  158. title: '提示',
  159. content: '收款人身份证号重复,添加失败',
  160. });
  161. }
  162. })
  163. }
  164. }).catch(res => {
  165. uni.showToast({
  166. title: res.data.message,
  167. icon: 'none',
  168. duration: 2000
  169. })
  170. })
  171. // that.$api.doRequest('post', '/driverViewInfo/api/addInfo', that.DriverViewInfo)
  172. // .then(res => {
  173. // if (res.data.code == 'ERROR001') {
  174. // uni.showModal({
  175. // title: '提示',
  176. // content: '该手机号已认证过司机,再次认证将覆盖之前的认证信息,是否确定认证?',
  177. // success: function(res) {
  178. // if (res.confirm) {
  179. // that.DriverViewInfo.cover = 1
  180. // that.$api.doRequest('post',
  181. // '/driverViewInfo/api/editInfo',
  182. // that.DriverViewInfo).then(
  183. // res => {}).catch(res => {
  184. // uni.showToast({
  185. // title: '提交成功',
  186. // icon: 'none',
  187. // duration: 2000
  188. // })
  189. // uni.navigateTo({
  190. // url: `/pages/attestation/indexThree`
  191. // })
  192. // })
  193. // } else if (res.cancel) {
  194. // uni.showToast({
  195. // title: '提交失败',
  196. // icon: 'none',
  197. // duration: 2000
  198. // })
  199. // }
  200. // }
  201. // });
  202. // } else if (res.data.code == 'ERROR002') {
  203. // uni.showModal({
  204. // title: '提示',
  205. // content: '司机身份证号重复',
  206. // });
  207. // } else if (res.data.code == 'ERROR003') {
  208. // uni.showModal({
  209. // title: '提示',
  210. // content: '收款人身份证号重复',
  211. // });
  212. // } else if (res.data.code == 200) {
  213. // uni.showToast({
  214. // title: '提交成功',
  215. // icon: 'none',
  216. // duration: 2000
  217. // })
  218. // uni.navigateTo({
  219. // url: `/pages/attestation/indexThree`
  220. // })
  221. // } else if (res.data.code == 200) {
  222. // uni.showToast({
  223. // title: '提交成功',
  224. // icon: 'none',
  225. // duration: 2000
  226. // })
  227. // uni.navigateTo({
  228. // url: `/pages/attestation/indexThree`
  229. // })
  230. // }
  231. // }).catch(res => {
  232. // uni.showToast({
  233. // title: res.data.message,
  234. // icon: 'none',
  235. // duration: 2000
  236. // })
  237. // })
  238. } else if (res.cancel) {
  239. // console.log('用户点击取消');
  240. }
  241. },
  242. })
  243. },
  244. travel() {
  245. var that = this
  246. uni.chooseImage({
  247. success: function(res) {
  248. uni.uploadFile({
  249. url: 'https://www.zthymaoyi.com/upload/admin',
  250. filePath: res.tempFilePaths[0],
  251. name: 'file',
  252. success(res) {
  253. var data = res.data
  254. var strToObj = JSON.parse(data)
  255. that.travels = strToObj.url
  256. that.addressUrl[0] = strToObj.url
  257. that.certificates = false
  258. }
  259. })
  260. }
  261. })
  262. },
  263. drive() {
  264. var that = this
  265. uni.chooseImage({
  266. success: function(res) {
  267. uni.uploadFile({
  268. url: 'https://www.zthymaoyi.com/upload/admin',
  269. filePath: res.tempFilePaths[0],
  270. name: 'file',
  271. success(res) {
  272. var data = res.data
  273. var strToObj = JSON.parse(data)
  274. that.drives = strToObj.url
  275. that.addressUrl[1] = strToObj.url
  276. that.certificatesTwo = false
  277. }
  278. })
  279. }
  280. })
  281. },
  282. practice() {
  283. var that = this
  284. uni.chooseImage({
  285. success: function(res) {
  286. uni.uploadFile({
  287. url: 'https://www.zthymaoyi.com/upload/admin',
  288. filePath: res.tempFilePaths[0],
  289. name: 'file',
  290. success(res) {
  291. var data = res.data
  292. var strToObj = JSON.parse(data)
  293. that.practices = strToObj.url
  294. that.addressUrl[2] = strToObj.url
  295. that.certificatesThree = false
  296. }
  297. })
  298. }
  299. })
  300. },
  301. operate() {
  302. var that = this
  303. uni.chooseImage({
  304. success: function(res) {
  305. uni.uploadFile({
  306. url: 'https://www.zthymaoyi.com/upload/admin',
  307. filePath: res.tempFilePaths[0],
  308. name: 'file',
  309. success(res) {
  310. var data = res.data
  311. var strToObj = JSON.parse(data)
  312. that.operates = strToObj.url
  313. that.addressUrl[3] = strToObj.url
  314. that.certificatesFour = false
  315. }
  316. })
  317. }
  318. })
  319. },
  320. }
  321. }
  322. </script>
  323. <style lang="scss" scoped>
  324. .center {
  325. padding: 10px 20px;
  326. background-color: #F5F6FA;
  327. }
  328. .picture {
  329. width: 100%;
  330. height: 220px;
  331. text-align: center;
  332. margin-top: 10px;
  333. }
  334. .btn {
  335. margin-top: 10px;
  336. background-color: #FFFFFF;
  337. border-radius: 25px;
  338. border: none;
  339. }
  340. .btns {
  341. background-color: #22C572;
  342. margin-bottom: 30rpx;
  343. color: white;
  344. }
  345. .words {
  346. font-size: 18px;
  347. font-weight: 600;
  348. color: #617E8B;
  349. }
  350. .floats {
  351. position: relative;
  352. top: -150px;
  353. }
  354. </style>