lilishop-uniapp/pages/tabbar/user/my.vue

317 lines
7.4 KiB
Vue
Raw Permalink Normal View History

2021-05-13 11:03:32 +08:00
<template>
<view class="user">
<!-- 个人信息 -->
<view class="status_bar">
<!-- 这里是状态栏 -->
</view>
<view class="header" @click="userDetail">
2021-05-13 11:03:32 +08:00
<view class="head-1">
<image :src="userInfo.face || userImage"></image>
2021-05-13 11:03:32 +08:00
</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>
2021-07-05 15:26:44 +08:00
<u-icon style="display: flex;align-items: flex-start;" name="arrow-right"></u-icon>
2021-05-13 11:03:32 +08:00
</view>
<!-- 积分优惠券关注 -->
2021-07-05 15:26:44 +08:00
<div class="pointBox box">
2021-05-13 11:03:32 +08:00
<u-row text-align="center" gutter="16" class="point">
<u-col text-align="center" span="4" @click="navigateTo('/pages/mine/deposit/operation')">
2021-05-13 11:03:32 +08:00
<view>预存款</view>
2022-12-27 14:17:00 +08:00
<view class="money">{{ walletNum | unitPrice }}</view>
2021-05-13 11:03:32 +08:00
</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>
2021-07-05 15:26:44 +08:00
<!-- 我的订单代付款 -->
<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>
2021-07-05 15:26:44 +08:00
</view>
2022-12-27 14:17:00 +08:00
<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>
2021-05-13 11:03:32 +08:00
</view>
2021-07-05 15:26:44 +08:00
</div>
2021-05-13 11:03:32 +08:00
<!-- 常用工具 -->
<tool />
2021-05-13 11:03:32 +08:00
</view>
</template>
<script>
import tool from "@/pages/tabbar/user/utils/tool.vue";
import { getCouponsNum, getFootprintNum } from "@/api/members.js";
2021-07-05 15:26:44 +08:00
import { getUserWallet } from "@/api/members";
import configs from '@/config/config'
2021-05-13 11:03:32 +08:00
export default {
components: {
tool,
},
data() {
return {
configs,
userImage:configs.defaultUserPhoto,
2021-05-13 11:03:32 +08:00
coverTransform: "translateY(0px)",
coverTransition: "0s",
moving: false,
userInfo: {},
couponNum: "",
footNum: "",
walletNum: "",
};
},
2022-12-27 14:17:00 +08:00
onLoad() { },
2021-05-13 11:03:32 +08:00
onShow() {
this.userInfo = this.$options.filters.isLogin() || {};
2021-05-13 11:03:32 +08:00
if (this.$options.filters.isLogin("auth")) {
this.getUserOrderNum();
} else {
this.walletNum = 0;
this.couponNum = 0;
this.footNum = 0;
2021-05-13 11:03:32 +08:00
}
},
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
2022-12-27 14:17:00 +08:00
mounted() { },
2021-05-13 11:03:32 +08:00
methods: {
/**
* 统一跳转接口,拦截未登录路由
* navigator标签现在默认没有转场动画所以用view
*/
navigateTo(url) {
uni.navigateTo({
2021-05-13 11:03:32 +08:00
url,
});
},
userDetail() {
this.userInfo.id
? this.navigateTo("/pages/mine/set/personMsg")
: this.$options.filters.navigateToLogin();;
2021-05-13 11:03:32 +08:00
},
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>
html,
body {
overflow: auto;
}
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.money {
overflow: hidden;
2021-07-05 15:26:44 +08:00
2021-05-13 11:03:32 +08:00
text-overflow: ellipsis;
white-space: nowrap;
}
2021-07-05 15:26:44 +08:00
2021-05-13 11:03:32 +08:00
.user {
.header {
max-width: 100%;
2021-07-05 15:26:44 +08:00
padding: calc(50rpx + var(--status-bar-height)) 30rpx 0 6%;
2021-05-13 11:03:32 +08:00
height: calc(var(--status-bar-height) + 360rpx);
background-size: cover;
2021-07-05 15:26:44 +08:00
border-bottom-left-radius: 30rpx;
border-bottom-right-radius: 30rpx;
background-image: url("/static/img/main-bg.png");
2021-05-13 11:03:32 +08:00
background-position: bottom;
background-repeat: no-repeat;
color: #ffffff;
display: flex;
justify-content: space-between;
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.head-1 {
text-align: center;
2021-07-02 17:58:49 +08:00
width: 152rpx;
2021-05-13 11:03:32 +08:00
position: relative;
2021-07-02 17:58:49 +08:00
display: flex;
align-items: center;
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
image {
2021-07-02 17:58:49 +08:00
width: 152rpx;
2021-05-13 11:03:32 +08:00
height: 144rpx;
border-radius: 50%;
margin-bottom: 30rpx;
border: 3px solid #fff;
}
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.edti-head {
position: absolute;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.3);
top: 100rpx;
right: 0;
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
image {
width: 100%;
height: 100%;
}
}
}
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.head-2 {
flex: 1;
margin-left: 30rpx;
2021-07-02 17:58:49 +08:00
margin-top: 100rpx;
line-height: 1;
2021-05-13 11:03:32 +08:00
}
2022-12-27 14:17:00 +08:00
2021-07-02 17:58:49 +08:00
/deep/ .u-icon,
2021-05-13 11:03:32 +08:00
.u-icon {
2021-07-02 17:58:49 +08:00
margin-top: 106rpx;
2021-05-13 11:03:32 +08:00
}
}
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.pointBox {
width: 94%;
margin: 0 3%;
background: #fff;
2021-07-05 15:26:44 +08:00
border-radius: 20rpx;
box-shadow: 0 4rpx 24rpx 0 rgba($color: #f6f6f6, $alpha: 1);
2021-05-13 11:03:32 +08:00
}
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.point {
text-align: center;
height: 160rpx;
2021-07-05 15:26:44 +08:00
2021-05-13 11:03:32 +08:00
font-size: $font-sm;
// #ifdef MP-WEIXIN
padding: 24rpx;
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
// #endif
.u-col {
2021-07-05 15:26:44 +08:00
view {
2021-05-13 11:03:32 +08:00
color: $u-main-color;
font-size: 28rpx;
}
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
view:last-child {
margin-top: 8rpx;
color: $main-color;
font-size: $font-lg;
}
}
}
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.order {
height: 140rpx;
text-align: center;
font-size: $font-sm;
display: flex;
justify-content: space-around;
align-items: center;
padding: 0 3%;
color: #999;
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.order-item {
position: relative;
line-height: 2em;
width: 96rpx;
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
:first-child {
font-size: 48rpx;
margin-bottom: 10rpx;
}
}
}
}
2021-07-05 15:26:44 +08:00
.box {
transform: translateY(-30rpx);
}
2022-12-27 14:17:00 +08:00
2021-05-13 11:03:32 +08:00
.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>