diff --git a/.env b/.env
index 2cd1130..79b33c8 100644
--- a/.env
+++ b/.env
@@ -15,7 +15,7 @@ SHOPRO_VERSION=v2.4.1
#SHOPRO_DEV_BASE_URL=http://192.168.101.58:48090
# 服务器
-# SHOPRO_DEV_BASE_URL=http://www.qflyqzy.net:48090
+SHOPRO_DEV_BASE_URL=http://www.qflyqzy.net:48090
#SHOPRO_DEV_BASE_URL=https://www.qflyqzy.net/yg-api
@@ -23,7 +23,7 @@ SHOPRO_VERSION=v2.4.1
# SHOPRO_DEV_BASE_URL=http://192.168.1.7:48080
# 测试环境
-SHOPRO_DEV_BASE_URL=https://yougoutest.api.riananyoumu.com
+# SHOPRO_DEV_BASE_URL=https://yougoutest.api.riananyoumu.com
# 本地
# SHOPRO_DEV_BASE_URL=http://8.136.55.200:48090
diff --git a/components/goods/goods.vue b/components/goods/goods.vue
index ca35948..5262d6c 100644
--- a/components/goods/goods.vue
+++ b/components/goods/goods.vue
@@ -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()
diff --git a/components/goodsItem/card_goods.vue b/components/goodsItem/card_goods.vue
index b2cf402..aeff26c 100644
--- a/components/goodsItem/card_goods.vue
+++ b/components/goodsItem/card_goods.vue
@@ -35,12 +35,12 @@
v-if="props.type == 1"
>
{{ props.data.tagSaleName }}
- 已售{{ props.data.salesCount }}
+ 已售{{ props.data.salesCount }}
{{ props.data.categoryText }}
- 销量:{{ props.data.salesCount }}
+ 销量:{{ props.data.salesCount }}
{
+ const now = Date.now();
+ if (aiShopStatus.value.value !== null && now - aiShopStatus.value.checkedAt < 60 * 1000) {
+ return Boolean(aiShopStatus.value.value);
+ }
+ const res = await api.checkShopStatus({});
+ if (res?.code !== 0) {
+ throw new Error('checkShopStatus_failed');
+ }
+ const opened = Boolean(res?.data);
+ aiShopStatus.value = {
+ value: opened ? 1 : 0,
+ checkedAt: now,
+ };
+ return opened;
+ };
+
const searchText = ref('');
const search = () => {
@@ -232,7 +256,70 @@
}
});
- onShow(() => {
+ onShow(async () => {
+ try {
+ const opened = await ensureAiShopOpened();
+ if (!opened) {
+ const message = '您尚未开通AI店铺,无法查看购物车。请先开通AI店铺后再进行购买。';
+ uni.setStorageSync(HOME_DEFAULT_TAB_STORAGE_KEY, '会员优选');
+ uni.switchTab({
+ url: '/pages/index/index',
+ success: () => {
+ setTimeout(() => {
+ uni.showToast({
+ title: message,
+ icon: 'none',
+ duration: 2500,
+ });
+ }, 50);
+ },
+ fail: () => {
+ uni.reLaunch({
+ url: '/pages/index/index',
+ success: () => {
+ setTimeout(() => {
+ uni.showToast({
+ title: message,
+ icon: 'none',
+ duration: 2500,
+ });
+ }, 50);
+ },
+ });
+ },
+ });
+ return;
+ }
+ } catch (e) {
+ const message = '系统繁忙,请稍后重试';
+ uni.switchTab({
+ url: '/pages/index/index',
+ success: () => {
+ setTimeout(() => {
+ uni.showToast({
+ title: message,
+ icon: 'none',
+ duration: 2500,
+ });
+ }, 50);
+ },
+ fail: () => {
+ uni.reLaunch({
+ url: '/pages/index/index',
+ success: () => {
+ setTimeout(() => {
+ uni.showToast({
+ title: message,
+ icon: 'none',
+ duration: 2500,
+ });
+ }, 50);
+ },
+ });
+ },
+ });
+ return;
+ }
getSpuTimeList();
getCartList();
getMessageList();
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 133e726..0aba983 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -50,7 +50,7 @@
-->
-
+
-
+
@@ -83,11 +83,13 @@