driverIdentityThree.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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;"></image>
  8. <view class="words">
  9. 上传行驶证
  10. </view>
  11. </view>
  12. </view>
  13. <view style="margin: 0 auto;height: 240px;" v-if="drives != ''" @click="drive">
  14. <image v-bind:src = "drives" class="picture"></image>
  15. <view class="floats" v-if="certificatesTwo == true">
  16. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;"></image>
  17. <view class="words">
  18. 上传驾驶证
  19. </view>
  20. </view>
  21. </view>
  22. <view style="margin: 0 auto;height: 240px;" v-if="practices != ''" @click="practice">
  23. <image v-bind:src = "practices" class="picture"></image>
  24. <view class="floats" v-if="certificatesThree == true">
  25. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;"></image>
  26. <view class="words">
  27. 上传道路运营证
  28. </view>
  29. </view>
  30. </view>
  31. <view style="margin: 0 auto;height: 240px;" v-if="operates != ''" class="fujian" @click="operate">
  32. <image v-bind:src = "operates" class="picture"></image>
  33. <view class="floats" v-if="certificatesFour == true">
  34. <image src="../../static/img/authentication/xiangji@3x.png" style="width: 60px;height: 50px;"></image>
  35. <view class="words">
  36. 上传从业资格证
  37. </view>
  38. </view>
  39. </view>
  40. <button class="btns btn" @click="commit">提交</button>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. mapState
  47. } from 'vuex';
  48. export default {
  49. data() {
  50. return {
  51. travels: "../../static/img/authentication/travel(3).png",
  52. drives: "../../static/img/authentication/drive(3).png",
  53. practices: "../../static/img/authentication/business@3x.png",
  54. operates: "../../static/img/authentication/business@3x.png",
  55. DriverViewInfo: {
  56. },
  57. addressUrl:[],
  58. certificates:true,
  59. certificatesTwo:true,
  60. certificatesThree:true,
  61. certificatesFour:true,
  62. }
  63. },
  64. computed: {
  65. ...mapState(['hasLogin', 'userInfo'])
  66. },
  67. onLoad(options){
  68. this.DriverViewInfo = JSON.parse(options.DriverViewInfo)
  69. },
  70. methods:{
  71. commit() {
  72. var that = this
  73. if (this.addressUrl[0] == "" || this.addressUrl[0] == null) {
  74. console.log(this.addressUrl)
  75. this.$api.msg('请上传行驶证!')
  76. return
  77. }
  78. if (this.addressUrl[1] == "" || this.addressUrl[1] == null) {
  79. console.log(this.addressUrl)
  80. this.$api.msg('请上传驾驶证!')
  81. return
  82. }
  83. if (this.addressUrl[2] == "" || this.addressUrl[2] == null) {
  84. console.log(this.addressUrl)
  85. this.$api.msg('请上传道路运营证!')
  86. return
  87. }
  88. if (this.addressUrl[3] == "" || this.addressUrl[3] == null) {
  89. console.log(this.addressUrl)
  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. this.DriverViewInfo.numberCard="210804199909162525"
  98. this.DriverViewInfo.driverPhone="15842688524"
  99. this.$api.doRequest('post', '/driverViewInfo/api/addInfo', this.DriverViewInfo).then(res => {
  100. if(res.data.code=='ERROR001'){
  101. uni.showModal({
  102. title: '提示',
  103. content: '该手机号已认证过司机,再次认证将覆盖之前的认证信息,是否确定认证?',
  104. success: function (res) {
  105. if (res.confirm) {
  106. that.DriverViewInfo.cover=1
  107. that.$api.doRequest('post', '/driverViewInfo/api/editInfo', that.DriverViewInfo).then(res => {
  108. }).catch(res => {
  109. uni.showToast({
  110. title: '提交成功',
  111. icon: 'none',
  112. duration: 2000
  113. })
  114. uni.navigateTo({
  115. url: `/pages/attestation/indexThree`
  116. })
  117. })
  118. } else if (res.cancel) {
  119. uni.showToast({
  120. title: '提交失败',
  121. icon: 'none',
  122. duration: 2000
  123. })
  124. }
  125. }
  126. });
  127. }else if(res.data.code==200){
  128. uni.showToast({
  129. title: '提交成功',
  130. icon: 'none',
  131. duration: 2000
  132. })
  133. uni.navigateTo({
  134. url: `/pages/attestation/indexThree`
  135. })
  136. }
  137. }).catch(res => {
  138. uni.showToast({
  139. title: res.data.message,
  140. icon: 'none',
  141. duration: 2000
  142. })
  143. })
  144. },
  145. travel(){
  146. var that = this
  147. wx.chooseImage({
  148. success: function(res) {
  149. wx.uploadFile({
  150. url: 'https://www.zthymaoyi.com/upload/admin',
  151. filePath: res.tempFilePaths[0],
  152. name: 'file',
  153. success(res) {
  154. var data = res.data
  155. var strToObj = JSON.parse(data)
  156. that.travels = strToObj.url
  157. that.addressUrl[0] = strToObj.url
  158. that.certificates = false
  159. }
  160. })
  161. }
  162. })
  163. },
  164. drive(){
  165. var that = this
  166. wx.chooseImage({
  167. success: function(res) {
  168. wx.uploadFile({
  169. url: 'https://www.zthymaoyi.com/upload/admin',
  170. filePath: res.tempFilePaths[0],
  171. name: 'file',
  172. success(res) {
  173. var data = res.data
  174. var strToObj = JSON.parse(data)
  175. that.drives = strToObj.url
  176. that.addressUrl[1] = strToObj.url
  177. that.certificatesTwo = false
  178. }
  179. })
  180. }
  181. })
  182. },
  183. practice(){
  184. var that = this
  185. wx.chooseImage({
  186. success: function(res) {
  187. wx.uploadFile({
  188. url: 'https://www.zthymaoyi.com/upload/admin',
  189. filePath: res.tempFilePaths[0],
  190. name: 'file',
  191. success(res) {
  192. var data = res.data
  193. var strToObj = JSON.parse(data)
  194. that.practices = strToObj.url
  195. that.addressUrl[2] = strToObj.url
  196. that.certificatesThree = false
  197. }
  198. })
  199. }
  200. })
  201. },
  202. operate(){
  203. var that = this
  204. wx.chooseImage({
  205. success: function(res) {
  206. wx.uploadFile({
  207. url: 'https://www.zthymaoyi.com/upload/admin',
  208. filePath: res.tempFilePaths[0],
  209. name: 'file',
  210. success(res) {
  211. var data = res.data
  212. var strToObj = JSON.parse(data)
  213. that.operates = strToObj.url
  214. that.addressUrl[3] = strToObj.url
  215. that.certificatesFour = false
  216. }
  217. })
  218. }
  219. })
  220. },
  221. }
  222. }
  223. </script>
  224. <style lang="scss" scoped>
  225. .center {
  226. padding: 10px 20px;
  227. background-color: #F5F6FA;
  228. }
  229. .picture{
  230. width: 100%;
  231. height: 220px;
  232. text-align: center;
  233. margin-top: 10px;
  234. }
  235. .btn {
  236. margin-top: 10px;
  237. background-color: #FFFFFF;
  238. border-radius: 25px;
  239. border: none;
  240. }
  241. .btns{
  242. background-color: #22C572;
  243. }
  244. .words{
  245. font-size: 18px;
  246. font-weight: 600;
  247. color: #617E8B;
  248. }
  249. .floats{
  250. position: relative;
  251. top: -150px;
  252. }
  253. </style>