完成预约修改

master
linyongLynn 2 months ago
parent 56658caf8c
commit 85297af827

@ -9,11 +9,11 @@
<view class="configvalue">
<view v-html="configInfo.value">
</view>
<view style="text-align: center;">
<view class="configbtn" @click="closeConfig">
确认
</view>
</view>
<view style="text-align: center;">
<view class="configbtn" @click="closeConfig">
确认
</view>
</view>
</view>
@ -43,10 +43,13 @@
<view class="steps">
<uni-steps :options="steps" :active="stepActive" active-color="#4f607e" />
</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>
<uni-forms-item label="到访日期" required name="date">
<uni-datetime-picker type="date" :start="toadyStart" return-type="string" v-model="form.date" />
<uni-forms-item label="开始日期" required name="start_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 label="到访时段" required name="visit_time_id">
<uni-data-checkbox v-model="form.visit_time_id" :localdata="visitTime"
@ -75,7 +78,11 @@
<uni-forms-item label="备注">
<uni-easyinput type="textarea" v-model="form.remark" placeholder="请输入自我备注" />
</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-easyinput v-model="form.name" placeholder="请输入姓名" />
</uni-forms-item>
@ -186,12 +193,12 @@
<uni-forms-item label="收货人" v-if="form.type==3" required name="goodsName">
<uni-easyinput @clear="clearAccept('goods')" disabled v-model="form.goodsName"
@tap="adminListShowOpen('goods')" placeholder="请选择联系人员" />
</uni-forms-item>
<view class="formtext" v-if="visitAreaText=='生产区'"></view>
<uni-forms-item label="陪同人" required name="accompanyName" v-if="visitAreaText=='生产区'">
<uni-easyinput @clear="clearAccept('accompany')" disabled v-model="form.accompanyName"
@tap="adminListShowOpen('accompany')" placeholder="请选择联系人员" />
</uni-forms-item>
<view class="formtext" v-if="visitAreaText=='生产区'"></view>
<uni-forms-item label="陪同人" required name="accompanyName" v-if="visitAreaText=='生产区'">
<uni-easyinput @clear="clearAccept('accompany')" disabled v-model="form.accompanyName"
@tap="adminListShowOpen('accompany')" placeholder="请选择联系人员" />
</uni-forms-item>
<qianziyu-select :show="adminListShow" type="radio" :popupTitle="'联系人员'" name="cworkStationName"
:dataLists="adminList" placeholder="输入陪同人具体姓名或手机号搜索" @search="selectSearch" @submit="submitAccept"
@ -255,6 +262,7 @@
configInfo: {},
configKey: "ptfk",
toadyStart: '',
dateRange: [],
carindex: 0,
plateShow: false,
adminListShow: false,
@ -298,10 +306,16 @@
},
follow_people_index: -1,
rules: {
date: {
start_date: {
rules: [{
required: true,
errorMessage: '请选择到访日期'
errorMessage: '请选择开始日期'
}]
},
end_date: {
rules: [{
required: true,
errorMessage: '请选择结束日期'
}]
},
visit_time_id: {
@ -484,6 +498,14 @@
this.getConfig()
}
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')) {
this.form = uni.getStorageSync('formdata')
}
@ -527,8 +549,8 @@
}
},
submitAccept(e) {
console.log(e)
this.form.accompany_id = e.id
console.log(e)
this.form.accompany_id = e.id
this.form.accompanyName = e.name
if (this.acceptType == 'accept') {
this.form.accept_admin_id = e.id
@ -785,6 +807,12 @@
for (var k of this.form.follw_people) {
id_arr.push(k.idcard)
}
// datestart_date
if (this.form.start_date) {
this.form.date = this.form.start_date
}
this.$refs['formdata'].validate().then(res => {
this.util.request({
api: '/api/mobile/visit/idcard-check',
@ -826,6 +854,12 @@
if (this.form.credent == 2) {
this.form.idcard = this.form.passcard
}
// datestart_date
if (this.form.start_date) {
this.form.date = this.form.start_date
}
this.$refs['formdata'].validate().then(res => {
console.log("form", this.form)
// return
@ -847,8 +881,8 @@
})
},
submitForm() {
let that = this
console.log("form",this.form)
let that = this
console.log("form",this.form)
// return
this.util.request({
api: '/api/admin/visit/save',
@ -909,7 +943,7 @@
url: '/pages/visit/successform'
})
} else {
//
// ""
uni.requestSubscribeMessage({
tmplIds: ['OfDFwAIZyXqvPgmc_czIXhveVtp3n_ftyWJEks1DSi4',
'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
// datestart_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>
@ -959,7 +1078,7 @@
.configtitle {
font-size: 40rpx;
text-align: center;
margin-top: 36rpx;
margin-top: 36rpx;
padding-bottom: 20rpx;
}
@ -996,8 +1115,6 @@
color: #fff !important
}
.areavalue {}
.areabtn {
background-color: #4f607e;
/* margin-left: 8px; */
@ -1011,4 +1128,31 @@
/deep/ .areavalue .uni-data-checklist .checklist-group .checklist-box.is--button {
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>
Loading…
Cancel
Save