<template>
|
<view class="user">
|
<!-- 个人信息 -->
|
<view class="status_bar">
|
<!-- 这里是状态栏 -->
|
</view>
|
<view class="header" @click="userDetail">
|
<view class="head-1">
|
<image v-if="userInfo.face" :src="endpoint + '/' + userInfo.face"></image>
|
<image v-else :src="userImage"></image>
|
</view>
|
<view class="head-2" v-if="userInfo.id">
|
<view class="user-name">{{ userInfo.nickName }}</view>
|
</view>
|
<view class="head-2" v-else>
|
<view class="user-name">登录/注册</view>
|
</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">
|
<image src="/static/tabbar/vip.png" mode="widthFix"></image>
|
</view>
|
<view class="vip-info">
|
<p class="vip-level">绿满筐会员</p>
|
<p class="vip-validity">长期有效</p>
|
</view>
|
|
<!-- 会员标识装饰 -->
|
<view class="vip-badge">
|
<text class="badge-text">尊享特权</text>
|
</view>
|
</view>
|
|
</view>
|
<!-- 积分,优惠券,关注, -->
|
<div class="pointBox box">
|
<u-row text-align="center" gutter="16" class="point">
|
<u-col text-align="center" span="4" @click="navigateTo('/pages/mine/deposit/operation')">
|
<view>预存款</view>
|
<view class="money">{{ walletNum | unitPrice }}</view>
|
</u-col>
|
|
<u-col text-align="center" span="4" @click="navigateTo('/pages/cart/coupon/myCoupon')">
|
<view>优惠券</view>
|
<view>{{ couponNum || 0 }}</view>
|
</u-col>
|
|
<u-col text-align="center" span="4" @click="navigateTo('/pages/mine/myTracks')">
|
<view>足迹</view>
|
<view>{{ footNum || 0 }}</view>
|
</u-col>
|
</u-row>
|
<!-- 我的订单,代付款 -->
|
<view class="order">
|
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=1')">
|
<div class="bag bag2">
|
<u-icon name="bag-fill" size="35" color="#fff"></u-icon>
|
</div>
|
<view>待付款</view>
|
</view>
|
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=3')">
|
<div class="bag bag3">
|
<u-icon name="car-fill" size="35" color="#fff"></u-icon>
|
</div>
|
<view>待收货</view>
|
</view>
|
<view class="order-item" @click="navigateTo('/pages/order/evaluate/myEvaluate')">
|
<div class="bag bag4">
|
<u-icon name="star-fill" size="35" color="#fff"></u-icon>
|
</div>
|
<view>待评价</view>
|
</view>
|
<view class="order-item" @click="navigateTo('/pages/order/afterSales/afterSales')">
|
<div class="bag bag5">
|
<u-icon name="server-fill" size="35" color="#fff"></u-icon>
|
</div>
|
<view>售后</view>
|
</view>
|
<view class="order-item" @click="navigateTo('/pages/order/myOrder?status=0')">
|
<div class="bag bag1">
|
<u-icon name="order" size="35" color="#fff"></u-icon>
|
</div>
|
<view>我的订单</view>
|
</view>
|
</view>
|
</div>
|
|
<!-- 视频相关, -->
|
<div class="pointBox box" style="margin-top: 20rpx;">
|
<view class="order">
|
<view class="order-item" @click="jumpToVideoHome()">
|
<view>
|
<text class="iconfont"></text>
|
</view>
|
<view>视频主页</view>
|
</view>
|
<view class="order-item" @click="navigateTo('/pages/mine/myAttention')">
|
<view>
|
<text class="iconfont"></text>
|
</view>
|
<view>关注列表</view>
|
</view>
|
<!-- <view class="order-item" @click="navigateTo('/pages/mine/myCollect/myCollect')">
|
<view>
|
<text class="iconfont"></text>
|
</view>
|
<view>收藏列表</view>
|
</view -->
|
<view class="order-item" @click="navigateTo('/pages/mine/activity/myActivity')">
|
<view>
|
<text class="iconfont"></text>
|
</view>
|
<view>我的活动</view>
|
</view>
|
<view class="order-item" @click="navigateTo('/pages/mine/myTracks')">
|
<view>
|
<text class="iconfont"></text>
|
</view>
|
<view>浏览记录</view>
|
</view>
|
</view>
|
</div>
|
|
<!-- 常用工具 -->
|
<view class="pointBox box" style="margin-top: 20rpx;">
|
<tool />
|
</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,bindMemberAndStore } from "@/api/members.js";
|
import { getUserWallet } from "@/api/members";
|
import configs from '@/config/config'
|
import storage from '@/utils/storage.js'
|
export default {
|
components: {
|
tool
|
},
|
data() {
|
return {
|
endpoint: '',
|
configs,
|
userImage:configs.defaultUserPhoto,
|
coverTransform: "translateY(0px)",
|
coverTransition: "0s",
|
moving: false,
|
userInfo: {},
|
couponNum: "",
|
footNum: "",
|
walletNum: "",
|
};
|
},
|
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() || {};
|
if (this.$options.filters.isLogin("auth")) {
|
this.getUserOrderNum();
|
} else {
|
this.walletNum = 0;
|
this.couponNum = 0;
|
this.footNum = 0;
|
}
|
},
|
onPullDownRefresh() {
|
this.getUserOrderNum();
|
this.userInfo = this.$options.filters.isLogin();
|
},
|
// #ifndef MP
|
onNavigationBarButtonTap(e) {
|
const index = e.index;
|
if (index === 0) {
|
this.navigateTo("/pages/mine/set/setUp");
|
}
|
},
|
// #endif
|
|
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临时访问凭证
|
getSTSToken().then(res => {
|
this.endpoint = res.data.data.endpoint
|
})
|
},
|
// 跳转视频主页
|
jumpToVideoHome() {
|
uni.navigateTo({
|
url: '/pages/video/home-page?authorId=' + storage.getUserInfo().id
|
});
|
},
|
/**
|
* 统一跳转接口,拦截未登录路由
|
* navigator标签现在默认没有转场动画,所以用view
|
*/
|
navigateTo(url) {
|
uni.navigateTo({
|
url,
|
});
|
},
|
userDetail() {
|
this.userInfo.id
|
? this.navigateTo("/pages/mine/set/personMsg")
|
: this.$options.filters.navigateToLogin();;
|
},
|
async getUserOrderNum() {
|
uni.stopPullDownRefresh();
|
|
Promise.all([
|
getCouponsNum(), //优惠券
|
getFootprintNum(), //浏览数量
|
getUserWallet(), //预存款
|
]).then((res) => {
|
this.couponNum = res[0].data.result;
|
this.footNum = res[1].data.result;
|
this.walletNum = res[2].data.result.memberWallet;
|
});
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
@import url("/pages/subComponents/static/bgStyle.css");
|
html,
|
body {
|
overflow: auto;
|
}
|
|
.member-gradient-bg {
|
width: 98%;
|
height: 250rpx;
|
margin: 1% 1%;
|
background: linear-gradient(135deg, #FF7A45 0%, #FF5252 100%);
|
border-radius: 24rpx;
|
box-shadow: 0 8rpx 30rpx rgba(255, 82, 82, 0.3);
|
transition: all 0.3s ease;
|
|
&:active {
|
transform: scale(0.98);
|
}
|
}
|
/* 内容区域 */
|
.member-content {
|
width: 100%;
|
height: 100%;
|
display: flex;
|
align-items: center;
|
padding: 0 40rpx;
|
box-sizing: border-box;
|
}
|
/* 会员信息 */
|
.vip-info {
|
flex: 1;
|
.vip-level {
|
font-size: 40rpx;
|
font-weight: bold;
|
color: #FFFFFF;
|
margin: 0;
|
line-height: 1;
|
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
|
}
|
|
.vip-validity {
|
font-size: 26rpx;
|
color: rgba(255, 255, 255, 0.9);
|
margin: 10rpx 0 0 0;
|
}
|
}
|
|
/* 会员图标 */
|
.vip-icon {
|
width: 100rpx;
|
height: 100rpx;
|
margin-right: 30rpx;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
background-color: rgba(255, 255, 255, 0.2);
|
border-radius: 50%;
|
}
|
|
.vip-icon image {
|
width: 60rpx;
|
height: 60rpx;
|
}
|
/* 特权标识 */
|
.vip-badge {
|
padding: 8rpx 20rpx;
|
background-color: rgba(255, 215, 0, 0.9);
|
border-radius: 30rpx;
|
box-shadow: 0 3rpx 6rpx rgba(0, 0, 0, 0.1);
|
}
|
|
.badge-text {
|
font-size: 24rpx;
|
color: #E63946;
|
font-weight: 600;
|
}
|
|
.money {
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
}
|
|
.user {
|
background: #e7e7e7;
|
.header {
|
max-width: 100%;
|
padding: calc(50rpx + var(--status-bar-height)) 30rpx 0 6%;
|
height: calc(360rpx);
|
background-size: cover;
|
border-bottom-left-radius: 30rpx;
|
border-bottom-right-radius: 30rpx;
|
background-image: var(--main-bg);
|
background-position: bottom;
|
background-repeat: no-repeat;
|
color: #ffffff;
|
display: flex;
|
justify-content: space-between;
|
|
.head-1 {
|
text-align: center;
|
width: 152rpx;
|
position: relative;
|
display: flex;
|
align-items: center;
|
|
image {
|
width: 152rpx;
|
height: 144rpx;
|
border-radius: 50%;
|
margin-bottom: 30rpx;
|
border: 3px solid #fff;
|
}
|
|
.edti-head {
|
position: absolute;
|
width: 40rpx;
|
height: 40rpx;
|
border-radius: 50%;
|
background-color: rgba(255, 255, 255, 0.3);
|
top: 100rpx;
|
right: 0;
|
|
image {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
}
|
|
.head-2 {
|
flex: 1;
|
margin-left: 30rpx;
|
margin-top: 100rpx;
|
line-height: 1;
|
}
|
|
/deep/ .u-icon,
|
.u-icon {
|
margin-top: 106rpx;
|
}
|
}
|
|
.point {
|
text-align: center;
|
height: 160rpx;
|
|
font-size: $font-sm;
|
// #ifdef MP-WEIXIN
|
padding: 24rpx;
|
|
// #endif
|
.u-col {
|
view {
|
color: $u-main-color;
|
font-size: 28rpx;
|
}
|
|
view:last-child {
|
margin-top: 8rpx;
|
color: $main-color;
|
font-size: $font-lg;
|
}
|
}
|
}
|
|
.order {
|
height: 140rpx;
|
text-align: center;
|
font-size: $font-sm;
|
display: flex;
|
justify-content: space-around;
|
align-items: center;
|
padding: 0 3%;
|
color: #666;
|
background: #fff;
|
border-radius: 20rpx;
|
box-shadow: 0 4rpx 24rpx 0 #f6f6f6;
|
margin: 0 20rpx;
|
|
.order-item {
|
position: relative;
|
line-height: 2em;
|
width: 96rpx;
|
|
:first-child {
|
font-size: 48rpx;
|
margin-bottom: 12rpx;
|
color: #333;
|
}
|
}
|
}
|
|
}
|
|
.box {
|
width: 95%;
|
margin: auto;
|
background: #fff;
|
border-radius: 20rpx;
|
box-shadow: 0 4rpx 24rpx 0 #f6f6f6;
|
}
|
|
.user-name {
|
font-size: 34rpx;
|
}
|
|
.bag {
|
width: 56rpx;
|
height: 56rpx;
|
border-radius: 50%;
|
margin: 0 auto;
|
}
|
|
.bag1 {
|
background: #ff4a48;
|
}
|
|
.bag2 {
|
background: #ff992f;
|
}
|
|
.bag3 {
|
background: #009ee0;
|
}
|
|
.bag4 {
|
background: #00d5d5;
|
}
|
|
.bag5 {
|
background: #28ccb0;
|
}
|
</style>
|