driverIdentityThree.vue 7.3 KB

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