driverIdentityThree.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. this.$api.msg('请上传行驶证!')
  75. return
  76. }
  77. if (this.addressUrl[1] == "" || this.addressUrl[1] == null) {
  78. this.$api.msg('请上传驾驶证!')
  79. return
  80. }
  81. if (this.addressUrl[2] == "" || this.addressUrl[2] == null) {
  82. this.$api.msg('请上传道路运营证!')
  83. return
  84. }
  85. if (this.addressUrl[3] == "" || this.addressUrl[3] == null) {
  86. this.$api.msg('请上传从业资格证')
  87. return
  88. }
  89. this.DriverViewInfo.addressUrl = this.addressUrl.toString()
  90. this.DriverViewInfo.commonId = this.userInfo.id
  91. this.DriverViewInfo.pcFlag = 0
  92. this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  93. var that = this
  94. uni.showModal({
  95. content: "确认提交司机信息?",
  96. showCancel: true,
  97. confirmText: '确定',
  98. success: function(res) {
  99. if (res.confirm) {
  100. that.$api.doRequest('post', '/driverViewInfo/api/addInfo', that.DriverViewInfo).then(res => {
  101. if(res.data.code=='ERROR001'){
  102. uni.showModal({
  103. title: '提示',
  104. content: '该手机号已认证过司机,再次认证将覆盖之前的认证信息,是否确定认证?',
  105. success: function (res) {
  106. if (res.confirm) {
  107. that.DriverViewInfo.cover=1
  108. that.$api.doRequest('post', '/driverViewInfo/api/editInfo', that.DriverViewInfo).then(res => {
  109. }).catch(res => {
  110. uni.showToast({
  111. title: '提交成功',
  112. icon: 'none',
  113. duration: 2000
  114. })
  115. uni.navigateTo({
  116. url: `/pages/attestation/indexThree`
  117. })
  118. })
  119. } else if (res.cancel) {
  120. uni.showToast({
  121. title: '提交失败',
  122. icon: 'none',
  123. duration: 2000
  124. })
  125. }
  126. }
  127. });
  128. }else if(res.data.code==200){
  129. uni.showToast({
  130. title: '提交成功',
  131. icon: 'none',
  132. duration: 2000
  133. })
  134. uni.navigateTo({
  135. url: `/pages/attestation/indexThree`
  136. })
  137. }
  138. }).catch(res => {
  139. uni.showToast({
  140. title: res.data.message,
  141. icon: 'none',
  142. duration: 2000
  143. })
  144. })
  145. } else if (res.cancel) {
  146. // console.log('用户点击取消');
  147. }
  148. },
  149. })
  150. },
  151. travel(){
  152. var that = this
  153. wx.chooseImage({
  154. success: function(res) {
  155. wx.uploadFile({
  156. url: 'https://www.zthymaoyi.com/upload/admin',
  157. filePath: res.tempFilePaths[0],
  158. name: 'file',
  159. success(res) {
  160. var data = res.data
  161. var strToObj = JSON.parse(data)
  162. that.travels = strToObj.url
  163. that.addressUrl[0] = strToObj.url
  164. that.certificates = false
  165. }
  166. })
  167. }
  168. })
  169. },
  170. drive(){
  171. var that = this
  172. wx.chooseImage({
  173. success: function(res) {
  174. wx.uploadFile({
  175. url: 'https://www.zthymaoyi.com/upload/admin',
  176. filePath: res.tempFilePaths[0],
  177. name: 'file',
  178. success(res) {
  179. var data = res.data
  180. var strToObj = JSON.parse(data)
  181. that.drives = strToObj.url
  182. that.addressUrl[1] = strToObj.url
  183. that.certificatesTwo = false
  184. }
  185. })
  186. }
  187. })
  188. },
  189. practice(){
  190. var that = this
  191. wx.chooseImage({
  192. success: function(res) {
  193. wx.uploadFile({
  194. url: 'https://www.zthymaoyi.com/upload/admin',
  195. filePath: res.tempFilePaths[0],
  196. name: 'file',
  197. success(res) {
  198. var data = res.data
  199. var strToObj = JSON.parse(data)
  200. that.practices = strToObj.url
  201. that.addressUrl[2] = strToObj.url
  202. that.certificatesThree = false
  203. }
  204. })
  205. }
  206. })
  207. },
  208. operate(){
  209. var that = this
  210. wx.chooseImage({
  211. success: function(res) {
  212. wx.uploadFile({
  213. url: 'https://www.zthymaoyi.com/upload/admin',
  214. filePath: res.tempFilePaths[0],
  215. name: 'file',
  216. success(res) {
  217. var data = res.data
  218. var strToObj = JSON.parse(data)
  219. that.operates = strToObj.url
  220. that.addressUrl[3] = strToObj.url
  221. that.certificatesFour = false
  222. }
  223. })
  224. }
  225. })
  226. },
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .center {
  232. padding: 10px 20px;
  233. background-color: #F5F6FA;
  234. }
  235. .picture{
  236. width: 100%;
  237. height: 220px;
  238. text-align: center;
  239. margin-top: 10px;
  240. }
  241. .btn {
  242. margin-top: 10px;
  243. background-color: #FFFFFF;
  244. border-radius: 25px;
  245. border: none;
  246. }
  247. .btns{
  248. background-color: #22C572;
  249. }
  250. .words{
  251. font-size: 18px;
  252. font-weight: 600;
  253. color: #617E8B;
  254. }
  255. .floats{
  256. position: relative;
  257. top: -150px;
  258. }
  259. </style>