修复bug
This commit is contained in:
Vendored
+2
-2
@@ -5,7 +5,7 @@ VITE_DELETE_CONSOLE=false
|
|||||||
|
|
||||||
#本地环境
|
#本地环境
|
||||||
#VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai
|
#VITE_SERVER_BASEURL=http://liuyao.nat100.top/meiguowaimai
|
||||||
VITE_SERVER_BASEURL=http://192.168.5.4:8080
|
#VITE_SERVER_BASEURL=http://192.168.5.4:8080
|
||||||
#VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
|
VITE_SERVER_BASEURL=https://howhowfresh.com/prod-api
|
||||||
#VITE_SERVER_BASEURL=http://192.168.1.8:8811
|
#VITE_SERVER_BASEURL=http://192.168.1.8:8811
|
||||||
#VITE_SERVER_BASEURL=http://mifengchuantou.natapp1.cc/meiguowaimai
|
#VITE_SERVER_BASEURL=http://mifengchuantou.natapp1.cc/meiguowaimai
|
||||||
|
|||||||
+3
-1
@@ -134,7 +134,9 @@
|
|||||||
"overview": "Overview",
|
"overview": "Overview",
|
||||||
"tipsDesc": "They help customers choose what to order.To add photos,go to items and choose menu item",
|
"tipsDesc": "They help customers choose what to order.To add photos,go to items and choose menu item",
|
||||||
"tipsTitle": "Photos of menu items can increase sales",
|
"tipsTitle": "Photos of menu items can increase sales",
|
||||||
"title": "Items"
|
"title": "Items",
|
||||||
|
"pickerNoMenu": "No menu data available",
|
||||||
|
"pickerSelectValidMenu": "Please select a valid menu item"
|
||||||
},
|
},
|
||||||
"mine": {
|
"mine": {
|
||||||
"complaintsSuggestions": "Complaints And Suggestions",
|
"complaintsSuggestions": "Complaints And Suggestions",
|
||||||
|
|||||||
@@ -134,7 +134,9 @@
|
|||||||
"overview": "总览",
|
"overview": "总览",
|
||||||
"tipsDesc": "他们帮助顾客选择要点什么。要添加照片,请转到项目并选择菜单项",
|
"tipsDesc": "他们帮助顾客选择要点什么。要添加照片,请转到项目并选择菜单项",
|
||||||
"tipsTitle": "菜单上的照片可以增加销量",
|
"tipsTitle": "菜单上的照片可以增加销量",
|
||||||
"title": "菜品"
|
"title": "菜品",
|
||||||
|
"pickerNoMenu": "暂无菜单数据",
|
||||||
|
"pickerSelectValidMenu": "请在有效选项上选择菜单"
|
||||||
},
|
},
|
||||||
"mine": {
|
"mine": {
|
||||||
"complaintsSuggestions": "投诉建议",
|
"complaintsSuggestions": "投诉建议",
|
||||||
|
|||||||
+15
-4
@@ -149,12 +149,13 @@ async function ensureMenuListLoaded() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const findIndexById = (array: any[], targetId: string | number) =>
|
const findIndexById = (array: any[], targetId: string | number) =>
|
||||||
array.findIndex((item) => item.id === targetId);
|
array.findIndex((item) => String(item.id) === String(targetId));
|
||||||
|
|
||||||
function indexChangeMenu(id: string) {
|
function indexChangeMenu(id: string) {
|
||||||
// 最新的菜单ID
|
// 最新的菜单ID
|
||||||
console.log('indexChangeMenu', id)
|
console.log('indexChangeMenu', id)
|
||||||
currentMenuIndex.value = findIndexById(menuList.value, id)
|
const idx = findIndexById(menuList.value, id)
|
||||||
|
currentMenuIndex.value = idx >= 0 ? idx : 0
|
||||||
console.log('当前选中的菜单索引', currentMenuIndex.value)
|
console.log('当前选中的菜单索引', currentMenuIndex.value)
|
||||||
getMenuDetail().then(() => {
|
getMenuDetail().then(() => {
|
||||||
paging.value?.reload()
|
paging.value?.reload()
|
||||||
@@ -165,9 +166,14 @@ function indexChangeMenu(id: string) {
|
|||||||
const menuDishListData = ref<MerchantDishVo[]>([])
|
const menuDishListData = ref<MerchantDishVo[]>([])
|
||||||
|
|
||||||
async function getMenuDetail() {
|
async function getMenuDetail() {
|
||||||
|
const recipeId = currentMenu.value?.id
|
||||||
|
if (recipeId === undefined || recipeId === null || String(recipeId).trim() === '') {
|
||||||
|
menuDishListData.value = []
|
||||||
|
return
|
||||||
|
}
|
||||||
return appMerchantMenuMenuDetailPost({
|
return appMerchantMenuMenuDetailPost({
|
||||||
params: {
|
params: {
|
||||||
recipeId: currentMenu.value.id || ''
|
recipeId
|
||||||
}
|
}
|
||||||
}).then((res: any) => {
|
}).then((res: any) => {
|
||||||
console.log('获取菜单详情', res)
|
console.log('获取菜单详情', res)
|
||||||
@@ -294,9 +300,14 @@ function deleteRecipe(item: MerchantDishVo) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentMenuId() {
|
||||||
|
return currentMenu.value?.id as string | number | undefined
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
initData,
|
initData,
|
||||||
indexChangeMenu
|
indexChangeMenu,
|
||||||
|
getCurrentMenuId
|
||||||
})
|
})
|
||||||
|
|
||||||
// 当前商家是否已经入驻了
|
// 当前商家是否已经入驻了
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import {useUserStore} from "@/store";
|
|||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const pickerValue = ref(0)
|
/** 与 wd-picker-view 的 value-key 一致,存菜单 id(非列索引) */
|
||||||
|
const pickerValue = ref<string | number>('')
|
||||||
const emits = defineEmits(['confirm'])
|
const emits = defineEmits(['confirm'])
|
||||||
|
|
||||||
// 默认分页配置(避免一次请求 1000 条)
|
// 默认分页配置(避免一次请求 1000 条)
|
||||||
@@ -17,9 +18,21 @@ type MenuColumnItem = {
|
|||||||
label: string
|
label: string
|
||||||
}
|
}
|
||||||
|
|
||||||
function onOpen(value: number) {
|
/** 打开选择器;selectedMenuId 为当前概览选中的菜单 id,用于回显 */
|
||||||
getMenuListByMerchant()
|
async function onOpen(selectedMenuId?: string | number) {
|
||||||
show.value = true;
|
await getMenuListByMerchant()
|
||||||
|
if (columns.value.length === 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: t('pages.menu.pickerNoMenu'),
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const match = selectedMenuId != null && selectedMenuId !== ''
|
||||||
|
? columns.value.find((c) => String(c.value) === String(selectedMenuId))
|
||||||
|
: undefined
|
||||||
|
pickerValue.value = match ? match.value : columns.value[0].value
|
||||||
|
show.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const columns = ref<MenuColumnItem[]>([])
|
const columns = ref<MenuColumnItem[]>([])
|
||||||
@@ -63,8 +76,30 @@ function handleClose() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
console.log('handleSubmit', pickerValue.value)
|
if (columns.value.length === 0) {
|
||||||
emits('confirm', pickerValue.value)
|
uni.showToast({
|
||||||
|
title: t('pages.menu.pickerNoMenu'),
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const pv = pickerValue.value
|
||||||
|
if (pv === '' || pv === undefined || pv === null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: t('pages.menu.pickerSelectValidMenu'),
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const isValid = columns.value.some((c) => String(c.value) === String(pv))
|
||||||
|
if (!isValid) {
|
||||||
|
uni.showToast({
|
||||||
|
title: t('pages.menu.pickerSelectValidMenu'),
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
emits('confirm', String(pv))
|
||||||
handleClose()
|
handleClose()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +122,13 @@ defineExpose({
|
|||||||
<view class="text-30rpx text-#FF6106" @click="handleSubmit">{{ t('common.confirm') }}</view>
|
<view class="text-30rpx text-#FF6106" @click="handleSubmit">{{ t('common.confirm') }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bg-#fff px-54rpx py-56rpx">
|
<view class="bg-#fff px-54rpx py-56rpx">
|
||||||
<wd-picker-view v-model="pickerValue" :columns="columns"/>
|
<wd-picker-view
|
||||||
|
v-if="show"
|
||||||
|
v-model="pickerValue"
|
||||||
|
:columns="columns"
|
||||||
|
label-key="label"
|
||||||
|
value-key="value"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</wd-popup>
|
</wd-popup>
|
||||||
|
|||||||
@@ -54,10 +54,17 @@ async function getPlatformDefaultStoreInfo() {
|
|||||||
console.log('getPlatformDefaultStoreInfo被处罚了')
|
console.log('getPlatformDefaultStoreInfo被处罚了')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentMenuId() {
|
||||||
|
const list = menuSwiperListRef.value as any
|
||||||
|
if (!list || !Array.isArray(list)) return undefined
|
||||||
|
return list[0]?.getCurrentMenuId?.()
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
indexChangeMenu,
|
indexChangeMenu,
|
||||||
initData,
|
initData,
|
||||||
init: getPlatformDefaultStoreInfo,
|
init: getPlatformDefaultStoreInfo,
|
||||||
|
getCurrentMenuId,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -74,8 +74,9 @@ function handleChooseLanguage() {
|
|||||||
const changeMenuRef = ref()
|
const changeMenuRef = ref()
|
||||||
|
|
||||||
function changeMenu() {
|
function changeMenu() {
|
||||||
|
const menuId = tabbarMenuRef.value?.getCurrentMenuId?.()
|
||||||
if (changeMenuRef.value) {
|
if (changeMenuRef.value) {
|
||||||
changeMenuRef.value.onOpen()
|
changeMenuRef.value.onOpen(menuId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user