lion 3 days ago
parent 8e93a5ca48
commit ffa7803949

@ -1,10 +1,10 @@
<template>
<page-meta :page-style="'overflow:'+(callshow?'hidden':'visible')"></page-meta>
<view class="containers">
<!-- #ifdef MP-WEIXIN -->
<privacy-popup ref="privacyComponent" @agree-privacy="onAgreePrivacy"
@reject-privacy="onRejectPrivacy"></privacy-popup>
<view class="containers">
<!-- #ifdef MP-WEIXIN -->
<privacy-popup ref="privacyComponent" @agree-privacy="onAgreePrivacy"
@reject-privacy="onRejectPrivacy"></privacy-popup>
<!-- #endif -->
<view class="top">
<view class="toplogo justify-between align-center">
@ -15,10 +15,10 @@
<view>
{{userEmail}}
</view>
</view>
<view @click='logout'>
<u--image :src="logo" width="164rpx" height="65rpx"></u--image>
<view class="logout" >退出</view>
</view>
<view @click='logout'>
<u--image :src="logo" width="164rpx" height="65rpx"></u--image>
<view class="logout" >退出</view>
</view>
</view>
@ -69,12 +69,12 @@
<view v-if="item.type=='1'"><text>{{item.reason}}</text></view>
<view v-else-if="item.type=='3'">车牌<text>{{item.plate}}</text></view>
</view>
</view>
<view class="company">
<view>
拜访公司<text>{{item.company_name?item.company_name:''}}</text>
</view>
</view>
<view class="company">
<view>
拜访公司<text>{{item.company_name?item.company_name:''}}</text>
</view>
</view>
<!-- <view class="dblong">
<view>长期访客申请<text>{{item.long_time==0?'否':'是'}}</text></view>
@ -94,10 +94,11 @@
<u-popup :show="callshow" mode="center" @close="callshow=false">
<view class="popupVisit">
<view>请选择邀约访客类型</view>
<view class="justify-between">
<view class="popupVisit-btns">
<button @click="toForm(1)">访</button>
<button @click="toForm(2)">访</button>
<button @click="toForm(3)"></button>
<button @click="toForm(4)">VIP访</button>
</view>
</view>
</u-popup>
@ -107,10 +108,10 @@
<script>
import '@/static/css/bd.css'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue';
export default{
components: {
PrivacyPopup
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue';
export default{
components: {
PrivacyPopup
},
data() {
return {
@ -155,20 +156,20 @@
onLoad() {
this.getBdInfo()
this.loadList()
},
onShareAppMessage() {
return {
title: 'BD访客系统',
path: '/pages/index/index',
// imageUrl: this.logoIndex
}
},
onShareTimeline() {
return {
title: 'BD访客系统',
path: '/pages/index/index',
// imageUrl: this.logoIndex
}
},
onShareAppMessage() {
return {
title: 'BD访客系统',
path: '/pages/index/index',
// imageUrl: this.logoIndex
}
},
onShareTimeline() {
return {
title: 'BD访客系统',
path: '/pages/index/index',
// imageUrl: this.logoIndex
}
},
onPullDownRefresh() {
@ -192,18 +193,19 @@
this.loadList()
}
},
methods: {
onAgreePrivacy() {
//
//
console.log('User agreed to the privacy policy');
},
onRejectPrivacy() {
//
//
console.log('User rejected the privacy policy');
methods: {
onAgreePrivacy() {
//
//
console.log('User agreed to the privacy policy');
},
onRejectPrivacy() {
//
//
console.log('User rejected the privacy policy');
},
toForm(type) {
this.callshow = false
uni.navigateTo({
url: "/pages/visit/addrecord?iscall=call&type=" + type
})
@ -242,8 +244,8 @@
page: this.select.page,
page_size: this.select.page_size,
audit_status: this.select.audit_status,
keyword: this.select.keyword,
is_auth:0,
keyword: this.select.keyword,
is_auth:0,
my_audit:1
},
utilSuccess: function(res) {
@ -284,11 +286,11 @@
title: '提示',
content: '确认退出账号?',
success: function(res) {
if (res.confirm) {
uni.removeStorageSync('userInfo_BD_token')
uni.removeStorageSync('userInfo_Bd')
uni.redirectTo({
url: '/pages/index/index'
if (res.confirm) {
uni.removeStorageSync('userInfo_BD_token')
uni.removeStorageSync('userInfo_Bd')
uni.redirectTo({
url: '/pages/index/index'
})
} else if (res.cancel) {
@ -363,9 +365,9 @@
text-align: center;
margin-top: 15rpx
}
.logout{
text-align: right;
font-size: 30rpx;
.logout{
text-align: right;
font-size: 30rpx;
}
/deep/ .u-empty {
min-height: 30vh;
@ -383,16 +385,25 @@
margin-bottom: 20rpx
}
.popupVisit>view button {
.popupVisit-btns {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 20rpx;
}
.popupVisit-btns button {
width: calc(50% - 10rpx);
padding: 0 20rpx;
background-color: #044ed7;
color: #fff
}
.company{
padding-bottom:30rpx;
margin-top:-10rpx;
}
.company text{
color: #8f9596;
color: #fff;
font-size: 28rpx;
}
.company{
padding-bottom:30rpx;
margin-top:-10rpx;
}
.company text{
color: #8f9596;
}
</style>

@ -58,7 +58,7 @@
<view class="steps">
<uni-steps :options="steps" :active="stepActive" active-color="#044ed7" />
</view>
<uni-forms ref="formdata" :model="form" :rules="rules" labelWidth="100px">
<uni-forms ref="formdata" :model="form" :rules="formRules" labelWidth="100px">
<view class="formtext">拜访信息</view>
<uni-forms-item label="到访日期" required name="date">
<uni-datetime-picker type="date" :start="toadyStart" return-type="string" v-model="form.date" />
@ -95,20 +95,20 @@
<button v-if="form.type!=4" class="history-btn" type="primary" size="mini" @click="fillLatestVisitorInfo"></button>
</view>
<uni-forms-item label="姓名" required name="name">
<uni-easyinput v-model="form.name" placeholder="请输入姓名" :disabled="form.type==4 && vipGatePassed" />
<uni-easyinput v-model="form.name" placeholder="请输入姓名" :disabled="form.type==4 && vipGatePassed && isCall!=='call'" />
</uni-forms-item>
<uni-forms-item label="联系电话" required name="mobile">
<uni-easyinput v-model="form.mobile" placeholder="请输入联系电话" :disabled="form.type==4 && vipGatePassed" />
<uni-easyinput v-model="form.mobile" placeholder="请输入联系电话" :disabled="form.type==4 && vipGatePassed && isCall!=='call'" />
</uni-forms-item>
<uni-forms-item label="证件类型" required name="credent">
<uni-forms-item label="证件类型" :required="form.type!=4" name="credent">
<uni-data-select v-model="form.credent" :localdata="credentList">
</uni-data-select>
</uni-forms-item>
<uni-forms-item label="证件号码" required name="idcard" v-if="form.credent==1">
<uni-easyinput type="idcard" v-model="form.idcard" placeholder="请输入证件号码" />
<uni-forms-item label="证件号码" :required="form.type!=4" name="idcard" v-if="form.credent==1">
<uni-easyinput type="idcard" v-model="form.idcard" :placeholder="form.type==4?'选填':'请输入证件号码'" />
</uni-forms-item>
<uni-forms-item label="护照号码" required name="passcard" v-if="form.credent==2">
<uni-easyinput type="text" v-model="form.passcard" placeholder="请输入证件号码" />
<uni-forms-item label="护照号码" :required="form.type!=4" name="passcard" v-if="form.credent==2">
<uni-easyinput type="text" v-model="form.passcard" :placeholder="form.type==4?'选填':'请输入证件号码'" />
</uni-forms-item>
<uni-forms-item label="单位名称" required name="company_name">
<uni-easyinput v-model="form.company_name" placeholder="请输入单位名称" />
@ -220,23 +220,23 @@
<!-- 随访人员弹出 -->
<uni-drawer ref="showRight" mode="right" :mask-click="true">
<uni-forms ref="peopleform" :model="follw_people_obj" :rules="peoplerules" labelWidth="80px">
<uni-forms ref="peopleform" :model="follw_people_obj" :rules="peopleFormRules" labelWidth="80px">
<uni-forms-item label="姓名" required name='name'>
<uni-easyinput v-model="follw_people_obj.name" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="联系电话" required name='mobile'>
<uni-easyinput v-model="follw_people_obj.mobile" placeholder="请输入联系电话" />
</uni-forms-item>
<uni-forms-item label="证件类型" required name='credent'>
<uni-forms-item label="证件类型" :required="form.type!=4" name='credent'>
<uni-data-select @change="chooseCredent" v-model="follw_people_obj.credent"
:localdata="credentList">
</uni-data-select>
</uni-forms-item>
<uni-forms-item label="证件号码" required name='idcard' v-if="follw_people_obj.credent==1">
<uni-easyinput type="idcard" v-model="follw_people_obj.idcard" placeholder="请输入证件号码" />
<uni-forms-item label="证件号码" :required="form.type!=4" name='idcard' v-if="follw_people_obj.credent==1">
<uni-easyinput type="idcard" v-model="follw_people_obj.idcard" :placeholder="form.type==4?'选填':'请输入证件号码'" />
</uni-forms-item>
<uni-forms-item label="护照号码" required name='passcard' v-if="follw_people_obj.credent==2">
<uni-easyinput type="text" v-model="follw_people_obj.passcard" placeholder="请输入证件号码" />
<uni-forms-item label="护照号码" :required="form.type!=4" name='passcard' v-if="follw_people_obj.credent==2">
<uni-easyinput type="text" v-model="follw_people_obj.passcard" :placeholder="form.type==4?'选填':'请输入证件号码'" />
</uni-forms-item>
</uni-forms>
<view class="uni-group" style="text-align: right;">
@ -491,6 +491,23 @@
}
},
computed: {
isVipVisit() {
return Number(this.form.type) === 4
},
formRules() {
if (!this.isVipVisit) {
return this.rules
}
return Object.assign({}, this.rules, this.vipOptionalIdentityRules())
},
peopleFormRules() {
if (!this.isVipVisit) {
return this.peoplerules
}
return Object.assign({}, this.peoplerules, this.vipOptionalIdentityRules())
}
},
onLoad(options) {
// uni.navigateTo({
// url:'/pages/visit/testStudy?type=3'
@ -505,9 +522,17 @@
String(now.getDate()).padStart(2, '0')
const visitType = parseInt(options.type || 1)
this.form.type = visitType
this.isCall = options.iscall ? options.iscall : ''
const isBdCall = this.isCall === 'call'
if (parseInt(visitType, 10) === 4) {
this.vipGatePassed = false
this.areaShow = false
if (isBdCall) {
// BD VIP
this.vipGatePassed = true
this.areaShow = true
} else {
this.vipGatePassed = false
this.areaShow = false
}
} else {
// / /
this.areaShow = (visitType === 1 || visitType === 2 || visitType === 3)
@ -517,9 +542,8 @@
visitType == 4 ? 'vipxz' :
visitType == 1 ? 'ptfk' :
visitType == 2 ? 'sgfk' : 'wlcl'
this.isCall = options.iscall ? options.iscall : ''
// this.goStudy = this.isCall == 'call' ? '' : ''
this.form.audit_status = this.isCall == 'call' ? 1 : 0
this.form.audit_status = isBdCall ? 1 : 0
if (visitType !== 4) {
this.showStudy()
}
@ -528,10 +552,15 @@
this.form = uni.getStorageSync('formdata')
}
if (parseInt(this.form.type, 10) === 4) {
this.vipGatePassed = false
this.areaShow = false
this.vipGateForm.name = (this.form.name || '').trim()
this.vipGateForm.mobile = (this.form.mobile || '').trim()
if (this.isCall === 'call') {
this.vipGatePassed = true
this.areaShow = true
} else {
this.vipGatePassed = false
this.areaShow = false
this.vipGateForm.name = (this.form.name || '').trim()
this.vipGateForm.mobile = (this.form.mobile || '').trim()
}
}
// 访
this.getVisitArea()
@ -554,6 +583,91 @@
onReady() {},
methods: {
vipOptionalIdentityRules() {
const validateOptionalIdcard = (rule, value, data, callback) => {
const v = (value || '').trim()
if (!v) {
return true
}
const ok = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]/.test(v)
if (!ok) {
callback('身份证格式错误')
return false
}
return true
}
const validateOptionalPasscard = (rule, value, data, callback) => {
const v = (value || '').trim()
if (!v) {
return true
}
const ok = /^([a-zA-z]|[0-9]){5,17}$/.test(v)
if (!ok) {
callback('护照格式错误')
return false
}
return true
}
return {
credent: {
rules: []
},
idcard: {
rules: [{
validateFunction: validateOptionalIdcard
}]
},
passcard: {
rules: [{
validateFunction: validateOptionalPasscard
}]
}
}
},
getStudyIdcardList() {
const idArr = []
const mainId = this.form.credent == 2 ?
(this.form.passcard || '').trim() :
(this.form.idcard || '').trim()
if (mainId) {
idArr.push(mainId)
}
for (const k of this.form.follw_people) {
const fid = (k.idcard || '').trim()
if (fid) {
idArr.push(fid)
}
}
return idArr
},
handleIdcardCheckResult(res) {
const that = this
const missing = Array.isArray(res?.missing) ? res.missing : []
const expired = Array.isArray(res?.expired) ? res.expired : []
const invalidLegacy = Array.isArray(res?.invalid) ? res.invalid : (Array.isArray(res) ? res : [])
const hasInvalid = missing.length > 0 || expired.length > 0 || invalidLegacy.length > 0
if (hasInvalid) {
let messageArr = []
if (missing.length > 0) {
messageArr.push(`未学习:${missing.join("")}`)
}
if (expired.length > 0) {
messageArr.push(`已过期:${expired.join("")}`)
}
if (messageArr.length === 0 && invalidLegacy.length > 0) {
messageArr.push(`异常:${invalidLegacy.join("")}`)
}
let str = messageArr.join("") + '。请先完成当前访客类型的学习流程'
that.util.alert(str)
uni.setStorageSync('formdata', that.form)
} else {
if (that.isCall === 'call') {
that.submitForm()
} else {
that.submitNoStudy()
}
}
},
init() {
this.getVisitTime()
this.getReason()
@ -924,7 +1038,7 @@
pushFollowPeople() {
console.log('this.follw_people_obj', this.follw_people_obj)
if (this.follw_people_obj.credent == 2) {
this.follw_people_obj.idcard = this.follw_people_obj.passcard
this.follw_people_obj.idcard = this.follw_people_obj.passcard || ''
}
this.$refs['peopleform'].validate().then(res => {
if (this.follow_people_index > -1) {
@ -983,13 +1097,7 @@
// 访
async getStudy() {
let that = this
let id_arr = []
id_arr.push(this.form.idcard)
for (var k of this.form.follw_people) {
id_arr.push(k.idcard)
}
this.$refs['formdata'].validate().then(res => {
// VIP/
this.checkVipByMobile(this.form.mobile).then(vipRes => {
const isVip = parseInt(vipRes?.is_vip || 0) === 1 ? 1 : 0
uni.setStorageSync('studydata', {
@ -1007,44 +1115,26 @@
idcard: this.form.credent == 2 ? this.form.passcard : this.form.idcard
})
})
const idArr = that.getStudyIdcardList()
if (that.isVipVisit && idArr.length === 0) {
that.handleIdcardCheckResult({
missing: [],
expired: [],
invalid: []
})
return
}
this.util.request({
api: '/api/mobile/visit/idcard-check',
method: "post",
data: {
idcard: id_arr,
idcard: idArr,
type: that.form.type
},
utilSuccess: function(res) {
const missing = Array.isArray(res?.missing) ? res.missing : []
const expired = Array.isArray(res?.expired) ? res.expired : []
const invalidLegacy = Array.isArray(res?.invalid) ? res.invalid : (Array.isArray(res) ? res : [])
const hasInvalid = missing.length > 0 || expired.length > 0 || invalidLegacy.length > 0
if (hasInvalid) {
let messageArr = []
if (missing.length > 0) {
messageArr.push(`未学习:${missing.join("")}`)
}
if (expired.length > 0) {
messageArr.push(`已过期:${expired.join("")}`)
}
if (messageArr.length === 0 && invalidLegacy.length > 0) {
messageArr.push(`异常:${invalidLegacy.join("")}`)
}
let str = messageArr.join("") + '。请先完成当前访客类型的学习流程'
that.util.alert(str)
uni.setStorageSync('formdata', that.form)
} else {
//
if (that.isCall === 'call') {
that.submitForm()
} else {
// 访
that.submitNoStudy()
}
}
that.handleIdcardCheckResult(res)
},
utilFail: function(res) {
// console.log(res)
uni.showToast({
title: res,
duration: 2000,
@ -1059,7 +1149,7 @@
},
saveFormgoStudy() {
if (this.form.credent == 2) {
if (this.form.credent == 2 && (this.form.passcard || '').trim()) {
this.form.idcard = this.form.passcard
}
this.$refs['formdata'].validate().then(res => {

Loading…
Cancel
Save