fix:修复bug

This commit is contained in:
2026-03-17 12:03:54 +08:00
parent 5d7b973ddd
commit 60df817de5
32 changed files with 654 additions and 528 deletions
+19 -20
View File
@@ -2,7 +2,7 @@
import { debounce } from 'throttle-debounce'
import dayjs from 'dayjs'
import Config from '@/config/index'
const { t } = useI18n();
const { t, locale } = useI18n();
import StoreSkeleton from './components/store-skeleton.vue';
import { useScrollThreshold } from '@/hooks/useScrollThreshold'
import {
@@ -271,20 +271,6 @@ const deliveryMethod = ref(0);
const deliveryMethodOptions = [t('pages-store.store.delivery'), t('pages-store.store.pickup')];
const showDeliverySwitch = ref(true); // 是否显示配送方式切换组件
// 配送时间显示:后端返回分钟;>= 1 天时换算成“天”,否则保持“分钟”
function formatMinutesToDaysText(minutes?: number | string) {
const m = Number(minutes)
if (!Number.isFinite(m) || m <= 0) return '--'
const MINUTES_PER_DAY = 60 * 24
if (m < MINUTES_PER_DAY) return `${m} ${t('common.minutes')}`
const days = m / MINUTES_PER_DAY
// 保留 1 位小数并去掉末尾 0(例如 2.0 -> 2
let daysText = days.toFixed(1).replace(/\.0$/, '')
daysText = '3';
return `${daysText}${t('pages-store.store.days')}`
}
const deliveryTimeText = computed(() => formatMinutesToDaysText(storeDetail.value?.deliveryTime as any))
function handleClickSegmented(index: number) {
console.log("切换配送方式:", index);
if(+storeDetail.value.deliveryService !== 1 && index === 0) {
@@ -307,6 +293,15 @@ function handleClickSegmented(index: number) {
const activeTab = ref(0);
const tabs = ref<any[]>([]);
function daySuffix(value: unknown) {
const n = Number(value)
const isEn = String(locale.value || '').toLowerCase().startsWith('en')
if (isEn) {
return n === 1 ? ` ${t('pages-store.store.day')}` : ` ${t('pages-store.store.days')}`
}
return t('pages-store.store.days')
}
// 分页相关状态
const pageNum = ref(1);
const pageSize = ref(10);
@@ -563,7 +558,9 @@ function handleShare() {
></image>
CHEFLINK
</view>
<text v-if="+storeDetail?.deliveryService === 1" class="text-#7D7D7D"> {{ deliveryTimeText }}</text>
<text v-if="+storeDetail?.deliveryService === 1" class="text-#7D7D7D">
{{ storeDetail?.deliveryTime }}{{ daySuffix(storeDetail?.deliveryTime) }}
</text>
</view>
<view class="text-24rpx lh-24rpx text-#7D7D7D text-center mt-16rpx">
{{ t('pages-store.store.title') }} US${{ storeDetail?.minOrderPrice }}
@@ -627,11 +624,13 @@ function handleShare() {
<template v-if="+storeDetail?.deliveryService === 1 && deliveryMethod === 0">
<view class="w-full h-full flex-1 text-center text-#CE7138 pr-44rpx">
<view>{{ t('pages-store.store.tips4') }} ${{ storeDetail?.minOrderPrice }}</view>
<view>{{ t('pages-store.store.tips5') }} ${{ storeDetail?.deliveryFee }}</view>
<view>{{ t('pages-store.store.tips5') }} ${{ storeDetail?.deliveryFee }}{{ t('pages-store.store.start') }}</view>
</view>
<view class="h-128rpx w-1rpx rotate-0 bg-#D8D8D8"></view>
<view class="w-full flex-1 center flex-col pl-44rpx">
<view class="text-#333 mb-8rpx">{{ deliveryTimeText }}</view>
<view class="text-#333 mb-8rpx">
{{ storeDetail?.deliveryTime }}{{ daySuffix(storeDetail?.deliveryTime) }}
</view>
<view class="text-#7D7D7D">{{ t('pages-store.store.earTime') }}</view>
</view>
</template>
@@ -661,7 +660,7 @@ function handleShare() {
<view v-if="tabs.length > 0" class="px-30rpx pb-120rpx">
<view v-if="currentDishList.length > 0" class="text-40rpx lh-40rpx font-500 my-36rpx">{{ t('pages-store.store.recommend') }}</view>
<view v-if="currentDishList.length > 0" class="grid grid-cols-2 gap-30rpx">
<template v-for="item in currentDishList">
<template v-for="item in currentDishList" :key="item.id">
<view @click="navigateToDishes(item)" class="w-100% mb-10rpx">
<view class="relative h-248rpx rounded-24rpx mb-28rpx">
<view @click.stop="handleDishCollectionClick(item)" class="w-68rpx h-68rpx absolute z-2 top-0 right-0">
@@ -704,7 +703,7 @@ function handleShare() {
<view class="flex-center-sb mt-12rpx">
<view class="text-28rpx text-#999">
<view class="line-through">US${{ item.originalPrice }}</view>
<!-- <view>{{ t('pages-store.store.sales') }}:{{ item.salesCount }}</view> -->
<view>{{ t('pages-store.store.sales') }}:{{ item.salesCount }}</view>
</view>
<view class="center w-64rpx h-64rpx rounded-50% bg-white shadow-lg">