123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591 |
- <template>
- <view class="container">
- <view class="vheigh"></view>
- <scroll-view class="content-box" scroll-y="true">
- <view class="user-section">
- <view class="user-info-box ">
- <view class="detail flex">
- <view class="portrait-box" @click="navTo('/pages/set/userinfo')">
- <image class="portrait" :src="user.avatar || '/static/error/missing-face.png'"></image>
- </view>
- <view class="info-box">
- <view class="username flex-start">
- <text class="clamp padding-r-20">
- {{ user.nickname || '游客' }}
- </text>
- <image v-if="user.level>0" class="tipLevel flex-shrink-false"
- :src="`../../static/image/level${user.level-1}.png`" mode="heightFix"></image>
- </view>
- <view class="flex-start flex">
- <view class="authentication"
- @click="navTo('/pages/user/realName/realNameAuthentication')"
- v-if="userInfo.is_real==0||!userInfo.is_real">未实名认证</view>
- <view class="authentication success" v-else>已认证</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="cover-container">
- <view class="tj-sction">
- <view class="tj-item" @click="navTo('./money/wallet')">
- <text class="num">{{ user.now_money || '0.00' }}</text>
- <text>余额</text>
- </view>
- <view v-if="fx" class="tj-item" @click="navTo('/pages/user/award/award')">
- <text class="num">{{ user.brokerage_price || '0.00' }}</text>
- <text>佣金</text>
- </view>
- <!-- <view class="tj-item" @click="navTo('/pages/index/route')">
- <text class="num">{{ user.record_sum || '0' }}</text>
- <text>行程</text>
- </view> -->
- <view class="tj-item" @click="navTo('/pages/index/notice')">
- <text class="num">{{ notic|| '0' }}</text>
- <text>消息</text>
- </view>
- </view>
- <!-- 订单 -->
- <view class="item-box">
- <view class="box-title flex">
- <view class="title"><text>我的订单</text></view>
- <!-- <view class="link" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover">
- <text>全部订单</text>
- <text class="iconfont iconenter"></text>
- </view> -->
- </view>
- <view class="order-section">
- <view class="order-item" @click="navTo('/pages/order/order?state=3')" hover-class="common-hover"
- :hover-stay-time="50">
- <view class=" icon position-relative">
- <image class="icon-img" src="../../static/icon/userIconAll.png" mode="aspectFit">
- </image>
- <!-- <view class="corner" v-if="orderInfo.unshipped_count > 0">
- <text>{{ orderInfo.unshipped_count }}</text>
- </view> -->
- </view>
- <text>已完成</text>
- </view>
- <view class="order-item" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover"
- :hover-stay-time="50">
- <view class=" icon position-relative">
- <image class="icon-img" src="../../static/icon/userIconPay.png" mode="aspectFit">
- </image>
- <view class="corner" v-if="user.unpaid_count > 0">
- <text>{{ user.unpaid_count }}</text>
- </view>
- </view>
- <text>待付款</text>
- </view>
- <view class="order-item" @click="navTo('/pages/order/order?state=2')" hover-class="common-hover"
- :hover-stay-time="50">
- <view class="icon position-relative">
- <image class="icon-img" src="../../static/icon/userIconGet.png" mode="aspectFit">
- </image>
- <view class="corner" v-if="user.received_count > 0">
- <text>{{ user.received_count }}</text>
- </view>
- </view>
- <text>待收货</text>
- </view>
- <view class="order-item" @click="navTo('/pages/order/orderAfter?state=0')"
- hover-class="common-hover" :hover-stay-time="50">
- <view class="icon position-relative">
- <image class="icon-img" src="../../static/icon/userIconout.png" mode="aspectFit">
- </image>
- <!-- <view class="corner" v-if="orderInfo.complete_count > 0">
- <text>{{ orderInfo.complete_count }}</text>
- </view> -->
- </view>
- <text>售后</text>
- </view>
- </view>
- </view>
- <view class="listBox">
- <view class="list">
- <view class="flex listItem" @click="navTo('/pages/user/myCart/myCart')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/myCart.png" mode="widthFix"></image>
- <text class="title">我的车辆</text>
- </view>
- <view class="right flex">
- <text></text>
- <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
- </view>
- </view>
- <view class="flex listItem" @click="navTo('/pages/user/repair/userRepair')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/myWx.png" mode="widthFix"></image>
- <text class="title">维修历史</text>
- </view>
- <view class="right flex">
- <text></text>
- <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
- </view>
- </view>
- <view class="flex listItem" v-if="fx" @click="navTo('/pages/user/myteam')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/myitem.png" mode="widthFix"></image>
- <text class="title">我的团队</text>
- </view>
- <view class="right flex">
- <text></text>
- <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
- </view>
- </view>
- <view class="flex listItem" @click="navTo('/pages/set/address')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/myAddress.png" mode="widthFix">
- </image>
- <text class="title">我的地址</text>
- </view>
- <view class="right flex">
- <text></text>
- <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
- </view>
- </view>
- <!-- #ifndef APP -->
- <view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/myitem.png" mode="widthFix"></image>
- <text class="title">邀请好友</text>
- </view>
- <view class="right flex">
- <text></text>
- </view>
- </view>
- <!-- #endif -->
- <!-- #ifdef APP -->
- <view class="flex listItem" @click="shareDomApp">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/myitem.png" mode="widthFix"></image>
- <text class="title">邀请好友</text>
- </view>
- <view class="right flex">
- <text></text>
- </view>
- </view>
- <!-- #endif -->
- <!-- #ifndef MP -->
- <view class="flex listItem" @click="navTo('/pages/public/workwork')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/myServer.png" mode="widthFix"></image>
- <text class="title">关于我们</text>
- </view>
- <view class="right flex">
- <text></text>
- </view>
- </view>
- <!-- #endif -->
- <view class="flex listItem" @click="navTo('/pages/set/set')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/mySet.png" mode="widthFix"></image>
- <text class="title">设置</text>
- </view>
- <view class="right flex">
- <text></text>
- <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
- </view>
- </view>
- </view>
- </view>
- <view class="tapBottom" v-if='user.adminid' @click="changeTab">
- 前往商家界面
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- share
- } from '@/api/wx';
- import {
- getUser
- } from '@/api/user.js';
- import {
- articleList,
- notify
- } from '@/api/index.js';
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- export default {
- data() {
- return {
- user: {
- avatar: '', //头像
- nickname: '', //昵称
- now_money: 0, //余额
- brokerage_price: 0, //佣金
- record_sum: 0, //行程
- notice_sum: 0, //报警信息
- question_sum: 0, //系统消息
- // 订单数据类型
- orderStatusNum: {
- unpaid_count: 0, //待付款
- received_count: 0, //待收货
- },
- },
- shareData: {}
- };
- },
- computed: {
- ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
- ...mapState(['baseURL', 'urlFile']),
- ...mapState(['fx']),
- // 总消息条数
- notic() {
- return this.user.question_sum + this.user.notice_sum;
- },
- },
- onLoad() {
- share().then((res) => {
- this.shareData = res.data.data
- }).catch((res) => {
- console.log(res, '分享加载失败');
- })
- },
- onShow() {
- if (this.hasLogin) {
- this.loadBaseData();
- this.getUser();
- }
- },
- // 创建时获取分享信息
- methods: {
- loadBaseData() {
- getUserInfo({})
- .then(({
- data
- }) => {
- this.setUserInfo(data);
- // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
- orderData({})
- .then(({
- data
- }) => {
- this.setOrderInfo(data);
- })
- .catch(e => {
- this.setOrderInfo({
- complete_count: 0, //完成
- received_count: 0, //待收货
- unshipped_count: 0, //待发货
- order_count: 0, //订单总数
- unpaid_count: 0 //待付款
- });
- });
- })
- .catch(e => {
- console.log(e);
- });
- },
- //#ifdef APP
- shareDomApp() {
- uni.share({
- provider: 'weixin',
- type: 0,
- title: '绿津智能电动车',
- summary: '新一代智能电动车,手机开关锁、智能防盗、卫星定位,时刻掌握爱车位置。品牌大厂生产,质量好,款式多,售后优,所有车辆支持0元购新车!',
- imageUrl: this.shareData.img,
- href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
- })
- },
- //#endif
- // 获取用户数据
- getUser() {
- const that = this;
- getUser({}).then((e) => {
- this.user = e.data;
- }).catch((e) => {
- console.log(e);
- })
- // 系统消息
- articleList({}, 1).then((e) => {
- that.user.question_sum = e.data.count
- console.log(that, 1);
- }).catch((e) => {
- console.log(e);
- })
- // 报警消息
- notify().then((e) => {
- that.user.notice_sum = e.data.count
- }).catch((e) => {
- console.log(e);
- })
- },
- changeTab() {
- this.$emit('tab', true)
- },
- navTo(url) {
- if (!this.hasLogin) {
- // 保存地址
- saveUrl();
- // 登录拦截
- interceptor();
- } else {
- uni.navigateTo({
- url,
- fail(e) {
- console.log(e);
- }
- });
- }
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100%;
- }
- .tapBottom {
- margin: 0 50rpx;
- text-align: center;
- color: #FFFFFF;
- border: 1px solid $color-red;
- background-color: $color-red;
- line-height: 1;
- padding: 25rpx;
- border-radius: 100rpx;
- margin-top: 50rpx;
- }
- .listBox {
- margin-top: 20rpx;
- background-color: #FFFFFF;
- border-radius: 20rpx;
- overflow: hidden;
- }
- .list {
- .listItem {
- padding: 35rpx 40rpx;
- border-bottom: 1px solid $page-color-light;
- }
- .listIconImg {
- width: 36rpx;
- height: 36rpx;
- }
- .right {
- .img {
- width: 26rpx;
- }
- }
- .titleBox {
- .title {
- padding-left: 20rpx;
- color: $font-color-base;
- font-size: $font-base;
- }
- }
- }
- %flex-center {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- %section {
- display: flex;
- justify-content: space-around;
- align-content: center;
- border-radius: 10rpx;
- }
- .container {
- height: 100%;
- background-color: $page-color-base;
- }
- .content-box {
- height: 100%;
- }
- .vheigh {
- height: var(--status-bar-height);
- }
- .user-section {
- padding: 15rpx 30rpx 0;
- position: relative;
- }
- .user-info-box {
- height: 180rpx;
- color: white;
- display: flex;
- align-items: center;
- justify-content: space-between;
- position: relative;
- z-index: 1;
- .detail {
- height: 130rpx;
- flex-grow: 1;
- overflow: hidden;
- .portrait-box {
- height: 100%;
- .portrait {
- width: 130rpx;
- height: 100%;
- border: 5rpx solid #fff;
- border-radius: 50%;
- }
- }
- .info-box {
- margin-left: 20rpx;
- line-height: 1.5;
- flex-grow: 1;
- overflow: hidden;
- .tipLevel {
- height: 36rpx;
- margin-right: 20rpx;
- }
- .username {
- font-size: 40rpx;
- color: $font-color-dark;
- font-weight: bold;
- height: 100%;
- }
- .authentication {
- border: 2rpx solid #FF4241;
- border-radius: 20px;
- padding: 0 25rpx;
- font-size: 24rpx;
- color: #FF4241;
- float: left;
- &.success {
- border: 2rpx solid $color-green;
- color: $color-green;
- }
- }
- }
- }
- }
- .cover-container {
- padding: 0 30rpx;
- position: relative;
- padding-bottom: 20rpx;
- }
- .tj-sction {
- @extend %section;
- .tj-item {
- @extend %flex-center;
- flex-direction: column;
- height: 100rpx;
- font-size: $font-sm;
- color: $font-color-light;
- }
- .num {
- font-size: $font-base;
- color: $font-color-dark;
- margin-bottom: 8rpx;
- font-weight: bold;
- }
- }
- .item-box {
- border-radius: 20rpx;
- background-color: white;
- margin-top: 20rpx;
- .box-title {
- line-height: 1;
- padding: 30rpx;
- .title {
- font-size: $font-lg;
- font-weight: bold;
- }
- .link {
- font-size: $font-base - 2rpx;
- color: $font-color-light;
- }
- }
- .order-section {
- @extend %section;
- padding: 28rpx 0;
- padding-top: 0;
- .order-item {
- @extend %flex-center;
- width: 120rpx;
- height: 120rpx;
- border-radius: 10rpx;
- font-size: $font-sm;
- color: $font-color-dark;
- }
- .iconfont {
- font-size: 48rpx;
- margin-bottom: 18rpx;
- color: #fa436a;
- }
- .icon-shouhoutuikuan {
- font-size: 44rpx;
- }
- .icon {
- height: 50rpx;
- width: 48rpx;
- margin-bottom: 18rpx;
- background-size: 100%;
- background-repeat: no-repeat;
- background-position: center;
- .icon-img {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- .history-section {
- // padding: 30rpx 0 0;
- margin-top: 20rpx;
- background: #fff;
- border-radius: 10rpx;
- .h-list {
- white-space: nowrap;
- padding: 30rpx 30rpx 0;
- .h-list-image {
- display: inline-block;
- width: 160rpx;
- height: 160rpx;
- margin-right: 20rpx;
- border-radius: 10rpx;
- }
- }
- }
- </style>
|