driverIdentityThree.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. if (this.addressUrl[0] == "" || this.addressUrl[0] == null) {
  73. console.log(this.addressUrl)
  74. this.$api.msg('请上传行驶证!')
  75. return
  76. }
  77. if (this.addressUrl[1] == "" || this.addressUrl[1] == null) {
  78. console.log(this.addressUrl)
  79. this.$api.msg('请上传驾驶证!')
  80. return
  81. }
  82. if (this.addressUrl[2] == "" || this.addressUrl[2] == null) {
  83. console.log(this.addressUrl)
  84. this.$api.msg('请上传道路运营证!')
  85. return
  86. }
  87. if (this.addressUrl[3] == "" || this.addressUrl[3] == null) {
  88. console.log(this.addressUrl)
  89. this.$api.msg('请上传从业资格证')
  90. return
  91. }
  92. this.DriverViewInfo.addressUrl = this.addressUrl.toString()
  93. this.DriverViewInfo.commonId = this.userInfo.id
  94. this.DriverViewInfo.pcFlag = 0
  95. this.DriverViewInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  96. console.log(this.DriverViewInfo,"司机对象")
  97. return
  98. this.$api.doRequest('post', '/driverViewInfo/api/addInfo', this.DriverViewInfo).then(res => {
  99. }).catch(res => {
  100. uni.showToast({
  101. title: res.data.message,
  102. icon: 'none',
  103. duration: 2000
  104. })
  105. })
  106. },
  107. travel(){
  108. var that = this
  109. wx.chooseImage({
  110. success: function(res) {
  111. wx.uploadFile({
  112. url: 'https://www.zthymaoyi.com/upload/admin',
  113. filePath: res.tempFilePaths[0],
  114. name: 'file',
  115. success(res) {
  116. var data = res.data
  117. var strToObj = JSON.parse(data)
  118. that.travels = strToObj.url
  119. that.addressUrl[0] = strToObj.url
  120. that.certificates = false
  121. }
  122. })
  123. }
  124. })
  125. },
  126. drive(){
  127. var that = this
  128. wx.chooseImage({
  129. success: function(res) {
  130. wx.uploadFile({
  131. url: 'https://www.zthymaoyi.com/upload/admin',
  132. filePath: res.tempFilePaths[0],
  133. name: 'file',
  134. success(res) {
  135. var data = res.data
  136. var strToObj = JSON.parse(data)
  137. that.drives = strToObj.url
  138. that.addressUrl[1] = strToObj.url
  139. that.certificatesTwo = false
  140. }
  141. })
  142. }
  143. })
  144. },
  145. practice(){
  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.practices = strToObj.url
  157. that.addressUrl[2] = strToObj.url
  158. that.certificatesThree = false
  159. }
  160. })
  161. }
  162. })
  163. },
  164. operate(){
  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.operates = strToObj.url
  176. that.addressUrl[3] = strToObj.url
  177. that.certificatesFour = false
  178. }
  179. })
  180. }
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style lang="scss" scoped>
  187. .center {
  188. padding: 10px 20px;
  189. background-color: #F5F6FA;
  190. }
  191. .picture{
  192. width: 100%;
  193. height: 220px;
  194. text-align: center;
  195. margin-top: 10px;
  196. }
  197. .btn {
  198. margin-top: 10px;
  199. background-color: #FFFFFF;
  200. border-radius: 25px;
  201. border: none;
  202. }
  203. .btns{
  204. background-color: #22C572;
  205. }
  206. .words{
  207. font-size: 18px;
  208. font-weight: 600;
  209. color: #617E8B;
  210. }
  211. .floats{
  212. position: relative;
  213. top: -150px;
  214. }
  215. </style>