comeadd.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="check">
  3. <uni-forms ref="form" :model="datainfo">
  4. <view class="cbox">
  5. <view class="chtop flexc">
  6. <image :src="line"></image>
  7. <view>访客信息</view>
  8. </view>
  9. <view class="chmain">
  10. <uni-forms-item label="访客姓名" name="name">
  11. <view class="flexc">
  12. <uni-easyinput v-model="datainfo.name" :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="num">
  17. <view class="flexc">
  18. <uni-easyinput v-model="datainfo.num" type="Number" :inputBorder='false' placeholder="请输入来访人数" />
  19. <view class="rimg"><image :src="rimg"></image></view>
  20. </view>
  21. </uni-forms-item>
  22. <uni-forms-item label="来访事由" name="reason">
  23. <view class="flexc">
  24. <uni-easyinput v-model="datainfo.reason" :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="houseAddress">
  31. <view class="flexc">
  32. <uni-easyinput v-model="datainfo.houseAddress" :inputBorder='false' placeholder="请输入门户号" />
  33. <view class="rimg"></view>
  34. </view>
  35. </uni-forms-item>
  36. </view>
  37. </view>
  38. <view class="cbox">
  39. <view class="chtop flexc">
  40. <image :src="line"></image>
  41. <view>驾车信息</view>
  42. </view>
  43. <view class="chmain">
  44. <!-- <view class="upbox" @click="getaddImage">
  45. <image :src="baseUrl+datainfo.front" class="img" v-if="datainfo.front"></image>
  46. <image :src="car" class="addimg"></image>
  47. <view>拍摄车辆照片自动识别</view>
  48. </view> -->
  49. <uni-forms-item label="是否驾车" name="isCar">
  50. <view class="flexc" @click="getChangeFn">
  51. <view class="flex1"></view>
  52. <image :src="check" v-if="datainfo.isCar=='Y'" class="checkimg"></image>
  53. <image :src="ncheck" v-else class="checkimg"></image>
  54. </view>
  55. </uni-forms-item>
  56. <uni-forms-item label="车牌号码" name="plateNumber">
  57. <view class="flexc">
  58. <!-- disabled -->
  59. <uni-easyinput v-model="datainfo.plateNumber" :inputBorder='false' placeholder="拍照自动识别" />
  60. <view class="aphoto" @click="getaddImage">
  61. <image :src="aphoto"></image>
  62. </view>
  63. </view>
  64. </uni-forms-item>
  65. <uni-forms-item label="手机号码" name="mobileNumber">
  66. <view class="flexc">
  67. <uni-easyinput v-model="datainfo.mobileNumber" :inputBorder='false' placeholder="请输入手机号码" />
  68. <view class="rimg"></view>
  69. </view>
  70. </uni-forms-item>
  71. </view>
  72. </view>
  73. </uni-forms>
  74. <view class="pdlr12 mt63">
  75. <view class="rhbtn" @click="getSubmit">确定</view>
  76. </view>
  77. <loading></loading>
  78. </view>
  79. </template>
  80. <script>
  81. import config from '@/config'
  82. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  83. import {uploadIdentify,uploadmore} from '@/utils/common.js'
  84. import {visitorAdd} from "@/api/work/people.js"
  85. export default {
  86. components: {},
  87. data() {
  88. return {
  89. line: require('@/car/static/car/line.png'),
  90. car: require('@/car/static/car/carico.png'),
  91. rimg: require('@/people/static/people/rimg.png'),
  92. aphoto: require('@/people/static/people/aphoto.png'),
  93. check: require('@/people/static/people/check.png'),
  94. ncheck: require('@/people/static/people/ncheck.png'),
  95. baseUrl: config.baseUrl,
  96. checkflag:true,
  97. datainfo: {
  98. "visitorManageId":"",//来访主键
  99. "portalId":"",//门户id
  100. "houseAddress":"",//详细门牌号
  101. "name":"",//访客姓名
  102. "num":"",//来访人数
  103. "reason":"",//来访事由
  104. "mobileNumber":"",//手机号码
  105. "isCar":"N",//是否驾车 N:否 Y:是
  106. "plateNumber":"",//车牌号码
  107. "reserveTime":"",//预约时间
  108. "visitorTime":"",//来访时间
  109. "status":"",//状态 1:预约成功 2:已来访 3:已过期
  110. "photo":""//人脸信息
  111. },
  112. syqxidx:'',
  113. sexs: [{
  114. text: '男',
  115. value: 0
  116. }, {
  117. text: '女',
  118. value: 1
  119. }],
  120. phofile:[],
  121. }
  122. },
  123. onLoad: function() {
  124. },
  125. methods: {
  126. checkPermi,
  127. checkRole,
  128. bindDateChange(e){
  129. var val=e.detail.value;
  130. // this.datainfo.applicationBank=this.sdyhlist[val].value;
  131. // this.applicationBank=this.sdyhlist[val].label;
  132. },
  133. getChangeFn(){
  134. if(this.datainfo.isCar=='Y'){
  135. this.datainfo.isCar='N'
  136. }else{
  137. this.datainfo.isCar='Y'
  138. }
  139. },
  140. getSubmit(){
  141. var params=JSON.parse(JSON.stringify(this.datainfo))
  142. // 手机号验证
  143. let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
  144. if (params.mobileNumber && !regphone.test(params.mobileNumber)) {
  145. this.$toast("请输入正确的手机号")
  146. return
  147. }
  148. visitorAdd(params).then(res=>{
  149. if(res.code==200){
  150. this.$toast("新增成功")
  151. setTimeout(function(){
  152. uni.$emit("refComelist")
  153. uni.navigateBack({
  154. delta:1
  155. })
  156. },1500)
  157. }
  158. })
  159. },
  160. getaddImage(e) {
  161. let that = this;
  162. let file = [],
  163. count = 9
  164. uni.chooseImage({
  165. success: function(res) {
  166. let img = res.tempFilePaths;
  167. if (img.length + file.length > count) {
  168. uni.showToast({
  169. title: '最多上传' + count + '张图片',
  170. icon: 'none',
  171. duration: 2000
  172. })
  173. } else {
  174. let imglen = res.tempFilePaths.length;
  175. var fuwufile = [];
  176. uploadmore('/common/upload', img, 0, 0, 0, imglen, fuwufile, function(rs) {
  177. that.phofile = that.phofile.concat(rs);
  178. })
  179. }
  180. }
  181. });
  182. },
  183. // getaddImage(e) {
  184. // let that = this;
  185. // // var rs=['D:\\idcard.png']
  186. // // if(rs&&rs.length>0){
  187. // // var obj={
  188. // // type:e,
  189. // // // url:baseUrl+rs.join(',')
  190. // // url:rs.join(',')
  191. // // }
  192. // // that.getOcrIdCard(obj)
  193. // // }
  194. // // return
  195. // let file = [],
  196. // count = 9
  197. // uni.chooseImage({
  198. // count: 1,
  199. // success: function(res) {
  200. // let img = res.tempFilePaths;
  201. // if (img.length + file.length > count) {
  202. // uni.showToast({
  203. // title: '最多上传' + count + '张图片',
  204. // icon: 'none',
  205. // duration: 2000
  206. // })
  207. // } else {
  208. // let imglen = res.tempFilePaths.length;
  209. // var fuwufile = [];
  210. // uploadIdentify('/common/upload', img, 0, 0, 0, imglen, fuwufile, function(rs) {
  211. // var resurl = rs[0];
  212. // if (e == 'front') {
  213. // that.datainfo.front = resurl.fileName;
  214. // } else {
  215. // that.datainfo.back = resurl.fileName;
  216. // }
  217. // if (rs && rs.length > 0) {
  218. // var obj = {
  219. // type: e,
  220. // url: resurl.urlOnline
  221. // }
  222. // that.getOcrIdCard(obj)
  223. // }
  224. // })
  225. // }
  226. // }
  227. // });
  228. // },
  229. // getOcrIdCard(obj) {
  230. // var params = {
  231. // image: obj.url,
  232. // idCardSide: obj.type
  233. // }
  234. // getOcrIdCard(params).then(res => {
  235. // if (res.code == 200) {
  236. // var datainfo = res.data;
  237. // if (obj.type == 'front') {
  238. // this.datainfo.realName = datainfo.realName;
  239. // this.datainfo.idCard = datainfo.idCard;
  240. // this.datainfo.address = datainfo.address;
  241. // } else {
  242. // this.datainfo.expirationDate = datainfo.expirationDate
  243. // }
  244. // }
  245. // })
  246. // }
  247. }
  248. }
  249. </script>
  250. <style>
  251. page{background: #F3F3F0;}
  252. </style>
  253. <style lang="scss" scoped>
  254. .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;}
  255. .check .cbox /deep/ .uni-forms-item:last-child{border: none;}
  256. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  257. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  258. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  259. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  260. .check /deep/ .uni-input-input{font-size: 26rpx;}
  261. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  262. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  263. .check /deep/ .uni-data-checklist .checklist-group .checklist-box{margin:10rpx 8rpx 10rpx 16rpx;}
  264. .check /deep/ .uni-data-checklist{flex: 0 0 auto;}
  265. .check{min-height: 100vh;padding: 20rpx 18rpx 24rpx;box-sizing: border-box;}
  266. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;margin-bottom: 24rpx;
  267. .chtop{padding-top: 32rpx;margin-bottom: 8rpx;
  268. image{width: 14rpx;height: 48rpx;margin-right: 20rpx;}
  269. view{font-weight: bold;font-size: 32rpx;color: #272727;}
  270. }
  271. .chmain{
  272. padding: 0 32rpx;
  273. .upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
  274. .img{width: 100%;height: 100%;}
  275. .addimg{width: 70rpx;height: 70rpx;margin-bottom: 16rpx;}
  276. view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
  277. }
  278. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  279. image{width: 100%;height: 100%;}
  280. }
  281. .checkimg{width: 80rpx;height: 40rpx;margin-right: 8rpx;}
  282. .aphoto{padding: 0 24rpx;border-left: 2rpx solid #e6e6e6;margin-left: 26rpx;
  283. image{width: 40rpx;height: 38rpx;}
  284. }
  285. }
  286. }
  287. </style>