driverIdentityThree.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. console.log(this.DriverViewInfo,"司机对象")
  98. this.$api.doRequest('post', '/driverViewInfo/api/addInfo', this.DriverViewInfo).then(res => {
  99. if(res.data.code=='ERROR001'){
  100. uni.showModal({
  101. title: '提示',
  102. content: '该手机号已认证过司机,再次认证将覆盖之前的认证信息,是否确定认证?',
  103. success: function (res) {
  104. if (res.confirm) {
  105. that.DriverViewInfo.cover=1
  106. that.$api.doRequest('post', '/driverViewInfo/api/editInfo', that.DriverViewInfo).then(res => {
  107. }).catch(res => {
  108. uni.showToast({
  109. title: '提交成功',
  110. icon: 'none',
  111. duration: 2000
  112. })
  113. })
  114. } else if (res.cancel) {
  115. uni.showToast({
  116. title: '提交失败',
  117. icon: 'none',
  118. duration: 2000
  119. })
  120. }
  121. }
  122. });
  123. }else if(res.data.code==200){
  124. uni.showToast({
  125. title: '提交成功',
  126. icon: 'none',
  127. duration: 2000
  128. })
  129. }
  130. }).catch(res => {
  131. uni.showToast({
  132. title: res.data.message,
  133. icon: 'none',
  134. duration: 2000
  135. })
  136. })
  137. },
  138. travel(){
  139. var that = this
  140. wx.chooseImage({
  141. success: function(res) {
  142. wx.uploadFile({
  143. url: 'https://www.zthymaoyi.com/upload/admin',
  144. filePath: res.tempFilePaths[0],
  145. name: 'file',
  146. success(res) {
  147. var data = res.data
  148. var strToObj = JSON.parse(data)
  149. that.travels = strToObj.url
  150. that.addressUrl[0] = strToObj.url
  151. that.certificates = false
  152. }
  153. })
  154. }
  155. })
  156. },
  157. drive(){
  158. var that = this
  159. wx.chooseImage({
  160. success: function(res) {
  161. wx.uploadFile({
  162. url: 'https://www.zthymaoyi.com/upload/admin',
  163. filePath: res.tempFilePaths[0],
  164. name: 'file',
  165. success(res) {
  166. var data = res.data
  167. var strToObj = JSON.parse(data)
  168. that.drives = strToObj.url
  169. that.addressUrl[1] = strToObj.url
  170. that.certificatesTwo = false
  171. }
  172. })
  173. }
  174. })
  175. },
  176. practice(){
  177. var that = this
  178. wx.chooseImage({
  179. success: function(res) {
  180. wx.uploadFile({
  181. url: 'https://www.zthymaoyi.com/upload/admin',
  182. filePath: res.tempFilePaths[0],
  183. name: 'file',
  184. success(res) {
  185. var data = res.data
  186. var strToObj = JSON.parse(data)
  187. that.practices = strToObj.url
  188. that.addressUrl[2] = strToObj.url
  189. that.certificatesThree = false
  190. }
  191. })
  192. }
  193. })
  194. },
  195. operate(){
  196. var that = this
  197. wx.chooseImage({
  198. success: function(res) {
  199. wx.uploadFile({
  200. url: 'https://www.zthymaoyi.com/upload/admin',
  201. filePath: res.tempFilePaths[0],
  202. name: 'file',
  203. success(res) {
  204. var data = res.data
  205. var strToObj = JSON.parse(data)
  206. that.operates = strToObj.url
  207. that.addressUrl[3] = strToObj.url
  208. that.certificatesFour = false
  209. }
  210. })
  211. }
  212. })
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. .center {
  219. padding: 10px 20px;
  220. background-color: #F5F6FA;
  221. }
  222. .picture{
  223. width: 100%;
  224. height: 220px;
  225. text-align: center;
  226. margin-top: 10px;
  227. }
  228. .btn {
  229. margin-top: 10px;
  230. background-color: #FFFFFF;
  231. border-radius: 25px;
  232. border: none;
  233. }
  234. .btns{
  235. background-color: #22C572;
  236. }
  237. .words{
  238. font-size: 18px;
  239. font-weight: 600;
  240. color: #617E8B;
  241. }
  242. .floats{
  243. position: relative;
  244. top: -150px;
  245. }
  246. </style>