|
@@ -1,165 +1,190 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
- <el-drawer v-model="show" :show-close="false" direction="rtl" size="700px">
|
|
|
|
- <template #header>
|
|
|
|
- <div class="h-[56px] text-[#000] text-[24px] font-semibold border-b border-[#ccc]">Search for products
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
-
|
|
|
|
- <template #default>
|
|
|
|
- <SearchInput></SearchInput>
|
|
|
|
- <!-- 判断从那点击进来 Search点击搜索框 -->
|
|
|
|
- <div v-if="type === 'Search'" class="food_main">
|
|
|
|
- <!-- 判断foodItems 显示图片 -->
|
|
|
|
- <div v-if="foodItems.length === 0" class="search_product"></div>
|
|
|
|
- <div v-else>
|
|
|
|
- <menuFood
|
|
|
|
- v-for="(item, index) in foodItems"
|
|
|
|
- :key="index"
|
|
|
|
- :imageUrl="item.imageUrl"
|
|
|
|
- :productName="item.productName"
|
|
|
|
- :price="item.price"
|
|
|
|
- :quantity="item.quantity"
|
|
|
|
- :type="type"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-drawer v-model="show" :show-close="false" direction="rtl" size="700px">
|
|
|
|
+ <template #header>
|
|
|
|
+ <div class="food_title">
|
|
|
|
+ {{ $t('menu.search') }}
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- <div v-else>
|
|
|
|
- <div>
|
|
|
|
- <!-- <el-divider /> -->
|
|
|
|
- <menuFood
|
|
|
|
- v-for="(item, index) in foodItems"
|
|
|
|
- :key="index"
|
|
|
|
- :imageUrl="item.imageUrl"
|
|
|
|
- :productName="item.productName"
|
|
|
|
- :price="item.price"
|
|
|
|
- :quantity="item.quantity"
|
|
|
|
- :type="type"
|
|
|
|
- />
|
|
|
|
- <Title fontSize="16px">Taste</Title>
|
|
|
|
- <CapsuleBox :items="foodList" />
|
|
|
|
- <Title fontSize="16px">Type</Title>
|
|
|
|
- <CapsuleBox :items="foodList" />
|
|
|
|
- <Title fontSize="16px">Number</Title>
|
|
|
|
- <div class="flex h-[60px] items-center ">
|
|
|
|
- <div @click="handleChange(-1)" class="numItem">-</div>
|
|
|
|
- <div class="numItem">{{num}}</div>
|
|
|
|
- <div @click="handleChange(1)" class="numItem">+</div>
|
|
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ <template #default>
|
|
|
|
+ <div class="scroll">
|
|
|
|
+ <SearchInput></SearchInput>
|
|
|
|
+ <!-- 判断从那点击进来 Search点击搜索框 -->
|
|
|
|
+ <div v-if="type === 'Search'">
|
|
|
|
+ <!-- 判断foodItems 显示图片 -->
|
|
|
|
+ <div v-if="foodItems.length === 0" class="search_product"></div>
|
|
|
|
+ <div class="food_img" v-else>
|
|
|
|
+ <menuFood
|
|
|
|
+ v-for="(item, index) in foodItems"
|
|
|
|
+ :key="index"
|
|
|
|
+ :imageUrl="item.imageUrl"
|
|
|
|
+ :productName="item.productName"
|
|
|
|
+ :price="item.price"
|
|
|
|
+ :quantity="item.quantity"
|
|
|
|
+ :type="type"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else>
|
|
|
|
+ <div>
|
|
|
|
+ <el-divider />
|
|
|
|
+ <menuFood
|
|
|
|
+ v-for="(item, index) in foodSearch"
|
|
|
|
+ :key="index"
|
|
|
|
+ :imageUrl="item.imageUrl"
|
|
|
|
+ :productName="item.productName"
|
|
|
|
+ :price="item.price"
|
|
|
|
+ :quantity="item.quantity"
|
|
|
|
+ :type="type"
|
|
|
|
+ />
|
|
|
|
+ <Title fontSize="16px"> {{ $t('menu.taste') }}</Title>
|
|
|
|
+ <CapsuleBox :items="foodList" />
|
|
|
|
+ <Title fontSize="16px">{{ $t('menu.type') }}</Title>
|
|
|
|
+ <CapsuleBox :items="foodList" />
|
|
|
|
+ <Title fontSize="16px">{{ $t('menu.number') }}</Title>
|
|
|
|
+ <div class="flex h-[60px] items-center">
|
|
|
|
+ <div @click="handleChange(-1)">
|
|
|
|
+ <img src="../../../assets//img//minus_Icon.png" alt="">
|
|
|
|
+ </div>
|
|
|
|
+ <div class="numItem">{{ num }}</div>
|
|
|
|
+ <div @click="handleChange(1)">
|
|
|
|
+ <img src="../../../assets//img//plus_Icon.png" alt="">
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <el-divider />
|
|
|
|
+ <menuFood
|
|
|
|
+ v-for="(item, index) in foodItems"
|
|
|
|
+ :key="index"
|
|
|
|
+ :imageUrl="item.imageUrl"
|
|
|
|
+ :productName="item.productName"
|
|
|
|
+ :price="item.price"
|
|
|
|
+ :quantity="item.quantity"
|
|
|
|
+ :type="type"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- <el-divider />
|
|
|
|
- <menuFood
|
|
|
|
- v-for="(item, index) in foodItems"
|
|
|
|
- :key="index"
|
|
|
|
- :imageUrl="item.imageUrl"
|
|
|
|
- :productName="item.productName"
|
|
|
|
- :price="item.price"
|
|
|
|
- :quantity="item.quantity"
|
|
|
|
- :type="type"
|
|
|
|
- />
|
|
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
|
|
+ </template>
|
|
|
|
|
|
- <template #footer>
|
|
|
|
- <div v-if="type === 'Search'">
|
|
|
|
- <el-button type="primary" class="w-[660px] h-[68px]" @click="cancelClick" plain>
|
|
|
|
- close window
|
|
|
|
- </el-button>
|
|
|
|
- </div>
|
|
|
|
- <div style="flex: auto" v-else>
|
|
|
|
- <el-button type="primary" @click="cancelClick" plain>close window</el-button>
|
|
|
|
- <el-button type="primary" @click="confirmClick">Join the checkout counter</el-button>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
- </el-drawer>
|
|
|
|
-</div>
|
|
|
|
|
|
+ <template #footer>
|
|
|
|
+ <div v-if="type === 'Search'">
|
|
|
|
+ <el-button style="height: 44px;" type="primary" class="w-[660px] h-[68px]" @click="cancelClick" plain>
|
|
|
|
+ close window
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="display: flex; justify-content: space-between; " v-else>
|
|
|
|
+ <el-button style="width: 220px; height: 44px;" type="primary" @click="cancelClick" plain>close window</el-button>
|
|
|
|
+ <el-button style="width: 408px; height: 44px" type="primary" @click="confirmClick">Join the checkout counter</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-drawer>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
- import { ref } from 'vue'
|
|
|
|
- import SearchInput from '../../../components/SearchInput.vue'
|
|
|
|
- import Title from '@/components/titleFood.vue'
|
|
|
|
- import menuFood from './menuFood.vue'
|
|
|
|
- import CapsuleBox from './CapsuleBox.vue'
|
|
|
|
- const props = defineProps({
|
|
|
|
- type: {
|
|
|
|
- type: String,
|
|
|
|
- required: true,
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- const show = defineModel('show')
|
|
|
|
- const showInput = defineModel('showInput')
|
|
|
|
- const num = ref(1)
|
|
|
|
- const foodList = ref([
|
|
|
|
- { id: 1, text: 'sautéed' },
|
|
|
|
- { id: 2, text: 'sautéed' },
|
|
|
|
- { id: 3, text: 'sautéed' },
|
|
|
|
- { id: 4, text: 'sautéed' },
|
|
|
|
- ])
|
|
|
|
- // 假数据,用于动态渲染
|
|
|
|
- const foodItems = ref([
|
|
|
|
- {
|
|
|
|
- imageUrl: 'https://www.w3schools.com/w3images/fjords.jpg',
|
|
|
|
- productName: 'Search for products 1',
|
|
|
|
- price: '\$5.29',
|
|
|
|
- quantity: 'x5'
|
|
|
|
- },
|
|
|
|
- // {
|
|
|
|
- // imageUrl: 'https://www.w3schools.com/w3images/lights.jpg',
|
|
|
|
- // productName: 'Search for products 2',
|
|
|
|
- // price: '\$3.99',
|
|
|
|
- // quantity: 'x3'
|
|
|
|
- // },
|
|
|
|
- // {
|
|
|
|
- // imageUrl: 'https://www.w3schools.com/w3images/mountains.jpg',
|
|
|
|
- // productName: 'Search for products 3',
|
|
|
|
- // price: '\$8.50',
|
|
|
|
- // quantity: 'x2'
|
|
|
|
- // },
|
|
|
|
- // {
|
|
|
|
- // imageUrl: 'https://www.w3schools.com/w3images/fjords.jpg',
|
|
|
|
- // productName: 'Search for products 1',
|
|
|
|
- // price: '\$5.29',
|
|
|
|
- // quantity: 'x5'
|
|
|
|
- // },
|
|
|
|
- ])
|
|
|
|
- const cancelClick = () => {
|
|
|
|
- show.value = false
|
|
|
|
- }
|
|
|
|
- const handleChange = (value) => {
|
|
|
|
- if (num.value > 0 || value > 0) {
|
|
|
|
- num.value += value
|
|
|
|
- }
|
|
|
|
|
|
+ import { ref } from 'vue'
|
|
|
|
+ import SearchInput from '../../../components/SearchInput.vue'
|
|
|
|
+ import Title from '@/components/titleFood.vue'
|
|
|
|
+ import menuFood from './menuFood.vue'
|
|
|
|
+ import CapsuleBox from './CapsuleBox.vue'
|
|
|
|
+ const props = defineProps({
|
|
|
|
+ type: {
|
|
|
|
+ type: String,
|
|
|
|
+ required: true,
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ const show = defineModel('show')
|
|
|
|
+ const showInput = defineModel('showInput')
|
|
|
|
+ const num = ref(1)
|
|
|
|
+ // 胶囊
|
|
|
|
+ const foodList = ref([
|
|
|
|
+ { id: 1, text: 'sautéed products' },
|
|
|
|
+ { id: 2, text: 'sautéed Search' },
|
|
|
|
+ { id: 3, text: 'show' },
|
|
|
|
+ { id: 4, text: 'https for' },
|
|
|
|
+ { id: 5, text: 'sautéed' },
|
|
|
|
+ { id: 6, text: 'fjords for' },
|
|
|
|
+ ])
|
|
|
|
+ // 假数据,用于动态渲染菜品
|
|
|
|
+ const foodSearch = ref([
|
|
|
|
+ {
|
|
|
|
+ imageUrl: 'https://www.w3schools.com/w3images/fjords.jpg',
|
|
|
|
+ productName: 'Search for products 1',
|
|
|
|
+ price: '\$5.29',
|
|
|
|
+ quantity: 'x5',
|
|
|
|
+ },
|
|
|
|
+ ])
|
|
|
|
+ const foodItems = ref([
|
|
|
|
+ {
|
|
|
|
+ imageUrl: 'https://www.w3schools.com/w3images/fjords.jpg',
|
|
|
|
+ productName: 'Search for products 1',
|
|
|
|
+ price: '\$5.29',
|
|
|
|
+ quantity: 'x5',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ imageUrl: 'https://www.w3schools.com/w3images/lights.jpg',
|
|
|
|
+ productName: 'Search for products 2',
|
|
|
|
+ price: '\$3.99',
|
|
|
|
+ quantity: 'x3'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ imageUrl: 'https://www.w3schools.com/w3images/mountains.jpg',
|
|
|
|
+ productName: 'Search for products 3',
|
|
|
|
+ price: '\$8.50',
|
|
|
|
+ quantity: 'x2'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ imageUrl: 'https://www.w3schools.com/w3images/fjords.jpg',
|
|
|
|
+ productName: 'Search for products 1',
|
|
|
|
+ price: '\$5.29',
|
|
|
|
+ quantity: 'x5'
|
|
|
|
+ },
|
|
|
|
+ ])
|
|
|
|
+ const cancelClick = () => {
|
|
|
|
+ show.value = false
|
|
|
|
+ }
|
|
|
|
+ const handleChange = (value) => {
|
|
|
|
+ if (num.value > 0 || value > 0) {
|
|
|
|
+ num.value += value
|
|
}
|
|
}
|
|
|
|
+ }
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
- ::v-deep .el-drawer__header {
|
|
|
|
- margin-bottom: 0px !important;
|
|
|
|
-}
|
|
|
|
-.search_product {
|
|
|
|
- width: 660px;
|
|
|
|
- height: 400px;
|
|
|
|
- background-image: url('../../../assets/img/bg_Icon.png');
|
|
|
|
- background-size: contain;
|
|
|
|
- background-repeat: no-repeat;
|
|
|
|
- background-position: center;
|
|
|
|
-}
|
|
|
|
-.numItem {
|
|
|
|
- width: 40px;
|
|
|
|
- height: 40px;
|
|
|
|
- background-color: rgba(246, 127, 32, 1);
|
|
|
|
- border-radius: 8px;
|
|
|
|
- margin-right: 10px;
|
|
|
|
- display: flex;
|
|
|
|
- align-items: center;
|
|
|
|
- justify-content: center;
|
|
|
|
- color: #fff;
|
|
|
|
- font-size: 20px;
|
|
|
|
-}
|
|
|
|
-.flex .numItem:nth-child(2) {
|
|
|
|
- background-color: transparent;
|
|
|
|
- color: #000;
|
|
|
|
- border: 1px solid #ccc;
|
|
|
|
-}
|
|
|
|
|
|
+ ::v-deep .el-drawer__header {
|
|
|
|
+ margin-bottom: 0px !important;
|
|
|
|
+ }
|
|
|
|
+ // ::v-deep .el-divider {
|
|
|
|
+ // margin: 20px 0px;
|
|
|
|
+ // }
|
|
|
|
+ ::v-deep .el-drawer__body::-webkit-scrollbar {
|
|
|
|
+ display: none;
|
|
|
|
+ }
|
|
|
|
+ .food_title{
|
|
|
|
+ height: 56px;
|
|
|
|
+ font-size: 24px;
|
|
|
|
+ font-weight: 600;
|
|
|
|
+ border-bottom: 1px solid #E6E6E6;
|
|
|
|
+ }
|
|
|
|
+ .search_product {
|
|
|
|
+ width: 660px;
|
|
|
|
+ height: 400px;
|
|
|
|
+ background-image: url('../../../assets/img/bg_Icon.png');
|
|
|
|
+ background-size: contain;
|
|
|
|
+ background-repeat: no-repeat;
|
|
|
|
+ background-position: center;
|
|
|
|
+ }
|
|
|
|
+ .numItem {
|
|
|
|
+ width: 40px;
|
|
|
|
+ height: 40px;
|
|
|
|
+ border-radius: 8px;
|
|
|
|
+ margin: 0px 15px;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ color: #000;
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ border: 1px solid #ccc;
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|