dinner.vue 2 KB
<template>
  <div>
    <div class="banner">
      <img src="@/assets/booking/cy_text.png">
    </div>
    <div class="box">
      <div class="searchBar">
        <el-input placeholder="请输入关键字搜索" v-model="query.name" class="no-border">
        </el-input>
        <el-button size="large" type="primary" class="btn-lineG" icon="search">搜索</el-button>
      </div>
    </div>

    <div class="box">
      <el-row :gutter="20">
        <el-col :span="12" v-for="(h,index) in list" class="mb20">
          <el-card>
            <!--        酒店列表-->
            <el-row class="hotel" align="middle">
              <el-col :span="12">
                <img/>
              </el-col>
              <el-col :span="12">
                <h3>{{h.name}}</h3>
                <p>
                  <el-icon><LocationFilled /></el-icon>
                  {{h.address}}
                </p>
                <div class="price">¥<span>450</span><i></i></div>
                <el-button class="btn-lineG" round type="primary" size="large">立即预约 ⇀</el-button>

              </el-col>
            </el-row>
          </el-card>
        </el-col>
      </el-row>

    </div>

  </div>
</template>

<script setup>
import {onMounted} from "@vue/runtime-core"
import * as booking from "@/apiPc/booking"
const query = ref({
  name:''
})
const list = ref([''])
onMounted(()=>{
  getList()
})

function getList() {
  booking.getHotelList(query.value).then(res=>{
    list.value = res.rows
  })
}
</script>

<style scoped lang="scss">
.hotel{}
.banner{height: 140px;background-size: cover;text-align: center;
  background: url("@/assets/booking/cy_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;}
}
</style>