|
|
<template> <view class="pageBgImg"> <topNavbar title="预约详情"></topNavbar> <!-- 详情 --> <view class="pad"> <view class="card"> <imitate v-if="type==1" :info="info"/> <opera v-else-if="type==2" :info="info" ref="operaRef"/> <examin v-else-if="type==3" :info="info"/> </view> <view class="btnCon" v-if="type!=2"> <view class="btnBg" @click.stop="$goPage('/pages/carEntry/evaluate/evaluate')" v-if="info.writtenoffStatus==2">去评价</view> <view class="btnBorder" @click="canceClick" v-if="info.recordStatus==0">取消预约</view> <view class="btnBorder" v-if="info.payStatus==1">申请退款</view> </view> <view class="btnCon" v-else> <view class="btnBg" @click.stop="$goPage('/pages/carEntry/evaluate/evaluate')" v-if="info.loginStatus==2">去评价</view> <view class="btnBorder" @click="canceClick" v-if="info.loginStatus==0">取消预约</view> </view> </view> <u-popup :show="show" mode="center" :round="20" > <cancelReservation @popupBtnClick="popupBtnClick"/> </u-popup> </view> </template>
<script> import imitate from './imitate' import opera from './opera' import examin from './examin' import { examSimulationGet, cancelSimulation, simulationDetail, cancelSimulationDevice, masterDetail, masterCancelBooking } from "@/config/api.js" export default { components: { imitate, opera, examin}, data() { return { type: 1, show: false, id: '', info: '' } }, onLoad(options) { this.type = options.type this.id = options.id if(this.type==3) { this.examSimulationGetFn() }else if(this.type==1) { this.simulationDetailFn() }else { this.masterDetailFn() } }, methods: { // 获得考场模拟详情
async examSimulationGetFn() { const {data: res} = await examSimulationGet({id: this.id}) this.info = res }, // 获得实操拟详情
async masterDetailFn() { const {data: res} = await masterDetail({id: this.id}) res.bookingDetailRespVOS = res.bookingDetailRespVOS.sort((a,b)=>{ return parseInt(a.classTime.slice(0,2)) - parseInt(b.classTime.slice(0,2)) }) this.info = res }, // 获得模拟预约详情
async simulationDetailFn(item) { const {data: res} = await simulationDetail({id: this.id}) this.info = res }, // 取消考场模拟预约
async cancelSimulationFn() { const res = await cancelSimulation({id: this.id}) console.log('没来到这里?') // console.log(res)
// if(res.code==0) {
this.$u.toast('取消成功') this.examSimulationGetFn() // }
}, // 取消模拟预约
async cancelSimulationDeviceFn() { const {data: res} = await cancelSimulationDevice({id: this.id}) this.$u.toast('取消成功') this.simulationDetailFn() }, // 取消实操预约
async masterCancelBookingFn() { let ids = this.$refs.operaRef.ids const {data: res} = await masterCancelBooking(ids.join()) this.$refs.operaRef.ids = [] this.$u.toast('取消成功') this.masterDetailFn() }, // 取消预约事件
popupBtnClick(val) { if(val==1) { if(this.type==1) { this.cancelSimulationDeviceFn() }else if(this.type==3) { this.cancelSimulationFn() }else { this.masterCancelBookingFn() } } this.show = false console.log(val) }, canceClick() { if(this.type==2) { let ids = this.$refs.operaRef.ids if(!ids.length) return this.$u.toast('请选择取消时间段') } this.show=true } } } </script>
<style lang="scss" scoped> .card { padding: 0 24rpx; } .btnCon { display: flex; flex-direction: column; align-items: center; justify-content: center; margin-top: 76rpx; .btnBg { width: 212rpx; margin-bottom: 40rpx; } .btnBorder { width: 396rpx; border: 2rpx solid #E8E9EC; background-color: #fff; color: #ADADAD; margin-bottom: 40rpx; } } </style>
|