551 lines
14 KiB
Vue
551 lines
14 KiB
Vue
<template>
|
|
<view class="user" :style="[background]">
|
|
<!-- #ifndef H5 -->
|
|
<u-sticky offset-top="0" h5-nav-height="0" bg-color="transparent">
|
|
<u-navbar :is-back="false" title="个人中心" :title-bold="true" :is-fixed="false" :border-bottom="false"
|
|
:background="{ background: 'rgba(256,256, 256,' + navBg + ')' }"
|
|
:title-color="navBg > 0.5 ? '#000' : '#fff'"></u-navbar>
|
|
</u-sticky>
|
|
<!-- #endif -->
|
|
<view class="header">
|
|
<view class="hd-wrap bg-white">
|
|
<view class="user-info flex row-between">
|
|
<router-link to="/bundle/pages/user_profile/user_profile">
|
|
<view class="info flex">
|
|
<image class="avatar m-r-20 flex-none"
|
|
:src="isLogin ? userInfo.avatar : aliOSSDomain + 'uniapp/portrait_empty.png'" />
|
|
<view v-if="isLogin">
|
|
<view class="name flex">
|
|
<view class="xxl bold line-2">{{userInfo.nickname}}</view>
|
|
<view class="level br60 m-l-10 flex-none flex" v-if="userInfo.vip">
|
|
<text class="m-r-10">
|
|
<text class="v xxl m-r-4">v</text>
|
|
<text class="xxs">{{userInfo.vip}}</text>
|
|
</text>
|
|
<text class="xxs">{{userInfo.level_name}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="flex m-t-10" v-if="userInfo.sn">
|
|
<view class="user-id xs m-r-20">会员ID: {{userInfo.sn}}</view>
|
|
<view class="xs primary row-center m-l-5" @tap.stop="onCopy">复制</view>
|
|
</view>
|
|
</view>
|
|
<view v-else>
|
|
<view style="font-size: 42rpx">点击登录</view>
|
|
<view class="sm m-t-10 lighter">登录体验更多功能</view>
|
|
</view>
|
|
</view>
|
|
</router-link>
|
|
<view class="flex m-l-20">
|
|
<router-link to="/bundle/pages/user_profile/user_profile">
|
|
<view class="user-opt">
|
|
<image style="width:58rpx;height: 58rpx;"
|
|
:src="aliOSSDomain + 'uniapp/icon_my_setting.png'">
|
|
</image>
|
|
</view>
|
|
</router-link>
|
|
</view>
|
|
</view>
|
|
<view class="user-assets flex m-t-20 m-b-20">
|
|
<router-link class="user-assests-item" to="/bundle/pages/user_wallet/user_wallet">
|
|
<view class="flex-col col-center">
|
|
<view class="xl primary">
|
|
{{userInfo.user_money || 0}}
|
|
</view>
|
|
<view class="sm m-t-10 bold">
|
|
余额
|
|
</view>
|
|
</view>
|
|
</router-link>
|
|
|
|
<router-link v-if="userInfo.xp_price_state == 2" class="user-assests-item"
|
|
to="/bundle/pages/account_limit/account_limit">
|
|
<view class="flex-col col-center">
|
|
<view class="xl primary">
|
|
{{userInfo.xy_price || 0}}
|
|
</view>
|
|
<view class="sm m-t-10 bold">
|
|
授信额度
|
|
</view>
|
|
</view>
|
|
</router-link>
|
|
|
|
<router-link v-if="appConfig.show_my_refund == 1" class="user-assests-item"
|
|
to="/bundle_b/pages/subsidy_shop/subsidy_shop">
|
|
<view class="flex-col col-center">
|
|
<view class="refund-badge">
|
|
<view v-if="userInfo.unread_billions" class="badge xs flex row-center bg-white">
|
|
{{userInfo.unread_billions > 99 ? '99+' : userInfo.unread_billions}}
|
|
</view>
|
|
<image :src="appConfig.my_refund_image"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">
|
|
{{appConfig.my_refund_name}}
|
|
</view>
|
|
</view>
|
|
</router-link>
|
|
|
|
<router-link v-if="appConfig.show_my_promotion == 1" class="user-assests-item"
|
|
to="/bundle/pages/user_spread/user_spread">
|
|
<view class="flex-col col-center">
|
|
<view>
|
|
<image :src="appConfig.my_promotion_image"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">
|
|
{{appConfig.my_promotion_name}}
|
|
</view>
|
|
</view>
|
|
</router-link>
|
|
|
|
<!-- <router-link class="user-assests-item" to="/bundle/pages/user_collection/user_collection">
|
|
<view class="flex-col col-center">
|
|
<view class="xl primary">
|
|
{{userInfo.collect || 0}}
|
|
</view>
|
|
<view class="sm m-t-10">
|
|
收藏
|
|
</view>
|
|
</view>
|
|
</router-link>
|
|
<router-link class="user-assests-item" to="/bundle/pages/user_coupon/user_coupon">
|
|
<view class="flex-col col-center">
|
|
<view class="xl primary">
|
|
{{userInfo.coupon || 0}}
|
|
</view>
|
|
<view class="sm m-t-10">
|
|
优惠券
|
|
</view>
|
|
</view>
|
|
</router-link> -->
|
|
|
|
<!-- <router-link v-if="userInfo.xp_price_state == 0 || userInfo.xp_price_state == 1 || userInfo.xp_price_state == 3" class="user-assests-item" to="/bundle/pages/credit_payment/credit_payment">
|
|
<view class="flex-col col-center">
|
|
<view class="xl primary">
|
|
<text v-if="userInfo.xp_price_state == 0 || userInfo.xp_price_state == 3">去审核</text>
|
|
<text v-if="userInfo.xp_price_state == 1">待审核</text>
|
|
</view>
|
|
<view class="sm m-t-10">
|
|
申请信用
|
|
</view>
|
|
</view>
|
|
</router-link> -->
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="server-nav bg-white" v-if="menuList && menuList.length > 0">
|
|
<view>
|
|
<view class="title flex row-between">
|
|
<view class="lg bold">我的功能</view>
|
|
</view>
|
|
</view>
|
|
<view class="nav flex flex-wrap">
|
|
<view v-for="(item, index) in menuList" :key="index" class="item flex-col col-center m-b-20"
|
|
style="width: 20%;" @tap="menuJump(item)">
|
|
<image class="nav-icon" :src="item.image"></image>
|
|
<view class="sm m-t-10 bold">{{item.name}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="order-nav bg-white">
|
|
<router-link to="/bundle/pages/user_order/user_order">
|
|
<view class="title flex row-between">
|
|
<view class="lg bold">我的订单</view>
|
|
<view class="muted sm row bold">
|
|
全部订单
|
|
<u-icon name="arrow-right" size="28rpx" />
|
|
</view>
|
|
</view>
|
|
</router-link>
|
|
<view class="nav flex">
|
|
<router-link class="item" :to="{path: '/bundle/pages/user_order/user_order',query:{type: 'pay'}}">
|
|
<view class="flex-col col-center m-b-20">
|
|
<view class="icon-contain">
|
|
<view v-if="userInfo.wait_pay" class="badge xs flex row-center bg-white">
|
|
{{userInfo.wait_pay}}
|
|
</view>
|
|
<image class="nav-icon"
|
|
:src="aliOSSDomain + 'uniapp/icon_my_payment.png'"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">待付款</view>
|
|
</view>
|
|
</router-link>
|
|
<router-link class="item" to="/bundle/pages/user_order/user_order?type=delivery">
|
|
<view class="flex-col col-center m-b-20">
|
|
<view class="icon-contain">
|
|
<view v-if="userInfo.wait_delivery" class="badge xs flex row-center bg-white">
|
|
{{userInfo.wait_delivery}}
|
|
</view>
|
|
<image class="nav-icon m-b-10"
|
|
:src="aliOSSDomain + 'uniapp/icon_my_fahuo.png'"></image>
|
|
</view>
|
|
<view class="sm bold">待发货</view>
|
|
</view>
|
|
</router-link>
|
|
<router-link class="item" to="/bundle/pages/user_order/user_order?type=delivery">
|
|
<view class="flex-col col-center m-b-20">
|
|
<view class="icon-contain">
|
|
<view v-if="userInfo.wait_take" class="badge xs flex row-center bg-white">
|
|
{{userInfo.wait_take}}
|
|
</view>
|
|
<image class="nav-icon"
|
|
:src="aliOSSDomain + 'uniapp/icon_my_shouhuo.png'"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">待收货</view>
|
|
</view>
|
|
</router-link>
|
|
<router-link class="item" to="/bundle/pages/user_comment/user_comment">
|
|
<view class="flex-col col-center m-b-20">
|
|
<view class="icon-contain">
|
|
<view v-if="userInfo.wait_comment" class="badge xs flex row-center bg-white">
|
|
{{userInfo.wait_comment}}
|
|
</view>
|
|
<image class="nav-icon"
|
|
:src="aliOSSDomain + 'uniapp/icon_my_pingjia.png'"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">商品评价</view>
|
|
</view>
|
|
</router-link>
|
|
<router-link class="item" to="/bundle/pages/after_sales/after_sales">
|
|
<view class="flex-col col-center m-b-20">
|
|
<view class="icon-contain">
|
|
<view v-if="userInfo.after_sale" class="badge xs flex row-center bg-white">
|
|
{{userInfo.after_sale}}
|
|
</view>
|
|
<image class="nav-icon"
|
|
:src="aliOSSDomain + 'uniapp/icon_my_shouhou.png'"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">退款/售后</view>
|
|
</view>
|
|
</router-link>
|
|
<router-link class="item" to="/bundle_b/pages/my_order/my_order">
|
|
<view class="flex-col col-center m-b-20">
|
|
<view class="icon-contain">
|
|
<view v-if="userInfo.after_sale" class="badge xs flex row-center bg-white">
|
|
{{userInfo.after_sale}}
|
|
</view>
|
|
<image class="nav-icon"
|
|
src="https://dlh.hainings.com/uploads/images/20240523164511214f81779.png"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">我的订单</view>
|
|
</view>
|
|
</router-link>
|
|
<router-link class="item" to="/bundle/pages/user_address/user_address">
|
|
<view class="flex-col col-center m-b-20">
|
|
<view class="icon-contain">
|
|
<view v-if="userInfo.after_sale" class="badge xs flex row-center bg-white">
|
|
{{userInfo.after_sale}}
|
|
</view>
|
|
<image class="nav-icon"
|
|
src="https://dlh.hainings.com/uploads/images/202106231653409334c6907.png"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">收货地址</view>
|
|
</view>
|
|
</router-link>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="order-nav bg-white">
|
|
<view class="title flex row-between">
|
|
<view class="lg bold">我的工具</view>
|
|
</view>
|
|
<view class="nav flex">
|
|
<router-link class="item" :to="{path: item.url}" v-for="(item, index) in toolsList" :key="index">
|
|
<view class="flex-col col-center m-b-20">
|
|
<view class="icon-contain">
|
|
<view v-if="userInfo.wait_pay" class="badge xs flex row-center bg-white">
|
|
{{userInfo.wait_pay}}
|
|
</view>
|
|
<image class="nav-icon"
|
|
:src="item.image"></image>
|
|
</view>
|
|
<view class="sm m-t-10 bold">{{item.name}}</view>
|
|
</view>
|
|
</router-link>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="m-20">
|
|
<active-area :list="newGoods" :price-type="priceType" type="new" title="新品推荐" url="/pages/active_list/active_list?type=new"></active-area>
|
|
</view>
|
|
<tabbar></tabbar>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import MescrollCompMixin from "@/components/mescroll-uni/mixins/mescroll-comp";
|
|
import {
|
|
mapGetters,
|
|
mapActions
|
|
} from 'vuex'
|
|
import {
|
|
getMenu,
|
|
getTools,
|
|
getNewGoods
|
|
} from '@/api/store'
|
|
import {
|
|
toLogin
|
|
} from '@/utils/login'
|
|
import {
|
|
menuJump,
|
|
copy
|
|
} from '@/utils/tools'
|
|
import Cache from '@/utils/cache'
|
|
const app = getApp()
|
|
export default {
|
|
mixins: [MescrollCompMixin],
|
|
data() {
|
|
return {
|
|
showNav: false,
|
|
navBg: 0,
|
|
menuList: [],
|
|
toolsList: [],
|
|
newGoods: [],
|
|
priceType: 0
|
|
};
|
|
},
|
|
|
|
onLoad(options) {
|
|
this.getMenuFun()
|
|
this.getToolsFun()
|
|
this.getNewGoodsFun()
|
|
},
|
|
|
|
onShow() {
|
|
this.$store.commit("setPid", 0);
|
|
this.$store.commit("setSetId", 0);
|
|
this.getUser();
|
|
this.getCartNum()
|
|
},
|
|
|
|
onPageScroll(e) {
|
|
const top = uni.upx2px(100)
|
|
const {
|
|
scrollTop
|
|
} = e
|
|
let percent = scrollTop / top > 1 ? 1 : scrollTop / top
|
|
this.navBg = percent
|
|
},
|
|
onPullDownRefresh() {
|
|
this.getUser().then(() => {
|
|
uni.stopPullDownRefresh()
|
|
})
|
|
this.getMenuFun()
|
|
this.getNewGoodsFun()
|
|
},
|
|
methods: {
|
|
...mapActions(['getCartNum', 'getUser']),
|
|
goLogin() {
|
|
let {
|
|
isLogin
|
|
} = this;
|
|
if (isLogin) {
|
|
uni.navigateTo({
|
|
url: '/bundle/pages/user_profile/user_profile'
|
|
});
|
|
return;
|
|
}
|
|
uni.navigateTo({
|
|
url: '/pages/login/login'
|
|
});
|
|
},
|
|
|
|
goPage(url) {
|
|
if (!this.isLogin) return toLogin()
|
|
uni.navigateTo({
|
|
url
|
|
});
|
|
},
|
|
async getNewGoodsFun() {
|
|
const {
|
|
code,
|
|
data
|
|
} = await getNewGoods({type: 'recommend'});
|
|
if (code == 1) {
|
|
this.newGoods = data
|
|
}
|
|
},
|
|
async getMenuFun() {
|
|
const {
|
|
data,
|
|
code
|
|
} = await getMenu({
|
|
type: 2,
|
|
})
|
|
if (code == 1) {
|
|
this.menuList = data
|
|
}
|
|
},
|
|
async getToolsFun() {
|
|
const {data,code} = await getTools()
|
|
if (code == 1) {
|
|
this.toolsList = data
|
|
}
|
|
},
|
|
onCopy(e) {
|
|
copy(this.userInfo.sn)
|
|
},
|
|
menuJump(item) {
|
|
menuJump(item)
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters(["userInfo", "inviteCode", 'appConfig']),
|
|
background() {
|
|
const {
|
|
center_setting
|
|
} = this.appConfig
|
|
return center_setting.top_bg_image ? {
|
|
'background-image': `url(${center_setting.top_bg_image})`
|
|
} : {}
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.badge {
|
|
padding: 0 6rpx;
|
|
min-width: 28rpx;
|
|
height: 28rpx;
|
|
border-radius: 28rpx;
|
|
box-sizing: border-box;
|
|
border: 1rpx solid $-color-primary;
|
|
color: $-color-primary;
|
|
position: absolute;
|
|
left: 33rpx;
|
|
top: -10rpx;
|
|
z-index: 2;
|
|
}
|
|
|
|
.user {
|
|
background-image: url(https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/my_topbg.png);
|
|
background-size: 100% auto;
|
|
background-repeat: no-repeat;
|
|
|
|
.header {
|
|
margin: 0 20rpx;
|
|
padding-top: 20rpx;
|
|
|
|
.hd-wrap {
|
|
padding-bottom: 20rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.user-info {
|
|
padding: 30rpx;
|
|
|
|
.avatar {
|
|
height: 110rpx;
|
|
width: 110rpx;
|
|
border-radius: 50%;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.name {
|
|
text-align: left;
|
|
margin-bottom: 5rpx;
|
|
}
|
|
|
|
.user-id {
|
|
border: $-solid-border;
|
|
border-radius: 100rpx;
|
|
padding: 2rpx 15rpx;
|
|
}
|
|
|
|
.user-opt {
|
|
position: relative;
|
|
|
|
.dot {
|
|
position: absolute;
|
|
background-color: #ee0a24;
|
|
border: 2rpx solid #FFFFFF;
|
|
color: $-color-primary;
|
|
border-radius: 28rpx;
|
|
top: 6rpx;
|
|
right: 0rpx;
|
|
font-size: 22rpx;
|
|
min-width: 28rpx;
|
|
height: 28rpx;
|
|
padding: 0 6rpx;
|
|
}
|
|
}
|
|
|
|
.level {
|
|
background: #333;
|
|
padding: 0 15rpx;
|
|
color: #ffdea5;
|
|
line-height: 40rpx;
|
|
|
|
.v {
|
|
font-style: italic;
|
|
}
|
|
}
|
|
}
|
|
|
|
.user-assets {
|
|
flex: 1;
|
|
|
|
.user-assests-item {
|
|
flex: 1;
|
|
|
|
.refund-badge {
|
|
position: relative;
|
|
}
|
|
}
|
|
|
|
.xl {
|
|
height: 52rpx;
|
|
}
|
|
|
|
image {
|
|
width: 52rpx;
|
|
height: 52rpx;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
.order-nav {
|
|
.icon-contain {
|
|
position: relative;
|
|
}
|
|
}
|
|
|
|
.order-nav,
|
|
.my-assets {
|
|
margin: 20rpx 20rpx 0;
|
|
border-radius: 8rpx;
|
|
}
|
|
|
|
.server-nav {
|
|
margin: 20rpx;
|
|
border-radius: 8rpx;
|
|
}
|
|
|
|
.title {
|
|
height: 88rpx;
|
|
padding: 0 30rpx;
|
|
border-bottom: $-dashed-border;
|
|
}
|
|
|
|
.nav {
|
|
padding: 26rpx 0 0;
|
|
flex-wrap: wrap;
|
|
|
|
.assets-item {
|
|
flex: 1;
|
|
}
|
|
|
|
.item {
|
|
width: 25%;
|
|
}
|
|
|
|
.nav-icon {
|
|
width: 52rpx;
|
|
height: 52rpx;
|
|
}
|
|
}
|
|
}
|
|
</style> |