update:优化金币

This commit is contained in:
2026-08-20 16:10:17 +08:00
parent 42cfb5c3d8
commit 45957d04b1
14 changed files with 247 additions and 39 deletions
+25 -2
View File
@@ -8,7 +8,8 @@ import StoreCard from "./components/StoreCard.vue";
import { getNearbyStoresAPI } from "@/apis";
const PAGE_SIZE = 20;
const DEFAULT_STORE_IMAGE = "/static/coin/store-photo.png";
const DEFAULT_STORE_IMAGE =
"https://static.shelingxingqiu.com/shootmini/static/coin/store-photo.png";
const showPermissionState = ref(false);
const stores = ref([]);
const location = ref(null);
@@ -100,6 +101,23 @@ const authorizeLocation = () => {
});
};
// 选择门店后替换当前页面,返回时直接回到进入金币模块前的页面。
const selectStore = (store) => {
const storeId = String(store?.id || "");
if (!/^\d+$/.test(storeId) || Number(storeId) <= 0) {
uni.showToast({
title: "门店信息无效",
icon: "none",
});
return;
}
const storeName = encodeURIComponent(store?.name || "");
uni.redirectTo({
url: `/pages/coin/index?storeId=${encodeURIComponent(storeId)}&storeName=${storeName}`,
});
};
onLoad(locateAndLoadStores);
</script>
@@ -114,7 +132,12 @@ onLoad(locateAndLoadStores);
@authorize="authorizeLocation"
/>
<template v-else>
<StoreCard v-for="store in stores" :key="store.id" :store="store" />
<StoreCard
v-for="store in stores"
:key="store.id"
:store="store"
@select="selectStore"
/>
<text v-if="loaded && !stores.length" class="stores-page__more">
附近暂无门店~
</text>