illegalcheck.vue 7.7 KB

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