vadd.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="check">
  3. <uni-forms ref="form" class="flex1" :model="datainfo">
  4. <view class="cbox">
  5. <view class="chtop flexc">
  6. <view class="line"></view>
  7. <view>访客信息</view>
  8. </view>
  9. <view class="chmain">
  10. <uni-forms-item label="访客姓名" name="realName">
  11. <view class="flexc">
  12. <uni-easyinput v-model="datainfo.realName" :inputBorder='false' placeholder="请输入访客姓名" />
  13. <uni-data-checkbox selectedColor="#0156FE" selectedTextColor="#272727" v-model="datainfo.sex" :localdata="sexs" />
  14. </view>
  15. </uni-forms-item>
  16. <uni-forms-item label="来访人数" name="phonenumber">
  17. <view class="flexc">
  18. <uni-easyinput v-model="datainfo.phonenumber" :inputBorder='false' placeholder="请输入来访人数" />
  19. <view class="rimg"><image :src="rimg"></image></view>
  20. </view>
  21. </uni-forms-item>
  22. <uni-forms-item label="来访事由" name="phonenumber">
  23. <view class="flexc">
  24. <uni-easyinput v-model="datainfo.phonenumber" :inputBorder='false' placeholder="请选择或输入来访事由" />
  25. <picker range-key='text' :value="syqxidx" :range="sexs" @change='bindDateChange'>
  26. <view class="rimg"><image :src="rimg"></image></view>
  27. </picker>
  28. </view>
  29. </uni-forms-item>
  30. <uni-forms-item label="来访时间" name="phonenumber">
  31. <uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick">
  32. <view class="flexc">
  33. <view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'请选择来访时间'}}</view>
  34. <view class="rimg"><image :src="rimg"></image></view>
  35. </view>
  36. </uni-datetime-picker>
  37. </uni-forms-item>
  38. <!-- <uni-forms-item label="来访门户" name="phonenumber">
  39. <view class="flexc">
  40. <uni-easyinput v-model="datainfo.phonenumber" :inputBorder='false' placeholder="请输入门户号" />
  41. <view class="rimg"></view>
  42. </view>
  43. </uni-forms-item> -->
  44. </view>
  45. </view>
  46. <view class="cbox">
  47. <view class="chtop flexc">
  48. <view class="line"></view>
  49. <view>驾车信息</view>
  50. </view>
  51. <view class="chmain">
  52. <uni-forms-item label="是否驾车" name="realName">
  53. <view class="flexc" @click="checkflag=!checkflag">
  54. <view class="flex1"></view>
  55. <image :src="check" v-if="checkflag" class="checkimg"></image>
  56. <image :src="ncheck" v-else class="checkimg"></image>
  57. </view>
  58. </uni-forms-item>
  59. <uni-forms-item label="车牌号码" name="phonenumber">
  60. <view class="flexc">
  61. <uni-easyinput v-model="datainfo.phonenumber" :inputBorder='false' placeholder="请输入车牌号码" />
  62. <view class="rimg"></view>
  63. </view>
  64. <!-- <view class="flexc">
  65. <uni-easyinput v-model="datainfo.phonenumber" disabled :inputBorder='false' placeholder="拍照自动识别" />
  66. <view class="aphoto" @click="getaddImage">
  67. <image :src="aphoto"></image>
  68. </view>
  69. </view> -->
  70. </uni-forms-item>
  71. <uni-forms-item label="手机号码" name="phonenumber">
  72. <view class="flexc">
  73. <uni-easyinput v-model="datainfo.phonenumber" :inputBorder='false' placeholder="请输入手机号码" />
  74. <view class="rimg"></view>
  75. </view>
  76. </uni-forms-item>
  77. <view class="tips">
  78. 如驾车,填写车牌后,访客到访时,车闸机自动打开
  79. </view>
  80. </view>
  81. </view>
  82. </uni-forms>
  83. <view class="pdlr12 flex0">
  84. <view class="rhbtn" @click="getNext">确定</view>
  85. </view>
  86. <loading></loading>
  87. </view>
  88. </template>
  89. <script>
  90. import config from '@/config'
  91. import {
  92. checkPermi,
  93. checkRole
  94. } from "@/utils/permission"; // 权限判断函数
  95. import {
  96. uploadIdentify
  97. } from '@/utils/common.js'
  98. export default {
  99. components: {},
  100. data() {
  101. return {
  102. rimg: require('@/static/images/rimg.png'),
  103. aphoto: require('@/work/static/visitor/aphoto.png'),
  104. check: require('@/mine/static/check.png'),
  105. ncheck: require('@/mine/static/ncheck.png'),
  106. baseUrl: config.baseUrl,
  107. checkflag:true,
  108. datainfo: {
  109. sex:0,
  110. realName: '',
  111. idCard: '',
  112. address: '',
  113. expirationDate: '',
  114. phonenumber: '',
  115. front: '',
  116. back: '',
  117. },
  118. syqxidx:'',
  119. sexs: [{
  120. text: '男',
  121. value: 0
  122. }, {
  123. text: '女',
  124. value: 1
  125. }],
  126. }
  127. },
  128. onLoad: function() {
  129. },
  130. methods: {
  131. checkPermi,
  132. checkRole,
  133. bindDateChange(e){
  134. var val=e.detail.value;
  135. // this.datainfo.applicationBank=this.sdyhlist[val].value;
  136. // this.applicationBank=this.sdyhlist[val].label;
  137. },
  138. getaddImage(e) {
  139. let that = this;
  140. // var rs=['D:\\idcard.png']
  141. // if(rs&&rs.length>0){
  142. // var obj={
  143. // type:e,
  144. // // url:baseUrl+rs.join(',')
  145. // url:rs.join(',')
  146. // }
  147. // that.getOcrIdCard(obj)
  148. // }
  149. // return
  150. let file = [],
  151. count = 9
  152. uni.chooseImage({
  153. count: 1,
  154. success: function(res) {
  155. let img = res.tempFilePaths;
  156. if (img.length + file.length > count) {
  157. uni.showToast({
  158. title: '最多上传' + count + '张图片',
  159. icon: 'none',
  160. duration: 2000
  161. })
  162. } else {
  163. let imglen = res.tempFilePaths.length;
  164. var fuwufile = [];
  165. uploadIdentify('/common/upload', img, 0, 0, 0, imglen, fuwufile, function(rs) {
  166. var resurl = rs[0];
  167. if (e == 'front') {
  168. that.datainfo.front = resurl.fileName;
  169. } else {
  170. that.datainfo.back = resurl.fileName;
  171. }
  172. if (rs && rs.length > 0) {
  173. var obj = {
  174. type: e,
  175. url: resurl.urlOnline
  176. }
  177. that.getOcrIdCard(obj)
  178. }
  179. })
  180. }
  181. }
  182. });
  183. },
  184. getOcrIdCard(obj) {
  185. var params = {
  186. image: obj.url,
  187. idCardSide: obj.type
  188. }
  189. getOcrIdCard(params).then(res => {
  190. if (res.code == 200) {
  191. var datainfo = res.data;
  192. if (obj.type == 'front') {
  193. this.datainfo.realName = datainfo.realName;
  194. this.datainfo.idCard = datainfo.idCard;
  195. this.datainfo.address = datainfo.address;
  196. } else {
  197. this.datainfo.expirationDate = datainfo.expirationDate
  198. }
  199. }
  200. })
  201. }
  202. }
  203. }
  204. </script>
  205. <style>
  206. page{background: #F3F3F0;}
  207. </style>
  208. <style lang="scss" scoped>
  209. .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;}
  210. .check .cbox /deep/ .uni-forms-item:last-child{border: none;}
  211. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  212. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  213. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  214. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  215. .check /deep/ .uni-input-input{font-size: 26rpx;}
  216. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  217. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  218. .check /deep/ .uni-data-checklist .checklist-group .checklist-box{margin:10rpx 8rpx 10rpx 16rpx;}
  219. .check /deep/ .uni-data-checklist{flex: 0 0 auto;}
  220. .check{min-height: 100vh;padding: 20rpx 18rpx 100rpx;box-sizing: border-box;display: flex;flex-direction: column;}
  221. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;margin-bottom: 24rpx;
  222. .chtop{padding-top: 32rpx;margin-bottom: 8rpx;
  223. image{width: 14rpx;height: 48rpx;margin-right: 20rpx;}
  224. view{font-weight: bold;font-size: 32rpx;color: #272727;}
  225. }
  226. .chmain{
  227. padding: 0 32rpx;
  228. .upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
  229. .img{width: 100%;height: 100%;}
  230. .addimg{width: 70rpx;height: 70rpx;margin-bottom: 16rpx;}
  231. view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
  232. }
  233. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  234. image{width: 100%;height: 100%;}
  235. }
  236. .checkimg{width: 80rpx;height: 40rpx;margin-right: 8rpx;}
  237. .aphoto{padding: 0 24rpx;border-left: 2rpx solid #e6e6e6;margin-left: 26rpx;
  238. image{width: 40rpx;height: 38rpx;}
  239. }
  240. }
  241. .line{width: 14rpx;height: 48rpx;background: #0256FD;border-radius:0 12rpx 12rpx 0;margin-right: 18rpx;}
  242. .tips{font-weight: 500;font-size: 22rpx;color: #0256FD;padding: 20rpx 0;}
  243. }
  244. </style>