You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

319 lines
8.1 KiB

<template>
<view class="pageBg">
<view class="pageBgImg pad">
<view class="status_bar"></view>
<view class="" style="height: 44rpx;"></view>
<view class="searchBox">
<searchRow placeholder="搜索学员姓名、学员手机号" @searchFn="searchFn"></searchRow>
</view>
<view class="card">
<view class="myClass">
<view class="leftTxt">我的排课</view>
<view class="leftBtn" @click="$goPage('/pages/recordEntry/operate/mySchedule/mySchedule')">去管理</view>
</view>
</view>
</view>
<div class="pad">
<view class="tabs">
<view class="tab" v-for="(item,index) in tabArr" :key="index" :class="{active: params.status==item.id}"
@click="changeTab(item)">{{ item.text }}</view>
</view>
<view class="screen_row">
<view class="selectItem" @click="showSubject=true">
<view class="text oneRowText">{{screen.subject}}</view>
<view class="downIcon">
<u-icon name="arrow-down"></u-icon>
</view>
</view>
<view class="selectItem" @click="showCar=true">
<view class="text oneRowText">{{screen.car}}</view>
<view class="downIcon">
<u-icon name="arrow-down"></u-icon>
</view>
</view>
<view class="selectItem">
<view class="text" @click="showDatePicker=true">{{screen.timer}}</view>
<view class="downIcon">
<u-icon name="arrow-down" v-if="screen.timer=='预约时间'" @click="showDatePicker=true"></u-icon>
<u-icon name="close" :size="'28rpx'" v-else @click="cancelDate"></u-icon>
</view>
</view>
</view>
<view class="list" v-if="list.length">
<view class="card" v-for="(item,index) in list" :key="index">
<appointItem-operate @click.native="$goPage('/pages/recordEntry/operate/detail/detail?id='+item.id)" :item="item"/>
</view>
</view>
<!-- <nodata v-if="!list.length"></nodata> -->
<view v-if="list.length">
<u-loadmore :status="status" />
</view>
<nodata v-if="!list.length&&status=='nomore'"></nodata>
<UserTab name ='实操训练'></UserTab>
</div>
<u-calendar :show="showDatePicker" ref="calendar" @confirm="confirmDatePicker" @close="cancelDate" :minDate="minDate" :maxDate="maxDate"></u-calendar>
<u-picker :show="showCar" :columns="carColumns" keyName="licnum" @confirm="confirmCar" @cancel="showCar=false" :closeOnClickOverlay="true" @close="showCar=false"></u-picker>
<u-picker :show="showSubject" :columns="subjectTxt" keyName="lab" @confirm="confirmSubject" @cancel="showSubject=false" :closeOnClickOverlay="true" @close="showSubject=false"></u-picker>
</view>
</template>
<script>
import { bookingMasterPage, carPage} from '@/config/api.js'
export default {
data() {
return {
tabArr: [{
text: '未签到',
id: 0
},
{
text: '已签到',
id: 1
},
{
text: '已签退',
id: 2
},
],//状态:0:未签到,1:已签到,2:已签退,3:已过期,9:已取消,示例值(2)
currentTab: 1,
screen: {
subject: '训练科目',
car: '预约车辆',
timer: '预约时间'
},
status: 'loading',
subjectTxt: [
[
{lab: '不限', id: 0},
{lab: '科目二', id: 2},
{lab: '科目三', id: 3},
]
],
// :0:不限;2:科目二;3:科目三
showDatePicker: false,
showCar: false,
showSubject: false,
carColumns: [],
params: {
pageNo: 1,
pageSize: 20,
status: 0,
carNumber: '',
bookingTime: []
},
list: [],
minDate: 0,
maxDate: 0,
}
},
onLoad() {
console.log('我的页面')
this.params.coachId = this.vuex_coachId
this.carPageFn()
// this.bookingMasterPageFn()
let nowTime = new Date()*1
// 一个月的时间戳
const oneMonthMilliseconds = 30 * 24 * 60 * 60 * 1000;
this.minDate = parseInt( nowTime - oneMonthMilliseconds )
this.maxDate = parseInt( nowTime + oneMonthMilliseconds )
},
onShow() {
uni.hideTabBar();
this.initList()
},
onPullDownRefresh() {
this.initList()
},
onReachBottom() {
if(this.list<this.total) {
this.initList()
}
},
methods: {
searchFn(val) {
// isPhone = this. uni.$u.test.mobile(this.FormData.phone)
if(/^\d+$/.test(val)) {
// 电话搜索
if( !this.$u.test.mobile(val)) return this.$u.toast('请输入正确的电话号码')
this.params.studentName = ''
this.params.studentPhone = val
}else {
// 学员姓名搜索
this.params.studentPhone = ''
this.params.studentName = val
}
this.status = 'loading'
this.list = []
this.params.pageNo = 1
this.bookingMasterPageFn()
},
cancelDate() {
this.showDatePicker=false
this.params.bookingStartTime = ''
this.params.bookingEndTime = ''
this.screen.timer = '预约时间'
this.initList()
},
async initList() {
this.status = 'loading'
this.list = []
this.params.pageNo = 1
this.params.studentName = ''
this.params.studentPhone = ''
this.bookingMasterPageFn()
},
async bookingMasterPageFn() {
console.log(this.params)
let obj = Object.assign({},this.params)
console.log(obj.carNumber)
if(obj.carNumber=='不限') delete obj.carNumber
const {data: res } = await bookingMasterPage(obj)
// uni.$u.http.get('/api/admin-api/business/booking/master/page', this.params ).then(res => {
// console.log(res)
// }).catch(err => {
// })
this.params.pageNo ++
this.list.push(...res.list)
this.total = res.total
if(this.list.length>=this.total) this.status = 'nomore'
console.log(res)
},
changeTab(item) {
if(item.id==this.params.status) return
this.params.status = item.id
this.initList()
},
confirmDatePicker(val) {
this.showDatePicker = false
this.screen.timer = val[0]
this.params.bookingStartTime = this.screen.timer+ ' 00:00:00'
this.params.bookingEndTime = this.screen.timer+ ' 23:59:59'
// this.params.bookingTime = [startTimer, bookingEndTimer]
this.initList()
},
confirmCar(val) {
let item = val.value[0]
this.screen.car = item.licnum
this.params.carNumber = item.licnum
this.showCar = false
this.initList()
},
confirmSubject(val) {
let item = val.value[0]
this.screen.subject = item.lab
this.params.subject = item.id
this.initList()
this.showSubject = false
},
async carPageFn() {
let obj = {
pageNo: 1,
pageSize: 40,
schoolId: this.vuex_schoolId,
coachId: this.vuex_coachId
}
const {data: res} = await carPage(obj)
res.list.unshift({licnum: '不限', id: 0})
this.carColumns = [res.list]
},
}
}
</script>
<style lang="scss" scoped>
.pageBg {
padding-bottom: 100rpx;
.pageBgImg {
height: 100%;
padding-bottom: 30rpx;
}
.searchBox {
padding: 24rpx 0;
}
.card {
padding: 0 28rpx;
margin-bottom: 20rpx;
.myClass {
height: 108rpx;
display: flex;
justify-content: space-between;
padding: 0 10rpx;
align-items: center;
.leftTxt {
font-size: 32rpx;
font-weight: 500;
}
.leftBtn {
width: 192rpx;
height: 60rpx;
background: $themC; border-radius: 8rpx;
line-height: 60rpx;
text-align: center;
font-weight: 500;
color: #FFFFFF;
}
}
}
.tabs {
height: 72rpx;
background: #FFFFFF;
border-radius: 16rpx;
display: flex;
line-height: 72rpx;
text-align: center;
color: #ADADAD;
margin: -24rpx 0 24rpx 0;
.tab {
flex: 1;
text-align: center;
&.active {
background: rgba(25, 137, 250, 0.1);
border: 2rpx solid #1989FA;
color: $themC;
border-radius: 16rpx;
}
}
}
.screen_row {
display: flex;
margin-bottom: 24rpx;
width: 100%;
justify-content: space-between;
.selectItem {
display: flex;
padding: 0 18rpx;
border: 2rpx solid rgba(25,137,250,0.3);
height: 60rpx;
border-radius: 16rpx;
background-color: #FFFFFF;
line-height: 60rpx;
align-items: center;
width: 29%;
.text {
color: $themC;
flex: 1;
white-space: nowrap;
text-align: center;
}
.downIcon {
width: 24rpx;
}
}
}
.list {
.card {
appointitem-operate {}
}
}
}
</style>