Browse Source

实操预约

master
unknown 1 year ago
parent
commit
c20298b5ad
  1. 7
      config/api.js
  2. 21
      config/request.js
  3. 1
      pages/carEntry/examineAppointment/comp/pickDate.vue
  4. 6
      pages/carEntry/operaAppointment/comp/pickDate.vue
  5. 1
      pages/carEntry/simulateAppointment/comp/pickDate.vue
  6. 251
      pages/carEntry/simulateAppointment/comp/step1 - 副本.vue
  7. 1
      pages/carEntry/simulateAppointment/comp/step2.vue
  8. 12
      pages/mineEntry/myAppointment/comp/comp.scss
  9. 27
      pages/mineEntry/myAppointment/comp/opera.vue
  10. 19
      pages/mineEntry/myAppointment/detail/detail.vue
  11. 23
      pages/mineEntry/myAppointment/detail/opera.vue
  12. 21
      pages/mineEntry/myAppointment/myAppointment.vue
  13. 4
      pages/tabbar/index/index.vue

7
config/api.js

@ -130,6 +130,13 @@ export const cancelSimulation = (data) => http.put(`business/exam-simulation-rec
export const scheduleClass = (params) => http.get('business/booking/schedule-class/get', {params}) export const scheduleClass = (params) => http.get('business/booking/schedule-class/get', {params})
// 2,创建预约记录 // 2,创建预约记录
export const masterCreate = (data) => http.post('business/booking/master/create', data) export const masterCreate = (data) => http.post('business/booking/master/create', data)
// 3,获取实操预约记录
export const masterPage = (params) => http.get('business/booking/master/page', {params})
// 4,实操预约详情
export const masterDetail = (params) => http.get('business/booking/master/get', {params})
// 5实操取消预约
export const masterCancelBooking = (data) => http.put('business/booking/master/cancelBooking', data)

21
config/request.js

@ -26,8 +26,8 @@ module.exports = (vm) => {
// 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{}
config.data = config.data || {} config.data = config.data || {}
// 根据custom参数中配置的是否需要token,添加对应的请求头 // 根据custom参数中配置的是否需要token,添加对应的请求头
console.log('--------------')
console.log(config)
// console.log('--------------')
// console.log(config)
let token = vm.$store.state.user.vuex_loginInfo.accessToken let token = vm.$store.state.user.vuex_loginInfo.accessToken
if(token) { if(token) {
config.header.Authorization = 'Bearer ' + token config.header.Authorization = 'Bearer ' + token
@ -36,7 +36,6 @@ module.exports = (vm) => {
if(noToken&&config.header.Authorization) { if(noToken&&config.header.Authorization) {
delete config.header.Authorization delete config.header.Authorization
} }
console.log(config)
return config return config
}, config => { // 可使用async await 做异步操作 }, config => { // 可使用async await 做异步操作
return Promise.reject(config) return Promise.reject(config)
@ -45,9 +44,8 @@ module.exports = (vm) => {
// 响应拦截 // 响应拦截
uni.$u.http.interceptors.response.use(async (response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/ uni.$u.http.interceptors.response.use(async (response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
const data = response.data const data = response.data
console.log(response.config)
console.log('请求结果')
console.log(data)
// console.log('请求结果')
// console.log(data)
if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') { if(data.code==406&&response.config.url!='member/auth/refresh-token'&&response.config.url!=='member/auth/logout') {
await vm.$store.dispatch('refreshToken') await vm.$store.dispatch('refreshToken')
// uni.$u.toast('登录过期,请重新登录') // uni.$u.toast('登录过期,请重新登录')
@ -56,12 +54,11 @@ module.exports = (vm) => {
// },1500) // },1500)
// console.log(response.config) // console.log(response.config)
let obj = response.config let obj = response.config
if(obj.method=='GET') {
return uni.$u.http.get(obj.url, {params: obj.params})
}else if(obj.method=='PUT'){
return uni.$u.http.put(obj.url, obj.data )
}else if(obj.method=='POST'){
return uni.$u.http.post(obj.url, obj.data )
let method = obj.method.toLowerCase()
if(method=='get') {
return uni.$u.http.method(obj.url, {params: obj.params})
}else{
return uni.$u.http.method(obj.url, obj.data )
} }
} }
if(data.code==401) { if(data.code==401) {

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

@ -190,6 +190,7 @@
this.chooseDay = this.dateArr[this.currentDay][0].date this.chooseDay = this.dateArr[this.currentDay][0].date
}, },
chooseCourse(item) { chooseCourse(item) {
if(item.status!=0) return
this.FormData.courseIds = this.courseIds = item.id this.FormData.courseIds = this.courseIds = item.id
this.FormData.classDate = item.classDate this.FormData.classDate = item.classDate
this.FormData.classTime = item.classTime this.FormData.classTime = item.classTime

6
pages/carEntry/operaAppointment/comp/pickDate.vue

@ -14,12 +14,17 @@
</view> </view>
<view class="dateArr" > <view class="dateArr" >
<view class="dateWidth" v-for="(item,index) in dateArr[currentDay]" :key="index" @click="chooseDate(item)" > <view class="dateWidth" v-for="(item,index) in dateArr[currentDay]" :key="index" @click="chooseDate(item)" >
<u-transition :show="true" mode="fade">
<view class="transition">
<view class="date" :class="{active: chooseDay==item.date}"> <view class="date" :class="{active: chooseDay==item.date}">
<!-- <view class="dian"></view> --> <!-- <view class="dian"></view> -->
<view class="week">{{ item.week }}</view> <view class="week">{{ item.week }}</view>
<view class="num">{{ item.num }}</view> <view class="num">{{ item.num }}</view>
</view> </view>
</view> </view>
</u-transition>
</view>
</view> </view>
<view class="icon right" @click="changeDateIndex(1)"> <view class="icon right" @click="changeDateIndex(1)">
<u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon> <u-icon name="arrow-right" :size="12" :color="'#fff'"></u-icon>
@ -186,6 +191,7 @@
this.scheduleClassFn() this.scheduleClassFn()
}, },
chooseCourse(item) { chooseCourse(item) {
if(item.status!=0) return
this.FormData.courseIds = this.courseIds = item.id this.FormData.courseIds = this.courseIds = item.id
this.FormData.classDate = item.classDate this.FormData.classDate = item.classDate
this.FormData.classTime = item.classTime this.FormData.classTime = item.classTime

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

@ -192,6 +192,7 @@
this.chooseDay = this.dateArr[this.currentDay][0].date this.chooseDay = this.dateArr[this.currentDay][0].date
}, },
chooseCourse(item) { chooseCourse(item) {
if(item.status!=0) return
this.FormData.courseIds = this.courseIds = item.id this.FormData.courseIds = this.courseIds = item.id
this.FormData.classDate = item.classDate this.FormData.classDate = item.classDate
this.FormData.classTime = item.classTime this.FormData.classTime = item.classTime

251
pages/carEntry/simulateAppointment/comp/step1 - 副本.vue

@ -1,251 +0,0 @@
<template>
<view class="step1">
<view class="card">
<view class="dateBox">
<view class="month-row">
<view class="month">2032.08</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="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">上午</view>
<view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr" :key="index" @click="chooseTimerClick(item)" :class="{active: item.id==chooseTimerId, disable: item.status!==1}">
<view class="lab" v-if="item.status==3">已过期</view>
<view class="lab" v-if="item.status==2">已约满</view>
<view class="lab" v-if="item.status==1">可预约</view>
<view class="time">{{ item.timer }}</view>
</view>
</view>
<view class="h2">下午</view>
<view class="time_box">
<view class="time_item" v-for="(item,index) in timerArr2" :key="index" @click="chooseTimerClick(item)" :class="{active: item.id==chooseTimerId,disable: item.status!==1}">
<view class="lab" v-if="item.status==3">已过期</view>
<view class="lab" v-if="item.status==2">已约满</view>
<view class="lab" v-if="item.status==1">可预约</view>
<view class="time">{{ item.timer }}</view>
</view>
</view>
</view>
</view>
<view class="btn" @click="changeStep(2)">下一步</view>
</view>
</template>
<script>
import { getDates } from '@/config/utils.js'
export default {
data() {
return {
dateArr: [],
currentDay: 0,
chooseDay: '',
timerArr: [
{status: 1, timer: '06:00-07:00', id: 1},
{status: 2, timer: '06:00-07:00', id: 2},
{status: 3, timer: '06:00-07:00', id: 3},
],
timerArr2: [
{status: 1, timer: '06:00-07:00', id: 4},
{status: 2, timer: '06:00-07:00', id: 5},
{status: 3, timer: '06:00-07:00', id: 6},
],
chooseTimerId: ''
}
},
mounted() {
const startDate = new Date('2023-09-06');
const endDate = new Date();
this.dateArr = getDates(startDate, endDate);
},
methods: {
//
chooseTimerClick(item) {
if(item.status!=1) return this.$u.toast('请选择可预约时间')
this.chooseTimerId = item.id
},
//
chooseDate(item) {
this.chooseDay = item.date
console.log(this.chooseDay)
},
changeDateIndex(num) {
if(this.currentDay==0&&num==-1) return
if(this.currentDay==this.dateArr.length-1&&num==1) return
this.currentDay = this.currentDay + num
console.log(this.currentDay)
},
changeStep(val) {
this.$emit('changeStep', val)
},
}
}
</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;
&.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;
.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;
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;
}
</style>

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

@ -28,6 +28,7 @@
methods: { methods: {
changeStep(val) { changeStep(val) {
if(!this.FormData.courseIds) return this.$toast('请选择预约时间段')
this.$emit('changeStep', val) this.$emit('changeStep', val)
}, },

12
pages/mineEntry/myAppointment/comp/comp.scss

@ -8,7 +8,10 @@
border-bottom: 2rpx dashed #E8E9EC; border-bottom: 2rpx dashed #E8E9EC;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.flex {
width: 0;
flex: 1;
}
.tag { .tag {
// width: 176rpx; // width: 176rpx;
height: 60rpx; height: 60rpx;
@ -18,6 +21,7 @@
font-size: 28rpx; font-size: 28rpx;
color: #FA7919; color: #FA7919;
margin-right: 24rpx; margin-right: 24rpx;
white-space: nowrap;
padding: 10rpx 18rpx; padding: 10rpx 18rpx;
} }
@ -25,15 +29,19 @@
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
margin-left: 20rpx; margin-left: 20rpx;
flex: 1;
} }
.status { .status {
display: flex; display: flex;
align-items: center; align-items: center;
width: 140rpx;
flex-shrink: 0;
text-align: right;
.text { .text {
font-size: 28rpx; font-size: 28rpx;
color: $themC; color: $themC;
white-space: nowrap;
} }
} }
} }

27
pages/mineEntry/myAppointment/comp/opera.vue

@ -3,11 +3,12 @@
<view class="consultItem"> <view class="consultItem">
<view class="top_row"> <view class="top_row">
<view class="flex"> <view class="flex">
<view class="tag">科目二实操</view>
<view class="schoolName">xx模拟驾驶馆</view>
<view class="tag">{{item.subject==2?'科目二实操':item.subject==3?'科目三实操':'不限科目'}}</view>
<view class="schoolName oneRowText">{{item.siteName}}</view>
</view> </view>
<view class="status"> <view class="status">
<view class="text">待处理</view>
<view class="text" v-if="item.loginStatus==9">已取消</view>
<view class="text" v-else>{{statusTxt[item.loginStatus]}}</view>
<view class="icon"> <view class="icon">
<u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon> <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
</view> </view>
@ -21,7 +22,7 @@
</view> </view>
<view class="lab">所选择车辆</view> <view class="lab">所选择车辆</view>
</view> </view>
<view class="name">000001</view>
<view class="name">{{item.carNumber}}</view>
</view> </view>
<view class="row"> <view class="row">
<view class="leftLab"> <view class="leftLab">
@ -30,19 +31,27 @@
</view> </view>
<view class="lab">预约时间</view> <view class="lab">预约时间</view>
</view> </view>
<view class="name">2023/08/08 10:00:00</view>
<view class="name">{{$u.timeFormat(item.startTime, 'yyyy-mm-dd ')}}</view>
</view> </view>
</view> </view>
<view class="border_bottom">
<view class="dateBox">
<view class="date">完成时间2022-01-04</view>
<view class="border_bottom" v-if="item.status==2">
<view class="dateBox" v-if="item.signOutTime">
<view class="date">完成时间{{$u.timeFormat(item.signOutTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
</view> </view>
<!-- <view class="btnBg">去评价</view> -->
<view class="btnBg" @click.stop="$goPage('/pages/carEntry/evaluate/evaluate')">去评价</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default {
props: ['item'],
data() {
return {
statusTxt: ['未签到','已签到','已签退','旷课','已取消',''],//012退39
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

19
pages/mineEntry/myAppointment/detail/detail.vue

@ -25,7 +25,7 @@
import imitate from './imitate' import imitate from './imitate'
import opera from './opera' import opera from './opera'
import examin from './examin' import examin from './examin'
import { examSimulationGet, cancelSimulation, simulationDetail, cancelSimulationDevice } from "@/config/api.js"
import { examSimulationGet, cancelSimulation, simulationDetail, cancelSimulationDevice, masterDetail, masterCancelBooking } from "@/config/api.js"
export default { export default {
components: { imitate, opera, examin}, components: { imitate, opera, examin},
data() { data() {
@ -43,6 +43,8 @@
this.examSimulationGetFn() this.examSimulationGetFn()
}else if(this.type==1) { }else if(this.type==1) {
this.simulationDetailFn() this.simulationDetailFn()
}else {
this.masterDetailFn()
} }
}, },
methods: { methods: {
@ -51,6 +53,12 @@
const {data: res} = await examSimulationGet({id: this.id}) const {data: res} = await examSimulationGet({id: this.id})
this.info = res this.info = res
}, },
//
async masterDetailFn() {
const {data: res} = await masterDetail({id: this.id})
this.info = res
},
// //
async simulationDetailFn(item) { async simulationDetailFn(item) {
const {data: res} = await simulationDetail({id: this.id}) const {data: res} = await simulationDetail({id: this.id})
@ -72,6 +80,13 @@
this.$u.toast('取消成功') this.$u.toast('取消成功')
this.simulationDetailFn() this.simulationDetailFn()
}, },
//
async masterCancelBookingFn() {
const {data: res} = await masterCancelBooking({id: this.id})
this.$u.toast('取消成功')
this.masterDetailFn()
},
// //
popupBtnClick(val) { popupBtnClick(val) {
if(val==1) { if(val==1) {
@ -79,6 +94,8 @@
this.cancelSimulationDeviceFn() this.cancelSimulationDeviceFn()
}else if(this.type==3) { }else if(this.type==3) {
this.cancelSimulationFn() this.cancelSimulationFn()
}else {
this.masterCancelBookingFn()
} }
} }
this.show = false this.show = false

23
pages/mineEntry/myAppointment/detail/opera.vue

@ -3,11 +3,12 @@
<view class="consultItem"> <view class="consultItem">
<view class="top_row"> <view class="top_row">
<view class="flex"> <view class="flex">
<view class="tag">科目二实操</view>
<view class="schoolName">xx模拟驾驶馆</view>
<view class="tag">{{info.subject==2?'科目二实操':info.subject==3?'科目三实操':'不限科目'}}</view>
<view class="schoolName oneRowText">{{info.siteName}}</view>
</view> </view>
<view class="status"> <view class="status">
<view class="text">待处理</view>
<view class="text" v-if="info.loginStatus==9">已取消</view>
<view class="text" v-else>{{statusTxt[info.loginStatus]}}</view>
<view class="icon"> <view class="icon">
<u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon> <u-icon name="arrow-right" size="14" color="#686B73" style="margin-left: 12rpx;" ></u-icon>
</view> </view>
@ -21,7 +22,7 @@
</view> </view>
<view class="lab">所选择车辆</view> <view class="lab">所选择车辆</view>
</view> </view>
<view class="name">000001</view>
<view class="name">{{info.carNumber}}</view>
</view> </view>
<view class="row"> <view class="row">
<view class="leftLab"> <view class="leftLab">
@ -35,15 +36,23 @@
</view> </view>
<view class="border_bottom"> <view class="border_bottom">
<view class="dateBox"> <view class="dateBox">
<view class="date">提交预约时间2022-01-04</view>
<view class="date">完成时间2022-01-04</view>
<view class="data">核销来源计时机器001</view>
<view class="date">提交预约时间{{$u.timeFormat(info.startTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
<view class="date" v-if="info.signOutTime">完成时间{{$u.timeFormat(item.signOutTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
<view class="date">核销来源计时机器001</view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default {
props: ['info'],
data() {
return {
statusTxt: ['未签到','已签到','已签退','旷课','已取消',''],//012退39
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

21
pages/mineEntry/myAppointment/myAppointment.vue

@ -20,7 +20,7 @@
</view> </view>
<view class="tabCon" v-if="currentTab==2"> <view class="tabCon" v-if="currentTab==2">
<view class="card" v-for="(item,index) in 10" :key="index" @click="$goPage('/pages/mineEntry/myAppointment/detail/detail')">
<view class="card" v-for="(item,index) in list" :key="index" @click="$goPage('/pages/mineEntry/myAppointment/detail/detail?type=2&id='+item.id)">
<opera :item="item"></opera> <opera :item="item"></opera>
</view> </view>
</view> </view>
@ -44,7 +44,7 @@
import imitate from './comp/imitate' import imitate from './comp/imitate'
import opera from './comp/opera' import opera from './comp/opera'
import examin from './comp/examin' import examin from './comp/examin'
import { examSimulationRecord, simulationPage } from '@/config/api.js'
import { examSimulationRecord, simulationPage, masterPage } from '@/config/api.js'
export default { export default {
components: { imitate, opera, examin}, components: { imitate, opera, examin},
data() { data() {
@ -86,6 +86,8 @@
this.examSimulationRecordFn() this.examSimulationRecordFn()
}else if(this.currentTab==1) { }else if(this.currentTab==1) {
this.simulationPageFn() this.simulationPageFn()
}else {
this.masterPageFn()
} }
}, },
changeTab(item) { changeTab(item) {
@ -127,6 +129,21 @@
this.total = res.total this.total = res.total
if(this.list.length>=this.total) this.status = 'nomore' if(this.list.length>=this.total) this.status = 'nomore'
}, },
//
async masterPageFn() {
let obj = {}
for(let k in this.params) {
if(this.params[k]!=='') {
obj[k] = this.params[k]
}
}
const {data: res} = await masterPage(obj)
this.params.pageNo ++
this.list.push(...res.list)
this.total = res.total
if(this.list.length>=this.total) this.status = 'nomore'
},
// //
searchFn(val) { searchFn(val) {
this.params.keyWord = val this.params.keyWord = val

4
pages/tabbar/index/index.vue

@ -80,7 +80,7 @@
<view class="swiper-item" :class="'swiper-item' + index"> <view class="swiper-item" :class="'swiper-item' + index">
<view class="flex-b"> <view class="flex-b">
<view class="imgBox"> <view class="imgBox">
<image :src="item.picture" mode="widthFix"></image>
<image :src="item.picture" mode="aspectFill"></image>
</view> </view>
<view class="rightText"> <view class="rightText">
<view class="text towRowText">{{ item.title }}</view> <view class="text towRowText">{{ item.title }}</view>
@ -509,7 +509,7 @@
.imgBox { .imgBox {
width: 184rpx; width: 184rpx;
height: 148rpx; height: 148rpx;
// background: linear-gradient(180deg, rgba(0, 122, 255, 0.5) 0%, #007AFF 100%);
background: linear-gradient(180deg, rgba(0, 122, 255, 0.5) 0%, #007AFF 100%);
border-radius: 6rpx; border-radius: 6rpx;
overflow: hidden; overflow: hidden;
} }

Loading…
Cancel
Save