Merge branch 'main' of https://gitea.lihaink.cn/sjeam/caipu_uni
Some checks are pending
deploy / deploy (push) Waiting to run

This commit is contained in:
sjeam 2025-08-14 14:43:13 +08:00
commit ac67fd6430
3 changed files with 150 additions and 415 deletions

View File

@ -22,3 +22,11 @@ export const logout = () => post<CommonRes>('/api/logout');
export const goodsMenu = () => get<CommonRes>('/api/config');
// export const goodsMenu = (data:any) => get<CommonRes>('/api/config', { data, custom: { toast: false } });
export const hotelListApi = (data: any) => get('/api/banquet/hotel/list', { data, custom: { toast: false } });
export const hotelDetailApi = (data: any) => get('/api/banquet/hotel/detail', { data, custom: { toast: false } });
export const hotelScheduleApi = (data: any) => get('/api/banquet/hotel/schedule', { data, custom: { toast: false } });
export const dishesListApi = (data: any) => get('/api/banquet/dishes/list', { data, custom: { toast: false } });

View File

@ -1,9 +1,5 @@
<template>
<view class="fv-page flex-col" style="">
<!-- <up-navbar class="" style="" :autoBack="true" bgColor="#00000000" :fixed="true" titleColor="#595757FF"
leftIconColor="#FFFFFFFF">
</up-navbar> -->
<up-navbar :autoBack="true" style="font-weight: bold;" leftIcon="arrow-left" :title="`酒店详情`" titleColor="#303133"
bgColor="#FFFFFFFF" titleWidth="600rpx" height="80rpx" leftIconSize="40rpx" leftIconColor="#303133"
:safeAreaInsetTop="true" :placeholder="true" :fixed="true">
@ -14,231 +10,136 @@
<view class="">
<u-cell :border="false">
<template #icon>
<wd-img :width="120" :height="120" :src="matchedItems_sc.image" :enable-preview="false" :radius="8"
:round=false custom-class="margin-right-24" />
<wd-img :width="120" :height="120" :src="hotel.certification?.public_image" :enable-preview="false"
:radius="8" :round=false custom-class="margin-right-24" />
</template>
<template #title>
<view class="h-60 flex">
<up-text size="32rpx" :text="`${matchedItems_sc.name}大酒店`" :flex1="true" align="left" wordWrap="normal"
:show="true" prefixIcon="" customStyle="font-weight:bold"
<up-text size="32rpx" :text="`${hotel.certification?.public_name}`" :flex1="true" align="left"
wordWrap="normal" :show="true" prefixIcon="" customStyle="font-weight:bold"
iconStyle="font-size:28rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`¥2000.00元`"></u-icon> -->
</view>
</template>
<template #label>
<view class="h-50 flex color-gray">
<wd-tag custom-class="space">家常菜</wd-tag>
<wd-tag custom-class="space" type="primary">川菜</wd-tag>
<wd-tag custom-class="space" type="danger">粤菜</wd-tag>
<wd-tag custom-class="space" type="warning">湘菜</wd-tag>
<wd-tag custom-class="space" type="success">特色菜</wd-tag>
<!-- <u-text size="" :text="`${matchedItems_sc.intro}川菜 家常菜`" :flex1="true" align="left"
wordWrap="normal" :show="true" prefixIcon="" customStyle="font-size:24rpx"
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</u-text> -->
<!-- <u-icon slot="right" label-color="red" :label="`X30`"></u-icon> -->
</view>
<view class="h-50 flex color-gray">
<up-text size="" :text="`${matchedItems_sc.intro}最大承载人数6000人`" :flex1="true" align="left"
wordWrap="normal" :show="true" prefixIcon="" customStyle="font-size:24rpx"
<up-text size="" :text="`${hotel.certification?.address}`" :flex1="true" align="left" wordWrap="normal"
:show="true" prefixIcon="" customStyle="font-size:24rpx"
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`X30`"></u-icon> -->
</view>
<view class="h-50 flex color-gray">
<up-text size="" :text="`${matchedItems_sc.intro}四川省泸州市龙马潭区`" :flex1="true" align="left"
wordWrap="normal" :show="true" prefixIcon="" customStyle="font-size:24rpx"
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`X30`"></u-icon> -->
</view>
<wd-button size="small" @click="addCart(1)">下单预定</wd-button>
<wd-button size="small" @click="gotoDishesList(hotel.id)">下单预定</wd-button>
</template>
</u-cell>
</view>
</up-cell-group>
</wd-card>
<wd-card title="酒店展示视频" type="rectangle">
<up-swiper v-if="imageList" height="320rpx" :list="imageList" keyName="url" :autoplay="false"></up-swiper>
</wd-card>
<wd-card title="推荐酒席套餐" type="rectangle">
<up-cell-group :border="false">
<view class="detail-box" v-for="(item, index) in matchedItems_sp" :key="index">
<u-cell :border="false" @click="goodsDetail(item.id)">
<view class="detail-box" v-for="(item, index) in dishesList" :key="index">
<u-cell :border="false" @click="gotoDishesDetai(item.id)">
<template #icon>
<wd-img :width="100" :height="100" :src="item.image" :enable-preview="false" :radius="8" :round=false
<wd-img :width="100" :height="100" :src="item.images[0]" :enable-preview="false" :radius="8" :round=false
custom-class="margin-right-24" />
</template>
<template #title>
<view class="h-60 flex">
<up-text size="32rpx" :text="`${item.name}大酒店`" :flex1="true" align="left" wordWrap="normal"
<up-text size="32rpx" :text="`${item.name}`" :flex1="true" align="left" wordWrap="normal"
:show="true" prefixIcon="" customStyle="font-weight:bold"
iconStyle="font-size:28rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`¥2000.00元`"></u-icon> -->
</view>
</template>
<template #label>
<view class="h-50 flex color-gray">
<wd-tag custom-class="space">家常菜</wd-tag>
<wd-tag custom-class="space" type="primary">川菜</wd-tag>
<wd-tag custom-class="space" type="danger">粤菜</wd-tag>
<wd-tag custom-class="space" type="warning">湘菜</wd-tag>
<wd-tag custom-class="space" type="success">特色菜</wd-tag>
</view>
<view class="h-50 flex color-gray">
<up-text size="" :text="`最大承载人数6000人${item.intro}`" :flex1="true" align="left" wordWrap="normal"
<up-text size="" :text="`${item.intro}`" :flex1="true" align="left" wordWrap="normal"
:show="true" prefixIcon="" customStyle="font-size:24rpx"
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`X30`"></u-icon> -->
</view>
<view class="h-50 flex color-gray">
<up-text size="" :text="`四川省泸州市龙马潭区${item.intro}`" :flex1="true" align="left" wordWrap="normal"
:show="true" prefixIcon="" customStyle="font-size:24rpx"
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`X30`"></u-icon> -->
</view>
<view class="h-50 flex color-gray">
<wd-text text="16354.156" mode="price" type="error" prefix="¥" />
<wd-text :text="item.price" mode="price" type="error" prefix="¥" />
</view>
<view class="h-20 flex color-gray">
<wd-text size="24rpx" text="16354.156" mode="price" decoration="line-through" prefix="¥" />
<wd-text size="24rpx" :text="item.line_price" mode="price" decoration="line-through" prefix="¥" />
<view style="margin-top: -20rpx;">
<wd-button size="small" @click="addCart(1)">下单预定</wd-button>
</view>
</view>
</template>
</u-cell>
</view>
</up-cell-group>
</wd-card>
<view class="flex box-border flex-sub-cart" v-if="is_add">
<view style="margin: 20rpx;">
<!-- <u-text class=""
custom-style="width: calc(100vw - 120rpx);text-align:center;display: flex; justify-content: center; align-items: center;height: 70rpx;border: 2px solid #59cb56;border-radius: 40rpx;background-color: #5acb5617;margin: 0rpx 20rpx!important;"
color="#59CB56" size="26rpx" :text="'加入食谱清单'" :flex1="true" align="center" wordWrap="normal" :show="true"
iconStyle="26rpx" decoration="none">
</u-text> -->
</view>
</view>
</view>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { CommonApi, UserApi } from "@/api";
import { setToken, getToken, isLogin } from '@/utils/auth';
import { image } from "@/uni_modules/uview-plus/libs/function/test";
import { url } from "inspector";
export default defineComponent({
data () {
import { defineComponent } from "vue";
import { CommonApi, UserApi } from "@/api";
import { setToken, getToken, isLogin } from '@/utils/auth';
import { image } from "@/uni_modules/uview-plus/libs/function/test";
import { url } from "inspector";
export default defineComponent({
data() {
return {
search: {
id: 0,
},
is_add: 0, //
matchedItems_sc: [],
matchedItems_sp: [],
hotel: [],
imageList: [],
dishesList: []
};
},
onLoad (option) {
onLoad(option) {
// console.log(option);
this.search.id = option.id;
this.id = option.id;
this.is_add = option.is_add | 0;
this.getCategoryList()
this.changeSP()
this.getHotelDetail()
this.getDishesList()
},
created () {
created() {
},
methods: {
getCategoryList () {
CommonApi.commonGet('/api/dishes/detail', this.search).catch((res) => {
gotoDishesList(id : number) {
uni.navigateTo({
url: `/pages/banquet/hotel/detail?id=${id}&is_add=1`
});
},
gotoDishesDetai(id) {
uni.navigateTo({
url: `/pages/banquet/hotel/detail?id=${id}&is_add=1`
});
},
getHotelDetail() {
UserApi.hotelDetailApi({ id: this.id }).catch((res) => {
if (res.code === 1) {
this.matchedItems_sc = res.data;
this.hotel = res.data;
//
this.imageList = res.data.image ? [{
url: res.data.image,
title: res.data.name,
poster: res.data.image
this.imageList = res.data.certification.video ? [{
url: res.data.certification.video,
title: '展示视频',
poster: res.data.certification.video
}] : [];
} else {
uni.$u.toast(res.msg);
}
});
},
//
changeSP () {
// console.log(pageNo);
// this.search.page = pageNo;
CommonApi.commonGet('/api/dishes/dishes', this.search).catch((res) => {
getDishesList() {
UserApi.dishesListApi({ server_user_id: this.id, type: 2 }).catch((res) => {
if (res.code === 1) {
this.matchedItems_sp = res.data;
// this.$refs.pagingRefSP?.complete(res.data);
this.dishesList = res.data
} else {
uni.$u.toast(res.msg);
}
});
},
//
addCart (id) {
uni.navigateTo({
url: `/pages/banquet/combo/index??id=${id}`
},
});
// CommonApi.commonPost('/api/cart/add', {
// buy_now: false,
// dishes_id: this.search.id,
// }).catch((res) => {
// if (res.code === 1) {
// uni.$u.toast('');
// uni.navigateTo({
// url: '/pages/cart/index'
// });
// } else {
// uni.$u.toast(res.msg);
// }
// });
}
},
});
// const imageList = reactive([
// {
// url: 'https://cdn.uviewui.com/uview/resources/video.mp4',
// title: '西',
// poster: 'https://cdn.uviewui.com/uview/swiper/swiper1.png'
// },
// {
// url: 'https://s3.bmp.ovh/imgs/2024/12/16/35bc6d28ab1c8bc7.png',
// title: '',
// // url URLURL
// // url URL
// },
// {
// url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
// title: '西',
// // url URLURL
// //
// },
// ]);
</script>

View File

@ -7,257 +7,83 @@
<up-search v-model="search.keyword" class="flex,flex-row p-1" style="" shape="round" bgColor="#f2f2f2"
placeholder="请输入酒店名称或者区域" :clearabled="true" :showAction="false" inputAlign="left" borderColor="transparent"
searchIconColor="#909399" color="#606266" placeholderColor="#909399" searchIcon="search" margin="10rpx"
maxlength="-1" height="60rpx" @change="searchSP()">
maxlength="-1" height="60rpx" @change="getHotelList(true)">
</up-search>
<z-paging ref="pagingRefSP" v-model="matchedItems_sp" @query="changeSP" :fixed="false" height="calc(100vh - 280rpx)"
width="calc(100vw)" style="right: 0; background-color: #FFFFFFFF; position: fixed;" class="fv-page flex-col">
<wd-card type="rectangle">
<up-cell-group :border="false">
<view class="detail-box" v-for="(item, index) in matchedItems_sp" :key="index">
<u-cell :border="false" @click="goodsDetail(item.id)">
<template #icon>
<wd-img :width="100" :height="100" :src="item.image" :enable-preview="false" :radius="8" :round=false
custom-class="margin-right-24" />
</template>
<template #title>
<view class="h-60 flex">
<up-text size="32rpx" :text="`${item.name}大酒店`" :flex1="true" align="left" wordWrap="normal"
:show="true" prefixIcon="" customStyle="font-weight:bold"
iconStyle="font-size:28rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`¥2000.00元`"></u-icon> -->
<view class="p-30rpx">
<view v-if="hotelList.length == 0" class="">
<up-empty mode="list"></up-empty>
</view>
</template>
<template #label>
<view class="h-50 flex color-gray">
<wd-tag custom-class="space">家常菜</wd-tag>
<wd-tag custom-class="space" type="primary">川菜</wd-tag>
<wd-tag custom-class="space" type="danger">粤菜</wd-tag>
<wd-tag custom-class="space" type="warning">湘菜</wd-tag>
<wd-tag custom-class="space" type="success">特色菜</wd-tag>
<!-- <u-text size="" :text="`${item.intro}川菜 家常菜`" :flex1="true" align="left"
wordWrap="normal" :show="true" prefixIcon="" customStyle="font-size:24rpx"
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</u-text> -->
<!-- <u-icon slot="right" label-color="red" :label="`X30`"></u-icon> -->
<view v-else class="detail-box u-flex" v-for="(item, index) in hotelList" :key="index" @click="goto(item.id)">
<view class="">
<wd-img :width="100" :height="100" :src="item.certification.public_image" :enable-preview="false" :radius="8"
:round=false custom-class="margin-right-24" />
</view>
<view class="h-50 flex color-gray">
<up-text size="" :text="`${item.intro}最大承载人数6000人`" :flex1="true" align="left"
wordWrap="normal" :show="true" prefixIcon="" customStyle="font-size:24rpx"
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`X30`"></u-icon> -->
<view class="u-flex u-flex-column">
<up-text size="32rpx" :text="`${item.certification.public_name}`" customStyle="font-weight:bold"></up-text>
<up-text :text="`${item.certification.address}`" customStyle="font-size:24rpx"></up-text>
</view>
<view class="h-50 flex color-gray">
<up-text size="" :text="`${item.intro}四川省泸州市龙马潭区`" :flex1="true" align="left"
wordWrap="normal" :show="true" prefixIcon="" customStyle="font-size:24rpx"
iconStyle="font-size:24rpx;color:#59CB56;margin-right:10rpx;" lines="1" decoration="none">
</up-text>
<!-- <u-icon slot="right" label-color="red" :label="`X30`"></u-icon> -->
</view>
</template>
</u-cell>
</view>
</up-cell-group>
</wd-card>
</z-paging>
</view>
</template>
<script lang="ts">
// useColPickerData
//
import { CommonApi, UserApi } from "@/api";
import { useColPickerData } from '@/hooks'
import { defineComponent } from "vue";
import { CommonApi, UserApi } from "@/api";
import { get } from 'http';
// import { setToken, getToken, isLogin } from '@/utils/auth';
const { colPickerData, findChildrenByCode } = useColPickerData()
export default defineComponent({
data () {
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
min_data: new Date().getTime(),
isDisabledDate: [1754755200000, 1754755200000],
time_list: [],
menu_list: [{ id: 0, name: '第一餐' }, { id: 1, name: '第二餐' }, { id: 2, name: '第三餐' }],
// keyword_sp: '',
categoryIndex: 0,
childrenIndex: 0,
categoryList: [],
tabList: [],
good_list: [],
matchedItems_sp: [],
hotelList: [],
loadEnd: false
};
},
onLoad () {
// if (isLogin()) {
this.getCategoryList()
// }
this.getArea()
},
created () {
onLoad() {
this.getHotelList()
},
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('获取区域数据失败');
getHotelList(force = false) {
if (force) {
this.hotelList = []
this.search.page = 1
this.loadEnd = false
}
},
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'; //
}
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) => {
UserApi.hotelListApi(this.search).catch(res => {
if (res.code === 1) {
this.categoryList = res.data;
this.handleClickCategory(0)
if (this.search.page == 1) {
this.hotelList = res.data
} else {
this.hotelList.push(...res.data)
}
if (res.data.length < this.search.limit) {
this.loadEnd = true
}
} else {
uni.$u.toast(res.msg);
}
});
})
},
//
searchSP () {
this.$refs.pagingRefSP?.reload();
// this.changeSP(1);
},
//
changeSP (pageNo: number) {
// 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);
// console.log(res);
} else {
uni.$u.toast(res.msg);
}
});
},
//
goodsDetail (id: number) {
// console.log(id);
goto(id : number) {
uni.navigateTo({
url: `/pages/banquet/hotel/detail?id=${id}&is_add=1`
});
},
//
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);
},
onReachBottom() {
if (this.loadEnd) {
return
}
this.search.page++
this.getHotelList()
}
});
}
},
});
</script>
<style>
</style>