addcar.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="check">
  3. <view class="cbox">
  4. <view class="chtop flexc">
  5. <view class="line"></view>
  6. <view>车辆信息</view>
  7. </view>
  8. <view class="chmain">
  9. <uni-forms ref="form" :model="datainfo">
  10. <view class="upbox" @click="getaddImage">
  11. <image :src="baseUrl+datainfo.front" class="img" v-if="datainfo.front"></image>
  12. <image :src="cmico" class="addimg"></image>
  13. <view>扫描行驶证自动填写</view>
  14. </view>
  15. <view class="carcode">
  16. <view class="tit mb16 lh18"><text class="cof4">*</text>车牌号码</view>
  17. <view>需车牌插件</view>
  18. </view>
  19. <block v-if="zhanfalg">
  20. <uni-forms-item label="品牌车型" name="realName">
  21. <picker range-key='text' :value="syqxidx" :range="sexs" @change='bindDateChange'>
  22. <view class="flexc">
  23. <view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'请选择品牌车型'}}</view>
  24. <view class="rimg"><image :src="rimg"></image></view>
  25. </view>
  26. </picker>
  27. </uni-forms-item>
  28. <uni-forms-item label="车辆类型" name="realName">
  29. <picker range-key='text' :value="syqxidx" :range="sexs" @change='bindDateChange'>
  30. <view class="flexc">
  31. <view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'请选择车辆类型'}}</view>
  32. <view class="rimg"><image :src="rimg"></image></view>
  33. </view>
  34. </picker>
  35. </uni-forms-item>
  36. <picker range-key='text' :value="syqxidx" :range="sexs" @change='bindDateChange'>
  37. <uni-forms-item label="车辆颜色" name="phonenumber">
  38. <view class="flexc" @click.stop="">
  39. <uni-easyinput v-model="datainfo.phonenumber" :inputBorder='false' placeholder="请选择或输入车辆颜色" />
  40. <view class="rimg"><image :src="rimg"></image></view>
  41. </view>
  42. </uni-forms-item>
  43. </picker>
  44. </block>
  45. <view class="zhanbox flexcc" @click="zhanfalg=!zhanfalg">
  46. {{zhanfalg?"折叠信息":'展开信息'}}<image :class="!zhanfalg?'act':''" :src="upimg"></image>
  47. </view>
  48. </uni-forms>
  49. <view class="rhbtn mt30" @click="getNext">确定添加</view>
  50. </view>
  51. </view>
  52. <loading></loading>
  53. </view>
  54. </template>
  55. <script>
  56. import config from '@/config'
  57. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  58. import {uploadIdentify} from '@/utils/common.js'
  59. export default{
  60. components:{},
  61. data(){
  62. return{
  63. rimg: require('@/mine/static/house/rimg.png'),
  64. cmico:require('@/mine/static/house/cmico.png'),
  65. upimg:require('@/mine/static/house/up.png'),
  66. baseUrl:config.baseUrl,
  67. datainfo:{
  68. realName:'',
  69. idCard:'',
  70. address:'',
  71. expirationDate:'',
  72. phonenumber:'',
  73. front:'',
  74. back:'',
  75. },
  76. zhanfalg:true,
  77. syqxidx:'',
  78. sexs: [{
  79. text: '男',
  80. value: 0
  81. }, {
  82. text: '女',
  83. value: 1
  84. }],
  85. }
  86. },
  87. onLoad: function() {
  88. },
  89. methods:{
  90. checkPermi, checkRole,
  91. getaddImage(e){
  92. let that = this;
  93. // var rs=['D:\\idcard.png']
  94. // if(rs&&rs.length>0){
  95. // var obj={
  96. // type:e,
  97. // // url:baseUrl+rs.join(',')
  98. // url:rs.join(',')
  99. // }
  100. // that.getOcrIdCard(obj)
  101. // }
  102. // return
  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. uploadIdentify('/common/upload',img,0,0,0,imglen,fuwufile,function(rs){
  118. var resurl=rs[0];
  119. if(e=='front'){
  120. that.datainfo.front=resurl.fileName;
  121. }else{
  122. that.datainfo.back=resurl.fileName;
  123. }
  124. if(rs&&rs.length>0){
  125. var obj={
  126. type:e,
  127. url:resurl.urlOnline
  128. }
  129. that.getOcrIdCard(obj)
  130. }
  131. })
  132. }
  133. }
  134. });
  135. },
  136. getOcrIdCard(obj){
  137. var params={
  138. image:obj.url,
  139. idCardSide:obj.type
  140. }
  141. getOcrIdCard(params).then(res=>{
  142. if(res.code==200){
  143. var datainfo=res.data;
  144. if(obj.type=='front'){
  145. this.datainfo.realName=datainfo.realName;
  146. this.datainfo.idCard=datainfo.idCard;
  147. this.datainfo.address=datainfo.address;
  148. }else{
  149. this.datainfo.expirationDate=datainfo.expirationDate
  150. }
  151. }
  152. })
  153. }
  154. }
  155. }
  156. </script>
  157. <style>
  158. page{background: #F3F3F0;}
  159. </style>
  160. <style lang="scss" scoped>
  161. .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;}
  162. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  163. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  164. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  165. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  166. .check /deep/ .uni-input-input{font-size: 26rpx;}
  167. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  168. .check /deep/ .uni-forms-item__label text{width: 110rpx;text-align-last: justify;}
  169. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  170. .check{min-height: 100vh;padding: 20rpx 24rpx 28rpx;box-sizing: border-box;display: flex;box-sizing: border-box;}
  171. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;padding-bottom: 76rpx;
  172. .chtop{padding-top: 32rpx;margin-bottom: 22rpx;
  173. .line{width: 14rpx;height: 48rpx;background: #0256FD;border-radius:0 12rpx 12rpx 0;margin-right: 18rpx;}
  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: 44rpx;overflow: auto;
  179. .img{width: 100%;height: 100%;}
  180. .addimg{width: 90rpx;height: 90rpx;margin-bottom: 8rpx;}
  181. view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
  182. }
  183. .carcode{
  184. .tit{font-weight: bold;font-size: 26rpx;color: #272727;}
  185. }
  186. }
  187. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  188. image{width: 100%;height: 100%;}
  189. }
  190. .zhanbox{font-weight: 500;font-size: 24rpx;color: #AAAAAA;padding: 16rpx 0;margin-top: 20rpx;
  191. image{width: 20rpx;height: 12rpx;margin-left: 18rpx;transition: all 0.3s;
  192. &.act{transform: rotate(-180deg);}
  193. }
  194. }
  195. }
  196. .tips{font-weight: bold;color: #272727;font-size: 26rpx;margin-left: 8rpx;}
  197. </style>