添加套餐管理列表页面

This commit is contained in:
wangxiaowei
2025-12-14 14:41:26 +08:00
parent a600c68099
commit 3c852116e6
4 changed files with 122 additions and 38 deletions

View File

@ -1,5 +1,4 @@
<route lang="jsonc" type="page">{
"needLogin": true,
"layout": "default",
"style": {
"navigationStyle": "custom"
@ -7,7 +6,7 @@
}</route>
<template>
<view class="">
<view class="pb-170rpx">
<view class="order-list sticky top-0 left-0 z-50 bg-[#F6F7F8] pb-10rpx">
<wd-navbar safeAreaInsetTop custom-class='!bg-[#F6F7F8]' :bordered="false" placeholder>
<template #left>
@ -16,27 +15,30 @@
<wd-icon name="thin-arrow-left" size="30rpx"></wd-icon>
</view>
<view class="search-box">
<wd-search v-model="keywords" hide-cancel placeholder-left light placeholder="搜索茶室订单" @search="OrderList.handleSearch()"></wd-search>
<wd-search v-model="keywords" hide-cancel placeholder-left light placeholder="搜索套餐名称" @search="OrderList.handleSearch()"></wd-search>
</view>
</view>
</template>
</wd-navbar>
<view class="tabs">
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="OrderList.handleChangeTabs">
<wd-tab title="全部" :name="TeaRoomOrderStatusText.All"></wd-tab>
<wd-tab title="待付款" :name="TeaRoomOrderStatusText.Pending"></wd-tab>
<wd-tab title="预约单" :name="TeaRoomOrderStatusText.Pay"></wd-tab>
<wd-tab title="已完结" :name="TeaRoomOrderStatusText.Finished"></wd-tab>
<wd-tab :title="item.title + `(${item.num})`" :name="item.name" v-for="(item, index) in tabList" :key="index"></wd-tab>
</wd-tabs>
</view>
</view>
<view class="tabs mt-18rpx mx-30rpx">
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption">
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
<combo-card :type="OrderSource.TeaRoom" :order="item"></combo-card>
<!-- <mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption"> -->
<view class="mb-20rpx" v-for="(item, index) in 10" :key="index">
<combo-card :type="OrderSource.SetMeal" :order="item"></combo-card>
</view>
</mescroll-body>
<!-- </mescroll-body> -->
</view>
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx">
<view class="flex items-center justify-center text-32rpx leading-44rpx leading-90rpx text-center !mt-34rpx">
<wd-button custom-class="!text-32rpx !w-630rpx !h-90rpx !bg-[#4C9F44] !rounded-8rpx !text-[#fff]">新建套餐</wd-button>
</view>
</view>
</view>
</template>
@ -65,6 +67,11 @@
// tab
const tab = ref<string>('all')
const tabList = ref<Array<{title: string, num: number, name: string}>>([
{ title: '已上架', num: 10, name: 'list'},
{ title: '已下架', num: 11, name: 'delist' },
// { title: '草稿箱', num: 0, name: 'draft' }
])
onLoad((args) => {
uni.$on('refreshOrderList', () => {
@ -89,21 +96,21 @@
*/
upCallback: (mescroll) => {
// 需要留一下数据为空的时候显示的空数据图标内容
const filter = {
page: mescroll.num,
size: mescroll.size,
order_status: orderStatus.value,
search: keywords.value
}
// const filter = {
// page: mescroll.num,
// size: mescroll.size,
// order_status: orderStatus.value,
// search: keywords.value
// }
getTeaRoomOrderList(filter).then((res) => {
const curPageData = res.list || [] // 当前页数据
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
list.value = list.value.concat(curPageData) //追加新数据
mescroll.endSuccess(curPageData.length, Boolean(res.more))
}).catch(() => {
// getTeaRoomOrderList(filter).then((res) => {
// const curPageData = res.list || [] // 当前页数据
// if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
// list.value = list.value.concat(curPageData) //追加新数据
// mescroll.endSuccess(curPageData.length, Boolean(res.more))
// }).catch(() => {
mescroll.endErr() // 请求失败, 结束加载
})
// })
},
/**
@ -111,24 +118,24 @@
* @param e
*/
handleChangeTabs: (e: {index: number, name: string}) => {
tab.value = e.name
if (e.name === TeaRoomOrderStatusText.Pending) {
orderStatus.value = '0'
} else {
orderStatus.value = TeaRoomOrderStatusValue[e.name] || ''
}
// tab.value = e.name
// if (e.name === TeaRoomOrderStatusText.Pending) {
// orderStatus.value = '0'
// } else {
// orderStatus.value = TeaRoomOrderStatusValue[e.name] || ''
// }
// 切换tab时,重置当前的mescroll
list.value = []
getMescroll().resetUpScroll();
// // 切换tab时,重置当前的mescroll
// list.value = []
// getMescroll().resetUpScroll();
},
/**
* 内容搜索
*/
handleSearch: () => {
list.value = []
getMescroll().resetUpScroll();
// list.value = []
// getMescroll().resetUpScroll();
}
}
</script>