| | |
| | | </view> |
| | | <u-icon style="display: flex;align-items: flex-start;" name="arrow-right"></u-icon> |
| | | </view> |
| | | |
| | | <!-- <button type="default" @click="goTOSuccess">立即查看</button> --> |
| | | <view class="member-gradient-bg"> |
| | | <view class="member-content"> |
| | | <view class="vip-icon"> |
| | |
| | | </view> |
| | | <!-- 撑起下方 --> |
| | | <view style="height:64px;"> |
| | | |
| | | </view> |
| | | <custom-tabbar bgColor="#ffffff" selected="my"></custom-tabbar> |
| | | |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import '@/pages/subComponents/uview-components/uview-ui'; |
| | | import tool from "@/pages/tabbar/user/utils/tool.vue"; |
| | | import { getSTSToken } from "@/api/common.js"; |
| | | import { getCouponsNum, getFootprintNum } from "@/api/members.js"; |
| | | import { getCouponsNum, getFootprintNum,bindMemberAndStore } from "@/api/members.js"; |
| | | import { getUserWallet } from "@/api/members"; |
| | | import configs from '@/config/config' |
| | | import storage from '@/utils/storage.js' |
| | |
| | | walletNum: "", |
| | | }; |
| | | }, |
| | | onLoad() { |
| | | this.initCOS() |
| | | onLoad(option) { |
| | | console.log('-----------分享出的数据---------->', option) |
| | | let shareStoreId = null; |
| | | let shareTime = null; |
| | | // 检查是否存在q参数 |
| | | if (option.q) { |
| | | // 双重解码:微信对URL进行了两次编码 |
| | | const decodedUrl = decodeURIComponent(decodeURIComponent(option.q)); |
| | | console.log('原始URL:', decodedUrl); |
| | | |
| | | // 解析URL中的查询参数 |
| | | const params = this.parseUrlParams(decodedUrl); |
| | | shareStoreId = params.shareStoreId; |
| | | try { |
| | | // 将数据存储到本地缓存 |
| | | uni.setStorageSync('shareStoreId', shareStoreId); |
| | | //创建一个扫码的时间 |
| | | // 获取当前时间并格式化为 yyyy-MM-dd HH:mm:ss |
| | | const now = new Date(); |
| | | const year = now.getFullYear(); |
| | | const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要+1 |
| | | const day = String(now.getDate()).padStart(2, '0'); |
| | | const hours = String(now.getHours()).padStart(2, '0'); |
| | | const minutes = String(now.getMinutes()).padStart(2, '0'); |
| | | const seconds = String(now.getSeconds()).padStart(2, '0'); |
| | | |
| | | shareTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
| | | uni.setStorageSync('shareTime', 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() || {}; |
| | |
| | | |
| | | mounted() { }, |
| | | methods: { |
| | | async bindMemberAndStore(shareStoreId, shareTime){ |
| | | let form ={ |
| | | shareStoreId: shareStoreId, |
| | | shareTime: shareTime |
| | | } |
| | | // let form ={ |
| | | // shareStoreId: "1376433565247471616", |
| | | // shareTime: "2025-09-26 16:18:00" |
| | | // } |
| | | try { |
| | | const res = await bindMemberAndStore(form); |
| | | if(res.statusCode === 200){ |
| | | //清除缓存 |
| | | uni.removeStorageSync('shareStoreId'); |
| | | uni.removeStorageSync('shareTime'); |
| | | } |
| | | } |
| | | catch(error) { |
| | | console.error('出错:', error); |
| | | }; |
| | | }, |
| | | // goTOSuccess(){ |
| | | // uni.redirectTo({ |
| | | // url:"/pages/cart/payment/success?paymentMethod=WECHAT" + |
| | | // "&payPrice=" + |
| | | // 10, |
| | | // }); |
| | | // }, |
| | | // 初始化腾讯云cos客户端 |
| | | initCOS() { |
| | | // 调用后端获取sts临时访问凭证 |
| | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import url("/pages/subComponents/static/bgStyle.css"); |
| | | html, |
| | | body { |
| | | overflow: auto; |
| | |
| | | background-size: cover; |
| | | border-bottom-left-radius: 30rpx; |
| | | border-bottom-right-radius: 30rpx; |
| | | background-image: url("/pages/subComponents/static/img/main-bg.png"); |
| | | background-image: var(--main-bg); |
| | | background-position: bottom; |
| | | background-repeat: no-repeat; |
| | | color: #ffffff; |
| | |
| | | background: #fff; |
| | | border-radius: 20rpx; |
| | | box-shadow: 0 4rpx 24rpx 0 #f6f6f6; |
| | | transform: translateY(-30rpx); |
| | | } |
| | | |
| | | .user-name { |