|
|
|
@ -9,11 +9,11 @@
|
|
|
|
<view class="configvalue">
|
|
|
|
<view class="configvalue">
|
|
|
|
<view v-html="configInfo.value">
|
|
|
|
<view v-html="configInfo.value">
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view style="text-align: center;">
|
|
|
|
<view style="text-align: center;">
|
|
|
|
<view class="configbtn" @click="closeConfig">
|
|
|
|
<view class="configbtn" @click="closeConfig">
|
|
|
|
确认
|
|
|
|
确认
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
@ -43,10 +43,13 @@
|
|
|
|
<view class="steps">
|
|
|
|
<view class="steps">
|
|
|
|
<uni-steps :options="steps" :active="stepActive" active-color="#4f607e" />
|
|
|
|
<uni-steps :options="steps" :active="stepActive" active-color="#4f607e" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<uni-forms ref="formdata" :model="form" :rules="rules" labelWidth="100px">
|
|
|
|
<uni-forms ref="formdata" :model="form" :rules="rules" labelWidth="120px">
|
|
|
|
<view class="formtext">拜访信息</view>
|
|
|
|
<view class="formtext">拜访信息</view>
|
|
|
|
<uni-forms-item label="到访日期" required name="date">
|
|
|
|
<uni-forms-item label="开始日期" required name="start_date">
|
|
|
|
<uni-datetime-picker type="date" :start="toadyStart" return-type="string" v-model="form.date" />
|
|
|
|
<uni-datetime-picker type="date" :start="toadyStart" return-type="string" v-model="form.start_date" @change="onStartDateChange" style="width: 100%;" />
|
|
|
|
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
|
|
<uni-forms-item label="结束日期" required name="end_date">
|
|
|
|
|
|
|
|
<uni-datetime-picker type="date" :start="toadyStart" return-type="string" v-model="form.end_date" @change="onEndDateChange" style="width: 100%;" />
|
|
|
|
</uni-forms-item>
|
|
|
|
</uni-forms-item>
|
|
|
|
<uni-forms-item label="到访时段" required name="visit_time_id">
|
|
|
|
<uni-forms-item label="到访时段" required name="visit_time_id">
|
|
|
|
<uni-data-checkbox v-model="form.visit_time_id" :localdata="visitTime"
|
|
|
|
<uni-data-checkbox v-model="form.visit_time_id" :localdata="visitTime"
|
|
|
|
@ -75,7 +78,11 @@
|
|
|
|
<uni-forms-item label="备注">
|
|
|
|
<uni-forms-item label="备注">
|
|
|
|
<uni-easyinput type="textarea" v-model="form.remark" placeholder="请输入自我备注" />
|
|
|
|
<uni-easyinput type="textarea" v-model="form.remark" placeholder="请输入自我备注" />
|
|
|
|
</uni-forms-item>
|
|
|
|
</uni-forms-item>
|
|
|
|
<view class="formtext">拜访人信息</view>
|
|
|
|
<view class="formtext" style="display: flex;justify-content: space-between;align-items: center;">
|
|
|
|
|
|
|
|
<text>拜访人信息</text>
|
|
|
|
|
|
|
|
<button style="background-color: #4f607e!important;" type="primary" size="mini"
|
|
|
|
|
|
|
|
@click="pullVisitorInfo">拉取拜访人信息</button>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
<uni-forms-item label="姓名" required name="name">
|
|
|
|
<uni-forms-item label="姓名" required name="name">
|
|
|
|
<uni-easyinput v-model="form.name" placeholder="请输入姓名" />
|
|
|
|
<uni-easyinput v-model="form.name" placeholder="请输入姓名" />
|
|
|
|
</uni-forms-item>
|
|
|
|
</uni-forms-item>
|
|
|
|
@ -186,12 +193,12 @@
|
|
|
|
<uni-forms-item label="收货人" v-if="form.type==3" required name="goodsName">
|
|
|
|
<uni-forms-item label="收货人" v-if="form.type==3" required name="goodsName">
|
|
|
|
<uni-easyinput @clear="clearAccept('goods')" disabled v-model="form.goodsName"
|
|
|
|
<uni-easyinput @clear="clearAccept('goods')" disabled v-model="form.goodsName"
|
|
|
|
@tap="adminListShowOpen('goods')" placeholder="请选择联系人员" />
|
|
|
|
@tap="adminListShowOpen('goods')" placeholder="请选择联系人员" />
|
|
|
|
</uni-forms-item>
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="formtext" v-if="visitAreaText=='生产区'">陪同人信息</view>
|
|
|
|
<view class="formtext" v-if="visitAreaText=='生产区'">陪同人信息</view>
|
|
|
|
<uni-forms-item label="陪同人" required name="accompanyName" v-if="visitAreaText=='生产区'">
|
|
|
|
<uni-forms-item label="陪同人" required name="accompanyName" v-if="visitAreaText=='生产区'">
|
|
|
|
<uni-easyinput @clear="clearAccept('accompany')" disabled v-model="form.accompanyName"
|
|
|
|
<uni-easyinput @clear="clearAccept('accompany')" disabled v-model="form.accompanyName"
|
|
|
|
@tap="adminListShowOpen('accompany')" placeholder="请选择联系人员" />
|
|
|
|
@tap="adminListShowOpen('accompany')" placeholder="请选择联系人员" />
|
|
|
|
</uni-forms-item>
|
|
|
|
</uni-forms-item>
|
|
|
|
<qianziyu-select :show="adminListShow" type="radio" :popupTitle="'联系人员'" name="cworkStationName"
|
|
|
|
<qianziyu-select :show="adminListShow" type="radio" :popupTitle="'联系人员'" name="cworkStationName"
|
|
|
|
:dataLists="adminList" placeholder="输入陪同人具体姓名或手机号搜索" @search="selectSearch" @submit="submitAccept"
|
|
|
|
:dataLists="adminList" placeholder="输入陪同人具体姓名或手机号搜索" @search="selectSearch" @submit="submitAccept"
|
|
|
|
@ -255,6 +262,7 @@
|
|
|
|
configInfo: {},
|
|
|
|
configInfo: {},
|
|
|
|
configKey: "ptfk",
|
|
|
|
configKey: "ptfk",
|
|
|
|
toadyStart: '',
|
|
|
|
toadyStart: '',
|
|
|
|
|
|
|
|
dateRange: [],
|
|
|
|
carindex: 0,
|
|
|
|
carindex: 0,
|
|
|
|
plateShow: false,
|
|
|
|
plateShow: false,
|
|
|
|
adminListShow: false,
|
|
|
|
adminListShow: false,
|
|
|
|
@ -298,10 +306,16 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
follow_people_index: -1,
|
|
|
|
follow_people_index: -1,
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
|
date: {
|
|
|
|
start_date: {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
|
required: true,
|
|
|
|
required: true,
|
|
|
|
errorMessage: '请选择到访日期'
|
|
|
|
errorMessage: '请选择开始日期'
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
end_date: {
|
|
|
|
|
|
|
|
rules: [{
|
|
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
|
|
errorMessage: '请选择结束日期'
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
visit_time_id: {
|
|
|
|
visit_time_id: {
|
|
|
|
@ -484,6 +498,14 @@
|
|
|
|
this.getConfig()
|
|
|
|
this.getConfig()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.init()
|
|
|
|
this.init()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置默认日期为当天
|
|
|
|
|
|
|
|
const today = new Date().toISOString().split('T')[0]
|
|
|
|
|
|
|
|
this.form.start_date = today
|
|
|
|
|
|
|
|
this.form.end_date = today
|
|
|
|
|
|
|
|
this.form.date = today
|
|
|
|
|
|
|
|
this.form.long_time = 0
|
|
|
|
|
|
|
|
|
|
|
|
if (uni.getStorageSync('formdata')) {
|
|
|
|
if (uni.getStorageSync('formdata')) {
|
|
|
|
this.form = uni.getStorageSync('formdata')
|
|
|
|
this.form = uni.getStorageSync('formdata')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -527,8 +549,8 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
submitAccept(e) {
|
|
|
|
submitAccept(e) {
|
|
|
|
console.log(e)
|
|
|
|
console.log(e)
|
|
|
|
this.form.accompany_id = e.id
|
|
|
|
this.form.accompany_id = e.id
|
|
|
|
this.form.accompanyName = e.name
|
|
|
|
this.form.accompanyName = e.name
|
|
|
|
if (this.acceptType == 'accept') {
|
|
|
|
if (this.acceptType == 'accept') {
|
|
|
|
this.form.accept_admin_id = e.id
|
|
|
|
this.form.accept_admin_id = e.id
|
|
|
|
@ -785,6 +807,12 @@
|
|
|
|
for (var k of this.form.follw_people) {
|
|
|
|
for (var k of this.form.follw_people) {
|
|
|
|
id_arr.push(k.idcard)
|
|
|
|
id_arr.push(k.idcard)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 确保date字段设置为start_date
|
|
|
|
|
|
|
|
if (this.form.start_date) {
|
|
|
|
|
|
|
|
this.form.date = this.form.start_date
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.$refs['formdata'].validate().then(res => {
|
|
|
|
this.$refs['formdata'].validate().then(res => {
|
|
|
|
this.util.request({
|
|
|
|
this.util.request({
|
|
|
|
api: '/api/mobile/visit/idcard-check',
|
|
|
|
api: '/api/mobile/visit/idcard-check',
|
|
|
|
@ -826,6 +854,12 @@
|
|
|
|
if (this.form.credent == 2) {
|
|
|
|
if (this.form.credent == 2) {
|
|
|
|
this.form.idcard = this.form.passcard
|
|
|
|
this.form.idcard = this.form.passcard
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 确保date字段设置为start_date
|
|
|
|
|
|
|
|
if (this.form.start_date) {
|
|
|
|
|
|
|
|
this.form.date = this.form.start_date
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.$refs['formdata'].validate().then(res => {
|
|
|
|
this.$refs['formdata'].validate().then(res => {
|
|
|
|
console.log("form", this.form)
|
|
|
|
console.log("form", this.form)
|
|
|
|
// return
|
|
|
|
// return
|
|
|
|
@ -847,8 +881,8 @@
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
submitForm() {
|
|
|
|
submitForm() {
|
|
|
|
let that = this
|
|
|
|
let that = this
|
|
|
|
console.log("form",this.form)
|
|
|
|
console.log("form",this.form)
|
|
|
|
// return
|
|
|
|
// return
|
|
|
|
this.util.request({
|
|
|
|
this.util.request({
|
|
|
|
api: '/api/admin/visit/save',
|
|
|
|
api: '/api/admin/visit/save',
|
|
|
|
@ -909,7 +943,7 @@
|
|
|
|
url: '/pages/visit/successform'
|
|
|
|
url: '/pages/visit/successform'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
|
|
|
|
// 用户没有点击"总是保持以上,不再询问"则每次都会调起订阅消息
|
|
|
|
uni.requestSubscribeMessage({
|
|
|
|
uni.requestSubscribeMessage({
|
|
|
|
tmplIds: ['OfDFwAIZyXqvPgmc_czIXhveVtp3n_ftyWJEks1DSi4',
|
|
|
|
tmplIds: ['OfDFwAIZyXqvPgmc_czIXhveVtp3n_ftyWJEks1DSi4',
|
|
|
|
'r8n41lmkGeob15YBuuxhG7MbpgVSsUxKnK9ORPtr5VY'
|
|
|
|
'r8n41lmkGeob15YBuuxhG7MbpgVSsUxKnK9ORPtr5VY'
|
|
|
|
@ -928,6 +962,91 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 开始日期变化处理
|
|
|
|
|
|
|
|
onStartDateChange(e) {
|
|
|
|
|
|
|
|
console.log('开始日期变化:', e)
|
|
|
|
|
|
|
|
this.calculateDateRange()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 结束日期变化处理
|
|
|
|
|
|
|
|
onEndDateChange(e) {
|
|
|
|
|
|
|
|
console.log('结束日期变化:', e)
|
|
|
|
|
|
|
|
this.calculateDateRange()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 计算日期范围和长期访问状态
|
|
|
|
|
|
|
|
calculateDateRange() {
|
|
|
|
|
|
|
|
if (this.form.start_date && this.form.end_date) {
|
|
|
|
|
|
|
|
// 计算日期差
|
|
|
|
|
|
|
|
const start = new Date(this.form.start_date)
|
|
|
|
|
|
|
|
const end = new Date(this.form.end_date)
|
|
|
|
|
|
|
|
const timeDiff = end.getTime() - start.getTime()
|
|
|
|
|
|
|
|
const daysDiff = Math.ceil(timeDiff / (1000 * 3600 * 24)) + 1 // +1 因为包含开始和结束日期
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果超过1天,设置为长期访问
|
|
|
|
|
|
|
|
this.form.long_time = daysDiff > 1 ? 1 : 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置date字段为start_date
|
|
|
|
|
|
|
|
this.form.date = this.form.start_date
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('计算后的值:', {
|
|
|
|
|
|
|
|
start_date: this.form.start_date,
|
|
|
|
|
|
|
|
end_date: this.form.end_date,
|
|
|
|
|
|
|
|
long_time: this.form.long_time,
|
|
|
|
|
|
|
|
daysDiff: daysDiff
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 拉取拜访人信息
|
|
|
|
|
|
|
|
pullVisitorInfo() {
|
|
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
|
|
this.util.request({
|
|
|
|
|
|
|
|
api: '/api/mobile/user/my-visit',
|
|
|
|
|
|
|
|
method: "get",
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
page: 1,
|
|
|
|
|
|
|
|
page_size: 1,
|
|
|
|
|
|
|
|
type: ""
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
utilSuccess: function(res) {
|
|
|
|
|
|
|
|
if (res.data && res.data.length > 0) {
|
|
|
|
|
|
|
|
// 获取第一条记录
|
|
|
|
|
|
|
|
const firstRecord = res.data[0]
|
|
|
|
|
|
|
|
// 自动填充拜访人信息
|
|
|
|
|
|
|
|
that.form.name = firstRecord.name || ''
|
|
|
|
|
|
|
|
that.form.mobile = firstRecord.mobile || ''
|
|
|
|
|
|
|
|
that.form.credent = firstRecord.credent || 1
|
|
|
|
|
|
|
|
that.form.idcard = firstRecord.idcard || ''
|
|
|
|
|
|
|
|
that.form.company_name = firstRecord.company_name || ''
|
|
|
|
|
|
|
|
that.form.cda = firstRecord.cda || ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据证件类型设置对应的证件号码
|
|
|
|
|
|
|
|
if (firstRecord.credent == 2) {
|
|
|
|
|
|
|
|
that.form.passcard = firstRecord.idcard || ''
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
|
|
title: '拜访人信息已自动填充',
|
|
|
|
|
|
|
|
duration: 2000,
|
|
|
|
|
|
|
|
icon: 'success'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
|
|
title: '暂无拜访人历史记录,请手动输入!',
|
|
|
|
|
|
|
|
duration: 2000,
|
|
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
utilFail: function(res) {
|
|
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
|
|
title: '拉取失败,请手动输入',
|
|
|
|
|
|
|
|
duration: 2000,
|
|
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
@ -959,7 +1078,7 @@
|
|
|
|
.configtitle {
|
|
|
|
.configtitle {
|
|
|
|
font-size: 40rpx;
|
|
|
|
font-size: 40rpx;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
margin-top: 36rpx;
|
|
|
|
margin-top: 36rpx;
|
|
|
|
padding-bottom: 20rpx;
|
|
|
|
padding-bottom: 20rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -996,8 +1115,6 @@
|
|
|
|
color: #fff !important
|
|
|
|
color: #fff !important
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.areavalue {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.areabtn {
|
|
|
|
.areabtn {
|
|
|
|
background-color: #4f607e;
|
|
|
|
background-color: #4f607e;
|
|
|
|
/* margin-left: 8px; */
|
|
|
|
/* margin-left: 8px; */
|
|
|
|
@ -1011,4 +1128,31 @@
|
|
|
|
/deep/ .areavalue .uni-data-checklist .checklist-group .checklist-box.is--button {
|
|
|
|
/deep/ .areavalue .uni-data-checklist .checklist-group .checklist-box.is--button {
|
|
|
|
padding: 30rpx
|
|
|
|
padding: 30rpx
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 日期选择器样式优化 */
|
|
|
|
|
|
|
|
/deep/ .uni-datetime-picker {
|
|
|
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
|
|
min-width: 0 !important;
|
|
|
|
|
|
|
|
flex: 1 !important;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/deep/ .uni-datetime-picker .uni-datetime-picker__input {
|
|
|
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
|
|
overflow: visible !important;
|
|
|
|
|
|
|
|
white-space: nowrap !important;
|
|
|
|
|
|
|
|
min-width: 0 !important;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/deep/ .uni-datetime-picker .uni-datetime-picker__input-text {
|
|
|
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
|
|
overflow: visible !important;
|
|
|
|
|
|
|
|
text-overflow: ellipsis !important;
|
|
|
|
|
|
|
|
min-width: 0 !important;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 确保表单项有足够空间 */
|
|
|
|
|
|
|
|
/deep/ .uni-forms-item__content {
|
|
|
|
|
|
|
|
flex: 1 !important;
|
|
|
|
|
|
|
|
min-width: 0 !important;
|
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|