|
|
<template> <view class="main pageBg"> <view class="swiper-box" > <view class="navPoz"> <topNavbar title=" "></topNavbar> </view> <u-swiper :list="swiperList" :height="261"></u-swiper> <view class="radian"> <image :src="radianImg" mode=""></image> </view> </view> <view class="pad traTop"> <!-- 驾校信息 --> <view class="card " v-if="Object.keys(schoolDetail).length"> <view class="flex"> <view class="schoolLogo"> <image :src="schoolDetail.schoolIntroduceDO.iconPath" mode="" v-if="schoolDetail.schoolIntroduceDO"></image> </view> <view class="textCon"> <view class="name">{{schoolDetail.shortName}}</view> <view class="starBox"> <u-rate active-color="#1989FA" inactive-color="#1989FA" gutter="1" :size="16" :value="schoolDetail.stars" :readonly="true"></u-rate> <view class="num">{{schoolDetail.stars}}分</view> </view> <view class="evaluate" @click="$goPage('/pages/indexEntry/findShcool/shcoolComment/shcoolComment?id='+ schoolId)"> <view class="txt">{{schoolDetail.reviewTotal}}条评价</view> <u-icon name="arrow-right" color="#363A44" size="14"></u-icon> </view> </view> <callPhone :servicePhone="[{name: schoolDetail.phone}]"> <view class="pozPhone"> <image src="@/static/images/index/telephone.png" mode=""></image> </view> </callPhone> </view> </view> <!-- 驾校位置 --> <view class="shoolPoz"> <view class="h1">驾校位置</view> <pozCard :info="{address: schoolDetail.address,distance: schoolDetail.distance, lat: schoolDetail.lat, lng: schoolDetail.lng}"></pozCard> </view> <!-- 驾校服务 --> <view class="severCon"> <view class="h1">驾校服务</view> <view class="navBox"> <view class="nav" v-for="(item,index) in navList" :key="index" :class="{active: currentNav==item.id}" @click="changeNav(item)">{{ item.text }}</view> </view> </view> <tab1 v-show="currentNav==1" :classList="schoolDetail.schoolClassDOList"></tab1> <tab2 v-show="currentNav==2" :siteList="schoolDetail.trainingSiteDOS"></tab2> <tab3 v-show="currentNav==3" :coachList="coachList" :status="tab3Status"></tab3> <tab4 v-show="currentNav==4" :carList="schoolDetail.carDOS"></tab4> </view> </view> </template>
<script> import tab1 from './comp/tab1.vue' import tab2 from './comp/tab2.vue' import tab3 from './comp/tab3.vue' import tab4 from './comp/tab4.vue' import { coachPage, getSchoolDetail, getListComment } from '@/config/api.js' import { imgUrl } from '@/config/site.config' export default { components: { tab1, tab2, tab3, tab4}, data() { return { swiperList: [], radianImg: imgUrl+'radian.png', show: false, navList: [ {text: '班型', id: 1}, {text: '场地', id: 2}, {text: '教练', id: 3}, {text: '教练车', id: 4}, ], params: {}, schoolDetail: {}, currentNav: 1, coachParams: { pageNo: 1, pageSize: 20 }, commentParams: { pageNo: 1, pageSize: 20 }, schoolId: '', coachList: [], tab3Status: 'loading', tab3Total: 20 } }, onLoad(options) { this.schoolId = options.schoolId this.coachParams.schoolId = this.schoolId this.commentParams.schoolId = this.schoolId this.coachPageFn() let vuex_cityInfo = this.$store.state.user.vuex_cityInfo if(!vuex_cityInfo.lat) { this.$store.dispatch('getCity') }else { this.params.lat = vuex_cityInfo.lat this.params.lng = vuex_cityInfo.lng } this.getSchoolDetailFn() // this.getListCommentFn()
}, onPullDownRefresh() { this.getSchoolDetailFn() if(this.currentNav==3&&this.coachList.length<this.tab3Total) { this.coachParams.pageNo = 1 this.coachList = [] this.coachPageFn() } }, onReachBottom() { if(this.currentNav==3&&this.coachList.length<this.tab3Total) { this.coachPageFn() } }, methods: { changeNav(item) { this.currentNav = item.id }, // 驾校详情
async getSchoolDetailFn() { const {data: res} = await getSchoolDetail(Object.assign(this.params,{id: this.schoolId})) this.schoolDetail = res this.swiperList = res.schoolIntroduceDO&&res.schoolIntroduceDO.headImages.split(',') }, // 教练分页
async coachPageFn() { const {data: res} = await coachPage(this.coachParams) this.coachParams.pageNo ++ this.coachList.push(...res.list) this.tab3Total = res.total if(this.coachList.length>=this.tab3Total) this.tab3Status = 'nomore' }, // 驾校评论分页
// async getListCommentFn() {
// const {data: res} = await getListComment(this.commentParams)
// this.coachParams.pageNo ++
// this.commentList.push(...res.list)
// this.tab3Total = res.total
// if(this.commentList.length>=this.tab4Total) this.tab3Status = 'nomore'
// }
} } </script>
<style lang="scss" scoped> .navPoz { position: absolute; top: 0; z-index: 9; left: 0; } .main { width: 100%; min-height: 100vh; .swiper-box { position: relative; width: 100%; .radian { position: absolute; width: 100%; height: 84rpx; bottom: 0; left: 0; z-index: 9; } } .traTop { position: relative; top: -120rpx; z-index: 99; } .card { padding: 24rpx; .flex { position: relative; .schoolLogo { width: 204rpx; height: 140rpx; } .textCon { flex: 1; padding: 0 0 0 36rpx; .name { font-size: 32rpx; font-weight: 600; } .starBox { padding: 12rpx 0 6rpx 0; } .evaluate { display: flex; align-items: center; margin-top: 30rpx; .txt { font-size: 24rpx; color: #363A44; margin-right: 12rpx; } } } .pozPhone { position: absolute; top: 50%; right: 40rpx; width: 72rpx; height: 72rpx; transform: translateY(-50%); } } } .h1 { line-height: 100rpx; } .navBox { display: flex; justify-content: space-between; padding: 10rpx 32rpx 20rpx 32rpx; .nav { font-size: 28rpx; color: #363A44; &.active { color: $themC; font-weight: 600; font-size: 32rpx; position: relative; &::before { content: ''; position: absolute; bottom: -18rpx; left: 50%; transform: translateX(-50%); width: 48rpx; height: 4rpx; background: #1989FA; border-radius: 2rpx 2rpx 0px 0px; } } } } } </style>
|