illegalcheck.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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="getaddImagea">
  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. <!-- disabled -->
  16. <uni-forms-item label="车牌号码" name="plateNumber">
  17. <uni-easyinput v-model="datainfo.plateNumber" disabled :inputBorder='false' placeholder="自动识别" />
  18. </uni-forms-item>
  19. <uni-forms-item label="手机号码" name="mobileNumber">
  20. <uni-easyinput v-model="datainfo.mobileNumber" disabled :inputBorder='false' placeholder="自动识别" />
  21. </uni-forms-item>
  22. <uni-forms-item label="关联房号" name="visitPortal">
  23. <uni-easyinput v-model="datainfo.visitPortal" disabled :inputBorder='false' placeholder="自动识别" />
  24. </uni-forms-item>
  25. <view class="imgs">
  26. <block v-if="phofile&&phofile.length">
  27. <view class="img" v-for="(ite,idx) in phofile" :key="idx" @click="getPreview(idx,phofile)">
  28. <image :src="baseUrl+ite" class="pico"></image>
  29. <image :src="del" class="del" @click.stop="getDelFn(idx)"></image>
  30. </view>
  31. </block>
  32. <view class="addbox" @click="getaddImage">
  33. <image :src="photo" class="pico"></image>
  34. <view>添加图片</view>
  35. </view>
  36. </view>
  37. </uni-forms>
  38. <view class="rhbtn mt63" @click="getSubmit">确定</view>
  39. </view>
  40. </view>
  41. <loading></loading>
  42. </view>
  43. </template>
  44. <script>
  45. import config from '@/config.js'
  46. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  47. import {uploadIdentify,uploadmore} from '@/utils/common.js'
  48. import {illegalParkingAdd} from "@/api/work/car.js"
  49. import {getlicensePlate} from "@/api/system/card.js"
  50. import {carList} from "@/api/work/car.js"
  51. export default{
  52. components:{},
  53. data(){
  54. return{
  55. photo:require("@/service/static/service/photo.png"),
  56. line:require('@/car/static/car/line.png'),
  57. car:require('@/car/static/car/carico.png'),
  58. del:require('@/car/static/car/del.png'),
  59. baseUrl:config.baseUrl,
  60. phofile:[],//图片合集
  61. datainfo:{
  62. "plateNumber": "",
  63. "houseId": "",
  64. "visitPortal": "",
  65. "mobileNumber": "",
  66. "carType": "2",
  67. "illegalPhoto": "",
  68. },
  69. }
  70. },
  71. onLoad: function() {
  72. },
  73. methods:{
  74. checkPermi, checkRole,
  75. getPreview(idx,arr) {
  76. var newArr=[];
  77. arr.forEach(ite=>{
  78. var ds=this.baseUrl+ite
  79. newArr.push(ds)
  80. })
  81. uni.previewImage({
  82. urls: newArr,
  83. current:idx,
  84. success: function(data) {},
  85. fail: function(err) {}
  86. });
  87. },
  88. getDelFn(idx){
  89. var that=this;
  90. uni.showModal({
  91. title: '确认删除',
  92. content: "是否确认删除",
  93. cancelText: '取消',
  94. confirmText: '确认',
  95. success: function(res) {
  96. if (res.confirm) {
  97. that.phofile.splice(idx,1)
  98. } else if (res.cancel) {
  99. }
  100. }
  101. });
  102. },
  103. getaddImage(e){
  104. let that = this;
  105. let file =[],count=9
  106. uni.chooseImage({
  107. // count: 1,
  108. success:function(res){
  109. let img= res.tempFilePaths;
  110. if(img.length + file.length > count){
  111. uni.showToast({
  112. title: '最多上传'+count+'张图片',
  113. icon: 'none',
  114. duration: 2000
  115. })
  116. }else{
  117. let imglen = res.tempFilePaths.length;
  118. var fuwufile = [];
  119. uploadmore('/common/upload',img,0,0,0,imglen,fuwufile,function(rs){
  120. that.phofile = that.phofile.concat(rs);
  121. })
  122. }
  123. }
  124. });
  125. },
  126. getSubmit(){
  127. var that=this;
  128. var params=JSON.parse(JSON.stringify(this.datainfo))
  129. var phofile=JSON.parse(JSON.stringify(this.phofile))
  130. if(phofile&&phofile.length){
  131. params.illegalPhoto=this.phofile.join(',');
  132. }
  133. // console.log(params)
  134. // return
  135. illegalParkingAdd(params).then(res=>{
  136. if(res.code==200){
  137. this.$toast("新增成功")
  138. setTimeout(function(){
  139. uni.$emit("refCarPark")
  140. uni.navigateBack({
  141. delta:1
  142. })
  143. },1500)
  144. }
  145. })
  146. },
  147. getcarList(car){
  148. var params={
  149. plateNumber:car
  150. }
  151. carList(params).then(res=>{
  152. if(res.code==200){
  153. if(res.rows&&res.rows.length){
  154. var data=res.rows[0];
  155. this.datainfo.carType='1';
  156. this.datainfo.mobileNumber=data.residentPhone;
  157. this.datainfo.visitPortal=data.detailedAddress;
  158. this.datainfo.houseId=data.houseId;
  159. }
  160. }
  161. })
  162. },
  163. getaddImagea(e){
  164. let that = this;
  165. let file =[],count=9
  166. uni.chooseImage({
  167. count: 1,
  168. success:function(res){
  169. let img= res.tempFilePaths;
  170. if(img.length + file.length > count){
  171. uni.showToast({
  172. title: '最多上传'+count+'张图片',
  173. icon: 'none',
  174. duration: 2000
  175. })
  176. }else{
  177. let imglen = res.tempFilePaths.length;
  178. var fuwufile = [];
  179. uploadIdentify('/common/upload',img,0,0,0,imglen,fuwufile,function(rs){
  180. var resurl=rs[0];
  181. if(rs&&rs.length>0){
  182. var obj={
  183. url:resurl.urlOnline
  184. }
  185. that.getOcrIdCard(obj)
  186. }
  187. })
  188. }
  189. }
  190. });
  191. },
  192. getOcrIdCard(obj){
  193. var params={
  194. image:obj.url,
  195. }
  196. getlicensePlate(params).then(res=>{
  197. if(res.code==200){
  198. var code=res.msg;
  199. if(code){
  200. this.datainfo.plateNumber=code;
  201. this.getcarList(code)
  202. }
  203. // if(obj.type=='front'){
  204. // this.datainfo.realName=datainfo.realName;
  205. // this.datainfo.idCard=datainfo.idCard;
  206. // this.datainfo.address=datainfo.address;
  207. // }else{
  208. // this.datainfo.expirationDate=datainfo.expirationDate
  209. // }
  210. }
  211. })
  212. }
  213. }
  214. }
  215. </script>
  216. <style>
  217. page{background: #F3F3F0;}
  218. </style>
  219. <style lang="scss" scoped>
  220. .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;}
  221. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  222. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  223. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  224. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  225. .check /deep/ .uni-input-input{font-size: 26rpx;}
  226. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  227. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  228. .check{min-height: 100vh;padding: 20rpx 24rpx 24rpx;box-sizing: border-box;display: flex;box-sizing: border-box;}
  229. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;padding-bottom: 32rpx;
  230. .chtop{padding-top: 32rpx;margin-bottom: 32rpx;
  231. image{width: 14rpx;height: 48rpx;margin-right: 20rpx;}
  232. view{font-weight: bold;font-size: 32rpx;color: #272727;}
  233. }
  234. .chmain{
  235. padding: 0 24rpx;
  236. .upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
  237. .img{width: 100%;height: 100%;}
  238. .addimg{width: 70rpx;height: 70rpx;margin-bottom: 16rpx;}
  239. view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
  240. }
  241. .imgs{display: flex;align-items: center;flex-wrap: wrap;margin-top: 40rpx;
  242. .img{width: 142rpx;height:142rpx;border-radius: 20rpx;margin: 0 28rpx 20rpx 0;position: relative;
  243. &:nth-of-type(4n){margin-right: 0;}
  244. }
  245. .pico{width: 100%;height: 100%;border-radius: 20rpx;}
  246. .del{width: 24rpx;height: 24rpx;position: absolute;right: 0;top: 0;}
  247. .addbox{background: #F0F0F0;border-radius: 20rpx;display: flex;align-items: center;flex-direction: column;width: 142rpx;height:142rpx;justify-content: center;margin-bottom: 20rpx;
  248. image{width: 48rpx;height: 42rpx;margin-bottom: 12rpx;}
  249. view{font-weight: 500;font-size: 24rpx;color: #666666;}
  250. }
  251. }
  252. }
  253. }
  254. </style>