ext.liuqiwen3 3 days ago
parent
commit
0b0e7264b7
3 changed files with 22 additions and 6 deletions
  1. 12 3
      pages/index/index.vue
  2. 1 2
      pages/users/login/index.vue
  3. 9 1
      utils/util.js

+ 12 - 3
pages/index/index.vue

@@ -136,7 +136,7 @@
                   </text>
                   <!-- <view class="txt">券</view> -->
                 </view>
-                <template v-if="item?.merchant?.id && (appStore.userInfo && !appStore.userInfo.merchant)">
+                <template v-if="item?.merchant?.id &&(!appStore.userInfo || (appStore.userInfo && !appStore.merchantId))">
                   <view class="merchantInfo" @click.stop="toMerchant(item.merchant.id)">
                     <image class="merchantLogo" :src="item.merchant.merchantLogo" mode="scaleToFill"></image>
                     <text class="merchantName">{{item.merchant.merchantName}}</text>
@@ -194,6 +194,8 @@ import {
 } from "@/api/store.js";
 import { timeFormat } from "@/uni_modules/uview-plus";
 import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
+import { getSceneInfo } from '@/utils/util.js';
+import { toLogin } from "@/libs/login.js";
 // 获取实时金价
 // 实时价格处理
 const {
@@ -255,7 +257,10 @@ const calculatedProducts = computed(() => {
     };
   });
 });
+onLoad(async (options) => {
+  const params = await getSceneInfo(options,'index');
 
+});
 onShow(() => {
   const isLogin = appStore.isLogin;
   if(isLogin){
@@ -264,19 +269,23 @@ onShow(() => {
   }
 
   uni.setNavigationBarTitle({ title: site_name.value });
+
   if(appStore.merchantId && appStore.merchantId!=''){
     merchantId.value = appStore.merchantId;
+    if(!isLogin){
+      toLogin();
+    }
   }else if(appStore?.userInfo?.merchant && appStore?.userInfo?.merchant.id){
     merchantId.value = appStore.userInfo.merchant.id
   }else{
     merchantId.value = '';
   }
-
-
   if(merchantId.value && merchantId.value!=''){
+    console.log('++++++++++++++++')
     getSbmerchantInfoFn();
     getMerchantBannerListFn()
   }else{
+    console.log('+++++===============')
     getIndexConfig();
   }
   getGroomList();

+ 1 - 2
pages/users/login/index.vue

@@ -345,8 +345,7 @@ const getUserInfoFn = async (data) => {
 };
 
 onLoad((options) => {
-  const params = getSceneInfo(options);
-  merchantId.value = params.merchantId || '';
+  merchantId.value = appStore.merchantId || '';
   getLogoImage();
 });
 

+ 9 - 1
utils/util.js

@@ -3,6 +3,7 @@ import { HTTP_ADMIN_URL, BASE_OSS_URL } from "@/config/app.js";
 import { useAppStore } from "@/stores/app.js";
 import { addJoinTeamUserRole } from "@/api/api.js";
 import { getJoinRolesAPI } from "@/api/joinus";
+import { footprintScan } from "@/api/merchant.js";
 import { pathToBase64 } from "@/plugin/image-tools/index.js";
 import { useToast } from "@/hooks/useToast";
 import pageJson from '@/pages.json';
@@ -887,7 +888,7 @@ export function isTabBarPage() {
 }
 
 // 获取邀请码
-export function getSceneInfo(e) {
+export async function getSceneInfo (e,index) {
   if (e.scene) {
     const decodedScene = decodeURIComponent(e.scene);
     const params = {};
@@ -901,6 +902,13 @@ export function getSceneInfo(e) {
     }
 
     if (params.merchantId) appStore.UPDATE_MERCHANT_ID(params.merchantId);
+    if(index == 'index' && appStore.userInfo){
+      let obj ={
+        merchantId:params.merchantId,
+        userId:appStore.userInfo.userId
+      }
+      await footprintScan(obj)
+    }
     console.log("获取邀请码-params", params)
     return params;
   }