You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

drivingLicense.vue 3.6KB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div>
  3. <custom-header title="车辆信息" :back="config.hasReturn === 'true'"></custom-header>
  4. <div style="padding: 20rpx 0" v-if='isShow'>
  5. <form-builder-vue :formData.value="formData" :config="config" @uploadImgOcr="uploadImg" @submit="submit">
  6. </form-builder-vue>
  7. </div>
  8. </div>
  9. </template>
  10. <script setup lang='ts'>
  11. import {
  12. unifyTemplate
  13. } from '@/hooks/unifyTemplate'
  14. // import Agreement from '@/components/Agreement.vue';
  15. import {
  16. TypeData,
  17. Index
  18. } from '@/components/form-builder/tools'
  19. // import {
  20. // IdCard
  21. // } from '../../static/data/testData.js'
  22. import {
  23. reactive,
  24. ref,
  25. nextTick
  26. } from 'vue'
  27. import {
  28. onLoad
  29. } from '@dcloudio/uni-app';
  30. import {
  31. request
  32. } from '@/utils/network/request'
  33. import ocrHandle from './ocrHandle'
  34. import fromData from './fromData.js'
  35. const {
  36. formBuilderVue, //组件
  37. CustomHeader, //头部组件
  38. initData, //初始化数据
  39. isShow, //是否展示formBuilderVue组件
  40. qdOrderVal //qdOrder中数据 ref
  41. } = unifyTemplate() //初始化数据
  42. onLoad((opin) => {
  43. // 初始化数据
  44. initData(opin, 2).then(data => {
  45. formData.value = JSON.parse(data.config.tableConfig)
  46. nextTick(() => {
  47. submitQuery.channelId = data.qdOrder.promoterChannelNum + '00000001'
  48. if (qdOrderVal.value.vanType == 1) {
  49. // 客车
  50. checkCarTpe(true)
  51. submitQuery.type = 1
  52. } else {
  53. // 货车
  54. checkCarTpe(false)
  55. isTractorHandle(data.qdOrder.isTractor)
  56. submitQuery.type = 2
  57. }
  58. isShow.value = true
  59. })
  60. delete data.config.tableConfig
  61. config.value = Object.assign(data.config, config.value)
  62. })
  63. })
  64. function isTractorHandle(isTractor: number) {
  65. const index = Index('车辆用户类型', formData.value);
  66. if (isTractor === 0) {
  67. formData.value[index].disabled = false
  68. }
  69. }
  70. // 货车或者客车切换
  71. function checkCarTpe(key) {
  72. // true为客车,false为货车
  73. formData.value[Index('总质量(kg)', formData.value)].show = key
  74. formData.value[Index('整备质量(kg)', formData.value)].show = key
  75. formData.value[Index('核定载质量(kg)', formData.value)].show = key
  76. formData.value[Index('准牵引总质量(kg)', formData.value)].show = key
  77. formData.value[Index('车轴数', formData.value)].show = key
  78. const dataItem = formData.value[Index('车辆用户类型', formData.value)]
  79. dataItem.disabled = true
  80. dataItem[dataItem.value] = 0;
  81. }
  82. let config = ref < any > ({
  83. submitName: '下一步',
  84. titleWidth: 250,
  85. isHeader: true
  86. })
  87. let formData = ref < any > (fromData)
  88. // ocr图片处理和额外请求参数处理
  89. const {
  90. uploadImgHandle,
  91. submitQuery
  92. } = ocrHandle()
  93. function uploadImg(fileList, item) {
  94. uploadImgHandle(fileList, item, formData)
  95. }
  96. function submit(item: any) {
  97. let vehicleColor = qdOrderVal.value.vehicleColor
  98. const dataItem = formData.value[Index('车牌号', formData.value)];
  99. let vehiclePlate = dataItem[dataItem.value]
  100. // console.log(qdOrderVal.value.vehiclePlate, vehiclePlate);
  101. submitQuery.vehicleId =
  102. vehiclePlate + "_" + vehicleColor;
  103. const orderId = qdOrderVal.value.qtOrderNo
  104. let data = {
  105. ...item,
  106. orderId
  107. }
  108. for (let dataItem in submitQuery) {
  109. if (submitQuery[dataItem] || submitQuery[dataItem] === 0 && !data[dataItem]) {
  110. data[dataItem] = submitQuery[dataItem]
  111. }
  112. }
  113. let {
  114. commitInterface,
  115. jumpPage
  116. } = config.value
  117. request(commitInterface || '18', {
  118. data,
  119. }).then((res) => {
  120. if (res.statusCode === 0) {
  121. uni.navigateTo({
  122. url: '/' + jumpPage,
  123. animationType: 'pop-in',
  124. animationDuration: 500
  125. })
  126. }
  127. })
  128. }
  129. </script>
  130. <style lang='scss' scoped>
  131. </style>