driverSchool/newPages/appointment/index.vue

280 lines
8.5 KiB
Vue
Raw Normal View History

2025-03-15 17:32:23 +08:00
<template>
<view class="page flex-col">
2025-04-03 16:47:39 +08:00
<view style="width: 100%;background: #f4f5f6;box-sizing: border-box;padding-top: 88px;">
2025-03-28 09:43:22 +08:00
<headers titles="预约训练">
2025-04-03 16:47:39 +08:00
<uni-icons type="left" color="#000000" size="22px"></uni-icons>
2025-03-28 09:43:22 +08:00
</headers>
2025-03-15 17:32:23 +08:00
</view>
2025-04-03 16:47:39 +08:00
<view style="padding: 10rpx 30rpx">
<u-subsection :list="list" :current="curNow" @change="sectionChange"></u-subsection>
</view>
<scroll-view style="height: 1200rpx;" scroll-y="true" class="itemContent" @scrolltolower="onReachBottomCus"
2025-03-28 09:43:22 +08:00
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<!-- 新增内容容器 -->
2025-04-03 16:47:39 +08:00
<view class="box_2 flex-col" v-if="curNow === 0">
2025-04-03 18:08:29 +08:00
<view class="box_4 flex-col" v-for="item in appointmentList" @click="goDetail(item,'')" :key="item.id">
2025-03-28 09:43:22 +08:00
<view class="group_5 flex-row justify-between">
<view class="block_3 flex-col justify-between">
<text class="text_2">{{ item.reservDay }}</text>
<view class="group_6 flex-row justify-between">
<view class="text-wrapper_1 flex-col">
<text class="text_3">{{ item.subjectStr }}</text>
</view>
<view class="text-wrapper_2 flex-col">
2025-04-03 16:47:39 +08:00
<text class="text_4">{{ item.courseType }}</text>
2025-03-28 09:43:22 +08:00
</view>
2025-03-15 17:32:23 +08:00
</view>
</view>
2025-04-03 16:47:39 +08:00
<view :class="item.status === true ? 'ytg' : 'text-wrapper_3'" class=" flex-col">
2025-03-28 09:43:22 +08:00
<text class="text_5">{{ item.statusStr }}</text>
</view>
2025-03-15 17:32:23 +08:00
</view>
2025-03-28 09:43:22 +08:00
<view class="text-wrapper_4 flex-row justify-between">
<text class="text_6">时间范围</text>
<text class="text_7">{{ item.reservTime }}</text>
</view>
<view class="text-wrapper_5 flex-row justify-between">
<text class="text_8">教练名称</text>
<text class="text_9">{{ item.coachName }}</text>
2025-03-15 17:32:23 +08:00
</view>
</view>
</view>
2025-04-03 16:47:39 +08:00
<!-- 新增内容容器 -->
<view class="box_2 flex-col" v-if="curNow === 1">
2025-04-03 18:08:29 +08:00
<view class="box_4 flex-col" v-for="item in appointmentList" @click="goDetail(item,'train')" :key="item.id">
2025-04-03 16:47:39 +08:00
<view class="group_5 flex-row justify-between">
<view class="block_3 flex-col justify-between">
<text class="text_2">{{ item.trainDay }}</text>
<view class="group_6 flex-row justify-between">
<view class="text-wrapper_1 flex-col">
<text class="text_3">{{ subjectArr[item.subject - 1] }}</text>
</view>
<view class="text-wrapper_2 flex-col">
<text class="text_4">{{ item.courseType }}</text>
</view>
</view>
</view>
</view>
<view class="text-wrapper_4 flex-row justify-between">
<text class="text_6">交通方式</text>
<text class="text_7">{{ item.transWay }}</text>
</view>
<view class="text-wrapper_4 flex-row justify-between">
<text class="text_6">训练地址</text>
<text class="text_7">{{ item.addr }}</text>
</view>
<view class="text-wrapper_4 flex-row justify-between">
<text class="text_6">训练时长</text>
<text class="text_7">{{ item.trainTime }}分钟</text>
</view>
<view class="text-wrapper_5 flex-row justify-between">
<text class="text_8">教练名称</text>
<text class="text_9">{{ item.coachName }}</text>
</view>
<view class="block_5 box_10 flex-row" style="justify-content: flex-end; margin: 0 20rpx 15rpx 0;" v-if="!item.ifEvaluate" @click="goEvaluateAdd(item)">
<view style="border: 1px solid rgba(44, 120, 245, 1); padding: 7rpx 30rpx; border-radius: 50rpx;color: rgba(44, 120, 245, 1)">
<text class="text_18">开始评价</text>
</view>
</view>
2025-03-28 09:43:22 +08:00
</view>
2025-03-15 17:32:23 +08:00
</view>
2025-03-28 09:43:22 +08:00
</scroll-view>
2025-04-03 16:47:39 +08:00
<view class="box_6 flex-col bottom_">
<view class="text-wrapper_12 flex-col " @click="goAppointment()">
<text class="text_19">预约</text>
</view>
</view>
2025-03-15 17:32:23 +08:00
</view>
</template>
<script>
2025-03-28 09:43:22 +08:00
import headers from "@/components/header/headers.vue";
import request from "@/utils/request";
2025-03-15 17:32:23 +08:00
export default {
2025-04-03 16:47:39 +08:00
components: {
headers
},
2025-03-15 17:32:23 +08:00
data() {
return {
2025-03-28 09:43:22 +08:00
isTriggered: false,
pageNo: 1,
pageSize: 10,
total: 0,
appointmentList: [],
2025-04-03 16:47:39 +08:00
constants: {},
list: ['预约记录', '训练记录'],
curNow: 0,
subjectArr:['科目一','科目二','科目三','科目四']
2025-03-15 17:32:23 +08:00
};
},
2025-03-28 09:43:22 +08:00
onLoad() {
this.getList()
2025-04-03 16:47:39 +08:00
uni.$on('refresh', (data) => {
this.pageNo = 1
this.appointmentList = []
if (this.curNow === 0) {
this.getList()
} else {
this.getTrainList()
}
})
2025-03-28 09:43:22 +08:00
},
methods: {
goback() {
uni.navigateBack()
},
2025-04-03 16:47:39 +08:00
sectionChange(index) {
this.curNow = index;
this.pageNo = 1
this.appointmentList = []
if (this.curNow === 0) {
this.getList()
} else {
this.getTrainList()
}
},
getList() {
2025-03-28 09:43:22 +08:00
request({
url: '/app-api/drivingSchool/system/reservationCourse/list',
method: 'GET',
params: {
pageNum: this.pageNo,
pageSize: this.pageSize,
2025-04-03 16:47:39 +08:00
ifCancel: false
2025-03-28 09:43:22 +08:00
},
tenantIdFlag: false
}).then(res => {
2025-04-03 16:47:39 +08:00
console.log('获取预约列表', res)
2025-03-28 09:43:22 +08:00
if (this.pageNo === 1) {
this.total = res.data.total
this.appointmentList = []
this.appointmentList = res.data.records
2025-04-03 16:47:39 +08:00
} else {
this.appointmentList = this.appointmentList.concat(res.data.records)
2025-03-28 09:43:22 +08:00
}
2025-04-03 16:47:39 +08:00
this.isTriggered = false
})
},
getTrainList() {
request({
url: '/app-api/train/page',
method: 'GET',
params: {
pageNum: this.pageNo,
pageSize: this.pageSize,
selectType: 'all'
},
tenantIdFlag: false
}).then(res => {
console.log('获取预约列表', res)
if (this.pageNo === 1) {
this.total = res.data.total
this.appointmentList = []
this.appointmentList = res.data.records
} else {
this.appointmentList = this.appointmentList.concat(res.data.records)
}
this.isTriggered = false
})
},
goDetail(data,str) {
//将data转为字符串
uni.navigateTo({
url: `/newPages/appointmentDetail/index?data=${JSON.stringify(data)}&type=${str}`
2025-03-28 09:43:22 +08:00
})
},
/**
* 上滑加载数据
*/
onReachBottomCus() {
//判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕
if (this.pageNo * this.pageSize >= this.total) {
uni.$u.toast('没有更多数据了')
return
}
//页码+1,调用获取数据的方法获取第二页数据
this.pageNo++
//此处调用自己获取数据列表的方法
2025-04-03 16:47:39 +08:00
if (this.curNow === 1) {
this.getTrainList()
} else {
this.getList()
}
2025-03-28 09:43:22 +08:00
},
/**
* 下拉刷新数据
*/
onRefresherrefresh() {
this.isTriggered = true
this.pageNo = 1
this.total = 0
this.appointmentList = []
2025-04-03 16:47:39 +08:00
if (this.curNow === 1) {
this.getTrainList()
} else {
this.getList()
}
2025-03-28 09:43:22 +08:00
},
2025-04-01 17:52:14 +08:00
goAppointment() {
uni.navigateTo({
url: '/newPages/appointmentAdd/index'
})
2025-04-03 16:47:39 +08:00
},
goEvaluateAdd(data) {
data = JSON.stringify(data)
uni.navigateTo({
url: `/newPages/evaluateAdd/index?data=${data}&type=xunlian&controls=add`
})
},
2025-03-28 09:43:22 +08:00
}
2025-03-15 17:32:23 +08:00
};
</script>
<style lang='scss'>
@import '../common/common.scss';
@import './assets/style/index.rpx.scss';
2025-03-28 09:43:22 +08:00
// 新增样式
.content-box {
2025-04-03 16:47:39 +08:00
margin-top: 88rpx;
/* 根据头部高度调整 */
2025-03-28 09:43:22 +08:00
padding: 20rpx;
overflow-y: auto;
2025-04-03 16:47:39 +08:00
height: calc(100vh - 88rpx);
/* 确保内容区域高度正确 */
2025-03-28 09:43:22 +08:00
}
.header {
width: 100%;
background: #f4f5f6;
box-sizing: border-box;
padding-top: 88px;
}
2025-04-03 16:47:39 +08:00
.bottom_ {
2025-04-01 17:52:14 +08:00
position: fixed;
bottom: 0;
}
2025-04-03 16:47:39 +08:00
.ytg {
background-color: #cfe2ff;
border-radius: 4px;
height: 40rpx;
margin-top: 22rpx;
width: 96rpx;
.text_5 {
width: 72rpx;
height: 24rpx;
overflow-wrap: break-word;
color: rgba(4, 78, 242, 1);
font-size: 24rpx;
font-family: PingFang SC-Regular;
font-weight: NaN;
text-align: left;
white-space: nowrap;
line-height: 24rpx;
margin: 8rpx 0 0 12rpx;
}
}
2025-03-15 17:32:23 +08:00
</style>