| | |
| | | |
| | | shareTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| | | uni.setStorageSync('shareTime', shareTime); |
| | | |
| | | this.bindMemberAndStore(shareStoreId, shareTime); |
| | | |
| | | console.log('数据存储成功'); |
| | | } catch (e) { |
| | | console.error('存储失败:', e); |
| | | } |
| | | }else{ |
| | | shareStoreId = uni.getStorageSync('shareStoreId'); |
| | | shareStoreId = uni.getStorageSync('shareTime'); |
| | | console.log('从缓存读取参数:', { shareStoreId, shareTime }); |
| | | // this.bindMemberAndStore(shareStoreId, shareTime) |
| | | if (shareStoreId && shareTime) { |
| | | console.log('检测到有效参数,调用后端接口'); |
| | | this.bindMemberAndStore(shareStoreId, shareTime); |
| | | } else { |
| | | console.log('无有效参数,执行正常逻辑'); |
| | | } |
| | | } |
| | | this.initCOS() |
| | | }, |
| | | onShow() { |
| | | |
| | | this.userInfo = this.$options.filters.isLogin() || {}; |
| | | if (this.$options.filters.isLogin("auth")) { |
| | | this.getUserOrderNum(); |
| | |
| | | this.walletNum = 0; |
| | | this.couponNum = 0; |
| | | this.footNum = 0; |
| | | } |
| | | |
| | | let shareStoreId = uni.getStorageSync('shareStoreId'); |
| | | let shareTime = uni.getStorageSync('shareTime'); |
| | | console.log('从缓存读取参数:', { shareStoreId, shareTime }); |
| | | if (shareStoreId && shareTime) { |
| | | console.log('检测到有效参数,调用后端接口'); |
| | | this.bindMemberAndStore(shareStoreId, shareTime); |
| | | } else { |
| | | console.log('无有效参数,执行正常逻辑'); |
| | | } |
| | | }, |
| | | onPullDownRefresh() { |
| | |
| | | |
| | | mounted() { }, |
| | | methods: { |
| | | // 解析URL参数 |
| | | parseUrlParams(url) { |
| | | const params = {}; |
| | | // 处理可能存在的hash(如果有的话) |
| | | const cleanUrl = url.split('#')[0]; |
| | | const queryStr = cleanUrl.split('?')[1] || ''; |
| | | |
| | | queryStr.split('&').forEach(pair => { |
| | | const [key, value] = pair.split('='); |
| | | if (key) { |
| | | // 如果值存在,则解码,否则设为空字符串 |
| | | params[key] = value ? decodeURIComponent(value) : ''; |
| | | } |
| | | }); |
| | | |
| | | return params; |
| | | }, |
| | | async bindMemberAndStore(shareStoreId, shareTime){ |
| | | let form ={ |
| | | shareStoreId: shareStoreId, |