123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- <template>
- <view class="check">
- <uni-forms ref="form" :model="datainfo">
- <view class="cbox">
- <view class="chtop flexc">
- <image :src="line"></image>
- <view>访客信息</view>
- </view>
- <view class="chmain">
- <uni-forms-item label="访客姓名" name="name">
- <view class="flexc">
- <uni-easyinput v-model="datainfo.name" :inputBorder='false' placeholder="请输入访客姓名" />
- <uni-data-checkbox selectedColor="#0156FE" selectedTextColor="#272727" v-model="datainfo.sex" :localdata="sexs" />
- </view>
- </uni-forms-item>
- <uni-forms-item label="来访人数" name="num">
- <view class="flexc">
- <uni-easyinput v-model="datainfo.num" type="Number" :inputBorder='false' placeholder="请输入来访人数" />
- <view class="rimg"><image :src="rimg"></image></view>
- </view>
- </uni-forms-item>
- <uni-forms-item label="来访事由" name="reason">
- <view class="flexc">
- <uni-easyinput v-model="datainfo.reason" :inputBorder='false' placeholder="请选择或输入来访事由" />
- <picker range-key='text' :value="syqxidx" :range="sexs" @change='bindDateChange'>
- <view class="rimg"><image :src="rimg"></image></view>
- </picker>
- </view>
- </uni-forms-item>
- <uni-forms-item label="来访门户" name="houseAddress">
- <view class="flexc">
- <uni-easyinput v-model="datainfo.houseAddress" :inputBorder='false' placeholder="请输入门户号" />
- <view class="rimg"></view>
- </view>
- </uni-forms-item>
- </view>
- </view>
- <view class="cbox">
- <view class="chtop flexc">
- <image :src="line"></image>
- <view>驾车信息</view>
- </view>
- <view class="chmain">
- <!-- <view class="upbox" @click="getaddImage">
- <image :src="baseUrl+datainfo.front" class="img" v-if="datainfo.front"></image>
- <image :src="car" class="addimg"></image>
- <view>拍摄车辆照片自动识别</view>
- </view> -->
- <uni-forms-item label="是否驾车" name="isCar">
- <view class="flexc" @click="getChangeFn">
- <view class="flex1"></view>
- <image :src="check" v-if="datainfo.isCar=='Y'" class="checkimg"></image>
- <image :src="ncheck" v-else class="checkimg"></image>
- </view>
- </uni-forms-item>
- <uni-forms-item label="车牌号码" name="plateNumber">
- <view class="flexc">
- <!-- disabled -->
- <uni-easyinput v-model="datainfo.plateNumber" :inputBorder='false' placeholder="拍照自动识别" />
- <view class="aphoto" @click="getaddImage">
- <image :src="aphoto"></image>
- </view>
-
- </view>
- </uni-forms-item>
- <uni-forms-item label="手机号码" name="mobileNumber">
- <view class="flexc">
- <uni-easyinput v-model="datainfo.mobileNumber" :inputBorder='false' placeholder="请输入手机号码" />
- <view class="rimg"></view>
- </view>
- </uni-forms-item>
- </view>
- </view>
- </uni-forms>
- <view class="pdlr12 mt63">
- <view class="rhbtn" @click="getSubmit">确定</view>
- </view>
- <loading></loading>
- </view>
- </template>
- <script>
- import config from '@/config'
- import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
- import {uploadIdentify,uploadmore} from '@/utils/common.js'
- import {visitorAdd} from "@/api/work/people.js"
- export default {
- components: {},
- data() {
- return {
- line: require('@/car/static/car/line.png'),
- car: require('@/car/static/car/carico.png'),
- rimg: require('@/people/static/people/rimg.png'),
- aphoto: require('@/people/static/people/aphoto.png'),
- check: require('@/people/static/people/check.png'),
- ncheck: require('@/people/static/people/ncheck.png'),
- baseUrl: config.baseUrl,
- checkflag:true,
- datainfo: {
- "visitorManageId":"",//来访主键
- "portalId":"",//门户id
- "houseAddress":"",//详细门牌号
- "name":"",//访客姓名
- "num":"",//来访人数
- "reason":"",//来访事由
- "mobileNumber":"",//手机号码
- "isCar":"N",//是否驾车 N:否 Y:是
- "plateNumber":"",//车牌号码
- "reserveTime":"",//预约时间
- "visitorTime":"",//来访时间
- "status":"",//状态 1:预约成功 2:已来访 3:已过期
- "photo":""//人脸信息
- },
- syqxidx:'',
- sexs: [{
- text: '男',
- value: 0
- }, {
- text: '女',
- value: 1
- }],
- phofile:[],
- }
- },
- onLoad: function() {
- },
- methods: {
- checkPermi,
- checkRole,
- bindDateChange(e){
- var val=e.detail.value;
- // this.datainfo.applicationBank=this.sdyhlist[val].value;
- // this.applicationBank=this.sdyhlist[val].label;
- },
- getChangeFn(){
- if(this.datainfo.isCar=='Y'){
- this.datainfo.isCar='N'
- }else{
- this.datainfo.isCar='Y'
- }
- },
- getSubmit(){
- var params=JSON.parse(JSON.stringify(this.datainfo))
- // 手机号验证
- 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}$/
- if (params.mobileNumber && !regphone.test(params.mobileNumber)) {
- this.$toast("请输入正确的手机号")
- return
- }
- visitorAdd(params).then(res=>{
- if(res.code==200){
- this.$toast("新增成功")
- setTimeout(function(){
- uni.$emit("refComelist")
- uni.navigateBack({
- delta:1
- })
- },1500)
- }
- })
- },
- getaddImage(e) {
- let that = this;
- let file = [],
- count = 9
- uni.chooseImage({
- success: function(res) {
- let img = res.tempFilePaths;
- if (img.length + file.length > count) {
- uni.showToast({
- title: '最多上传' + count + '张图片',
- icon: 'none',
- duration: 2000
- })
- } else {
- let imglen = res.tempFilePaths.length;
- var fuwufile = [];
- uploadmore('/common/upload', img, 0, 0, 0, imglen, fuwufile, function(rs) {
- that.phofile = that.phofile.concat(rs);
- })
- }
- }
- });
- },
- // getaddImage(e) {
- // let that = this;
- // // var rs=['D:\\idcard.png']
- // // if(rs&&rs.length>0){
- // // var obj={
- // // type:e,
- // // // url:baseUrl+rs.join(',')
- // // url:rs.join(',')
- // // }
- // // that.getOcrIdCard(obj)
- // // }
- // // return
- // let file = [],
- // count = 9
- // uni.chooseImage({
- // count: 1,
- // success: function(res) {
- // let img = res.tempFilePaths;
- // if (img.length + file.length > count) {
- // uni.showToast({
- // title: '最多上传' + count + '张图片',
- // icon: 'none',
- // duration: 2000
- // })
- // } else {
- // let imglen = res.tempFilePaths.length;
- // var fuwufile = [];
- // uploadIdentify('/common/upload', img, 0, 0, 0, imglen, fuwufile, function(rs) {
- // var resurl = rs[0];
- // if (e == 'front') {
- // that.datainfo.front = resurl.fileName;
- // } else {
- // that.datainfo.back = resurl.fileName;
- // }
- // if (rs && rs.length > 0) {
- // var obj = {
- // type: e,
- // url: resurl.urlOnline
- // }
- // that.getOcrIdCard(obj)
- // }
- // })
- // }
- // }
- // });
- // },
- // getOcrIdCard(obj) {
- // var params = {
- // image: obj.url,
- // idCardSide: obj.type
- // }
- // getOcrIdCard(params).then(res => {
- // if (res.code == 200) {
- // var datainfo = res.data;
- // if (obj.type == 'front') {
- // this.datainfo.realName = datainfo.realName;
- // this.datainfo.idCard = datainfo.idCard;
- // this.datainfo.address = datainfo.address;
- // } else {
- // this.datainfo.expirationDate = datainfo.expirationDate
- // }
- // }
- // })
- // }
- }
- }
- </script>
- <style>
- page{background: #F3F3F0;}
- </style>
- <style lang="scss" scoped>
- .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;}
- .check .cbox /deep/ .uni-forms-item:last-child{border: none;}
- .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
- .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
- .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
- .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
- .check /deep/ .uni-input-input{font-size: 26rpx;}
- .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
- .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
- .check /deep/ .uni-data-checklist .checklist-group .checklist-box{margin:10rpx 8rpx 10rpx 16rpx;}
- .check /deep/ .uni-data-checklist{flex: 0 0 auto;}
- .check{min-height: 100vh;padding: 20rpx 18rpx 24rpx;box-sizing: border-box;}
- .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;margin-bottom: 24rpx;
- .chtop{padding-top: 32rpx;margin-bottom: 8rpx;
- image{width: 14rpx;height: 48rpx;margin-right: 20rpx;}
- view{font-weight: bold;font-size: 32rpx;color: #272727;}
- }
- .chmain{
- padding: 0 32rpx;
- .upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
- .img{width: 100%;height: 100%;}
- .addimg{width: 70rpx;height: 70rpx;margin-bottom: 16rpx;}
- view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
- }
- .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
- image{width: 100%;height: 100%;}
- }
- .checkimg{width: 80rpx;height: 40rpx;margin-right: 8rpx;}
- .aphoto{padding: 0 24rpx;border-left: 2rpx solid #e6e6e6;margin-left: 26rpx;
- image{width: 40rpx;height: 38rpx;}
- }
- }
-
- }
- </style>
|