This commit is contained in:
parent
26d97d8461
commit
7bbe57d536
@ -80,17 +80,10 @@ export default defineComponent({
|
||||
data () {
|
||||
return {
|
||||
search: {
|
||||
// category_id: '',
|
||||
keyword: '',
|
||||
page: 1,
|
||||
limit: 10,
|
||||
},
|
||||
// area: useColPickerData().colPickerData.map((item) => {
|
||||
// return {
|
||||
// value: item.value,
|
||||
// label: item.text
|
||||
// }
|
||||
// }),
|
||||
area: [],
|
||||
value: [],
|
||||
currentTab: 0, // tab索引
|
||||
@ -109,116 +102,15 @@ export default defineComponent({
|
||||
};
|
||||
},
|
||||
onLoad () {
|
||||
// if (isLogin()) {
|
||||
this.getCategoryList()
|
||||
// }
|
||||
|
||||
this.getArea()
|
||||
// this.getCategoryList()
|
||||
// this.getArea()
|
||||
|
||||
},
|
||||
created () {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
handleConfirm ({ value }) {
|
||||
console.log(value)
|
||||
},
|
||||
getArea () {
|
||||
try {
|
||||
this.area = [colPickerData.map(item => ({
|
||||
value: item.value,
|
||||
label: item.text
|
||||
}))];
|
||||
} catch (error) {
|
||||
console.error('获取区域数据时出错:', error);
|
||||
uni.$u.toast('获取区域数据失败');
|
||||
}
|
||||
},
|
||||
|
||||
columnChange ({ selectedItem, resolve, finish }) {
|
||||
try {
|
||||
const areaData = findChildrenByCode(colPickerData, selectedItem.value);
|
||||
if (areaData && areaData.length) {
|
||||
|
||||
|
||||
resolve(areaData.map(item => ({
|
||||
value: item.value,
|
||||
label: item.text
|
||||
})));
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('处理列变更时出错:', error);
|
||||
finish(); // 确保在发生错误时也能完成操作以避免卡顿
|
||||
}
|
||||
},
|
||||
|
||||
formatter (day) {
|
||||
const date = new Date(day.date)
|
||||
const now = new Date()
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth()
|
||||
const da = date.getDate()
|
||||
const nowYear = now.getFullYear()
|
||||
const nowMonth = now.getMonth()
|
||||
const nowDa = now.getDate()
|
||||
|
||||
if (year === nowYear && month === nowMonth && da === nowDa) {
|
||||
day.topInfo = '今天'
|
||||
}
|
||||
// const disabledDates = ['2025-08-05', '2023-08-15'];
|
||||
// const formattedDate = `${year}-${month}-${da}`;
|
||||
if (this.isDisabledDate.includes(day.date)) {
|
||||
day.topInfo = '已预定';
|
||||
day.disabled = true; // 禁用日期
|
||||
day.disabled_class = 'disabled-date'; // 添加自定义样式类
|
||||
}
|
||||
// if (day.type === 'start') {
|
||||
// day.bottomInfo = '开始'
|
||||
// }
|
||||
|
||||
// if (day.type === 'end') {
|
||||
// day.bottomInfo = '结束'
|
||||
// }
|
||||
// if (day.type === 'same') {
|
||||
// day.bottomInfo = '开始/结束'
|
||||
// }
|
||||
return day
|
||||
},
|
||||
|
||||
handleTimeConfirm (res) {
|
||||
console.log(res.value)
|
||||
this.time_list = res.value
|
||||
|
||||
},
|
||||
handleChange () {
|
||||
this.$nextTick(() => { this.handleClickCategory(this.currentTab) });
|
||||
},
|
||||
handleClickCategory (index: number) {
|
||||
|
||||
console.log(index);
|
||||
this.categoryIndex = index;
|
||||
this.tabList = this.categoryList[index].children;
|
||||
this.handleChildrenClick(0);
|
||||
},
|
||||
handleChildrenClick (index: number) {
|
||||
this.childrenIndex = index;
|
||||
this.search.category_id = this.tabList[index].id;
|
||||
this.$refs.pagingRefSP?.reload();
|
||||
},
|
||||
|
||||
getCategoryList () {
|
||||
CommonApi.commonGet('/api/dishes/category').catch((res) => {
|
||||
if (res.code === 1) {
|
||||
this.categoryList = res.data;
|
||||
this.handleClickCategory(0)
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//搜索事件
|
||||
searchSP () {
|
||||
this.$refs.pagingRefSP?.reload();
|
||||
|
@ -1,7 +1,7 @@
|
||||
<style>
|
||||
.wd-grid-item-img {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
height: 120px;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
@ -18,15 +18,15 @@
|
||||
:placeholder="true" :fixed="true"></up-navbar>
|
||||
<view style="padding:0px 20rpx"> <u-swiper radius="20rpx" height="360rpx" :list="swiperList" indicator
|
||||
indicatorMode="dot" circular @click="handleClick"></u-swiper></view>
|
||||
|
||||
|
||||
<wd-grid :gutter="10" :column="2" clickable>
|
||||
<wd-grid-item use-slot @click="goTabCook">
|
||||
<image class="wd-grid-item-img" src="https://cdn.uviewui.com/uview/goods/1.jpg" />
|
||||
<wd-grid-item use-slot @click="goTabCook">
|
||||
<image class="wd-grid-item-img"
|
||||
src="https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20250813/20250813165502085532573.png" />
|
||||
<!-- <view class="text font-bold" >找厨师</view> -->
|
||||
</wd-grid-item>
|
||||
<wd-grid-item use-slot @click="goTabHotel">
|
||||
<image class="wd-grid-item-img" src="https://cdn.uviewui.com/uview/goods/1.jpg" />
|
||||
<wd-grid-item use-slot @click="goTabHotel">
|
||||
<image class="wd-grid-item-img"
|
||||
src="https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20250813/202508131655082b6295503.png" />
|
||||
<!-- <view class="text font-bold">找酒店</view> -->
|
||||
</wd-grid-item>
|
||||
|
||||
@ -48,49 +48,8 @@
|
||||
</wd-grid-item>
|
||||
</wd-grid>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <z-paging ref="pagingRefSP" v-model="matchedItems_sp" @query="changeSP" :fixed="false" height="calc(100vh - 440rpx)"
|
||||
width="calc(100vw - 200rpx)" style="right: 0; background-color: #FFFFFFFF; position: fixed;"
|
||||
class="fv-page flex-col">
|
||||
|
||||
<view v-for="(item, index) in matchedItems_sp" :key="index">
|
||||
<up-cell :border='false' @click="goodsDetail(item.id)">
|
||||
<template #icon>
|
||||
<up-image :src="item.image" width="140rpx" height="140rpx"></up-image>
|
||||
</template>
|
||||
<template v-slot:title>
|
||||
<view class="h-50 flex">
|
||||
<up-text size="28rpx" :text="`${item.name}`" :flex1="true" align="left" wordWrap="normal" :show="true"
|
||||
prefixIcon="" iconStyle="font-size:26rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
|
||||
</up-text>
|
||||
</view>
|
||||
|
||||
<view class="h-50 flex">
|
||||
<up-text color="#767676" size="24rpx" :text="`主料:${item.intro}`" :flex1="true" align="left"
|
||||
wordWrap="normal" :show="true" prefixIcon=""
|
||||
iconStyle="font-size:26rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
|
||||
</up-text>
|
||||
</view>
|
||||
<view class="h-50 flex ellipsis_text">
|
||||
<up-text color="#767676" size="24rpx" :text="`营养:${item.intro}`" :flex1="true" align="left"
|
||||
wordWrap="normal" :show="true" prefixIcon=""
|
||||
iconStyle="font-size:26rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
|
||||
</up-text>
|
||||
<view @click.stop="addCart(item.id)">
|
||||
<u-icon slot="right" label="" size="42rpx" name="plus-circle" color="#59CB56"
|
||||
labelColor="#59CB56"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</up-cell>
|
||||
</view>
|
||||
</z-paging> -->
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { CommonApi, UserApi } from "@/api";
|
||||
@ -103,7 +62,7 @@ export default defineComponent({
|
||||
{ url: 'https://cdn.uviewui.com/uview/album/1.jpg', title: '卡!皮!巴!拉!' },
|
||||
],
|
||||
search: {
|
||||
category_id: '',
|
||||
// category_id: '',
|
||||
keyword: '',
|
||||
page: 1,
|
||||
limit: 10,
|
||||
@ -120,7 +79,7 @@ export default defineComponent({
|
||||
},
|
||||
onLoad () {
|
||||
// if (isLogin()) {
|
||||
this.getCategoryList()
|
||||
this.changeSP()
|
||||
// }
|
||||
},
|
||||
created () {
|
||||
@ -159,29 +118,25 @@ export default defineComponent({
|
||||
this.$refs.pagingRefSP?.reload();
|
||||
},
|
||||
|
||||
getCategoryList () {
|
||||
CommonApi.commonGet('/api/dishes/category').catch((res) => {
|
||||
if (res.code === 1) {
|
||||
this.categoryList = res.data;
|
||||
this.handleClickCategory(0)
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
//搜索事件
|
||||
searchSP () {
|
||||
this.$refs.pagingRefSP?.reload();
|
||||
// this.changeSP(1);
|
||||
},
|
||||
// getCategoryList () {
|
||||
// CommonApi.commonGet('/api/dishes/category').catch((res) => {
|
||||
// if (res.code === 1) {
|
||||
// this.categoryList = res.data;
|
||||
// this.handleClickCategory(0)
|
||||
// } else {
|
||||
// uni.$u.toast(res.msg);
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
|
||||
//列表分页
|
||||
changeSP (pageNo: number) {
|
||||
console.log(pageNo);
|
||||
this.search.page = pageNo;
|
||||
CommonApi.commonGet('/api/dishes/dishes', this.search).catch((res) => {
|
||||
changeSP () {
|
||||
// console.log(pageNo);
|
||||
// this.search.page = pageNo;
|
||||
CommonApi.commonGet('/api/banquet/chef/list', this.search).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
// this.matchedItems_sp = res.data;
|
||||
this.$refs.pagingRefSP?.complete(res.data);
|
||||
this.matchedItems_sp = res.data;
|
||||
// this.$refs.pagingRefSP?.complete(res.data);
|
||||
// console.log(res);
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
@ -197,19 +152,7 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
|
||||
//加入购物车
|
||||
addCart (id) {
|
||||
CommonApi.commonPost('/api/cart/add', {
|
||||
buy_now: false,
|
||||
dishes_id: id,
|
||||
}).catch((res) => {
|
||||
if (res.code === 1) {
|
||||
uni.$u.toast('加入购物车成功');
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
BIN
src/static/images/cook.png
Normal file
BIN
src/static/images/cook.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 472 KiB |
BIN
src/static/images/hotel.png
Normal file
BIN
src/static/images/hotel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 518 KiB |
Loading…
x
Reference in New Issue
Block a user