|
|
|
|
@ -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 => {
|
|
|
|
|
|