123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- <template>
- <view>
- <view class="header">
- <view class="info">
- <view class="avatar">
- <image :src="userInfo.avatar"></image>
- </view>
- <view class="text">
- <view class="name">{{userInfo.nickname}}<text>{{userInfo.levelname}}</text></view>
- <view>{{userInfo.mobile}}</view>
- </view>
- </view>
- <text @click="loginOut">退出</text>
- </view>
- <view class="money">
- <view class="balance">
- 账户余额(元)
- <view>{{userInfo.money}}</view>
- </view>
- <view>
- <navigator class="recharge" hover-class="none" url="/pages/users/recharge/index">充值</navigator>
- <navigator class="detail" hover-class="none" url="/pages/users/record/index?type=recharge">明细</navigator>
- </view>
- </view>
- <view class="order-wrapper">
- <view class="order-hd flex">
- <view class="left">我的订单</view>
- <navigator class="right flex" hover-class="none" url="/pages/users/order/index" open-type="navigate">
- 查看全部
- <text class="iconfont icon-xiangyou"></text>
- </navigator>
- </view>
- <view class="order-bd">
- <block v-for="(item,index) in orderMenu" :key="index">
- <navigator class="order-item" hover-class="none" :url="item.url">
- <view class="pic">
- <image :src="item.img" mode=""></image>
- <text class="order-status-num" v-if="item.num > 0">{{ item.num }}</text>
- </view>
- <view class="txt">{{item.title}}</view>
- </navigator>
- </block>
- </view>
- </view>
- <view class="menu">
- <view class="title">我的服务</view>
- <view class="list">
- <navigator class="item" url="/pages/users/spread/index" hover-class="none">
- <text class="iconfont icon-iconfontzhizuobiaozhun49"></text>
- <text>邀请好友</text>
- </navigator>
- <navigator class="item" url="/pages/users/record/index?type=consumption" hover-class="none">
- <text class="iconfont icon-xiaofeimingxi"></text>
- <text>消费明细</text>
- </navigator>
- <navigator class="item" url="/pages/users/commission/index" hover-class="none">
- <text class="iconfont icon-yongjinmingxi"></text>
- <text>佣金明细</text>
- </navigator>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from "vuex";
- import {
- toLogin
- } from '@/libs/login.js';
- import {
- getUserInfo,
- getOrder
- } from '@/api/api.js';
- export default {
- data() {
- return {
- userInfo: {},
- orderMenu: [
- {
- title: '待支付',
- img: '../../static/images/order1.png',
- url: '/pages/users/order/index?status=0',
- num: 0
- },
- {
- title: '打单中',
- img: '../../static/images/order2.png',
- url: '/pages/users/order/index?status=1',
- num: 0
- },
- {
- title: '已出单',
- img: '../../static/images/order3.png',
- url: '/pages/users/order/index?status=2',
- num: 0
- },
- {
- title: '异常',
- img: '../../static/images/order4.png',
- url: '/pages/users/order/index?status=9',
- num: 0
- },
- {
- title: '退货',
- img: '../../static/images/order5.png',
- url: '/pages/users/order/index?status=-2',
- num: 0
- }
- ],
- }
- },
- computed: mapGetters(['isLogin']),
- onLoad() {
- if (this.isLogin) {
- this.getUserInfo();
- this.getOrderData();
- }else{
- toLogin();
- }
- },
- methods: {
- getUserInfo: function() {
- let that = this;
- getUserInfo().then(res => {
- that.userInfo = res.data;
- });
- },
- //获取订单统计数据
- getOrderData: function() {
- let that = this;
- getOrder().then(res => {
- that.orderMenu.forEach((item, index) => {
- switch (item.title) {
- case '待支付':
- item.num = res.data.unpaid
- break
- case '打单中':
- item.num = res.data.inorder
- break
- case '已出单':
- item.num = res.data.sendOrder
- break
- case '异常':
- item.num = res.data.abnormalOrder
- break
- case '退货':
- item.num = res.data.refundOrder
- break
- }
- })
- })
- },
- loginOut: function() {
- let that = this;
- uni.showModal({
- title: '提示',
- content: '确定退出登录?',
- success: function (res) {
- if (res.confirm) {
- that.$store.commit("LOGOUT");
- uni.switchTab({
- url: '/pages/index/index'
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .header{
- display: flex;
- justify-content: space-between;
- height:360rpx;
- background: linear-gradient(90deg,#ff5c00 0,#FF464E);
- .info{
- display: flex;
- padding-top: 80rpx;
- padding-left: 25rpx;
- .avatar{
- width: 125rpx;
- height: 125rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 50%;
- border: 1px solid hsla(0,0%,100%,.5);
- image{
- width:110rpx;
- height:110rpx;
- border-radius: 50%;
- }
- }
- .text{
- color:#fff;
- padding-left: 20rpx;
- padding-top: 10rpx;
- .name{
- font-size: 36rpx;
- font-weight: bolder;
- margin-bottom: 10rpx;
- text{
- color: #fff;
- opacity: 0.8;
- font-size: 24rpx;
- border: 1px solid hsla(0,0%,100%,.6);
- border-radius: 30rpx;
- padding: 2rpx 15rpx;
- margin-left: 15rpx;
- }
- }
- }
- }
- text{
- color:#fff;
- padding-top: 80rpx;
- padding-right: 25rpx;
- }
- }
- .money{
- width:700rpx;
- margin-left: 25rpx;
- margin-top: -100rpx;
- background: #fff;
- border-radius: 20rpx;
- padding: 30rpx;
- display: flex;
- justify-content:space-between;
- .balance{
- font-size: 30rpx;
- view{
- font-size: 50rpx;
- font-weight: 600;
- color: #ff5c00;
- margin-top: 20rpx;
- }
- }
- .recharge{
- background: #ff5c00;
- color:#fff;
- font-size: 28rpx;
- text-align: center;
- border-radius: 30rpx;
- width:150rpx;
- height:60rpx;
- line-height: 60rpx;
- margin-bottom: 20rpx;
- }
- .detail{
- width:150rpx;
- height:60rpx;
- line-height: 60rpx;
- border: 1rpx solid #ebedf0;
- border-radius: 30rpx;
- font-size: 28rpx;
- text-align: center;
- }
- }
- .order-wrapper {
- width:700rpx;
- margin-left: 25rpx;
- background: #fff;
- border-radius: 15rpx;
- .order-hd {
- justify-content: space-between;
- padding: 25rpx 20rpx;
- margin-top: 25rpx;
- font-size: 30rpx;
- color: #282828;
- .right {
- align-items: center;
- color: #666666;
- font-size: 26rpx;
- .icon-xiangyou {
- margin-left: 5rpx;
- margin-top: 6rpx;
- font-size: 26rpx;
- }
- }
- }
- .order-bd {
- display: flex;
- .order-item {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 20%;
- height: 160rpx;
- .pic {
- position: relative;
- text-align: center;
- image {
- width: 70rpx;
- height: 70rpx;
- }
- }
- .txt {
- font-size: 26rpx;
- color: #454545;
- }
- }
- }
- }
- .menu{
- width:700rpx;
- margin: 25rpx;
- padding: 25rpx 20rpx;
- border-radius: 15rpx;
- background: #fff;
- .title{
- font-size: 30rpx;
- }
- .list{
- width:660rpx;
- overflow: hidden;
- .item{
- width:25%;
- float:left;
- text-align: center;
- margin-top: 30rpx;
- image{
- width:70rpx;
- height:70rpx;
- }
- text{
- display: block;
- color:#636363;
- }
- .iconfont{
- font-size: 70rpx;
- }
- }
- }
- }
- .order-status-num {
- min-width:12rpx;
- background-color: #fff;
- color: #ee5a52;
- border-radius: 15px;
- position: absolute;
- right:-12rpx;
- top: -10rpx;
- font-size: 20rpx;
- padding: 0 8rpx;
- border: 1px solid #ee5a52;
- }
- </style>
|