Merge branch 'feat-mendian'

This commit is contained in:
2026-10-29 10:05:02 +08:00
23 changed files with 870 additions and 196 deletions
+28 -4
View File
@@ -1,5 +1,7 @@
<script setup>
import { ref, onMounted } from "vue";
import { onShow } from "@dcloudio/uni-app";
import { getSelectedExperienceStore, hasAnyStoreVip } from "@/utils/storeVip";
import Container from "@/components/Container.vue";
import UserHeader from "@/components/UserHeader.vue";
import UserItem from "@/components/UserItem.vue";
@@ -26,20 +28,40 @@ const toFristTryPage = async () => {
}
};
const toCoinPage = () => {
const selected = getSelectedExperienceStore();
uni.navigateTo({
url: "/pages/coin/nearby-stores",
url: selected ? "/pages/coin/index?tab=vip" : "/pages/coin/nearby-stores?tab=vip",
});
};
const showCoinEntry = ref(false);
const storeVipLabel = ref("加载中");
const storeVipFailed = ref(false);
let entryRequest = 0;
const loadCoinEntryVisibility = async () => {
const requestId = ++entryRequest;
showCoinEntry.value = false;
storeVipFailed.value = false;
storeVipLabel.value = "加载中";
try {
const result = await getMyGoldAPI();
if (requestId !== entryRequest) return;
showCoinEntry.value = result?.hasTempBind === true;
if (!showCoinEntry.value) return;
try {
const active = await hasAnyStoreVip();
if (requestId !== entryRequest) return;
storeVipLabel.value = active ? "VIP已开通" : "VIP未开通";
} catch (error) {
if (requestId !== entryRequest) return;
storeVipLabel.value = "加载失败,重试";
storeVipFailed.value = true;
console.error("加载入口门店VIP失败", error);
}
} catch (error) {
console.error("加载金币入口状态失败", error);
}
};
onShow(loadCoinEntryVisibility);
const toBeVipPage = () => {
uni.navigateTo({
url: "/pages/member/be-vip",
@@ -85,7 +107,6 @@ const logout = () => {
updateUser();
};
onMounted(() => {
loadCoinEntryVisibility();
const accountInfo = uni.getAccountInfoSync();
const envVersion = accountInfo.miniProgram.envVersion;
if (envVersion !== "release") showLogout.value = true;
@@ -127,9 +148,11 @@ const buildVersion = typeof __BUILD_TIME__ !== 'undefined' ? __BUILD_TIME__ : ''
</UserItem>
<UserItem
v-if="showCoinEntry"
title="我的金币"
title="线下体验中心"
:onClick="toCoinPage"
/>
>
<text class="store-vip-label" @click.stop="storeVipFailed ? loadCoinEntryVisibility() : toCoinPage()">{{ storeVipLabel }}</text>
</UserItem>
<!-- <UserItem title="会员" :onClick="toBeVipPage">
<view
v-if="user.sVip === true"
@@ -205,6 +228,7 @@ const buildVersion = typeof __BUILD_TIME__ !== 'undefined' ? __BUILD_TIME__ : ''
</template>
<style scoped>
.store-vip-label { padding: 4rpx 12rpx; border: 1rpx solid #999999; border-radius: 20rpx; font-size: 24rpx; }
.container {
background-color: #f5f5f5;
height: calc(100% - 65px);