feat: banner跳转ai店铺判断

This commit is contained in:
2026-06-08 17:34:23 +08:00
parent 7752c4efa5
commit 5551b08d5a
7 changed files with 186 additions and 17 deletions
+28
View File
@@ -40,9 +40,14 @@
type: Array,
default: () => [],
},
defaultTabName: {
type: String,
default: '',
},
});
const hasPurchasedShop = ref(null);
const displayList = ref([]);
const hasAppliedDefaultTab = ref(false);
const computeDisplayList = () => {
const list = Array.isArray(props.list) ? props.list : [];
@@ -67,10 +72,24 @@
onReachBottom,
);
const applyDefaultTabIfNeeded = (list) => {
const target = String(props.defaultTabName || '').trim();
if (!target) return;
if (hasAppliedDefaultTab.value) return;
const index = (Array.isArray(list) ? list : []).findIndex(
(v) => String(v?.name || '').trim() === target,
);
if (index >= 0) {
tabIndex.value = index;
hasAppliedDefaultTab.value = true;
}
};
const refreshDisplay = () => {
const next = computeDisplayList();
displayList.value = next;
syncMescrollItems(next);
applyDefaultTabIfNeeded(next);
if (tabIndex.value >= next.length) tabIndex.value = 0;
};
@@ -96,6 +115,15 @@
},
{ immediate: true, deep: true },
);
watch(
() => props.defaultTabName,
() => {
hasAppliedDefaultTab.value = false;
applyDefaultTabIfNeeded(displayList.value);
},
{ immediate: true },
);
// let tabIndex = ref(0);
const navChange = (i) => {
// scrollToLastY()
+2 -2
View File
@@ -35,12 +35,12 @@
v-if="props.type == 1"
>
<view class="label" v-if="props.data.tagSaleName">{{ props.data.tagSaleName }}</view>
<view class="num">已售{{ props.data.salesCount }}</view>
<view class="num" v-if="!props.memberPreferred">已售{{ props.data.salesCount }}</view>
</view>
<view v-else-if="props.type == 2">
<view class="flex-center ju-between mt10 wrap">
<view class="num size26 m-r-4">{{ props.data.categoryText }}</view>
<view class="num">销量:{{ props.data.salesCount }}</view>
<view class="num" v-if="!props.memberPreferred">销量:{{ props.data.salesCount }}</view>
</view>
<view class="flex-row wrap" v-if="props.data.tagSaleName">
<view