illegalcheck.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="check">
  3. <view class="cbox">
  4. <view class="chtop flexc">
  5. <image :src="line"></image>
  6. <view>车辆信息</view>
  7. </view>
  8. <view class="chmain">
  9. <view class="upbox" @click="getaddImage">
  10. <image :src="baseUrl+datainfo.front" class="img" v-if="datainfo.front"></image>
  11. <image :src="car" class="addimg"></image>
  12. <view>拍摄车辆照片自动识别</view>
  13. </view>
  14. <uni-forms ref="form" :model="datainfo">
  15. <uni-forms-item label="车牌号码" name="realName">
  16. <uni-easyinput v-model="datainfo.realName" disabled :inputBorder='false' placeholder="自动识别" />
  17. </uni-forms-item>
  18. <uni-forms-item label="手机号码" name="phonenumber">
  19. <uni-easyinput v-model="datainfo.phonenumber" disabled :inputBorder='false' placeholder="自动识别" />
  20. </uni-forms-item>
  21. <uni-forms-item label="关联房号" name="phonenumber">
  22. <uni-easyinput v-model="datainfo.phonenumber" disabled :inputBorder='false' placeholder="自动识别" />
  23. </uni-forms-item>
  24. <view class="imgs">
  25. <view class="img" @click="getPreview">
  26. <image :src="car" class="pico"></image>
  27. <image :src="del" class="del" @click="getDelFn"></image>
  28. </view>
  29. </view>
  30. </uni-forms>
  31. <view class="rhbtn mt63" @click="getNext">确定</view>
  32. </view>
  33. </view>
  34. <loading></loading>
  35. </view>
  36. </template>
  37. <script>
  38. import config from '@/config'
  39. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  40. import {uploadIdentify} from '@/utils/common.js'
  41. export default{
  42. components:{},
  43. data(){
  44. return{
  45. line:require('@/work/static/car/line.png'),
  46. car:require('@/work/static/car/carico.png'),
  47. del:require('@/work/static/car/del.png'),
  48. baseUrl:config.baseUrl,
  49. datainfo:{
  50. realName:'',
  51. idCard:'',
  52. address:'',
  53. expirationDate:'',
  54. phonenumber:'',
  55. front:'',
  56. back:'',
  57. },
  58. }
  59. },
  60. onLoad: function() {
  61. },
  62. methods:{
  63. checkPermi, checkRole,
  64. getPreview(idx,arr) {
  65. var newArr=[];
  66. arr.forEach(ite=>{
  67. var ds=this.baseUrl+ite
  68. newArr.push(ds)
  69. })
  70. uni.previewImage({
  71. urls: newArr,
  72. current:idx,
  73. success: function(data) {},
  74. fail: function(err) {}
  75. });
  76. },
  77. getDelFn(){
  78. var that=this;
  79. uni.showModal({
  80. title: '确认删除',
  81. content: "是否确认删除",
  82. cancelText: '取消',
  83. confirmText: '确认',
  84. success: function(res) {
  85. if (res.confirm) {
  86. // that.filelist.splice(idx,1)
  87. } else if (res.cancel) {
  88. }
  89. }
  90. });
  91. },
  92. getaddImage(e){
  93. let that = this;
  94. // var rs=['D:\\idcard.png']
  95. // if(rs&&rs.length>0){
  96. // var obj={
  97. // type:e,
  98. // // url:baseUrl+rs.join(',')
  99. // url:rs.join(',')
  100. // }
  101. // that.getOcrIdCard(obj)
  102. // }
  103. // return
  104. let file =[],count=9
  105. uni.chooseImage({
  106. count: 1,
  107. success:function(res){
  108. let img= res.tempFilePaths;
  109. if(img.length + file.length > count){
  110. uni.showToast({
  111. title: '最多上传'+count+'张图片',
  112. icon: 'none',
  113. duration: 2000
  114. })
  115. }else{
  116. let imglen = res.tempFilePaths.length;
  117. var fuwufile = [];
  118. uploadIdentify('/common/upload',img,0,0,0,imglen,fuwufile,function(rs){
  119. var resurl=rs[0];
  120. if(e=='front'){
  121. that.datainfo.front=resurl.fileName;
  122. }else{
  123. that.datainfo.back=resurl.fileName;
  124. }
  125. if(rs&&rs.length>0){
  126. var obj={
  127. type:e,
  128. url:resurl.urlOnline
  129. }
  130. that.getOcrIdCard(obj)
  131. }
  132. })
  133. }
  134. }
  135. });
  136. },
  137. getOcrIdCard(obj){
  138. var params={
  139. image:obj.url,
  140. idCardSide:obj.type
  141. }
  142. getOcrIdCard(params).then(res=>{
  143. if(res.code==200){
  144. var datainfo=res.data;
  145. if(obj.type=='front'){
  146. this.datainfo.realName=datainfo.realName;
  147. this.datainfo.idCard=datainfo.idCard;
  148. this.datainfo.address=datainfo.address;
  149. }else{
  150. this.datainfo.expirationDate=datainfo.expirationDate
  151. }
  152. }
  153. })
  154. }
  155. }
  156. }
  157. </script>
  158. <style>
  159. page{background: #F3F3F0;}
  160. </style>
  161. <style lang="scss" scoped>
  162. .check /deep/ .uni-forms-item{min-height: 106rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:10rpx 0;}
  163. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  164. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  165. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  166. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  167. .check /deep/ .uni-input-input{font-size: 26rpx;}
  168. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  169. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  170. .check{min-height: 100vh;padding: 20rpx 24rpx 24rpx;box-sizing: border-box;display: flex;box-sizing: border-box;}
  171. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;padding-bottom: 32rpx;
  172. .chtop{padding-top: 32rpx;margin-bottom: 32rpx;
  173. image{width: 14rpx;height: 48rpx;margin-right: 20rpx;}
  174. view{font-weight: bold;font-size: 32rpx;color: #272727;}
  175. }
  176. .chmain{
  177. padding: 0 24rpx;
  178. .upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
  179. .img{width: 100%;height: 100%;}
  180. .addimg{width: 70rpx;height: 70rpx;margin-bottom: 16rpx;}
  181. view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
  182. }
  183. .imgs{display: flex;align-items: center;flex-wrap: wrap;margin-top: 40rpx;
  184. .img{width: 142rpx;height:142rpx;border-radius: 20rpx;margin: 0 28rpx 20rpx 0;position: relative;
  185. &:nth-of-type(4n){margin-right: 0;}
  186. }
  187. .pico{width: 100%;height: 100%;border-radius: 20rpx;}
  188. .del{width: 24rpx;height: 24rpx;position: absolute;right: 0;top: 0;}
  189. }
  190. }
  191. }
  192. </style>