carList.vue 6.43 KB
<template>
  <div>
    <div class="banner">
      <img v-if="language==0" src="@/assets/booking/cl_text_c.png">
      <img v-else src="@/assets/booking/cl_text_e.png">
    </div>
    <div class="box">
      <div class="searchBar">
        <el-input v-model="query.name" :placeholder="language==0?'请输入关键字搜索':'Search'" class="no-border" />
        <el-button class="btn-lineG" icon="search" size="large" type="primary" @click="getVehicleByCheckIn">
          {{ language == 0 ? '搜索' : 'Search' }}
        </el-button>
      </div>
    </div>
    <div v-loading="loading" class="box">
      <div v-for="(h,index) in list" :key="index" class="routeItem">
        <el-row :gutter="20" align="middle" class="w100">
          <el-col :lg="2" :sm="6">
            <div class="index">{{ language == 0 ? '路线' : 'Route' }}{{ index + 1 }}
            </div>
          </el-col>
          <el-col :lg="6">
            <p class="esp text-center">{{ h.checkIn }}</p>
          </el-col>
          <el-col :lg="4" :sm="6" class="text-center">
            <img class="mauto w40px" src="@/assets/booking/wf.png">
          </el-col>
          <el-col :lg="6">
            <p class="esp text-center">{{ h.checkOut }}</p>
          </el-col>
          <el-col :lg="3" :sm="12">
            <div v-if="language==0" class="price">
              ¥
              <span>{{ h.upPrice }}</span>
            </div>
            <div v-else class="price">

              <span>{{ h.upPriceEn }}</span>
            </div>
          
          </el-col>
          <el-col :lg="3" :sm="12">
            <el-button class="btn-lineG w100" round type="primary" @click="goOrder(h)">
              {{ language == 0 ? '我要预订' : 'Select' }}
            </el-button>
          </el-col>
        </el-row>
      </div>
      
      <el-empty v-show="!loading&&list.length==0" :image="`/img/order_no.png`" :image-size="228" description="" />
      <div style="height: 50px" />
    </div>
  
  </div>
</template>

<script setup>
import { onMounted, ref } from '@vue/runtime-core'
import * as booking from '@/apiPc/booking'
import { useRouter, useRoute } from 'vue-router'
import { useStorage } from '@vueuse/core/index'
import useUserStore from '@/store/modules/user'

const user = useUserStore().user
const router = useRouter()
const route = useRoute()
const language = useStorage('language', 0)
const query = ref({})
const activeName = ref(0)
const cptId = ref('')
const list = ref([])
const loading = ref(false)


onMounted(() => {
  query.value.activityId = route.query.activityId
  query.value.checkIn = route.query.checkIn
  query.value.checkOut = route.query.checkOut
  query.value.category = route.query.category
  // if (language.value==0)
  // getList()
  getVehicleByCheckIn()
})


function getList() {
  // if (language.value!=0)return
  loading.value = true
  booking.getActivityCarList(query.value).then(res => {
    list.value = res.rows
    loading.value = false
  }).catch(e => {
    loading.value = false
  })
}

async function getVehicleByCheckIn() {
  loading.value = true
  const res = await booking.getVehicleByCheckIn(query.value)
  list.value = res.data || []
  loading.value = false
}

function goOrder(item, car) {
  if (!user) {
    useUserStore().setReLogin()
    return
  }
  router.push({
    name: 'carOrder',
    params: {
      id: item.id
    },
    query: {
      item: encodeURIComponent(JSON.stringify(item))
    }
  })
}
</script>

<style lang="scss" scoped>

.hotel {
  margin-bottom: 20px;
  cursor: pointer;
  
  .index {
    display: flex;
    font-weight: 500;
    padding-left: 20px;
    font-size: 18px;
    align-items: center;
    
    img {
      margin-left: 15px;
    }
  }
  
  p {
    font-weight: 500;
    font-size: 24px;
    color: #000000;
  }
  
  &:hover .el-card {
    box-shadow: 0 0 10px #aaa;
  }
}

.hotel:nth-child(7n) .index {
  color: #009E96;
}

.hotel:nth-child(7n+1) .index {
  color: #FF8124;
}

.hotel:nth-child(7n+2) .index {
  color: #E4007F;
}

.hotel:nth-child(7n+3) .index {
  color: #0068B7;
}

.hotel:nth-child(7n+4) .index {
  color: #32B16C;
}

.hotel:nth-child(7n+5) .index {
  color: #920783;
}

.hotel:nth-child(7n+6) .index {
  color: #00B7EE;
}

.banner {
  height: 140px;
  background-size: cover;
  text-align: center;
  background: url("@/assets/booking/cl_bg.png") center;
  display: flex;
  align-items: center;
  justify-content: center;
  
  img {
    display: block;
    margin: -30px auto 0;
    width: auto;
  }
}

.searchBar {
  position: relative;
  top: -30px;
  background: #FFFFFF;
  display: flex;
  padding: 20px;
  border-radius: 10px;
}

.no-border {
  border: none;
  background: #F5F7F9;
  
  :deep(.el-input__wrapper) {
    border: none;
    box-shadow: none;
    background: #F5F7F9;
  }
}

.starBox {
  img {
    display: inline-block;
    margin-right: 4px
  }
}

.tagbox {
  margin: 15px 0;
  
  a {
    color: #AFB5B9;
    font-size: 12px;
  }
  
  span {
    border-radius: 13px;
    font-size: 12px;
    padding: 4px 10px;
    margin-right: 10px;
    font-weight: 400;
  }
  
  span:nth-child(4n) {
    background: rgba(50, 177, 108, 0.2);
    color: rgba(50, 177, 108, 1);
  }
  
  span:nth-child(4n+1) {
    background: rgba(243, 152, 0, 0.2);
    color: rgba(243, 152, 0, 1);
  }
  
  span:nth-child(4n+2) {
    background: rgba(0, 160, 233, 0.2);
    color: rgba(0, 160, 233, 1);
  }
  
  span:nth-child(4n+3) {
    background: rgba(247, 64, 166, 0.2);
    color: rgba(247, 64, 166, 1);
  }
}

.name.flex {
  align-items: center;
}

.name .tagbox {
  margin: 0 0 0 15px;
}

.room {
  background: #FAFBFD;
  margin: 20px 0 0;
  padding: 20px;
  border: 1px solid #E5E5E5;
  
  .name {
    font-size: 20px;
    margin: 0 0 10px;
  }
  
  .roomImg {
    aspect-ratio: 16/9;
    border-radius: 10px;
    overflow: hidden;
    
    img {
      width: 100%;
      object-fit: cover;
      object-position: center;
      height: 100%;
    }
  }
  
  
  .bg-lineg {
    margin: auto;
    border-radius: 10px;
    text-align: center;
    padding: 7px 2px 2px;
    font-size: 24px;
    width: 66px;
    cursor: pointer;
    
    div {
      background: #fff;
      font-size: 13px;
      border-radius: 20px;
      padding: 0 10px;
      color: #453DEA;
      font-weight: 500;
    }
  }
}

.routeItem {
  background: #fff;
  border-radius: 10px;
  margin: 0 0 20px;
  padding: 10px 20px;
  box-shadow: 0 0 6px #eee;
  
  .price {
    color: #FF8124;
    font-size: 24px;
    
    span {
      font-size: 36px;
      font-family: "DIN Alternate"
    }
  }
}
</style>