Files
barter-app/pages/property/index.vue

666 lines
18 KiB
Vue

<template>
<view v-if='loding'>
<block v-if="this.$store.state.token != ''">
<!-- 用户信息 -->
<view class="user">
<view class="user-tool" @click="$Router.push({name:'Setting'})">
<image src="@/static/icons/user_icon_00.png" mode="widthFix" />
</view>
<view class="user-content">
<image class="info-cover" :src="base.avatar || require('@/static/images/boss.png')" mode="aspectFill" />
<view class="info-nickname">{{base.nickname}}</view>
<view class="info-signa">潮流就是我的态度</view>
<view class="info-tags" v-if="this.$store.state.token != ''">
<text class="info-tags-item identity" v-if="base.identity">{{base.identity.name}}</text>
<text class="info-tags-item vip" v-if="base.company_level.name">{{base.company_level.name }}</text>
</view>
</view>
<view class="user-tabs">
<view class="user-tabs-item" :class="{'show': tabsIndex === 0}" @click="tabsIndex = 0">管理中心</view>
<view class="user-tabs-item" :class="{'show': tabsIndex === 1}" @click="tabsIndex = 1">我的推广</view>
</view>
</view>
<!-- 消息 -->
<view class="user-ad" v-if="message.length > 0">
<uni-icons class="user-ad-icon" type="sound-filled" color="#e93340"></uni-icons>
<swiper class="user-ad-swiper" :interval="3000" autoplay vertical circular>
<swiper-item v-for="(item,index) in message" :key='index'>
<view class="user-ad-item">{{item}}</view>
</swiper-item>
</swiper>
</view>
<block v-if="tabsIndex === 0">
<!-- 我的资产 -->
<view class="user-group">
<view class="title">
<view class="title-text">我的资产</view>
</view>
<view class="group-flex group-flex-4">
<view class="item" @click="$Router.push({name:'Extract'})">
<view class="item-num">{{base.account.token}}</view>
<view class="item-title">原石</view>
</view>
<view class="item" @click="showToast">
<view class="item-num">{{base.account.contribution}}</view>
<view class="item-title">当前贡献值</view>
</view>
<view class="item" @click="$Router.push({name:'Eb'})">
<view class="item-num">{{base.account.eb}}</view>
<view class="item-title">当前易币</view>
</view>
<view class="item" @click="$Router.push({name:'ExtractRed'})">
<view class="item-num">{{base.account.money}}</view>
<view class="item-title">零钱</view>
</view>
</view>
</view>
<!-- 我的权证 -->
<view class="user-group">
<view class="title" >
<view class="title-text">我的权证</view>
</view>
<view class="group-flex group-flex-4">
<view class="item" @click="$Router.push({name:'NumberWeight'})">
<view class="item-num">{{count.warrnats}}</view>
<view class="item-title">权证持有</view>
</view>
<view class="item" @click="$Router.push({name: 'marketManag'})">
<view class="item-num">{{count.warrnat_transfer}}</view>
<view class="item-title">权证转让</view>
</view>
<view class="item" @click="$Router.push({name:'ServicesOrder'})">
<view class="item-num">{{count.shipment_fuwu_count}}</view>
<view class="item-title">已使用</view>
</view>
<view class="item" @click="$Router.push({name:'MallShipments'})">
<view class="item-num">{{count.shipment_goods_count}}</view>
<view class="item-title">已提货</view>
</view>
</view>
</view>
<!-- 我的权证 -->
<view class="user-group">
<view class="group-flex group-flex-4">
<view class="item" @click="$Router.push({name:'Collection'})">
<image class="item-cover" src="@/static/icons/user_icon_02.png" mode="aspectFill" />
<view class="item-title">收藏的企业</view>
</view>
<view class="item" @click="$Router.push({name:'CouponList'})">
<image class="item-cover" src="@/static/icons/user_icon_03.png" mode="aspectFill" />
<view class="item-title">我的优惠券</view>
</view>
<view class="item" @click="$Router.push({name:'HistoryShop'})">
<image class="item-cover" src="@/static/icons/user_icon_01.png" mode="aspectFill" />
<view class="item-title">我的足迹</view>
</view>
<view class="item" @click="$Router.push({name:'AddressList'})">
<image class="item-cover" src="@/static/icons/user_icon_04.png" mode="aspectFill" />
<view class="item-title">地址管理</view>
</view>
</view>
</view>
</block>
<block v-else-if="tabsIndex === 1">
<!-- 我的权证 -->
<view class="user-group">
<view class="title">
<view class="title-text">推广数据</view>
</view>
<view class="group-flex group-flex-2">
<view class="item">
<view class="item-num">{{relations.children}}</view>
<view class="item-title">推广人数</view>
</view>
<view class="item">
<view class="item-num">{{relations.company}}</view>
<view class="item-title">推广企业</view>
</view>
</view>
</view>
<!-- 排名信息 -->
<view class="user-group">
<view class="title">
<view class="title-text">推广排名</view>
</view>
<view class="ranking ranking-after">
<view class="ranking-title">
<view class="ranking-text">全站推广人数</view>
<view class="ranking-number">{{relations.childrenRank}}</view>
</view>
<image class="tips" src="../../static/icons/property_icon_00.png" mode="aspectFill" />
</view>
<view class="ranking">
<view class="ranking-title">
<view class="ranking-text">推广企业</view>
<view class="ranking-number">{{relations.companyRank}}</view>
</view>
<image class="tips" src="../../static/icons/property_icon_01.png" mode="aspectFill" />
</view>
</view>
<!-- 推广海报 -->
<view class="poster-text">推广海报</view>
<view class="code">
<image class="code-img-bg" src="/static/images/share_bg_3.png" mode="aspectFill" />
<image class='code-img' :src="shareCode" mode="widthFix" />
</view>
</block>
<!-- 版权信息 -->
<view class="copyright">易品新境 beta 1.0.0</view>
</block>
<block v-else>
<view class="statusBar">
<view class="statusBar-title">我的资产</view>
</view>
<view class="store-login">
<image class="icon" src="@/static/icons/login-icon.png" mode="widthFix"></image>
<view class="sub-title">一键开启您的易货之旅</view>
<button type="default" @click="login">登录</button>
</view>
</block>
</view>
</template>
<script>
import carousel from '@/components/vear-carousel/vear-carousel'
import { getUserInfo , appcode } from '@/apis/interfaces/mine'
import userAuth from '@/public/userAuth'
export default {
components: {
carousel
},
data() {
return {
tabsIndex : 0,
base : {
avatar : '',
nickname: '',
account : {
token : 0,
contribution: 0,
eb : 0,
money : 0
}
},
count : {
warrnats : 0,
warrnat_transfer : 0,
shipment_fuwu_count : 0,
shipment_goods_count: 0
},
relations : '',
message : [],
shareCode : '',
loding : false
}
},
onShow(){
if(this.$store.state.token != '') this.userInfo()
else this.loding = true
},
methods: {
// 获取用户的基本信息
userInfo(){
Promise.all([getUserInfo(), appcode()]).then(res => {
let userInfoData = res[0],
appcodeData = res[1]
this.base = userInfoData.base
this.count = userInfoData.count
this.message = userInfoData.message
this.relations = userInfoData.relations
this.shareCode = appcodeData.code
this.loding = true
}).catch(err => {
console.log(err)
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 努力开发中,,,
showToast(){
uni.showToast({
title: '努力开发中',
icon : 'none'
})
},
// 登录
login(){
let auth = new userAuth()
auth.Login().then(res => {
if(res.auth){
this.loding = false
this.userInfo()
}
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}
</script>
<style lang="scss" scoped>
// 登录提示
.store-login{
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 9;
background: white;
text-align: center;
@extend .vertical;
button{
margin-top: $margin*3;
display: inline-block;
width: 50%;
height: 90rpx;
line-height: 90rpx;
border-radius: $radius/2;
background: $text-price;
color: white;
font-weight: bold;
font-size: $title-size;
}
.sub-title{
color: $text-gray;
font-size: $title-size-m;
}
.icon{
width: 288rpx;
}
}
// 退出按钮
.out-login{
padding: 0 $padding;
button{
background: $text-price;
height: 90rpx;
line-height: 90rpx;
color: white;
font-size: $title-size;
border-radius: $radius;
font-weight: bold;
&::after{
border: none;
}
}
}
// 消息通知
.user-ad{
position: relative;
background: white;
margin: $margin;
border-radius: $radius;
line-height: 90rpx;
padding: 0 $padding;
font-size: $title-size-m;
.user-ad-icon{
position: absolute;
}
.user-ad-swiper{
height: 90rpx;
padding-left: 50rpx;
.user-ad-item{
color: $text-gray;
@extend .nowrap;
}
}
}
// 用户
.user{
.user-tool{
@extend .ios-top;
background: $text-price;
color: white;
padding-left: $padding;
padding-right: $padding;
padding-bottom: 200rpx;
line-height: 90rpx;
text-align: right;
font-size: $title-size-m;
image{
width: 58rpx;
}
}
.user-content{
margin: -140rpx $margin 0 $margin;
background: white;
border-radius: $radius;
text-align: center;
padding: 0 $padding ($padding + 50);
.info-cover{
width: 128rpx;
height: 128rpx;
border-radius: 50%;
border:solid 4rpx white;
margin-top: -64rpx;
box-sizing: border-box;
margin-bottom: $margin/2;
}
.info-nickname{
font-weight: bold;
font-size: $title-size + 4;
line-height: 50rpx;
}
.info-signa{
line-height: 50rpx;
color: $text-gray;
font-size: $title-size-sm;
}
.info-tags{
padding: ($padding/2) 0 0;
font-size: $title-size-sm - 2;
.info-tags-item{
background: $text-price;
color: white;
margin: 0 ($margin/2);
padding: 0 ($padding/2);
line-height: 40rpx;
display: inline-block;
border-radius: 20rpx;
&.identity{
background-image: linear-gradient(to right, #e75e44, #e93340);
}
&.vip{
background-image: linear-gradient(to right, #f8e5c0, #d6a46a);
color: #8d4928;
text-transform: uppercase;
}
}
}
}
.user-tabs{
margin-top: -33rpx;
text-align: center;
.user-tabs-item{
display: inline-block;
width: 240rpx;
height: 66rpx;
line-height: 66rpx;
text-align: center;
background-color: white;
border:solid 1rpx $border-color;
font-size: $title-size-m;
&.show{
background: $text-price;
color: white;
border-color: $text-price;
}
}
}
.user-total{
padding: $padding ($padding - 10);
display: flex;
.total-item{
position: relative;
margin: 0 ($margin/3);
text-align: center;
width: calc(33.33% - #{$margin - 10});
.total-number{
font-size: $title-size;
font-weight: bold;
line-height: 50rpx;
}
.total-text{
font-size: $title-size-sm;
line-height: 40rpx;
}
&::before{
position: absolute;
right: -($margin/3);
top: 25%;
height: 50%;
content: " ";
width: 1rpx;
background: #c2c4c1;
}
&:last-child::before{
display: none;
}
}
}
}
// 用户功能组
.user-group{
margin: $margin;
background: white;
border-radius: $radius;
.ranking {
width: 50%;
display: inline-block;
position: relative;
padding: $padding $padding - 10 $padding - 10 $padding;
box-sizing: border-box;
.ranking-title {
font-size: 28rpx;
.ranking-text {
margin-bottom: $margin - 10;
}
.ranking-number {
font-weight: 600;
font-size: 30rpx;
}
}
.tips {
position: absolute;
right: 30rpx;
top: 25rpx;
width: 90rpx;
height: 90rpx;
}
}
.ranking-after::after {
position: absolute;
content: '';
right: 0;
top: 0;
width: 2rpx;
height: 100%;
background-color: $border-color;
}
.title{
padding: $padding $padding ($padding - 10);
display: flex;
justify-content: space-between;
border-bottom: solid 1rpx $border-color;
align-items: center;
.title-text{
line-height: 40rpx;
font-size: $title-size;
}
.title-more{
height: 40rpx;
line-height: 40rpx;
font-size: $title-size-sm;
color: $text-gray-m;
}
.title-icon{
vertical-align: middle;
}
}
.group-flex{
display: flex;
padding: $padding - 10;
flex-wrap: wrap;
.item{
margin: $padding / 3;
text-align: center;
}
}
}
.poster-text {
margin: $margin + 10 0 0;
text-align: center;
}
.code{
width: 700rpx;
height: 400rpx;
background-color: red;
margin: 25rpx;
position: relative;
.code-img-bg{
width: 100%;
height: 100%;
}
.code-img{
width: 220rpx;
position: absolute;
left: 30rpx;
top: 50%;
margin-top: -90rpx;
}
}
// 易货订单
.order-flex{
.item{
width: calc(25% - #{$padding - 10});
.item-num{
font-weight: bold;
font-size: $title-size;
}
.item-cover{
width: 72rpx;
height: 72rpx;
vertical-align: top;
margin-bottom: 10rpx;
}
.item-title{
font-size: $title-size-sm - 2;
color: $text-gray-m;
line-height: 40rpx;
}
}
}
// 工具内容
.group-flex-4{
@extend .order-flex;
.item{
width: calc(25% - #{$padding - 10});
}
}
.group-flex-3{
@extend .order-flex;
.item{
width: calc(33.33% - #{$padding - 10});
}
}
.group-flex-2{
@extend .order-flex;
.item{
width: calc(50% - #{$padding - 10});
}
}
// 易品新境
.copyright{
padding: $padding 0 ($padding * 2);
text-align: center;
font-size: $title-size-sm;
color: $text-gray-m;
}
// Bar
.statusBar{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 99;
background: $text-price;
@extend .ios-top;
.statusBar-box{
min-height: 90rpx;
position: relative;
padding: $padding $padding $padding ($padding + 88);
color: white;
.logo{
position: absolute;
left: $padding;
width: 94rpx;
height: 94rpx;
border-radius: 50%;
border: 4rpx solid #ed8483;
box-sizing: border-box;
box-shadow: 0 4rpx 15rpx rgba(109,1,0,.8);
}
.company{
width: calc(100% - 94rpx);
padding-left: 30rpx;
box-sizing: border-box;
.name{
line-height: 40rpx;
@extend .nowrap;
font-size: $title-size;
.name-img {
width: 30rpx;
height: 30rpx;
margin: 7rpx 0 0 15rpx;
}
}
.tool {
display: flex;
margin-top: 13rpx;
.faith{
line-height: 40rpx;
height: 38rpx;
@extend .nowrap;
font-size: 24rpx;
background-color: rgba(0,0,0,.15);
padding: 0 15rpx;
border-radius: 60rpx;
margin-right: 30rpx;
display: flex;
.faith-img {
width: 28rpx;
height: 28rpx;
margin: 5rpx 4rpx 0 0;
}
}
.btn{
line-height: 40rpx;
height: 38rpx;
font-size: 24rpx;
padding: 0 15rpx 0 30rpx;
background-color: #913335;
display: inline-block;
border-radius: 0 60rpx 60rpx 0;
position: relative;
text-transform: uppercase;
.btn-img {
position: absolute;
width: 38rpx;
height: 38rpx;
left: -20rpx;
top: 0;
}
}
}
}
}
.statusBar-title{
line-height: 88rpx;
min-height: 88rpx;
color: white;
text-align: center;
font-weight: bold;
}
}
.content{
padding-top: calc(var(--status-bar-height) + #{$padding * 2} + 65rpx);
padding-bottom: $padding;
}
</style>