跳转逻辑

parent 62c70bb4
...@@ -351,7 +351,7 @@ const recommendedListOfPeripherals = ref([]); ...@@ -351,7 +351,7 @@ const recommendedListOfPeripherals = ref([]);
onLoad(async (options) => { onLoad(async (options) => {
params.value.shopId = options.shopId; params.value.shopId = options.shopId;
shopId.value = options.shopId; shopId.value = options.shopId;
scrollToTop();
// 使用 Promise.all 并行请求,提升性能 // 使用 Promise.all 并行请求,提升性能
await Promise.all([ await Promise.all([
getStoreInformationFn(options.shopId), getStoreInformationFn(options.shopId),
...@@ -368,7 +368,13 @@ onLoad(async (options) => { ...@@ -368,7 +368,13 @@ onLoad(async (options) => {
// 获取位置并计算距离 // 获取位置并计算距离
calculateDistance(); calculateDistance();
}); });
function scrollToTop() {
// 使用 scrollTo 方法滚动到顶部
xma.pageScrollTo({
scrollTop: 0,
duration: 300, // 动画时间,可选
});
}
onShow(async () => { onShow(async () => {
await getStoreInformationFn(params.value.shopId); await getStoreInformationFn(params.value.shopId);
...@@ -376,24 +382,28 @@ onShow(async () => { ...@@ -376,24 +382,28 @@ onShow(async () => {
calculateDistance(); calculateDistance();
}); });
async function refreshShowDetail(item) { async function refreshShowDetail(item) {
params.value.shopId = item.shopId; // params.value.shopId = item.shopId;
shopId.value = item.shopId; // shopId.value = item.shopId;
// 使用 Promise.all 并行请求,提升性能 // // 使用 Promise.all 并行请求,提升性能
await Promise.all([ // await Promise.all([
getStoreInformationFn(item.shopId), // getStoreInformationFn(item.shopId),
groupBuyListFn(item.shopId), // groupBuyListFn(item.shopId),
couponShopListFn(item.shopId), // couponShopListFn(item.shopId),
]); // ]);
// 获取周边推荐信息 // // 获取周边推荐信息
peripheryRecomFn(); // peripheryRecomFn();
// 获取评价信息 // // 获取评价信息
getEvaluationPageFn(); // getEvaluationPageFn();
// 获取位置并计算距离 // // 获取位置并计算距离
calculateDistance(); // calculateDistance();
/// /////////////////////
xma.navigateTo({
url: `/pages/shop/shop?shopId=${item.shopId}`,
});
} }
// 计算距离的函数封装 // 计算距离的函数封装
async function calculateDistance() { async function calculateDistance() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment