From f44a0c0a5086a5a19742ecf70a485c0dc9f58ae5 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Fri, 11 Oct 2024 10:05:26 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../index/components/goods-item.vue | 21 +++++++--
pagesCreateOrder/index/index.vue | 43 ++++++++++++++++---
2 files changed, 55 insertions(+), 9 deletions(-)
diff --git a/pagesCreateOrder/index/components/goods-item.vue b/pagesCreateOrder/index/components/goods-item.vue
index 1f644f6..5e97132 100644
--- a/pagesCreateOrder/index/components/goods-item.vue
+++ b/pagesCreateOrder/index/components/goods-item.vue
@@ -1,6 +1,6 @@
-
+
{{data.name}}
@@ -50,6 +50,13 @@
watch
} from 'vue';
const props = defineProps({
+ img:{
+ type:Object,
+ default:{
+ width:'250rpx',
+ height:'272rpx'
+ }
+ },
index: {
type: Number,
},
@@ -67,6 +74,14 @@
}
}
})
+
+ function computedImgStyle(){
+ return {
+ width:props.img.width,
+ height:props.img.height
+ }
+ }
+
//判断是否是菜品
function isGoods(){
return props.data.hasOwnProperty('id')
@@ -118,8 +133,8 @@
}
.item {
- width: 250rpx;
- height: 272rpx;
+ // width: 250rpx;
+ // height: 272rpx;
background: #F9B798;
border-radius: 8rpx 8rpx 8rpx 8rpx;
overflow: hidden;
diff --git a/pagesCreateOrder/index/index.vue b/pagesCreateOrder/index/index.vue
index af340b5..74a95ed 100644
--- a/pagesCreateOrder/index/index.vue
+++ b/pagesCreateOrder/index/index.vue
@@ -92,7 +92,21 @@
@@ -377,6 +391,8 @@
// data.table=res.content[0]
}
}
+
+ let $originGoods = ref([])
async function init() {
const shopInfo = await tbShopInfo()
$shop.value = shopInfo
@@ -401,9 +417,10 @@
}
return isShow;
});
+ $originGoods.value = goods
if (!data.table.tableId) {
//无桌台
- setTabBar(category, goods, [])
+ setTabBar(category, $originGoods.value, [])
return
}
const {
@@ -441,15 +458,29 @@
let searchValue = ref('')
let isSearch = ref(false)
+ let searchResult = ref([])
+
+ function returnSearchGoods() {
+ const newval = searchValue.value
+ let arr = []
+ if (newval == "") {
+ arr = $originGoods.value;
+ } else {
+ arr = $originGoods.value.filter((v) =>
+ v.name.includes(newval.trim())
+ );
+ }
+ return arr
+ }
function search() {
- // isSearch.value=true
- console.log(searchValue.value);
- console.log(data.tabbar);
+ isSearch.value = true
+ searchResult.value = returnSearchGoods()
+ console.log(searchResult.value);
}
function clearSearch() {
- // isSearch.value=false
+ isSearch.value = false
}
function chooseUser() {