Browse Source

模拟预约

master
unknown 1 year ago
parent
commit
45d1238d0b
  1. 6
      config/api.js
  2. 4
      pages/carEntry/examineAppointment/comp/pickDate.vue
  3. 380
      pages/carEntry/simulateAppointment/comp/pickDate.vue
  4. 15
      pages/carEntry/simulateAppointment/comp/step1.vue
  5. 7
      pages/carEntry/simulateAppointment/comp/step2.vue
  6. 59
      pages/carEntry/simulateAppointment/comp/step3.vue
  7. 34
      pages/carEntry/simulateAppointment/simulateAppointment.vue
  8. 5
      pages/indexEntry/enroll/registInfo/registInfo.vue
  9. 4
      pages/mineEntry/myAppointment/comp/examin.vue
  10. 11
      pages/mineEntry/myAppointment/detail/detail.vue
  11. 1
      pages/mineEntry/myAppointment/detail/examin.vue

6
config/api.js

@ -101,9 +101,11 @@ export const getContractStatus = (params) => http.get('business/contract/getCont
// 1获得模拟预约点
export const simulationPoint = (params) => http.get('business/booking/simulation-point/page', {params})
// 2获得模拟器排课
export const simulationClass = (params) => http.get('business/booking/simulation-class/get', {params})
export const simulationClass = (params) => http.get('business/booking/simulation-class/get', {params})
// 3获得模拟器
export const simulationDevices = (params) => http.get('business/booking/simulation-devices/list', {params})
// 4创建模拟预约
export const simulationCreate = (data) => http.post('business/booking/simulation-record/create', data)
// 1新增实操预约记录
export const masterCreate = (data) => http.post('business/booking/master/create', data)
// 1获得考场
@ -119,7 +121,7 @@ export const examSimulationRecord = (params) => http.get('business/exam-simulati
// 6 考场模拟详情
export const examSimulationGet = (params) => http.get('business/exam-simulation-record/get', {params})
// 7取消预约
export const cancelSimulation = (data) => http.put(`business/exam-simulation-record/cancelSimulation`, data)
export const cancelSimulation = (data) => http.put(`business/exam-simulation-record/cancelSimulation?id=${data.id}`)
// 1获得实操预约排课
export const scheduleClass = (params) => http.get('business/booking/schedule-class/get', {params})

4
pages/carEntry/examineAppointment/comp/pickDate.vue

@ -130,8 +130,8 @@
let obj = { "examSiteId": this.FormData.examSiteId, "examCarId": this.FormData.carId, "trainType": this.FormData.trainType, "subject": this.FormData.subject, "classDate": this.chooseDay}
const {data: res} = await examSimulationClass(obj)
this.timerArr = res.afternoonSimulationClass
this.timerArr2 = res.morningSimulationClass
this.timerArr2 = res.afternoonSimulationClass
this.timerArr = res.morningSimulationClass
//
if(this.chooseDay==this.dateArr[0][0].date) {
let arr = [...this.timerArr,...this.timerArr2]

380
pages/carEntry/simulateAppointment/comp/pickDate.vue

@ -0,0 +1,380 @@
<template>
<view class="step1">
<view class="card">
<view class="dateBox">
<view class="month-row">
<view class="month" @click="show=true">{{ currentMonth }}</view>
<view class="arrow">
<u-icon name="arrow-down" :size="12" :color="'#1989FA'"></u-icon>
</view>
</view>
<view class="date_row">
<view class="icon left" @click="changeDateIndex(-1)">
<u-icon name="arrow-left" :size="12" :color="'#fff'"></u-icon>
</view>
<view class="dateArr" >
<view class="dateWidth" v-for="(item,index) in dateArr[currentDay]" :key="index" @click="chooseDate(item)" >
<view class="date" :class="{active: chooseDay==item.date}">
<!-- <view class="dian"></view> -->
<view class="week">{{ item.week }}</view>
<view class="num">{{ item.num }}</view>
</view>
</view>
</view>
<view class="icon right" @click="changeDateIndex(1)">
<u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
</view>
</view>
</view>
</view>
<view class="card" >
<view class="timeCon">
<view class="h2" v-if="timerArr.length">上午</view>
<view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}" >
<view class="flex" v-if="item.status==0">
<view class="lab">{{ item.alreadyAppointmentCount ||0 }} <text>/</text> {{ item.appointmentSum}}</view>
<view class="iconArrowBg" v-if="item.alreadyAppointmentCount">
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon>
</view>
</view>
<view class="lab" v-else>{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view>
</view>
</view>
<view class="h2" v-if="timerArr2.length">下午</view>
<view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseCourse(item)" :class="{active: courseIds==item.id, disable: item.status!=0}">
<view class="flex" v-if="item.status==0">
<view class="lab">{{ item.alreadyAppointmentCount ||0 }} <text>/</text> {{ item.appointmentSum}} </view>
<view class="iconArrowBg" v-if="item.alreadyAppointmentCount">
<u-icon name="arrow-right" :size="10" :color="'#fff'"></u-icon>
</view>
</view>
<view class="lab" v-else>{{ statusTxt[item.status] }}</view>
<view class="time">{{ item.classTime }}</view>
</view>
</view>
</view>
</view>
<view class="card" v-if="!timerArr2.length&&!timerArr.length">
<nodata>暂无预约排课</nodata>
</view>
<u-datetime-picker
:show="show"
v-model="chooseMonth"
:minDate="minDate"
:maxDate="maxDate"
mode="year-month"
@confirm="changeMonth"
></u-datetime-picker>
</view>
</template>
<script>
import { getDates, getMonthsBetweenDates } from '@/config/utils.js'
import { simulationClass } from '@/config/api.js'
export default {
props: ['step', 'FormData'],
data() {
return {
maxDate: 0,
minDate: 0,
monthArr: [],
show: false,
dateArr: [],
currentDay: 0,//
chooseDay: '',
chooseMonth: '',
timerArr: [],
statusTxt: ['可预约', '已过期', '已约满', ], //0 2 3
timerArr2: [],
chooseTimerId: '',
endDate: null,
startDate: null,
courseIds: '',
radioVal: '',
}
},
mounted() {
this.initDate()
},
computed: {
currentMonth() {
let tiemr = new Date(this.chooseDay) * 1
return this.$u.date(tiemr, 'yyyy.mm')
}
},
watch: {
courseIds: {
handler(val) {
let allTimer = [...this.timerArr,...this.timerArr2]
let total = allTimer.reduce((pre, item)=>{
if(item.status==1) {
pre.push(item.classTime)
}
return pre
},[])
if(total.length==this.courseIds.length) {
this.radioVal = 0
}
}
}
},
methods: {
//
async simulationClassFn() {
// let id = this.vuex_userInfo.id
let obj = { "pointId": this.FormData.pointId, "trainType": this.FormData.trainType, "classDate":this.chooseDay, "studentId": this.FormData.studentId}
const {data: res} = await simulationClass(obj)
this.timerArr2 = res.afternoonSimulationClass
this.timerArr = res.morningSimulationClass
console.log('this.timerArr')
console.log(this.timerArr)
//
if(this.chooseDay==this.dateArr[0][0].date) {
let arr = [...this.timerArr,...this.timerArr2]
arr.forEach(item=>{
let timer = new Date() * 1
let date = this.chooseDay+' '+(item.classTime.split('-')[0])
date = date.replace(/-/g,'/');
let timer2 = new Date(date).getTime();
// console.log(timer)
// console.log(timer2)
// console.log(date)
if(timer>timer2) {
item.status = 2
}
})
}
},
//
async initDate() {
this.startDate = this.$u.timeFormat(new Date()*1, 'yyyy-mm-dd');
this.maxDate = this.endDate = new Date('2023-11-30')*1
this.minDate = new Date()*1
this.dateArr = getDates(this.startDate, this.endDate);
this.chooseDay = this.dateArr[0][0].date
console.log(this.dateArr)
this.simulationClassFn()
},
//
changeMonth(val) {
let startDate = this.$u.date(val.value, 'yyyy-mm-dd')
for(let i=0; i<this.dateArr.length; i++) {
for(let j=0; j<this.dateArr[i].length; j++) {
let date = this.dateArr[i][j].date
if(startDate==date) {
this.currentDay = i
this.chooseDay = date
}
}
}
this.show = false
},
//
chooseDate(item) {
this.chooseDay = item.date
this.simulationClassFn()
console.log('*****')
console.log(item)
},
changeDateIndex(num) {
if(this.currentDay==0&&num==-1) return this.$u.toast('已是可选最小日期')
if(this.currentDay==this.dateArr.length-1&&num==1) return this.$u.toast('已是可选最大日期')
this.currentDay = this.currentDay + num
this.chooseDay = this.dateArr[this.currentDay][0].date
},
chooseCourse(item) {
this.FormData.courseIds = this.courseIds = item.id
this.FormData.classDate = item.classDate
this.FormData.classTime = item.classTime
console.log(item)
},
}
}
</script>
<style lang="scss" scoped>
.card {
width: 100%;
margin-bottom: 24rpx;
overflow: hidden;
.dateBox {
padding: 36rpx 0 40rpx 0;
.month-row {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 36rpx;
.month {
font-size: 32rpx;
color: $themC;
}
.arrow {
margin-left: 6rpx;
}
}
.date_row {
width: 100%;
height: 100rpx;
position: relative;
.icon {
width: 40rpx;
height: 40rpx;
background: rgba(51,51,51,0.18);
backdrop-filter: blur(4rpx);
position: absolute;
top: 50%;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
&.left {
left: 16rpx;
}
&.right {
right: 16rpx;
}
}
.dateArr {
display: flex;
padding: 0 70rpx;
// justify-content: space-between;
&.oneDate {
justify-content: center;
}
.dateWidth {
width: 20%;
display: flex;
justify-content: center;
}
.date {
width: 74rpx;
height: 100rpx;
border-radius: 16rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #333;
.dian {
width: 12rpx;
height: 12rpx;
background: #D8D8D8;
border-radius: 50%;
&.active {
background: #1989FA;
}
}
&.active {
background: rgba(25,137,250,0.1);
border: 2rpx solid #1989FA;
color: $themC;
}
.week {
}
.num {
margin-top: 4rpx;
}
}
}
}
}
}
.card {
.timeCon {
padding: 0 24rpx 40rpx 24rpx;
}
.h2 {
line-height: 90rpx;
font-weight: 500;
color: #333;
}
.time_box {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
&::after{
display:block;
content:"";
width: 32%;
height:0px;
}
.time_item {
width: 30%;
height: 120rpx;
background: #F8F8F8;
border-radius: 12rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 12rpx;
margin-bottom: 20rpx;
color: #333;
&.active {
background: rgba(25,137,250,0.1);
border: 2rpx solid #1989FA;
color: $themC;
}
&.disable {
opacity: 0.4;
}
.lab {
font-size: 28rpx;
font-weight: 500;
}
.time {
font-size: 24rpx;
margin-top: 4rpx;
}
}
}
}
.btn {
width: 47%;
height: 72rpx;
background: #1989FA;
border-radius: 8rpx;
font-size: 28rpx;
color: #fff;
text-align: center;
line-height: 72rpx;
margin: 108rpx auto 50rpx auto;
}
.iconArrowBg {
background: #D8D8D8;
width: 26rpx;
height: 26rpx;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
margin-left: 4px;
}
.step2 {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 40px;
.btnBg {
width: 310rpx;
}
}
</style>

15
pages/carEntry/simulateAppointment/comp/step1.vue

@ -1,13 +1,13 @@
<template>
<view class="step2">
<view class="card" v-for="(item,index) in 10" :key="index" :class="{active: index==2}">
<view class="card" v-for="(item,index) in list" :key="index" :class="{active: FormData.pointId==item.id}" @click="choosePoint(item)">
<view class="leftTxt">
<view class="name oneRowText">某某模拟驾驶馆</view>
<view class="adr">江西省江西市江西区尚坤丁兰国际1190</view>
<view class="name oneRowText">{{ item.pointName }}</view>
<view class="adr">{{item.pointAddress}}</view>
</view>
<view class="icon">
<image src="@/static/images/index/telephone.png" mode=""></image>
<!-- <image src="@/static/images/index/telephone_cli.png" mode=""></image> -->
<image src="@/static/images/index/telephone_cli.png" mode="" v-if="FormData.pointId==item.id"></image>
<image src="@/static/images/index/telephone.png" mode="" v-else></image>
</view>
</view>
<view class="poz_btn">
@ -21,9 +21,14 @@
<script>
export default {
props: ['list', 'FormData'],
methods: {
changeStep(val) {
if(!this.FormData.pointId) return this.$u.toast('请选择模拟馆')
this.$emit('changeStep', val)
},
choosePoint(item) {
this.$emit('choosePoint',item)
}
}
}

7
pages/carEntry/simulateAppointment/comp/step2.vue

@ -1,7 +1,7 @@
<template>
<view class="step1">
<pickDateTimer/>
<pickDate :FormData="FormData"/>
<view class="poz_btn">
<view class="btn_row" >
@ -13,14 +13,17 @@
</template>
<script>
import pickDate from './pickDate'
import { examSimulationCreate } from '@/config/api.js'
export default {
components: {pickDate},
props: ['step','FormData'],
data() {
return {
}
},
mounted() {
},
methods: {

59
pages/carEntry/simulateAppointment/comp/step3.vue

@ -2,14 +2,14 @@
<view class="step3">
<view class="card">
<view class="list">
<view class="listItem" v-for="(item,index) in list" :key="index" :class="{active: index==1}">
{{ item.text }}</view>
<view class="listItem" v-for="(item,index) in list" :key="index" :class="{active: FormData.deviceNum==item.id}" @click="chooseDevice(item)">
{{ item.seq }}</view>
</view>
</view>
<view class="btn_row" style="margin-top: 108rpx;">
<view class="border btn" @click="changeStep(2)">返回上一步</view>
<view class="btn" @click="show=true">确认</view>
<view class="btn" @click="confirmClick">确认</view>
</view>
<u-popup :show="show" mode="center" :round="8">
@ -22,20 +22,20 @@
</view>
<view class="row">
<view class="lab">预约时间</view>
<view class="val">2023/08/08 08:009:00</view>
<view class="val">{{FormData.classDate}} {{ FormData.classTime}}</view>
</view>
<view class="row">
<view class="lab">模拟驾驶馆</view>
<view class="val">某某模拟驾驶馆</view>
<view class="val">{{FormData.pointName}}</view>
</view>
<view class="row">
<view class="lab">预约模拟器</view>
<view class="val">00002</view>
<view class="val">{{ FormData.deviceName}}</view>
</view>
</view>
<view class="btn_row">
<view class="border btn" @click="show = false">返回修改</view>
<view class="btn">确认</view>
<view class="btn" @click="simulationCreateFn">确认</view>
</view>
</view>
</u-popup>
@ -43,28 +43,47 @@
</template>
<script>
import { simulationDevices, simulationCreate } from '@/config/api.js'
export default {
props: ['FormData'],
data() {
return {
list: [{
text: '00001',
id: 1
},
{
text: '00002',
id: 1
},
{
text: '00003',
id: 1
},
],
list: [],
show: false
}
},
created() {
this.simulationDevicesFn()
},
methods: {
changeStep(val) {
this.$emit('changeStep', val)
},
async simulationDevicesFn() {
let arr = this.FormData.classTime.split('-')
let obj = { "pointId": this.FormData.pointId, "classDate": this.FormData.classDate, "beginTime": arr[0], "endTime": arr[1]}
const {data: res} = await simulationDevices(obj)
this.list = res
},
chooseDevice(item) {
this.FormData.deviceNum = item.id
this.FormData.deviceName = item.seq
},
confirmClick(item) {
if(!this.FormData.deviceNum) return this.$u.toast('请选择模拟器')
this.show = true
},
//
async simulationCreateFn() {
let obj = {
"studentId": this.FormData.studentId,
"classId": this.FormData.courseIds,
"deviceNum": this.FormData.deviceNum
}
const {data: res} = await simulationCreate(obj)
console.log(res)
}
}
}

34
pages/carEntry/simulateAppointment/simulateAppointment.vue

@ -23,9 +23,9 @@
</view>
</view>
<step1 v-if="currentStep==1" @changeStep="changeStep"></step1>
<step2 v-if="currentStep==2" @changeStep="changeStep"></step2>
<step3 v-if="currentStep==3" @changeStep="changeStep"></step3>
<step1 v-if="currentStep==1" @changeStep="changeStep" :list="list1" :FormData="FormData" @choosePoint="choosePoint"></step1>
<step2 v-if="currentStep==2" @changeStep="changeStep" :FormData="FormData"></step2>
<step3 v-if="currentStep==3" @changeStep="changeStep" :FormData="FormData"></step3>
</view>
</view>
</template>
@ -34,24 +34,48 @@
import step1 from './comp/step1'
import step2 from './comp/step2'
import step3 from './comp/step3'
import { simulationDevices, simulationPoint } from '@/config/api.js'
import { simulationDevices, simulationPoint, simulationClass } from '@/config/api.js'
export default {
components: { step1, step2, step3 },
data() {
return {
currentStep: 1
currentStep: 1,
list1: [],
FormData: {
pointName: '',
pointId: '',
trainType: '',
studentId: '',
deviceName: '',
classDate: '',
classTime: '',
deviceNum: ''
}
}
},
created() {
this.simulationPointFn()
this.FormData.trainType = this.vuex_userInfo.trainType
this.FormData.studentId = this.userId
},
methods: {
changeStep(num) {
this.currentStep = num
},
//
choosePoint(item) {
this.FormData.pointName = item.pointName
this.FormData.pointId = item.id
// this.simulationClassFn()
},
//
async simulationPointFn() {
const {data: res} = await simulationPoint({schoolId: this.vuex_userInfo.schoolId,lat: this.vuex_cityInfo.lat,lng: this.vuex_cityInfo.lng})
this.list1 = res
},
async simulationClassFn() {
let obj = { "pointId": this.FormData.pointId, "trainType": this.FormData.trainType, "classDate": "2023-11-01", "studentId": this.FormData.studentId}
const {data: res} = await simulationClass(obj)
},
async simulationDevicesFn() {
const {data: res} = await simulationDevices()

5
pages/indexEntry/enroll/registInfo/registInfo.vue

@ -309,7 +309,7 @@
driveLicence: '',//
firstDriveDate: '',//
sex: 2,
phone: '',
phone: '18267103167',
applyType: 1,
name: '',
oldTrainType: '',//
@ -480,7 +480,8 @@
this.form.school = item.name
this.form.schoolId = item.id
this.columnsCar = [item.businessScope.split(',')]
console.log(this.columnsCar)
console.log('驾校id')
console.log(item.id)
this.showSchool = false
this.schoolClassFn()
},

4
pages/mineEntry/myAppointment/comp/examin.vue

@ -7,7 +7,9 @@
<view class="tag" v-if="item.subject==3">科目三考场模拟</view>
</view>
<view class="status">
<view class="text"> {{item.writtenoffStatus==0?'待处理': '已完成'}}</view>
<!-- <view class="text"> {{item.writtenoffStatus==0?'待处理': '已完成'}}</view> -->
<view class="text" v-if="item.recordStatus==9">已取消</view>
<view class="text" v-else>{{statusTxt[item.recordStatus]}}</view>
<view class="icon">
<u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;"></u-icon>
</view>

11
pages/mineEntry/myAppointment/detail/detail.vue

@ -50,19 +50,20 @@
},
//
async cancelSimulationFn() {
const {data: res} = await cancelSimulation({id: this.id})
if(res.code==0) {
const res = await cancelSimulation({id: this.id})
console.log('没来到这里?')
// console.log(res)
// if(res.code==0) {
this.$u.toast('取消成功')
this.examSimulationGetFn()
}
// }
},
//
popupBtnClick(val) {
if(val==1) {
this.cancelSimulationFn()
}else {
this.show = false
}
this.show = false
console.log(val)
}
}

1
pages/mineEntry/myAppointment/detail/examin.vue

@ -35,6 +35,7 @@
<view class="border_bottom">
<view class="dateBox">
<view class="date">提交预约时间{{ $u.timeFormat(info.createTime, 'yyyy-mm-dd')}}</view>
<view class="date" v-if="info.cancelTime">取消时间{{ $u.timeFormat(info.cancelTime, 'yyyy-mm-dd')}}</view>
</view>
</view>
</view>

Loading…
Cancel
Save