学员端小程序
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.
 
 
 

184 lines
4.0 KiB

<template>
<view class="step3">
<view class="card">
<view class="list">
<view class="listItem" v-for="(item,index) in list" :key="index" :class="{active: FormData.deviceNum==item.seq}" @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="confirmClick">确认</view>
</view>
<u-popup :show="show" mode="center" :round="8">
<view class="popupCon">
<view class="h2">再次确认预约信息</view>
<view class="content">
<view class="row">
<view class="lab">预约类型</view>
<view class="val">模拟器训练预约</view>
</view>
<view class="row">
<view class="lab">预约时间</view>
<view class="val">{{FormData.classDate}} {{ FormData.classTime}}</view>
</view>
<view class="row">
<view class="lab">模拟驾驶馆</view>
<view class="val">{{FormData.pointName}}</view>
</view>
<view class="row">
<view class="lab">预约模拟器</view>
<view class="val">{{ FormData.deviceNum}}</view>
</view>
</view>
<view class="btn_row">
<view class="border btn" @click="show = false">返回修改</view>
<view class="btn" @click="simulationCreateFn">确认</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import { simulationDevices, simulationCreate } from '@/config/api.js'
export default {
props: ['FormData'],
data() {
return {
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.seq
// 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 res = await simulationCreate(obj)
if(res.code==0) {
this.show = false
this.$u.toast('预约成功')
setTimeout(()=>{
this.$goPage('/pages/mineEntry/myAppointment/myAppointment?currentTab=1')
},1500)
}
}
}
}
</script>
<style lang="scss" scoped>
.card {
padding: 28rpx 24rpx;
}
.list {
display: flex;
flex-wrap: wrap;
display: flex;
justify-content: space-between;
.listItem {
width: 32.4%;
height: 120rpx;
background: #F8F8F8;
border-radius: 12rpx;
font-weight: 500;
text-align: center;
line-height: 120rpx;
&.active {
width: 200rpx;
height: 120rpx;
background: rgba(25, 137, 250, 0.1);
border-radius: 12rpx;
border: 2rpx solid $themC;
color: $themC;
}
}
}
.popupCon {
padding: 30rpx 50rpx;
.h2 {
font-weight: 600;
color: #333333;
line-height: 70rpx;
font-size: 36rpx;
text-align: center;
}
.content {
padding-bottom: 20rpx;
.row {
padding: 22rpx 0;
display: flex;
font-size: 28rpx;
align-items: center;
.lab {
width: 180rpx;
color: #686B73;
}
.val {
flex: 1;
font-weight: 500;
}
}
}
}
.btn_row {
display: flex;
justify-content: space-between;
.btn {
width: 47%;
height: 72rpx;
background: #1989FA;
border-radius: 8rpx;
font-size: 28rpx;
color: #fff;
text-align: center;
line-height: 72rpx;
&.border {
background: rgba(25, 137, 250, 0.1);
border: 2rpx solid $themC;
color: $themC;
}
}
}
</style>