|
|
|
|
@ -505,13 +505,14 @@
|
|
|
|
|
String(now.getDate()).padStart(2, '0')
|
|
|
|
|
const visitType = parseInt(options.type || 1)
|
|
|
|
|
this.form.type = visitType
|
|
|
|
|
if (visitType == 4) {
|
|
|
|
|
if (parseInt(visitType, 10) === 4) {
|
|
|
|
|
this.vipGatePassed = false
|
|
|
|
|
this.areaShow = false
|
|
|
|
|
} else {
|
|
|
|
|
this.areaShow = (visitType == 1)
|
|
|
|
|
// 普通 / 施工 / 物流:先选前往区域(列表来自接口)
|
|
|
|
|
this.areaShow = (visitType === 1 || visitType === 2 || visitType === 3)
|
|
|
|
|
}
|
|
|
|
|
// VIP 访客:拜访须知使用后台配置 key「vipxz」;普通访客初始 ptfk(选区后在 closeArea 切换)
|
|
|
|
|
// 须知 key 在确认区域后按访客身份与区域计算,此处仅占位
|
|
|
|
|
this.configKey =
|
|
|
|
|
visitType == 4 ? 'vipxz' :
|
|
|
|
|
visitType == 1 ? 'ptfk' :
|
|
|
|
|
@ -522,9 +523,6 @@
|
|
|
|
|
if (visitType !== 4) {
|
|
|
|
|
this.showStudy()
|
|
|
|
|
}
|
|
|
|
|
if (visitType == 2 || visitType == 3) {
|
|
|
|
|
this.getConfig()
|
|
|
|
|
}
|
|
|
|
|
this.init()
|
|
|
|
|
if (uni.getStorageSync('formdata')) {
|
|
|
|
|
this.form = uni.getStorageSync('formdata')
|
|
|
|
|
@ -535,6 +533,8 @@
|
|
|
|
|
this.vipGateForm.name = (this.form.name || '').trim()
|
|
|
|
|
this.vipGateForm.mobile = (this.form.mobile || '').trim()
|
|
|
|
|
}
|
|
|
|
|
// 还原表单后按当前访客类型刷新区域列表
|
|
|
|
|
this.getVisitArea()
|
|
|
|
|
// this.getAdminList()
|
|
|
|
|
},
|
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
@ -555,7 +555,6 @@
|
|
|
|
|
onReady() {},
|
|
|
|
|
methods: {
|
|
|
|
|
init() {
|
|
|
|
|
this.getVisitArea()
|
|
|
|
|
this.getVisitTime()
|
|
|
|
|
this.getReason()
|
|
|
|
|
this.getPark()
|
|
|
|
|
@ -715,6 +714,7 @@
|
|
|
|
|
that.form.name = name
|
|
|
|
|
that.form.mobile = mobile
|
|
|
|
|
that.areaShow = true
|
|
|
|
|
that.getVisitArea()
|
|
|
|
|
that.showStudy()
|
|
|
|
|
},
|
|
|
|
|
utilFail: function(err) {
|
|
|
|
|
@ -730,13 +730,27 @@
|
|
|
|
|
this.util.alert("请先选择前往区域")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// VIP 访客统一走拜访须知「vipxz」,不按区域切换 ptfk/cjfk/yffk
|
|
|
|
|
// VIP:须知固定 vipxz
|
|
|
|
|
if (Number(this.form.type) === 4) {
|
|
|
|
|
this.configKey = 'vipxz'
|
|
|
|
|
this.getConfig()
|
|
|
|
|
this.areaShow = false
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 施工 / 物流:须知按访客身份对应后台配置 key
|
|
|
|
|
if (Number(this.form.type) === 2) {
|
|
|
|
|
this.configKey = 'sgfk'
|
|
|
|
|
this.getConfig()
|
|
|
|
|
this.areaShow = false
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (Number(this.form.type) === 3) {
|
|
|
|
|
this.configKey = 'wlcl'
|
|
|
|
|
this.getConfig()
|
|
|
|
|
this.areaShow = false
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// 普通访客:须知按前往区域切换
|
|
|
|
|
if (this.visitAreaText == "生产区") {
|
|
|
|
|
this.configKey = 'cjfk'
|
|
|
|
|
this.getConfig()
|
|
|
|
|
@ -763,10 +777,24 @@
|
|
|
|
|
// requestType: 'bd',
|
|
|
|
|
utilSuccess: function(res) {
|
|
|
|
|
console.log(res)
|
|
|
|
|
let data = res
|
|
|
|
|
let data = Array.isArray(res) ? res : []
|
|
|
|
|
let found = null
|
|
|
|
|
for (let k of data) {
|
|
|
|
|
if (k.key == that.configKey) {
|
|
|
|
|
that.configInfo = k
|
|
|
|
|
found = k
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (found) {
|
|
|
|
|
that.configInfo = {
|
|
|
|
|
name: found.name != null && found.name !== '' ? found.name : '访客须知',
|
|
|
|
|
value: found.value != null ? found.value : ''
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
that.configInfo = {
|
|
|
|
|
name: '访客须知',
|
|
|
|
|
value: '<p style="color:#999;">未配置 key 为 <strong>' + that.configKey +
|
|
|
|
|
'</strong> 的须知内容,请在后台【配置管理】中新增后再试。</p>'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
that.configshow = true
|
|
|
|
|
@ -778,26 +806,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getVisitArea() {
|
|
|
|
|
let that = this
|
|
|
|
|
that.visitArea = [{
|
|
|
|
|
name: '非生产区',
|
|
|
|
|
id: 3
|
|
|
|
|
}, {
|
|
|
|
|
name: '生产区',
|
|
|
|
|
id: 4
|
|
|
|
|
}, {
|
|
|
|
|
name: "研发R&D",
|
|
|
|
|
id: 5
|
|
|
|
|
}]
|
|
|
|
|
// this.util.request({
|
|
|
|
|
// api: '/api/mobile/visit/visit-area',
|
|
|
|
|
// data: {},
|
|
|
|
|
// utilSuccess: function(res) {
|
|
|
|
|
// console.log(res)
|
|
|
|
|
// that.visitArea = res
|
|
|
|
|
// },
|
|
|
|
|
// utilFail: function(res) {}
|
|
|
|
|
// })
|
|
|
|
|
const that = this
|
|
|
|
|
const visitType = parseInt(this.form.type, 10) || 1
|
|
|
|
|
this.util.request({
|
|
|
|
|
api: '/api/mobile/visit/visit-area',
|
|
|
|
|
data: {
|
|
|
|
|
type: visitType
|
|
|
|
|
},
|
|
|
|
|
utilSuccess: function(res) {
|
|
|
|
|
that.visitArea = Array.isArray(res) ? res : []
|
|
|
|
|
if (that.form.visit_area_id) {
|
|
|
|
|
const row = that.visitArea.find(a => String(a.id) === String(that.form.visit_area_id))
|
|
|
|
|
if (row) {
|
|
|
|
|
that.visitAreaText = row.name
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (that.visitArea.length === 0) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '暂无可选前往区域',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
utilFail: function() {
|
|
|
|
|
that.visitArea = []
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
changeVisitArea(e) {
|
|
|
|
|
console.log(e)
|
|
|
|
|
|